+
+ ` +
+ '$' +
+ `{Object.entries(params[0].value).map(kv => ` +
+ '`' +
+ `
` +
+ '$' +
+ `{kv[0]}:` +
+ '$' +
+ `{kv[1]}
` +
+ '`' +
+ `).join('')}
+
+ ` +
+ '`;' +
+ `
+ },
+ }
+})
+`
+
+// 添加【轮播列表】样式
+const addStyleString =
+ `
+// 组件样式作用域标识
+const scoped = this.subTree.scopeId
+function loadStyleString(css){
+ let style = document.createElement('style')
+ style.type = 'text/css'
+ style.appendChild(document.createTextNode(css))
+ let head = document.getElementsByTagName('head')[0]
+ head.appendChild(style)
+}
+loadStyleString(` +
+ '`' +
+ `
+.dv-scroll-board[` +
+ '$' +
+ `{scoped}] {
+ position: relative;
+ overflow: hidden;
+}
+.dv-scroll-board[` +
+ '$' +
+ `{scoped}]::before {
+ content: '';
+ display: block;
+ position: absolute;
+ top: -20%;
+ left: -100%;
+ width: 550px;
+ height: 60px;
+ transform: rotate(-45deg);
+ background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(255, 255, 255, 0.3), rgba(0, 0, 0, 0));
+ animation: cross 2s infinite;
+}
+@keyframes cross{
+ to{
+ top: 80%;
+ left: 100%;
+ transform: rotate(-45deg);
+ }
+}
+` +
+ '`' +
+ `)
+`
+
+// 修改地图原点大小
+const editMapPointString = `
+const chart = this.refs.vChartRef.chart
+// 定义地图原点大小 同理可自定义标签等等内容
+this.props.chartConfig.option.series[0].symbolSize = (val) => {
+ return Math.sqrt(val[2]) / 3;
+}
+this.setupState.vEchartsSetOption();
+let i = 0; // 当前轮播索引
+const len = 3; // 轮播部分提示
+(function showTips() {
+ const action = (type, dataIndex) => {
+ chart.dispatchAction({
+ type,
+ dataIndex,
+ seriesIndex: 0,
+ });
+ }
+ setInterval(() => {
+ action("downplay", i);
+ action("hideTip", i);
+ if (i === len) i = 0;
+ i++;
+ action("highlight", i);
+ action("showTip", i);
+ }, 2000);
+})()
+`
+
+export const templateList = [
+ {
+ description: '获取当前组件实例',
+ code: eTemplateString
+ },
+ {
+ description: '获取全局 echarts 实例',
+ code: echartsTemplateString
+ },
+ {
+ description: '获取组件图表集合',
+ code: componentsTemplateString
+ },
+ {
+ description: '获取 nodeModules 实例',
+ code: nodeModulesTemplateString
+ },
+ {
+ description: '获取远程 CDN 库',
+ code: importTemplateString
+ },
+ {
+ description: '修改图表 tooltip',
+ code: tooltipTemplateString
+ },
+ {
+ description: '添加【轮播列表】样式',
+ code: addStyleString
+ },
+ {
+ description: '修改【地图】圆点,新增提示自动轮播',
+ code: editMapPointString
+ }
+]
diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventMonacoEditor/index.ts b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventMonacoEditor/index.ts
new file mode 100644
index 00000000..b6d23e30
--- /dev/null
+++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventMonacoEditor/index.ts
@@ -0,0 +1,3 @@
+import ChartEventMonacoEditor from './index.vue'
+
+export { ChartEventMonacoEditor }
diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventMonacoEditor/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventMonacoEditor/index.vue
new file mode 100644
index 00000000..1865164d
--- /dev/null
+++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventMonacoEditor/index.vue
@@ -0,0 +1,285 @@
+
+
+
+
+
+
+
+
+
+ 编辑
+
+
+
+
+
+
+ async {{ eventName }} (e, components, echarts, node_modules) {
+
+
+
},
+
+
+
+
+
+
+
+
+
+ 高级事件编辑器(配合源码使用)
+
+
+
+
+
+
+
+
+ tips: {{ EventLifeTip[editTab] }}
+
+
+
+
+ async function
+ {{ eventName }}(e, components, echarts, node_modules) {
+
+
+
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+ {{ error.errorFn || '暂无' }}
+
+
+ {{ error.name || '暂无' }}
+
+
+ {{ error.message || '暂无' }}
+
+
+
+
+
+
+
+
+
+
+ 触发对应生命周期事件时接收的参数
+
+
+ 图表组件实例
+
+ {{
+ prop
+ }}
+
+
+ 当前大屏内所有组件的集合id 图表组件中的配置id,可以获取其他图表组件进行控制
+
+
+
+ 以下是内置在代码环境中可用的包变量
+
+ {{ pkg }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 提示
+
+ 通过提供的参数可为图表增加定制化的tooltip、交互事件等等
+
+
+
+ 取消
+ 保存
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue
new file mode 100644
index 00000000..e60a7731
--- /dev/null
+++ b/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue
@@ -0,0 +1,24 @@
+
+
+
+
+ 组件 id:
+ {{ targetData.id }}
+
+
+
+ 【单击、双击、移入、移出】尽情期待!
+
+
+
+
+
+
+
diff --git a/src/views/chart/ContentConfigurations/index.d.ts b/src/views/chart/ContentConfigurations/index.d.ts
index d17818aa..59ca5bcf 100644
--- a/src/views/chart/ContentConfigurations/index.d.ts
+++ b/src/views/chart/ContentConfigurations/index.d.ts
@@ -3,4 +3,5 @@ export enum TabsEnum {
CHART_SETTING = 'chartSetting',
CHART_ANIMATION = 'chartAnimation',
CHART_DATA = 'chartData',
+ CHART_EVENT = 'chartEvent'
}
diff --git a/src/views/chart/ContentConfigurations/index.vue b/src/views/chart/ContentConfigurations/index.vue
index c1b11b20..0f8a8609 100644
--- a/src/views/chart/ContentConfigurations/index.vue
+++ b/src/views/chart/ContentConfigurations/index.vue
@@ -75,12 +75,13 @@ const { getDetails } = toRefs(useChartLayoutStore())
const { setItem } = useChartLayoutStore()
const chartEditStore = useChartEditStore()
-const { ConstructIcon, FlashIcon, DesktopOutlineIcon, LeafIcon } = icon.ionicons5
+const { ConstructIcon, FlashIcon, DesktopOutlineIcon, LeafIcon, RocketIcon } = icon.ionicons5
const ContentEdit = loadAsyncComponent(() => import('../ContentEdit/index.vue'))
const CanvasPage = loadAsyncComponent(() => import('./components/CanvasPage/index.vue'))
const ChartSetting = loadAsyncComponent(() => import('./components/ChartSetting/index.vue'))
const ChartData = loadAsyncComponent(() => import('./components/ChartData/index.vue'))
+const ChartEvent = loadAsyncComponent(() => import('./components/ChartEvent/index.vue'))
const ChartAnimation = loadAsyncComponent(() => import('./components/ChartAnimation/index.vue'))
const collapsed = ref
(getDetails.value)
@@ -148,6 +149,12 @@ const chartsTabList = [
title: '数据',
icon: FlashIcon,
render: ChartData
+ },
+ {
+ key: TabsEnum.CHART_EVENT,
+ title: '事件',
+ icon: RocketIcon,
+ render: ChartEvent
}
]
diff --git a/src/views/chart/ContentEdit/components/EditBottom/index.vue b/src/views/chart/ContentEdit/components/EditBottom/index.vue
index 193f4b70..b3f1cbf3 100644
--- a/src/views/chart/ContentEdit/components/EditBottom/index.vue
+++ b/src/views/chart/ContentEdit/components/EditBottom/index.vue
@@ -135,9 +135,11 @@ watchEffect(() => {
diff --git a/src/views/preview/components/PreviewRenderGroup/index.vue b/src/views/preview/components/PreviewRenderGroup/index.vue
index 81790f63..422fd441 100644
--- a/src/views/preview/components/PreviewRenderGroup/index.vue
+++ b/src/views/preview/components/PreviewRenderGroup/index.vue
@@ -18,6 +18,7 @@
:themeSetting="themeSetting"
:themeColor="themeColor"
:style="{ ...getSizeStyle(item.attr) }"
+ v-on="useLifeHandler(item)"
>
@@ -27,7 +28,7 @@ import { PropType } from 'vue'
import { CreateComponentGroupType } from '@/packages/index.d'
import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils'
import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils'
-
+import { useLifeHandler } from '@/hooks'
const props = defineProps({
groupData: {
type: Object as PropType