jvs-ppt-ui 0.0.29 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,641 +1,1479 @@
1
- <script setup lang="ts">
2
- import { ref } from 'vue'
3
- import SidebarAlignGroup from '../common/SidebarAlignGroup.vue'
4
- import SidebarPositionGroup from '../common/SidebarPositionGroup.vue'
5
- import SidebarBorderAccordion from '../common/SidebarBorderAccordion.vue'
6
- import SidebarShadowAccordion from '../common/SidebarShadowAccordion.vue'
7
- import SidebarReflectionAccordion from '../common/SidebarReflectionAccordion.vue'
8
- import ChartTypeSelector from '../../ChartTypeSelector.vue'
9
- import QuickColorPopover from '../../QuickColorPopover.vue'
10
- import { generateMonoPalette } from '../../../utils/palette'
11
-
12
- const props = defineProps<{
13
- element: any
14
- elementX: number
15
- elementY: number
16
- elementW: number
17
- elementH: number
18
- elementRotate: number
19
- isFixedRatio?: boolean
20
- isFlipH?: boolean
21
- isFlipV?: boolean
22
- chartPrimaryColor: string
23
- chartGridColor: string
24
- chartTextColor: string
25
- currentChartColors: string[]
26
- currentChartPaletteId: string
27
- chartPresetPalettes: any[]
28
- recentColors?: string[]
29
- // Fill props
30
- isFillEnabled?: boolean
31
- isFillExpanded?: boolean
32
- fillHex?: string
33
- // Border props
34
- isBorderEnabled?: boolean
35
- isBorderExpanded?: boolean
36
- borderHex?: string
37
- borderStyle?: string
38
- borderWidth?: number
39
- // Shadow props
40
- isShadowEnabled?: boolean
41
- isShadowExpanded?: boolean
42
- shadowHex?: string
43
- shadowAngle?: number
44
- shadowSize?: number
45
- shadowBlur?: number
46
- shadowDistance?: number
47
- // Reflection props
48
- enableReflection?: boolean
49
- isReflectionExpanded?: boolean
50
- reflectionDistance?: number
51
- reflectionSize?: number
52
- reflectionOpacity?: number
53
- reflectionBlur?: number
54
- }>()
55
-
56
- const emit = defineEmits<{
57
- (e: 'alignLeft'): void
58
- (e: 'alignCenter'): void
59
- (e: 'alignRight'): void
60
- (e: 'alignTop'): void
61
- (e: 'alignMiddle'): void
62
- (e: 'alignBottom'): void
63
- (e: 'update:elementX', val: number): void
64
- (e: 'update:elementY', val: number): void
65
- (e: 'update:elementW', val: number): void
66
- (e: 'update:elementH', val: number): void
67
- (e: 'update:elementRotate', val: number): void
68
- (e: 'update:isFixedRatio', val: boolean): void
69
- (e: 'toggleFlipH'): void
70
- (e: 'toggleFlipV'): void
71
- (e: 'adjustZIndex', cmd: any): void
72
- (e: 'openChartDataDialog'): void
73
- (e: 'changeChartType', type: any): void
74
- (e: 'update:chartPrimaryColor', val: string): void
75
- (e: 'update:chartGridColor', val: string): void
76
- (e: 'update:chartTextColor', val: string): void
77
- (e: 'selectChartPalette', palette: any): void
78
- // Fill
79
- (e: 'update:isFillEnabled', val: boolean): void
80
- (e: 'update:isFillExpanded', val: boolean): void
81
- (e: 'update:fillHex', val: string): void
82
- // Border
83
- (e: 'update:isBorderEnabled', val: boolean): void
84
- (e: 'update:isBorderExpanded', val: boolean): void
85
- (e: 'update:borderHex', val: string): void
86
- (e: 'update:borderStyle', val: string): void
87
- (e: 'update:borderWidth', val: number): void
88
- // Shadow
89
- (e: 'update:isShadowEnabled', val: boolean): void
90
- (e: 'update:isShadowExpanded', val: boolean): void
91
- (e: 'update:shadowHex', val: string): void
92
- (e: 'update:shadowAngle', val: number): void
93
- (e: 'update:shadowSize', val: number): void
94
- (e: 'update:shadowBlur', val: number): void
95
- (e: 'update:shadowDistance', val: number): void
96
- // Reflection
97
- (e: 'update:enableReflection', val: boolean): void
98
- (e: 'update:isReflectionExpanded', val: boolean): void
99
- (e: 'update:reflectionDistance', val: number): void
100
- (e: 'update:reflectionSize', val: number): void
101
- (e: 'update:reflectionOpacity', val: number): void
102
- (e: 'update:reflectionBlur', val: number): void
103
- }>()
104
-
105
- const chartTypePopoverVisible = ref(false)
106
- const chartPrimaryColorPopoverVisible = ref(false)
107
- const chartPalettePopoverVisible = ref(false)
108
- const chartGridColorPopoverVisible = ref(false)
109
- const chartTextColorPopoverVisible = ref(false)
110
- const fillPopoverVisible = ref(false)
111
-
112
- const localRecentColors = ref<string[]>(props.recentColors || [])
113
-
114
- const legendPositions = [
115
- 'top-left', 'top', 'top-right', 'bottom-left',
116
- 'bottom', 'bottom-right', 'right-top', 'right',
117
- 'right-bottom', 'left-top', 'left', 'left-bottom'
118
- ]
119
-
120
- const legendIcons: Record<string, string> = {
121
- 'top-left': 'icon-ppt-a-zu9437',
122
- 'top': 'icon-ppt-a-zu9436',
123
- 'top-right': 'icon-ppt-a-zu9435',
124
- 'bottom-left': 'icon-ppt-a-zu9440',
125
- 'bottom': 'icon-ppt-a-zu9439',
126
- 'bottom-right': 'icon-ppt-a-zu9438',
127
- 'right-top': 'icon-ppt-a-zu9432',
128
- 'right': 'icon-ppt-a-zu9433',
129
- 'right-bottom': 'icon-ppt-a-zu9434',
130
- 'left-top': 'icon-ppt-a-zu9429',
131
- 'left': 'icon-ppt-a-zu9430',
132
- 'left-bottom': 'icon-ppt-a-zu9431'
133
- }
134
-
135
- function getChartTypeName(type: string | undefined): string {
136
- if (!type) return '柱状图'
137
- const map: Record<string, string> = {
138
- 'bar': '柱状图',
139
- 'horizontal-bar': '条形图',
140
- 'line': '折线图',
141
- 'area': '面积图',
142
- 'scatter': '散点图',
143
- 'pie': '饼图',
144
- 'donut': '环形图',
145
- 'radar': '雷达图'
146
- }
147
- return map[type] || '柱状图'
148
- }
149
-
150
- function formatHexDisplay(val: any): string {
151
- if (!val) return ''
152
- if (val === 'transparent') return '无'
153
- let str = ''
154
- if (typeof val === 'string') {
155
- str = val
156
- } else if (typeof val === 'object' && val !== null) {
157
- if (val.type === 'color' && typeof val.value === 'string') {
158
- str = val.value
159
- } else if (val.colors && Array.isArray(val.colors) && val.colors[0]?.color) {
160
- str = val.colors[0].color
161
- } else if (val.value && typeof val.value === 'object' && val.value.colors && Array.isArray(val.value.colors)) {
162
- str = val.value.colors[0]?.color || ''
163
- } else if (typeof val.value === 'string') {
164
- str = val.value
165
- }
166
- }
167
- if (!str) return ''
168
- return str.replace('#', '').toUpperCase()
169
- }
170
-
171
- function getPaletteColors(palette: any): string[] {
172
- if (palette.id === 'mono') {
173
- return generateMonoPalette(props.chartPrimaryColor, 8)
174
- }
175
- return palette.colors || []
176
- }
177
-
178
- function onSelectChartType(type: any) {
179
- emit('changeChartType', type)
180
- chartTypePopoverVisible.value = false
181
- }
182
-
183
- function onSelectChartPalette(palette: any) {
184
- emit('selectChartPalette', palette)
185
- chartPalettePopoverVisible.value = false
186
- }
187
-
188
- // Accordion toggles with switch check
189
- function toggleFillExpand() {
190
- if (!props.isFillEnabled) return
191
- emit('update:isFillExpanded', !props.isFillExpanded)
192
- }
193
- function toggleFillHeader() {
194
- if (!props.isFillEnabled) return
195
- emit('update:isFillExpanded', !props.isFillExpanded)
196
- }
197
- function toggleFillSwitch(val: any) {
198
- const boolVal = !!val
199
- emit('update:isFillEnabled', boolVal)
200
- emit('update:isFillExpanded', boolVal)
201
- }
202
- </script>
203
-
204
- <template>
205
- <div class="sidebar-chart-format-panel flex-column" style="display: flex; flex-direction: column;">
206
- <!-- Alignment Row -->
207
- <SidebarAlignGroup @align-left="emit('alignLeft')" @align-center="emit('alignCenter')"
208
- @align-right="emit('alignRight')" @align-top="emit('alignTop')" @align-middle="emit('alignMiddle')"
209
- @align-bottom="emit('alignBottom')" />
210
-
211
- <!-- Position & Dimensions without rotate and flips, with "编辑数据" inside the group -->
212
- <SidebarPositionGroup :element-x="elementX" :element-y="elementY" :element-w="elementW" :element-h="elementH"
213
- :element-rotate="elementRotate" :is-fixed-ratio="isFixedRatio" :is-flip-h="isFlipH" :is-flip-v="isFlipV"
214
- :show-rotate="false" :show-flips="false" @update:element-x="emit('update:elementX', $event)"
215
- @update:element-y="emit('update:elementY', $event)" @update:element-w="emit('update:elementW', $event)"
216
- @update:element-h="emit('update:elementH', $event)" @update:element-rotate="emit('update:elementRotate', $event)"
217
- @update:is-fixed-ratio="emit('update:isFixedRatio', $event)" @toggle-flip-h="emit('toggleFlipH')"
218
- @toggle-flip-v="emit('toggleFlipV')" @adjust-z-index="emit('adjustZIndex', $event)">
219
- <!-- Edit Chart Data Button placed inside position group before bottom border divider -->
220
- <el-button type="primary" style="width: 100%; height: 32px; margin-top: 8px;"
221
- @click="emit('openChartDataDialog')">
222
- 编辑数据
223
- </el-button>
224
- </SidebarPositionGroup>
225
-
226
- <!-- Chart Specific Settings -->
227
- <div style="padding: 0 16px; display: flex; flex-direction: column; gap: 12px; margin-top: 8px;">
228
- <!-- Chart Type -->
229
- <div class="shape-property-row"
230
- style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
231
- <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">图表类型</span>
232
- <el-popover placement="bottom" :width="568" trigger="click" popper-class="chart-popover-popper"
233
- v-model:visible="chartTypePopoverVisible" :show-arrow="false">
234
- <template #reference>
235
- <div
236
- style="flex: 1; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; background: #f5f6f7; border-radius: 4px; cursor: pointer; height: 32px; box-sizing: border-box;">
237
- <span style="font-size: 12px; color: var(--text-primary); font-weight: 500;">
238
- {{ getChartTypeName(element.chartType) }}
239
- </span>
240
- <span style="font-size: 10px; color: var(--text-muted);">▼</span>
241
- </div>
242
- </template>
243
- <ChartTypeSelector @select="onSelectChartType" />
244
- </el-popover>
245
- </div>
246
-
247
- <!-- Chart Primary Color (图表主色) -->
248
- <div class="shape-property-row"
249
- style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
250
- <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">图表主色</span>
251
- <QuickColorPopover v-model:visible="chartPrimaryColorPopoverVisible" :color="chartPrimaryColor"
252
- v-model:recentColors="localRecentColors" @select-color="(val) => emit('update:chartPrimaryColor', val)">
253
- <template #reference>
254
- <div class="color-picker-pill-wrapper" style="flex: 1; height: 32px;">
255
- <div class="color-pill-inner" style="height: 32px;">
256
- <div :style="{ background: chartPrimaryColor }" class="color-square-preview"></div>
257
- <span style="font-size: 11px; color: var(--text-primary); font-family: monospace; font-weight: 500;">
258
- {{ formatHexDisplay(chartPrimaryColor) }}
259
- </span>
260
- </div>
261
- </div>
262
- </template>
263
- </QuickColorPopover>
264
- </div>
265
-
266
- <!-- Chart Palette (调色板) -->
267
- <div class="shape-property-row"
268
- style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
269
- <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">调色板</span>
270
- <el-popover placement="bottom-end" :width="250" trigger="click" v-model:visible="chartPalettePopoverVisible"
271
- popper-class="chart-palette-popover">
272
- <template #reference>
273
- <div
274
- style="flex: 1; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; background: #f5f6f7; border-radius: 4px; cursor: pointer; height: 32px; box-sizing: border-box;">
275
- <div style="display: flex; gap: 4px; align-items: center; overflow: hidden;">
276
- <div v-for="(c, idx) in currentChartColors" :key="idx" :style="{ background: c }"
277
- style="width: 14px; height: 14px; border-radius: 2px; border: 1px solid rgba(0,0,0,0.08); flex-shrink: 0;">
278
- </div>
279
- </div>
280
- <span style="font-size: 10px; color: var(--text-muted); margin-left: 6px;">▼</span>
281
- </div>
282
- </template>
283
- <div
284
- style="padding: 4px 0; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto;">
285
- <div v-for="item in chartPresetPalettes" :key="item.id" class="chart-palette-option-item"
286
- :class="{ active: currentChartPaletteId === item.id }" @click="onSelectChartPalette(item)"
287
- style="padding: 6px 8px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: background 0.15s ease;">
288
- <div style="display: flex; align-items: center; justify-content: space-between;">
289
- <span style="font-size: 12px; font-weight: 500; color: var(--text-primary);">{{ item.name }}</span>
290
- <span v-if="currentChartPaletteId === item.id"
291
- style="color: var(--accent-primary); font-size: 12px; font-weight: bold;">✔</span>
292
- </div>
293
- <div style="display: flex; gap: 4px; align-items: center;">
294
- <div v-for="(col, cIdx) in getPaletteColors(item)" :key="cIdx" :style="{ background: col }"
295
- style="flex: 1; height: 14px; border-radius: 2px; border: 1px solid rgba(0,0,0,0.08);"></div>
296
- </div>
297
- </div>
298
- </div>
299
- </el-popover>
300
- </div>
301
-
302
- <!-- Axis Color (坐标轴色) -->
303
- <div class="shape-property-row"
304
- style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
305
- <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">坐标轴色</span>
306
- <QuickColorPopover v-model:visible="chartGridColorPopoverVisible" :color="chartGridColor"
307
- v-model:recentColors="localRecentColors" @select-color="(val) => emit('update:chartGridColor', val)">
308
- <template #reference>
309
- <div class="color-picker-pill-wrapper" style="flex: 1; height: 32px;">
310
- <div class="color-pill-inner" style="height: 32px;">
311
- <div :style="{ background: chartGridColor }" class="color-square-preview"></div>
312
- <span style="font-size: 11px; color: var(--text-primary); font-family: monospace; font-weight: 500;">
313
- {{ formatHexDisplay(chartGridColor) }}
314
- </span>
315
- </div>
316
- </div>
317
- </template>
318
- </QuickColorPopover>
319
- </div>
320
-
321
- <!-- Text Color (文字颜色) -->
322
- <div class="shape-property-row"
323
- style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
324
- <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">文字颜色</span>
325
- <QuickColorPopover v-model:visible="chartTextColorPopoverVisible" :color="chartTextColor"
326
- v-model:recentColors="localRecentColors" @select-color="(val) => emit('update:chartTextColor', val)">
327
- <template #reference>
328
- <div class="color-picker-pill-wrapper" style="flex: 1; height: 32px;">
329
- <div class="color-pill-inner" style="height: 32px;">
330
- <div :style="{ background: chartTextColor }" class="color-square-preview"></div>
331
- <span style="font-size: 11px; color: var(--text-primary); font-family: monospace; font-weight: 500;">
332
- {{ formatHexDisplay(chartTextColor) }}
333
- </span>
334
- </div>
335
- </div>
336
- </template>
337
- </QuickColorPopover>
338
- </div>
339
-
340
- <!-- Elements Checkboxes (8 options in 2 columns matching 图一) -->
341
- <div class="shape-property-row"
342
- style="display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; height: auto;">
343
- <span class="shape-property-label"
344
- style="flex-shrink: 0; width: 64px; text-align: left; margin-top: 4px;">图表元素</span>
345
- <div style="flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px;">
346
- <el-checkbox v-model="element.showAxes" size="small">坐标轴</el-checkbox>
347
- <el-checkbox v-model="element.showAxisTitles" size="small">轴标题</el-checkbox>
348
- <el-checkbox v-model="element.showTitle" size="small">图表标题</el-checkbox>
349
- <el-checkbox v-model="element.showDataLabels" size="small">数据标签</el-checkbox>
350
- <el-checkbox v-model="element.showDataTable" size="small">数据表</el-checkbox>
351
- <el-checkbox v-model="element.showErrorBars" size="small">误差线</el-checkbox>
352
- <el-checkbox v-model="element.showGridlines" size="small">网格线</el-checkbox>
353
- <el-checkbox v-model="element.showLegend" size="small">图例</el-checkbox>
354
- </div>
355
- </div>
356
-
357
- <!-- Legend Positions (12 grid buttons matching 图一) -->
358
- <div class="shape-property-row"
359
- style="display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; height: auto;">
360
- <span class="shape-property-label"
361
- style="flex-shrink: 0; width: 64px; text-align: left; margin-top: 4px;">图例位置</span>
362
- <div style="flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;">
363
- <div v-for="pos in legendPositions" :key="pos" class="grid-btn" :style="{
364
- border: (element.legendPosition || 'bottom') === pos ? '1.5px solid var(--accent-primary, #6366f1)' : '1px solid var(--border-color, #e2e8f0)',
365
- color: (element.legendPosition || 'bottom') === pos ? 'var(--accent-primary, #6366f1)' : 'inherit',
366
- background: (element.legendPosition || 'bottom') === pos ? '#f5f3ff' : '#ffffff'
367
- }"
368
- style="height: 32px; border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-sizing: border-box; transition: all 0.15s ease;"
369
- @click="element.legendPosition = pos">
370
- <svg class="icon" style="width: 20px; height: 20px;">
371
- <use :xlink:href="`#${legendIcons[pos]}`"></use>
372
- </svg>
373
- </div>
374
- </div>
375
- </div>
376
- </div>
377
-
378
- <!-- Accordions: Fill, Border, Shadow, Reflection -->
379
- <!-- Fill Accordion -->
380
- <div class="control-group shape-accordion-group"
381
- style="border-top: 1px solid #eeeff0; margin-top: 12px; padding-top: 12px;">
382
- <div class="shape-accordion-header" @click="toggleFillHeader">
383
- <span class="control-label shape-accordion-header-label">
384
- <span class="accordion-arrow" @click.stop="toggleFillExpand"
385
- :style="{ transform: isFillExpanded ? 'rotate(90deg)' : 'rotate(0deg)' }">▶</span>填充
386
- </span>
387
- <el-switch :model-value="isFillEnabled" size="small" @click.stop @change="toggleFillSwitch" />
388
- </div>
389
-
390
- <div v-show="isFillExpanded && isFillEnabled" class="shape-accordion-content">
391
- <div class="shape-property-row">
392
- <span class="shape-property-label">填充颜色</span>
393
- <QuickColorPopover v-model:visible="fillPopoverVisible" :color="fillHex || '#FFFFFF'"
394
- v-model:recentColors="localRecentColors" @select-color="(color) => emit('update:fillHex', color)">
395
- <template #reference>
396
- <div class="color-picker-pill-wrapper">
397
- <div class="color-pill-inner">
398
- <div :style="{ background: fillHex || '#FFFFFF' }" class="color-square-preview"></div>
399
- <span style="font-size: 11px; color: var(--text-primary); font-family: monospace; font-weight: 500;">
400
- {{ formatHexDisplay(fillHex || '#FFFFFF') }}
401
- </span>
402
- </div>
403
- </div>
404
- </template>
405
- </QuickColorPopover>
406
- </div>
407
- </div>
408
- </div>
409
-
410
- <!-- Border Accordion -->
411
- <SidebarBorderAccordion
412
- :is-border-enabled="isBorderEnabled"
413
- :is-border-expanded="isBorderExpanded"
414
- :border-hex="borderHex"
415
- :border-style="borderStyle"
416
- :border-width="borderWidth"
417
- :recent-colors="localRecentColors"
418
- @update:is-border-enabled="emit('update:isBorderEnabled', $event)"
419
- @update:is-border-expanded="emit('update:isBorderExpanded', $event)"
420
- @update:border-hex="emit('update:borderHex', $event)"
421
- @update:border-style="emit('update:borderStyle', $event)"
422
- @update:border-width="emit('update:borderWidth', $event)"
423
- />
424
-
425
- <!-- Shadow Accordion -->
426
- <SidebarShadowAccordion
427
- :is-shadow-enabled="isShadowEnabled"
428
- :is-shadow-expanded="isShadowExpanded"
429
- :shadow-hex="shadowHex"
430
- :shadow-angle="shadowAngle"
431
- :shadow-size="shadowSize"
432
- :shadow-blur="shadowBlur"
433
- :shadow-distance="shadowDistance"
434
- :recent-colors="localRecentColors"
435
- @update:is-shadow-enabled="emit('update:isShadowEnabled', $event)"
436
- @update:is-shadow-expanded="emit('update:isShadowExpanded', $event)"
437
- @update:shadow-hex="emit('update:shadowHex', $event)"
438
- @update:shadow-angle="emit('update:shadowAngle', $event)"
439
- @update:shadow-size="emit('update:shadowSize', $event)"
440
- @update:shadow-blur="emit('update:shadowBlur', $event)"
441
- @update:shadow-distance="emit('update:shadowDistance', $event)"
442
- />
443
-
444
- <!-- Reflection Accordion -->
445
- <SidebarReflectionAccordion
446
- :enable-reflection="enableReflection"
447
- :is-reflection-expanded="isReflectionExpanded"
448
- :reflection-distance="reflectionDistance"
449
- :reflection-size="reflectionSize"
450
- :reflection-opacity="reflectionOpacity"
451
- :reflection-blur="reflectionBlur"
452
- style="margin-bottom: 24px;"
453
- @update:enable-reflection="emit('update:enableReflection', $event)"
454
- @update:is-reflection-expanded="emit('update:isReflectionExpanded', $event)"
455
- @update:reflection-distance="emit('update:reflectionDistance', $event)"
456
- @update:reflection-size="emit('update:reflectionSize', $event)"
457
- @update:reflection-opacity="emit('update:reflectionOpacity', $event)"
458
- @update:reflection-blur="emit('update:reflectionBlur', $event)"
459
- />
460
- </div>
461
- </template>
462
-
463
- <style scoped lang="scss">
464
- .shape-accordion-group {
465
- border-bottom: 1px solid #EEEFF0;
466
- padding-bottom: 12px;
467
- margin-bottom: 8px;
468
- }
469
-
470
- .shape-accordion-header {
471
- display: flex;
472
- align-items: center;
473
- // justify-content: space-between;
474
- padding: 0 16px;
475
- height: 32px;
476
- cursor: pointer;
477
- }
478
-
479
- .shape-accordion-header-label {
480
- font-size: 14px;
481
- font-weight: 400;
482
- color: var(--text-primary);
483
- display: flex;
484
- align-items: center;
485
- gap: 6px;
486
- width: 80px;
487
- flex-shrink: 0;
488
- text-align: left;
489
- }
490
-
491
- .accordion-arrow {
492
- font-size: 9px;
493
- transition: transform 0.2s;
494
- display: inline-block;
495
- color: #475569;
496
- }
497
-
498
- .shape-accordion-content {
499
- padding: 12px 16px 0 16px;
500
- display: flex;
501
- flex-direction: column;
502
- gap: 12px;
503
- }
504
-
505
- .shape-property-row {
506
- display: flex;
507
- align-items: center;
508
- justify-content: space-between;
509
- height: 32px;
510
- padding: 0;
511
- gap: 8px;
512
- }
513
-
514
- .shape-property-label {
515
- font-size: 12px;
516
- color: var(--text-secondary, #64748b);
517
- width: 80px;
518
- flex-shrink: 0;
519
- text-align: left;
520
- }
521
-
522
- .color-picker-pill-wrapper {
523
- position: relative;
524
- display: flex;
525
- align-items: center;
526
- justify-content: space-between;
527
- background: #F5F6F7;
528
- border-radius: 4px;
529
- padding: 0 10px;
530
- height: 32px;
531
- flex: 1;
532
- cursor: pointer;
533
- border: none;
534
- box-sizing: border-box;
535
- }
536
-
537
- .color-pill-inner {
538
- display: flex;
539
- align-items: center;
540
- gap: 8px;
541
- }
542
-
543
- .color-square-preview {
544
- width: 14px;
545
- height: 14px;
546
- border-radius: 3px;
547
- border: 1px solid rgba(0, 0, 0, 0.1);
548
- flex-shrink: 0;
549
- }
550
-
551
- .chart-palette-option-item:hover {
552
- background: var(--bg-hover, #f1f5f9);
553
- }
554
-
555
- .chart-palette-option-item.active {
556
- background: var(--bg-active, #eff6ff);
557
- }
558
-
559
- .grid-btn {
560
- border: 1px solid var(--border-color, #e2e8f0);
561
- background: #ffffff;
562
- transition: all 0.2s;
563
-
564
- &:hover {
565
- background: var(--bg-hover, #f8fafc);
566
- border-color: #cbd5e1;
567
- }
568
- }
569
-
570
-
571
- .shape-slider-wrapper {
572
- display: flex;
573
- align-items: center;
574
- gap: 10px;
575
- flex: 1;
576
- }
577
-
578
- .custom-slider {
579
- --el-slider-height: 4px !important;
580
- --el-slider-button-size: 16px !important;
581
- --el-slider-button-wrapper-offset: -16px !important;
582
-
583
- :deep(.show-input) {
584
- margin-right: 16px;
585
- }
586
-
587
- :deep(.el-input-number) {
588
- width: 48px;
589
- height: 30px;
590
-
591
- .el-input__wrapper {
592
- padding: 4px;
593
- background: #F5F6F7;
594
- border: none;
595
- border-radius: 4px;
596
- box-shadow: none;
597
- }
598
-
599
- .el-input__inner {
600
- text-align: center;
601
- font-size: 12px;
602
- color: var(--text-primary);
603
- }
604
- }
605
- }
606
-
607
- :deep(.custom-select) {
608
- .el-select__wrapper {
609
- background-color: #F5F6F7 !important;
610
- border: none !important;
611
- border-radius: 4px !important;
612
- box-shadow: none !important;
613
- height: 32px !important;
614
- min-height: 32px !important;
615
- line-height: 32px !important;
616
- padding: 0 10px !important;
617
-
618
- &.is-focused {
619
- box-shadow: 0 0 0 1px var(--accent-primary, #6366f1) inset !important;
620
- }
621
- }
622
-
623
- .el-select__selected-item {
624
- font-size: 12px !important;
625
- color: var(--text-primary, #1e293b) !important;
626
- }
627
- }
628
-
629
- :deep(.el-switch__core) {
630
- border-radius: 4px !important;
631
- }
632
-
633
- :deep(.el-switch__action) {
634
- border-radius: 3px !important;
635
- }
636
-
637
-
638
- :deep(.color-span-box) {
639
- width: 100%;
640
- }
641
- </style>
1
+ <script setup lang="ts">
2
+ import { ref, computed, nextTick } from 'vue'
3
+ import SidebarAlignGroup from '../common/SidebarAlignGroup.vue'
4
+ import SidebarPositionGroup from '../common/SidebarPositionGroup.vue'
5
+ import SidebarBorderAccordion from '../common/SidebarBorderAccordion.vue'
6
+ import SidebarShadowAccordion from '../common/SidebarShadowAccordion.vue'
7
+ import SidebarReflectionAccordion from '../common/SidebarReflectionAccordion.vue'
8
+ import ChartTypeSelector from '../../ChartTypeSelector.vue'
9
+ import QuickColorPopover from '../../QuickColorPopover.vue'
10
+ import GradientEditor from './GradientEditor.vue'
11
+ import { generateMonoPalette } from '../../../utils/palette'
12
+ import {
13
+ parseColor,
14
+ hexToRgba,
15
+ generateGradientEndColor,
16
+ PATTERN_PRESETS,
17
+ buildPatternSvgDataUrl,
18
+ parsePatternSvgMeta
19
+ } from '../../../composables/sidebar/useSidebarShapeFormat'
20
+ import {
21
+ getElementGradientConfig,
22
+ getElementGradientCss
23
+ } from '../../../utils/canvas/elementStyles'
24
+
25
+ const props = defineProps<{
26
+ element: any
27
+ elementX: number
28
+ elementY: number
29
+ elementW: number
30
+ elementH: number
31
+ elementRotate: number
32
+ isFixedRatio?: boolean
33
+ isFlipH?: boolean
34
+ isFlipV?: boolean
35
+ chartPrimaryColor: string
36
+ chartGridColor: string
37
+ chartTextColor: string
38
+ currentChartColors: string[]
39
+ currentChartPaletteId: string
40
+ chartPresetPalettes: any[]
41
+ recentColors?: string[]
42
+ // Fill props
43
+ isFillEnabled?: boolean
44
+ isFillExpanded?: boolean
45
+ shapeFillType?: string
46
+ fillHex?: string
47
+ fillOpacity?: number
48
+ gradientPathType?: string
49
+ gradientDirection?: string
50
+ gradientStartHex?: string
51
+ gradientEndHex?: string
52
+ gradientAngle?: number
53
+ shapePatternFill?: string
54
+ shapePatternType?: string
55
+ shapePatternFg?: string
56
+ shapePatternBg?: string
57
+ // Border props
58
+ isBorderEnabled?: boolean
59
+ isBorderExpanded?: boolean
60
+ borderHex?: string
61
+ borderStyle?: string
62
+ borderWidth?: number
63
+ borderAlpha?: number
64
+ // Shadow props
65
+ isShadowEnabled?: boolean
66
+ isShadowExpanded?: boolean
67
+ shadowHex?: string
68
+ shadowAngle?: number
69
+ shadowSize?: number
70
+ shadowBlur?: number
71
+ shadowDistance?: number
72
+ shadowAlpha?: number
73
+ // Reflection props
74
+ enableReflection?: boolean
75
+ isReflectionExpanded?: boolean
76
+ reflectionDistance?: number
77
+ reflectionSize?: number
78
+ reflectionOpacity?: number
79
+ reflectionBlur?: number
80
+ }>()
81
+
82
+ const emit = defineEmits<{
83
+ (e: 'alignLeft'): void
84
+ (e: 'alignCenter'): void
85
+ (e: 'alignRight'): void
86
+ (e: 'alignTop'): void
87
+ (e: 'alignMiddle'): void
88
+ (e: 'alignBottom'): void
89
+ (e: 'update:elementX', val: number): void
90
+ (e: 'update:elementY', val: number): void
91
+ (e: 'update:elementW', val: number): void
92
+ (e: 'update:elementH', val: number): void
93
+ (e: 'update:elementRotate', val: number): void
94
+ (e: 'update:isFixedRatio', val: boolean): void
95
+ (e: 'toggleFlipH'): void
96
+ (e: 'toggleFlipV'): void
97
+ (e: 'adjustZIndex', cmd: any): void
98
+ (e: 'openChartDataDialog'): void
99
+ (e: 'changeChartType', type: any): void
100
+ (e: 'update:chartPrimaryColor', val: string): void
101
+ (e: 'update:chartGridColor', val: string): void
102
+ (e: 'update:chartTextColor', val: string): void
103
+ (e: 'selectChartPalette', palette: any): void
104
+ // Fill
105
+ (e: 'update:isFillEnabled', val: boolean): void
106
+ (e: 'update:isFillExpanded', val: boolean): void
107
+ (e: 'update:shapeFillType', val: string): void
108
+ (e: 'update:fillHex', val: string): void
109
+ (e: 'update:fillOpacity', val: number): void
110
+ (e: 'update:gradientPathType', val: string): void
111
+ (e: 'update:gradientDirection', val: string): void
112
+ (e: 'update:gradientStartHex', val: string): void
113
+ (e: 'update:gradientEndHex', val: string): void
114
+ (e: 'update:gradientAngle', val: number): void
115
+ (e: 'update:elementGradient', config: any, css: string, commit?: boolean): void
116
+ (e: 'update:shapePatternFill', val: string): void
117
+ (e: 'update:shapePatternType', val: string): void
118
+ (e: 'update:shapePatternFg', val: string): void
119
+ (e: 'update:shapePatternBg', val: string): void
120
+ (e: 'handleShapePatternUpload', event: Event): void
121
+ (e: 'clearShapePatternFill'): void
122
+ // Border
123
+ (e: 'update:isBorderEnabled', val: boolean): void
124
+ (e: 'update:isBorderExpanded', val: boolean): void
125
+ (e: 'update:borderHex', val: string): void
126
+ (e: 'update:borderStyle', val: string): void
127
+ (e: 'update:borderWidth', val: number): void
128
+ (e: 'update:borderAlpha', val: number): void
129
+ // Shadow
130
+ (e: 'update:isShadowEnabled', val: boolean): void
131
+ (e: 'update:isShadowExpanded', val: boolean): void
132
+ (e: 'update:shadowHex', val: string): void
133
+ (e: 'update:shadowAngle', val: number): void
134
+ (e: 'update:shadowSize', val: number): void
135
+ (e: 'update:shadowBlur', val: number): void
136
+ (e: 'update:shadowDistance', val: number): void
137
+ (e: 'update:shadowAlpha', val: number): void
138
+ // Reflection
139
+ (e: 'update:enableReflection', val: boolean): void
140
+ (e: 'update:isReflectionExpanded', val: boolean): void
141
+ (e: 'update:reflectionDistance', val: number): void
142
+ (e: 'update:reflectionSize', val: number): void
143
+ (e: 'update:reflectionOpacity', val: number): void
144
+ (e: 'update:reflectionBlur', val: number): void
145
+ }>()
146
+
147
+ const chartTypePopoverVisible = ref(false)
148
+ const chartPrimaryColorPopoverVisible = ref(false)
149
+ const chartPalettePopoverVisible = ref(false)
150
+ const chartGridColorPopoverVisible = ref(false)
151
+ const chartTextColorPopoverVisible = ref(false)
152
+ const fillPopoverVisible = ref(false)
153
+ const patternFgPopoverVisible = ref(false)
154
+ const patternBgPopoverVisible = ref(false)
155
+ const imageFileInputRef = ref<HTMLInputElement | null>(null)
156
+ const gradientEditorRef = ref<any>(null)
157
+
158
+ const localRecentColors = ref<string[]>(props.recentColors || [])
159
+
160
+ const legendPositions = [
161
+ 'top-left', 'top', 'top-right', 'bottom-left',
162
+ 'bottom', 'bottom-right', 'right-top', 'right',
163
+ 'right-bottom', 'left-top', 'left', 'left-bottom'
164
+ ]
165
+
166
+ const legendIcons: Record<string, string> = {
167
+ 'top-left': 'icon-ppt-a-zu9437',
168
+ 'top': 'icon-ppt-a-zu9436',
169
+ 'top-right': 'icon-ppt-a-zu9435',
170
+ 'bottom-left': 'icon-ppt-a-zu9440',
171
+ 'bottom': 'icon-ppt-a-zu9439',
172
+ 'bottom-right': 'icon-ppt-a-zu9438',
173
+ 'right-top': 'icon-ppt-a-zu9432',
174
+ 'right': 'icon-ppt-a-zu9433',
175
+ 'right-bottom': 'icon-ppt-a-zu9434',
176
+ 'left-top': 'icon-ppt-a-zu9429',
177
+ 'left': 'icon-ppt-a-zu9430',
178
+ 'left-bottom': 'icon-ppt-a-zu9431'
179
+ }
180
+
181
+ function getChartTypeName(type: string | undefined): string {
182
+ if (!type) return '基础柱状图'
183
+ const map: Record<string, string> = {
184
+ 'pie': '基础饼图',
185
+ 'donut': '环图',
186
+ 'rose-pie': '玫瑰图',
187
+ 'rose-donut': '玫瑰环图',
188
+ 'bar': '基础柱状图',
189
+ 'percent-bar': '百分比柱状图',
190
+ 'stacked-bar': '堆叠柱状图',
191
+ 'line': '折线图',
192
+ 'compare-line': '对比折线图',
193
+ 'step-line': '其他折线图',
194
+ 'horizontal-bar': '基础条形图',
195
+ 'stacked-horizontal-bar': '堆叠条形图',
196
+ 'area': '基础面积图',
197
+ 'stacked-area': '堆叠面积图',
198
+ 'scatter': '散点图',
199
+ 'radar': '雷达图'
200
+ }
201
+ return map[type] || '基础柱状图'
202
+ }
203
+
204
+ const normalizedChartType = computed(() => {
205
+ let t = (props.element?.chartType as string) || 'bar'
206
+ if (t === 'doughnutChart' || t === 'ring') t = 'donut'
207
+ if (t === 'pieChart' || t === 'pie3DChart') t = 'pie'
208
+ if (t === 'barChart' || t === 'bar3DChart') t = 'bar'
209
+ if (t === 'lineChart' || t === 'line3DChart') t = 'line'
210
+ if (t === 'areaChart' || t === 'area3DChart') t = 'area'
211
+ return t
212
+ })
213
+
214
+ const isPieOrDonut = computed(() =>
215
+ ['pie', 'donut', 'rose-pie', 'rose-donut'].includes(normalizedChartType.value)
216
+ )
217
+ const isCartesianChart = computed(() =>
218
+ ['bar', 'percent-bar', 'stacked-bar', 'horizontal-bar', 'stacked-horizontal-bar', 'line', 'compare-line', 'step-line', 'area', 'stacked-area', 'scatter'].includes(normalizedChartType.value)
219
+ )
220
+
221
+ const chartShowAxes = computed({
222
+ get: () => props.element?.showAxes !== false,
223
+ set: (val: boolean) => { if (props.element) props.element.showAxes = val }
224
+ })
225
+
226
+ const chartShowGridlines = computed({
227
+ get: () => props.element?.showGridlines !== false,
228
+ set: (val: boolean) => { if (props.element) props.element.showGridlines = val }
229
+ })
230
+
231
+ const chartShowLegend = computed({
232
+ get: () => {
233
+ if (props.element?.showLegend !== undefined) return Boolean(props.element.showLegend)
234
+ if (props.element?.options?.showLegend !== undefined) return Boolean(props.element.options.showLegend)
235
+ return true
236
+ },
237
+ set: (val: boolean) => {
238
+ if (!props.element) return
239
+ props.element.showLegend = val
240
+ if (props.element.options) props.element.options.showLegend = val
241
+ }
242
+ })
243
+
244
+ const chartShowDataLabels = computed({
245
+ get: () => {
246
+ if (props.element?.showDataLabels !== undefined) return Boolean(props.element.showDataLabels)
247
+ if (isPieOrDonut.value) {
248
+ if (props.element?.showPercent !== undefined) return Boolean(props.element.showPercent)
249
+ if (props.element?.options?.showPercent !== undefined) return Boolean(props.element.options.showPercent)
250
+ return true
251
+ }
252
+ return false
253
+ },
254
+ set: (val: boolean) => {
255
+ if (!props.element) return
256
+ props.element.showDataLabels = val
257
+ if (isPieOrDonut.value) {
258
+ props.element.showPercent = val
259
+ if (props.element.options) props.element.options.showPercent = val
260
+ }
261
+ }
262
+ })
263
+
264
+ const chartShowTitle = computed({
265
+ get: () => Boolean(props.element?.showTitle),
266
+ set: (val: boolean) => {
267
+ if (!props.element) return
268
+ props.element.showTitle = val
269
+ if (val && !props.element.chartTitle) {
270
+ props.element.chartTitle = '图表标题'
271
+ }
272
+ }
273
+ })
274
+
275
+ const chartShowAxisTitles = computed({
276
+ get: () => Boolean(props.element?.showAxisTitles),
277
+ set: (val: boolean) => {
278
+ if (!props.element) return
279
+ props.element.showAxisTitles = val
280
+ if (val) {
281
+ if (!props.element.xAxisTitle) props.element.xAxisTitle = normalizedChartType.value === 'horizontal-bar' ? '数值' : '分类'
282
+ if (!props.element.yAxisTitle) props.element.yAxisTitle = normalizedChartType.value === 'horizontal-bar' ? '分类' : '数值'
283
+ }
284
+ }
285
+ })
286
+
287
+ const chartShowDataTable = computed({
288
+ get: () => Boolean(props.element?.showDataTable),
289
+ set: (val: boolean) => { if (props.element) props.element.showDataTable = val }
290
+ })
291
+
292
+ const chartShowErrorBars = computed({
293
+ get: () => Boolean(props.element?.showErrorBars),
294
+ set: (val: boolean) => { if (props.element) props.element.showErrorBars = val }
295
+ })
296
+
297
+ const donutHoleSize = computed({
298
+ get: () => {
299
+ const h = parseFloat(props.element?.holeSize ?? props.element?.options?.holeSize)
300
+ return !isNaN(h) && h > 0 && h < 100 ? Math.round(h) : 72
301
+ },
302
+ set: (val: number) => {
303
+ if (!props.element) return
304
+ const clamped = Math.max(25, Math.min(85, val))
305
+ props.element.holeSize = clamped
306
+ if (props.element.options) props.element.options.holeSize = clamped
307
+ }
308
+ })
309
+
310
+ function formatHexDisplay(val: any): string {
311
+ if (!val || val === 'transparent') return '无'
312
+ let str = ''
313
+ if (typeof val === 'string') {
314
+ str = val
315
+ } else if (typeof val === 'object' && val !== null) {
316
+ if (val.type === 'color' && typeof val.value === 'string') {
317
+ str = val.value
318
+ } else if (val.colors && Array.isArray(val.colors) && val.colors[0]?.color) {
319
+ str = val.colors[0].color
320
+ } else if (val.value && typeof val.value === 'object' && val.value.colors && Array.isArray(val.value.colors)) {
321
+ str = val.value.colors[0]?.color || ''
322
+ } else if (typeof val.value === 'string') {
323
+ str = val.value
324
+ }
325
+ }
326
+ if (!str || str === 'transparent') return '无'
327
+ let clean = str.replace('#', '').trim().toUpperCase()
328
+ if (clean.length === 8) clean = clean.slice(0, 6)
329
+ return clean
330
+ }
331
+
332
+ function getPaletteColors(palette: any): string[] {
333
+ if (palette.id === 'mono') {
334
+ return generateMonoPalette(props.chartPrimaryColor, 8)
335
+ }
336
+ return palette.colors || []
337
+ }
338
+
339
+ function onSelectChartType(type: any) {
340
+ emit('changeChartType', type)
341
+ chartTypePopoverVisible.value = false
342
+ }
343
+
344
+ function onSelectChartPalette(palette: any) {
345
+ emit('selectChartPalette', palette)
346
+ chartPalettePopoverVisible.value = false
347
+ }
348
+
349
+ // Fill mode & gradient/pattern helpers (aligned with SidebarShapeFormatPanel)
350
+ const currentShapeGradient = computed(() => {
351
+ if (!props.element) return 'linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%)'
352
+ const g = getElementGradientConfig(props.element) || props.element?._lastGradient
353
+ if (g?.css) return g.css
354
+ const css = getElementGradientCss(props.element)
355
+ if (css) return css
356
+ if (g) return g
357
+ const startColor = (props.fillHex && props.fillHex !== 'transparent' && props.fillHex !== 'none') ? props.fillHex : '#3b82f6'
358
+ const endColor = props.gradientEndHex || generateGradientEndColor(startColor)
359
+ return `linear-gradient(135deg, ${startColor} 0%, ${endColor} 100%)`
360
+ })
361
+
362
+ const activeGradientStart = computed(() => {
363
+ const g = getElementGradientConfig(props.element) || props.element?._lastGradient
364
+ if (g?.colors && g.colors.length > 0 && g.colors[0]?.color) {
365
+ return parseColor(g.colors[0].color).hex
366
+ }
367
+ if (props.gradientStartHex) return props.gradientStartHex
368
+ if (props.fillHex && props.fillHex !== 'transparent' && props.fillHex !== 'none') {
369
+ return props.fillHex
370
+ }
371
+ return '#3b82f6'
372
+ })
373
+
374
+ const activeGradientEnd = computed(() => {
375
+ const g = getElementGradientConfig(props.element) || props.element?._lastGradient
376
+ if (g?.colors && g.colors.length > 1 && g.colors[g.colors.length - 1]?.color) {
377
+ return parseColor(g.colors[g.colors.length - 1]?.color).hex
378
+ }
379
+ if (props.gradientEndHex) return props.gradientEndHex
380
+ return generateGradientEndColor(activeGradientStart.value)
381
+ })
382
+
383
+ const activeGradientMid = computed(() => {
384
+ const g = getElementGradientConfig(props.element) || props.element?._lastGradient
385
+ if (g?.colors && g.colors.length > 2) {
386
+ const midIdx = Math.floor(g.colors.length / 2)
387
+ return parseColor(g.colors[midIdx].color).hex
388
+ }
389
+ return generateGradientEndColor(activeGradientStart.value)
390
+ })
391
+
392
+ function onShapeGradientRealtime(config: any, css: string) {
393
+ emit('update:elementGradient', config, css, false)
394
+ }
395
+
396
+ function onShapeGradientCommit(config: any, css: string) {
397
+ emit('update:elementGradient', config, css, true)
398
+ }
399
+
400
+ const activeFillMode = computed(() => {
401
+ const fillType = props.shapeFillType || 'solid'
402
+ if (fillType === 'solid') return 'solid'
403
+ if (fillType === 'gradient') {
404
+ if (gradientEditorRef.value?.currentType) {
405
+ const ct = gradientEditorRef.value.currentType
406
+ return ct === 'path' ? 'gradient-linear' : `gradient-${ct}`
407
+ }
408
+ const g = getElementGradientConfig(props.element) || props.element?._lastGradient
409
+ if (g?.type) {
410
+ return g.type === 'path' ? 'gradient-linear' : `gradient-${g.type}`
411
+ }
412
+ if (props.gradientPathType === 'circle') return 'gradient-radial'
413
+ if (props.gradientPathType === 'rect') return 'gradient-rect'
414
+ return 'gradient-linear'
415
+ }
416
+ if (fillType === 'image') return 'image'
417
+ if (fillType === 'pattern') return 'pattern'
418
+ return 'solid'
419
+ })
420
+
421
+ function selectFillMode(mode: string) {
422
+ if (!props.isFillEnabled) {
423
+ emit('update:isFillEnabled', true)
424
+ emit('update:isFillExpanded', true)
425
+ }
426
+ if (mode === 'solid') {
427
+ emit('update:shapeFillType', 'solid')
428
+ } else if (mode.startsWith('gradient-')) {
429
+ const gType = mode.replace('gradient-', '') as 'linear' | 'radial' | 'rect'
430
+ const path = gType === 'linear' ? 'line' : (gType === 'radial' ? 'circle' : 'rect')
431
+ emit('update:gradientPathType', path)
432
+ if (props.shapeFillType !== 'gradient') {
433
+ emit('update:shapeFillType', 'gradient')
434
+ }
435
+ nextTick(() => {
436
+ if (gradientEditorRef.value?.changeType) {
437
+ gradientEditorRef.value.changeType(gType)
438
+ }
439
+ })
440
+ } else if (mode === 'image') {
441
+ emit('update:shapeFillType', 'image')
442
+ } else if (mode === 'pattern') {
443
+ emit('update:shapeFillType', 'pattern')
444
+ }
445
+ }
446
+
447
+ function toggleFillHeader() {
448
+ if (!props.isFillEnabled) return
449
+ emit('update:isFillExpanded', !props.isFillExpanded)
450
+ }
451
+
452
+ function toggleFillSwitch(val: any) {
453
+ const boolVal = !!val
454
+ emit('update:isFillEnabled', boolVal)
455
+ emit('update:isFillExpanded', boolVal)
456
+ }
457
+
458
+ const currentPatternImage = computed(() => {
459
+ return props.shapePatternFill || props.element?.pattern || props.element?.style?.pattern || ''
460
+ })
461
+
462
+ function triggerImageUpload() {
463
+ imageFileInputRef.value?.click()
464
+ }
465
+
466
+ function handleImageFileChange(e: Event) {
467
+ emit('handleShapePatternUpload', e)
468
+ if (imageFileInputRef.value) {
469
+ imageFileInputRef.value.value = ''
470
+ }
471
+ }
472
+
473
+ const activePatternType = computed(() => {
474
+ if (props.shapePatternType && props.shapePatternType !== 'pattern' && props.shapePatternType !== 'solid') {
475
+ return props.shapePatternType
476
+ }
477
+ const meta = parsePatternSvgMeta(currentPatternImage.value)
478
+ return meta.type || 'diag-up'
479
+ })
480
+
481
+ const parsedPatternFg = computed(() => {
482
+ const raw = props.shapePatternFg || parsePatternSvgMeta(currentPatternImage.value).fg || '#3B82F6'
483
+ return parseColor(raw)
484
+ })
485
+
486
+ const parsedPatternBg = computed(() => {
487
+ const raw = props.shapePatternBg || parsePatternSvgMeta(currentPatternImage.value).bg || '#FFFFFF'
488
+ return parseColor(raw)
489
+ })
490
+
491
+ function getPatternPresetPreviewUrl(p: { key: string; url: string }) {
492
+ const fg = props.shapePatternFg || '#3B82F6'
493
+ const bg = props.shapePatternBg || '#FFFFFF'
494
+ return buildPatternSvgDataUrl(p.key, fg, bg)
495
+ }
496
+
497
+ function isPatternPresetActive(p: { key: string; url: string }) {
498
+ return activePatternType.value === p.key
499
+ }
500
+
501
+ function selectPatternPreset(p: { key: string; url: string }) {
502
+ emit('update:shapePatternType', p.key)
503
+ }
504
+
505
+ function onSelectPatternFgColor(color: string) {
506
+ if (!color || color === 'transparent' || color === 'none') {
507
+ emit('update:shapePatternFg', 'transparent')
508
+ return
509
+ }
510
+ emit('update:shapePatternFg', color)
511
+ }
512
+
513
+ function handlePatternFgOpacityInput(e: Event) {
514
+ const target = e.target as HTMLInputElement
515
+ let val = parseInt(target.value)
516
+ if (isNaN(val)) val = 100
517
+ val = Math.max(0, Math.min(100, val))
518
+ if (val === 0) {
519
+ emit('update:shapePatternFg', 'transparent')
520
+ } else if (val === 100) {
521
+ const hex = parsedPatternFg.value.hex === 'transparent' ? '#3B82F6' : parsedPatternFg.value.hex
522
+ emit('update:shapePatternFg', hex)
523
+ } else {
524
+ const hex = parsedPatternFg.value.hex === 'transparent' ? '#3B82F6' : parsedPatternFg.value.hex
525
+ emit('update:shapePatternFg', hexToRgba(hex, val))
526
+ }
527
+ }
528
+
529
+ function onSelectPatternBgColor(color: string) {
530
+ if (!color || color === 'transparent' || color === 'none') {
531
+ emit('update:shapePatternBg', 'transparent')
532
+ return
533
+ }
534
+ emit('update:shapePatternBg', color)
535
+ }
536
+
537
+ function handlePatternBgOpacityInput(e: Event) {
538
+ const target = e.target as HTMLInputElement
539
+ let val = parseInt(target.value)
540
+ if (isNaN(val)) val = 100
541
+ val = Math.max(0, Math.min(100, val))
542
+ if (val === 0) {
543
+ emit('update:shapePatternBg', 'transparent')
544
+ } else if (val === 100) {
545
+ const hex = parsedPatternBg.value.hex === 'transparent' ? '#FFFFFF' : parsedPatternBg.value.hex
546
+ emit('update:shapePatternBg', hex)
547
+ } else {
548
+ const hex = parsedPatternBg.value.hex === 'transparent' ? '#FFFFFF' : parsedPatternBg.value.hex
549
+ emit('update:shapePatternBg', hexToRgba(hex, val))
550
+ }
551
+ }
552
+
553
+ const displayFillOpacity = computed(() => {
554
+ if (props.fillHex === 'transparent' || props.fillHex === 'none') {
555
+ return 0
556
+ }
557
+ const alpha = props.fillOpacity !== undefined ? props.fillOpacity : 100
558
+ return Math.max(0, Math.min(100, Math.round(alpha)))
559
+ })
560
+
561
+ function handleFillOpacityInput(e: Event) {
562
+ const target = e.target as HTMLInputElement
563
+ let val = parseInt(target.value)
564
+ if (isNaN(val)) val = 100
565
+ val = Math.max(0, Math.min(100, val))
566
+ emit('update:fillOpacity', val)
567
+ }
568
+
569
+ function onSelectFillColor(color: string) {
570
+ if (!color || color === 'transparent' || color === 'none') {
571
+ emit('update:fillHex', 'transparent')
572
+ emit('update:fillOpacity', 0)
573
+ return
574
+ }
575
+ const parsed = parseColor(color)
576
+ emit('update:fillHex', parsed.hex)
577
+ if (parsed.alpha !== undefined && parsed.alpha < 100) {
578
+ emit('update:fillOpacity', parsed.alpha)
579
+ } else if (!props.fillOpacity || props.fillOpacity === 0) {
580
+ emit('update:fillOpacity', 100)
581
+ }
582
+ }
583
+ </script>
584
+
585
+ <template>
586
+ <div class="sidebar-chart-format-panel flex-column" style="display: flex; flex-direction: column;">
587
+ <!-- Alignment Row -->
588
+ <SidebarAlignGroup @align-left="emit('alignLeft')" @align-center="emit('alignCenter')"
589
+ @align-right="emit('alignRight')" @align-top="emit('alignTop')" @align-middle="emit('alignMiddle')"
590
+ @align-bottom="emit('alignBottom')" />
591
+
592
+ <!-- Position & Dimensions without rotate and flips, with "编辑数据" inside the group -->
593
+ <SidebarPositionGroup :element-x="elementX" :element-y="elementY" :element-w="elementW" :element-h="elementH"
594
+ :element-rotate="elementRotate" :is-fixed-ratio="isFixedRatio" :is-flip-h="isFlipH" :is-flip-v="isFlipV"
595
+ :show-rotate="false" :show-flips="false" @update:element-x="emit('update:elementX', $event)"
596
+ @update:element-y="emit('update:elementY', $event)" @update:element-w="emit('update:elementW', $event)"
597
+ @update:element-h="emit('update:elementH', $event)" @update:element-rotate="emit('update:elementRotate', $event)"
598
+ @update:is-fixed-ratio="emit('update:isFixedRatio', $event)" @toggle-flip-h="emit('toggleFlipH')"
599
+ @toggle-flip-v="emit('toggleFlipV')" @adjust-z-index="emit('adjustZIndex', $event)">
600
+ <!-- Edit Chart Data Button placed inside position group before bottom border divider -->
601
+ <el-button type="primary" class="edit-chart-data-btn" @click="emit('openChartDataDialog')">
602
+ 编辑数据
603
+ </el-button>
604
+ </SidebarPositionGroup>
605
+
606
+ <!-- Chart Specific Settings -->
607
+ <div style="padding: 0 16px; display: flex; flex-direction: column; gap: 12px; margin-top: 8px;">
608
+ <!-- Chart Type -->
609
+ <div class="shape-property-row"
610
+ style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
611
+ <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">图表类型</span>
612
+ <el-popover placement="bottom" :width="568" trigger="click" popper-class="chart-popover-popper"
613
+ v-model:visible="chartTypePopoverVisible" :show-arrow="false">
614
+ <template #reference>
615
+ <div
616
+ style="flex: 1; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; background: #f5f6f7; border-radius: 4px; cursor: pointer; height: 32px; box-sizing: border-box;">
617
+ <span style="font-size: 12px; color: var(--text-primary); font-weight: 500;">
618
+ {{ getChartTypeName(normalizedChartType) }}
619
+ </span>
620
+ <span style="font-size: 10px; color: var(--text-muted);">▼</span>
621
+ </div>
622
+ </template>
623
+ <ChartTypeSelector :current-type="normalizedChartType" @select="onSelectChartType" />
624
+ </el-popover>
625
+ </div>
626
+
627
+ <!-- Chart Primary Color (图表主色) -->
628
+ <div class="shape-property-row"
629
+ style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
630
+ <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">图表主色</span>
631
+ <QuickColorPopover v-model:visible="chartPrimaryColorPopoverVisible" :color="chartPrimaryColor"
632
+ v-model:recentColors="localRecentColors" @select-color="(val) => emit('update:chartPrimaryColor', val)">
633
+ <template #reference>
634
+ <div class="color-picker-pill-wrapper" style="flex: 1; height: 32px;">
635
+ <div class="color-pill-inner" style="height: 32px;">
636
+ <div :style="{ background: chartPrimaryColor }" class="color-square-preview"></div>
637
+ <span style="font-size: 11px; color: var(--text-primary); font-family: monospace; font-weight: 500;">
638
+ {{ formatHexDisplay(chartPrimaryColor) }}
639
+ </span>
640
+ </div>
641
+ </div>
642
+ </template>
643
+ </QuickColorPopover>
644
+ </div>
645
+
646
+ <!-- Chart Palette (调色板) -->
647
+ <div class="shape-property-row"
648
+ style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
649
+ <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">调色板</span>
650
+ <el-popover placement="bottom-end" :width="250" trigger="click" v-model:visible="chartPalettePopoverVisible"
651
+ popper-class="chart-palette-popover">
652
+ <template #reference>
653
+ <div
654
+ style="flex: 1; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; background: #f5f6f7; border-radius: 4px; cursor: pointer; height: 32px; box-sizing: border-box;">
655
+ <div style="display: flex; gap: 4px; align-items: center; overflow: hidden;">
656
+ <div v-for="(c, idx) in currentChartColors" :key="idx" :style="{ background: c }"
657
+ style="width: 14px; height: 14px; border-radius: 2px; border: 1px solid rgba(0,0,0,0.08); flex-shrink: 0;">
658
+ </div>
659
+ </div>
660
+ <span style="font-size: 10px; color: var(--text-muted); margin-left: 6px;">▼</span>
661
+ </div>
662
+ </template>
663
+ <div
664
+ style="padding: 4px 0; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto;">
665
+ <div v-for="item in chartPresetPalettes" :key="item.id" class="chart-palette-option-item"
666
+ :class="{ active: currentChartPaletteId === item.id }" @click="onSelectChartPalette(item)"
667
+ style="padding: 6px 8px; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: background 0.15s ease;">
668
+ <div style="display: flex; align-items: center; justify-content: space-between;">
669
+ <span style="font-size: 12px; font-weight: 500; color: var(--text-primary);">{{ item.name }}</span>
670
+ <span v-if="currentChartPaletteId === item.id"
671
+ style="color: var(--accent-primary); font-size: 12px; font-weight: bold;">✔</span>
672
+ </div>
673
+ <div style="display: flex; gap: 4px; align-items: center;">
674
+ <div v-for="(col, cIdx) in getPaletteColors(item)" :key="cIdx" :style="{ background: col }"
675
+ style="flex: 1; height: 14px; border-radius: 2px; border: 1px solid rgba(0,0,0,0.08);"></div>
676
+ </div>
677
+ </div>
678
+ </div>
679
+ </el-popover>
680
+ </div>
681
+
682
+ <!-- Axis Color (坐标轴色 - 仅直角坐标系/雷达图或开启数据表时显示) -->
683
+ <div v-if="!isPieOrDonut || chartShowDataTable" class="shape-property-row"
684
+ style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
685
+ <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">{{ isPieOrDonut ? '表格线色' : '坐标轴色' }}</span>
686
+ <QuickColorPopover v-model:visible="chartGridColorPopoverVisible" :color="chartGridColor"
687
+ v-model:recentColors="localRecentColors" @select-color="(val) => emit('update:chartGridColor', val)">
688
+ <template #reference>
689
+ <div class="color-picker-pill-wrapper" style="flex: 1; height: 32px;">
690
+ <div class="color-pill-inner" style="height: 32px;">
691
+ <div :style="{ background: chartGridColor }" class="color-square-preview"></div>
692
+ <span style="font-size: 11px; color: var(--text-primary); font-family: monospace; font-weight: 500;">
693
+ {{ formatHexDisplay(chartGridColor) }}
694
+ </span>
695
+ </div>
696
+ </div>
697
+ </template>
698
+ </QuickColorPopover>
699
+ </div>
700
+
701
+ <!-- Text Color (文字颜色) -->
702
+ <div class="shape-property-row"
703
+ style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
704
+ <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">文字颜色</span>
705
+ <QuickColorPopover v-model:visible="chartTextColorPopoverVisible" :color="chartTextColor"
706
+ v-model:recentColors="localRecentColors" @select-color="(val) => emit('update:chartTextColor', val)">
707
+ <template #reference>
708
+ <div class="color-picker-pill-wrapper" style="flex: 1; height: 32px;">
709
+ <div class="color-pill-inner" style="height: 32px;">
710
+ <div :style="{ background: chartTextColor }" class="color-square-preview"></div>
711
+ <span style="font-size: 11px; color: var(--text-primary); font-family: monospace; font-weight: 500;">
712
+ {{ formatHexDisplay(chartTextColor) }}
713
+ </span>
714
+ </div>
715
+ </div>
716
+ </template>
717
+ </QuickColorPopover>
718
+ </div>
719
+
720
+ <!-- Donut Hole Size (环形图 / 玫瑰环图专属:内径比例调节) -->
721
+ <div v-if="normalizedChartType === 'donut' || normalizedChartType === 'rose-donut'" class="shape-property-row"
722
+ style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
723
+ <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">环形内径</span>
724
+ <div style="flex: 1; display: flex; align-items: center; gap: 8px;">
725
+ <el-slider v-model="donutHoleSize" :min="25" :max="85" :show-tooltip="false" size="small" style="flex: 1;" />
726
+ <span style="font-size: 11px; color: var(--text-secondary, #475569); width: 34px; text-align: right; font-variant-numeric: tabular-nums;">
727
+ {{ donutHoleSize }}%
728
+ </span>
729
+ </div>
730
+ </div>
731
+
732
+ <!-- Elements Checkboxes (根据当前图表类型智能过滤有效元素) -->
733
+ <div class="shape-property-row"
734
+ style="display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; height: auto;">
735
+ <span class="shape-property-label"
736
+ style="flex-shrink: 0; width: 64px; text-align: left; margin-top: 4px;">图表元素</span>
737
+ <div style="flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px;">
738
+ <el-checkbox v-if="!isPieOrDonut" v-model="chartShowAxes" size="small">坐标轴</el-checkbox>
739
+ <el-checkbox v-if="isCartesianChart" v-model="chartShowAxisTitles" size="small">轴标题</el-checkbox>
740
+ <el-checkbox v-model="chartShowTitle" size="small">图表标题</el-checkbox>
741
+ <el-checkbox v-model="chartShowDataLabels" size="small">数据标签</el-checkbox>
742
+ <el-checkbox v-if="!isPieOrDonut" v-model="chartShowGridlines" size="small">网格线</el-checkbox>
743
+ <el-checkbox v-model="chartShowLegend" size="small">图例</el-checkbox>
744
+ <el-checkbox v-model="chartShowDataTable" size="small">数据表</el-checkbox>
745
+ <el-checkbox v-if="isCartesianChart" v-model="chartShowErrorBars" size="small">误差线</el-checkbox>
746
+ </div>
747
+ </div>
748
+
749
+ <!-- 图表标题文字编辑 (开启图表标题时展示) -->
750
+ <div v-if="chartShowTitle" class="shape-property-row"
751
+ style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
752
+ <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">标题内容</span>
753
+ <el-input v-model="element.chartTitle" size="small" placeholder="请输入图表标题" style="flex: 1;" />
754
+ </div>
755
+
756
+ <!-- 坐标轴标题文字编辑 (直角坐标系开启轴标题时展示) -->
757
+ <div v-if="isCartesianChart && chartShowAxisTitles" class="shape-property-row"
758
+ style="display: flex; align-items: center; justify-content: space-between; gap: 8px; height: auto;">
759
+ <span class="shape-property-label" style="flex-shrink: 0; width: 64px; text-align: left;">轴标题名</span>
760
+ <div style="flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px;">
761
+ <el-input v-model="element.xAxisTitle" size="small" placeholder="横轴标题" />
762
+ <el-input v-model="element.yAxisTitle" size="small" placeholder="纵轴标题" />
763
+ </div>
764
+ </div>
765
+
766
+ <!-- Legend Positions (12 grid buttons - 开启图例时显示) -->
767
+ <div v-if="chartShowLegend" class="shape-property-row"
768
+ style="display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; height: auto;">
769
+ <span class="shape-property-label"
770
+ style="flex-shrink: 0; width: 64px; text-align: left; margin-top: 4px;">图例位置</span>
771
+ <div style="flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;">
772
+ <div v-for="pos in legendPositions" :key="pos" class="grid-btn" :style="{
773
+ border: (element.legendPosition || 'bottom') === pos ? '1.5px solid var(--accent-primary, #6366f1)' : '1px solid var(--border-color, #e2e8f0)',
774
+ color: (element.legendPosition || 'bottom') === pos ? 'var(--accent-primary, #6366f1)' : 'inherit',
775
+ background: (element.legendPosition || 'bottom') === pos ? '#f5f3ff' : '#ffffff'
776
+ }"
777
+ style="height: 32px; border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-sizing: border-box; transition: all 0.15s ease;"
778
+ @click="element.legendPosition = pos">
779
+ <svg class="icon" style="width: 20px; height: 20px;">
780
+ <use :xlink:href="`#${legendIcons[pos]}`"></use>
781
+ </svg>
782
+ </div>
783
+ </div>
784
+ </div>
785
+ </div>
786
+
787
+ <!-- Accordions: Fill, Border, Shadow, Reflection -->
788
+ <!-- Fill Accordion (aligned with SidebarShapeFormatPanel & SidebarBorderAccordion) -->
789
+ <div class="control-group shape-accordion-group"
790
+ style="border-top: 1px solid #f1f5f9; margin-top: 12px; padding-top: 12px;">
791
+ <div class="shape-accordion-header" @click="toggleFillHeader">
792
+ <span class="control-label shape-accordion-header-label">
793
+ <span>填充</span>
794
+ <span class="accordion-arrow">
795
+ <svg class="icon" style="width: 14px; height: 14px;">
796
+ <use :href="(isFillEnabled && isFillExpanded) ? '#icon-ppt-xiala-zhankai' : '#icon-ppt-xiala-shouqi'"
797
+ :xlink:href="(isFillEnabled && isFillExpanded) ? '#icon-ppt-xiala-zhankai' : '#icon-ppt-xiala-shouqi'"></use>
798
+ </svg>
799
+ </span>
800
+ </span>
801
+ <el-switch :model-value="isFillEnabled" size="small" @click.stop @change="toggleFillSwitch" />
802
+ </div>
803
+
804
+ <div v-show="isFillExpanded && isFillEnabled" class="shape-accordion-content">
805
+ <!-- 6 Fill Type Buttons Bar -->
806
+ <div class="fill-types-bar">
807
+ <button type="button" class="fill-type-icon-btn" :class="{ active: activeFillMode === 'solid' }"
808
+ @click="selectFillMode('solid')" title="纯色填充">
809
+ <svg viewBox="0 0 18 18" width="18" height="18">
810
+ <rect x="0.5" y="0.5" width="17" height="17" rx="2"
811
+ :fill="activeFillMode === 'solid' ? (props.fillHex && props.fillHex !== 'transparent' ? props.fillHex : '#3b82f6') : '#cbd5e1'"
812
+ :stroke="activeFillMode === 'solid' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" />
813
+ </svg>
814
+ </button>
815
+ <button type="button" class="fill-type-icon-btn" :class="{ active: activeFillMode === 'gradient-linear' }"
816
+ @click="selectFillMode('gradient-linear')" title="线性渐变">
817
+ <svg viewBox="0 0 18 18" width="18" height="18">
818
+ <defs>
819
+ <linearGradient id="chartFillBarLinear" x1="0" y1="0" x2="0" y2="1">
820
+ <stop offset="0%" :stop-color="activeFillMode === 'gradient-linear' ? activeGradientStart : '#94a3b8'" />
821
+ <stop offset="100%" :stop-color="activeFillMode === 'gradient-linear' ? activeGradientEnd : '#ffffff'" />
822
+ </linearGradient>
823
+ </defs>
824
+ <rect x="0.5" y="0.5" width="17" height="17" rx="2" fill="url(#chartFillBarLinear)" :stroke="activeFillMode === 'gradient-linear' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" />
825
+ </svg>
826
+ </button>
827
+ <button type="button" class="fill-type-icon-btn" :class="{ active: activeFillMode === 'gradient-radial' }"
828
+ @click="selectFillMode('gradient-radial')" title="径向渐变">
829
+ <svg viewBox="0 0 18 18" width="18" height="18">
830
+ <defs>
831
+ <radialGradient id="chartFillBarRadial" cx="50%" cy="50%" r="50%">
832
+ <stop offset="15%" :stop-color="activeFillMode === 'gradient-radial' ? activeGradientEnd : '#ffffff'" />
833
+ <stop offset="100%" :stop-color="activeFillMode === 'gradient-radial' ? activeGradientStart : '#cbd5e1'" />
834
+ </radialGradient>
835
+ </defs>
836
+ <rect x="0.5" y="0.5" width="17" height="17" rx="2" fill="url(#chartFillBarRadial)" :stroke="activeFillMode === 'gradient-radial' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" />
837
+ </svg>
838
+ </button>
839
+ <button type="button" class="fill-type-icon-btn" :class="{ active: activeFillMode === 'gradient-rect' }"
840
+ @click="selectFillMode('gradient-rect')" title="菱形渐变">
841
+ <svg viewBox="0 0 18 18" width="18" height="18">
842
+ <defs>
843
+ <radialGradient id="chartFillBarRect" cx="50%" cy="50%" r="50%">
844
+ <stop offset="0%" :stop-color="activeFillMode === 'gradient-rect' ? activeGradientEnd : '#ffffff'" />
845
+ <stop offset="60%" :stop-color="activeFillMode === 'gradient-rect' ? activeGradientMid : '#e2e8f0'" />
846
+ <stop offset="100%" :stop-color="activeFillMode === 'gradient-rect' ? activeGradientStart : '#94a3b8'" />
847
+ </radialGradient>
848
+ </defs>
849
+ <rect x="0.5" y="0.5" width="17" height="17" rx="2" fill="url(#chartFillBarRect)" :stroke="activeFillMode === 'gradient-rect' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" />
850
+ </svg>
851
+ </button>
852
+ <button type="button" class="fill-type-icon-btn" :class="{ active: activeFillMode === 'image' }"
853
+ @click="selectFillMode('image')" title="图片填充">
854
+ <svg viewBox="0 0 18 18" width="18" height="18" fill="none">
855
+ <rect x="0.5" y="0.5" width="17" height="17" rx="2" :stroke="activeFillMode === 'image' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" fill="#ffffff" />
856
+ <circle cx="6" cy="6" r="1.5" :fill="activeFillMode === 'image' ? '#1E6FFF' : '#94a3b8'" />
857
+ <path d="M2.5 14L7 9.5L10.5 13L12.5 11L15.5 14" :stroke="activeFillMode === 'image' ? '#1E6FFF' : '#94a3b8'" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round" />
858
+ </svg>
859
+ </button>
860
+ <button type="button" class="fill-type-icon-btn" :class="{ active: activeFillMode === 'pattern' }"
861
+ @click="selectFillMode('pattern')" title="图案填充">
862
+ <svg viewBox="0 0 18 18" width="18" height="18">
863
+ <defs>
864
+ <pattern id="chartFillBarPattern" width="4" height="4" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
865
+ <line x1="0" y1="0" x2="0" y2="4" :stroke="activeFillMode === 'pattern' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" />
866
+ </pattern>
867
+ </defs>
868
+ <rect x="0.5" y="0.5" width="17" height="17" rx="2" fill="url(#chartFillBarPattern)" :stroke="activeFillMode === 'pattern' ? '#1E6FFF' : '#94a3b8'" stroke-width="1" />
869
+ </svg>
870
+ </button>
871
+ </div>
872
+
873
+ <!-- Solid Fill (Full-width Color Pill) -->
874
+ <template v-if="(shapeFillType || 'solid') === 'solid'">
875
+ <div class="full-color-pill">
876
+ <QuickColorPopover v-model:visible="fillPopoverVisible" :color="fillHex || '#FFFFFF'" :alpha="props.fillOpacity"
877
+ v-model:recentColors="localRecentColors" @select-color="onSelectFillColor">
878
+ <template #reference>
879
+ <div class="color-left-info">
880
+ <div :style="{ background: fillHex || '#FFFFFF' }" class="color-square-preview"></div>
881
+ <span class="color-hex-text">
882
+ {{ formatHexDisplay(fillHex || '#FFFFFF') }}
883
+ </span>
884
+ </div>
885
+ </template>
886
+ </QuickColorPopover>
887
+ <div class="color-opacity-input-wrapper" @click.stop title="不透明度 (0%为完全透明,100%为完全不透明)">
888
+ <input
889
+ type="number"
890
+ class="color-opacity-num-input"
891
+ :value="displayFillOpacity"
892
+ min="0"
893
+ max="100"
894
+ @input="handleFillOpacityInput"
895
+ @keydown.enter="($event.target as HTMLElement).blur()"
896
+ />
897
+ <span class="percent-unit">%</span>
898
+ </div>
899
+ </div>
900
+ </template>
901
+
902
+ <!-- Gradient Fill -->
903
+ <template v-else-if="shapeFillType === 'gradient'">
904
+ <div style="padding: 0;">
905
+ <GradientEditor
906
+ ref="gradientEditorRef"
907
+ :hide-type-buttons="true"
908
+ :model-value="currentShapeGradient"
909
+ :recent-colors="localRecentColors"
910
+ @update:config="onShapeGradientRealtime"
911
+ @change:config="onShapeGradientCommit"
912
+ />
913
+ </div>
914
+ </template>
915
+
916
+ <!-- Image Fill -->
917
+ <template v-else-if="shapeFillType === 'image'">
918
+ <div class="image-fill-section">
919
+ <input
920
+ ref="imageFileInputRef"
921
+ type="file"
922
+ accept="image/*"
923
+ style="display: none;"
924
+ @change="handleImageFileChange"
925
+ />
926
+ <div v-if="currentPatternImage" class="image-fill-preview-card">
927
+ <div class="image-fill-thumb" :style="{ backgroundImage: `url(${currentPatternImage})` }"></div>
928
+ <div class="image-fill-btn-group">
929
+ <button type="button" class="image-fill-sub-btn" @click="triggerImageUpload">更换图片</button>
930
+ <button type="button" class="image-fill-sub-btn danger" @click="emit('clearShapePatternFill')">清除</button>
931
+ </div>
932
+ </div>
933
+ <div v-else class="image-fill-upload-card" @click="triggerImageUpload">
934
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.6">
935
+ <rect x="3" y="3" width="18" height="18" rx="3" stroke="currentColor" />
936
+ <circle cx="8.5" cy="8.5" r="1.5" fill="currentColor" />
937
+ <path d="M21 15l-5-5L5 21" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" />
938
+ </svg>
939
+ <span class="upload-tip-text">点击上传图片</span>
940
+ </div>
941
+ </div>
942
+ </template>
943
+
944
+ <!-- Pattern Fill -->
945
+ <template v-else-if="shapeFillType === 'pattern'">
946
+ <div class="pattern-fill-container">
947
+ <div class="pattern-presets-grid">
948
+ <div
949
+ v-for="p in PATTERN_PRESETS"
950
+ :key="p.key"
951
+ class="pattern-preset-card"
952
+ :class="{ active: isPatternPresetActive(p) }"
953
+ :title="p.name"
954
+ :style="{ backgroundImage: `url('${getPatternPresetPreviewUrl(p)}')` }"
955
+ @click="selectPatternPreset(p)"
956
+ ></div>
957
+ </div>
958
+
959
+ <div class="pattern-colors-section">
960
+ <div class="shape-property-row">
961
+ <span class="shape-property-label" style="width: 44px;">前景</span>
962
+ <div class="full-color-pill" style="flex: 1;">
963
+ <QuickColorPopover
964
+ v-model:visible="patternFgPopoverVisible"
965
+ :color="parsedPatternFg.hex === 'transparent' ? '#3B82F6' : parsedPatternFg.hex"
966
+ :alpha="parsedPatternFg.alpha"
967
+ :recent-colors="localRecentColors"
968
+ @select-color="onSelectPatternFgColor"
969
+ >
970
+ <template #reference>
971
+ <div class="color-left-info">
972
+ <div :style="{ background: parsedPatternFg.hex === 'transparent' ? 'transparent' : parsedPatternFg.hex }" class="color-square-preview"></div>
973
+ <span class="color-hex-text">{{ formatHexDisplay(parsedPatternFg.hex) }}</span>
974
+ </div>
975
+ </template>
976
+ </QuickColorPopover>
977
+ <div class="color-opacity-input-wrapper" @click.stop title="前景不透明度">
978
+ <input
979
+ type="number"
980
+ class="color-opacity-num-input"
981
+ :value="parsedPatternFg.alpha"
982
+ min="0"
983
+ max="100"
984
+ @input="handlePatternFgOpacityInput"
985
+ @keydown.enter="($event.target as HTMLElement).blur()"
986
+ />
987
+ <span class="percent-unit">%</span>
988
+ </div>
989
+ </div>
990
+ </div>
991
+
992
+ <div class="shape-property-row">
993
+ <span class="shape-property-label" style="width: 44px;">背景</span>
994
+ <div class="full-color-pill" style="flex: 1;">
995
+ <QuickColorPopover
996
+ v-model:visible="patternBgPopoverVisible"
997
+ :color="parsedPatternBg.hex === 'transparent' ? '#FFFFFF' : parsedPatternBg.hex"
998
+ :alpha="parsedPatternBg.alpha"
999
+ :recent-colors="localRecentColors"
1000
+ @select-color="onSelectPatternBgColor"
1001
+ >
1002
+ <template #reference>
1003
+ <div class="color-left-info">
1004
+ <div :style="{ background: parsedPatternBg.hex === 'transparent' ? 'transparent' : parsedPatternBg.hex }" class="color-square-preview"></div>
1005
+ <span class="color-hex-text">{{ formatHexDisplay(parsedPatternBg.hex) }}</span>
1006
+ </div>
1007
+ </template>
1008
+ </QuickColorPopover>
1009
+ <div class="color-opacity-input-wrapper" @click.stop title="背景不透明度">
1010
+ <input
1011
+ type="number"
1012
+ class="color-opacity-num-input"
1013
+ :value="parsedPatternBg.alpha"
1014
+ min="0"
1015
+ max="100"
1016
+ @input="handlePatternBgOpacityInput"
1017
+ @keydown.enter="($event.target as HTMLElement).blur()"
1018
+ />
1019
+ <span class="percent-unit">%</span>
1020
+ </div>
1021
+ </div>
1022
+ </div>
1023
+ </div>
1024
+ </div>
1025
+ </template>
1026
+ </div>
1027
+ </div>
1028
+
1029
+ <!-- Border Accordion -->
1030
+ <SidebarBorderAccordion
1031
+ :is-border-enabled="isBorderEnabled"
1032
+ :is-border-expanded="isBorderExpanded"
1033
+ :border-hex="borderHex"
1034
+ :border-style="borderStyle"
1035
+ :border-width="borderWidth"
1036
+ :border-alpha="borderAlpha"
1037
+ :recent-colors="localRecentColors"
1038
+ @update:is-border-enabled="emit('update:isBorderEnabled', $event)"
1039
+ @update:is-border-expanded="emit('update:isBorderExpanded', $event)"
1040
+ @update:border-hex="emit('update:borderHex', $event)"
1041
+ @update:border-style="emit('update:borderStyle', $event)"
1042
+ @update:border-width="emit('update:borderWidth', $event)"
1043
+ @update:border-alpha="emit('update:borderAlpha', $event)"
1044
+ />
1045
+
1046
+ <!-- Shadow Accordion -->
1047
+ <SidebarShadowAccordion
1048
+ :is-shadow-enabled="isShadowEnabled"
1049
+ :is-shadow-expanded="isShadowExpanded"
1050
+ :shadow-hex="shadowHex"
1051
+ :shadow-angle="shadowAngle"
1052
+ :shadow-size="shadowSize"
1053
+ :shadow-blur="shadowBlur"
1054
+ :shadow-distance="shadowDistance"
1055
+ :shadow-alpha="shadowAlpha"
1056
+ :recent-colors="localRecentColors"
1057
+ @update:is-shadow-enabled="emit('update:isShadowEnabled', $event)"
1058
+ @update:is-shadow-expanded="emit('update:isShadowExpanded', $event)"
1059
+ @update:shadow-hex="emit('update:shadowHex', $event)"
1060
+ @update:shadow-angle="emit('update:shadowAngle', $event)"
1061
+ @update:shadow-size="emit('update:shadowSize', $event)"
1062
+ @update:shadow-blur="emit('update:shadowBlur', $event)"
1063
+ @update:shadow-distance="emit('update:shadowDistance', $event)"
1064
+ @update:shadow-alpha="emit('update:shadowAlpha', $event)"
1065
+ />
1066
+
1067
+ <!-- Reflection Accordion -->
1068
+ <SidebarReflectionAccordion
1069
+ :enable-reflection="enableReflection"
1070
+ :is-reflection-expanded="isReflectionExpanded"
1071
+ :reflection-distance="reflectionDistance"
1072
+ :reflection-size="reflectionSize"
1073
+ :reflection-opacity="reflectionOpacity"
1074
+ :reflection-blur="reflectionBlur"
1075
+ style="margin-bottom: 24px;"
1076
+ @update:enable-reflection="emit('update:enableReflection', $event)"
1077
+ @update:is-reflection-expanded="emit('update:isReflectionExpanded', $event)"
1078
+ @update:reflection-distance="emit('update:reflectionDistance', $event)"
1079
+ @update:reflection-size="emit('update:reflectionSize', $event)"
1080
+ @update:reflection-opacity="emit('update:reflectionOpacity', $event)"
1081
+ @update:reflection-blur="emit('update:reflectionBlur', $event)"
1082
+ />
1083
+ </div>
1084
+ </template>
1085
+
1086
+ <style scoped lang="scss">
1087
+ .edit-chart-data-btn {
1088
+ width: 100%;
1089
+ height: 34px;
1090
+ margin-top: 4px;
1091
+ background-color: #1E6FFF !important;
1092
+ border-color: #1E6FFF !important;
1093
+ color: #ffffff !important;
1094
+ border-radius: 8px !important;
1095
+ font-size: 13px !important;
1096
+ font-weight: 500 !important;
1097
+ transition: background-color 0.15s ease, border-color 0.15s ease;
1098
+
1099
+ &:hover,
1100
+ &:focus {
1101
+ background-color: #195ee6 !important;
1102
+ border-color: #195ee6 !important;
1103
+ color: #ffffff !important;
1104
+ }
1105
+ }
1106
+
1107
+ .shape-accordion-group {
1108
+ border-bottom: 1px solid #f1f5f9;
1109
+ padding-bottom: 12px;
1110
+ margin-bottom: 12px;
1111
+ }
1112
+
1113
+ .shape-accordion-header {
1114
+ display: flex;
1115
+ align-items: center;
1116
+ justify-content: space-between;
1117
+ padding: 0 16px;
1118
+ height: 34px;
1119
+ cursor: pointer;
1120
+ user-select: none;
1121
+ }
1122
+
1123
+ .shape-accordion-header-label {
1124
+ font-size: 14px;
1125
+ font-weight: 400;
1126
+ color: #1e293b;
1127
+ display: flex;
1128
+ align-items: center;
1129
+ gap: 6px;
1130
+ flex-shrink: 0;
1131
+ }
1132
+
1133
+ .accordion-arrow {
1134
+ display: flex;
1135
+ align-items: center;
1136
+ justify-content: center;
1137
+ color: #64748b;
1138
+ }
1139
+
1140
+ :deep(.el-switch) {
1141
+ --el-switch-on-color: #2563eb;
1142
+ --el-switch-off-color: #cbd5e1;
1143
+ }
1144
+
1145
+ .shape-accordion-content {
1146
+ padding: 8px 16px 0 16px;
1147
+ display: flex;
1148
+ flex-direction: column;
1149
+ gap: 8px;
1150
+ }
1151
+
1152
+ .fill-types-bar {
1153
+ display: flex;
1154
+ align-items: center;
1155
+ justify-content: space-between;
1156
+ margin-bottom: 4px;
1157
+ width: 100%;
1158
+ height: 40px;
1159
+ background: #f8f9fa;
1160
+ border: 1px solid #edf0f3;
1161
+ border-radius: 10px;
1162
+ padding: 3px 4px;
1163
+ box-sizing: border-box;
1164
+ }
1165
+
1166
+ .fill-type-icon-btn {
1167
+ width: 32px;
1168
+ height: 32px;
1169
+ flex: 0 0 32px;
1170
+ border-radius: 9px;
1171
+ background: transparent;
1172
+ border: 1px solid transparent;
1173
+ display: flex;
1174
+ align-items: center;
1175
+ justify-content: center;
1176
+ cursor: pointer;
1177
+ padding: 0;
1178
+ transition: all 0.15s ease;
1179
+ box-sizing: border-box;
1180
+
1181
+ &:hover:not(.active) {
1182
+ background: rgba(0, 0, 0, 0.04);
1183
+ }
1184
+
1185
+ &.active {
1186
+ width: 32px;
1187
+ height: 32px;
1188
+ background: #FFFFFF;
1189
+ border-radius: 9px;
1190
+ border: 1px solid #E5E7EB;
1191
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
1192
+ }
1193
+ }
1194
+
1195
+ .full-color-pill {
1196
+ width: 100%;
1197
+ height: 32px;
1198
+ background: #FAFAFA;
1199
+ border: 1px solid #edf0f3;
1200
+ border-radius: 8px;
1201
+ padding: 0 10px;
1202
+ box-sizing: border-box;
1203
+ display: flex;
1204
+ align-items: center;
1205
+ justify-content: space-between;
1206
+ cursor: pointer;
1207
+ transition: all 0.15s ease;
1208
+
1209
+ &:hover {
1210
+ border-color: #cbd5e1;
1211
+ }
1212
+
1213
+ &:focus-within {
1214
+ border-color: #2563eb;
1215
+ box-shadow: 0 0 0 1px #2563eb;
1216
+ }
1217
+ }
1218
+
1219
+ .color-left-info {
1220
+ display: flex;
1221
+ align-items: center;
1222
+ gap: 8px;
1223
+ cursor: pointer;
1224
+ height: 100%;
1225
+ }
1226
+
1227
+ .color-hex-text {
1228
+ font-size: 13px;
1229
+ font-weight: 500;
1230
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
1231
+ color: #1e293b;
1232
+ letter-spacing: 0.2px;
1233
+ user-select: none;
1234
+ }
1235
+
1236
+ .color-opacity-input-wrapper {
1237
+ display: inline-flex;
1238
+ align-items: center;
1239
+ justify-content: flex-end;
1240
+ height: 24px;
1241
+ padding: 0 2px;
1242
+ border-radius: 4px;
1243
+ transition: all 0.15s ease;
1244
+ background: transparent;
1245
+ cursor: text;
1246
+
1247
+ &:hover {
1248
+ background: rgba(0, 0, 0, 0.04);
1249
+ }
1250
+
1251
+ &:focus-within {
1252
+ background: rgba(37, 99, 235, 0.08);
1253
+ }
1254
+ }
1255
+
1256
+ .color-opacity-num-input {
1257
+ width: 28px;
1258
+ border: none;
1259
+ background: transparent;
1260
+ outline: none;
1261
+ font-size: 13px;
1262
+ font-weight: 500;
1263
+ color: #1e293b;
1264
+ text-align: right;
1265
+ padding: 0;
1266
+ margin: 0;
1267
+ font-family: inherit;
1268
+ font-variant-numeric: tabular-nums;
1269
+
1270
+ &::-webkit-outer-spin-button,
1271
+ &::-webkit-inner-spin-button {
1272
+ -webkit-appearance: none;
1273
+ display: none !important;
1274
+ margin: 0;
1275
+ }
1276
+ }
1277
+
1278
+ .percent-unit {
1279
+ font-size: 12px;
1280
+ font-weight: 500;
1281
+ color: #1e293b;
1282
+ margin-left: 2px;
1283
+ user-select: none;
1284
+ line-height: 1;
1285
+ }
1286
+
1287
+ .image-fill-section {
1288
+ display: flex;
1289
+ flex-direction: column;
1290
+ gap: 8px;
1291
+ }
1292
+
1293
+ .image-fill-upload-card {
1294
+ width: 100%;
1295
+ height: 76px;
1296
+ border: 1px dashed #cbd5e1;
1297
+ border-radius: 8px;
1298
+ background: #f8fafc;
1299
+ display: flex;
1300
+ flex-direction: column;
1301
+ align-items: center;
1302
+ justify-content: center;
1303
+ gap: 6px;
1304
+ color: #64748b;
1305
+ cursor: pointer;
1306
+ transition: all 0.15s ease;
1307
+
1308
+ &:hover {
1309
+ border-color: #1E6FFF;
1310
+ color: #1E6FFF;
1311
+ background: #eff6ff;
1312
+ }
1313
+ }
1314
+
1315
+ .upload-tip-text {
1316
+ font-size: 12px;
1317
+ font-weight: 500;
1318
+ }
1319
+
1320
+ .image-fill-preview-card {
1321
+ display: flex;
1322
+ align-items: center;
1323
+ gap: 10px;
1324
+ padding: 8px;
1325
+ background: #f8fafc;
1326
+ border: 1px solid #edf0f3;
1327
+ border-radius: 8px;
1328
+ }
1329
+
1330
+ .image-fill-thumb {
1331
+ width: 48px;
1332
+ height: 36px;
1333
+ border-radius: 4px;
1334
+ background-size: cover;
1335
+ background-position: center;
1336
+ border: 1px solid #e2e8f0;
1337
+ flex-shrink: 0;
1338
+ }
1339
+
1340
+ .image-fill-btn-group {
1341
+ display: flex;
1342
+ gap: 6px;
1343
+ flex: 1;
1344
+ }
1345
+
1346
+ .image-fill-sub-btn {
1347
+ flex: 1;
1348
+ height: 28px;
1349
+ border-radius: 6px;
1350
+ border: 1px solid #e2e8f0;
1351
+ background: #ffffff;
1352
+ color: #334155;
1353
+ font-size: 12px;
1354
+ cursor: pointer;
1355
+ transition: all 0.15s ease;
1356
+
1357
+ &:hover {
1358
+ border-color: #cbd5e1;
1359
+ background: #f1f5f9;
1360
+ }
1361
+
1362
+ &.danger {
1363
+ color: #ef4444;
1364
+ &:hover {
1365
+ background: #fef2f2;
1366
+ border-color: #fecaca;
1367
+ }
1368
+ }
1369
+ }
1370
+
1371
+ .pattern-fill-container {
1372
+ display: flex;
1373
+ flex-direction: column;
1374
+ gap: 10px;
1375
+ }
1376
+
1377
+ .pattern-presets-grid {
1378
+ display: grid;
1379
+ grid-template-columns: repeat(6, 1fr);
1380
+ gap: 6px;
1381
+ }
1382
+
1383
+ .pattern-preset-card {
1384
+ aspect-ratio: 1;
1385
+ border-radius: 6px;
1386
+ border: 1px solid #e2e8f0;
1387
+ background-repeat: repeat;
1388
+ background-size: 10px 10px;
1389
+ cursor: pointer;
1390
+ transition: all 0.15s ease;
1391
+
1392
+ &:hover {
1393
+ border-color: #94a3b8;
1394
+ }
1395
+
1396
+ &.active {
1397
+ border: 1.5px solid #1E6FFF;
1398
+ box-shadow: 0 0 0 2px rgba(30, 111, 255, 0.15);
1399
+ }
1400
+ }
1401
+
1402
+ .pattern-colors-section {
1403
+ display: flex;
1404
+ flex-direction: column;
1405
+ gap: 8px;
1406
+ }
1407
+
1408
+ .shape-property-row {
1409
+ display: flex;
1410
+ align-items: center;
1411
+ justify-content: space-between;
1412
+ height: 32px;
1413
+ padding: 0;
1414
+ gap: 8px;
1415
+ }
1416
+
1417
+ .shape-property-label {
1418
+ font-size: 12px;
1419
+ color: var(--text-secondary, #64748b);
1420
+ width: 80px;
1421
+ flex-shrink: 0;
1422
+ text-align: left;
1423
+ }
1424
+
1425
+ .color-picker-pill-wrapper {
1426
+ position: relative;
1427
+ display: flex;
1428
+ align-items: center;
1429
+ justify-content: space-between;
1430
+ background: #F5F6F7;
1431
+ border-radius: 4px;
1432
+ padding: 0 10px;
1433
+ height: 32px;
1434
+ flex: 1;
1435
+ cursor: pointer;
1436
+ border: none;
1437
+ box-sizing: border-box;
1438
+ }
1439
+
1440
+ .color-pill-inner {
1441
+ display: flex;
1442
+ align-items: center;
1443
+ gap: 8px;
1444
+ }
1445
+
1446
+ .color-square-preview {
1447
+ width: 16px;
1448
+ height: 16px;
1449
+ border-radius: 4px;
1450
+ border: 1px solid rgba(0, 0, 0, 0.1);
1451
+ flex-shrink: 0;
1452
+ }
1453
+
1454
+ .chart-palette-option-item:hover {
1455
+ background: var(--bg-hover, #f1f5f9);
1456
+ }
1457
+
1458
+ .chart-palette-option-item.active {
1459
+ background: var(--bg-active, #eff6ff);
1460
+ }
1461
+
1462
+ .grid-btn {
1463
+ border: 1px solid var(--border-color, #e2e8f0);
1464
+ background: #ffffff;
1465
+ transition: all 0.2s;
1466
+
1467
+ &:hover {
1468
+ background: var(--bg-hover, #f8fafc);
1469
+ border-color: #cbd5e1;
1470
+ }
1471
+ }
1472
+
1473
+ :deep(.color-span-box) {
1474
+ width: 100%;
1475
+ display: flex !important;
1476
+ align-items: center !important;
1477
+ height: 100% !important;
1478
+ }
1479
+ </style>