mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-26 03:16:34 +08:00
feat: 新增 border
This commit is contained in:
parent
0053daed2f
commit
b5e862e740
@ -134,14 +134,14 @@
|
|||||||
<n-select
|
<n-select
|
||||||
v-model:value="xAxis.splitLine.lineStyle.type"
|
v-model:value="xAxis.splitLine.lineStyle.type"
|
||||||
size="small"
|
size="small"
|
||||||
:options="axisConf.splitLint.lineStyle.type"
|
:options="axisConfig.splitLint.lineStyle.type"
|
||||||
></n-select>
|
></n-select>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
<setting-item name="位置">
|
<setting-item name="位置">
|
||||||
<n-select
|
<n-select
|
||||||
v-model:value="xAxis.position"
|
v-model:value="xAxis.position"
|
||||||
size="small"
|
size="small"
|
||||||
:options="axisConf.xposition"
|
:options="axisConfig.xposition"
|
||||||
></n-select>
|
></n-select>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
@ -247,14 +247,14 @@
|
|||||||
<n-select
|
<n-select
|
||||||
v-model:value="yAxis.splitLine.lineStyle.type"
|
v-model:value="yAxis.splitLine.lineStyle.type"
|
||||||
size="small"
|
size="small"
|
||||||
:options="axisConf.splitLint.lineStyle.type"
|
:options="axisConfig.splitLint.lineStyle.type"
|
||||||
></n-select>
|
></n-select>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
<setting-item name="位置">
|
<setting-item name="位置">
|
||||||
<n-select
|
<n-select
|
||||||
v-model:value="yAxis.position"
|
v-model:value="yAxis.position"
|
||||||
size="small"
|
size="small"
|
||||||
:options="axisConf.yposition"
|
:options="axisConfig.yposition"
|
||||||
></n-select>
|
></n-select>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
@ -282,7 +282,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType, computed } from 'vue'
|
import { PropType, computed } from 'vue'
|
||||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||||
import { axisConf } from '@/packages/chartConfiguration/echarts/index'
|
import { axisConfig } from '@/packages/chartConfiguration/echarts/index'
|
||||||
import {
|
import {
|
||||||
CollapseItem,
|
CollapseItem,
|
||||||
SettingItemBox,
|
SettingItemBox,
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
import { onMounted, ref, watch } from 'vue'
|
|
||||||
import cloneDeep from 'lodash/cloneDeep'
|
|
||||||
import merge from 'lodash/merge'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* border-hook
|
|
||||||
* @param props
|
|
||||||
* @param _defaultColor 默认颜色
|
|
||||||
* @param afterResizeFun resize容器之后执行函数
|
|
||||||
*/
|
|
||||||
export const useBorderBox = (props: any, _defaultColor: string[]) => {
|
|
||||||
const mergedColor = ref([])
|
|
||||||
const defaultColor = ref(_defaultColor)
|
|
||||||
|
|
||||||
function mergeColor() {
|
|
||||||
mergedColor.value = merge(cloneDeep(defaultColor.value), props.color || [])
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => [props.color, props.reverse],
|
|
||||||
() => {
|
|
||||||
mergeColor()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
onMounted(() => {
|
|
||||||
mergeColor()
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
|
||||||
defaultColor,
|
|
||||||
mergeColor,
|
|
||||||
mergedColor
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
export const axisConf = {
|
export const axisConfig = {
|
||||||
xposition: [
|
xposition: [
|
||||||
{
|
{
|
||||||
label: 'top',
|
label: 'top',
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
import { publicConfig } from '@/packages/public'
|
||||||
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
|
import {BorderCommonConfig} from './index'
|
||||||
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
|
|
||||||
|
export default class Config extends publicConfig implements CreateComponentType {
|
||||||
|
public key = BorderCommonConfig.key
|
||||||
|
public chartConfig = cloneDeep(BorderCommonConfig)
|
||||||
|
public borderOptions = {
|
||||||
|
colors: ['#6586ec', '#2cf7fe']
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<CollapseItem name="颜色" :expanded="true">
|
||||||
|
<!-- <SettingItemBox
|
||||||
|
name="图形"
|
||||||
|
v-for="(item, index) in optionData.borderOptions.colors"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<SettingItem :name="`颜色-${index + 1}`">
|
||||||
|
<n-color-picker
|
||||||
|
size="small"
|
||||||
|
:modes="['hex']"
|
||||||
|
v-model:value="optionData.borderOptions.colors[index]"
|
||||||
|
></n-color-picker>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox> -->
|
||||||
|
</CollapseItem>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { PropType } from 'vue'
|
||||||
|
import {
|
||||||
|
CollapseItem,
|
||||||
|
SettingItemBox,
|
||||||
|
SettingItem
|
||||||
|
} from '@/components/ChartItemSetting/index'
|
||||||
|
import Config from './config'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
optionData: {
|
||||||
|
type: Object as PropType<Config>,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(props.optionData)
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,70 +1,60 @@
|
|||||||
<template>
|
<template>
|
||||||
<div></div>
|
<div class="bv-border-box-13" ref="domRef">
|
||||||
<!-- <div class="bv-border-box-13" ref="domRef">
|
<svg class="bv-border-svg-container" :width="w" :height="h">
|
||||||
<svg class="bv-border-svg-container" :width="width" :height="height">
|
|
||||||
<path
|
<path
|
||||||
:fill="backgroundColor"
|
fill="transparent"
|
||||||
:stroke="mergedColor[0]"
|
:stroke="colors[0]"
|
||||||
:d="`
|
:d="`
|
||||||
M 5 20 L 5 10 L 12 3 L 60 3 L 68 10
|
M 5 20 L 5 10 L 12 3 L 60 3 L 68 10
|
||||||
L ${width - 20} 10 L ${width - 5} 25
|
L ${w - 20} 10 L ${w - 5} 25
|
||||||
L ${width - 5} ${height - 5} L 20 ${height - 5}
|
L ${w - 5} ${h - 5} L 20 ${h - 5}
|
||||||
L 5 ${height - 20} L 5 20
|
L 5 ${h - 20} L 5 20
|
||||||
`"
|
`"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<path
|
<path
|
||||||
fill="transparent"
|
fill="transparent"
|
||||||
stroke-width="3"
|
stroke-w="3"
|
||||||
stroke-linecap="round"
|
stroke-linecap="round"
|
||||||
stroke-dasharray="10, 5"
|
stroke-dasharray="10, 5"
|
||||||
:stroke="mergedColor[0]"
|
:stroke="colors[0]"
|
||||||
:d="`M 16 9 L 61 9`"
|
:d="`M 16 9 L 61 9`"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<path
|
<path
|
||||||
fill="transparent"
|
fill="transparent"
|
||||||
:stroke="mergedColor[1]"
|
:stroke="colors[1]"
|
||||||
:d="`M 5 20 L 5 10 L 12 3 L 60 3 L 68 10`"
|
:d="`M 5 20 L 5 10 L 12 3 L 60 3 L 68 10`"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<path
|
<path
|
||||||
fill="transparent"
|
fill="transparent"
|
||||||
:stroke="mergedColor[1]"
|
:stroke="colors[1]"
|
||||||
:d="`M ${width - 5} ${height - 30} L ${width - 5} ${height - 5} L ${
|
:d="`M ${w - 5} ${h - 30} L ${w - 5} ${h - 5} L ${
|
||||||
width - 30
|
w - 30
|
||||||
} ${height - 5}`"
|
} ${h - 5}`"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<div class="border-box-content">
|
<div class="border-box-content">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// import { useBorderBox } from '@/hooks'
|
import { PropType, toRefs } from 'vue'
|
||||||
// const props = defineProps({
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
// width: {
|
|
||||||
// type: Number,
|
|
||||||
// default: 200
|
|
||||||
// },
|
|
||||||
// height: {
|
|
||||||
// type: Number,
|
|
||||||
// default: 200
|
|
||||||
// },
|
|
||||||
// color: {
|
|
||||||
// type: Array,
|
|
||||||
// default: () => []
|
|
||||||
// },
|
|
||||||
// backgroundColor: {
|
|
||||||
// type: String,
|
|
||||||
// default: 'transparent'
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
|
|
||||||
// const {defaultColor, mergedColor} = useBorderBox(props, ['#6586ec', '#2cf7fe'])
|
const props = defineProps({
|
||||||
|
chartConfig: {
|
||||||
|
type: Object as PropType<CreateComponentType>,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const { w, h } = toRefs(props.chartConfig.attr)
|
||||||
|
const { colors } = toRefs(props.chartConfig.borderOptions)
|
||||||
</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,7 +36,8 @@ 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类型的方法
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
<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 :optionData="targetData.option" :in-chart="true"></global-setting>
|
<global-setting v-if="targetData.option" :optionData="targetData.option" :in-chart="true"></global-setting>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
type="segment"
|
type="segment"
|
||||||
>
|
>
|
||||||
<n-tab-pane
|
<n-tab-pane
|
||||||
v-for="item in canvasTabList"
|
v-for="(item, index) in canvasTabList"
|
||||||
:key="item.key"
|
:key="item.key"
|
||||||
:name="item.key"
|
:name="item.key"
|
||||||
size="small"
|
size="small"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user