Commit 90872f0272625705219e0cad23aa5302e42d42eb

Authored by xp.Huang
2 parents e42dc58e e5302036

Merge branch 'ft' into 'main_dev'

perf(external/Componse): 修改小标题1,缩放未居中

See merge request yunteng/thingskit-view!30
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 <SettingItemBox name="内容"> 8 <SettingItemBox name="内容">
9 <SettingItem name="数值"> 9 <SettingItem name="数值">
10 <n-input-number 10 <n-input-number
  11 + :disabled="true"
11 v-model:value="item.data[0]" 12 v-model:value="item.data[0]"
12 :min="0" 13 :min="0"
13 :step="0.01" 14 :step="0.01"
@@ -10,7 +10,7 @@ export const LeftCenterRightHeadConfig: ConfigType = { @@ -10,7 +10,7 @@ export const LeftCenterRightHeadConfig: ConfigType = {
10 key, 10 key,
11 chartKey, 11 chartKey,
12 conKey, 12 conKey,
13 - title: '大标题', 13 + title: '大标题1',
14 category: ChatCategoryEnum.HEADCOMBINATION, 14 category: ChatCategoryEnum.HEADCOMBINATION,
15 categoryName: ChatCategoryEnumName.HEADCOMBINATION, 15 categoryName: ChatCategoryEnumName.HEADCOMBINATION,
16 package: EPackagesCategoryEnum.COMPOSES, 16 package: EPackagesCategoryEnum.COMPOSES,
1 -import { PublicConfigClass } from '@/packages/public'  
2 -import { CreateComponentType } from '@/packages/index.d'  
3 -import { TitleConfig } from './index'  
4 -import cloneDeep from 'lodash/cloneDeep'  
5 -  
6 -export const option = {  
7 - dataset: '我是标题',  
8 - attribute: {  
9 - titleColor: '#fff',  
10 - titleSize: 16,  
11 - svg_7: 'blue',  
12 - svg_8: 'red',  
13 - svg_16: 'red',  
14 - svg_14: 'red',  
15 - svg_21: 'red',  
16 - svg_7_opacity: 1,  
17 - svg_8_opacity: 1,  
18 - svg_16_opacity: 1,  
19 - svg_14_opacity: 1,  
20 - linearGradient: {  
21 - stop_color1: '#447799',  
22 - stop_color2: '#224488',  
23 - svg_21_opacity1: 1,  
24 - svg_21_opacity2: 1,  
25 - }  
26 - }  
27 -}  
28 -  
29 -export default class Config extends PublicConfigClass implements CreateComponentType {  
30 - public key = TitleConfig.key  
31 - public chartConfig = cloneDeep(TitleConfig)  
32 - public option = cloneDeep(option)  
33 -}  
1 -<template>  
2 - <CollapseItem name="配置" :expanded="true">  
3 - <SettingItemBox name="文字">  
4 - <SettingItem name="内容">  
5 - <n-input size="small" v-model:value="optionData.dataset"></n-input>  
6 - </SettingItem>  
7 - <SettingItem name="颜色">  
8 - <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.attribute.titleColor"></n-color-picker>  
9 - </SettingItem>  
10 - <SettingItem>  
11 - <n-button size="small" @click="optionData.attribute.titleColor ='#fff'"> 恢复默认 </n-button>  
12 - </SettingItem>  
13 - <SettingItem name="大小">  
14 - <n-input-number v-model:value="optionData.attribute.titleSize" size="small" placeholder="大小"></n-input-number>  
15 - </SettingItem>  
16 - </SettingItemBox>  
17 - <SettingItemBox name="左边装饰">  
18 - <SettingItem name="颜色">  
19 - <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.attribute.svg_16"></n-color-picker>  
20 - </SettingItem>  
21 - <SettingItem name="透明度">  
22 - <n-input-number :min="0" :max="1" v-model:value="optionData.attribute.svg_16_opacity" size="small" placeholder="透明度1"></n-input-number>  
23 - </SettingItem>  
24 - </SettingItemBox>  
25 - <SettingItemBox name="三角装饰">  
26 - <SettingItem name="颜色">  
27 - <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.attribute.svg_14"></n-color-picker>  
28 - </SettingItem>  
29 - <SettingItem name="透明度">  
30 - <n-input-number :min="0" :max="1" v-model:value="optionData.attribute.svg_14_opacity" size="small" placeholder="透明度1"></n-input-number>  
31 - </SettingItem>  
32 - </SettingItemBox>  
33 - <SettingItemBox name="右边装饰">  
34 - <SettingItem name="颜色1">  
35 - <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.attribute.svg_7"></n-color-picker>  
36 - </SettingItem>  
37 - <SettingItem name="颜色2">  
38 - <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.attribute.svg_8"></n-color-picker>  
39 - </SettingItem>  
40 - <SettingItem name="透明度1">  
41 - <n-input-number :min="0" :max="1" v-model:value="optionData.attribute.svg_7_opacity" size="small" placeholder="透明度1"></n-input-number>  
42 - </SettingItem>  
43 - <SettingItem name="透明度2">  
44 - <n-input-number :min="0" :max="1" v-model:value="optionData.attribute.svg_8_opacity" size="small" placeholder="透明度2"></n-input-number>  
45 - </SettingItem>  
46 - </SettingItemBox>  
47 - <SettingItemBox name="装饰渐变">  
48 - <SettingItem name="渐变颜色1">  
49 - <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.attribute.linearGradient.stop_color1"></n-color-picker>  
50 - </SettingItem>  
51 - <SettingItem name="渐变颜色2">  
52 - <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.attribute.linearGradient.stop_color2"></n-color-picker>  
53 - </SettingItem>  
54 - <SettingItem name="透明度1">  
55 - <n-input-number :min="0" :max="1" v-model:value="optionData.attribute.linearGradient.svg_21_opacity1" size="small" placeholder="透明度1"></n-input-number>  
56 - </SettingItem>  
57 - <SettingItem name="透明度2">  
58 - <n-input-number :min="0" :max="1" v-model:value="optionData.attribute.linearGradient.svg_21_opacity2" size="small" placeholder="透明度1"></n-input-number>  
59 - </SettingItem>  
60 - </SettingItemBox>  
61 - </CollapseItem>  
62 -</template>  
63 -  
64 -<script setup lang="ts">  
65 -import { PropType } from 'vue'  
66 -import { option } from './config'  
67 -import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'  
68 -  
69 -defineProps({  
70 - optionData: {  
71 - type: Object as PropType<typeof option>,  
72 - required: true  
73 - }  
74 -})  
75 -</script>  
1 -import { ChartFrameEnum, ConfigType } from '@/packages/index.d'  
2 -import { EPackagesCategoryEnum } from '@/packages/components/external/types'  
3 -import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'  
4 -import { useWidgetKey } from '@/packages/external/useWidgetKey'  
5 -  
6 -const { key, chartKey, conKey } = useWidgetKey('Title')  
7 -export const TitleConfig: ConfigType = {  
8 - key,  
9 - chartKey,  
10 - conKey,  
11 - title: '小标题',  
12 - category: ChatCategoryEnum.MORE,  
13 - categoryName: ChatCategoryEnumName.MORE,  
14 - package: EPackagesCategoryEnum.COMPOSES,  
15 - chartFrame: ChartFrameEnum.NAIVE_UI,  
16 - image: 'dateTime.png',  
17 -}  
1 -<template>  
2 - <div class="go-content-box">  
3 - <svg xmlns="http://www.w3.org/2000/svg" width="782" height="600">  
4 - <defs>  
5 - <defs>  
6 - <linearGradient id="my-cool-gradient" x1="0%" y1="0%" x2="100%" y2="0%">  
7 - <stop offset="0%"  
8 - :style="{ stopColor: attribute.linearGradient.stop_color1, stopOpacity: attribute.linearGradient.svg_21_opacity1 }" />  
9 - <stop offset="100%"  
10 - :style="{ stopColor: attribute.linearGradient.stop_color2, stopOpacity: attribute.linearGradient.svg_21_opacity2 }" />  
11 - </linearGradient>  
12 - </defs>  
13 - </defs>  
14 - <g>  
15 - <rect stroke="#000" id="svg_6" height="0" width="2" y="189.5" x="523" fill="#fff" />  
16 - <path :opacity="attribute.svg_7_opacity" transform="rotate(-137 422.766 284.992)" stroke="#000" id="svg_7"  
17 - d="m412.87465,287.39672l3.95636,-4.80932l15.82545,0l-3.95636,4.80932l-15.82545,0z" :fill="attribute.svg_7" />  
18 - <path :opacity="attribute.svg_8_opacity" transform="rotate(44 444.883 283.871)" stroke="#000" id="svg_8"  
19 - d="m435.52609,286.39738l3.74294,-5.0534l14.97175,0l-3.74294,5.0534l-14.97175,0z" :fill="attribute.svg_8" />  
20 - <rect id="svg_10" height="0" width="1" y="242.5" x="235" stroke="#000" fill="#fff" />  
21 - <text xml:space="preserve" text-anchor="start" font-family="Noto Sans JP" :font-size="attribute.titleSize"  
22 - stroke-width="0" id="svg_12" y="290.5" x="214" stroke="#000" :fill="attribute.titleColor">{{ dataset }}</text>  
23 - <path :opacity="attribute.svg_14_opacity" transform="rotate(90 198.922 284.168)" stroke="#000" id="svg_14"  
24 - d="m193.42189,288.16843l5.50043,-8.00001l5.50043,8.00001l-11.00085,0z" stroke-width="0"  
25 - :fill="attribute.svg_14" />  
26 - <path id="svg_15" d="m259.7,311.34437l0.5,-1.00001l0.5,1.00001l-1.00001,0z" stroke-width="0" stroke="#000"  
27 - fill="#000000" />  
28 - <rect stroke="#000" id="svg_16" height="33" width="4" y="269" x="181" :fill="attribute.svg_16"  
29 - :opacity="attribute.svg_16_opacity" />  
30 - <rect id="svg_17" height="0" width="2" y="368.5" x="187" stroke="#000" fill="#6D97AB" />  
31 - <rect id="svg_18" height="13" width="0" y="290.5" x="167" stroke="#000" fill="#6D97AB" />  
32 - <rect id="svg_20" height="0" width="1" y="193.5" x="281" stroke="#000" fill="#6D97AB" />  
33 - <path stroke="#000" id="svg_21" d="m184,269l299.00001,0l0,33l-299.00001,0l0,-33z" opacity="0.35"  
34 - fill="url(#my-cool-gradient)" />  
35 - </g>  
36 -  
37 - </svg>  
38 - </div>  
39 -</template>  
40 -<script setup lang="ts">  
41 -import { PropType, toRefs } from 'vue'  
42 -import { CreateComponentType } from '@/packages/index.d'  
43 -  
44 -const props = defineProps({  
45 - chartConfig: {  
46 - type: Object as PropType<CreateComponentType>,  
47 - required: true  
48 - }  
49 -})  
50 -  
51 -//修改默认宽高距离位置  
52 -props.chartConfig.attr.w = 600  
53 -props.chartConfig.attr.h = 100  
54 -props.chartConfig.attr.x = 200  
55 -props.chartConfig.attr.y = 200  
56 -  
57 -const { dataset, attribute } = toRefs(props.chartConfig.option)  
58 -  
59 -const { w, h } = toRefs(props.chartConfig.attr)  
60 -  
61 -  
62 -</script>  
63 -  
64 -<style lang="scss" scoped>  
65 -.go-content-box {  
66 - display: flex;  
67 - align-items: center;  
68 - justify-content: center;  
69 -  
70 - .content {  
71 - width: v-bind('w + "px"');  
72 - height: v-bind('h + "px"');  
73 - }  
74 -}  
75 -</style>  
@@ -5,16 +5,16 @@ @@ -5,16 +5,16 @@
5 <n-input v-model:value="optionData.dataset" /> 5 <n-input v-model:value="optionData.dataset" />
6 </SettingItem> 6 </SettingItem>
7 <SettingItem name="大小"> 7 <SettingItem name="大小">
8 - <n-input v-model:value="optionData.attribute.fontSize" /> 8 + <n-input-number v-model:value="optionData.attribute.fontSize" />
9 </SettingItem> 9 </SettingItem>
10 <SettingItem name="颜色"> 10 <SettingItem name="颜色">
11 <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.attribute.fontColor"></n-color-picker> 11 <n-color-picker size="small" :modes="['hex']" v-model:value="optionData.attribute.fontColor"></n-color-picker>
12 </SettingItem> 12 </SettingItem>
13 <SettingItem name="x轴位置"> 13 <SettingItem name="x轴位置">
14 - <n-input v-model:value="optionData.attribute.fontPos.x" /> 14 + <n-input-number v-model:value="optionData.attribute.fontPos.x" />
15 </SettingItem> 15 </SettingItem>
16 <SettingItem name="y轴位置"> 16 <SettingItem name="y轴位置">
17 - <n-input v-model:value="optionData.attribute.fontPos.y" /> 17 + <n-input-number v-model:value="optionData.attribute.fontPos.y" />
18 </SettingItem> 18 </SettingItem>
19 </SettingItemBox> 19 </SettingItemBox>
20 <SettingItemBox 20 <SettingItemBox
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 <SettingItem> 32 <SettingItem>
33 <n-button 33 <n-button
34 size="small" 34 size="small"
35 - @click="optionData.attribute.linearColors[index] = optionData.attribute.linearColors[index]" 35 + @click="optionData.attribute.linearColors[index] = option.attribute.linearColors[index]"
36 > 36 >
37 恢复默认 37 恢复默认
38 </n-button> 38 </n-button>
@@ -46,6 +46,7 @@ import { PropType } from 'vue' @@ -46,6 +46,7 @@ import { PropType } from 'vue'
46 import { option } from './config' 46 import { option } from './config'
47 import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting' 47 import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
48 48
  49 +
49 defineProps({ 50 defineProps({
50 optionData: { 51 optionData: {
51 type: Object as PropType<typeof option>, 52 type: Object as PropType<typeof option>,
@@ -24,9 +24,13 @@ @@ -24,9 +24,13 @@
24 fill="url(#linear_0)" 24 fill="url(#linear_0)"
25 transform="translate(0 0) rotate(0 246 15)" 25 transform="translate(0 0) rotate(0 246 15)"
26 opacity="1" 26 opacity="1"
27 - :d="`M0,${h / 2.933333333333333} L${w},${h / 2.933333333333333} L${w},0 L0,0 L0,${h / 2.933333333333333} Z`" 27 + :d="`M0,${h} L${w},${h} L${w},0 L0,0 L0,${h} Z`"
28 /> 28 />
29 - <g opacity="1" transform="translate(34 2) rotate(0 46 13)"> 29 + <g
  30 + opacity="1"
  31 + :transform="`translate(34 ${(h/2)-26/2
  32 + }) rotate(0 46 13)`"
  33 + >
30 <text> 34 <text>
31 <tspan 35 <tspan
32 :x="attribute.fontPos.x" 36 :x="attribute.fontPos.x"
@@ -48,9 +52,12 @@ @@ -48,9 +52,12 @@
48 style="fill: #2affff" 52 style="fill: #2affff"
49 transform="translate(0 0) rotate(0 0.5 15)" 53 transform="translate(0 0) rotate(0 0.5 15)"
50 opacity="1" 54 opacity="1"
51 - :d="`M0,${h / 2.933333333333333}L1,${h / 2.933333333333333}L1,0L0,0L0,${h / 2.933333333333333}Z`" 55 + :d="`M0,${h}L1,${h }L1,0L0,0L0,${h}Z`"
52 /> 56 />
53 - <g opacity="1" :transform="`translate(14 8) rotate(0 6.5 7)`"> 57 + <g
  58 + opacity="1"
  59 + :transform="`translate(14 ${(h/2)-8/2}) rotate(0 6.5 7)`"
  60 + >
54 <path 61 <path
55 id="矩形 22" 62 id="矩形 22"
56 fill-rule="evenodd" 63 fill-rule="evenodd"
@@ -76,7 +83,7 @@ @@ -76,7 +83,7 @@
76 :d="`M6,0L0,7L5,7L11,0L6,0Z `" 83 :d="`M6,0L0,7L5,7L11,0L6,0Z `"
77 /> 84 />
78 </g> 85 </g>
79 - <g opacity="1" transform="translate(396 2) rotate(0 46.5 13.5)"> 86 + <g opacity="1" :transform="`translate(396 ${(h/2)-2/2}) rotate(0 46.5 13.5)`">
80 <path 87 <path
81 id="并集" 88 id="并集"
82 fill-rule="evenodd" 89 fill-rule="evenodd"
@@ -108,6 +115,8 @@ const { w, h } = toRefs(props.chartConfig.attr) @@ -108,6 +115,8 @@ const { w, h } = toRefs(props.chartConfig.attr)
108 115
109 <style lang="scss" scoped> 116 <style lang="scss" scoped>
110 .go-content-box { 117 .go-content-box {
  118 + width: v-bind('w+"px"');
  119 + height: v-bind('h+"px"');
111 display: flex; 120 display: flex;
112 align-items: center; 121 align-items: center;
113 justify-content: center; 122 justify-content: center;
1 import { ButtonConfig } from './Button/index' 1 import { ButtonConfig } from './Button/index'
2 import { Title1Config } from './Title1/index' 2 import { Title1Config } from './Title1/index'
3 -import { TitleConfig } from './Title/index'  
4 import { CameraConfig } from './Camera/index' 3 import { CameraConfig } from './Camera/index'
5 4
6 -export default [ButtonConfig, Title1Config, TitleConfig, CameraConfig] 5 +export default [ButtonConfig, Title1Config, CameraConfig]