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.
@@ -0,0 +1,1040 @@
1
+ <script setup lang="ts">
2
+ import { ref, computed } from 'vue'
3
+ import SvgChart from '../../SvgChart.vue'
4
+ import ChartTypeSelector from '../../ChartTypeSelector.vue'
5
+ import type { ChartDatasetItem } from '../../../composables/sidebar/useSidebarChart'
6
+
7
+ const props = defineProps<{
8
+ visible: boolean
9
+ element: any
10
+ labels: string[]
11
+ datasets: ChartDatasetItem[]
12
+ csvText: string
13
+ editMode: 'table' | 'csv'
14
+ previewChartType: string
15
+ chartColors: string[]
16
+ }>()
17
+
18
+ const emit = defineEmits<{
19
+ (e: 'update:visible', val: boolean): void
20
+ (e: 'update:labels', val: string[]): void
21
+ (e: 'update:datasets', val: ChartDatasetItem[]): void
22
+ (e: 'update:csvText', val: string): void
23
+ (e: 'update:editMode', val: 'table' | 'csv'): void
24
+ (e: 'update:previewChartType', val: string): void
25
+ (e: 'add-row'): void
26
+ (e: 'remove-row', index: number): void
27
+ (e: 'add-series'): void
28
+ (e: 'remove-series', index: number): void
29
+ (e: 'transpose'): void
30
+ (e: 'sync-from-table'): void
31
+ (e: 'sync-from-csv', text: string): void
32
+ (e: 'save'): void
33
+ }>()
34
+
35
+ const chartTypePopoverVisible = ref(false)
36
+
37
+ const chartTypeMap: Record<string, string> = {
38
+ 'pie': '基础饼图',
39
+ 'donut': '环图',
40
+ 'rose-pie': '玫瑰图',
41
+ 'rose-donut': '玫瑰环图',
42
+ 'bar': '基础柱状图',
43
+ 'percent-bar': '百分比柱状图',
44
+ 'stacked-bar': '堆叠柱状图',
45
+ 'line': '折线图',
46
+ 'compare-line': '对比折线图',
47
+ 'step-line': '其他折线图',
48
+ 'horizontal-bar': '基础条形图',
49
+ 'stacked-horizontal-bar': '堆叠条形图',
50
+ 'area': '基础面积图',
51
+ 'stacked-area': '堆叠面积图',
52
+ 'scatter': '散点图',
53
+ 'radar': '雷达图'
54
+ }
55
+
56
+ const normalizedPreviewType = computed(() => {
57
+ const t = props.previewChartType || props.element?.chartType || 'bar'
58
+ if (t === 'pieChart' || t === 'pie3DChart') return 'pie'
59
+ if (t === 'doughnutChart' || t === 'ring') return 'donut'
60
+ if (t === 'barChart' || t === 'bar3DChart') return 'bar'
61
+ if (t === 'lineChart' || t === 'line3DChart') return 'line'
62
+ if (t === 'areaChart' || t === 'area3DChart') return 'area'
63
+ return t
64
+ })
65
+
66
+ const isSingleSeriesChart = computed(() => {
67
+ return ['pie', 'donut', 'rose-pie', 'rose-donut'].includes(normalizedPreviewType.value)
68
+ })
69
+
70
+ function getChartTypeName(type: string | undefined): string {
71
+ if (!type) return '基础柱状图'
72
+ return chartTypeMap[type] || '基础柱状图'
73
+ }
74
+
75
+ function onSelectChartType(type: string) {
76
+ emit('update:previewChartType', type)
77
+ chartTypePopoverVisible.value = false
78
+ }
79
+
80
+ // 将指定系列提升为第 1 系列(针对饼图/环形图切换生效系列)
81
+ function setPrimarySeries(sIdx: number) {
82
+ if (sIdx <= 0 || sIdx >= props.datasets.length) return
83
+ const next = [...props.datasets]
84
+ const [picked] = next.splice(sIdx, 1)
85
+ next.unshift(picked)
86
+ emit('update:datasets', next)
87
+ emit('sync-from-table')
88
+ }
89
+
90
+ // 仅保留第 1 个系列,清理多余系列(针对饼图/环形图)
91
+ function keepOnlyPrimarySeries() {
92
+ if (props.datasets.length <= 1) return
93
+ emit('update:datasets', [props.datasets[0]])
94
+ emit('sync-from-table')
95
+ }
96
+
97
+ const previewElement = computed(() => {
98
+ const base = props.element ? { ...props.element } : { id: 'preview-chart', type: 'chart' }
99
+ return {
100
+ ...base,
101
+ chartType: normalizedPreviewType.value,
102
+ style: {
103
+ ...(base.style || {}),
104
+ chartColors: props.chartColors
105
+ },
106
+ data: {
107
+ labels: props.labels.map((l, idx) => l || `分类${idx + 1}`),
108
+ datasets: props.datasets.map((ds, idx) => ({
109
+ label: ds.label || `系列${idx + 1}`,
110
+ data: ds.data.map(v => (isNaN(Number(v)) ? 0 : Number(v)))
111
+ }))
112
+ }
113
+ }
114
+ })
115
+
116
+ const primarySeriesTotal = computed(() => {
117
+ const primaryData = props.datasets[0]?.data || []
118
+ return primaryData.reduce((acc, v) => {
119
+ const n = Number(v)
120
+ return acc + (isNaN(n) ? 0 : Math.max(0, n))
121
+ }, 0)
122
+ })
123
+
124
+ function getRowPercentage(rIdx: number): string {
125
+ const total = primarySeriesTotal.value
126
+ if (total <= 0) return '0%'
127
+ const val = Math.max(0, Number(props.datasets[0]?.data?.[rIdx]) || 0)
128
+ return `${Math.round((val / total) * 100)}%`
129
+ }
130
+
131
+ const summaryStats = computed(() => {
132
+ const primaryData = props.datasets[0]?.data || []
133
+ const nums = primaryData.map(v => {
134
+ const n = Number(v)
135
+ return isNaN(n) ? 0 : Math.max(0, n)
136
+ })
137
+ const total = nums.reduce((acc, v) => acc + v, 0)
138
+ const count = nums.length || 1
139
+ const avg = total / count
140
+ const maxVal = nums.length ? Math.max(...nums) : 0
141
+ const maxPct = total > 0 ? Math.round((maxVal / total) * 100) : 0
142
+
143
+ return {
144
+ total: Number.isInteger(total) ? total.toString() : total.toFixed(1),
145
+ avg: avg.toFixed(1),
146
+ maxPct: `${maxPct}%`
147
+ }
148
+ })
149
+
150
+ function handleLabelInput(idx: number, val: string) {
151
+ const next = [...props.labels]
152
+ next[idx] = val
153
+ emit('update:labels', next)
154
+ emit('sync-from-table')
155
+ }
156
+
157
+ function handleSeriesNameInput(sIdx: number, val: string) {
158
+ const next = props.datasets.map((ds, i) => (i === sIdx ? { ...ds, label: val } : ds))
159
+ emit('update:datasets', next)
160
+ emit('sync-from-table')
161
+ }
162
+
163
+ function handleCellInput(sIdx: number, rIdx: number, rawVal: string) {
164
+ const parsed = parseFloat(rawVal)
165
+ const numVal = isNaN(parsed) ? 0 : parsed
166
+ const next = props.datasets.map((ds, i) => {
167
+ if (i !== sIdx) return ds
168
+ const nextData = [...ds.data]
169
+ nextData[rIdx] = numVal
170
+ return { ...ds, data: nextData }
171
+ })
172
+ emit('update:datasets', next)
173
+ emit('sync-from-table')
174
+ }
175
+
176
+ function handleCsvInput(val: string) {
177
+ emit('update:csvText', val)
178
+ emit('sync-from-csv', val)
179
+ }
180
+
181
+ function toggleEditMode() {
182
+ const nextMode = props.editMode === 'table' ? 'csv' : 'table'
183
+ emit('update:editMode', nextMode)
184
+ }
185
+
186
+ function getPaletteColor(idx: number): string {
187
+ const palette = props.chartColors?.length
188
+ ? props.chartColors
189
+ : ['#4f46e5', '#06b6d4', '#f59e0b', '#10b981', '#ec4899', '#8b5cf6', '#ef4444', '#14b8a6']
190
+ return palette[idx % palette.length]
191
+ }
192
+ </script>
193
+
194
+ <template>
195
+ <el-dialog
196
+ :model-value="visible"
197
+ @update:model-value="emit('update:visible', $event)"
198
+ width="860px"
199
+ destroy-on-close
200
+ align-center
201
+ :show-close="false"
202
+ class="chart-data-editor-dialog"
203
+ >
204
+ <template #header>
205
+ <div class="cde-header">
206
+ <div class="cde-header-left">
207
+ <div class="cde-icon-badge">✨</div>
208
+ <div>
209
+ <div class="cde-title">编辑图表数据 · 实时预览</div>
210
+ <div class="cde-subtitle">所见即所得:修改左侧任意数值或系列名,右侧实时渲染最新图表效果</div>
211
+ </div>
212
+ </div>
213
+ <div class="cde-header-actions">
214
+ <button type="button" class="cde-outline-btn" @click="emit('add-row')">+ 新增分类</button>
215
+ <el-tooltip
216
+ :disabled="!isSingleSeriesChart"
217
+ content="饼图 / 环图 / 玫瑰图仅展示单系列占比数据,切换到柱状图或折线图后可添加多个系列"
218
+ placement="bottom"
219
+ >
220
+ <span>
221
+ <button
222
+ type="button"
223
+ class="cde-outline-btn"
224
+ :class="{ 'is-disabled': isSingleSeriesChart }"
225
+ :disabled="isSingleSeriesChart"
226
+ @click="!isSingleSeriesChart && emit('add-series')"
227
+ >
228
+ + 新增系列
229
+ </button>
230
+ </span>
231
+ </el-tooltip>
232
+ <button type="button" class="cde-close-btn" @click="emit('update:visible', false)" title="关闭">✕</button>
233
+ </div>
234
+ </div>
235
+ </template>
236
+
237
+ <!-- 双栏主体 -->
238
+ <div class="cde-body">
239
+ <!-- 左侧:数据表格 / CSV 粘贴 -->
240
+ <div class="cde-left-col">
241
+ <!-- 单系列图表(饼图/环形图/玫瑰图)存在多系列数据时的智能提示横幅 -->
242
+ <div v-if="isSingleSeriesChart && datasets.length > 1" class="cde-single-series-alert">
243
+ <div class="cde-alert-text">
244
+ <span>ℹ️ <strong>{{ getChartTypeName(normalizedPreviewType) }}</strong>仅渲染第 1 列({{ datasets[0]?.label || '系列1' }})的数据占比,其余系列已置灰忽略。</span>
245
+ </div>
246
+ <button type="button" class="cde-alert-btn" @click="keepOnlyPrimarySeries">
247
+ 仅保留单系列
248
+ </button>
249
+ </div>
250
+
251
+ <div v-if="editMode === 'table'" class="cde-table-wrap">
252
+ <table class="cde-table">
253
+ <thead>
254
+ <tr>
255
+ <th class="col-index">#</th>
256
+ <th class="col-label">分类标签</th>
257
+ <th
258
+ v-for="(ds, sIdx) in datasets"
259
+ :key="sIdx"
260
+ class="col-series"
261
+ :class="{ 'is-ignored-series': isSingleSeriesChart && sIdx > 0 }"
262
+ >
263
+ <div class="series-header-cell">
264
+ <span
265
+ class="series-dot"
266
+ :style="{ background: isSingleSeriesChart ? (sIdx === 0 ? getPaletteColor(0) : '#cbd5e1') : getPaletteColor(sIdx) }"
267
+ ></span>
268
+ <input
269
+ type="text"
270
+ :value="ds.label"
271
+ @input="handleSeriesNameInput(sIdx, ($event.target as HTMLInputElement).value)"
272
+ class="series-name-input"
273
+ placeholder="系列名称"
274
+ />
275
+ <span v-if="!isSingleSeriesChart || sIdx === 0" class="series-edit-icon">✎</span>
276
+ <button
277
+ v-if="isSingleSeriesChart && sIdx > 0"
278
+ type="button"
279
+ class="use-series-btn"
280
+ title="将该系列设为当前展示的数据列"
281
+ @click="setPrimarySeries(sIdx)"
282
+ >设为展示</button>
283
+ <button
284
+ v-if="datasets.length > 1"
285
+ type="button"
286
+ class="row-del-btn"
287
+ title="删除该系列"
288
+ @click="emit('remove-series', sIdx)"
289
+ >×</button>
290
+ </div>
291
+ </th>
292
+ <!-- 单系列饼图/环形图下展示实时占比列 -->
293
+ <th v-if="isSingleSeriesChart" class="col-pct">占比</th>
294
+ <th class="col-action"></th>
295
+ </tr>
296
+ </thead>
297
+ <tbody>
298
+ <tr v-for="(lbl, rIdx) in labels" :key="rIdx">
299
+ <td class="col-index">{{ rIdx + 1 }}</td>
300
+ <td class="col-label">
301
+ <div class="cell-input-box">
302
+ <span
303
+ v-if="isSingleSeriesChart"
304
+ class="label-color-sq"
305
+ :style="{ background: getPaletteColor(rIdx) }"
306
+ ></span>
307
+ <input
308
+ type="text"
309
+ :value="lbl"
310
+ @input="handleLabelInput(rIdx, ($event.target as HTMLInputElement).value)"
311
+ class="cell-raw-input"
312
+ placeholder="输入分类名"
313
+ />
314
+ </div>
315
+ </td>
316
+ <td
317
+ v-for="(ds, sIdx) in datasets"
318
+ :key="sIdx"
319
+ class="col-series"
320
+ :class="{ 'is-ignored-series': isSingleSeriesChart && sIdx > 0 }"
321
+ >
322
+ <div class="cell-input-box">
323
+ <input
324
+ type="number"
325
+ step="any"
326
+ :value="ds.data[rIdx] ?? 0"
327
+ @input="handleCellInput(sIdx, rIdx, ($event.target as HTMLInputElement).value)"
328
+ class="cell-raw-input is-number"
329
+ />
330
+ </div>
331
+ </td>
332
+ <td v-if="isSingleSeriesChart" class="col-pct">
333
+ <span class="pct-badge">{{ getRowPercentage(rIdx) }}</span>
334
+ </td>
335
+ <td class="col-action">
336
+ <button
337
+ type="button"
338
+ class="row-del-btn"
339
+ :disabled="labels.length <= 1"
340
+ title="删除该行"
341
+ @click="emit('remove-row', rIdx)"
342
+ >×</button>
343
+ </td>
344
+ </tr>
345
+ </tbody>
346
+ </table>
347
+ </div>
348
+
349
+ <!-- CSV 批量粘贴视图 -->
350
+ <div v-else class="cde-csv-wrap">
351
+ <div class="cde-csv-tip">
352
+ <span>格式:分类标签, 系列1数值, 系列2数值...(支持中英文逗号或 Tab 分隔)</span>
353
+ </div>
354
+ <textarea
355
+ :value="csvText"
356
+ @input="handleCsvInput(($event.target as HTMLTextAreaElement).value)"
357
+ class="cde-csv-textarea"
358
+ rows="9"
359
+ placeholder="分类A, 35&#10;分类B, 25&#10;分类C, 20"
360
+ ></textarea>
361
+ </div>
362
+
363
+ <!-- 底部快捷提示栏 -->
364
+ <div class="cde-hint-bar">
365
+ <div class="cde-hint-left">
366
+ <span>💡 支持切换</span>
367
+ <button type="button" class="cde-link-btn" @click="toggleEditMode">
368
+ 「{{ editMode === 'table' ? 'CSV 文本粘贴' : '可视化表格视图' }}」
369
+ </button>
370
+ <span>或一键转置行列</span>
371
+ </div>
372
+ <button
373
+ v-if="!isSingleSeriesChart"
374
+ type="button"
375
+ class="cde-transpose-btn"
376
+ @click="emit('transpose')"
377
+ >
378
+ ⇄ 行列转置
379
+ </button>
380
+ <span v-else class="cde-single-tag">单系列占比模式</span>
381
+ </div>
382
+ </div>
383
+
384
+ <!-- 右侧:实时图表预览 + 统计指标卡片 -->
385
+ <div class="cde-right-col">
386
+ <div class="cde-preview-top">
387
+ <div class="cde-preview-header">
388
+ <span class="cde-preview-title">实时图表预览</span>
389
+
390
+ <!-- 与外侧属性面板完全一致的 ChartTypeSelector 下拉选择器(支持精确选中任意细分图表) -->
391
+ <el-popover
392
+ placement="bottom-end"
393
+ :width="568"
394
+ trigger="click"
395
+ popper-class="chart-popover-popper"
396
+ v-model:visible="chartTypePopoverVisible"
397
+ :show-arrow="false"
398
+ >
399
+ <template #reference>
400
+ <div class="cde-type-selector-trigger" title="点击切换具体图表样式">
401
+ <span class="cde-trigger-label">{{ getChartTypeName(normalizedPreviewType) }}</span>
402
+ <span class="cde-trigger-arrow">▼</span>
403
+ </div>
404
+ </template>
405
+ <ChartTypeSelector :current-type="normalizedPreviewType" @select="onSelectChartType" />
406
+ </el-popover>
407
+ </div>
408
+
409
+ <div class="cde-chart-card">
410
+ <SvgChart :element="previewElement as any" />
411
+ </div>
412
+ </div>
413
+
414
+ <!-- 底部 3 个汇总统计卡片 -->
415
+ <div class="cde-stats-grid">
416
+ <div class="cde-stat-card">
417
+ <div class="cde-stat-label">{{ isSingleSeriesChart ? '数值总计' : '首系列总计' }}</div>
418
+ <div class="cde-stat-value">{{ summaryStats.total }}</div>
419
+ </div>
420
+ <div class="cde-stat-card">
421
+ <div class="cde-stat-label">平均值</div>
422
+ <div class="cde-stat-value">{{ summaryStats.avg }}</div>
423
+ </div>
424
+ <div class="cde-stat-card">
425
+ <div class="cde-stat-label">最高项占比</div>
426
+ <div class="cde-stat-value is-highlight">{{ summaryStats.maxPct }}</div>
427
+ </div>
428
+ </div>
429
+ </div>
430
+ </div>
431
+
432
+ <template #footer>
433
+ <div class="cde-footer">
434
+ <span class="cde-footer-status">已开启实时校验 · 自动过滤空行</span>
435
+ <div class="cde-footer-btns">
436
+ <button type="button" class="cde-btn-cancel" @click="emit('update:visible', false)">取消</button>
437
+ <button type="button" class="cde-btn-submit" @click="emit('save')">应用修改</button>
438
+ </div>
439
+ </div>
440
+ </template>
441
+ </el-dialog>
442
+ </template>
443
+
444
+ <style lang="scss">
445
+ .chart-data-editor-dialog.el-dialog {
446
+ padding: 0 !important;
447
+ border-radius: 16px !important;
448
+ overflow: hidden;
449
+ box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(148, 163, 184, 0.2) !important;
450
+
451
+ .el-dialog__header {
452
+ padding: 0 !important;
453
+ margin: 0 !important;
454
+ border-bottom: 1px solid #f1f5f9;
455
+ }
456
+
457
+ .el-dialog__body {
458
+ padding: 0 !important;
459
+ color: #0f172a;
460
+ }
461
+
462
+ .el-dialog__footer {
463
+ padding: 0 !important;
464
+ border-top: 1px solid #f1f5f9;
465
+ }
466
+ }
467
+ </style>
468
+
469
+ <style scoped lang="scss">
470
+ .cde-header {
471
+ padding: 16px 22px;
472
+ display: flex;
473
+ align-items: center;
474
+ justify-content: space-between;
475
+ background: #ffffff;
476
+ }
477
+
478
+ .cde-header-left {
479
+ display: flex;
480
+ align-items: center;
481
+ gap: 12px;
482
+ }
483
+
484
+ .cde-icon-badge {
485
+ width: 36px;
486
+ height: 36px;
487
+ border-radius: 10px;
488
+ background: #eef2ff;
489
+ color: #4f46e5;
490
+ display: flex;
491
+ align-items: center;
492
+ justify-content: center;
493
+ font-size: 16px;
494
+ flex-shrink: 0;
495
+ }
496
+
497
+ .cde-title {
498
+ font-size: 15px;
499
+ font-weight: 700;
500
+ color: #0f172a;
501
+ line-height: 1.3;
502
+ }
503
+
504
+ .cde-subtitle {
505
+ font-size: 11px;
506
+ color: #64748b;
507
+ margin-top: 2px;
508
+ }
509
+
510
+ .cde-header-actions {
511
+ display: flex;
512
+ align-items: center;
513
+ gap: 8px;
514
+ }
515
+
516
+ .cde-outline-btn {
517
+ padding: 6px 12px !important;
518
+ border-radius: 8px !important;
519
+ border: 1px solid #e2e8f0 !important;
520
+ background: #ffffff !important;
521
+ color: #334155 !important;
522
+ font-size: 12px !important;
523
+ font-weight: 600 !important;
524
+ cursor: pointer;
525
+ transition: all 0.15s ease;
526
+
527
+ &:hover:not(.is-disabled) {
528
+ border-color: #6366f1 !important;
529
+ color: #4f46e5 !important;
530
+ background: #f5f3ff !important;
531
+ }
532
+
533
+ &.is-disabled {
534
+ opacity: 0.45;
535
+ cursor: not-allowed !important;
536
+ background: #f8fafc !important;
537
+ color: #94a3b8 !important;
538
+ }
539
+ }
540
+
541
+ .cde-close-btn {
542
+ width: 28px;
543
+ height: 28px;
544
+ border-radius: 8px !important;
545
+ border: none !important;
546
+ background: transparent !important;
547
+ color: #94a3b8 !important;
548
+ font-size: 14px;
549
+ cursor: pointer;
550
+ display: flex;
551
+ align-items: center;
552
+ justify-content: center;
553
+ margin-left: 4px;
554
+
555
+ &:hover {
556
+ background: #f1f5f9 !important;
557
+ color: #334155 !important;
558
+ }
559
+ }
560
+
561
+ .cde-body {
562
+ display: grid;
563
+ grid-template-columns: 1.35fr 1fr;
564
+ min-height: 380px;
565
+ background: #ffffff;
566
+ }
567
+
568
+ .cde-left-col {
569
+ padding: 16px 20px;
570
+ border-right: 1px solid #f1f5f9;
571
+ display: flex;
572
+ flex-direction: column;
573
+ justify-content: space-between;
574
+ gap: 10px;
575
+ min-width: 0;
576
+ }
577
+
578
+ .cde-single-series-alert {
579
+ background: #fffbeb;
580
+ border: 1px solid #fde68a;
581
+ border-radius: 10px;
582
+ padding: 8px 12px;
583
+ display: flex;
584
+ align-items: center;
585
+ justify-content: space-between;
586
+ gap: 10px;
587
+ font-size: 11px;
588
+ color: #92400e;
589
+ }
590
+
591
+ .cde-alert-text {
592
+ line-height: 1.4;
593
+ }
594
+
595
+ .cde-alert-btn {
596
+ flex-shrink: 0;
597
+ padding: 4px 10px !important;
598
+ border-radius: 6px !important;
599
+ border: 1px solid #f59e0b !important;
600
+ background: #ffffff !important;
601
+ color: #b45309 !important;
602
+ font-size: 11px !important;
603
+ font-weight: 600 !important;
604
+ cursor: pointer;
605
+
606
+ &:hover {
607
+ background: #fef3c7 !important;
608
+ }
609
+ }
610
+
611
+ .cde-table-wrap {
612
+ border: 1px solid #e2e8f0;
613
+ border-radius: 12px;
614
+ overflow: auto;
615
+ max-height: 280px;
616
+ flex: 1;
617
+ }
618
+
619
+ .cde-table {
620
+ width: 100%;
621
+ border-collapse: collapse;
622
+ text-align: left;
623
+
624
+ th {
625
+ background: #f8fafc;
626
+ border-bottom: 1px solid #e2e8f0;
627
+ padding: 9px 10px;
628
+ font-size: 12px;
629
+ font-weight: 600;
630
+ color: #475569;
631
+ position: sticky;
632
+ top: 0;
633
+ z-index: 1;
634
+ }
635
+
636
+ td {
637
+ border-bottom: 1px solid #f1f5f9;
638
+ padding: 7px 10px;
639
+ font-size: 13px;
640
+ color: #1e293b;
641
+ }
642
+
643
+ tbody tr:last-child td {
644
+ border-bottom: none;
645
+ }
646
+
647
+ tbody tr:hover {
648
+ background: #f8fafc;
649
+ }
650
+
651
+ .col-index {
652
+ width: 34px;
653
+ text-align: center;
654
+ color: #94a3b8;
655
+ font-size: 12px;
656
+ font-variant-numeric: tabular-nums;
657
+ }
658
+
659
+ .col-label {
660
+ min-width: 130px;
661
+ }
662
+
663
+ .col-series {
664
+ min-width: 108px;
665
+ transition: opacity 0.15s ease;
666
+
667
+ &.is-ignored-series {
668
+ opacity: 0.45;
669
+ background: #f8fafc;
670
+ }
671
+ }
672
+
673
+ .col-pct {
674
+ width: 58px;
675
+ text-align: center;
676
+ }
677
+
678
+ .col-action {
679
+ width: 32px;
680
+ text-align: center;
681
+ }
682
+ }
683
+
684
+ .pct-badge {
685
+ display: inline-block;
686
+ padding: 2px 7px;
687
+ border-radius: 999px;
688
+ background: #eef2ff;
689
+ color: #4f46e5;
690
+ font-size: 11px;
691
+ font-weight: 700;
692
+ font-variant-numeric: tabular-nums;
693
+ }
694
+
695
+ .use-series-btn {
696
+ flex-shrink: 0;
697
+ padding: 1px 6px !important;
698
+ border-radius: 4px !important;
699
+ border: 1px solid #cbd5e1 !important;
700
+ background: #ffffff !important;
701
+ color: #475569 !important;
702
+ font-size: 10px !important;
703
+ font-weight: 600 !important;
704
+ cursor: pointer;
705
+
706
+ &:hover {
707
+ border-color: #4f46e5 !important;
708
+ color: #4f46e5 !important;
709
+ }
710
+ }
711
+
712
+ .series-header-cell {
713
+ display: flex;
714
+ align-items: center;
715
+ gap: 5px;
716
+ }
717
+
718
+ .series-dot {
719
+ width: 8px;
720
+ height: 8px;
721
+ border-radius: 50%;
722
+ flex-shrink: 0;
723
+ }
724
+
725
+ .series-name-input {
726
+ width: 100%;
727
+ min-width: 50px;
728
+ border: 1px solid transparent;
729
+ background: transparent;
730
+ font-size: 12px;
731
+ font-weight: 600;
732
+ color: #334155;
733
+ padding: 2px 4px;
734
+ border-radius: 4px;
735
+ outline: none;
736
+
737
+ &:hover {
738
+ background: #ffffff;
739
+ border-color: #cbd5e1;
740
+ }
741
+
742
+ &:focus {
743
+ background: #ffffff;
744
+ border-color: #4f46e5;
745
+ }
746
+ }
747
+
748
+ .series-edit-icon {
749
+ font-size: 11px;
750
+ color: #94a3b8;
751
+ pointer-events: none;
752
+ }
753
+
754
+ .cell-input-box {
755
+ background: #f8fafc;
756
+ border: 1px solid #e2e8f0;
757
+ border-radius: 7px;
758
+ padding: 5px 10px;
759
+ display: flex;
760
+ align-items: center;
761
+ gap: 7px;
762
+ transition: all 0.15s ease;
763
+
764
+ &:focus-within {
765
+ background: #ffffff;
766
+ border-color: #4f46e5;
767
+ box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
768
+ }
769
+ }
770
+
771
+ .label-color-sq {
772
+ width: 9px;
773
+ height: 9px;
774
+ border-radius: 2px;
775
+ flex-shrink: 0;
776
+ }
777
+
778
+ .cell-raw-input {
779
+ width: 100%;
780
+ border: none;
781
+ background: transparent;
782
+ font-size: 12px;
783
+ color: #0f172a;
784
+ outline: none;
785
+
786
+ &.is-number {
787
+ font-weight: 700;
788
+ font-variant-numeric: tabular-nums;
789
+ }
790
+ }
791
+
792
+ .row-del-btn {
793
+ border: none !important;
794
+ background: transparent !important;
795
+ color: #cbd5e1 !important;
796
+ font-size: 15px;
797
+ cursor: pointer;
798
+ padding: 2px 5px !important;
799
+ border-radius: 4px;
800
+ line-height: 1;
801
+
802
+ &:hover:not(:disabled) {
803
+ color: #ef4444 !important;
804
+ background: #fef2f2 !important;
805
+ }
806
+
807
+ &:disabled {
808
+ opacity: 0.35;
809
+ cursor: not-allowed;
810
+ }
811
+ }
812
+
813
+ .cde-csv-wrap {
814
+ display: flex;
815
+ flex-direction: column;
816
+ gap: 8px;
817
+ flex: 1;
818
+ }
819
+
820
+ .cde-csv-tip {
821
+ font-size: 11px;
822
+ color: #64748b;
823
+ }
824
+
825
+ .cde-csv-textarea {
826
+ width: 100%;
827
+ flex: 1;
828
+ border: 1px solid #e2e8f0;
829
+ border-radius: 10px;
830
+ padding: 10px 12px;
831
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
832
+ font-size: 12px;
833
+ color: #0f172a;
834
+ background: #f8fafc;
835
+ resize: none;
836
+ outline: none;
837
+
838
+ &:focus {
839
+ background: #ffffff;
840
+ border-color: #4f46e5;
841
+ box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
842
+ }
843
+ }
844
+
845
+ .cde-hint-bar {
846
+ background: #f8fafc;
847
+ border: 1px solid #f1f5f9;
848
+ border-radius: 8px;
849
+ padding: 8px 12px;
850
+ display: flex;
851
+ align-items: center;
852
+ justify-content: space-between;
853
+ font-size: 11px;
854
+ color: #64748b;
855
+ }
856
+
857
+ .cde-hint-left {
858
+ display: flex;
859
+ align-items: center;
860
+ gap: 2px;
861
+ }
862
+
863
+ .cde-link-btn {
864
+ border: none !important;
865
+ background: transparent !important;
866
+ color: #4f46e5 !important;
867
+ font-weight: 600 !important;
868
+ font-size: 11px !important;
869
+ cursor: pointer;
870
+ padding: 0 2px !important;
871
+
872
+ &:hover {
873
+ text-decoration: underline;
874
+ }
875
+ }
876
+
877
+ .cde-transpose-btn {
878
+ border: none !important;
879
+ background: transparent !important;
880
+ color: #4f46e5 !important;
881
+ font-weight: 600 !important;
882
+ font-size: 11px !important;
883
+ cursor: pointer;
884
+
885
+ &:hover {
886
+ text-decoration: underline;
887
+ }
888
+ }
889
+
890
+ .cde-single-tag {
891
+ font-size: 11px;
892
+ color: #94a3b8;
893
+ font-weight: 500;
894
+ }
895
+
896
+ .cde-right-col {
897
+ padding: 16px 20px;
898
+ background: #f8fafc;
899
+ display: flex;
900
+ flex-direction: column;
901
+ justify-content: space-between;
902
+ gap: 12px;
903
+ }
904
+
905
+ .cde-preview-header {
906
+ display: flex;
907
+ align-items: center;
908
+ justify-content: space-between;
909
+ margin-bottom: 10px;
910
+ }
911
+
912
+ .cde-preview-title {
913
+ font-size: 12px;
914
+ font-weight: 700;
915
+ color: #334155;
916
+ }
917
+
918
+ .cde-type-selector-trigger {
919
+ display: inline-flex;
920
+ align-items: center;
921
+ gap: 8px;
922
+ padding: 5px 12px;
923
+ background: #ffffff;
924
+ border: 1px solid #e2e8f0;
925
+ border-radius: 7px;
926
+ cursor: pointer;
927
+ transition: all 0.15s ease;
928
+
929
+ &:hover {
930
+ border-color: #6366f1;
931
+ background: #f5f3ff;
932
+ }
933
+
934
+ .cde-trigger-label {
935
+ font-size: 12px;
936
+ font-weight: 600;
937
+ color: #1e293b;
938
+ }
939
+
940
+ .cde-trigger-arrow {
941
+ font-size: 9px;
942
+ color: #64748b;
943
+ }
944
+ }
945
+
946
+ .cde-chart-card {
947
+ background: #ffffff;
948
+ border: 1px solid #e2e8f0;
949
+ border-radius: 12px;
950
+ padding: 12px;
951
+ height: 256px;
952
+ display: flex;
953
+ align-items: center;
954
+ justify-content: center;
955
+ overflow: hidden;
956
+ }
957
+
958
+ .cde-stats-grid {
959
+ display: grid;
960
+ grid-template-columns: repeat(3, 1fr);
961
+ gap: 8px;
962
+ }
963
+
964
+ .cde-stat-card {
965
+ background: #ffffff;
966
+ border: 1px solid #e2e8f0;
967
+ border-radius: 10px;
968
+ padding: 8px 6px;
969
+ text-align: center;
970
+ }
971
+
972
+ .cde-stat-label {
973
+ font-size: 10px;
974
+ color: #94a3b8;
975
+ }
976
+
977
+ .cde-stat-value {
978
+ font-size: 14px;
979
+ font-weight: 700;
980
+ color: #0f172a;
981
+ margin-top: 2px;
982
+ font-variant-numeric: tabular-nums;
983
+
984
+ &.is-highlight {
985
+ color: #4f46e5;
986
+ }
987
+ }
988
+
989
+ .cde-footer {
990
+ padding: 13px 22px;
991
+ background: #ffffff;
992
+ display: flex;
993
+ align-items: center;
994
+ justify-content: space-between;
995
+ }
996
+
997
+ .cde-footer-status {
998
+ font-size: 12px;
999
+ color: #94a3b8;
1000
+ }
1001
+
1002
+ .cde-footer-btns {
1003
+ display: flex;
1004
+ align-items: center;
1005
+ gap: 8px;
1006
+ }
1007
+
1008
+ .cde-btn-cancel {
1009
+ padding: 7px 16px !important;
1010
+ border-radius: 8px !important;
1011
+ border: 1px solid #e2e8f0 !important;
1012
+ background: #ffffff !important;
1013
+ color: #475569 !important;
1014
+ font-size: 12px !important;
1015
+ font-weight: 600 !important;
1016
+ cursor: pointer;
1017
+
1018
+ &:hover {
1019
+ background: #f8fafc !important;
1020
+ color: #0f172a !important;
1021
+ }
1022
+ }
1023
+
1024
+ .cde-btn-submit {
1025
+ padding: 7px 18px !important;
1026
+ border-radius: 8px !important;
1027
+ border: 1px solid #4f46e5 !important;
1028
+ background: #4f46e5 !important;
1029
+ color: #ffffff !important;
1030
+ font-size: 12px !important;
1031
+ font-weight: 600 !important;
1032
+ cursor: pointer;
1033
+ box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
1034
+
1035
+ &:hover {
1036
+ background: #4338ca !important;
1037
+ border-color: #4338ca !important;
1038
+ }
1039
+ }
1040
+ </style>