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