Merge branch 'dev' into master-fetch-dev

This commit is contained in:
奔跑的面条 2023-03-16 20:02:18 +08:00
commit afe17efde9
97 changed files with 1274 additions and 87 deletions
package.json
src
assets/images/chart/informations
components/Pages
enums
hooks
packages
components
Charts
Bars
BarCommon
BarCrossrange
Lines
LineCommon
LineGradientSingle
LineGradients
LineLinearSingle
Maps/MapBase
Mores
Funnel
Heatmap
Radar
TreeMap
WaterPolo
Pies
PieCircle
PieCommon
Scatters
ScatterCommon
ScatterLogarithmicRegression
Decorates
Borders
Border01
Border02
Border03
Border04
Border05
Border06
Border07
Border08
Border09
Border10
Border11
Border12
Border13
Decorates
Decorates01
Decorates02
Decorates03
Decorates04
Decorates05
Decorates06
Mores
CountDown
FlipperNumber
Number
TimeCommon
Three/ThreeEarth01
Informations
index.d.ts
public
router
settings
utils
views
chart
ContentBox
ContentConfigurations/components
ChartData
components
ChartDataAjax
ChartDataMonacoEditor
ChartDataPond
index.vue
ChartEvent
components
ChartEventAdvancedHandle
ChartEventBaseHandle
ChartEventInteraction
index.vue
ContentEdit
components/EditBottom
index.vue
ContentLayers
hooks
preview
components/PreviewRenderList
hooks
utils

@ -24,6 +24,7 @@
"axios": "^0.27.2", "axios": "^0.27.2",
"color": "^4.2.3", "color": "^4.2.3",
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"dayjs": "^1.11.7",
"dom-helpers": "^5.2.1", "dom-helpers": "^5.2.1",
"echarts-liquidfill": "^3.1.0", "echarts-liquidfill": "^3.1.0",
"echarts-stat": "^1.2.0", "echarts-stat": "^1.2.0",

Binary file not shown.

After

(image error) Size: 28 KiB

Binary file not shown.

After

(image error) Size: 18 KiB

Binary file not shown.

After

(image error) Size: 6.9 KiB

@ -0,0 +1,45 @@
<template>
<n-radio-group :value="props.modelValue || INHERIT_VALUE" @update:value="handleChange">
<n-space>
<n-tooltip :show-arrow="false" trigger="hover" v-for="item in rendererList" :key="item.value">
<template #trigger>
<n-radio :value="item.value">
{{ item.value }}
</n-radio>
</template>
{{ item.desc }}
</n-tooltip>
</n-space>
</n-radio-group>
</template>
<script setup lang="ts">
import { type EchartsRenderer } from '@/settings/chartThemes'
const props = defineProps<{ modelValue?: EchartsRenderer; includeInherit?: boolean }>()
const emits = defineEmits(['update:modelValue'])
const INHERIT_VALUE = 'inherit'
const handleChange = (val: EchartsRenderer & typeof INHERIT_VALUE) => {
emits('update:modelValue', val === INHERIT_VALUE ? undefined : val)
}
const rendererList = [
{
value: 'svg',
desc: '在缩放场景下具有更好的表现'
},
{
value: 'canvas',
desc: '数据量较大(经验判断 > 1k、较多交互时建议选择'
},
...(props.includeInherit
? [
{
value: INHERIT_VALUE,
desc: '默认继承全局配置'
}
]
: [])
]
</script>

@ -1,4 +1,34 @@
<template> <template>
<collapse-item name="渲染器">
<setting-item-box :alone="true">
<template #name>
<n-text>全局</n-text>
<n-tooltip trigger="hover">
<template #trigger>
<n-icon size="21" :depth="3">
<help-outline-icon></help-outline-icon>
</n-icon>
</template>
<n-text>所有echarts图表组件默认都将采用所选的渲染器进行渲染</n-text>
</n-tooltip>
</template>
<EchartsRendererSetting v-model="themeSetting.renderer" />
</setting-item-box>
<setting-item-box :alone="true">
<template #name>
<n-text>当前</n-text>
<n-tooltip trigger="hover">
<template #trigger>
<n-icon size="21" :depth="3">
<help-outline-icon></help-outline-icon>
</n-icon>
</template>
<n-text>仅当前组件采用指定渲染器渲染</n-text>
</n-tooltip>
</template>
<EchartsRendererSetting v-model="optionData.renderer" includeInherit />
</setting-item-box>
</collapse-item>
<collapse-item v-if="title" name="标题"> <collapse-item v-if="title" name="标题">
<template #header> <template #header>
<n-switch v-model:value="title.show" size="small"></n-switch> <n-switch v-model:value="title.show" size="small"></n-switch>
@ -283,6 +313,11 @@ import { PropType, computed } from 'vue'
import { GlobalThemeJsonType } from '@/settings/chartThemes/index' import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
import { axisConfig } from '@/packages/chartConfiguration/echarts/index' import { axisConfig } from '@/packages/chartConfiguration/echarts/index'
import { CollapseItem, SettingItemBox, SettingItem, GlobalSettingPosition } from '@/components/Pages/ChartItemSetting' import { CollapseItem, SettingItemBox, SettingItem, GlobalSettingPosition } from '@/components/Pages/ChartItemSetting'
import { icon } from '@/plugins'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import EchartsRendererSetting from './EchartsRendererSetting.vue'
const { HelpOutlineIcon } = icon.ionicons5
const props = defineProps({ const props = defineProps({
optionData: { optionData: {
@ -296,6 +331,12 @@ const props = defineProps({
} }
}) })
const chartEditStore = useChartEditStore()
const themeSetting = computed(() => {
const chartThemeSetting = chartEditStore.getEditCanvasConfig.chartThemeSetting
return chartThemeSetting
})
const title = computed(() => { const title = computed(() => {
return props.optionData.title return props.optionData.title
}) })

@ -36,7 +36,7 @@
</div> </div>
<div class="model-footer"> <div class="model-footer">
中国色列表来自于 中国色列表来自于
<n-a href="http://zhongguose.com">http://zhongguose.com</n-a> <n-a href="http://zhongguose.com" target="_blank">http://zhongguose.com</n-a>
</div> </div>
</div> </div>
</n-modal> </n-modal>
@ -157,6 +157,7 @@ $height: 85vh;
} }
} }
.model-footer { .model-footer {
z-index: 1;
text-align: end; text-align: end;
} }
} }

@ -10,6 +10,29 @@ export enum BaseEvent {
ON_MOUSE_LEAVE = 'mouseleave' ON_MOUSE_LEAVE = 'mouseleave'
} }
// 组件交互回调事件
export enum InteractEvents {
INTERACT_ON = 'interactOn',
INTERACT_COMPONENT_ID = 'interactComponentId',
INTERACT_FN = 'interactFn'
}
// 全局组件交互回调事件触发的类型(当然可以自定义名称)
export enum InteractEventOn {
CLICK = 'click',
CHANGE = 'change'
}
// 确定交互组件触发类型 key名称
export const COMPONENT_INTERACT_EVENT_KET = 'componentInteractEventKey'
// 交互式组件的触发配置
export type InteractActionsType = {
interactType: InteractEventOn
interactName: string
componentEmitEvents: { [T: string]: { value: any; label: string }[] }
}
// vue3 生命周期事件 // vue3 生命周期事件
export enum EventLife { export enum EventLife {
// 渲染之后 // 渲染之后

@ -6,3 +6,4 @@ export * from '@/hooks/useSystemInit.hook'
export * from '@/hooks/useChartDataPondFetch.hook' export * from '@/hooks/useChartDataPondFetch.hook'
export * from '@/hooks/useLifeHandler.hook' export * from '@/hooks/useLifeHandler.hook'
export * from '@/hooks/useLang.hook' export * from '@/hooks/useLang.hook'
export * from '@/hooks/useChartInteract.hook'

@ -0,0 +1,26 @@
import { inject, type Ref } from 'vue'
import { EchartsRenderer } from '@/settings/chartThemes'
import { SCALE_KEY } from '@/views/preview/hooks/useScale.hook'
import { use } from 'echarts/core'
import { CanvasRenderer, SVGRenderer } from 'echarts/renderers'
use([CanvasRenderer, SVGRenderer])
type InitOptions = {
renderer: EchartsRenderer
devicePixelRatio?: number
}
// 获取需要给当前echarts组件设置什么初始值
export function useCanvasInitOptions(option: any, themeSetting: any) {
const renderer = option.renderer || themeSetting.renderer
const initOptions: InitOptions = { renderer }
const scaleRef = inject<Ref<{ width: number; height: number }>>(SCALE_KEY) || { value: { width: 1, height: 1 } }
if (renderer === 'canvas') {
initOptions.devicePixelRatio = Math.ceil(
Math.max(window.devicePixelRatio, scaleRef.value.width, scaleRef.value.height)
)
}
return initOptions
}

@ -1,4 +1,4 @@
import { ref, toRefs, toRaw } from 'vue' import { ref, toRefs, toRaw, watch } from 'vue'
import type VChart from 'vue-echarts' import type VChart from 'vue-echarts'
import { customizeHttp } from '@/api/http' import { customizeHttp } from '@/api/http'
import { useChartDataPondFetch } from '@/hooks/' import { useChartDataPondFetch } from '@/hooks/'
@ -87,8 +87,18 @@ export const useChartDataFetch = (
} }
} }
// 立即调用 // 普通初始化与组件交互处理监听
watch(
() => targetComponent.request,
() => {
fetchFn() fetchFn()
},
{
immediate: true,
deep: true
}
)
// 定时时间 // 定时时间
const time = targetInterval && targetInterval.value ? targetInterval.value : globalRequestInterval.value const time = targetInterval && targetInterval.value ? targetInterval.value : globalRequestInterval.value
// 单位 // 单位

@ -0,0 +1,40 @@
import { toRefs } from 'vue'
import { CreateComponentType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
// 获取类型
type ChartEditStoreType = typeof useChartEditStore
// Params 参数修改触发 api 更新图表请求
export const useChartInteract = (
chartConfig: CreateComponentType,
useChartEditStore: ChartEditStoreType,
param: { [T: string]: any },
interactEventOn: string
) => {
const chartEditStore = useChartEditStore()
const { interactEvents } = chartConfig.events
const fnOnEvent = interactEvents.filter(item => {
return item.interactOn === interactEventOn
})
if (fnOnEvent.length === 0) return
fnOnEvent.forEach(item => {
const index = chartEditStore.fetchTargetIndex(item.interactComponentId)
if (index === -1) return
const { Params, Header } = toRefs(chartEditStore.componentList[index].request.requestParams)
Object.keys(item.interactFn).forEach(key => {
if (Params.value[key]) {
Params.value[key] = param[item.interactFn[key]]
}
if (Header.value[key]) {
Header.value[key] = param[item.interactFn[key]]
}
})
})
}
// 联动事件触发的 type 变更时,清除当前绑定内容
export const clearInteractEvent = (chartConfig: CreateComponentType) => {
}

@ -1,6 +1,7 @@
<template> <template>
<v-chart <v-chart
ref="vChartRef" ref="vChartRef"
:init-options="initOptions"
:theme="themeColor" :theme="themeColor"
:option="option" :option="option"
:manual-update="isPreview()" :manual-update="isPreview()"
@ -14,6 +15,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, nextTick, computed, watch, PropType } from 'vue' import { ref, nextTick, computed, watch, PropType } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { BarChart } from 'echarts/charts' import { BarChart } from 'echarts/charts'
@ -41,6 +43,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent]) use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
const replaceMergeArr = ref<string[]>() const replaceMergeArr = ref<string[]>()

@ -1,6 +1,7 @@
<template> <template>
<v-chart <v-chart
ref="vChartRef" ref="vChartRef"
:init-options="initOptions"
:theme="themeColor" :theme="themeColor"
:option="option" :option="option"
:manual-update="isPreview()" :manual-update="isPreview()"
@ -14,6 +15,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, nextTick, computed, watch, PropType } from 'vue' import { ref, nextTick, computed, watch, PropType } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { BarChart } from 'echarts/charts' import { BarChart } from 'echarts/charts'
@ -40,6 +42,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent]) use([DatasetComponent, CanvasRenderer, BarChart, GridComponent, TooltipComponent, LegendComponent])
const replaceMergeArr = ref<string[]>() const replaceMergeArr = ref<string[]>()

@ -1,6 +1,7 @@
<template> <template>
<v-chart <v-chart
ref="vChartRef" ref="vChartRef"
:init-options="initOptions"
:theme="themeColor" :theme="themeColor"
:option="option" :option="option"
:manual-update="isPreview()" :manual-update="isPreview()"
@ -15,6 +16,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { PropType, computed, watch, ref, nextTick } from 'vue' import { PropType, computed, watch, ref, nextTick } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { LineChart } from 'echarts/charts' import { LineChart } from 'echarts/charts'
@ -41,6 +43,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent]) use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
const replaceMergeArr = ref<string[]>() const replaceMergeArr = ref<string[]>()

@ -1,11 +1,12 @@
<template> <template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize> <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
</v-chart> </v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, watch, PropType } from 'vue' import { reactive, watch, PropType } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use, graphic } from 'echarts/core' import { use, graphic } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { LineChart } from 'echarts/charts' import { LineChart } from 'echarts/charts'
@ -32,6 +33,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent]) use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
const chartEditStore = useChartEditStore() const chartEditStore = useChartEditStore()

@ -1,10 +1,11 @@
<template> <template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize></v-chart> <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize></v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, watch, PropType } from 'vue' import { reactive, watch, PropType } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use, graphic } from 'echarts/core' import { use, graphic } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { LineChart } from 'echarts/charts' import { LineChart } from 'echarts/charts'
@ -31,6 +32,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent]) use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
const chartEditStore = useChartEditStore() const chartEditStore = useChartEditStore()

@ -1,11 +1,12 @@
<template> <template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize> <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
</v-chart> </v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PropType, watch, reactive } from 'vue' import { PropType, watch, reactive } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { LineChart } from 'echarts/charts' import { LineChart } from 'echarts/charts'
@ -32,6 +33,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent]) use([DatasetComponent, CanvasRenderer, LineChart, GridComponent, TooltipComponent, LegendComponent])
const chartEditStore = useChartEditStore() const chartEditStore = useChartEditStore()

@ -1,5 +1,5 @@
<template> <template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize> <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize>
</v-chart> </v-chart>
</template> </template>
@ -7,6 +7,7 @@
import { PropType, reactive, watch, ref, nextTick } from 'vue' import { PropType, reactive, watch, ref, nextTick } from 'vue'
import config, { includes } from './config' import config, { includes } from './config'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use, registerMap } from 'echarts/core' import { use, registerMap } from 'echarts/core'
import { EffectScatterChart, MapChart } from 'echarts/charts' import { EffectScatterChart, MapChart } from 'echarts/charts'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
@ -32,6 +33,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([ use([
MapChart, MapChart,
DatasetComponent, DatasetComponent,

@ -1,10 +1,11 @@
<template> <template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, PropType } from 'vue' import { computed, PropType } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { FunnelChart } from 'echarts/charts' import { FunnelChart } from 'echarts/charts'
@ -31,6 +32,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([DatasetComponent, CanvasRenderer, FunnelChart, GridComponent, TooltipComponent, LegendComponent]) use([DatasetComponent, CanvasRenderer, FunnelChart, GridComponent, TooltipComponent, LegendComponent])
const option = computed(() => { const option = computed(() => {

@ -1,10 +1,11 @@
<template> <template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch, computed, PropType } from 'vue' import { ref, watch, computed, PropType } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import dataJson from './data.json' import dataJson from './data.json'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
@ -38,6 +39,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([ use([
DatasetComponent, DatasetComponent,
CanvasRenderer, CanvasRenderer,

@ -1,10 +1,11 @@
<template> <template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, PropType, watch } from 'vue' import { ref, computed, PropType, watch } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import dataJson from './data.json' import dataJson from './data.json'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
@ -32,6 +33,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([DatasetComponent, CanvasRenderer, RadarChart, GridComponent, TooltipComponent, LegendComponent]) use([DatasetComponent, CanvasRenderer, RadarChart, GridComponent, TooltipComponent, LegendComponent])
const vChartRef = ref<typeof VChart>() const vChartRef = ref<typeof VChart>()

@ -1,10 +1,11 @@
<template> <template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, PropType, watch } from 'vue' import { ref, computed, PropType, watch } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import dataJson from './data.json' import dataJson from './data.json'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
@ -31,6 +32,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([CanvasRenderer, TreemapChart]) use([CanvasRenderer, TreemapChart])
const vChartRef = ref<typeof VChart>() const vChartRef = ref<typeof VChart>()

@ -1,10 +1,11 @@
<template> <template>
<v-chart :theme="themeColor" :option="option.value" autoresize></v-chart> <v-chart :theme="themeColor" :init-options="initOptions" :option="option.value" autoresize></v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PropType, watch, reactive } from 'vue' import { PropType, watch, reactive } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import 'echarts-liquidfill/src/liquidFill.js' import 'echarts-liquidfill/src/liquidFill.js'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
@ -30,6 +31,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([CanvasRenderer, GridComponent]) use([CanvasRenderer, GridComponent])
const chartEditStore = useChartEditStore() const chartEditStore = useChartEditStore()

@ -1,10 +1,11 @@
<template> <template>
<v-chart :theme="themeColor" :option="option.value" autoresize> </v-chart> <v-chart :theme="themeColor" :init-options="initOptions" :option="option.value" autoresize> </v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { PropType, reactive, watch } from 'vue' import { PropType, reactive, watch } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { PieChart } from 'echarts/charts' import { PieChart } from 'echarts/charts'
@ -29,6 +30,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent, TitleComponent]) use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent, TitleComponent])
const option = reactive({ const option = reactive({

@ -1,10 +1,11 @@
<template> <template>
<v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart> <v-chart ref="vChartRef" :init-options="initOptions" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, PropType, reactive, watch } from 'vue' import { computed, PropType, reactive, watch } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { PieChart } from 'echarts/charts' import { PieChart } from 'echarts/charts'
@ -30,6 +31,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent]) use([DatasetComponent, CanvasRenderer, PieChart, GridComponent, TooltipComponent, LegendComponent])
const option = computed(() => { const option = computed(() => {

@ -1,6 +1,7 @@
<template> <template>
<v-chart <v-chart
ref="vChartRef" ref="vChartRef"
:init-options="initOptions"
:theme="themeColor" :theme="themeColor"
:option="option" :option="option"
:manual-update="isPreview()" :manual-update="isPreview()"
@ -13,6 +14,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { PropType, computed, watch, ref, nextTick } from 'vue' import { PropType, computed, watch, ref, nextTick } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { ScatterChart, EffectScatterChart } from 'echarts/charts' import { ScatterChart, EffectScatterChart } from 'echarts/charts'
@ -46,6 +48,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([ use([
DatasetComponent, DatasetComponent,
CanvasRenderer, CanvasRenderer,

@ -1,6 +1,7 @@
<template> <template>
<v-chart <v-chart
ref="vChartRef" ref="vChartRef"
:init-options="initOptions"
:theme="themeColor" :theme="themeColor"
:option="option" :option="option"
:manual-update="isPreview()" :manual-update="isPreview()"
@ -13,6 +14,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { PropType, computed, ref } from 'vue' import { PropType, computed, ref } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import ecStat from 'echarts-stat' import ecStat from 'echarts-stat'
import { use, registerTransform } from 'echarts/core' import { use, registerTransform } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
@ -47,6 +49,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([ use([
DatasetComponent, DatasetComponent,
CanvasRenderer, CanvasRenderer,

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border01Config: ConfigType = { export const Border01Config: ConfigType = {
@ -9,5 +9,6 @@ export const Border01Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border01.png' image: 'border01.png'
} }

@ -1,5 +1,4 @@
import image from '@/assets/images/chart/decorates/border02.png' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum} from '@/packages/index.d'
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border02Config: ConfigType = { export const Border02Config: ConfigType = {
@ -10,5 +9,6 @@ export const Border02Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border02.png' image: 'border02.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border03Config: ConfigType = { export const Border03Config: ConfigType = {
@ -9,5 +9,6 @@ export const Border03Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border03.png' image: 'border03.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border04Config: ConfigType = { export const Border04Config: ConfigType = {
@ -9,5 +9,6 @@ export const Border04Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border04.png' image: 'border04.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border05Config: ConfigType = { export const Border05Config: ConfigType = {
@ -9,5 +9,6 @@ export const Border05Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border05.png' image: 'border05.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border06Config: ConfigType = { export const Border06Config: ConfigType = {
@ -9,5 +9,6 @@ export const Border06Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border06.png' image: 'border06.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border07Config: ConfigType = { export const Border07Config: ConfigType = {
@ -9,5 +9,6 @@ export const Border07Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border07.png' image: 'border07.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border08Config: ConfigType = { export const Border08Config: ConfigType = {
@ -9,5 +9,6 @@ export const Border08Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border08.png' image: 'border08.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border09Config: ConfigType = { export const Border09Config: ConfigType = {
@ -9,5 +9,6 @@ export const Border09Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border09.png' image: 'border09.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border10Config: ConfigType = { export const Border10Config: ConfigType = {
@ -9,5 +9,6 @@ export const Border10Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border10.png' image: 'border10.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border11Config: ConfigType = { export const Border11Config: ConfigType = {
@ -9,5 +9,6 @@ export const Border11Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border11.png' image: 'border11.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border12Config: ConfigType = { export const Border12Config: ConfigType = {
@ -9,5 +9,6 @@ export const Border12Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border12.png' image: 'border12.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Border13Config: ConfigType = { export const Border13Config: ConfigType = {
@ -9,5 +9,6 @@ export const Border13Config: ConfigType = {
category: ChatCategoryEnum.BORDER, category: ChatCategoryEnum.BORDER,
categoryName: ChatCategoryEnumName.BORDER, categoryName: ChatCategoryEnumName.BORDER,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'border13.png' image: 'border13.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const Decorates01Config: ConfigType = { export const Decorates01Config: ConfigType = {
@ -9,5 +9,6 @@ export const Decorates01Config: ConfigType = {
category: ChatCategoryEnum.DECORATE, category: ChatCategoryEnum.DECORATE,
categoryName: ChatCategoryEnumName.DECORATE, categoryName: ChatCategoryEnumName.DECORATE,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'decorates01.png' image: 'decorates01.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const Decorates02Config: ConfigType = { export const Decorates02Config: ConfigType = {
@ -9,5 +9,6 @@ export const Decorates02Config: ConfigType = {
category: ChatCategoryEnum.DECORATE, category: ChatCategoryEnum.DECORATE,
categoryName: ChatCategoryEnumName.DECORATE, categoryName: ChatCategoryEnumName.DECORATE,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'decorates02.png' image: 'decorates02.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Decorates03Config: ConfigType = { export const Decorates03Config: ConfigType = {
@ -9,5 +9,6 @@ export const Decorates03Config: ConfigType = {
category: ChatCategoryEnum.DECORATE, category: ChatCategoryEnum.DECORATE,
categoryName: ChatCategoryEnumName.DECORATE, categoryName: ChatCategoryEnumName.DECORATE,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
image: 'decorates01.png' chartFrame: ChartFrameEnum.STATIC,
image: 'decorates03.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Decorates04Config: ConfigType = { export const Decorates04Config: ConfigType = {
@ -9,5 +9,6 @@ export const Decorates04Config: ConfigType = {
category: ChatCategoryEnum.DECORATE, category: ChatCategoryEnum.DECORATE,
categoryName: ChatCategoryEnumName.DECORATE, categoryName: ChatCategoryEnumName.DECORATE,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'decorates04.png' image: 'decorates04.png'
} }

@ -1,5 +1,4 @@
import image from '@/assets/images/chart/decorates/decorates05.png' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const Decorates05Config: ConfigType = { export const Decorates05Config: ConfigType = {
@ -10,5 +9,6 @@ export const Decorates05Config: ConfigType = {
category: ChatCategoryEnum.DECORATE, category: ChatCategoryEnum.DECORATE,
categoryName: ChatCategoryEnumName.DECORATE, categoryName: ChatCategoryEnumName.DECORATE,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'decorates05.png' image: 'decorates05.png'
} }

@ -9,6 +9,6 @@ export const Decorates06Config: ConfigType = {
category: ChatCategoryEnum.DECORATE, category: ChatCategoryEnum.DECORATE,
categoryName: ChatCategoryEnumName.DECORATE, categoryName: ChatCategoryEnumName.DECORATE,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.COMMON, chartFrame: ChartFrameEnum.STATIC,
image: 'decorates06.png' image: 'decorates06.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const CountDownConfig: ConfigType = { export const CountDownConfig: ConfigType = {
@ -9,5 +9,6 @@ export const CountDownConfig: ConfigType = {
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE, categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.COMMON,
image: 'countdown.png' image: 'countdown.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const FlipperNumberConfig: ConfigType = { export const FlipperNumberConfig: ConfigType = {
@ -9,5 +9,6 @@ export const FlipperNumberConfig: ConfigType = {
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE, categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.COMMON,
image: 'flipper-number.png' image: 'flipper-number.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const NumberConfig: ConfigType = { export const NumberConfig: ConfigType = {
@ -9,5 +9,6 @@ export const NumberConfig: ConfigType = {
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE, categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.COMMON,
image: 'number.png' image: 'number.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const TimeCommonConfig: ConfigType = { export const TimeCommonConfig: ConfigType = {
@ -9,5 +9,6 @@ export const TimeCommonConfig: ConfigType = {
category: ChatCategoryEnum.MORE, category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE, categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC,
image: 'time.png' image: 'time.png'
} }

@ -9,6 +9,6 @@ export const ThreeEarth01Config: ConfigType = {
category: ChatCategoryEnum.THREE, category: ChatCategoryEnum.THREE,
categoryName: ChatCategoryEnumName.THREE, categoryName: ChatCategoryEnumName.THREE,
package: PackagesCategoryEnum.DECORATES, package: PackagesCategoryEnum.DECORATES,
chartFrame: ChartFrameEnum.STATIC, chartFrame: ChartFrameEnum.COMMON,
image: 'threeEarth01.png' image: 'threeEarth01.png'
} }

@ -0,0 +1,24 @@
import dayjs from 'dayjs'
import cloneDeep from 'lodash/cloneDeep'
import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d'
import { chartInitConfig } from '@/settings/designSetting'
import { COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum'
import { interactActions, ComponentInteractEventEnum } from './interact'
import { InputsDateConfig } from './index'
export const option = {
// 时间组件展示类型,必须和 interactActions 中定义的数据一致
[COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATE,
// 下拉展示
isPanel: 0,
dataset: dayjs().valueOf()
}
export default class Config extends PublicConfigClass implements CreateComponentType {
public key = InputsDateConfig.key
public attr = { ...chartInitConfig, w: 260, h: 32, zIndex: -1 }
public chartConfig = cloneDeep(InputsDateConfig)
public interactActions = interactActions
public option = cloneDeep(option)
}

@ -0,0 +1,98 @@
<template>
<collapse-item name="展示方式" :expanded="true">
<setting-item-box name="选择方式">
<n-select
v-model:value="optionData.isPanel"
size="small"
:options="panelOptions"
/>
</setting-item-box>
</collapse-item>
<collapse-item name="时间配置" :expanded="true">
<setting-item-box name="基础">
<setting-item name="类型">
<n-select
v-model:value="optionData.componentInteractEventKey"
size="small"
:options="datePickerTypeOptions"
/>
</setting-item>
</setting-item-box>
<setting-item-box name="默认值" :alone="true">
<n-date-picker
size="small"
v-model:value="optionData.dataset"
:type="optionData.componentInteractEventKey"
/>
</setting-item-box>
</collapse-item>
</template>
<script lang="ts" setup>
import { PropType } from 'vue'
import { icon } from '@/plugins'
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
import { option } from './config'
import { ComponentInteractEventEnum } from './interact'
const { HelpOutlineIcon } = icon.ionicons5
const props = defineProps({
optionData: {
type: Object as PropType<typeof option>,
required: true
}
})
const panelOptions = [
{
label: '下拉展示',
value: 0
},
{
label: '面板展示',
value: 1
}
]
const datePickerTypeOptions = [
{
label: '日期',
value: ComponentInteractEventEnum.DATE
},
{
label: '日期时间',
value: ComponentInteractEventEnum.DATE_TIME
},
{
label: '日期范围',
value: ComponentInteractEventEnum.DATE_RANGE
},
{
label: '月份',
value: ComponentInteractEventEnum.MONTH
},
{
label: '月份范围',
value: ComponentInteractEventEnum.MONTH_RANGE
},
{
label: '年份',
value: ComponentInteractEventEnum.YEAR
},
{
label: '年份范围',
value: ComponentInteractEventEnum.YEAR_RANGE
},
{
label: '季度',
value: ComponentInteractEventEnum.QUARTER
},
{
label: '季度范围',
value: ComponentInteractEventEnum.QUARTER_RANGE
}
]
</script>

@ -0,0 +1,14 @@
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const InputsDateConfig: ConfigType = {
key: 'InputsDate',
chartKey: 'VInputsDate',
conKey: 'VCInputsDate',
title: '时间选择器',
category: ChatCategoryEnum.INPUTS,
categoryName: ChatCategoryEnumName.INPUTS,
package: PackagesCategoryEnum.INFORMATIONS,
chartFrame: ChartFrameEnum.STATIC,
image: 'inputs_date.png'
}

@ -0,0 +1,81 @@
<template>
<n-date-picker
v-model:value="option.dataset"
:panel="!!chartConfig.option.isPanel"
:type="chartConfig.option.componentInteractEventKey"
:style="`width:${w}px;`"
@update:value="onChange"
/>
</template>
<script setup lang="ts">
import { PropType, toRefs, ref, shallowReactive, watch } from 'vue'
import dayjs from 'dayjs'
import { CreateComponentType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { useChartInteract } from '@/hooks'
import { InteractEventOn } from '@/enums/eventEnum'
import { ComponentInteractParamsEnum } from './interact'
const props = defineProps({
chartConfig: {
type: Object as PropType<CreateComponentType>,
required: true
}
})
const { w, h } = toRefs(props.chartConfig.attr)
const rangeDate = ref<number | number[]>()
const option = shallowReactive({
dataset: props.chartConfig.option.dataset
})
//
const onChange = (v: number | number[]) => {
if (v instanceof Array) {
//
useChartInteract(
props.chartConfig,
useChartEditStore,
{
[ComponentInteractParamsEnum.DATE_START]: v[0] | dayjs().valueOf(),
[ComponentInteractParamsEnum.DATE_END]: v[1] | dayjs().valueOf(),
[ComponentInteractParamsEnum.DATE_RANGE]: `${v[0]}-${v[1]}`
},
InteractEventOn.CHANGE
)
} else {
//
useChartInteract(
props.chartConfig,
useChartEditStore,
{ [ComponentInteractParamsEnum.DATE]: v },
InteractEventOn.CHANGE
)
}
}
//
watch(
() => props.chartConfig.option.dataset,
(newData: number | number[]) => {
option.dataset = newData
//
onChange(newData)
},
{
immediate: true
}
)
</script>
<style lang="scss" scoped>
@include deep() {
.n-input {
height: v-bind('h + "px"');
display: flex;
align-items: center;
}
}
</style>

@ -0,0 +1,64 @@
import { InteractEventOn, InteractActionsType } from '@/enums/eventEnum'
// 时间组件类型
export enum ComponentInteractEventEnum {
DATE = 'date',
DATE_TIME = 'datetime',
DATE_RANGE = 'daterange',
DATE_TIME_RANGE = 'datetimerange',
MONTH = 'month',
MONTH_RANGE = 'monthrange',
YEAR = 'year',
YEAR_RANGE = 'yearrange',
QUARTER = 'quarter',
QUARTER_RANGE = 'quarterrange'
}
// 联动参数
export enum ComponentInteractParamsEnum {
DATE = 'date',
DATE_START = 'dateStart',
DATE_END = 'dateEnd',
DATE_RANGE = 'daterange'
}
const time = [
{
value: ComponentInteractParamsEnum.DATE,
label: '日期'
}
]
const timeRange = [
{
value: ComponentInteractParamsEnum.DATE_START,
label: '开始时间'
},
{
value: ComponentInteractParamsEnum.DATE_END,
label: '结束时间'
},
{
value: ComponentInteractParamsEnum.DATE_RANGE,
label: '日期范围'
}
]
// 定义组件触发回调事件
export const interactActions: InteractActionsType[] = [
{
interactType: InteractEventOn.CHANGE,
interactName: '选择完成',
componentEmitEvents: {
[ComponentInteractEventEnum.DATE]: time,
[ComponentInteractEventEnum.DATE_TIME]: time,
[ComponentInteractEventEnum.DATE_RANGE]: timeRange,
[ComponentInteractEventEnum.MONTH]: time,
[ComponentInteractEventEnum.MONTH_RANGE]: timeRange,
[ComponentInteractEventEnum.QUARTER]: time,
[ComponentInteractEventEnum.QUARTER_RANGE]: timeRange,
[ComponentInteractEventEnum.YEAR]: time,
[ComponentInteractEventEnum.YEAR_RANGE]: timeRange,
}
}
]

@ -0,0 +1,37 @@
import cloneDeep from 'lodash/cloneDeep'
import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d'
import { chartInitConfig } from '@/settings/designSetting'
import { COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum'
import { interactActions, ComponentInteractEventEnum } from './interact'
import { InputsSelectConfig } from './index'
export const option = {
// 时间组件展示类型,必须和 interactActions 中定义的数据一致
[COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATA,
// 默认值
selectValue: '1',
// 暴露配置内容给用户
dataset: [
{
label: '选项1',
value: '1'
},
{
label: '选项2',
value: '2'
},
{
label: '选项3',
value: '3'
}
]
}
export default class Config extends PublicConfigClass implements CreateComponentType {
public key = InputsSelectConfig.key
public attr = { ...chartInitConfig, w: 260, h: 32, zIndex: -1 }
public chartConfig = cloneDeep(InputsSelectConfig)
public interactActions = interactActions
public option = cloneDeep(option)
}

@ -0,0 +1,20 @@
<template>
<collapse-item name="下拉配置" :expanded="true">
<setting-item-box name="默认值" :alone="true">
<n-select size="small" v-model:value="optionData.selectValue" :options="optionData.dataset" />
</setting-item-box>
</collapse-item>
</template>
<script lang="ts" setup>
import { PropType } from 'vue'
import { CollapseItem, SettingItemBox } from '@/components/Pages/ChartItemSetting'
import { option } from './config'
defineProps({
optionData: {
type: Object as PropType<typeof option>,
required: true
}
})
</script>

@ -0,0 +1,14 @@
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const InputsSelectConfig: ConfigType = {
key: 'InputsSelect',
chartKey: 'VInputsSelect',
conKey: 'VCInputsSelect',
title: '下拉选择器',
category: ChatCategoryEnum.INPUTS,
categoryName: ChatCategoryEnumName.INPUTS,
package: PackagesCategoryEnum.INFORMATIONS,
chartFrame: ChartFrameEnum.STATIC,
image: 'inputs_select.png'
}

@ -0,0 +1,66 @@
<template>
<n-select
v-model:value="option.value.selectValue"
:options="option.value.dataset"
:style="`width:${w}px;`"
@update:value="onChange"
/>
</template>
<script setup lang="ts">
import { PropType, toRefs, ref, shallowReactive, watch } from 'vue'
import { CreateComponentType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { useChartInteract } from '@/hooks'
import { InteractEventOn } from '@/enums/eventEnum'
import { ComponentInteractParamsEnum } from './interact'
const props = defineProps({
chartConfig: {
type: Object as PropType<CreateComponentType>,
required: true
}
})
const { w, h } = toRefs(props.chartConfig.attr)
const option = shallowReactive({
value: {
selectValue: props.chartConfig.option.selectValue,
dataset: props.chartConfig.option.dataset
}
})
//
const onChange = (v: string) => {
//
useChartInteract(
props.chartConfig,
useChartEditStore,
{ [ComponentInteractParamsEnum.DATA]: v },
InteractEventOn.CHANGE
)
}
//
watch(
() => props.chartConfig.option,
(newData: any) => {
option.value = newData
onChange(newData.selectValue)
},
{
immediate: true,
deep: true
}
)
</script>
<style lang="scss" scoped>
@include deep() {
.n-base-selection-label {
height: v-bind('h + "px"');
display: flex;
align-items: center;
}
}
</style>

@ -0,0 +1,27 @@
import { InteractEventOn, InteractActionsType } from '@/enums/eventEnum'
// 时间组件类型
export enum ComponentInteractEventEnum {
DATA = 'data'
}
// 联动参数
export enum ComponentInteractParamsEnum {
DATA = 'data'
}
// 定义组件触发回调事件
export const interactActions: InteractActionsType[] = [
{
interactType: InteractEventOn.CHANGE,
interactName: '选择完成',
componentEmitEvents: {
[ComponentInteractEventEnum.DATA]: [
{
value: ComponentInteractParamsEnum.DATA,
label: '选择项'
}
]
}
}
]

@ -0,0 +1,39 @@
import cloneDeep from 'lodash/cloneDeep'
import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d'
import { chartInitConfig } from '@/settings/designSetting'
import { COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum'
import { interactActions, ComponentInteractEventEnum } from './interact'
import { InputsTabConfig } from './index'
export const option = {
// 时间组件展示类型,必须和 interactActions 中定义的数据一致
[COMPONENT_INTERACT_EVENT_KET]: ComponentInteractEventEnum.DATA,
// 默认值
tabLabel: '选项1',
// 样式
tabType: 'segment',
// 暴露配置内容给用户
dataset: [
{
label: '选项1',
value: '1'
},
{
label: '选项2',
value: '2'
},
{
label: '选项3',
value: '3'
}
]
}
export default class Config extends PublicConfigClass implements CreateComponentType {
public key = InputsTabConfig.key
public attr = { ...chartInitConfig, w: 460, h: 32, zIndex: -1 }
public chartConfig = cloneDeep(InputsTabConfig)
public interactActions = interactActions
public option = cloneDeep(option)
}

@ -0,0 +1,31 @@
<template>
<collapse-item name="标签页配置" :expanded="true">
<setting-item-box name="默认值" :alone="true">
<n-select size="small" v-model:value="optionData.tabType" :options="tabTypeOptions" />
</setting-item-box>
</collapse-item>
</template>
<script lang="ts" setup>
import { PropType } from 'vue'
import { CollapseItem, SettingItemBox } from '@/components/Pages/ChartItemSetting'
import { option } from './config'
defineProps({
optionData: {
type: Object as PropType<typeof option>,
required: true
}
})
const tabTypeOptions = [
{
label: '线条',
value: 'bar'
},
{
label: '分段',
value: 'segment'
}
]
</script>

@ -0,0 +1,14 @@
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const InputsTabConfig: ConfigType = {
key: 'InputsTab',
chartKey: 'VInputsTab',
conKey: 'VCInputsTab',
title: '标签选择器',
category: ChatCategoryEnum.INPUTS,
categoryName: ChatCategoryEnumName.INPUTS,
package: PackagesCategoryEnum.INFORMATIONS,
chartFrame: ChartFrameEnum.STATIC,
image: 'inputs_tab.png'
}

@ -0,0 +1,53 @@
<template>
<n-tabs :type="option.value.tabType" @update:value="onChange">
<n-tab v-for="(item, index) in option.value.dataset" :name="item.label" :key="index"> {{ item.label }} </n-tab>
</n-tabs>
</template>
<script setup lang="ts">
import { PropType, toRefs, shallowReactive, watch } from 'vue'
import cloneDeep from 'lodash/cloneDeep'
import { CreateComponentType } from '@/packages/index.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { useChartInteract } from '@/hooks'
import { InteractEventOn } from '@/enums/eventEnum'
import { ComponentInteractParamsEnum } from './interact'
const props = defineProps({
chartConfig: {
type: Object as PropType<CreateComponentType>,
required: true
}
})
const { w, h } = toRefs(props.chartConfig.attr)
const option = shallowReactive({
value: cloneDeep(props.chartConfig.option)
})
//
const onChange = (v: string) => {
if (v === undefined) return
const selectItem = option.value.dataset.find((item: { label: string; value: any }) => item.label === v)
//
useChartInteract(
props.chartConfig,
useChartEditStore,
{ [ComponentInteractParamsEnum.DATA]: selectItem.value },
InteractEventOn.CHANGE
)
}
//
watch(
() => props.chartConfig.option,
(newData: any) => {
option.value = newData
onChange(newData.tabValue)
},
{
immediate: true,
deep: true
}
)
</script>

@ -0,0 +1,27 @@
import { InteractEventOn, InteractActionsType } from '@/enums/eventEnum'
// 时间组件类型
export enum ComponentInteractEventEnum {
DATA = 'data'
}
// 联动参数
export enum ComponentInteractParamsEnum {
DATA = 'data'
}
// 定义组件触发回调事件
export const interactActions: InteractActionsType[] = [
{
interactType: InteractEventOn.CHANGE,
interactName: '选择完成',
componentEmitEvents: {
[ComponentInteractEventEnum.DATA]: [
{
value: ComponentInteractParamsEnum.DATA,
label: '选择项'
}
]
}
}
]

@ -0,0 +1,5 @@
import { InputsDateConfig } from './InputsDate/index'
import { InputsSelectConfig } from './InputsSelect/index'
import { InputsTabConfig } from './InputsTab/index'
export default [InputsDateConfig, InputsSelectConfig, InputsTabConfig]

@ -1,4 +1,5 @@
<template> <template>
<global-setting :optionData="optionData"></global-setting>
<collapse-item name="词云" expanded> <collapse-item name="词云" expanded>
<setting-item-box name="形状"> <setting-item-box name="形状">
<setting-item> <setting-item>
@ -45,7 +46,7 @@
import { PropType, computed } from 'vue' import { PropType, computed } from 'vue'
import { option, ShapeEnumList } from './config' import { option, ShapeEnumList } from './config'
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
const props = defineProps({ const props = defineProps({
optionData: { optionData: {

@ -1,6 +1,7 @@
<template> <template>
<v-chart <v-chart
ref="vChartRef" ref="vChartRef"
:init-options="initOptions"
:theme="themeColor" :theme="themeColor"
:option="option" :option="option"
:manual-update="isPreview()" :manual-update="isPreview()"
@ -12,6 +13,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, watch, PropType } from 'vue' import { ref, computed, watch, PropType } from 'vue'
import VChart from 'vue-echarts' import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import 'echarts-wordcloud' import 'echarts-wordcloud'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
@ -38,6 +40,8 @@ const props = defineProps({
} }
}) })
const initOptions = useCanvasInitOptions(props.chartConfig.option, props.themeSetting)
use([CanvasRenderer, GridComponent, TooltipComponent]) use([CanvasRenderer, GridComponent, TooltipComponent])
const replaceMergeArr = ref<string[]>() const replaceMergeArr = ref<string[]>()

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const TextBarrageConfig: ConfigType = { export const TextBarrageConfig: ConfigType = {
@ -9,5 +9,6 @@ export const TextBarrageConfig: ConfigType = {
category: ChatCategoryEnum.TEXT, category: ChatCategoryEnum.TEXT,
categoryName: ChatCategoryEnumName.TEXT, categoryName: ChatCategoryEnumName.TEXT,
package: PackagesCategoryEnum.INFORMATIONS, package: PackagesCategoryEnum.INFORMATIONS,
chartFrame: ChartFrameEnum.COMMON,
image: 'text_barrage.png' image: 'text_barrage.png'
} }

@ -1,4 +1,4 @@
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d' import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d' import { ChatCategoryEnum,ChatCategoryEnumName } from '../../index.d'
export const TextCommonConfig: ConfigType = { export const TextCommonConfig: ConfigType = {
@ -9,5 +9,6 @@ export const TextCommonConfig: ConfigType = {
category: ChatCategoryEnum.TEXT, category: ChatCategoryEnum.TEXT,
categoryName: ChatCategoryEnumName.TEXT, categoryName: ChatCategoryEnumName.TEXT,
package: PackagesCategoryEnum.INFORMATIONS, package: PackagesCategoryEnum.INFORMATIONS,
chartFrame: ChartFrameEnum.COMMON,
image: 'text_static.png' image: 'text_static.png'
} }

@ -1,11 +1,14 @@
export enum ChatCategoryEnum { export enum ChatCategoryEnum {
TEXT = 'Texts', TEXT = 'Texts',
TITLE = 'Titles', TITLE = 'Titles',
INPUTS = 'Inputs',
MORE = 'Mores' MORE = 'Mores'
} }
export enum ChatCategoryEnumName { export enum ChatCategoryEnumName {
TEXT = '文本', TEXT = '文本',
TITLE = '标题', TITLE = '标题',
// 控件 => 数据录入
INPUTS = '控件',
MORE = '更多' MORE = '更多'
} }

@ -1,4 +1,5 @@
import Texts from './Texts' import Texts from './Texts'
import Inputs from './Inputs'
import Mores from './Mores' import Mores from './Mores'
export const InformationList = [...Texts, ...Mores] export const InformationList = [...Texts, ...Inputs, ...Mores]

@ -1,4 +1,4 @@
import { BaseEvent, EventLife } from '@/enums/eventEnum' import { BaseEvent, EventLife, InteractEvents, InteractEventOn, InteractActionsType } from '@/enums/eventEnum'
import type { GlobalThemeJsonType } from '@/settings/chartThemes/index' import type { GlobalThemeJsonType } from '@/settings/chartThemes/index'
import type { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d' import type { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
@ -120,20 +120,26 @@ export interface PublicConfigType {
} }
filter?: string filter?: string
status: StatusType status: StatusType
interactActions?: InteractActionsType[],
events: { events: {
baseEvent: { baseEvent: {
[K in BaseEvent]?: string [K in BaseEvent]?: string
}, }
advancedEvents: { advancedEvents: {
[K in EventLife]?: string [K in EventLife]?: string
} }
interactEvents: {
[InteractEvents.INTERACT_ON]: InteractEventOn | undefined
[InteractEvents.INTERACT_COMPONENT_ID]: string | undefined
[InteractEvents.INTERACT_FN]: { [name: string]: string }
}[]
} }
} }
export interface CreateComponentType extends PublicConfigType, requestConfig { export interface CreateComponentType extends PublicConfigType, requestConfig {
key: string key: string
chartConfig: ConfigType chartConfig: ConfigType
option: GlobalThemeJsonType, option: GlobalThemeJsonType
} }
// 组件成组实例类 // 组件成组实例类

@ -102,7 +102,8 @@ export class PublicConfigClass implements PublicConfigType {
advancedEvents: { advancedEvents: {
[EventLife.VNODE_MOUNTED]: undefined, [EventLife.VNODE_MOUNTED]: undefined,
[EventLife.VNODE_BEFORE_MOUNT]: undefined [EventLife.VNODE_BEFORE_MOUNT]: undefined
} },
interactEvents: []
} }
} }

@ -13,6 +13,13 @@ const routerAllowList = [
export function createRouterGuards(router: Router) { export function createRouterGuards(router: Router) {
// 前置 // 前置
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
// http://localhost:3000/#/chart/preview/792622755697790976?t=123
// 把外部动态参数放入window.route.params后续API动态接口可以用window.route?.params?.t来拼接参数
// @ts-ignore
if (!window.route) window.route = {params: {}}
// @ts-ignore
Object.assign(window.route.params, to.query)
const Loading = window['$loading']; const Loading = window['$loading'];
Loading && Loading.start(); Loading && Loading.start();
const isErrorPage = router.getRoutes().findIndex((item) => item.name === to.name); const isErrorPage = router.getRoutes().findIndex((item) => item.name === to.name);

@ -64,10 +64,13 @@ export const chartColorsSearch = {
roma: ['#e01f54', '#5e4ea5', 'rgba(137, 52, 72, 0.3)', 'rgba(224, 31, 84, 0.5)', 'rgba(94, 78, 165, 0.5)'], roma: ['#e01f54', '#5e4ea5', 'rgba(137, 52, 72, 0.3)', 'rgba(224, 31, 84, 0.5)', 'rgba(94, 78, 165, 0.5)'],
} }
export type EchartsRenderer = 'svg' | 'canvas';
// 默认主题详细配置 // 默认主题详细配置
type ThemeJsonType = typeof themeJson type ThemeJsonType = typeof themeJson
export interface GlobalThemeJsonType extends Partial<ThemeJsonType> { export interface GlobalThemeJsonType extends Partial<ThemeJsonType> {
dataset?: any, dataset?: any,
renderer?: EchartsRenderer,
[T:string]: any [T:string]: any
} }
export const globalThemeJson = {...themeJson, dataset: null,} export const globalThemeJson = {...themeJson, dataset: null, renderer: 'svg' as const }

@ -44,7 +44,7 @@ export const asideCollapsedWidth = 60
export const maskClosable = false export const maskClosable = false
// 全局边框圆角 // 全局边框圆角
export const borderRadius = '6px' export const borderRadius = '4px'
// 轮播间隔 // 轮播间隔
export const carouselInterval = 4000 export const carouselInterval = 4000

@ -169,7 +169,8 @@ export const fetchRouteParams = () => {
*/ */
export const fetchRouteParamsLocation = () => { export const fetchRouteParamsLocation = () => {
try { try {
return document.location.hash.split('/').pop() || '' // 防止添加query参数的时候解析ID异常
return document.location.hash.split('?')[0].split('/').pop() || ''
} catch (error) { } catch (error) {
window['$message'].warning('查询路由信息失败,请联系管理员!') window['$message'].warning('查询路由信息失败,请联系管理员!')
return '' return ''

@ -10,7 +10,7 @@
<slot name="icon"></slot> <slot name="icon"></slot>
</div> </div>
</n-space> </n-space>
<n-space align="center" style="gap: 4px"> <n-space class="go-flex-no-wrap" align="center" style="gap: 4px">
<slot name="top-right"></slot> <slot name="top-right"></slot>
<n-icon v-show="backIcon" size="20" class="go-cursor-pointer go-d-block" @click="backHandle"> <n-icon v-show="backIcon" size="20" class="go-cursor-pointer go-d-block" @click="backHandle">
<chevron-back-outline-icon></chevron-back-outline-icon> <chevron-back-outline-icon></chevron-back-outline-icon>

@ -135,8 +135,9 @@ const sendHandle = async () => {
showMatching.value = true showMatching.value = true
return return
} }
window['$message'].warning('数据异常,请检查参数') window['$message'].warning('没有拿到返回值,请检查接口')
} catch (error) { } catch (error) {
console.error(error);
loading.value = false loading.value = false
window['$message'].warning('数据异常,请检查参数!') window['$message'].warning('数据异常,请检查参数!')
} }

@ -132,8 +132,9 @@ const fetchTargetData = async () => {
sourceData.value = res sourceData.value = res
return return
} }
window['$message'].warning('数据异常,请检查参数') window['$message'].warning('没有拿到返回值,请检查接口')
} catch (error) { } catch (error) {
console.error(error);
window['$message'].warning('数据异常,请检查参数!') window['$message'].warning('数据异常,请检查参数!')
} }
} }

@ -114,10 +114,6 @@ const sendHandle = async () => {
} }
loading.value = true loading.value = true
try { try {
// const res = await customizeHttp(
// toRaw(pondData.value?.dataPondRequestConfig),
// toRaw(chartEditStore.getRequestGlobalConfig)
// )
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.getRequestGlobalConfig)) const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.getRequestGlobalConfig))
loading.value = false loading.value = false
if (res) { if (res) {
@ -126,8 +122,9 @@ const sendHandle = async () => {
showMatching.value = true showMatching.value = true
return return
} }
window['$message'].warning('数据异常,请检查参数') window['$message'].warning('没有拿到返回值,请检查接口')
} catch (error) { } catch (error) {
console.error(error);
loading.value = false loading.value = false
window['$message'].warning('数据异常,请检查参数!') window['$message'].warning('数据异常,请检查参数!')
} }

@ -16,9 +16,10 @@
import { computed } from 'vue' import { computed } from 'vue'
import { loadAsyncComponent } from '@/utils' import { loadAsyncComponent } from '@/utils'
import { SettingItemBox } from '@/components/Pages/ChartItemSetting' import { SettingItemBox } from '@/components/Pages/ChartItemSetting'
import { RequestDataTypeEnum } from '@/enums/httpEnum'
import { ChartFrameEnum } from '@/packages/index.d'
import { useTargetData } from '../hooks/useTargetData.hook' import { useTargetData } from '../hooks/useTargetData.hook'
import { SelectCreateDataType, SelectCreateDataEnum } from './index.d' import { SelectCreateDataType, SelectCreateDataEnum } from './index.d'
import { RequestDataTypeEnum } from '@/enums/httpEnum'
const ChartDataStatic = loadAsyncComponent(() => import('./components/ChartDataStatic/index.vue')) const ChartDataStatic = loadAsyncComponent(() => import('./components/ChartDataStatic/index.vue'))
const ChartDataAjax = loadAsyncComponent(() => import('./components/ChartDataAjax/index.vue')) const ChartDataAjax = loadAsyncComponent(() => import('./components/ChartDataAjax/index.vue'))
@ -44,6 +45,9 @@ const selectOptions: SelectCreateDataType[] = [
// //
const isNotData = computed(() => { const isNotData = computed(() => {
return typeof targetData.value?.option?.dataset === 'undefined' return (
targetData.value.chartConfig?.chartFrame === ChartFrameEnum.STATIC ||
typeof targetData.value?.option?.dataset === 'undefined'
)
}) })
</script> </script>

@ -1,5 +1,5 @@
<template> <template>
<n-collapse-item title="高级事件配置" name="2"> <n-collapse-item title="高级事件配置" name="3">
<template #header-extra> <template #header-extra>
<n-button type="primary" tertiary size="small" @click.stop="showModal = true"> <n-button type="primary" tertiary size="small" @click.stop="showModal = true">
<template #icon> <template #icon>

@ -1,5 +1,5 @@
<template> <template>
<n-collapse-item title="基础事件配置" name="1"> <n-collapse-item title="基础事件配置" name="2">
<template #header-extra> <template #header-extra>
<n-button type="primary" tertiary size="small" @click.stop="showModal = true"> <n-button type="primary" tertiary size="small" @click.stop="showModal = true">
<template #icon> <template #icon>

@ -0,0 +1,3 @@
import ChartEventInteraction from './index.vue'
export { ChartEventInteraction }

@ -0,0 +1,243 @@
<template>
<n-collapse-item title="组件交互" name="1" v-if="interactActions.length">
<template #header-extra>
<n-button type="primary" tertiary size="small" @click.stop="evAddEventsFn">
<template #icon>
<n-icon>
<add-icon />
</n-icon>
</template>
新增
</n-button>
</template>
<!-- 无数据 -->
<div v-if="!targetData.events.interactEvents.length" class="no-data go-flex-center">
<img :src="noData" alt="暂无数据" />
<n-text :depth="3">暂无内容</n-text>
</div>
<n-card
v-for="(item, cardIndex) in targetData.events.interactEvents"
:key="cardIndex"
class="n-card-shallow"
size="small"
>
<n-space justify="space-between">
<n-text>关联组件 - {{ cardIndex + 1 }}</n-text>
<n-button type="error" text size="small" @click="evDeleteEventsFn(cardIndex)">
<template #icon>
<n-icon>
<close-icon />
</n-icon>
</template>
</n-button>
</n-space>
<n-divider style="margin: 10px 0" />
<n-tag :bordered="false" type="primary"> 选择目标组件 </n-tag>
<setting-item-box name="触发事件" :alone="true">
<n-input-group v-if="interactActions">
<n-select
class="select-type-options"
v-model:value="item.interactOn"
size="tiny"
:options="interactActions"
/>
</n-input-group>
</setting-item-box>
<setting-item-box :alone="true">
<template #name>
<n-text>绑定</n-text>
<n-tooltip trigger="hover">
<template #trigger>
<n-icon size="21" :depth="3">
<help-outline-icon></help-outline-icon>
</n-icon>
</template>
<n-text>不支持静态组件分组</n-text>
</n-tooltip>
</template>
<n-select
class="select-type-options"
value-field="id"
label-field="title"
size="tiny"
filterable
placeholder="仅展示符合条件的组件"
v-model:value="item.interactComponentId"
:options="fnEventsOptions()"
/>
</setting-item-box>
<setting-item-box v-if="fnDimensionsAndSource(item.interactOn).length" name="查询结果" :alone="true">
<n-table size="small" striped>
<thead>
<tr>
<th v-for="item in ['参数', '说明']" :key="item">{{ item }}</th>
</tr>
</thead>
<tbody>
<tr v-for="(cItem, index) in fnDimensionsAndSource(item.interactOn)" :key="index">
<td>{{ cItem.value }}</td>
<td>{{ cItem.label }}</td>
</tr>
</tbody>
</n-table>
</setting-item-box>
<n-tag :bordered="false" type="primary"> 关联目标组件请求参数 </n-tag>
<setting-item-box
:name="requestParamsItem"
v-for="requestParamsItem in requestParamsTypeList"
:key="requestParamsItem"
>
<setting-item
v-for="(ovlValue, ovlKey, index) in fnGetRequest(item.interactComponentId, requestParamsItem)"
:key="index"
:name="`${ovlKey}`"
>
<n-select
size="tiny"
v-model:value="item.interactFn[ovlKey]"
:options="fnDimensionsAndSource(item.interactOn)"
clearable
></n-select>
</setting-item>
<n-text
v-show="JSON.stringify(fnGetRequest(item.interactComponentId, requestParamsItem)) === '{}'"
class="go-pt-1"
depth="3"
>
暂无数据
</n-text>
</setting-item-box>
</n-card>
</n-collapse-item>
</template>
<script lang="ts" setup>
import { VNodeChild, computed } from 'vue'
import { SelectOption, SelectGroupOption } from 'naive-ui'
import { SettingItemBox, SettingItem, CollapseItem } from '@/components/Pages/ChartItemSetting'
import { CreateComponentType, CreateComponentGroupType, ChartFrameEnum } from '@/packages/index.d'
import { RequestParamsTypeEnum } from '@/enums/httpEnum'
import { InteractEventOn, COMPONENT_INTERACT_EVENT_KET } from '@/enums/eventEnum'
import { icon } from '@/plugins'
import noData from '@/assets/images/canvas/noData.png'
import { goDialog } from '@/utils'
import { useTargetData } from '../../../hooks/useTargetData.hook'
const { CloseIcon, AddIcon, HelpOutlineIcon } = icon.ionicons5
const { targetData, chartEditStore } = useTargetData()
const requestParamsTypeList = [RequestParamsTypeEnum.PARAMS, RequestParamsTypeEnum.HEADER]
//
const interactActions = computed(() => {
const interactActions = targetData.value.interactActions
if (!interactActions) return []
return interactActions.map(value => ({
label: value.interactName,
value: value.interactType
}))
})
//
const option = computed(() => {
return targetData.value.option
})
// request
const fnGetRequest = (id: string | undefined, key: RequestParamsTypeEnum) => {
if (!id) return {}
return chartEditStore.componentList[chartEditStore.fetchTargetIndex(id)]?.request.requestParams[key]
}
//
const fnDimensionsAndSource = (interactOn: InteractEventOn | undefined) => {
if (!interactOn || !targetData.value.interactActions) return []
const tableData = targetData.value.interactActions.find(item => {
return item.interactType === interactOn
})
return tableData?.componentEmitEvents[option.value[COMPONENT_INTERACT_EVENT_KET]] || []
}
//
const fnEventsOptions = (): Array<SelectOption | SelectGroupOption> => {
const filterOptionList = chartEditStore.componentList.filter(item => {
//
const isNotSelf = item.id !== targetData.value.id
//
const isNotStatic = item.chartConfig.chartFrame !== ChartFrameEnum.STATIC
//
const isNotGroup = !item.isGroup
return isNotSelf && isNotStatic && isNotGroup
})
const mapOptionList = filterOptionList.map(item => ({
id: item.id,
title: item.chartConfig.title,
disabled: false
}))
targetData.value.events.interactEvents?.forEach(iaItem => {
mapOptionList.forEach(optionItem => {
if (optionItem.id === iaItem.interactComponentId) {
optionItem.disabled = true
}
})
})
return mapOptionList
}
//
const evAddEventsFn = () => {
targetData.value.events.interactEvents.push({
interactOn: undefined,
interactComponentId: undefined,
interactFn: {}
})
}
//
const evDeleteEventsFn = (index: number) => {
goDialog({
message: '是否删除此关联交互模块?',
onPositiveCallback: () => {
targetData.value.events.interactEvents.splice(index, 1)
}
})
}
</script>
<style lang="scss" scoped>
.mill-chart-target-data {
:deep(pre) {
white-space: pre-wrap;
word-wrap: break-word;
}
}
.n-input-group {
height: 30px;
}
.no-data {
flex-direction: column;
width: 100%;
img {
width: 120px;
}
}
:deep(.n-base-selection .n-base-selection-label) {
height: 32px;
}
</style>

@ -5,6 +5,7 @@
组件 id 组件 id
<n-text>{{ targetData.id }}</n-text> <n-text>{{ targetData.id }}</n-text>
</n-text> </n-text>
<chart-event-interaction></chart-event-interaction>
<chart-event-base-handle></chart-event-base-handle> <chart-event-base-handle></chart-event-base-handle>
<chart-event-advanced-handle></chart-event-advanced-handle> <chart-event-advanced-handle></chart-event-advanced-handle>
</n-collapse> </n-collapse>
@ -12,6 +13,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from 'vue'
import { ChartEventInteraction } from './components/ChartEventInteraction'
import { ChartEventAdvancedHandle } from './components/ChartEventAdvancedHandle' import { ChartEventAdvancedHandle } from './components/ChartEventAdvancedHandle'
import { ChartEventBaseHandle } from './components/ChartEventBaseHandle' import { ChartEventBaseHandle } from './components/ChartEventBaseHandle'
import { useTargetData } from '../hooks/useTargetData.hook' import { useTargetData } from '../hooks/useTargetData.hook'

@ -15,10 +15,11 @@
<!-- 缩放比例 --> <!-- 缩放比例 -->
<n-select <n-select
:disabled="lockScale" ref="selectInstRef"
class="scale-btn" class="scale-btn"
v-model:value="filterValue" v-model:value="filterValue"
size="mini" size="mini"
:disabled="lockScale"
:options="filterOptions" :options="filterOptions"
@update:value="selectHandle" @update:value="selectHandle"
></n-select> ></n-select>
@ -54,6 +55,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { SelectInst } from 'naive-ui'
import { reactive, ref, toRefs, watchEffect } from 'vue' import { reactive, ref, toRefs, watchEffect } from 'vue'
import { icon } from '@/plugins' import { icon } from '@/plugins'
import { EditHistory } from '../EditHistory/index' import { EditHistory } from '../EditHistory/index'
@ -62,15 +64,18 @@ import { EditDataSync } from '../EditDataSync/index'
import { useDesignStore } from '@/store/modules/designStore/designStore' import { useDesignStore } from '@/store/modules/designStore/designStore'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d' import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
import { ChartLayoutStoreEnum } from '@/store/modules/chartLayoutStore/chartLayoutStore.d'
const { LockClosedOutlineIcon, LockOpenOutlineIcon } = icon.ionicons5 const { LockClosedOutlineIcon, LockOpenOutlineIcon } = icon.ionicons5
// //
const designStore = useDesignStore() const designStore = useDesignStore()
const themeColor = ref(designStore.getAppTheme) const themeColor = ref(designStore.getAppTheme)
const chartLayoutStore = useChartLayoutStore()
const chartEditStore = useChartEditStore() const chartEditStore = useChartEditStore()
const { lockScale, scale } = toRefs(chartEditStore.getEditCanvas) const { lockScale, scale } = toRefs(chartEditStore.getEditCanvas)
const selectInstRef = ref<SelectInst | null>(null)
// //
let filterOptions = [ let filterOptions = [
@ -101,7 +106,9 @@ const filterValue = ref('')
// //
const selectHandle = (v: number) => { const selectHandle = (v: number) => {
selectInstRef.value?.blur()
if (v === 0) { if (v === 0) {
chartLayoutStore.setItemUnHandle(ChartLayoutStoreEnum.RE_POSITION_CANVAS, true)
chartEditStore.computedScale() chartEditStore.computedScale()
return return
} }

@ -83,7 +83,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, computed } from 'vue' import { onMounted, computed, provide } from 'vue'
import { chartColors } from '@/settings/chartThemes/index' import { chartColors } from '@/settings/chartThemes/index'
import { MenuEnum } from '@/enums/editPageEnum' import { MenuEnum } from '@/enums/editPageEnum'
import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d' import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
@ -91,7 +91,7 @@ import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle,
import { useContextMenu } from '@/views/chart/hooks/useContextMenu.hook' import { useContextMenu } from '@/views/chart/hooks/useContextMenu.hook'
import { MenuOptionsItemType } from '@/views/chart/hooks/useContextMenu.hook.d' import { MenuOptionsItemType } from '@/views/chart/hooks/useContextMenu.hook.d'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore' import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { SCALE_KEY } from '@/views/preview/hooks/useScale.hook'
import { useLayout } from './hooks/useLayout.hook' import { useLayout } from './hooks/useLayout.hook'
import { useAddKeyboard } from '../hooks/useKeyboard.hook' import { useAddKeyboard } from '../hooks/useKeyboard.hook'
import { useSync } from '../hooks/useSync.hook' import { useSync } from '../hooks/useSync.hook'
@ -110,6 +110,9 @@ const chartEditStore = useChartEditStore()
const { handleContextMenu } = useContextMenu() const { handleContextMenu } = useContextMenu()
const { dataSyncFetch, intervalDataSyncUpdate } = useSync() const { dataSyncFetch, intervalDataSyncUpdate } = useSync()
// scale
provide(SCALE_KEY, null);
// //
useLayout() useLayout()

@ -199,9 +199,8 @@ const changeLayerType = (value: LayerModeEnum) => {
<style lang="scss" scoped> <style lang="scss" scoped>
$wight: 200px; $wight: 200px;
@include go(content-layers) { @include go('content-layers') {
width: $wight; width: $wight;
flex-shrink: 0;
overflow: hidden; overflow: hidden;
@extend .go-transition; @extend .go-transition;
.not-layer-text { .not-layer-text {

@ -60,7 +60,8 @@ const componentVersionUpdatePolyfill = (newObject: any, sources: any) => {
advancedEvents: { advancedEvents: {
[EventLife.VNODE_MOUNTED]: undefined, [EventLife.VNODE_MOUNTED]: undefined,
[EventLife.VNODE_BEFORE_MOUNT]: undefined [EventLife.VNODE_BEFORE_MOUNT]: undefined
} },
interactEvents: []
} }
} }
return newObject return newObject

@ -1,7 +1,7 @@
<template> <template>
<div <div
class="chart-item" class="chart-item"
v-for="(item, index) in localStorageInfo.componentList" v-for="(item, index) in chartEditStore.componentList"
:class="animationsClass(item.styles.animations)" :class="animationsClass(item.styles.animations)"
:key="item.id" :key="item.id"
:style="{ :style="{
@ -52,30 +52,29 @@ import { useLifeHandler } from '@/hooks'
const { initDataPond, clearMittDataPondMap } = useChartDataPondFetch() const { initDataPond, clearMittDataPondMap } = useChartDataPondFetch()
const chartEditStore = useChartEditStore() const chartEditStore = useChartEditStore()
const props = defineProps({ // const props = defineProps({
localStorageInfo: { // localStorageInfo: {
type: Object as PropType<ChartEditStorageType>, // type: Object as PropType<ChartEditStorageType>,
required: true // required: true
} // }
}) // })
// //
const themeSetting = computed(() => { const themeSetting = computed(() => {
const chartThemeSetting = props.localStorageInfo.editCanvasConfig.chartThemeSetting const chartThemeSetting = chartEditStore.editCanvasConfig.chartThemeSetting
return chartThemeSetting return chartThemeSetting
}) })
// //
const themeColor = computed(() => { const themeColor = computed(() => {
const colorCustomMergeData = colorCustomMerge(props.localStorageInfo.editCanvasConfig.chartCustomThemeColorInfo) const colorCustomMergeData = colorCustomMerge(chartEditStore.editCanvasConfig.chartCustomThemeColorInfo)
return colorCustomMergeData[props.localStorageInfo.editCanvasConfig.chartThemeColor] return colorCustomMergeData[chartEditStore.editCanvasConfig.chartThemeColor]
}) })
// //
clearMittDataPondMap() clearMittDataPondMap()
onMounted(() => { onMounted(() => {
initDataPond(props.localStorageInfo.requestGlobalConfig) initDataPond(chartEditStore.requestGlobalConfig)
}) })
</script> </script>

@ -1,14 +1,25 @@
import { ref, onMounted, onUnmounted} from 'vue' import { ref, provide, onMounted, onUnmounted } from 'vue'
import { usePreviewFitScale, usePreviewScrollYScale, usePreviewScrollXScale, usePreviewFullScale } from '@/hooks/index' import { usePreviewFitScale, usePreviewScrollYScale, usePreviewScrollXScale, usePreviewFullScale } from '@/hooks/index'
import type { ChartEditStorageType } from '../index.d' import type { ChartEditStorageType } from '../index.d'
import { PreviewScaleEnum } from '@/enums/styleEnum' import { PreviewScaleEnum } from '@/enums/styleEnum'
export const SCALE_KEY = 'scale-value'
export const useScale = (localStorageInfo: ChartEditStorageType) => { export const useScale = (localStorageInfo: ChartEditStorageType) => {
const entityRef = ref() const entityRef = ref()
const previewRef = ref() const previewRef = ref()
const width = ref(localStorageInfo.editCanvasConfig.width) const width = ref(localStorageInfo.editCanvasConfig.width)
const height = ref(localStorageInfo.editCanvasConfig.height) const height = ref(localStorageInfo.editCanvasConfig.height)
const scaleRef = ref({ width: 1, height: 1 })
provide(SCALE_KEY, scaleRef);
const updateScaleRef = (scale: { width: number; height: number }) => {
// 这里需要解构保证赋值给scaleRef的为一个新对象
// 因为scale始终为同一引用
scaleRef.value = { ...scale }
}
// 屏幕适配 // 屏幕适配
onMounted(() => { onMounted(() => {
@ -18,6 +29,7 @@ export const useScale = (localStorageInfo: ChartEditStorageType) => {
width.value as number, width.value as number,
height.value as number, height.value as number,
previewRef.value, previewRef.value,
updateScaleRef
) )
calcRate() calcRate()
windowResize() windowResize()
@ -35,6 +47,7 @@ export const useScale = (localStorageInfo: ChartEditStorageType) => {
const dom = entityRef.value const dom = entityRef.value
dom.style.width = `${width.value * scale.width}px` dom.style.width = `${width.value * scale.width}px`
dom.style.height = `${height.value * scale.height}px` dom.style.height = `${height.value * scale.height}px`
updateScaleRef(scale)
} }
) )
calcRate() calcRate()
@ -54,6 +67,7 @@ export const useScale = (localStorageInfo: ChartEditStorageType) => {
const dom = entityRef.value const dom = entityRef.value
dom.style.width = `${width.value * scale.width}px` dom.style.width = `${width.value * scale.width}px`
dom.style.height = `${height.value * scale.height}px` dom.style.height = `${height.value * scale.height}px`
updateScaleRef(scale)
} }
) )
calcRate() calcRate()
@ -69,6 +83,7 @@ export const useScale = (localStorageInfo: ChartEditStorageType) => {
width.value as number, width.value as number,
height.value as number, height.value as number,
previewRef.value, previewRef.value,
updateScaleRef
) )
calcRate() calcRate()
windowResize() windowResize()
@ -82,6 +97,7 @@ export const useScale = (localStorageInfo: ChartEditStorageType) => {
return { return {
entityRef, entityRef,
previewRef previewRef,
scaleRef
} }
} }

@ -3,6 +3,9 @@ import { ResultEnum } from '@/enums/httpEnum'
import { StorageEnum } from '@/enums/storageEnum' import { StorageEnum } from '@/enums/storageEnum'
import { ChartEditStorage } from '@/store/modules/chartEditStore/chartEditStore.d' import { ChartEditStorage } from '@/store/modules/chartEditStore/chartEditStore.d'
import { fetchProjectApi } from '@/api/path' import { fetchProjectApi } from '@/api/path'
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
const chartEditStore = useChartEditStore()
export interface ChartEditStorageType extends ChartEditStorage { export interface ChartEditStorageType extends ChartEditStorage {
id: string id: string
@ -31,6 +34,10 @@ export const getSessionStorageInfo = async () => {
// 本地读取 // 本地读取
for (let i = 0; i < storageList.length; i++) { for (let i = 0; i < storageList.length; i++) {
if (id.toString() === storageList[i]['id']) { if (id.toString() === storageList[i]['id']) {
const { editCanvasConfig, requestGlobalConfig, componentList } = storageList[i]
chartEditStore.editCanvasConfig = editCanvasConfig
chartEditStore.requestGlobalConfig = requestGlobalConfig
chartEditStore.componentList = componentList
return storageList[i] return storageList[i]
} }
} }