mirror of
https://gitee.com/dromara/go-view.git
synced 2024-11-30 10:48:40 +08:00
feat: 新增 border 样式修改,修改全部设置引入方式
This commit is contained in:
parent
ef74947572
commit
0faf7e24af
@ -3,6 +3,7 @@ import { BarCommonConfig } from './index'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
import dataJson from './data.json'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
|
||||
export const includes = ['legend', 'xAxis', 'yAxis']
|
||||
|
||||
|
@ -36,20 +36,23 @@
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
<!-- Echarts 全局设置 -->
|
||||
<global-setting :optionData="optionData" :in-chart="true"></global-setting>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, computed } from 'vue'
|
||||
import {
|
||||
GlobalSetting,
|
||||
CollapseItem,
|
||||
SettingItemBox,
|
||||
SettingItem
|
||||
} from '@/components/ChartItemSetting/index'
|
||||
import { option } from './config'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
type: Object as PropType<GlobalThemeJsonType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
@ -25,16 +25,19 @@
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
<!-- Echarts 全局设置 -->
|
||||
<global-setting :optionData="optionData" :in-chart="true"></global-setting>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, computed } from 'vue'
|
||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/ChartItemSetting/index'
|
||||
import { GlobalSetting, CollapseItem, SettingItemBox, SettingItem } from '@/components/ChartItemSetting/index'
|
||||
import { option } from './config'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
type: Object as PropType<GlobalThemeJsonType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
@ -65,21 +65,24 @@
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
<!-- Echarts 全局设置 -->
|
||||
<global-setting :optionData="optionData" :in-chart="true"></global-setting>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, computed } from 'vue'
|
||||
import { lineConf } from '@/packages/chartConfiguration/echarts/index'
|
||||
import {
|
||||
GlobalSetting,
|
||||
CollapseItem,
|
||||
SettingItemBox,
|
||||
SettingItem
|
||||
} from '@/components/ChartItemSetting/index'
|
||||
import { option } from './config'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<typeof option>,
|
||||
type: Object as PropType<GlobalThemeJsonType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
@ -1,6 +1,18 @@
|
||||
<template>
|
||||
<!-- Echarts 全局设置 -->
|
||||
<global-setting :optionData="optionData" :in-chart="true"></global-setting>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
import { GlobalSetting } from '@/components/ChartItemSetting/index'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<GlobalThemeJsonType>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
console.log(props.optionData)
|
||||
</script>
|
||||
|
@ -3,10 +3,12 @@ import { CreateComponentType } from '@/packages/index.d'
|
||||
import {BorderCommonConfig} from './index'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
|
||||
export const option = {
|
||||
colors: ['#6586ec', '#2cf7fe']
|
||||
}
|
||||
|
||||
export default class Config extends publicConfig implements CreateComponentType {
|
||||
public key = BorderCommonConfig.key
|
||||
public chartConfig = cloneDeep(BorderCommonConfig)
|
||||
public borderOptions = {
|
||||
colors: ['#6586ec', '#2cf7fe']
|
||||
}
|
||||
public option = option
|
||||
}
|
||||
|
@ -1,18 +1,26 @@
|
||||
<template>
|
||||
<CollapseItem name="颜色" :expanded="true">
|
||||
<!-- <SettingItemBox
|
||||
name="图形"
|
||||
v-for="(item, index) in optionData.borderOptions.colors"
|
||||
<CollapseItem name="边框" :expanded="true">
|
||||
<SettingItemBox
|
||||
:name="`颜色-${index + 1}`"
|
||||
v-for="(item, index) in optionData.colors"
|
||||
:key="index"
|
||||
>
|
||||
<SettingItem :name="`颜色-${index + 1}`">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
size="small"
|
||||
:modes="['hex']"
|
||||
v-model:value="optionData.borderOptions.colors[index]"
|
||||
v-model:value="optionData.colors[index]"
|
||||
></n-color-picker>
|
||||
</SettingItem>
|
||||
</SettingItemBox> -->
|
||||
<SettingItem>
|
||||
<n-button
|
||||
size="small"
|
||||
@click="optionData.colors[index] = option.colors[index]"
|
||||
>
|
||||
恢复默认
|
||||
</n-button>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
@ -23,11 +31,11 @@ import {
|
||||
SettingItemBox,
|
||||
SettingItem
|
||||
} from '@/components/ChartItemSetting/index'
|
||||
import Config from './config'
|
||||
import { option } from './config'
|
||||
|
||||
const props = defineProps({
|
||||
optionData: {
|
||||
type: Object as PropType<Config>,
|
||||
type: Object as PropType<typeof option>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
@ -30,9 +30,7 @@
|
||||
<path
|
||||
fill="transparent"
|
||||
:stroke="colors[1]"
|
||||
:d="`M ${w - 5} ${h - 30} L ${w - 5} ${h - 5} L ${
|
||||
w - 30
|
||||
} ${h - 5}`"
|
||||
:d="`M ${w - 5} ${h - 30} L ${w - 5} ${h - 5} L ${w - 30} ${h - 5}`"
|
||||
/>
|
||||
</svg>
|
||||
|
||||
@ -43,18 +41,21 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, toRefs } from 'vue'
|
||||
import { PropType, toRefs, computed } from 'vue'
|
||||
import { CreateComponentType } from '@/packages/index.d'
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
type: Object as PropType<CreateComponentType>,
|
||||
required: true
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
const { w, h } = toRefs(props.chartConfig.attr)
|
||||
const { colors } = toRefs(props.chartConfig.borderOptions)
|
||||
|
||||
const colors = computed(() => {
|
||||
return props.chartConfig.option?.colors
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
3
src/packages/index.d.ts
vendored
3
src/packages/index.d.ts
vendored
@ -36,8 +36,7 @@ export interface PublicConfigType extends requestConfig {
|
||||
export interface CreateComponentType extends PublicConfigType {
|
||||
key: string
|
||||
chartConfig: ConfigType
|
||||
option?: GlobalThemeJsonType
|
||||
[T: string]: any
|
||||
option: GlobalThemeJsonType
|
||||
}
|
||||
|
||||
// 获取组件实例类中某个key对应value类型的方法
|
||||
|
@ -83,5 +83,8 @@ export const chartColorsSearch = {
|
||||
}
|
||||
|
||||
// 默认主题详细配置
|
||||
export type GlobalThemeJsonType = typeof themeJson
|
||||
type ThemeJsonType = typeof themeJson
|
||||
export interface GlobalThemeJsonType extends Partial<ThemeJsonType> {
|
||||
[T:string]: any
|
||||
}
|
||||
export const globalThemeJson = themeJson
|
||||
|
@ -10,13 +10,11 @@
|
||||
<styles-setting :chartStyles="targetData.styles"></styles-setting>
|
||||
<!-- 自定义配置项 -->
|
||||
<component :is="targetData.chartConfig.conKey" :optionData="targetData.option"></component>
|
||||
<!-- Echarts 全局设置 -->
|
||||
<global-setting v-if="targetData.option" :optionData="targetData.option" :in-chart="true"></global-setting>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { GlobalSetting, NameSetting, PositionSetting, SizeSetting, StylesSetting } from '@/components/ChartItemSetting/index'
|
||||
import { NameSetting, PositionSetting, SizeSetting, StylesSetting } from '@/components/ChartItemSetting/index'
|
||||
import { useTargetData } from '../hooks/useTargetData.hook'
|
||||
const { targetData, chartEditStore } = useTargetData()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user