diff --git a/package.json b/package.json
index a483412b..43b3f9c0 100644
--- a/package.json
+++ b/package.json
@@ -9,31 +9,32 @@
"postinstall": "husky install"
},
"dependencies": {
+ "@vicons/carbon": "^0.12.0",
+ "@vicons/ionicons5": "~0.11.0",
+ "@vueuse/core": "^7.7.1",
"animate.css": "^4.1.1",
"axios": "0.23.0",
"color": "^4.2.3",
"crypto-js": "^4.1.1",
+ "echarts": "^5.3.2",
"echarts-liquidfill": "^3.1.0",
"highlight.js": "^11.5.0",
"html2canvas": "^1.4.1",
"keymaster": "^1.6.2",
+ "lodash": "~4.17.21",
"monaco-editor": "^0.33.0",
"naive-ui": "2.30.3",
"pinia": "^2.0.13",
"screenfull": "^6.0.1",
+ "tiny-emitter": "^2.1.0",
"vue": "^3.2.31",
"vue-demi": "^0.13.1",
+ "vue-echarts": "^6.0.2",
"vue-i18n": "9.1.9",
"vue-router": "4.0.12",
"vue3-lazyload": "^0.2.5-beta",
"vue3-sketch-ruler": "^1.3.3",
- "vuedraggable": "^4.1.0",
- "@vueuse/core": "^7.7.1",
- "@vicons/carbon": "^0.12.0",
- "@vicons/ionicons5": "~0.11.0",
- "echarts": "^5.3.2",
- "vue-echarts": "^6.0.2",
- "lodash": "~4.17.21"
+ "vuedraggable": "^4.1.0"
},
"devDependencies": {
"@types/color": "^3.0.3",
@@ -68,4 +69,4 @@
"vite-plugin-monaco-editor": "^1.1.0",
"vue-tsc": "^0.28.10"
}
-}
\ No newline at end of file
+}
diff --git a/src/enums/eventEnum.ts b/src/enums/eventEnum.ts
new file mode 100644
index 00000000..2b61ca88
--- /dev/null
+++ b/src/enums/eventEnum.ts
@@ -0,0 +1,38 @@
+export enum EventType {
+ CLICK = 'click',
+ DBCLICK = 'dblclick',
+ CHANGE = 'change',
+ // MOUSE_ENTER = 'mouseenter',
+ // MOUSE_LEAVE = 'mouseleave',
+ MOUNTED = 'vnodeMounted',
+ // OTHER = 'other'
+}
+
+export const EventTypeTitle = {
+ [EventType.CLICK]: '点击',
+ [EventType.DBCLICK]: '双击',
+ [EventType.CHANGE]: '值变化',
+ // [EventType.MOUSE_ENTER]: '鼠标进入',
+ // [EventType.MOUSE_LEAVE]: '鼠标移开',
+ [EventType.MOUNTED]: '渲染完成',
+ // [EventType.OTHER]: '其它',
+}
+
+export enum EventTriggerType {
+ COMPONENT = 'component',
+ JAVASCRIPT = 'javascript'
+}
+
+export const EventTriggerTypeMap = new Map(
+ [
+ [EventTriggerType.COMPONENT, '组件联动'],
+ [EventTriggerType.JAVASCRIPT, '自定义js'],
+ ]
+)
+
+export const CommonEventMap = new Map(
+ [
+ ['forceUpdate', '强制更新'],
+ ]
+)
+
diff --git a/src/hooks/index.ts b/src/hooks/index.ts
index 16b0bb69..338bde00 100644
--- a/src/hooks/index.ts
+++ b/src/hooks/index.ts
@@ -1,4 +1,5 @@
export * from '@/hooks/useTheme.hook'
export * from '@/hooks/usePreviewScale.hook'
export * from '@/hooks/useCode.hook'
-export * from '@/hooks/useChartDataFetch.hook'
\ No newline at end of file
+export * from '@/hooks/useChartDataFetch.hook'
+export * from '@/hooks/useEventBus.hook'
\ No newline at end of file
diff --git a/src/hooks/useEventBus.hook.ts b/src/hooks/useEventBus.hook.ts
new file mode 100644
index 00000000..ece04e5c
--- /dev/null
+++ b/src/hooks/useEventBus.hook.ts
@@ -0,0 +1,67 @@
+import Emitter from 'tiny-emitter'
+import { onBeforeUnmount } from 'vue'
+
+
+/**
+ * {
+ * on: {
+ * [event]: []
+ * },
+ * }
+ */
+
+type EventBusListeners = {
+ [key: string]: () => any
+};
+
+export type EventBusOptions = {
+ on?: EventBusListeners
+ once?: EventBusListeners
+}
+
+
+//@ts-ignore
+const bus = new Emitter()
+
+const addListeners = (listeners: EventBusListeners | undefined, isOnce = false): void => {
+ if(!listeners) return
+ Object.keys(listeners).forEach(key => {
+ console.info('监听事件:', key)
+ bus[isOnce ? 'once' : 'on'](key, listeners[key])
+ onBeforeUnmount(() => {
+ bus.off(key, listeners[key])
+ })
+ })
+}
+
+
+// 转换事件名
+const convertListeners = (listeners: EventBusListeners, dst: object, prefix = 'prefix'): void => {
+ Object.keys(listeners).forEach((key: string) => {
+ // @ts-ignore
+ dst[`${prefix}:${key}`] = listeners[key]
+ })
+}
+
+export const convertEventBusListeners = (listeners: EventBusOptions, prefix: string): EventBusOptions => {
+ const res = {
+ on: {},
+ once: {},
+ }
+
+ if(listeners.on) {
+ convertListeners(listeners.on, res.on, prefix)
+ }
+
+ if(listeners.once) {
+ convertListeners(listeners.once, res.once, prefix)
+ }
+
+ return res
+}
+
+export const useEventBus = (listeners: EventBusOptions = {}) => {
+ addListeners(listeners.on);
+ addListeners(listeners.once, true)
+ return bus
+}
diff --git a/src/packages/components/Charts/Bars/BarCommon/index.ts b/src/packages/components/Charts/Bars/BarCommon/index.ts
index a4247970..46bd0e28 100644
--- a/src/packages/components/Charts/Bars/BarCommon/index.ts
+++ b/src/packages/components/Charts/Bars/BarCommon/index.ts
@@ -1,15 +1,14 @@
import image from '@/assets/images/chart/charts/bar_x.png'
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
+import { getComponentConfig } from '@/utils'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
-export const BarCommonConfig: ConfigType = {
+export const BarCommonConfig: ConfigType = getComponentConfig({
key: 'BarCommon',
- chartKey: 'VBarCommon',
- conKey: 'VCBarCommon',
title: '柱状图',
category: ChatCategoryEnum.BAR,
categoryName: ChatCategoryEnumName.BAR,
package: PackagesCategoryEnum.CHARTS,
chartFrame: ChartFrameEnum.ECHARTS,
image
-}
+})
diff --git a/src/packages/components/Informations/Texts/TextCommon/config.vue b/src/packages/components/Informations/Texts/TextCommon/config.vue
index 4988e9c4..447d82b2 100644
--- a/src/packages/components/Informations/Texts/TextCommon/config.vue
+++ b/src/packages/components/Informations/Texts/TextCommon/config.vue
@@ -62,7 +62,7 @@
\ No newline at end of file
diff --git a/src/views/chart/ContentConfigurations/index.vue b/src/views/chart/ContentConfigurations/index.vue
index 92ba612d..bb040a54 100644
--- a/src/views/chart/ContentConfigurations/index.vue
+++ b/src/views/chart/ContentConfigurations/index.vue
@@ -92,7 +92,8 @@ const {
ConstructIcon,
FlashIcon,
DesktopOutlineIcon,
- LeafIcon
+ LeafIcon,
+ RocketIcon
} = icon.ionicons5
const ContentEdit = loadAsyncComponent(() => import('../ContentEdit/index.vue'))
@@ -108,6 +109,9 @@ const ChartData = loadAsyncComponent(() =>
const ChartAnimation = loadAsyncComponent(() =>
import('./components/ChartAnimation/index.vue')
)
+const ChartEvent = loadAsyncComponent(() =>
+ import('./components/ChartEvent/index.vue')
+)
const collapsed = ref(getDetails.value)
@@ -164,6 +168,12 @@ const canvasTabList = [
title: '数据',
icon: FlashIcon,
render: ChartData
+ },
+ {
+ key: 'eventData',
+ title: '事件',
+ icon: RocketIcon,
+ render: ChartEvent
}
]
diff --git a/src/views/chart/ContentLayers/components/LayersListItem/index.vue b/src/views/chart/ContentLayers/components/LayersListItem/index.vue
index 97c09028..6a366c8b 100644
--- a/src/views/chart/ContentLayers/components/LayersListItem/index.vue
+++ b/src/views/chart/ContentLayers/components/LayersListItem/index.vue
@@ -22,7 +22,7 @@
+
+
\ No newline at end of file
diff --git a/src/views/preview/components/PreviewRenderList/index.vue b/src/views/preview/components/PreviewRenderList/index.vue
index 665ba487..f92a229f 100644
--- a/src/views/preview/components/PreviewRenderList/index.vue
+++ b/src/views/preview/components/PreviewRenderList/index.vue
@@ -10,13 +10,12 @@
...getTransformStyle(item.styles)
}"
>
-
+ :themeColor="themeColor">
+
@@ -26,6 +25,8 @@ import { ChartEditStorageType } from '../../index.d'
import { chartColors } from '@/settings/chartThemes/index'
import { animationsClass, getFilterStyle, getTransformStyle } from '@/utils'
import { getSizeStyle, getComponentAttrStyle } from '../../utils'
+import PreViewRenderItem from './PreViewRenderItem.vue'
+
const props = defineProps({
localStorageInfo: {