Commit 87d47feb5f2af91e6e7de3ca547818dd187ccd4d
Merge branch 'merge' into 'main'
update(*): 升级至V1.2.3 / V2.2.0(2023/03/16)版本 See merge request yunteng/thingskit-view!15
Showing
100 changed files
with
1308 additions
and
123 deletions
Too many changes to show.
To preserve performance only 100 of 111 files are displayed.
... | ... | @@ -25,6 +25,7 @@ specifiers: |
25 | 25 | color: ^4.2.3 |
26 | 26 | commitlint: ^17.0.2 |
27 | 27 | crypto-js: ^4.1.1 |
28 | + dayjs: ^1.11.7 | |
28 | 29 | default-passive-events: ^2.0.0 |
29 | 30 | dom-helpers: ^5.2.1 |
30 | 31 | echarts: ^5.3.2 |
... | ... | @@ -82,6 +83,7 @@ dependencies: |
82 | 83 | axios: 0.27.2 |
83 | 84 | color: 4.2.3 |
84 | 85 | crypto-js: 4.1.1 |
86 | + dayjs: 1.11.7 | |
85 | 87 | dom-helpers: 5.2.1 |
86 | 88 | echarts-liquidfill: 3.1.0_echarts@5.3.3 |
87 | 89 | echarts-stat: 1.2.0 |
... | ... | @@ -2008,6 +2010,10 @@ packages: |
2008 | 2010 | engines: {node: '>=0.11'} |
2009 | 2011 | dev: false |
2010 | 2012 | |
2013 | + /dayjs/1.11.7: | |
2014 | + resolution: {integrity: sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==} | |
2015 | + dev: false | |
2016 | + | |
2011 | 2017 | /debug/2.6.9: |
2012 | 2018 | resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} |
2013 | 2019 | peerDependencies: | ... | ... |
28 KB
17.5 KB
6.87 KB
... | ... | @@ -37,7 +37,6 @@ import { icon } from '@/plugins' |
37 | 37 | import { useUserStore } from '@/store/external/module/user' |
38 | 38 | const { ChatboxEllipsesIcon, PersonIcon, LogOutOutlineIcon, SettingsSharpIcon } = icon.ionicons5 |
39 | 39 | |
40 | - | |
41 | 40 | const t = window['$t'] |
42 | 41 | |
43 | 42 | const modelShowInfo = ref(false) | ... | ... |
1 | +<template> | |
2 | + <n-radio-group :value="props.modelValue || INHERIT_VALUE" @update:value="handleChange"> | |
3 | + <n-space> | |
4 | + <n-tooltip :show-arrow="false" trigger="hover" v-for="item in rendererList" :key="item.value"> | |
5 | + <template #trigger> | |
6 | + <n-radio :value="item.value"> | |
7 | + {{ item.value }} | |
8 | + </n-radio> | |
9 | + </template> | |
10 | + {{ item.desc }} | |
11 | + </n-tooltip> | |
12 | + </n-space> | |
13 | + </n-radio-group> | |
14 | +</template> | |
15 | +<script setup lang="ts"> | |
16 | +import { type EchartsRenderer } from '@/settings/chartThemes' | |
17 | + | |
18 | +const props = defineProps<{ modelValue?: EchartsRenderer; includeInherit?: boolean }>() | |
19 | +const emits = defineEmits(['update:modelValue']) | |
20 | + | |
21 | +const INHERIT_VALUE = 'inherit' | |
22 | + | |
23 | +const handleChange = (val: EchartsRenderer & typeof INHERIT_VALUE) => { | |
24 | + emits('update:modelValue', val === INHERIT_VALUE ? undefined : val) | |
25 | +} | |
26 | + | |
27 | +const rendererList = [ | |
28 | + { | |
29 | + value: 'svg', | |
30 | + desc: '在缩放场景下具有更好的表现' | |
31 | + }, | |
32 | + { | |
33 | + value: 'canvas', | |
34 | + desc: '数据量较大(经验判断 > 1k)、较多交互时,建议选择' | |
35 | + }, | |
36 | + ...(props.includeInherit | |
37 | + ? [ | |
38 | + { | |
39 | + value: INHERIT_VALUE, | |
40 | + desc: '默认继承全局配置' | |
41 | + } | |
42 | + ] | |
43 | + : []) | |
44 | +] | |
45 | +</script> | ... | ... |
1 | 1 | <template> |
2 | + <collapse-item name="渲染器"> | |
3 | + <setting-item-box :alone="true"> | |
4 | + <template #name> | |
5 | + <n-text>全局</n-text> | |
6 | + <n-tooltip trigger="hover"> | |
7 | + <template #trigger> | |
8 | + <n-icon size="21" :depth="3"> | |
9 | + <help-outline-icon></help-outline-icon> | |
10 | + </n-icon> | |
11 | + </template> | |
12 | + <n-text>所有echarts图表组件默认都将采用所选的渲染器进行渲染</n-text> | |
13 | + </n-tooltip> | |
14 | + </template> | |
15 | + <EchartsRendererSetting v-model="themeSetting.renderer" /> | |
16 | + </setting-item-box> | |
17 | + <setting-item-box :alone="true"> | |
18 | + <template #name> | |
19 | + <n-text>当前</n-text> | |
20 | + <n-tooltip trigger="hover"> | |
21 | + <template #trigger> | |
22 | + <n-icon size="21" :depth="3"> | |
23 | + <help-outline-icon></help-outline-icon> | |
24 | + </n-icon> | |
25 | + </template> | |
26 | + <n-text>仅当前组件采用指定渲染器渲染</n-text> | |
27 | + </n-tooltip> | |
28 | + </template> | |
29 | + <EchartsRendererSetting v-model="optionData.renderer" includeInherit /> | |
30 | + </setting-item-box> | |
31 | + </collapse-item> | |
2 | 32 | <collapse-item v-if="title" name="标题"> |
3 | 33 | <template #header> |
4 | 34 | <n-switch v-model:value="title.show" size="small"></n-switch> |
... | ... | @@ -283,6 +313,11 @@ import { PropType, computed } from 'vue' |
283 | 313 | import { GlobalThemeJsonType } from '@/settings/chartThemes/index' |
284 | 314 | import { axisConfig } from '@/packages/chartConfiguration/echarts/index' |
285 | 315 | import { CollapseItem, SettingItemBox, SettingItem, GlobalSettingPosition } from '@/components/Pages/ChartItemSetting' |
316 | +import { icon } from '@/plugins' | |
317 | +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | |
318 | +import EchartsRendererSetting from './EchartsRendererSetting.vue' | |
319 | + | |
320 | +const { HelpOutlineIcon } = icon.ionicons5 | |
286 | 321 | |
287 | 322 | const props = defineProps({ |
288 | 323 | optionData: { |
... | ... | @@ -296,6 +331,12 @@ const props = defineProps({ |
296 | 331 | } |
297 | 332 | }) |
298 | 333 | |
334 | +const chartEditStore = useChartEditStore() | |
335 | +const themeSetting = computed(() => { | |
336 | + const chartThemeSetting = chartEditStore.getEditCanvasConfig.chartThemeSetting | |
337 | + return chartThemeSetting | |
338 | +}) | |
339 | + | |
299 | 340 | const title = computed(() => { |
300 | 341 | return props.optionData.title |
301 | 342 | }) | ... | ... |
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | </div> |
37 | 37 | <div class="model-footer"> |
38 | 38 | 中国色列表来自于: |
39 | - <n-a href="http://zhongguose.com">http://zhongguose.com</n-a> | |
39 | + <n-a href="http://zhongguose.com" target="_blank">http://zhongguose.com</n-a> | |
40 | 40 | </div> |
41 | 41 | </div> |
42 | 42 | </n-modal> |
... | ... | @@ -157,6 +157,7 @@ $height: 85vh; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | .model-footer { |
160 | + z-index: 1; | |
160 | 161 | text-align: end; |
161 | 162 | } |
162 | 163 | } | ... | ... |
... | ... | @@ -7,15 +7,38 @@ export enum BaseEvent { |
7 | 7 | // 移入 |
8 | 8 | ON_MOUSE_ENTER = 'mouseenter', |
9 | 9 | // 移出 |
10 | - ON_MOUSE_LEAVE = 'mouseleave', | |
10 | + ON_MOUSE_LEAVE = 'mouseleave' | |
11 | +} | |
12 | + | |
13 | +// 组件交互回调事件 | |
14 | +export enum InteractEvents { | |
15 | + INTERACT_ON = 'interactOn', | |
16 | + INTERACT_COMPONENT_ID = 'interactComponentId', | |
17 | + INTERACT_FN = 'interactFn' | |
18 | +} | |
19 | + | |
20 | +// 全局组件交互回调事件触发的类型(当然可以自定义名称) | |
21 | +export enum InteractEventOn { | |
22 | + CLICK = 'click', | |
23 | + CHANGE = 'change' | |
24 | +} | |
25 | + | |
26 | +// 确定交互组件触发类型 key名称 | |
27 | +export const COMPONENT_INTERACT_EVENT_KET = 'componentInteractEventKey' | |
28 | + | |
29 | +// 交互式组件的触发配置 | |
30 | +export type InteractActionsType = { | |
31 | + interactType: InteractEventOn | |
32 | + interactName: string | |
33 | + componentEmitEvents: { [T: string]: { value: any; label: string }[] } | |
11 | 34 | } |
12 | 35 | |
13 | 36 | // vue3 生命周期事件 |
14 | -export enum EventLife { | |
37 | +export enum EventLife { | |
15 | 38 | // 渲染之后 |
16 | 39 | VNODE_MOUNTED = 'vnodeMounted', |
17 | 40 | // 渲染之前 |
18 | - VNODE_BEFORE_MOUNT = 'vnodeBeforeMount', | |
41 | + VNODE_BEFORE_MOUNT = 'vnodeBeforeMount' | |
19 | 42 | } |
20 | 43 | |
21 | 44 | // 内置字符串函数对象列表 | ... | ... |
... | ... | @@ -4,4 +4,5 @@ export * from '@/hooks/useCode.hook' |
4 | 4 | export * from '@/hooks/useChartDataFetch.hook' |
5 | 5 | export * from '@/hooks/useChartDataPondFetch.hook' |
6 | 6 | export * from '@/hooks/useLifeHandler.hook' |
7 | -export * from '@/hooks/useLang.hook' | |
\ No newline at end of file | ||
7 | +export * from '@/hooks/useLang.hook' | |
8 | +export * from '@/hooks/useChartInteract.hook' | |
\ No newline at end of file | ... | ... |
src/hooks/useCanvasInitOptions.hook.ts
0 → 100644
1 | +import { inject, type Ref } from 'vue' | |
2 | +import { EchartsRenderer } from '@/settings/chartThemes' | |
3 | +import { SCALE_KEY } from '@/views/preview/hooks/useScale.hook' | |
4 | +import { use } from 'echarts/core' | |
5 | +import { CanvasRenderer, SVGRenderer } from 'echarts/renderers' | |
6 | + | |
7 | +use([CanvasRenderer, SVGRenderer]) | |
8 | + | |
9 | +type InitOptions = { | |
10 | + renderer: EchartsRenderer | |
11 | + devicePixelRatio?: number | |
12 | +} | |
13 | + | |
14 | +// 获取需要给当前echarts组件设置什么初始值 | |
15 | +export function useCanvasInitOptions(option: any, themeSetting: any) { | |
16 | + const renderer = option.renderer || themeSetting.renderer | |
17 | + const initOptions: InitOptions = { renderer } | |
18 | + const scaleRef = inject<Ref<{ width: number; height: number }>>(SCALE_KEY) || { value: { width: 1, height: 1 } } | |
19 | + | |
20 | + if (renderer === 'canvas') { | |
21 | + initOptions.devicePixelRatio = Math.ceil( | |
22 | + Math.max(window.devicePixelRatio, scaleRef.value.width, scaleRef.value.height) | |
23 | + ) | |
24 | + } | |
25 | + return initOptions | |
26 | +} | ... | ... |
1 | -import { ref, toRefs, toRaw } from 'vue' | |
1 | +import { ref, toRefs, toRaw, watch } from 'vue' | |
2 | 2 | import type VChart from 'vue-echarts' |
3 | 3 | import { customizeHttp } from '@/api/http' |
4 | 4 | import { useChartDataPondFetch } from '@/hooks/' |
... | ... | @@ -87,8 +87,18 @@ export const useChartDataFetch = ( |
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | - // 立即调用 | |
91 | - fetchFn() | |
90 | + // 普通初始化与组件交互处理监听 | |
91 | + watch( | |
92 | + () => targetComponent.request, | |
93 | + () => { | |
94 | + fetchFn() | |
95 | + }, | |
96 | + { | |
97 | + immediate: true, | |
98 | + deep: true | |
99 | + } | |
100 | + ) | |
101 | + | |
92 | 102 | // 定时时间 |
93 | 103 | const time = targetInterval && targetInterval.value ? targetInterval.value : globalRequestInterval.value |
94 | 104 | // 单位 | ... | ... |
src/hooks/useChartInteract.hook.ts
0 → 100644
1 | +import { toRefs } from 'vue' | |
2 | +import { CreateComponentType } from '@/packages/index.d' | |
3 | +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | |
4 | + | |
5 | +// 获取类型 | |
6 | +type ChartEditStoreType = typeof useChartEditStore | |
7 | + | |
8 | +// Params 参数修改触发 api 更新图表请求 | |
9 | +export const useChartInteract = ( | |
10 | + chartConfig: CreateComponentType, | |
11 | + useChartEditStore: ChartEditStoreType, | |
12 | + param: { [T: string]: any }, | |
13 | + interactEventOn: string | |
14 | +) => { | |
15 | + const chartEditStore = useChartEditStore() | |
16 | + const { interactEvents } = chartConfig.events | |
17 | + const fnOnEvent = interactEvents.filter(item => { | |
18 | + return item.interactOn === interactEventOn | |
19 | + }) | |
20 | + | |
21 | + if (fnOnEvent.length === 0) return | |
22 | + fnOnEvent.forEach(item => { | |
23 | + const index = chartEditStore.fetchTargetIndex(item.interactComponentId) | |
24 | + if (index === -1) return | |
25 | + const { Params, Header } = toRefs(chartEditStore.componentList[index].request.requestParams) | |
26 | + Object.keys(item.interactFn).forEach(key => { | |
27 | + if (Params.value[key]) { | |
28 | + Params.value[key] = param[item.interactFn[key]] | |
29 | + } | |
30 | + if (Header.value[key]) { | |
31 | + Header.value[key] = param[item.interactFn[key]] | |
32 | + } | |
33 | + }) | |
34 | + }) | |
35 | +} | |
36 | + | |
37 | +// 联动事件触发的 type 变更时,清除当前绑定内容 | |
38 | +export const clearInteractEvent = (chartConfig: CreateComponentType) => { | |
39 | + | |
40 | +} | ... | ... |
1 | 1 | <template> |
2 | 2 | <v-chart |
3 | 3 | ref="vChartRef" |
4 | + :init-options="initOptions" | |
4 | 5 | :theme="themeColor" |
5 | 6 | :option="option" |
6 | 7 | :manual-update="isPreview()" |
... | ... | @@ -14,6 +15,7 @@ |
14 | 15 | <script setup lang="ts"> |
15 | 16 | import { ref, nextTick, computed, watch, PropType } from 'vue' |
16 | 17 | import VChart from 'vue-echarts' |
18 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
17 | 19 | import { use } from 'echarts/core' |
18 | 20 | import { CanvasRenderer } from 'echarts/renderers' |
19 | 21 | import { BarChart } from 'echarts/charts' |
... | ... | @@ -41,6 +43,8 @@ const props = defineProps({ |
41 | 43 | } |
42 | 44 | }) |
43 | 45 | |
46 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
47 | + | |
44 | 48 | use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent]) |
45 | 49 | |
46 | 50 | const replaceMergeArr = ref<string[]>() | ... | ... |
1 | 1 | <template> |
2 | 2 | <v-chart |
3 | 3 | ref="vChartRef" |
4 | + :init-options="initOptions" | |
4 | 5 | :theme="themeColor" |
5 | 6 | :option="option" |
6 | 7 | :manual-update="isPreview()" |
... | ... | @@ -14,6 +15,7 @@ |
14 | 15 | <script setup lang="ts"> |
15 | 16 | import { ref, nextTick, computed, watch, PropType } from 'vue' |
16 | 17 | import VChart from 'vue-echarts' |
18 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
17 | 19 | import { use } from 'echarts/core' |
18 | 20 | import { CanvasRenderer } from 'echarts/renderers' |
19 | 21 | import { BarChart } from 'echarts/charts' |
... | ... | @@ -40,6 +42,8 @@ const props = defineProps({ |
40 | 42 | } |
41 | 43 | }) |
42 | 44 | |
45 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
46 | + | |
43 | 47 | use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent]) |
44 | 48 | |
45 | 49 | const replaceMergeArr = ref<string[]>() | ... | ... |
1 | 1 | <template> |
2 | 2 | <v-chart |
3 | 3 | ref="vChartRef" |
4 | + :init-options="initOptions" | |
4 | 5 | :theme="themeColor" |
5 | 6 | :option="option" |
6 | 7 | :manual-update="isPreview()" |
... | ... | @@ -15,6 +16,7 @@ |
15 | 16 | <script setup lang="ts"> |
16 | 17 | import { PropType, computed, watch, ref, nextTick } from 'vue' |
17 | 18 | import VChart from 'vue-echarts' |
19 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
18 | 20 | import { use } from 'echarts/core' |
19 | 21 | import { CanvasRenderer } from 'echarts/renderers' |
20 | 22 | import { LineChart } from 'echarts/charts' |
... | ... | @@ -41,6 +43,8 @@ const props = defineProps({ |
41 | 43 | } |
42 | 44 | }) |
43 | 45 | |
46 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
47 | + | |
44 | 48 | use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent]) |
45 | 49 | |
46 | 50 | const replaceMergeArr = ref<string[]>() | ... | ... |
1 | 1 | <template> |
2 | - <v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize> | |
2 | + <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize> | |
3 | 3 | </v-chart> |
4 | 4 | </template> |
5 | 5 | |
6 | 6 | <script setup lang="ts"> |
7 | 7 | import { reactive, watch, PropType } from 'vue' |
8 | 8 | import VChart from 'vue-echarts' |
9 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
9 | 10 | import { use, graphic } from 'echarts/core' |
10 | 11 | import { CanvasRenderer } from 'echarts/renderers' |
11 | 12 | import { LineChart } from 'echarts/charts' |
... | ... | @@ -32,6 +33,8 @@ const props = defineProps({ |
32 | 33 | } |
33 | 34 | }) |
34 | 35 | |
36 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
37 | + | |
35 | 38 | use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent]) |
36 | 39 | const chartEditStore = useChartEditStore() |
37 | 40 | ... | ... |
1 | 1 | <template> |
2 | - <v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize></v-chart> | |
2 | + <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize></v-chart> | |
3 | 3 | </template> |
4 | 4 | |
5 | 5 | <script setup lang="ts"> |
6 | 6 | import { reactive, watch, PropType } from 'vue' |
7 | 7 | import VChart from 'vue-echarts' |
8 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
8 | 9 | import { use, graphic } from 'echarts/core' |
9 | 10 | import { CanvasRenderer } from 'echarts/renderers' |
10 | 11 | import { LineChart } from 'echarts/charts' |
... | ... | @@ -31,6 +32,8 @@ const props = defineProps({ |
31 | 32 | } |
32 | 33 | }) |
33 | 34 | |
35 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
36 | + | |
34 | 37 | use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent]) |
35 | 38 | const chartEditStore = useChartEditStore() |
36 | 39 | ... | ... |
1 | 1 | <template> |
2 | - <v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize> | |
2 | + <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize> | |
3 | 3 | </v-chart> |
4 | 4 | </template> |
5 | 5 | |
6 | 6 | <script setup lang="ts"> |
7 | 7 | import { PropType, watch, reactive } from 'vue' |
8 | 8 | import VChart from 'vue-echarts' |
9 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
9 | 10 | import { use } from 'echarts/core' |
10 | 11 | import { CanvasRenderer } from 'echarts/renderers' |
11 | 12 | import { LineChart } from 'echarts/charts' |
... | ... | @@ -32,6 +33,8 @@ const props = defineProps({ |
32 | 33 | } |
33 | 34 | }) |
34 | 35 | |
36 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
37 | + | |
35 | 38 | use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent]) |
36 | 39 | |
37 | 40 | const chartEditStore = useChartEditStore() | ... | ... |
1 | 1 | <template> |
2 | - <v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize> | |
2 | + <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize> | |
3 | 3 | </v-chart> |
4 | 4 | </template> |
5 | 5 | |
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | import { PropType, reactive, watch, ref, nextTick } from 'vue' |
8 | 8 | import config, { includes } from './config' |
9 | 9 | import VChart from 'vue-echarts' |
10 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
10 | 11 | import { use, registerMap } from 'echarts/core' |
11 | 12 | import { EffectScatterChart, MapChart } from 'echarts/charts' |
12 | 13 | import { CanvasRenderer } from 'echarts/renderers' |
... | ... | @@ -32,6 +33,8 @@ const props = defineProps({ |
32 | 33 | } |
33 | 34 | }) |
34 | 35 | |
36 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
37 | + | |
35 | 38 | use([ |
36 | 39 | MapChart, |
37 | 40 | DatasetComponent, | ... | ... |
1 | 1 | <template> |
2 | - <v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> | |
2 | + <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> | |
3 | 3 | </template> |
4 | 4 | |
5 | 5 | <script setup lang="ts"> |
6 | 6 | import { computed, PropType } from 'vue' |
7 | 7 | import VChart from 'vue-echarts' |
8 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
8 | 9 | import { use } from 'echarts/core' |
9 | 10 | import { CanvasRenderer } from 'echarts/renderers' |
10 | 11 | import { FunnelChart } from 'echarts/charts' |
... | ... | @@ -31,6 +32,8 @@ const props = defineProps({ |
31 | 32 | } |
32 | 33 | }) |
33 | 34 | |
35 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
36 | + | |
34 | 37 | use([DatasetComponent, CanvasRenderer, FunnelChart, GridComponent, TooltipComponent, LegendComponent]) |
35 | 38 | |
36 | 39 | const option = computed(() => { | ... | ... |
1 | 1 | <template> |
2 | - <v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> | |
2 | + <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> | |
3 | 3 | </template> |
4 | 4 | |
5 | 5 | <script setup lang="ts"> |
6 | 6 | import { ref, watch, computed, PropType } from 'vue' |
7 | 7 | import VChart from 'vue-echarts' |
8 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
8 | 9 | import dataJson from './data.json' |
9 | 10 | import { use } from 'echarts/core' |
10 | 11 | import { CanvasRenderer } from 'echarts/renderers' |
... | ... | @@ -38,6 +39,8 @@ const props = defineProps({ |
38 | 39 | } |
39 | 40 | }) |
40 | 41 | |
42 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
43 | + | |
41 | 44 | use([ |
42 | 45 | DatasetComponent, |
43 | 46 | CanvasRenderer, | ... | ... |
1 | 1 | <template> |
2 | - <v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> | |
2 | + <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> | |
3 | 3 | </template> |
4 | 4 | |
5 | 5 | <script setup lang="ts"> |
6 | 6 | import { ref, computed, PropType, watch } from 'vue' |
7 | 7 | import VChart from 'vue-echarts' |
8 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
8 | 9 | import dataJson from './data.json' |
9 | 10 | import { use } from 'echarts/core' |
10 | 11 | import { CanvasRenderer } from 'echarts/renderers' |
... | ... | @@ -32,6 +33,8 @@ const props = defineProps({ |
32 | 33 | } |
33 | 34 | }) |
34 | 35 | |
36 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
37 | + | |
35 | 38 | use([DatasetComponent, CanvasRenderer, RadarChart, GridComponent, TooltipComponent, LegendComponent]) |
36 | 39 | |
37 | 40 | const vChartRef = ref<typeof VChart>() | ... | ... |
1 | 1 | <template> |
2 | - <v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> | |
2 | + <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> | |
3 | 3 | </template> |
4 | 4 | |
5 | 5 | <script setup lang="ts"> |
6 | 6 | import { ref, computed, PropType, watch } from 'vue' |
7 | 7 | import VChart from 'vue-echarts' |
8 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
8 | 9 | import dataJson from './data.json' |
9 | 10 | import { use } from 'echarts/core' |
10 | 11 | import { CanvasRenderer } from 'echarts/renderers' |
... | ... | @@ -31,6 +32,8 @@ const props = defineProps({ |
31 | 32 | } |
32 | 33 | }) |
33 | 34 | |
35 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
36 | + | |
34 | 37 | use([CanvasRenderer, TreemapChart]) |
35 | 38 | |
36 | 39 | const vChartRef = ref<typeof VChart>() | ... | ... |
1 | 1 | <template> |
2 | - <v-chart :theme="themeColor" :option="option.value" autoresize></v-chart> | |
2 | + <v-chart :theme="themeColor" :init-options="initOptions" :option="option.value" autoresize></v-chart> | |
3 | 3 | </template> |
4 | 4 | |
5 | 5 | <script setup lang="ts"> |
6 | 6 | import { PropType, watch, reactive } from 'vue' |
7 | 7 | import VChart from 'vue-echarts' |
8 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
8 | 9 | import { use } from 'echarts/core' |
9 | 10 | import 'echarts-liquidfill/src/liquidFill.js' |
10 | 11 | import { CanvasRenderer } from 'echarts/renderers' |
... | ... | @@ -30,6 +31,8 @@ const props = defineProps({ |
30 | 31 | } |
31 | 32 | }) |
32 | 33 | |
34 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
35 | + | |
33 | 36 | use([CanvasRenderer, GridComponent]) |
34 | 37 | |
35 | 38 | const chartEditStore = useChartEditStore() | ... | ... |
1 | 1 | <template> |
2 | - <v-chart :theme="themeColor" :option="option.value" autoresize> </v-chart> | |
2 | + <v-chart :theme="themeColor" :init-options="initOptions" :option="option.value" autoresize> </v-chart> | |
3 | 3 | </template> |
4 | 4 | |
5 | 5 | <script setup lang="ts"> |
6 | 6 | import { PropType, reactive, watch } from 'vue' |
7 | 7 | import VChart from 'vue-echarts' |
8 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
8 | 9 | import { use } from 'echarts/core' |
9 | 10 | import { CanvasRenderer } from 'echarts/renderers' |
10 | 11 | import { PieChart } from 'echarts/charts' |
... | ... | @@ -29,6 +30,8 @@ const props = defineProps({ |
29 | 30 | } |
30 | 31 | }) |
31 | 32 | |
33 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
34 | + | |
32 | 35 | use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent, TitleComponent]) |
33 | 36 | |
34 | 37 | const option = reactive({ | ... | ... |
1 | 1 | <template> |
2 | - <v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> | |
2 | + <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> | |
3 | 3 | </template> |
4 | 4 | |
5 | 5 | <script setup lang="ts"> |
6 | 6 | import { computed, PropType, reactive, watch } from 'vue' |
7 | 7 | import VChart from 'vue-echarts' |
8 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
8 | 9 | import { use } from 'echarts/core' |
9 | 10 | import { CanvasRenderer } from 'echarts/renderers' |
10 | 11 | import { PieChart } from 'echarts/charts' |
... | ... | @@ -30,6 +31,8 @@ const props = defineProps({ |
30 | 31 | } |
31 | 32 | }) |
32 | 33 | |
34 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
35 | + | |
33 | 36 | use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent]) |
34 | 37 | |
35 | 38 | const option = computed(() => { | ... | ... |
1 | 1 | <template> |
2 | 2 | <v-chart |
3 | 3 | ref="vChartRef" |
4 | + :init-options="initOptions" | |
4 | 5 | :theme="themeColor" |
5 | 6 | :option="option" |
6 | 7 | :manual-update="isPreview()" |
... | ... | @@ -13,6 +14,7 @@ |
13 | 14 | <script setup lang="ts"> |
14 | 15 | import { PropType, computed, watch, ref, nextTick } from 'vue' |
15 | 16 | import VChart from 'vue-echarts' |
17 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
16 | 18 | import { use } from 'echarts/core' |
17 | 19 | import { CanvasRenderer } from 'echarts/renderers' |
18 | 20 | import { ScatterChart, EffectScatterChart } from 'echarts/charts' |
... | ... | @@ -46,6 +48,8 @@ const props = defineProps({ |
46 | 48 | } |
47 | 49 | }) |
48 | 50 | |
51 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
52 | + | |
49 | 53 | use([ |
50 | 54 | DatasetComponent, |
51 | 55 | CanvasRenderer, | ... | ... |
1 | 1 | <template> |
2 | 2 | <v-chart |
3 | 3 | ref="vChartRef" |
4 | + :init-options="initOptions" | |
4 | 5 | :theme="themeColor" |
5 | 6 | :option="option" |
6 | 7 | :manual-update="isPreview()" |
... | ... | @@ -13,6 +14,7 @@ |
13 | 14 | <script setup lang="ts"> |
14 | 15 | import { PropType, computed, ref } from 'vue' |
15 | 16 | import VChart from 'vue-echarts' |
17 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
16 | 18 | import ecStat from 'echarts-stat' |
17 | 19 | import { use, registerTransform } from 'echarts/core' |
18 | 20 | import { CanvasRenderer } from 'echarts/renderers' |
... | ... | @@ -47,6 +49,8 @@ const props = defineProps({ |
47 | 49 | } |
48 | 50 | }) |
49 | 51 | |
52 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
53 | + | |
50 | 54 | use([ |
51 | 55 | DatasetComponent, |
52 | 56 | CanvasRenderer, | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Border01Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Border01Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.BORDER, |
10 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'border01.png' |
13 | 14 | } | ... | ... |
1 | -import image from '@/assets/images/chart/decorates/border02.png' | |
2 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum} from '@/packages/index.d' | |
3 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
4 | 3 | |
5 | 4 | export const Border02Config: ConfigType = { |
... | ... | @@ -10,5 +9,6 @@ export const Border02Config: ConfigType = { |
10 | 9 | category: ChatCategoryEnum.BORDER, |
11 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
12 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
13 | 13 | image: 'border02.png' |
14 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Border03Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Border03Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.BORDER, |
10 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'border03.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Border04Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Border04Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.BORDER, |
10 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'border04.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Border05Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Border05Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.BORDER, |
10 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'border05.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Border06Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Border06Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.BORDER, |
10 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'border06.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Border07Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Border07Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.BORDER, |
10 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'border07.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Border08Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Border08Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.BORDER, |
10 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'border08.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Border09Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Border09Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.BORDER, |
10 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'border09.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Border10Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Border10Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.BORDER, |
10 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'border10.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Border11Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Border11Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.BORDER, |
10 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'border11.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Border12Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Border12Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.BORDER, |
10 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'border12.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Border13Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Border13Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.BORDER, |
10 | 10 | categoryName: ChatCategoryEnumName.BORDER, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'border13.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Decorates01Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Decorates01Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.DECORATE, |
10 | 10 | categoryName: ChatCategoryEnumName.DECORATE, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'decorates01.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Decorates02Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Decorates02Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.DECORATE, |
10 | 10 | categoryName: ChatCategoryEnumName.DECORATE, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'decorates02.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Decorates03Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Decorates03Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.DECORATE, |
10 | 10 | categoryName: ChatCategoryEnumName.DECORATE, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | - image: 'decorates01.png' | |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
13 | + image: 'decorates03.png' | |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const Decorates04Config: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const Decorates04Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.DECORATE, |
10 | 10 | categoryName: ChatCategoryEnumName.DECORATE, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'decorates04.png' |
13 | 14 | } | ... | ... |
1 | -import image from '@/assets/images/chart/decorates/decorates05.png' | |
2 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
3 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
4 | 3 | |
5 | 4 | export const Decorates05Config: ConfigType = { |
... | ... | @@ -10,5 +9,6 @@ export const Decorates05Config: ConfigType = { |
10 | 9 | category: ChatCategoryEnum.DECORATE, |
11 | 10 | categoryName: ChatCategoryEnumName.DECORATE, |
12 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
13 | 13 | image: 'decorates05.png' |
14 | 14 | } | ... | ... |
... | ... | @@ -9,6 +9,6 @@ export const Decorates06Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.DECORATE, |
10 | 10 | categoryName: ChatCategoryEnumName.DECORATE, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | - chartFrame: ChartFrameEnum.COMMON, | |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
13 | 13 | image: 'decorates06.png' |
14 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const CountDownConfig: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const CountDownConfig: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.MORE, |
10 | 10 | categoryName: ChatCategoryEnumName.MORE, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.COMMON, | |
12 | 13 | image: 'countdown.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const FlipperNumberConfig: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const FlipperNumberConfig: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.MORE, |
10 | 10 | categoryName: ChatCategoryEnumName.MORE, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.COMMON, | |
12 | 13 | image: 'flipper-number.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const NumberConfig: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const NumberConfig: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.MORE, |
10 | 10 | categoryName: ChatCategoryEnumName.MORE, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.COMMON, | |
12 | 13 | image: 'number.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const TimeCommonConfig: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const TimeCommonConfig: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.MORE, |
10 | 10 | categoryName: ChatCategoryEnumName.MORE, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
12 | 13 | image: 'time.png' |
13 | 14 | } | ... | ... |
... | ... | @@ -9,6 +9,6 @@ export const ThreeEarth01Config: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.THREE, |
10 | 10 | categoryName: ChatCategoryEnumName.THREE, |
11 | 11 | package: PackagesCategoryEnum.DECORATES, |
12 | - chartFrame: ChartFrameEnum.STATIC, | |
12 | + chartFrame: ChartFrameEnum.COMMON, | |
13 | 13 | image: 'threeEarth01.png' |
14 | 14 | } | ... | ... |
1 | +import dayjs from 'dayjs' | |
2 | +import cloneDeep from 'lodash/cloneDeep' | |
3 | +import { PublicConfigClass } from '@/packages/public' | |
4 | +import { CreateComponentType } from '@/packages/index.d' | |
5 | +import { chartInitConfig } from '@/settings/designSetting' | |
6 | +import { COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum' | |
7 | +import { interactActions, ComponentInteractEventEnum } from './interact' | |
8 | +import { InputsDateConfig } from './index' | |
9 | + | |
10 | +export const option = { | |
11 | + // 时间组件展示类型,必须和 interactActions 中定义的数据一致 | |
12 | + [COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATE, | |
13 | + // 下拉展示 | |
14 | + isPanel: 0, | |
15 | + dataset: dayjs().valueOf() | |
16 | +} | |
17 | + | |
18 | +export default class Config extends PublicConfigClass implements CreateComponentType { | |
19 | + public key = InputsDateConfig.key | |
20 | + public attr = { ...chartInitConfig, w: 260, h: 32, zIndex: -1 } | |
21 | + public chartConfig = cloneDeep(InputsDateConfig) | |
22 | + public interactActions = interactActions | |
23 | + public option = cloneDeep(option) | |
24 | +} | ... | ... |
1 | +<template> | |
2 | + <collapse-item name="展示方式" :expanded="true"> | |
3 | + <setting-item-box name="选择方式"> | |
4 | + <n-select | |
5 | + v-model:value="optionData.isPanel" | |
6 | + size="small" | |
7 | + :options="panelOptions" | |
8 | + /> | |
9 | + </setting-item-box> | |
10 | + </collapse-item> | |
11 | + | |
12 | + <collapse-item name="时间配置" :expanded="true"> | |
13 | + <setting-item-box name="基础"> | |
14 | + <setting-item name="类型"> | |
15 | + <n-select | |
16 | + v-model:value="optionData.componentInteractEventKey" | |
17 | + size="small" | |
18 | + :options="datePickerTypeOptions" | |
19 | + /> | |
20 | + </setting-item> | |
21 | + </setting-item-box> | |
22 | + | |
23 | + <setting-item-box name="默认值" :alone="true"> | |
24 | + <n-date-picker | |
25 | + size="small" | |
26 | + v-model:value="optionData.dataset" | |
27 | + :type="optionData.componentInteractEventKey" | |
28 | + /> | |
29 | + </setting-item-box> | |
30 | + </collapse-item> | |
31 | +</template> | |
32 | + | |
33 | +<script lang="ts" setup> | |
34 | +import { PropType } from 'vue' | |
35 | +import { icon } from '@/plugins' | |
36 | +import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' | |
37 | +import { option } from './config' | |
38 | +import { ComponentInteractEventEnum } from './interact' | |
39 | + | |
40 | +const { HelpOutlineIcon } = icon.ionicons5 | |
41 | + | |
42 | +const props = defineProps({ | |
43 | + optionData: { | |
44 | + type: Object as PropType<typeof option>, | |
45 | + required: true | |
46 | + } | |
47 | +}) | |
48 | + | |
49 | +const panelOptions = [ | |
50 | + { | |
51 | + label: '下拉展示', | |
52 | + value: 0 | |
53 | + }, | |
54 | + { | |
55 | + label: '面板展示', | |
56 | + value: 1 | |
57 | + } | |
58 | +] | |
59 | + | |
60 | +const datePickerTypeOptions = [ | |
61 | + { | |
62 | + label: '日期', | |
63 | + value: ComponentInteractEventEnum.DATE | |
64 | + }, | |
65 | + { | |
66 | + label: '日期时间', | |
67 | + value: ComponentInteractEventEnum.DATE_TIME | |
68 | + }, | |
69 | + { | |
70 | + label: '日期范围', | |
71 | + value: ComponentInteractEventEnum.DATE_RANGE | |
72 | + }, | |
73 | + { | |
74 | + label: '月份', | |
75 | + value: ComponentInteractEventEnum.MONTH | |
76 | + }, | |
77 | + { | |
78 | + label: '月份范围', | |
79 | + value: ComponentInteractEventEnum.MONTH_RANGE | |
80 | + }, | |
81 | + { | |
82 | + label: '年份', | |
83 | + value: ComponentInteractEventEnum.YEAR | |
84 | + }, | |
85 | + { | |
86 | + label: '年份范围', | |
87 | + value: ComponentInteractEventEnum.YEAR_RANGE | |
88 | + }, | |
89 | + { | |
90 | + label: '季度', | |
91 | + value: ComponentInteractEventEnum.QUARTER | |
92 | + }, | |
93 | + { | |
94 | + label: '季度范围', | |
95 | + value: ComponentInteractEventEnum.QUARTER_RANGE | |
96 | + } | |
97 | +] | |
98 | +</script> | ... | ... |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | +import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' | |
3 | + | |
4 | +export const InputsDateConfig: ConfigType = { | |
5 | + key: 'InputsDate', | |
6 | + chartKey: 'VInputsDate', | |
7 | + conKey: 'VCInputsDate', | |
8 | + title: '时间选择器', | |
9 | + category: ChatCategoryEnum.INPUTS, | |
10 | + categoryName: ChatCategoryEnumName.INPUTS, | |
11 | + package: PackagesCategoryEnum.INFORMATIONS, | |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
13 | + image: 'inputs_date.png' | |
14 | +} | ... | ... |
1 | +<template> | |
2 | + <n-date-picker | |
3 | + v-model:value="option.dataset" | |
4 | + :panel="!!chartConfig.option.isPanel" | |
5 | + :type="chartConfig.option.componentInteractEventKey" | |
6 | + :style="`width:${w}px;`" | |
7 | + @update:value="onChange" | |
8 | + /> | |
9 | +</template> | |
10 | + | |
11 | +<script setup lang="ts"> | |
12 | +import { PropType, toRefs, ref, shallowReactive, watch } from 'vue' | |
13 | +import dayjs from 'dayjs' | |
14 | +import { CreateComponentType } from '@/packages/index.d' | |
15 | +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | |
16 | +import { useChartInteract } from '@/hooks' | |
17 | +import { InteractEventOn } from '@/enums/eventEnum' | |
18 | +import { ComponentInteractParamsEnum } from './interact' | |
19 | + | |
20 | +const props = defineProps({ | |
21 | + chartConfig: { | |
22 | + type: Object as PropType<CreateComponentType>, | |
23 | + required: true | |
24 | + } | |
25 | +}) | |
26 | + | |
27 | +const { w, h } = toRefs(props.chartConfig.attr) | |
28 | +const rangeDate = ref<number | number[]>() | |
29 | + | |
30 | +const option = shallowReactive({ | |
31 | + dataset: props.chartConfig.option.dataset | |
32 | +}) | |
33 | + | |
34 | +// 监听事件改变 | |
35 | +const onChange = (v: number | number[]) => { | |
36 | + if (v instanceof Array) { | |
37 | + // 存储到联动数据 | |
38 | + useChartInteract( | |
39 | + props.chartConfig, | |
40 | + useChartEditStore, | |
41 | + { | |
42 | + [ComponentInteractParamsEnum.DATE_START]: v[0] | dayjs().valueOf(), | |
43 | + [ComponentInteractParamsEnum.DATE_END]: v[1] | dayjs().valueOf(), | |
44 | + [ComponentInteractParamsEnum.DATE_RANGE]: `${v[0]}-${v[1]}` | |
45 | + }, | |
46 | + InteractEventOn.CHANGE | |
47 | + ) | |
48 | + } else { | |
49 | + // 存储到联动数据 | |
50 | + useChartInteract( | |
51 | + props.chartConfig, | |
52 | + useChartEditStore, | |
53 | + { [ComponentInteractParamsEnum.DATE]: v }, | |
54 | + InteractEventOn.CHANGE | |
55 | + ) | |
56 | + } | |
57 | +} | |
58 | + | |
59 | +// 手动更新 | |
60 | +watch( | |
61 | + () => props.chartConfig.option.dataset, | |
62 | + (newData: number | number[]) => { | |
63 | + option.dataset = newData | |
64 | + // 关联目标组件首次请求带上默认内容 | |
65 | + onChange(newData) | |
66 | + }, | |
67 | + { | |
68 | + immediate: true | |
69 | + } | |
70 | +) | |
71 | +</script> | |
72 | + | |
73 | +<style lang="scss" scoped> | |
74 | +@include deep() { | |
75 | + .n-input { | |
76 | + height: v-bind('h + "px"'); | |
77 | + display: flex; | |
78 | + align-items: center; | |
79 | + } | |
80 | +} | |
81 | +</style> | ... | ... |
1 | +import { InteractEventOn, InteractActionsType } from '@/enums/eventEnum' | |
2 | + | |
3 | +// 时间组件类型 | |
4 | +export enum ComponentInteractEventEnum { | |
5 | + DATE = 'date', | |
6 | + DATE_TIME = 'datetime', | |
7 | + DATE_RANGE = 'daterange', | |
8 | + DATE_TIME_RANGE = 'datetimerange', | |
9 | + MONTH = 'month', | |
10 | + MONTH_RANGE = 'monthrange', | |
11 | + YEAR = 'year', | |
12 | + YEAR_RANGE = 'yearrange', | |
13 | + QUARTER = 'quarter', | |
14 | + QUARTER_RANGE = 'quarterrange' | |
15 | +} | |
16 | + | |
17 | +// 联动参数 | |
18 | +export enum ComponentInteractParamsEnum { | |
19 | + DATE = 'date', | |
20 | + DATE_START = 'dateStart', | |
21 | + DATE_END = 'dateEnd', | |
22 | + DATE_RANGE = 'daterange' | |
23 | +} | |
24 | + | |
25 | +const time = [ | |
26 | + { | |
27 | + value: ComponentInteractParamsEnum.DATE, | |
28 | + label: '日期' | |
29 | + } | |
30 | +] | |
31 | + | |
32 | +const timeRange = [ | |
33 | + { | |
34 | + value: ComponentInteractParamsEnum.DATE_START, | |
35 | + label: '开始时间' | |
36 | + }, | |
37 | + { | |
38 | + value: ComponentInteractParamsEnum.DATE_END, | |
39 | + label: '结束时间' | |
40 | + }, | |
41 | + { | |
42 | + value: ComponentInteractParamsEnum.DATE_RANGE, | |
43 | + label: '日期范围' | |
44 | + } | |
45 | +] | |
46 | + | |
47 | +// 定义组件触发回调事件 | |
48 | +export const interactActions: InteractActionsType[] = [ | |
49 | + { | |
50 | + interactType: InteractEventOn.CHANGE, | |
51 | + interactName: '选择完成', | |
52 | + componentEmitEvents: { | |
53 | + [ComponentInteractEventEnum.DATE]: time, | |
54 | + [ComponentInteractEventEnum.DATE_TIME]: time, | |
55 | + [ComponentInteractEventEnum.DATE_RANGE]: timeRange, | |
56 | + [ComponentInteractEventEnum.MONTH]: time, | |
57 | + [ComponentInteractEventEnum.MONTH_RANGE]: timeRange, | |
58 | + [ComponentInteractEventEnum.QUARTER]: time, | |
59 | + [ComponentInteractEventEnum.QUARTER_RANGE]: timeRange, | |
60 | + [ComponentInteractEventEnum.YEAR]: time, | |
61 | + [ComponentInteractEventEnum.YEAR_RANGE]: timeRange, | |
62 | + } | |
63 | + } | |
64 | +] | ... | ... |
1 | +import cloneDeep from 'lodash/cloneDeep' | |
2 | +import { PublicConfigClass } from '@/packages/public' | |
3 | +import { CreateComponentType } from '@/packages/index.d' | |
4 | +import { chartInitConfig } from '@/settings/designSetting' | |
5 | +import { COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum' | |
6 | +import { interactActions, ComponentInteractEventEnum } from './interact' | |
7 | +import { InputsSelectConfig } from './index' | |
8 | + | |
9 | +export const option = { | |
10 | + // 时间组件展示类型,必须和 interactActions 中定义的数据一致 | |
11 | + [COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATA, | |
12 | + // 默认值 | |
13 | + selectValue: '1', | |
14 | + // 暴露配置内容给用户 | |
15 | + dataset: [ | |
16 | + { | |
17 | + label: '选项1', | |
18 | + value: '1' | |
19 | + }, | |
20 | + { | |
21 | + label: '选项2', | |
22 | + value: '2' | |
23 | + }, | |
24 | + { | |
25 | + label: '选项3', | |
26 | + value: '3' | |
27 | + } | |
28 | + ] | |
29 | +} | |
30 | + | |
31 | +export default class Config extends PublicConfigClass implements CreateComponentType { | |
32 | + public key = InputsSelectConfig.key | |
33 | + public attr = { ...chartInitConfig, w: 260, h: 32, zIndex: -1 } | |
34 | + public chartConfig = cloneDeep(InputsSelectConfig) | |
35 | + public interactActions = interactActions | |
36 | + public option = cloneDeep(option) | |
37 | +} | ... | ... |
1 | +<template> | |
2 | + <collapse-item name="下拉配置" :expanded="true"> | |
3 | + <setting-item-box name="默认值" :alone="true"> | |
4 | + <n-select size="small" v-model:value="optionData.selectValue" :options="optionData.dataset" /> | |
5 | + </setting-item-box> | |
6 | + </collapse-item> | |
7 | +</template> | |
8 | + | |
9 | +<script lang="ts" setup> | |
10 | +import { PropType } from 'vue' | |
11 | +import { CollapseItem, SettingItemBox } from '@/components/Pages/ChartItemSetting' | |
12 | +import { option } from './config' | |
13 | + | |
14 | +defineProps({ | |
15 | + optionData: { | |
16 | + type: Object as PropType<typeof option>, | |
17 | + required: true | |
18 | + } | |
19 | +}) | |
20 | +</script> | ... | ... |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | +import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' | |
3 | + | |
4 | +export const InputsSelectConfig: ConfigType = { | |
5 | + key: 'InputsSelect', | |
6 | + chartKey: 'VInputsSelect', | |
7 | + conKey: 'VCInputsSelect', | |
8 | + title: '下拉选择器', | |
9 | + category: ChatCategoryEnum.INPUTS, | |
10 | + categoryName: ChatCategoryEnumName.INPUTS, | |
11 | + package: PackagesCategoryEnum.INFORMATIONS, | |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
13 | + image: 'inputs_select.png' | |
14 | +} | ... | ... |
1 | +<template> | |
2 | + <n-select | |
3 | + v-model:value="option.value.selectValue" | |
4 | + :options="option.value.dataset" | |
5 | + :style="`width:${w}px;`" | |
6 | + @update:value="onChange" | |
7 | + /> | |
8 | +</template> | |
9 | + | |
10 | +<script setup lang="ts"> | |
11 | +import { PropType, toRefs, ref, shallowReactive, watch } from 'vue' | |
12 | +import { CreateComponentType } from '@/packages/index.d' | |
13 | +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | |
14 | +import { useChartInteract } from '@/hooks' | |
15 | +import { InteractEventOn } from '@/enums/eventEnum' | |
16 | +import { ComponentInteractParamsEnum } from './interact' | |
17 | + | |
18 | +const props = defineProps({ | |
19 | + chartConfig: { | |
20 | + type: Object as PropType<CreateComponentType>, | |
21 | + required: true | |
22 | + } | |
23 | +}) | |
24 | + | |
25 | +const { w, h } = toRefs(props.chartConfig.attr) | |
26 | +const option = shallowReactive({ | |
27 | + value: { | |
28 | + selectValue: props.chartConfig.option.selectValue, | |
29 | + dataset: props.chartConfig.option.dataset | |
30 | + } | |
31 | +}) | |
32 | + | |
33 | +// 监听事件改变 | |
34 | +const onChange = (v: string) => { | |
35 | + // 存储到联动数据 | |
36 | + useChartInteract( | |
37 | + props.chartConfig, | |
38 | + useChartEditStore, | |
39 | + { [ComponentInteractParamsEnum.DATA]: v }, | |
40 | + InteractEventOn.CHANGE | |
41 | + ) | |
42 | +} | |
43 | + | |
44 | +// 手动更新 | |
45 | +watch( | |
46 | + () => props.chartConfig.option, | |
47 | + (newData: any) => { | |
48 | + option.value = newData | |
49 | + onChange(newData.selectValue) | |
50 | + }, | |
51 | + { | |
52 | + immediate: true, | |
53 | + deep: true | |
54 | + } | |
55 | +) | |
56 | +</script> | |
57 | + | |
58 | +<style lang="scss" scoped> | |
59 | +@include deep() { | |
60 | + .n-base-selection-label { | |
61 | + height: v-bind('h + "px"'); | |
62 | + display: flex; | |
63 | + align-items: center; | |
64 | + } | |
65 | +} | |
66 | +</style> | ... | ... |
1 | +import { InteractEventOn, InteractActionsType } from '@/enums/eventEnum' | |
2 | + | |
3 | +// 时间组件类型 | |
4 | +export enum ComponentInteractEventEnum { | |
5 | + DATA = 'data' | |
6 | +} | |
7 | + | |
8 | +// 联动参数 | |
9 | +export enum ComponentInteractParamsEnum { | |
10 | + DATA = 'data' | |
11 | +} | |
12 | + | |
13 | +// 定义组件触发回调事件 | |
14 | +export const interactActions: InteractActionsType[] = [ | |
15 | + { | |
16 | + interactType: InteractEventOn.CHANGE, | |
17 | + interactName: '选择完成', | |
18 | + componentEmitEvents: { | |
19 | + [ComponentInteractEventEnum.DATA]: [ | |
20 | + { | |
21 | + value: ComponentInteractParamsEnum.DATA, | |
22 | + label: '选择项' | |
23 | + } | |
24 | + ] | |
25 | + } | |
26 | + } | |
27 | +] | ... | ... |
1 | +import cloneDeep from 'lodash/cloneDeep' | |
2 | +import { PublicConfigClass } from '@/packages/public' | |
3 | +import { CreateComponentType } from '@/packages/index.d' | |
4 | +import { chartInitConfig } from '@/settings/designSetting' | |
5 | +import { COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum' | |
6 | +import { interactActions, ComponentInteractEventEnum } from './interact' | |
7 | +import { InputsTabConfig } from './index' | |
8 | + | |
9 | +export const option = { | |
10 | + // 时间组件展示类型,必须和 interactActions 中定义的数据一致 | |
11 | + [COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATA, | |
12 | + // 默认值 | |
13 | + tabLabel: '选项1', | |
14 | + // 样式 | |
15 | + tabType: 'segment', | |
16 | + // 暴露配置内容给用户 | |
17 | + dataset: [ | |
18 | + { | |
19 | + label: '选项1', | |
20 | + value: '1' | |
21 | + }, | |
22 | + { | |
23 | + label: '选项2', | |
24 | + value: '2' | |
25 | + }, | |
26 | + { | |
27 | + label: '选项3', | |
28 | + value: '3' | |
29 | + } | |
30 | + ] | |
31 | +} | |
32 | + | |
33 | +export default class Config extends PublicConfigClass implements CreateComponentType { | |
34 | + public key = InputsTabConfig.key | |
35 | + public attr = { ...chartInitConfig, w: 460, h: 32, zIndex: -1 } | |
36 | + public chartConfig = cloneDeep(InputsTabConfig) | |
37 | + public interactActions = interactActions | |
38 | + public option = cloneDeep(option) | |
39 | +} | ... | ... |
1 | +<template> | |
2 | + <collapse-item name="标签页配置" :expanded="true"> | |
3 | + <setting-item-box name="默认值" :alone="true"> | |
4 | + <n-select size="small" v-model:value="optionData.tabType" :options="tabTypeOptions" /> | |
5 | + </setting-item-box> | |
6 | + </collapse-item> | |
7 | +</template> | |
8 | + | |
9 | +<script lang="ts" setup> | |
10 | +import { PropType } from 'vue' | |
11 | +import { CollapseItem, SettingItemBox } from '@/components/Pages/ChartItemSetting' | |
12 | +import { option } from './config' | |
13 | + | |
14 | +defineProps({ | |
15 | + optionData: { | |
16 | + type: Object as PropType<typeof option>, | |
17 | + required: true | |
18 | + } | |
19 | +}) | |
20 | + | |
21 | +const tabTypeOptions = [ | |
22 | + { | |
23 | + label: '线条', | |
24 | + value: 'bar' | |
25 | + }, | |
26 | + { | |
27 | + label: '分段', | |
28 | + value: 'segment' | |
29 | + } | |
30 | +] | |
31 | +</script> | ... | ... |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | +import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' | |
3 | + | |
4 | +export const InputsTabConfig: ConfigType = { | |
5 | + key: 'InputsTab', | |
6 | + chartKey: 'VInputsTab', | |
7 | + conKey: 'VCInputsTab', | |
8 | + title: '标签选择器', | |
9 | + category: ChatCategoryEnum.INPUTS, | |
10 | + categoryName: ChatCategoryEnumName.INPUTS, | |
11 | + package: PackagesCategoryEnum.INFORMATIONS, | |
12 | + chartFrame: ChartFrameEnum.STATIC, | |
13 | + image: 'inputs_tab.png' | |
14 | +} | ... | ... |
1 | +<template> | |
2 | + <n-tabs :type="option.value.tabType" @update:value="onChange"> | |
3 | + <n-tab v-for="(item, index) in option.value.dataset" :name="item.label" :key="index"> {{ item.label }} </n-tab> | |
4 | + </n-tabs> | |
5 | +</template> | |
6 | + | |
7 | +<script setup lang="ts"> | |
8 | +import { PropType, toRefs, shallowReactive, watch } from 'vue' | |
9 | +import cloneDeep from 'lodash/cloneDeep' | |
10 | +import { CreateComponentType } from '@/packages/index.d' | |
11 | +import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' | |
12 | +import { useChartInteract } from '@/hooks' | |
13 | +import { InteractEventOn } from '@/enums/eventEnum' | |
14 | +import { ComponentInteractParamsEnum } from './interact' | |
15 | + | |
16 | +const props = defineProps({ | |
17 | + chartConfig: { | |
18 | + type: Object as PropType<CreateComponentType>, | |
19 | + required: true | |
20 | + } | |
21 | +}) | |
22 | + | |
23 | +const { w, h } = toRefs(props.chartConfig.attr) | |
24 | +const option = shallowReactive({ | |
25 | + value: cloneDeep(props.chartConfig.option) | |
26 | +}) | |
27 | + | |
28 | +// 监听事件改变 | |
29 | +const onChange = (v: string) => { | |
30 | + if (v === undefined) return | |
31 | + const selectItem = option.value.dataset.find((item: { label: string; value: any }) => item.label === v) | |
32 | + // 存储到联动数据 | |
33 | + useChartInteract( | |
34 | + props.chartConfig, | |
35 | + useChartEditStore, | |
36 | + { [ComponentInteractParamsEnum.DATA]: selectItem.value }, | |
37 | + InteractEventOn.CHANGE | |
38 | + ) | |
39 | +} | |
40 | + | |
41 | +// 手动更新 | |
42 | +watch( | |
43 | + () => props.chartConfig.option, | |
44 | + (newData: any) => { | |
45 | + option.value = newData | |
46 | + onChange(newData.tabValue) | |
47 | + }, | |
48 | + { | |
49 | + immediate: true, | |
50 | + deep: true | |
51 | + } | |
52 | +) | |
53 | +</script> | |
\ No newline at end of file | ... | ... |
1 | +import { InteractEventOn, InteractActionsType } from '@/enums/eventEnum' | |
2 | + | |
3 | +// 时间组件类型 | |
4 | +export enum ComponentInteractEventEnum { | |
5 | + DATA = 'data' | |
6 | +} | |
7 | + | |
8 | +// 联动参数 | |
9 | +export enum ComponentInteractParamsEnum { | |
10 | + DATA = 'data' | |
11 | +} | |
12 | + | |
13 | +// 定义组件触发回调事件 | |
14 | +export const interactActions: InteractActionsType[] = [ | |
15 | + { | |
16 | + interactType: InteractEventOn.CHANGE, | |
17 | + interactName: '选择完成', | |
18 | + componentEmitEvents: { | |
19 | + [ComponentInteractEventEnum.DATA]: [ | |
20 | + { | |
21 | + value: ComponentInteractParamsEnum.DATA, | |
22 | + label: '选择项' | |
23 | + } | |
24 | + ] | |
25 | + } | |
26 | + } | |
27 | +] | ... | ... |
1 | 1 | <template> |
2 | + <global-setting :optionData="optionData"></global-setting> | |
2 | 3 | <collapse-item name="词云" expanded> |
3 | 4 | <setting-item-box name="形状"> |
4 | 5 | <setting-item> |
... | ... | @@ -45,7 +46,7 @@ |
45 | 46 | import { PropType, computed } from 'vue' |
46 | 47 | import { option, ShapeEnumList } from './config' |
47 | 48 | // eslint-disable-next-line no-unused-vars |
48 | -import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' | |
49 | +import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' | |
49 | 50 | |
50 | 51 | const props = defineProps({ |
51 | 52 | optionData: { | ... | ... |
1 | 1 | <template> |
2 | 2 | <v-chart |
3 | 3 | ref="vChartRef" |
4 | + :init-options="initOptions" | |
4 | 5 | :theme="themeColor" |
5 | 6 | :option="option" |
6 | 7 | :manual-update="isPreview()" |
... | ... | @@ -12,6 +13,7 @@ |
12 | 13 | <script setup lang="ts"> |
13 | 14 | import { ref, computed, watch, PropType } from 'vue' |
14 | 15 | import VChart from 'vue-echarts' |
16 | +import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook' | |
15 | 17 | import 'echarts-wordcloud' |
16 | 18 | import { use } from 'echarts/core' |
17 | 19 | import { CanvasRenderer } from 'echarts/renderers' |
... | ... | @@ -38,6 +40,8 @@ const props = defineProps({ |
38 | 40 | } |
39 | 41 | }) |
40 | 42 | |
43 | +const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting) | |
44 | + | |
41 | 45 | use([CanvasRenderer, GridComponent, TooltipComponent]) |
42 | 46 | |
43 | 47 | const replaceMergeArr = ref<string[]>() | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const TextBarrageConfig: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const TextBarrageConfig: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.TEXT, |
10 | 10 | categoryName: ChatCategoryEnumName.TEXT, |
11 | 11 | package: PackagesCategoryEnum.INFORMATIONS, |
12 | + chartFrame: ChartFrameEnum.COMMON, | |
12 | 13 | image: 'text_barrage.png' |
13 | 14 | } | ... | ... |
1 | -import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' | |
1 | +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' | |
2 | 2 | import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d' |
3 | 3 | |
4 | 4 | export const TextCommonConfig: ConfigType = { |
... | ... | @@ -9,5 +9,6 @@ export const TextCommonConfig: ConfigType = { |
9 | 9 | category: ChatCategoryEnum.TEXT, |
10 | 10 | categoryName: ChatCategoryEnumName.TEXT, |
11 | 11 | package: PackagesCategoryEnum.INFORMATIONS, |
12 | + chartFrame: ChartFrameEnum.COMMON, | |
12 | 13 | image: 'text_static.png' |
13 | 14 | } | ... | ... |
1 | 1 | export enum ChatCategoryEnum { |
2 | 2 | TEXT = 'Texts', |
3 | 3 | TITLE = 'Titles', |
4 | + INPUTS = 'Inputs', | |
4 | 5 | MORE = 'Mores' |
5 | 6 | } |
6 | 7 | |
7 | 8 | export enum ChatCategoryEnumName { |
8 | 9 | TEXT = '文本', |
9 | 10 | TITLE = '标题', |
11 | + // 控件 => 数据录入 | |
12 | + INPUTS = '控件', | |
10 | 13 | MORE = '更多' |
11 | 14 | } |
\ No newline at end of file | ... | ... |
... | ... | @@ -6,7 +6,7 @@ import { ClockConfig } from '@/packages/components/external/Decorates/Mores/Icon |
6 | 6 | export function useInjectLib(packagesList: EPackagesType) { |
7 | 7 | packagesList[EPackagesCategoryEnum.COMPOSES] = ComposesList |
8 | 8 | |
9 | - addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, ClockConfig) | |
9 | + // addWidgetToCategoryByCategoryName(packagesList, PackagesCategoryEnum.DECORATES, ClockConfig) | |
10 | 10 | } |
11 | 11 | |
12 | 12 | /** | ... | ... |
1 | -import { BaseEvent, EventLife } from '@/enums/eventEnum' | |
1 | +import { BaseEvent, EventLife, InteractEvents, InteractEventOn, InteractActionsType } from '@/enums/eventEnum' | |
2 | 2 | import type { GlobalThemeJsonType } from '@/settings/chartThemes/index' |
3 | 3 | import type { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d' |
4 | 4 | |
... | ... | @@ -120,13 +120,19 @@ export interface PublicConfigType { |
120 | 120 | } |
121 | 121 | filter?: string |
122 | 122 | status: StatusType |
123 | + interactActions?: InteractActionsType[], | |
123 | 124 | events: { |
124 | 125 | baseEvent: { |
125 | 126 | [K in BaseEvent]?: string |
126 | - }, | |
127 | + } | |
127 | 128 | advancedEvents: { |
128 | 129 | [K in EventLife]?: string |
129 | 130 | } |
131 | + interactEvents: { | |
132 | + [InteractEvents.INTERACT_ON]: InteractEventOn | undefined | |
133 | + [InteractEvents.INTERACT_COMPONENT_ID]: string | undefined | |
134 | + [InteractEvents.INTERACT_FN]: { [name: string]: string } | |
135 | + }[] | |
130 | 136 | } |
131 | 137 | } |
132 | 138 | ... | ... |
... | ... | @@ -14,7 +14,7 @@ export const packagesList: PackagesType = { |
14 | 14 | [PackagesCategoryEnum.CHARTS]: ChartList, |
15 | 15 | [PackagesCategoryEnum.INFORMATIONS]: InformationList, |
16 | 16 | [PackagesCategoryEnum.TABLES]: TableList, |
17 | - [PackagesCategoryEnum.DECORATES]: DecorateList, | |
17 | + [PackagesCategoryEnum.DECORATES]: DecorateList | |
18 | 18 | } |
19 | 19 | |
20 | 20 | /** | ... | ... |
... | ... | @@ -67,8 +67,7 @@ import { |
67 | 67 | EyeOutline as EyeOutlineIcon, |
68 | 68 | EyeOffOutline as EyeOffOutlineIcon, |
69 | 69 | Albums as AlbumsIcon, |
70 | - Analytics as AnalyticsIcon, | |
71 | - SaveOutline as SaveIcon | |
70 | + Analytics as AnalyticsIcon | |
72 | 71 | } from '@vicons/ionicons5' |
73 | 72 | |
74 | 73 | import { |
... | ... | @@ -295,10 +294,7 @@ const carbon = { |
295 | 294 | FilterIcon, |
296 | 295 | FilterEditIcon, |
297 | 296 | // 图层 |
298 | - LaptopIcon, | |
299 | - // 保存 | |
300 | - // THINGS_KIT | |
301 | - SaveIcon | |
297 | + LaptopIcon | |
302 | 298 | } |
303 | 299 | |
304 | 300 | // https://www.xicons.org/#/ 还有很多 | ... | ... |
... | ... | @@ -5,6 +5,13 @@ import { loginCheck } from '@/utils' |
5 | 5 | export function createRouterGuards(router: Router) { |
6 | 6 | // 前置 |
7 | 7 | router.beforeEach(async (to, from, next) => { |
8 | + // http://localhost:3000/#/chart/preview/792622755697790976?t=123 | |
9 | + // 把外部动态参数放入window.route.params,后续API动态接口可以用window.route?.params?.t来拼接参数 | |
10 | + // @ts-ignore | |
11 | + if (!window.route) window.route = {params: {}} | |
12 | + // @ts-ignore | |
13 | + Object.assign(window.route.params, to.query) | |
14 | + | |
8 | 15 | const Loading = window['$loading']; |
9 | 16 | Loading && Loading.start(); |
10 | 17 | const isErrorPage = router.getRoutes().findIndex((item) => item.name === to.name); | ... | ... |
... | ... | @@ -64,10 +64,13 @@ export const chartColorsSearch = { |
64 | 64 | roma: ['#e01f54', '#5e4ea5', 'rgba(137, 52, 72, 0.3)', 'rgba(224, 31, 84, 0.5)', 'rgba(94, 78, 165, 0.5)'], |
65 | 65 | } |
66 | 66 | |
67 | +export type EchartsRenderer = 'svg' | 'canvas'; | |
68 | + | |
67 | 69 | // 默认主题详细配置 |
68 | 70 | type ThemeJsonType = typeof themeJson |
69 | 71 | export interface GlobalThemeJsonType extends Partial<ThemeJsonType> { |
70 | 72 | dataset?: any, |
73 | + renderer?: EchartsRenderer, | |
71 | 74 | [T:string]: any |
72 | 75 | } |
73 | -export const globalThemeJson = {...themeJson, dataset: null,} | |
76 | +export const globalThemeJson = {...themeJson, dataset: null, renderer: 'svg' as const } | ... | ... |
... | ... | @@ -6,7 +6,7 @@ import designColor from './designColor.json' |
6 | 6 | export const lang = LangEnum.ZH |
7 | 7 | |
8 | 8 | // 水印文字 |
9 | -export const watermarkText = 'GoView 低代码平台' | |
9 | +export const watermarkText = "GoView 低代码平台" | |
10 | 10 | |
11 | 11 | // 分组名称 |
12 | 12 | export const groupTitle = '分组' |
... | ... | @@ -17,7 +17,7 @@ export const theme = { |
17 | 17 | darkTheme: false, |
18 | 18 | //默认主题色 |
19 | 19 | appTheme: '#51d6a9', |
20 | - appThemeDetail: null | |
20 | + appThemeDetail: null, | |
21 | 21 | } |
22 | 22 | |
23 | 23 | // 图表初始配置(px) |
... | ... | @@ -28,7 +28,7 @@ export const chartInitConfig = { |
28 | 28 | h: 300, |
29 | 29 | // 不建议动 offset |
30 | 30 | offsetX: 0, |
31 | - offsetY: 0 | |
31 | + offsetY: 0, | |
32 | 32 | } |
33 | 33 | |
34 | 34 | // dialog 图标的大小 |
... | ... | @@ -44,7 +44,7 @@ export const asideCollapsedWidth = 60 |
44 | 44 | export const maskClosable = false |
45 | 45 | |
46 | 46 | // 全局边框圆角 |
47 | -export const borderRadius = '6px' | |
47 | +export const borderRadius = '4px' | |
48 | 48 | |
49 | 49 | // 轮播间隔 |
50 | 50 | export const carouselInterval = 4000 | ... | ... |
... | ... | @@ -159,7 +159,8 @@ export const fetchRouteParams = () => { |
159 | 159 | */ |
160 | 160 | export const fetchRouteParamsLocation = () => { |
161 | 161 | try { |
162 | - return document.location.hash.split('/').pop() || '' | |
162 | + // 防止添加query参数的时候,解析ID异常 | |
163 | + return document.location.hash.split('?')[0].split('/').pop() || '' | |
163 | 164 | } catch (error) { |
164 | 165 | window['$message'].warning('查询路由信息失败,请联系管理员!') |
165 | 166 | return '' | ... | ... |
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | <slot name="icon"></slot> |
11 | 11 | </div> |
12 | 12 | </n-space> |
13 | - <n-space align="center" style="gap: 4px"> | |
13 | + <n-space class="go-flex-no-wrap" align="center" style="gap: 4px"> | |
14 | 14 | <slot name="top-right"></slot> |
15 | 15 | <n-icon v-show="backIcon" size="20" class="go-cursor-pointer go-d-block" @click="backHandle"> |
16 | 16 | <chevron-back-outline-icon></chevron-back-outline-icon> | ... | ... |
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | draggable |
14 | 14 | @dragstart="dragStartHandle($event, item)" |
15 | 15 | @dragend="dragendHandle" |
16 | - @dblclick="dblclickHandle(item)" | |
16 | + @dblclick="dblclickHandle(item)" | |
17 | 17 | > |
18 | 18 | <div class="list-header"> |
19 | 19 | <mac-os-control-btn class="list-header-control-btn" :mini="true" :disabled="true"></mac-os-control-btn> | ... | ... |
... | ... | @@ -3,21 +3,34 @@ |
3 | 3 | <n-form inline :label-width="45" size="small" label-placement="left"> |
4 | 4 | <n-form-item label="宽度"> |
5 | 5 | <!-- 尺寸选择 --> |
6 | - <n-input-number size="small" v-model:value="canvasConfig.width" :disabled="editCanvas.lockScale" | |
7 | - :validator="validator" @update:value="changeSizeHandle"></n-input-number> | |
6 | + <n-input-number | |
7 | + size="small" | |
8 | + v-model:value="canvasConfig.width" | |
9 | + :disabled="editCanvas.lockScale" | |
10 | + :validator="validator" | |
11 | + @update:value="changeSizeHandle" | |
12 | + ></n-input-number> | |
8 | 13 | </n-form-item> |
9 | 14 | <n-form-item label="高度"> |
10 | - <n-input-number size="small" v-model:value="canvasConfig.height" :disabled="editCanvas.lockScale" | |
11 | - :validator="validator" @update:value="changeSizeHandle"></n-input-number> | |
15 | + <n-input-number | |
16 | + size="small" | |
17 | + v-model:value="canvasConfig.height" | |
18 | + :disabled="editCanvas.lockScale" | |
19 | + :validator="validator" | |
20 | + @update:value="changeSizeHandle" | |
21 | + ></n-input-number> | |
12 | 22 | </n-form-item> |
13 | 23 | </n-form> |
14 | 24 | |
15 | - <n-card class="upload-box"> | |
16 | - <n-upload v-model:file-list="uploadFileListRef" :show-file-list="false" :customRequest="customRequest" | |
17 | - :onBeforeUpload="beforeUploadHandle"> | |
25 | + <div class="upload-box"> | |
26 | + <n-upload | |
27 | + v-model:file-list="uploadFileListRef" | |
28 | + :show-file-list="false" | |
29 | + :customRequest="customRequest" | |
30 | + :onBeforeUpload="beforeUploadHandle" | |
31 | + > | |
18 | 32 | <n-upload-dragger> |
19 | - <!-- THINGS_KIT 路径转换,同步生产环境与开发环境的保存的静态资源文件路径不一致 --> | |
20 | - <img v-if="canvasConfig.backgroundImage" class="upload-show" :src="getPath(canvasConfig.backgroundImage)" alt="背景" /> | |
33 | + <img v-if="canvasConfig.backgroundImage" class="upload-show" :src="canvasConfig.backgroundImage" alt="背景" /> | |
21 | 34 | <div class="upload-img" v-show="!canvasConfig.backgroundImage"> |
22 | 35 | <img src="@/assets/images/canvas/noImage.png" /> |
23 | 36 | <n-text class="upload-desc" depth="3"> |
... | ... | @@ -26,22 +39,33 @@ |
26 | 39 | </div> |
27 | 40 | </n-upload-dragger> |
28 | 41 | </n-upload> |
29 | - </n-card> | |
42 | + </div> | |
30 | 43 | <n-space vertical :size="12"> |
31 | 44 | <n-space> |
32 | 45 | <!-- THINGS_KIT 新增预置背景选择 --> |
33 | 46 | <SelectBackgroundImage /> |
34 | 47 | <n-text>背景颜色</n-text> |
35 | 48 | <div class="picker-height"> |
36 | - <n-color-picker v-if="!switchSelectColorLoading" size="small" style="width: 250px" | |
37 | - v-model:value="canvasConfig.background" :showPreview="true" :swatches="swatchesColors"></n-color-picker> | |
49 | + <n-color-picker | |
50 | + v-if="!switchSelectColorLoading" | |
51 | + size="small" | |
52 | + style="width: 250px" | |
53 | + v-model:value="canvasConfig.background" | |
54 | + :showPreview="true" | |
55 | + :swatches="swatchesColors" | |
56 | + ></n-color-picker> | |
38 | 57 | </div> |
39 | 58 | </n-space> |
40 | 59 | <n-space> |
41 | 60 | <n-text>应用类型</n-text> |
42 | - <n-select size="small" style="width: 250px" v-model:value="selectColorValue" | |
43 | - :disabled="!canvasConfig.backgroundImage" :options="selectColorOptions" | |
44 | - @update:value="selectColorValueHandle" /> | |
61 | + <n-select | |
62 | + size="small" | |
63 | + style="width: 250px" | |
64 | + v-model:value="selectColorValue" | |
65 | + :disabled="!canvasConfig.backgroundImage" | |
66 | + :options="selectColorOptions" | |
67 | + @update:value="selectColorValueHandle" | |
68 | + /> | |
45 | 69 | </n-space> |
46 | 70 | <n-space> |
47 | 71 | <n-text>背景控制</n-text> |
... | ... | @@ -55,9 +79,14 @@ |
55 | 79 | <n-space> |
56 | 80 | <n-text>适配方式</n-text> |
57 | 81 | <n-button-group> |
58 | - <n-button v-for="item in previewTypeList" :key="item.key" | |
59 | - :type="canvasConfig.previewScaleType === item.key ? 'primary' : 'tertiary'" ghost size="small" | |
60 | - @click="selectPreviewType(item.key)"> | |
82 | + <n-button | |
83 | + v-for="item in previewTypeList" | |
84 | + :key="item.key" | |
85 | + :type="canvasConfig.previewScaleType === item.key ? 'primary' : 'tertiary'" | |
86 | + ghost | |
87 | + size="small" | |
88 | + @click="selectPreviewType(item.key)" | |
89 | + > | |
61 | 90 | <n-tooltip :show-arrow="false" trigger="hover"> |
62 | 91 | <template #trigger> |
63 | 92 | <n-icon class="select-preview-icon" size="18"> |
... | ... | @@ -77,8 +106,13 @@ |
77 | 106 | |
78 | 107 | <!-- 主题选择和全局配置 --> |
79 | 108 | <n-tabs class="tabs-box" size="small" type="segment"> |
80 | - <n-tab-pane v-for="item in globalTabList" :key="item.key" :name="item.key" size="small" | |
81 | - display-directive="show:lazy"> | |
109 | + <n-tab-pane | |
110 | + v-for="item in globalTabList" | |
111 | + :key="item.key" | |
112 | + :name="item.key" | |
113 | + size="small" | |
114 | + display-directive="show:lazy" | |
115 | + > | |
82 | 116 | <template #tab> |
83 | 117 | <n-space> |
84 | 118 | <span>{{ item.title }}</span> |
... | ... | @@ -96,7 +130,7 @@ |
96 | 130 | <script setup lang="ts"> |
97 | 131 | import { ref, nextTick, watch } from 'vue' |
98 | 132 | import { backgroundImageSize } from '@/settings/designSetting' |
99 | -import { swatchesColors } from '@/settings/chartThemes' | |
133 | +import { swatchesColors } from '@/settings/chartThemes/index' | |
100 | 134 | import { FileTypeEnum } from '@/enums/fileTypeEnum' |
101 | 135 | import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' |
102 | 136 | import { EditCanvasConfigEnum } from '@/store/modules/chartEditStore/chartEditStore.d' |
... | ... | @@ -259,14 +293,11 @@ const selectPreviewType = (key: PreviewScaleEnum) => { |
259 | 293 | <style lang="scss" scoped> |
260 | 294 | $uploadWidth: 326px; |
261 | 295 | $uploadHeight: 193px; |
262 | - | |
263 | 296 | @include go(canvas-setting) { |
264 | 297 | padding-top: 20px; |
265 | - | |
266 | 298 | .upload-box { |
267 | 299 | cursor: pointer; |
268 | 300 | margin-bottom: 20px; |
269 | - | |
270 | 301 | @include deep() { |
271 | 302 | .n-card__content { |
272 | 303 | padding: 0; |
... | ... | @@ -276,48 +307,40 @@ $uploadHeight: 193px; |
276 | 307 | .n-upload-dragger { |
277 | 308 | padding: 5px; |
278 | 309 | width: $uploadWidth; |
310 | + background-color: rgba(0, 0, 0, 0); | |
279 | 311 | } |
280 | 312 | } |
281 | - | |
282 | 313 | .upload-show { |
283 | 314 | width: -webkit-fill-available; |
284 | 315 | height: $uploadHeight; |
285 | 316 | border-radius: 5px; |
286 | 317 | } |
287 | - | |
288 | 318 | .upload-img { |
289 | 319 | display: flex; |
290 | 320 | flex-direction: column; |
291 | 321 | align-items: center; |
292 | - | |
293 | 322 | img { |
294 | 323 | height: 150px; |
295 | 324 | } |
296 | - | |
297 | 325 | .upload-desc { |
298 | 326 | padding: 10px 0; |
299 | 327 | } |
300 | 328 | } |
301 | 329 | } |
302 | - | |
303 | 330 | .icon-position { |
304 | 331 | padding-top: 2px; |
305 | 332 | } |
306 | - | |
307 | 333 | .picker-height { |
308 | 334 | min-height: 35px; |
309 | 335 | } |
310 | - | |
311 | 336 | .clear-btn { |
312 | 337 | padding-left: 2.25em; |
313 | 338 | padding-right: 2.25em; |
314 | 339 | } |
315 | - | |
316 | 340 | .select-preview-icon { |
317 | - padding-right: .68em; | |
318 | - padding-left: .68em; | |
341 | + padding-right: 0.68em; | |
342 | + padding-left: 0.68em; | |
319 | 343 | } |
320 | - | |
321 | 344 | .tabs-box { |
322 | 345 | margin-top: 20px; |
323 | 346 | } | ... | ... |
... | ... | @@ -135,8 +135,9 @@ const sendHandle = async () => { |
135 | 135 | showMatching.value = true |
136 | 136 | return |
137 | 137 | } |
138 | - window['$message'].warning('数据异常,请检查参数!') | |
138 | + window['$message'].warning('没有拿到返回值,请检查接口!') | |
139 | 139 | } catch (error) { |
140 | + console.error(error); | |
140 | 141 | loading.value = false |
141 | 142 | window['$message'].warning('数据异常,请检查参数!') |
142 | 143 | } | ... | ... |
... | ... | @@ -132,8 +132,9 @@ const fetchTargetData = async () => { |
132 | 132 | sourceData.value = res |
133 | 133 | return |
134 | 134 | } |
135 | - window['$message'].warning('数据异常,请检查参数!') | |
135 | + window['$message'].warning('没有拿到返回值,请检查接口!') | |
136 | 136 | } catch (error) { |
137 | + console.error(error); | |
137 | 138 | window['$message'].warning('数据异常,请检查参数!') |
138 | 139 | } |
139 | 140 | } | ... | ... |
... | ... | @@ -114,10 +114,6 @@ const sendHandle = async () => { |
114 | 114 | } |
115 | 115 | loading.value = true |
116 | 116 | try { |
117 | - // const res = await customizeHttp( | |
118 | - // toRaw(pondData.value?.dataPondRequestConfig), | |
119 | - // toRaw(chartEditStore.getRequestGlobalConfig) | |
120 | - // ) | |
121 | 117 | const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.getRequestGlobalConfig)) |
122 | 118 | loading.value = false |
123 | 119 | if (res) { |
... | ... | @@ -126,8 +122,9 @@ const sendHandle = async () => { |
126 | 122 | showMatching.value = true |
127 | 123 | return |
128 | 124 | } |
129 | - window['$message'].warning('数据异常,请检查参数!') | |
125 | + window['$message'].warning('没有拿到返回值,请检查接口!') | |
130 | 126 | } catch (error) { |
127 | + console.error(error); | |
131 | 128 | loading.value = false |
132 | 129 | window['$message'].warning('数据异常,请检查参数!') |
133 | 130 | } | ... | ... |
... | ... | @@ -16,9 +16,10 @@ |
16 | 16 | import { computed } from 'vue' |
17 | 17 | import { loadAsyncComponent } from '@/utils' |
18 | 18 | import { SettingItemBox } from '@/components/Pages/ChartItemSetting' |
19 | +import { RequestDataTypeEnum } from '@/enums/httpEnum' | |
20 | +import { ChartFrameEnum } from '@/packages/index.d' | |
19 | 21 | import { useTargetData } from '../hooks/useTargetData.hook' |
20 | 22 | import { SelectCreateDataType, SelectCreateDataEnum } from './index.d' |
21 | -import { RequestDataTypeEnum } from '@/enums/httpEnum' | |
22 | 23 | |
23 | 24 | const ChartDataStatic = loadAsyncComponent(() => import('./components/ChartDataStatic/index.vue')) |
24 | 25 | const ChartDataAjax = loadAsyncComponent(() => import('./components/ChartDataAjax/index.vue')) |
... | ... | @@ -44,6 +45,9 @@ const selectOptions: SelectCreateDataType[] = [ |
44 | 45 | |
45 | 46 | // 无数据源 |
46 | 47 | const isNotData = computed(() => { |
47 | - return typeof targetData.value?.option?.dataset === 'undefined' | |
48 | + return ( | |
49 | + targetData.value.chartConfig?.chartFrame === ChartFrameEnum.STATIC || | |
50 | + typeof targetData.value?.option?.dataset === 'undefined' | |
51 | + ) | |
48 | 52 | }) |
49 | 53 | </script> | ... | ... |
1 | +<template> | |
2 | + <n-collapse-item title="组件交互" name="1" v-if="interactActions.length"> | |
3 | + <template #header-extra> | |
4 | + <n-button type="primary" tertiary size="small" @click.stop="evAddEventsFn"> | |
5 | + <template #icon> | |
6 | + <n-icon> | |
7 | + <add-icon /> | |
8 | + </n-icon> | |
9 | + </template> | |
10 | + 新增 | |
11 | + </n-button> | |
12 | + </template> | |
13 | + | |
14 | + <!-- 无数据 --> | |
15 | + <div v-if="!targetData.events.interactEvents.length" class="no-data go-flex-center"> | |
16 | + <img :src="noData" alt="暂无数据" /> | |
17 | + <n-text :depth="3">暂无内容</n-text> | |
18 | + </div> | |
19 | + | |
20 | + <n-card | |
21 | + v-for="(item, cardIndex) in targetData.events.interactEvents" | |
22 | + :key="cardIndex" | |
23 | + class="n-card-shallow" | |
24 | + size="small" | |
25 | + > | |
26 | + <n-space justify="space-between"> | |
27 | + <n-text>关联组件 - {{ cardIndex + 1 }}</n-text> | |
28 | + <n-button type="error" text size="small" @click="evDeleteEventsFn(cardIndex)"> | |
29 | + <template #icon> | |
30 | + <n-icon> | |
31 | + <close-icon /> | |
32 | + </n-icon> | |
33 | + </template> | |
34 | + </n-button> | |
35 | + </n-space> | |
36 | + | |
37 | + <n-divider style="margin: 10px 0" /> | |
38 | + | |
39 | + <n-tag :bordered="false" type="primary"> 选择目标组件 </n-tag> | |
40 | + | |
41 | + <setting-item-box name="触发事件" :alone="true"> | |
42 | + <n-input-group v-if="interactActions"> | |
43 | + <n-select | |
44 | + class="select-type-options" | |
45 | + v-model:value="item.interactOn" | |
46 | + size="tiny" | |
47 | + :options="interactActions" | |
48 | + /> | |
49 | + </n-input-group> | |
50 | + </setting-item-box> | |
51 | + | |
52 | + <setting-item-box :alone="true"> | |
53 | + <template #name> | |
54 | + <n-text>绑定</n-text> | |
55 | + <n-tooltip trigger="hover"> | |
56 | + <template #trigger> | |
57 | + <n-icon size="21" :depth="3"> | |
58 | + <help-outline-icon></help-outline-icon> | |
59 | + </n-icon> | |
60 | + </template> | |
61 | + <n-text>不支持「静态组件」和「分组」</n-text> | |
62 | + </n-tooltip> | |
63 | + </template> | |
64 | + <n-select | |
65 | + class="select-type-options" | |
66 | + value-field="id" | |
67 | + label-field="title" | |
68 | + size="tiny" | |
69 | + filterable | |
70 | + placeholder="仅展示符合条件的组件" | |
71 | + v-model:value="item.interactComponentId" | |
72 | + :options="fnEventsOptions()" | |
73 | + /> | |
74 | + </setting-item-box> | |
75 | + | |
76 | + <setting-item-box v-if="fnDimensionsAndSource(item.interactOn).length" name="查询结果" :alone="true"> | |
77 | + <n-table size="small" striped> | |
78 | + <thead> | |
79 | + <tr> | |
80 | + <th v-for="item in ['参数', '说明']" :key="item">{{ item }}</th> | |
81 | + </tr> | |
82 | + </thead> | |
83 | + <tbody> | |
84 | + <tr v-for="(cItem, index) in fnDimensionsAndSource(item.interactOn)" :key="index"> | |
85 | + <td>{{ cItem.value }}</td> | |
86 | + <td>{{ cItem.label }}</td> | |
87 | + </tr> | |
88 | + </tbody> | |
89 | + </n-table> | |
90 | + </setting-item-box> | |
91 | + | |
92 | + <n-tag :bordered="false" type="primary"> 关联目标组件请求参数 </n-tag> | |
93 | + | |
94 | + <setting-item-box | |
95 | + :name="requestParamsItem" | |
96 | + v-for="requestParamsItem in requestParamsTypeList" | |
97 | + :key="requestParamsItem" | |
98 | + > | |
99 | + <setting-item | |
100 | + v-for="(ovlValue, ovlKey, index) in fnGetRequest(item.interactComponentId, requestParamsItem)" | |
101 | + :key="index" | |
102 | + :name="`${ovlKey}`" | |
103 | + > | |
104 | + <n-select | |
105 | + size="tiny" | |
106 | + v-model:value="item.interactFn[ovlKey]" | |
107 | + :options="fnDimensionsAndSource(item.interactOn)" | |
108 | + clearable | |
109 | + ></n-select> | |
110 | + </setting-item> | |
111 | + <n-text | |
112 | + v-show="JSON.stringify(fnGetRequest(item.interactComponentId, requestParamsItem)) === '{}'" | |
113 | + class="go-pt-1" | |
114 | + depth="3" | |
115 | + > | |
116 | + 暂无数据 | |
117 | + </n-text> | |
118 | + </setting-item-box> | |
119 | + </n-card> | |
120 | + </n-collapse-item> | |
121 | +</template> | |
122 | + | |
123 | +<script lang="ts" setup> | |
124 | +import { VNodeChild, computed } from 'vue' | |
125 | +import { SelectOption, SelectGroupOption } from 'naive-ui' | |
126 | +import { SettingItemBox, SettingItem, CollapseItem } from '@/components/Pages/ChartItemSetting' | |
127 | +import { CreateComponentType, CreateComponentGroupType, ChartFrameEnum } from '@/packages/index.d' | |
128 | +import { RequestParamsTypeEnum } from '@/enums/httpEnum' | |
129 | +import { InteractEventOn, COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum' | |
130 | +import { icon } from '@/plugins' | |
131 | +import noData from '@/assets/images/canvas/noData.png' | |
132 | +import { goDialog } from '@/utils' | |
133 | +import { useTargetData } from '../../../hooks/useTargetData.hook' | |
134 | + | |
135 | +const { CloseIcon, AddIcon, HelpOutlineIcon } = icon.ionicons5 | |
136 | +const { targetData, chartEditStore } = useTargetData() | |
137 | +const requestParamsTypeList = [RequestParamsTypeEnum.PARAMS, RequestParamsTypeEnum.HEADER] | |
138 | + | |
139 | +// 获取组件交互事件列表 | |
140 | +const interactActions = computed(() => { | |
141 | + const interactActions = targetData.value.interactActions | |
142 | + if (!interactActions) return [] | |
143 | + return interactActions.map(value => ({ | |
144 | + label: value.interactName, | |
145 | + value: value.interactType | |
146 | + })) | |
147 | +}) | |
148 | + | |
149 | +// 获取组件事件 | |
150 | +const option = computed(() => { | |
151 | + return targetData.value.option | |
152 | +}) | |
153 | + | |
154 | +// 绑定组件数据 request | |
155 | +const fnGetRequest = (id: string | undefined, key: RequestParamsTypeEnum) => { | |
156 | + if (!id) return {} | |
157 | + return chartEditStore.componentList[chartEditStore.fetchTargetIndex(id)]?.request.requestParams[key] | |
158 | +} | |
159 | + | |
160 | +// 查询结果 | |
161 | +const fnDimensionsAndSource = (interactOn: InteractEventOn | undefined) => { | |
162 | + if (!interactOn || !targetData.value.interactActions) return [] | |
163 | + const tableData = targetData.value.interactActions.find(item => { | |
164 | + return item.interactType === interactOn | |
165 | + }) | |
166 | + | |
167 | + return tableData?.componentEmitEvents[option.value[COMPONENT_INTERACT_EVENT_KET]] || [] | |
168 | +} | |
169 | + | |
170 | +// 绑定组件列表 | |
171 | +const fnEventsOptions = (): Array<SelectOption | SelectGroupOption> => { | |
172 | + const filterOptionList = chartEditStore.componentList.filter(item => { | |
173 | + // 排除自己 | |
174 | + const isNotSelf = item.id !== targetData.value.id | |
175 | + // 排除静态组件 | |
176 | + const isNotStatic = item.chartConfig.chartFrame !== ChartFrameEnum.STATIC | |
177 | + // 排除分组 | |
178 | + const isNotGroup = !item.isGroup | |
179 | + | |
180 | + return isNotSelf && isNotStatic && isNotGroup | |
181 | + }) | |
182 | + | |
183 | + const mapOptionList = filterOptionList.map(item => ({ | |
184 | + id: item.id, | |
185 | + title: item.chartConfig.title, | |
186 | + disabled: false | |
187 | + })) | |
188 | + | |
189 | + targetData.value.events.interactEvents?.forEach(iaItem => { | |
190 | + mapOptionList.forEach(optionItem => { | |
191 | + if (optionItem.id === iaItem.interactComponentId) { | |
192 | + optionItem.disabled = true | |
193 | + } | |
194 | + }) | |
195 | + }) | |
196 | + | |
197 | + return mapOptionList | |
198 | +} | |
199 | + | |
200 | +// 新增模块 | |
201 | +const evAddEventsFn = () => { | |
202 | + targetData.value.events.interactEvents.push({ | |
203 | + interactOn: undefined, | |
204 | + interactComponentId: undefined, | |
205 | + interactFn: {} | |
206 | + }) | |
207 | +} | |
208 | + | |
209 | +// 删除模块 | |
210 | +const evDeleteEventsFn = (index: number) => { | |
211 | + goDialog({ | |
212 | + message: '是否删除此关联交互模块?', | |
213 | + onPositiveCallback: () => { | |
214 | + targetData.value.events.interactEvents.splice(index, 1) | |
215 | + } | |
216 | + }) | |
217 | +} | |
218 | +</script> | |
219 | + | |
220 | +<style lang="scss" scoped> | |
221 | +.mill-chart-target-data { | |
222 | + :deep(pre) { | |
223 | + white-space: pre-wrap; | |
224 | + word-wrap: break-word; | |
225 | + } | |
226 | +} | |
227 | + | |
228 | +.n-input-group { | |
229 | + height: 30px; | |
230 | +} | |
231 | + | |
232 | +.no-data { | |
233 | + flex-direction: column; | |
234 | + width: 100%; | |
235 | + img { | |
236 | + width: 120px; | |
237 | + } | |
238 | +} | |
239 | + | |
240 | +:deep(.n-base-selection .n-base-selection-label) { | |
241 | + height: 32px; | |
242 | +} | |
243 | +</style> | ... | ... |
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | 组件 id: |
6 | 6 | <n-text>{{ targetData.id }}</n-text> |
7 | 7 | </n-text> |
8 | + <chart-event-interaction></chart-event-interaction> | |
8 | 9 | <chart-event-base-handle></chart-event-base-handle> |
9 | 10 | <chart-event-advanced-handle></chart-event-advanced-handle> |
10 | 11 | </n-collapse> |
... | ... | @@ -12,6 +13,7 @@ |
12 | 13 | |
13 | 14 | <script setup lang="ts"> |
14 | 15 | import { ref } from 'vue' |
16 | +import { ChartEventInteraction } from './components/ChartEventInteraction' | |
15 | 17 | import { ChartEventAdvancedHandle } from './components/ChartEventAdvancedHandle' |
16 | 18 | import { ChartEventBaseHandle } from './components/ChartEventBaseHandle' |
17 | 19 | import { useTargetData } from '../hooks/useTargetData.hook' | ... | ... |
... | ... | @@ -13,10 +13,11 @@ |
13 | 13 | |
14 | 14 | <!-- 缩放比例 --> |
15 | 15 | <n-select |
16 | - :disabled="lockScale" | |
16 | + ref="selectInstRef" | |
17 | 17 | class="scale-btn" |
18 | 18 | v-model:value="filterValue" |
19 | 19 | size="mini" |
20 | + :disabled="lockScale" | |
20 | 21 | :options="filterOptions" |
21 | 22 | @update:value="selectHandle" |
22 | 23 | ></n-select> |
... | ... | @@ -52,6 +53,7 @@ |
52 | 53 | </template> |
53 | 54 | |
54 | 55 | <script setup lang="ts"> |
56 | +import { SelectInst } from 'naive-ui' | |
55 | 57 | import { reactive, ref, toRefs, watchEffect } from 'vue' |
56 | 58 | import { icon } from '@/plugins' |
57 | 59 | import { EditHistory } from '../EditHistory/index' |
... | ... | @@ -59,15 +61,18 @@ import EditShortcutKey from '../EditShortcutKey/index.vue' |
59 | 61 | import { useDesignStore } from '@/store/modules/designStore/designStore' |
60 | 62 | import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' |
61 | 63 | import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d' |
64 | +import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore' | |
65 | +import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d' | |
62 | 66 | |
63 | 67 | const { LockClosedOutlineIcon, LockOpenOutlineIcon } = icon.ionicons5 |
64 | 68 | |
65 | 69 | // 全局颜色 |
66 | 70 | const designStore = useDesignStore() |
67 | 71 | const themeColor = ref(designStore.getAppTheme) |
68 | - | |
72 | +const chartLayoutStore = useChartLayoutStore() | |
69 | 73 | const chartEditStore = useChartEditStore() |
70 | 74 | const { lockScale, scale } = toRefs(chartEditStore.getEditCanvas) |
75 | +const selectInstRef = ref<SelectInst | null>(null) | |
71 | 76 | |
72 | 77 | // 缩放选项 |
73 | 78 | let filterOptions = [ |
... | ... | @@ -98,7 +103,9 @@ const filterValue = ref('') |
98 | 103 | |
99 | 104 | // 用户自选择 |
100 | 105 | const selectHandle = (v: number) => { |
106 | + selectInstRef.value?.blur() | |
101 | 107 | if (v === 0) { |
108 | + chartLayoutStore.setItemUnHandle(ChartLayoutStoreEnum.RE_POSITION_CANVAS, true) | |
102 | 109 | chartEditStore.computedScale() |
103 | 110 | return |
104 | 111 | } | ... | ... |
... | ... | @@ -48,10 +48,10 @@ const useSyncUpdateHandle = () => { |
48 | 48 | // document.hasFocus() && syncData() |
49 | 49 | // }, editToJsonInterval) |
50 | 50 | |
51 | - // 2、失焦同步数据 | |
52 | - addEventListener('blur', syncData) | |
51 | + // 失焦同步数据(暂不开启) | |
52 | + // addEventListener('blur', syncData) | |
53 | 53 | |
54 | - // 【监听JSON代码 刷新工作台图表】 | |
54 | + // 监听编辑器保存事件 刷新工作台图表 | |
55 | 55 | addEventListener(SavePageEnum.JSON, updateFn) |
56 | 56 | |
57 | 57 | // 监听编辑页关闭 |
... | ... | @@ -74,7 +74,7 @@ const useSyncUpdateHandle = () => { |
74 | 74 | use() |
75 | 75 | } |
76 | 76 | } |
77 | - | |
77 | + | |
78 | 78 | return watchHandler |
79 | 79 | } |
80 | 80 | ... | ... |