feat: 新增图表独立配置混合

This commit is contained in:
mtruning
2022-02-26 17:38:24 +08:00
parent 0bf38c032c
commit 8d97bdc976
43 changed files with 271 additions and 170 deletions
@@ -9,7 +9,7 @@
@dragstart="handleDragStart($event, item)"
>
<div class="list-header">
<AppleControlBtn :mini="true" :disabled="true"></AppleControlBtn>
<MacOsControlBtn :mini="true" :disabled="true"></MacOsControlBtn>
<n-text class="list-header-text" depth="3">{{ item.title }}</n-text>
</div>
<div class="list-center go-flex-center">
@@ -26,7 +26,8 @@
</template>
<script setup lang="ts">
import { AppleControlBtn } from '@/components/AppleControlBtn/index'
import { PropType } from 'vue'
import { MacOsControlBtn } from '@/components/MacOsControlBtn/index'
import { requireFallbackImg, componentInstall } from '@/utils'
import { DragKeyEnum } from '@/enums/editPageEnum'
import { ConfigType } from '@/packages/index.d'
@@ -34,13 +35,14 @@ import omit from 'lodash/omit'
defineProps({
menuOptions: {
type: Array,
type: Array as PropType<ConfigType[]>,
default: () => []
}
})
// 拖拽处理
const handleDragStart = (e: DragEvent, item: ConfigType) => {
// 动态注册图表组件
componentInstall(item.key, item.node)
// 将配置项绑定到拖拽属性上
e!.dataTransfer!.setData(DragKeyEnum.DROG_KEY, JSON.stringify(omit(item, ['node', 'image'])))
@@ -17,12 +17,12 @@ const {
// 图表
const { getPackagesList } = usePackagesStore()
const menuOptions = shallowReactive<{
const menuOptions:{
key: string
icon: ReturnType<typeof renderIcon>
label: ReturnType<typeof renderLang>
list: PackagesType
}[]>([])
}[] = []
const packagesListObj = {
[PackagesCategoryEnum.CHARTS]: {
-1
View File
@@ -43,7 +43,6 @@
</template>
<script setup lang="ts">
import { reactive, ref, toRefs } from 'vue'
import { ContentBox } from '../ContentBox/index'
import { OptionContent } from './components/OptionContent'
import {
@@ -1,5 +1,6 @@
<template>
<div class="go-chart-content-details" v-if="targetData">
<!-- 名称 -->
<SettingItemBox name="名称">
<n-input
type="text"
@@ -10,7 +11,11 @@
v-model:value="targetData.chartConfig.title"
/>
</SettingItemBox>
<!-- 位置 -->
<PositionSetting :chartAttr="targetData.attr" />
<!-- 自定义配置项 -->
<component :is="targetData.chartConfig.conNode()" :optionData="targetData.option"></component>
<!-- 全局设置 -->
<GlobalSetting :optionData="targetData.option" :in-chart="true" />
</div>
</template>
@@ -0,0 +1,3 @@
import ContentConfigurations from './index.vue'
export { ContentConfigurations }
-3
View File
@@ -1,3 +0,0 @@
import ContentDetails from './index.vue'
export { ContentDetails }
@@ -11,7 +11,7 @@
</template>
<script setup lang="ts">
import { ref, computed, PropType, h } from 'vue';
import { ref, computed, PropType } from 'vue';
import { useChartEditStoreStore } from '@/store/modules/chartEditStore/chartEditStore'
import { useDesignStore } from '@/store/modules/designStore/designStore'
import { CreateComponentType } from '@/packages/index.d'
+1 -1
View File
@@ -61,7 +61,7 @@ const btnList = reactive<ItemType[]>([
])
// store 描述的是展示的值,所以和 ContentDetails 的 collapsed 是相反的
// store 描述的是展示的值,所以和 ContentConfigurations 的 collapsed 是相反的
const styleHandle = (item: ItemType) => {
if (item.key === ChartLayoutStoreEnum.DETAILS) {
return item.select ? '' : 'success'
+3 -3
View File
@@ -16,7 +16,7 @@
<n-layout-content content-style="overflow:hidden; display: flex">
<ContentCharts />
<ContentLayers />
<ContentDetails />
<ContentConfigurations />
</n-layout-content>
</n-layout>
</div>
@@ -60,8 +60,8 @@ const ContentLayers = loadAsyncComponent(() =>
const ContentCharts = loadAsyncComponent(() =>
import('./ContentCharts/index.vue')
)
const ContentDetails = loadAsyncComponent(() =>
import('./ContentDetails/index.vue')
const ContentConfigurations = loadAsyncComponent(() =>
import('./ContentConfigurations/index.vue')
)
// 右键
@@ -4,7 +4,7 @@
<div class="list-content">
<!-- 顶部按钮 -->
<div class="list-content-top">
<AppleControlBtn
<MacOsControlBtn
class="top-btn"
:hidden="['remove']"
@close="deleteHanlde"
@@ -85,7 +85,7 @@
import { reactive, ref } from 'vue'
import { renderIcon, renderLang, requireUrl, requireFallbackImg } from '@/utils'
import { icon } from '@/plugins'
import { AppleControlBtn } from '@/components/AppleControlBtn'
import { MacOsControlBtn } from '@/components/MacOsControlBtn'
const {
EllipsisHorizontalCircleSharpIcon,
@@ -17,7 +17,7 @@
</n-space>
<!-- 顶部按钮 -->
<n-space class="list-content-top">
<AppleControlBtn
<MacOsControlBtn
:narrow="true"
:hidden="['close']"
@remove="closeHandle"
@@ -78,7 +78,7 @@
import { reactive } from 'vue'
import { renderIcon, renderLang, requireUrl } from '@/utils'
import { icon } from '@/plugins'
import { AppleControlBtn } from '@/components/AppleControlBtn'
import { MacOsControlBtn } from '@/components/MacOsControlBtn'
const { HammerIcon } = icon.ionicons5