@arronqzy/vue-view 0.1.0 → 0.1.2

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.
Files changed (48) hide show
  1. package/package.json +9 -6
  2. package/src/panel/VueViewOnlinePreview.vue +15 -7
  3. package/src/panel/VueViewPanel.vue +81 -55
  4. package/src/panel/components/ConfigHintIcon.vue +4 -2
  5. package/src/panel/components/ElementsLayer.vue +15 -0
  6. package/src/panel/components/MaterialPreview.vue +19 -1
  7. package/src/panel/components/MaterialSidebar.vue +35 -31
  8. package/src/panel/components/MaterialSidebarTreeNode.vue +27 -26
  9. package/src/panel/components/MoveableLayer.vue +7 -4
  10. package/src/panel/components/PanelConfigSidebar.vue +57 -39
  11. package/src/panel/components/ViewElementScopePanel.vue +6 -4
  12. package/src/panel/components/WorkspaceConfigSidebar.vue +7 -1
  13. package/src/panel/components/WorkspaceProjectNav.vue +23 -16
  14. package/src/panel/components/WorkspaceStageSplit.vue +10 -7
  15. package/src/panel/components/config/ConfigColorField.vue +3 -1
  16. package/src/panel/components/config/PanelConfigAudioSection.vue +44 -43
  17. package/src/panel/components/config/PanelConfigChartSection.vue +79 -76
  18. package/src/panel/components/config/PanelConfigGeometrySection.vue +21 -19
  19. package/src/panel/components/config/PanelConfigGridChildSpan.vue +7 -5
  20. package/src/panel/components/config/PanelConfigGridSection.vue +10 -8
  21. package/src/panel/components/config/PanelConfigImageSection.vue +22 -21
  22. package/src/panel/components/config/PanelConfigMultiSelect.vue +42 -40
  23. package/src/panel/components/config/PanelConfigNodeInfo.vue +19 -16
  24. package/src/panel/components/config/PanelConfigReferenceSection.vue +11 -9
  25. package/src/panel/components/config/PanelConfigStyleSections.vue +27 -26
  26. package/src/panel/components/config/PanelConfigTextSection.vue +20 -17
  27. package/src/panel/components/config/PanelConfigVideoSection.vue +15 -14
  28. package/src/panel/components/config/shared.ts +0 -3
  29. package/src/panel/components/elementsLayerNodes.ts +37 -18
  30. package/src/panel/components/materialSidebarData.ts +73 -54
  31. package/src/panel/components/scope-config/ScopeTemplatePreviewHost.vue +7 -2
  32. package/src/panel/components/scope-config/ScopeTemplatePreviewPanel.vue +6 -3
  33. package/src/panel/components/scope-config/ScopeTemplateUsageHint.vue +7 -16
  34. package/src/panel/components/scope-config/ScopeTemplateWarningsPanel.vue +4 -2
  35. package/src/panel/components/table/ConditionEditor.vue +181 -0
  36. package/src/panel/components/table/JsonCodeEditor.vue +148 -0
  37. package/src/panel/components/table/PanelConfigTableSection.vue +2033 -0
  38. package/src/panel/components/table/TableNodeContent.vue +557 -0
  39. package/src/panel/constants/messages.ts +76 -34
  40. package/src/panel/hooks/usePanelElements.ts +54 -41
  41. package/src/panel/hooks/useWorkspaceProjects.ts +8 -5
  42. package/src/panel/types.ts +4 -0
  43. package/src/panel/utils/panelElementDefaults.ts +73 -39
  44. package/src/panel/utils/scope-field-labels.ts +53 -39
  45. package/src/panel/utils/scope-template-spread.ts +57 -24
  46. package/src/panel/utils/scope-template-warnings.ts +23 -22
  47. package/src/panel/utils/scope-template.ts +80 -0
  48. package/src/tailwind.css +18 -10
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useI18n } from "@arronqzy/i18n/vue";
2
3
  import { computed, ref, watch } from "vue";
3
4
  import { Checkbox, Collapse, Input, InputNumber, Select, Textarea } from "ant-design-vue";
4
5
  import type { PanelChartConfig, PanelElement } from "../../types";
@@ -14,6 +15,8 @@ import ConfigFieldGroup from "./ConfigFieldGroup.vue";
14
15
  import ConfigHintIcon from "../ConfigHintIcon.vue";
15
16
  import ConfigSection from "./ConfigSection.vue";
16
17
 
18
+ const { t, locale } = useI18n();
19
+
17
20
  type ChartType =
18
21
  | "bar"
19
22
  | "line"
@@ -112,21 +115,21 @@ function onOptionJsonChange(v: string) {
112
115
  updateChart({ option: parsed });
113
116
  optionJsonError.value = null;
114
117
  } catch {
115
- optionJsonError.value = "JSON 格式错误,修正后会自动应用";
118
+ optionJsonError.value = t("panel.config.jsonInvalid");
116
119
  }
117
120
  }
118
121
  </script>
119
122
 
120
123
  <template>
121
124
  <ConfigSection
122
- title="图表配置 / 基础"
125
+ :title="t('panel.config.sectionChartBasic')"
123
126
  :open="basicOpen"
124
127
  :force-open="forceOpen"
125
128
  @update:open="emit('update:basicOpen', $event)"
126
129
  >
127
- <ConfigFieldGroup title="基础显示">
130
+ <ConfigFieldGroup :title="t('panel.config.groupBasicDisplay')">
128
131
  <label class="block space-y-1.5">
129
- <div>标题</div>
132
+ <div>{{ t("panel.config.title") }}</div>
130
133
  <Input
131
134
  size="small"
132
135
  :value="element.chart?.title ?? ''"
@@ -135,7 +138,7 @@ function onOptionJsonChange(v: string) {
135
138
  />
136
139
  </label>
137
140
  <ConfigColorField
138
- label="主色"
141
+ :label="t('panel.config.primaryColor')"
139
142
  :value="element.chart?.color ?? '#3b82f6'"
140
143
  :disabled="!isEditable"
141
144
  @update:value="(v) => updateChart({ color: v || '#3b82f6' })"
@@ -146,23 +149,23 @@ function onOptionJsonChange(v: string) {
146
149
  :disabled="!isEditable"
147
150
  @update:checked="(v) => updateChart({ colorMode: v ? 'gradient' : 'solid' })"
148
151
  />
149
- <span>主色使用渐变</span>
152
+ <span>{{ t("panel.config.usePrimaryGradient") }}</span>
150
153
  </label>
151
154
  <div v-if="element.chart?.colorMode === 'gradient'" class="grid grid-cols-2 gap-2">
152
155
  <ConfigColorField
153
- label="渐变起始色"
156
+ :label="t('panel.scope.fieldChartGradientFrom')"
154
157
  :value="element.chart?.gradientFrom ?? element.chart?.color ?? '#3b82f6'"
155
158
  :disabled="!isEditable"
156
159
  @update:value="(v) => updateChart({ gradientFrom: v || '#3b82f6' })"
157
160
  />
158
161
  <ConfigColorField
159
- label="渐变结束色"
162
+ :label="t('panel.scope.fieldChartGradientTo')"
160
163
  :value="element.chart?.gradientTo ?? '#22d3ee'"
161
164
  :disabled="!isEditable"
162
165
  @update:value="(v) => updateChart({ gradientTo: v || '#22d3ee' })"
163
166
  />
164
167
  <label class="col-span-2 block space-y-1">
165
- <div>渐变方向</div>
168
+ <div>{{ t("panel.config.gradientDirection") }}</div>
166
169
  <Select
167
170
  size="small"
168
171
  class="w-full"
@@ -170,14 +173,14 @@ function onOptionJsonChange(v: string) {
170
173
  :disabled="!isEditable"
171
174
  @update:value="(v) => updateChart({ gradientDirection: v as PanelChartConfig['gradientDirection'] })"
172
175
  >
173
- <Select.Option value="to-right">左 → 右</Select.Option>
174
- <Select.Option value="to-bottom">上 → 下</Select.Option>
175
- <Select.Option value="to-bottom-right">左上 → 右下</Select.Option>
176
- <Select.Option value="to-top-right">左下 → 右上</Select.Option>
176
+ <Select.Option value="to-right">{{ t("panel.config.dirToRight") }}</Select.Option>
177
+ <Select.Option value="to-bottom">{{ t("panel.config.dirToBottom") }}</Select.Option>
178
+ <Select.Option value="to-bottom-right">{{ t("panel.config.dirToBottomRight") }}</Select.Option>
179
+ <Select.Option value="to-top-right">{{ t("panel.config.dirToTopRight") }}</Select.Option>
177
180
  </Select>
178
181
  </label>
179
182
  <div class="col-span-2 space-y-1">
180
- <div class="text-[11px] text-gray-500">渐变预览</div>
183
+ <div class="text-[11px] text-gray-500">{{ t("panel.config.gradientPreview") }}</div>
181
184
  <div
182
185
  class="h-6 rounded border border-gray-200/60"
183
186
  :style="{
@@ -191,7 +194,7 @@ function onOptionJsonChange(v: string) {
191
194
  </div>
192
195
  </div>
193
196
  <label class="block space-y-1.5">
194
- <div>显示模式</div>
197
+ <div>{{ t("panel.config.renderMode") }}</div>
195
198
  <Select
196
199
  size="small"
197
200
  class="w-full"
@@ -205,7 +208,7 @@ function onOptionJsonChange(v: string) {
205
208
  </label>
206
209
  </ConfigFieldGroup>
207
210
 
208
- <ConfigFieldGroup title="提示框 Tooltip">
211
+ <ConfigFieldGroup :title="t('panel.config.groupTooltip')">
209
212
  <div class="grid grid-cols-2 gap-2">
210
213
  <label class="flex items-center gap-2">
211
214
  <Checkbox
@@ -213,10 +216,10 @@ function onOptionJsonChange(v: string) {
213
216
  :disabled="!isEditable"
214
217
  @update:checked="(v) => updateChart({ tooltipShow: v === true })"
215
218
  />
216
- <span>显示 Tooltip</span>
219
+ <span>{{ t("panel.config.showTooltip") }}</span>
217
220
  </label>
218
221
  <label class="block space-y-1">
219
- <div>Tooltip 触发方式</div>
222
+ <div>{{ t("panel.config.tooltipTrigger") }}</div>
220
223
  <Select
221
224
  size="small"
222
225
  class="w-full"
@@ -231,13 +234,13 @@ function onOptionJsonChange(v: string) {
231
234
  </div>
232
235
  <div class="grid grid-cols-2 gap-2">
233
236
  <ConfigColorField
234
- label="Tooltip 背景色"
237
+ :label="t('panel.scope.fieldChartTooltipBackgroundColor')"
235
238
  :value="element.chart?.tooltipBackgroundColor ?? '#0f172a'"
236
239
  :disabled="!isEditable"
237
240
  @update:value="(v) => updateChart({ tooltipBackgroundColor: v || '#0f172a' })"
238
241
  />
239
242
  <ConfigColorField
240
- label="Tooltip 文字色"
243
+ :label="t('panel.scope.fieldChartTooltipTextColor')"
241
244
  :value="element.chart?.tooltipTextColor ?? '#f8fafc'"
242
245
  :disabled="!isEditable"
243
246
  @update:value="(v) => updateChart({ tooltipTextColor: v || '#f8fafc' })"
@@ -245,25 +248,25 @@ function onOptionJsonChange(v: string) {
245
248
  </div>
246
249
  <label class="block space-y-1">
247
250
  <div class="flex items-center gap-1">
248
- <span>Tooltip Formatter(可选)</span>
251
+ <span>{{ t("panel.config.tooltipFormatter") }}</span>
249
252
  <ConfigHintIcon label="Tooltip Formatter" content-class="max-w-[360px]">
250
- <div class="font-medium">可用占位符</div>
251
- <div>{"{a}=系列名, {b}=类目名, {c}=数值, {d}=百分比(饼图)"}</div>
253
+ <div class="font-medium">{{ t("panel.config.formatterPlaceholdersTitle") }}</div>
254
+ <div>{{ t("panel.config.formatterPlaceholders") }}</div>
252
255
  </ConfigHintIcon>
253
256
  </div>
254
257
  <Input
255
258
  size="small"
256
259
  :value="element.chart?.tooltipFormatter ?? ''"
257
260
  :disabled="!isEditable"
258
- placeholder="例如:{b}: {c}"
261
+ :placeholder="t('panel.config.tooltipFormatterPlaceholder')"
259
262
  @update:value="(v: string) => updateChart({ tooltipFormatter: v || undefined })"
260
263
  />
261
264
  </label>
262
265
  </ConfigFieldGroup>
263
266
 
264
- <ConfigFieldGroup title="数据">
267
+ <ConfigFieldGroup :title="t('panel.config.groupData')">
265
268
  <label class="block space-y-1">
266
- <div>类目(逗号分隔)</div>
269
+ <div>{{ t("panel.config.labelsCsv") }}</div>
267
270
  <Input
268
271
  size="small"
269
272
  :value="getChartLabelsDisplayText(element.chart)"
@@ -272,7 +275,7 @@ function onOptionJsonChange(v: string) {
272
275
  />
273
276
  </label>
274
277
  <label class="block space-y-1">
275
- <div>数值(逗号分隔)</div>
278
+ <div>{{ t("panel.config.valuesCsv") }}</div>
276
279
  <Input
277
280
  size="small"
278
281
  :value="getChartValuesDisplayText(element.chart)"
@@ -284,11 +287,11 @@ function onOptionJsonChange(v: string) {
284
287
 
285
288
  <ConfigFieldGroup
286
289
  v-if="['bar', 'line', 'area', 'scatter'].includes(selectedChartType)"
287
- title="坐标轴"
290
+ :title="t('panel.config.groupAxes')"
288
291
  >
289
292
  <div class="grid grid-cols-2 gap-2">
290
293
  <label class="block">
291
- <div class="mb-1">X 轴名称</div>
294
+ <div class="mb-1">{{ t("panel.scope.fieldChartXAxisName") }}</div>
292
295
  <Input
293
296
  size="small"
294
297
  :value="element.chart?.xAxisName ?? ''"
@@ -297,7 +300,7 @@ function onOptionJsonChange(v: string) {
297
300
  />
298
301
  </label>
299
302
  <label class="block">
300
- <div class="mb-1">Y 轴名称</div>
303
+ <div class="mb-1">{{ t("panel.scope.fieldChartYAxisName") }}</div>
301
304
  <Input
302
305
  size="small"
303
306
  :value="element.chart?.yAxisName ?? ''"
@@ -313,7 +316,7 @@ function onOptionJsonChange(v: string) {
313
316
  :disabled="!isEditable"
314
317
  @update:checked="(v) => updateChart({ xAxisTickShow: v === true })"
315
318
  />
316
- <span>X 轴刻度线</span>
319
+ <span>{{ t("panel.config.xAxisTick") }}</span>
317
320
  </label>
318
321
  <label class="flex items-center gap-2">
319
322
  <Checkbox
@@ -321,18 +324,18 @@ function onOptionJsonChange(v: string) {
321
324
  :disabled="!isEditable"
322
325
  @update:checked="(v) => updateChart({ yAxisTickShow: v === true })"
323
326
  />
324
- <span>Y 轴刻度线</span>
327
+ <span>{{ t("panel.config.yAxisTick") }}</span>
325
328
  </label>
326
329
  </div>
327
330
  <div class="grid grid-cols-2 gap-2">
328
331
  <ConfigColorField
329
- label="X 轴刻度线颜色"
332
+ :label="t('panel.config.xAxisTickColor')"
330
333
  :value="element.chart?.xAxisTickColor ?? '#94a3b8'"
331
334
  :disabled="!isEditable"
332
335
  @update:value="(v) => updateChart({ xAxisTickColor: v || '#94a3b8' })"
333
336
  />
334
337
  <ConfigColorField
335
- label="Y 轴刻度线颜色"
338
+ :label="t('panel.config.yAxisTickColor')"
336
339
  :value="element.chart?.yAxisTickColor ?? '#94a3b8'"
337
340
  :disabled="!isEditable"
338
341
  @update:value="(v) => updateChart({ yAxisTickColor: v || '#94a3b8' })"
@@ -345,7 +348,7 @@ function onOptionJsonChange(v: string) {
345
348
  :disabled="!isEditable"
346
349
  @update:checked="(v) => updateChart({ xAxisSplitLineShow: v === true })"
347
350
  />
348
- <span>X 轴分割线</span>
351
+ <span>{{ t("panel.config.xAxisSplitLine") }}</span>
349
352
  </label>
350
353
  <label class="flex items-center gap-2">
351
354
  <Checkbox
@@ -353,18 +356,18 @@ function onOptionJsonChange(v: string) {
353
356
  :disabled="!isEditable"
354
357
  @update:checked="(v) => updateChart({ yAxisSplitLineShow: v === true })"
355
358
  />
356
- <span>Y 轴分割线</span>
359
+ <span>{{ t("panel.config.yAxisSplitLine") }}</span>
357
360
  </label>
358
361
  </div>
359
362
  <div class="grid grid-cols-2 gap-2">
360
363
  <ConfigColorField
361
- label="X 轴标签颜色"
364
+ :label="t('panel.scope.fieldChartXAxisLabelColor')"
362
365
  :value="element.chart?.xAxisLabelColor ?? '#64748b'"
363
366
  :disabled="!isEditable"
364
367
  @update:value="(v) => updateChart({ xAxisLabelColor: v || '#64748b' })"
365
368
  />
366
369
  <ConfigColorField
367
- label="Y 轴标签颜色"
370
+ :label="t('panel.scope.fieldChartYAxisLabelColor')"
368
371
  :value="element.chart?.yAxisLabelColor ?? '#64748b'"
369
372
  :disabled="!isEditable"
370
373
  @update:value="(v) => updateChart({ yAxisLabelColor: v || '#64748b' })"
@@ -372,7 +375,7 @@ function onOptionJsonChange(v: string) {
372
375
  </div>
373
376
  <div class="grid grid-cols-2 gap-2">
374
377
  <label class="block">
375
- <div class="mb-1">X 轴标签字号</div>
378
+ <div class="mb-1">{{ t("panel.config.xAxisLabelFontSize") }}</div>
376
379
  <InputNumber
377
380
  size="small"
378
381
  class="w-full"
@@ -387,7 +390,7 @@ function onOptionJsonChange(v: string) {
387
390
  />
388
391
  </label>
389
392
  <label class="block">
390
- <div class="mb-1">Y 轴标签字号</div>
393
+ <div class="mb-1">{{ t("panel.config.yAxisLabelFontSize") }}</div>
391
394
  <InputNumber
392
395
  size="small"
393
396
  class="w-full"
@@ -406,10 +409,10 @@ function onOptionJsonChange(v: string) {
406
409
 
407
410
  <ConfigFieldGroup
408
411
  v-if="['bar', 'line', 'area', 'pie'].includes(selectedChartType)"
409
- title="系列"
412
+ :title="t('panel.config.groupSeries')"
410
413
  >
411
414
  <label v-if="selectedChartType === 'bar'" class="block space-y-1">
412
- <div>柱宽(px)</div>
415
+ <div>{{ t("panel.config.barWidthPx") }}</div>
413
416
  <InputNumber
414
417
  size="small"
415
418
  class="w-full"
@@ -431,11 +434,11 @@ function onOptionJsonChange(v: string) {
431
434
  :disabled="!isEditable"
432
435
  @update:checked="(v) => updateChart({ smooth: v === true })"
433
436
  />
434
- <span>平滑曲线</span>
437
+ <span>{{ t("panel.config.smooth") }}</span>
435
438
  </label>
436
439
  <div v-if="selectedChartType === 'pie'" class="grid grid-cols-2 gap-2">
437
440
  <label class="block space-y-1">
438
- <div>内半径(%)</div>
441
+ <div>{{ t("panel.config.pieInnerRadiusPct") }}</div>
439
442
  <InputNumber
440
443
  size="small"
441
444
  class="w-full"
@@ -450,7 +453,7 @@ function onOptionJsonChange(v: string) {
450
453
  />
451
454
  </label>
452
455
  <label class="block space-y-1">
453
- <div>外半径(%)</div>
456
+ <div>{{ t("panel.config.pieOuterRadiusPct") }}</div>
454
457
  <InputNumber
455
458
  size="small"
456
459
  class="w-full"
@@ -469,17 +472,17 @@ function onOptionJsonChange(v: string) {
469
472
  </ConfigSection>
470
473
 
471
474
  <ConfigSection
472
- title="图表配置 / 高级"
475
+ :title="t('panel.config.sectionChartAdvanced')"
473
476
  :open="advancedOpen"
474
477
  :force-open="forceOpen"
475
478
  @update:open="emit('update:advancedOpen', $event)"
476
479
  >
477
- <ConfigFieldGroup title="常用项(表单)">
480
+ <ConfigFieldGroup :title="t('panel.config.groupCommonForm')">
478
481
  <Collapse ghost size="small">
479
- <Collapse.Panel key="layout" header="布局与坐标">
482
+ <Collapse.Panel key="layout" :header="t('panel.config.groupLayoutAndCoord')">
480
483
  <div class="grid grid-cols-2 gap-2">
481
484
  <label class="block space-y-1">
482
- <div class="text-[11px]">网格左距(grid.left)</div>
485
+ <div class="text-[11px]">{{ t("panel.config.gridLeftForm") }}</div>
483
486
  <InputNumber
484
487
  size="small"
485
488
  class="w-full"
@@ -489,7 +492,7 @@ function onOptionJsonChange(v: string) {
489
492
  />
490
493
  </label>
491
494
  <label class="block space-y-1">
492
- <div class="text-[11px]">网格右距(grid.right)</div>
495
+ <div class="text-[11px]">{{ t("panel.config.gridRightForm") }}</div>
493
496
  <InputNumber
494
497
  size="small"
495
498
  class="w-full"
@@ -499,7 +502,7 @@ function onOptionJsonChange(v: string) {
499
502
  />
500
503
  </label>
501
504
  <label class="block space-y-1">
502
- <div class="text-[11px]">图例位置(legend.top)</div>
505
+ <div class="text-[11px]">{{ t("panel.config.legendPositionForm") }}</div>
503
506
  <Select
504
507
  size="small"
505
508
  class="w-full"
@@ -507,14 +510,14 @@ function onOptionJsonChange(v: string) {
507
510
  :disabled="!isEditable"
508
511
  @update:value="(v) => updateOptionForm({ legend: { top: v } })"
509
512
  >
510
- <Select.Option value="top">顶部</Select.Option>
511
- <Select.Option value="bottom">底部</Select.Option>
512
- <Select.Option value="left">左侧</Select.Option>
513
- <Select.Option value="right">右侧</Select.Option>
513
+ <Select.Option value="top">{{ t("panel.config.legendTop") }}</Select.Option>
514
+ <Select.Option value="bottom">{{ t("panel.config.legendBottom") }}</Select.Option>
515
+ <Select.Option value="left">{{ t("panel.config.legendLeft") }}</Select.Option>
516
+ <Select.Option value="right">{{ t("panel.config.legendRight") }}</Select.Option>
514
517
  </Select>
515
518
  </label>
516
519
  <label class="block space-y-1">
517
- <div class="text-[11px]">图例排列(legend.orient)</div>
520
+ <div class="text-[11px]">{{ t("panel.config.legendOrientForm") }}</div>
518
521
  <Select
519
522
  size="small"
520
523
  class="w-full"
@@ -522,13 +525,13 @@ function onOptionJsonChange(v: string) {
522
525
  :disabled="!isEditable"
523
526
  @update:value="(v) => updateOptionForm({ legend: { orient: v } })"
524
527
  >
525
- <Select.Option value="horizontal">横向</Select.Option>
526
- <Select.Option value="vertical">纵向</Select.Option>
528
+ <Select.Option value="horizontal">{{ t("panel.config.legendHorizontal") }}</Select.Option>
529
+ <Select.Option value="vertical">{{ t("panel.config.legendVertical") }}</Select.Option>
527
530
  </Select>
528
531
  </label>
529
532
  </div>
530
533
  </Collapse.Panel>
531
- <Collapse.Panel key="highfreq" header="高频项">
534
+ <Collapse.Panel key="highfreq" :header="t('panel.config.groupHighFreq')">
532
535
  <div class="space-y-2">
533
536
  <label class="flex items-center gap-2">
534
537
  <Checkbox
@@ -536,7 +539,7 @@ function onOptionJsonChange(v: string) {
536
539
  :disabled="!isEditable"
537
540
  @update:checked="(v) => updateOptionForm({ legend: { show: v === true } })"
538
541
  />
539
- <span>显示图例</span>
542
+ <span>{{ t("panel.config.showLegend") }}</span>
540
543
  </label>
541
544
  <label class="flex items-center gap-2">
542
545
  <Checkbox
@@ -544,7 +547,7 @@ function onOptionJsonChange(v: string) {
544
547
  :disabled="!isEditable"
545
548
  @update:checked="(v) => updateOptionForm({ grid: { containLabel: v === true } })"
546
549
  />
547
- <span>网格包含标签</span>
550
+ <span>{{ t("panel.config.gridContainLabel") }}</span>
548
551
  </label>
549
552
  <label class="flex items-center gap-2">
550
553
  <Checkbox
@@ -552,7 +555,7 @@ function onOptionJsonChange(v: string) {
552
555
  :disabled="!isEditable"
553
556
  @update:checked="(v) => toggleDataZoom('inside', v === true)"
554
557
  />
555
- <span>内置缩放</span>
558
+ <span>{{ t("panel.config.zoomInside") }}</span>
556
559
  </label>
557
560
  <label class="flex items-center gap-2">
558
561
  <Checkbox
@@ -560,7 +563,7 @@ function onOptionJsonChange(v: string) {
560
563
  :disabled="!isEditable"
561
564
  @update:checked="(v) => toggleDataZoom('slider', v === true)"
562
565
  />
563
- <span>滑块缩放</span>
566
+ <span>{{ t("panel.config.zoomSlider") }}</span>
564
567
  </label>
565
568
  <label class="flex items-center gap-2">
566
569
  <Checkbox
@@ -568,10 +571,10 @@ function onOptionJsonChange(v: string) {
568
571
  :disabled="!isEditable"
569
572
  @update:checked="(v) => updateOptionForm({ animation: v === true })"
570
573
  />
571
- <span>开启动画</span>
574
+ <span>{{ t("panel.config.enableAnimation") }}</span>
572
575
  </label>
573
576
  <label class="block space-y-1">
574
- <div class="text-[11px]">动画时长(ms)</div>
577
+ <div class="text-[11px]">{{ t("panel.config.animationDurationMs") }}</div>
575
578
  <InputNumber
576
579
  size="small"
577
580
  class="w-full"
@@ -583,7 +586,7 @@ function onOptionJsonChange(v: string) {
583
586
  </label>
584
587
  </div>
585
588
  </Collapse.Panel>
586
- <Collapse.Panel key="axisPointer" header="轴指示器与对齐">
589
+ <Collapse.Panel key="axisPointer" :header="t('panel.config.groupAxisPointer')">
587
590
  <div class="space-y-2">
588
591
  <label class="flex items-center gap-2">
589
592
  <Checkbox
@@ -591,10 +594,10 @@ function onOptionJsonChange(v: string) {
591
594
  :disabled="!isEditable"
592
595
  @update:checked="(v) => updateOptionForm({ axisPointer: { show: v === true } })"
593
596
  />
594
- <span>显示轴指示器</span>
597
+ <span>{{ t("panel.config.showAxisPointer") }}</span>
595
598
  </label>
596
599
  <label class="block space-y-1">
597
- <div class="text-[11px]">轴指示器类型</div>
600
+ <div class="text-[11px]">{{ t("panel.config.axisPointerType") }}</div>
598
601
  <Select
599
602
  size="small"
600
603
  class="w-full"
@@ -602,9 +605,9 @@ function onOptionJsonChange(v: string) {
602
605
  :disabled="!isEditable"
603
606
  @update:value="(v) => updateOptionForm({ axisPointer: { type: v } })"
604
607
  >
605
- <Select.Option value="line">线</Select.Option>
606
- <Select.Option value="shadow">阴影</Select.Option>
607
- <Select.Option value="cross">十字</Select.Option>
608
+ <Select.Option value="line">{{ t("panel.config.axisPointerLine") }}</Select.Option>
609
+ <Select.Option value="shadow">{{ t("panel.config.axisPointerShadow") }}</Select.Option>
610
+ <Select.Option value="cross">{{ t("panel.config.axisPointerCross") }}</Select.Option>
608
611
  </Select>
609
612
  </label>
610
613
  </div>
@@ -612,15 +615,15 @@ function onOptionJsonChange(v: string) {
612
615
  </Collapse>
613
616
  </ConfigFieldGroup>
614
617
 
615
- <ConfigFieldGroup title="JSON 高级模式">
618
+ <ConfigFieldGroup :title="t('panel.config.groupJsonAdvanced')">
616
619
  <label class="flex items-center gap-2">
617
620
  <Checkbox
618
621
  v-model:checked="isAdvancedOptionMode"
619
622
  :disabled="!isEditable"
620
623
  />
621
- <span>开启高级模式(直接编辑图表 JSON 配置)</span>
622
- <ConfigHintIcon label="图表 JSON 高级模式">
623
- 基础配置会先生成图表配置,高级模式会在此基础上覆盖(深度合并)。
624
+ <span>{{ t("panel.config.enableAdvancedJson") }}</span>
625
+ <ConfigHintIcon :label="t('panel.config.advancedJsonHintLabel')">
626
+ {{ t("panel.config.advancedJsonHint") }}
624
627
  </ConfigHintIcon>
625
628
  </label>
626
629
  <template v-if="isAdvancedOptionMode">
@@ -642,7 +645,7 @@ function onOptionJsonChange(v: string) {
642
645
  v-else
643
646
  class="rounded border border-emerald-500/30 bg-emerald-500/10 px-2 py-1.5 text-[11px] text-emerald-700"
644
647
  >
645
- JSON 有效,已实时应用到当前图表。
648
+ {{ t("panel.config.jsonValidApplied") }}
646
649
  </div>
647
650
  </template>
648
651
  </ConfigFieldGroup>
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useI18n } from "@arronqzy/i18n/vue";
2
3
  import { onMounted, ref, watch } from "vue";
3
4
  import { Input, InputNumber, Select, Textarea } from "ant-design-vue";
4
5
  import type { PanelElement } from "../../types";
@@ -6,6 +7,7 @@ import ConfigColorField from "./ConfigColorField.vue";
6
7
  import ConfigFieldGroup from "./ConfigFieldGroup.vue";
7
8
  import ConfigSection from "./ConfigSection.vue";
8
9
 
10
+ const { t, locale } = useI18n();
9
11
  const props = defineProps<{
10
12
  element: PanelElement;
11
13
  isEditable: boolean;
@@ -105,14 +107,14 @@ function clearSketch() {
105
107
 
106
108
  <template>
107
109
  <ConfigSection
108
- title="几何配置"
110
+ :title="t('panel.config.sectionGeometry')"
109
111
  :open="open"
110
112
  :force-open="forceOpen"
111
113
  @update:open="emit('update:open', $event)"
112
114
  >
113
- <ConfigFieldGroup title="基础形状">
115
+ <ConfigFieldGroup :title="t('panel.config.groupBasicShape')">
114
116
  <label class="block space-y-1">
115
- <div>形状</div>
117
+ <div>{{ t("panel.config.shape") }}</div>
116
118
  <Select
117
119
  size="small"
118
120
  class="w-full"
@@ -120,25 +122,25 @@ function clearSketch() {
120
122
  :disabled="!isEditable"
121
123
  @update:value="(v) => patch({ geometryShape: v as PanelElement['geometryShape'] })"
122
124
  >
123
- <Select.Option value="rect">矩形</Select.Option>
124
- <Select.Option value="circle">圆形</Select.Option>
125
- <Select.Option value="triangle">三角形</Select.Option>
126
- <Select.Option value="diamond">菱形</Select.Option>
127
- <Select.Option value="hexagon">六边形</Select.Option>
128
- <Select.Option value="star">星形</Select.Option>
129
- <Select.Option value="heart">爱心</Select.Option>
125
+ <Select.Option value="rect">{{ t("panel.config.shapeRect") }}</Select.Option>
126
+ <Select.Option value="circle">{{ t("panel.config.shapeCircle") }}</Select.Option>
127
+ <Select.Option value="triangle">{{ t("panel.config.shapeTriangle") }}</Select.Option>
128
+ <Select.Option value="diamond">{{ t("panel.config.shapeDiamond") }}</Select.Option>
129
+ <Select.Option value="hexagon">{{ t("panel.config.shapeHexagon") }}</Select.Option>
130
+ <Select.Option value="star">{{ t("panel.config.shapeStar") }}</Select.Option>
131
+ <Select.Option value="heart">{{ t("panel.config.shapeHeart") }}</Select.Option>
130
132
  </Select>
131
133
  </label>
132
134
  <ConfigColorField
133
- label="几何颜色"
135
+ :label="t('panel.scope.fieldGeometryColor')"
134
136
  :value="element.geometryColor ?? '#3b82f6'"
135
137
  :disabled="!isEditable"
136
138
  @update:value="(v) => patch({ geometryColor: v || '#3b82f6' })"
137
139
  />
138
140
  </ConfigFieldGroup>
139
- <ConfigFieldGroup title="高级(Canvas 脚本)">
141
+ <ConfigFieldGroup :title="t('panel.config.groupCanvasScript')">
140
142
  <template #hint>
141
- 可输入 Canvas 绘制逻辑,变量:ctx、width、height、element。脚本异常会被安全忽略。
143
+ {{ t("panel.config.canvasScriptHint") }}
142
144
  </template>
143
145
  <Textarea
144
146
  :value="element.geometryScript ?? ''"
@@ -146,14 +148,14 @@ function clearSketch() {
146
148
  :rows="6"
147
149
  spellcheck="false"
148
150
  class="font-mono text-[11px]"
149
- placeholder="// 例: ctx.fillStyle = 'rgba(255,255,255,0.25)'; ctx.fillRect(8,8,width-16,height-16);"
151
+ :placeholder="t('panel.config.geometryScriptPlaceholder')"
150
152
  @update:value="(v: string) => patch({ geometryScript: v || undefined })"
151
153
  />
152
154
  </ConfigFieldGroup>
153
- <ConfigFieldGroup title="手绘叠加">
155
+ <ConfigFieldGroup :title="t('panel.config.groupSketchOverlay')">
154
156
  <div class="flex items-center gap-2">
155
157
  <label class="block space-y-1">
156
- <div class="text-[11px]">画笔颜色</div>
158
+ <div class="text-[11px]">{{ t("panel.config.penColor") }}</div>
157
159
  <input
158
160
  v-model="geometryDrawPenColor"
159
161
  type="color"
@@ -162,7 +164,7 @@ function clearSketch() {
162
164
  />
163
165
  </label>
164
166
  <label class="block space-y-1">
165
- <div class="text-[11px]">画笔粗细</div>
167
+ <div class="text-[11px]">{{ t("panel.config.penWidth") }}</div>
166
168
  <InputNumber
167
169
  size="small"
168
170
  class="w-20"
@@ -193,7 +195,7 @@ function clearSketch() {
193
195
  :disabled="!isEditable"
194
196
  @click="applySketch"
195
197
  >
196
- 应用手绘到节点
198
+ {{ t("panel.config.applySketch") }}
197
199
  </button>
198
200
  <button
199
201
  type="button"
@@ -201,7 +203,7 @@ function clearSketch() {
201
203
  :disabled="!isEditable"
202
204
  @click="clearSketch"
203
205
  >
204
- 清空手绘
206
+ {{ t("panel.config.clearSketch") }}
205
207
  </button>
206
208
  </div>
207
209
  </ConfigFieldGroup>