@veltra/sheet 2.1.1 → 2.2.0

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 (202) hide show
  1. package/dist/components/report/binding-badge.js +76 -0
  2. package/dist/components/report/designer/cell-coords.js +46 -0
  3. package/dist/components/report/designer/col-widths.js +15 -0
  4. package/dist/components/report/designer/conditional-rules/helpers.js +139 -0
  5. package/dist/components/report/designer/drop-highlight-overlay.js +76 -0
  6. package/dist/components/report/designer/float-panel.js +385 -0
  7. package/dist/components/report/designer/role.js +17 -0
  8. package/dist/components/report/designer/rule-preview.js +33 -0
  9. package/dist/components/report/designer/rule-row.js +269 -0
  10. package/dist/components/report/designer/rules-dialog.js +135 -0
  11. package/dist/components/report/designer/topology-overlay.js +122 -0
  12. package/dist/components/report/designer/topology.js +64 -0
  13. package/dist/components/report/designer/use-grid-overlay.js +75 -0
  14. package/dist/components/report/designer-hub.js +177 -0
  15. package/dist/components/report/field-panel-helpers.js +33 -0
  16. package/dist/components/report/field-panel.js +132 -0
  17. package/dist/components/report/filter-bar.js +74 -0
  18. package/dist/components/report/hub-connection-form.js +145 -0
  19. package/dist/components/report/hub-dataset-editor.js +394 -0
  20. package/dist/components/report/report-designer.js +343 -0
  21. package/dist/components/report/report-viewer.js +111 -0
  22. package/dist/components/report/style.d.ts +17 -0
  23. package/dist/components/report/style.js +18 -0
  24. package/dist/components/report/style2.css +869 -0
  25. package/dist/components/report/use-report-designer.js +360 -0
  26. package/dist/components/report/use-report-viewer.js +50 -0
  27. package/dist/{vue → components/sheet}/formula-bar.js +1 -1
  28. package/dist/{vue → components/sheet}/formula-suggest-list.js +1 -1
  29. package/dist/{vue → components/sheet}/import-file.js +1 -1
  30. package/dist/{vue → components/sheet}/insert-count-menu-item.js +1 -1
  31. package/dist/{vue → components/sheet}/insert-image.js +1 -1
  32. package/dist/{vue → components/sheet}/popup-helpers.js +1 -1
  33. package/dist/{vue → components/sheet}/popups/border-popup.js +1 -1
  34. package/dist/{vue → components/sheet}/popups/border-preset-glyph.js +1 -1
  35. package/dist/{vue → components/sheet}/popups/export-popup.js +2 -2
  36. package/dist/{vue → components/sheet}/popups/fill-color-popup.js +1 -1
  37. package/dist/{vue → components/sheet}/popups/find-popup.js +1 -1
  38. package/dist/{vue → components/sheet}/popups/font-color-popup.js +1 -1
  39. package/dist/{vue → components/sheet}/popups/font-size-popup.js +1 -1
  40. package/dist/{vue → components/sheet}/popups/import.worker.d.ts +1 -1
  41. package/dist/{vue → components/sheet}/popups/import.worker.js +1 -1
  42. package/dist/{vue → components/sheet}/popups/insert-image-popup.js +1 -1
  43. package/dist/{vue → components/sheet}/sheet-context-menu.js +1 -1
  44. package/dist/{vue → components/sheet}/sheet-tabs.js +1 -1
  45. package/dist/{vue → components/sheet}/sheet-toolbar.js +1 -1
  46. package/dist/{vue → components/sheet}/sheet.js +8 -1
  47. package/dist/{vue → components/sheet}/use-find-replace.js +1 -1
  48. package/dist/{vue → components/sheet}/use-formula-ref-select.js +1 -1
  49. package/dist/{vue → components/sheet}/use-sheet-grid.js +10 -2
  50. package/dist/{vue → components/sheet}/use-sheet-state.js +3 -3
  51. package/dist/{vue → components/sheet}/use-sheet-tabs-bar.js +1 -1
  52. package/dist/{vue → components/sheet}/use-tool-groups.js +2 -2
  53. package/dist/{vue → components/sheet}/use-tool-popup.js +2 -2
  54. package/dist/{vue → components/sheet}/use-toolbar-scroll.js +1 -1
  55. package/dist/index.d.ts +17 -3
  56. package/dist/index.js +13 -3
  57. package/dist/report/binding.d.ts +45 -0
  58. package/dist/report/binding.js +175 -0
  59. package/dist/report/connector.d.ts +66 -0
  60. package/dist/report/connector.js +159 -0
  61. package/dist/report/export-xlsx.d.ts +19 -0
  62. package/dist/report/export-xlsx.js +95 -0
  63. package/dist/report/filter-bar.d.ts +10 -0
  64. package/dist/report/filter-bar.js +31 -0
  65. package/dist/report/index.d.ts +12 -0
  66. package/dist/report/params.d.ts +13 -0
  67. package/dist/report/params.js +61 -0
  68. package/dist/report/render/aggregate.js +157 -0
  69. package/dist/report/render/builder.d.ts +12 -0
  70. package/dist/report/render/builder.js +139 -0
  71. package/dist/report/render/coordinate.d.ts +25 -0
  72. package/dist/report/render/coordinate.js +733 -0
  73. package/dist/report/render/index.d.ts +14 -0
  74. package/dist/report/render/index.js +21 -0
  75. package/dist/report/render/style-resolver.js +50 -0
  76. package/dist/report/render/template-index.d.ts +24 -0
  77. package/dist/report/render/template-index.js +137 -0
  78. package/dist/report/rules/evaluate.d.ts +25 -0
  79. package/dist/report/rules/evaluate.js +82 -0
  80. package/dist/report/rules/index.d.ts +2 -0
  81. package/dist/report/template.d.ts +59 -0
  82. package/dist/report/template.js +80 -0
  83. package/dist/report/types.d.ts +85 -0
  84. package/dist/tools/context.d.ts +1 -1
  85. package/dist/types/index.d.ts +3 -2
  86. package/dist/types/report-designer.d.ts +36 -0
  87. package/dist/types/report-viewer.d.ts +38 -0
  88. package/dist/types/sheet.d.ts +17 -1
  89. package/package.json +3 -5
  90. package/src/components/report/__test__/conditional-rules-helpers.test.ts +87 -0
  91. package/src/components/report/__test__/field-panel-helpers.test.ts +65 -0
  92. package/src/components/report/__test__/float-panel-position.test.ts +45 -0
  93. package/src/components/report/__test__/report-designer.test.ts +388 -0
  94. package/src/components/report/__test__/report-viewer.test.ts +334 -0
  95. package/src/components/report/__test__/topology.test.ts +143 -0
  96. package/src/components/report/__test__/use-report-designer.test.ts +565 -0
  97. package/src/components/report/binding-badge.ts +73 -0
  98. package/src/components/report/designer/cell-coords.ts +94 -0
  99. package/src/components/report/designer/col-widths.ts +33 -0
  100. package/src/components/report/designer/conditional-rules/helpers.ts +186 -0
  101. package/src/components/report/designer/drop-highlight-overlay.vue +74 -0
  102. package/src/components/report/designer/float-panel.vue +387 -0
  103. package/src/components/report/designer/role.ts +32 -0
  104. package/src/components/report/designer/rule-preview.vue +40 -0
  105. package/src/components/report/designer/rule-row.vue +252 -0
  106. package/src/components/report/designer/rules-dialog.vue +126 -0
  107. package/src/components/report/designer/topology-overlay.vue +127 -0
  108. package/src/components/report/designer/topology.ts +124 -0
  109. package/src/components/report/designer/use-grid-overlay.ts +113 -0
  110. package/src/components/report/designer-hub.vue +198 -0
  111. package/src/components/report/field-panel-helpers.ts +44 -0
  112. package/src/components/report/field-panel.vue +136 -0
  113. package/src/components/report/filter-bar.vue +77 -0
  114. package/src/components/report/hub-connection-form.vue +124 -0
  115. package/src/components/report/hub-dataset-editor.vue +369 -0
  116. package/src/components/report/index.ts +2 -0
  117. package/src/components/report/report-designer.vue +356 -0
  118. package/src/components/report/report-viewer.vue +128 -0
  119. package/src/components/report/style-designer.scss +583 -0
  120. package/src/components/report/style-hub.scss +292 -0
  121. package/src/components/report/style-viewer.scss +104 -0
  122. package/src/components/report/style.scss +3 -0
  123. package/src/components/report/style.ts +20 -0
  124. package/src/components/report/use-report-designer.ts +547 -0
  125. package/src/components/report/use-report-viewer.ts +79 -0
  126. package/src/{vue → components/sheet}/__test__/formula-bar.test.ts +37 -18
  127. package/src/{vue → components/sheet}/__test__/insert-image-popup.test.ts +1 -1
  128. package/src/{vue → components/sheet}/__test__/insert-image.test.ts +1 -1
  129. package/src/{vue → components/sheet}/__test__/sheet-component.test.ts +40 -3
  130. package/src/{vue → components/sheet}/__test__/sheet-context-menu.test.ts +1 -1
  131. package/src/{vue → components/sheet}/formula-bar.vue +1 -1
  132. package/src/{vue → components/sheet}/insert-image.ts +1 -1
  133. package/src/{vue → components/sheet}/popup-helpers.ts +1 -1
  134. package/src/{vue → components/sheet}/popups/border-popup.vue +1 -1
  135. package/src/{vue → components/sheet}/popups/export-popup.vue +2 -2
  136. package/src/{vue → components/sheet}/popups/fill-color-popup.vue +1 -1
  137. package/src/{vue → components/sheet}/popups/find-popup.vue +1 -1
  138. package/src/{vue → components/sheet}/popups/font-color-popup.vue +1 -1
  139. package/src/{vue → components/sheet}/popups/font-size-popup.vue +1 -1
  140. package/src/{vue → components/sheet}/popups/insert-image-popup.vue +1 -1
  141. package/src/{vue → components/sheet}/sheet-context-menu.ts +2 -2
  142. package/src/{vue → components/sheet}/sheet-toolbar.vue +2 -2
  143. package/src/{vue → components/sheet}/sheet.vue +4 -3
  144. package/src/{vue → components/sheet}/use-find-replace.ts +1 -1
  145. package/src/{vue → components/sheet}/use-sheet-grid.ts +7 -3
  146. package/src/{vue → components/sheet}/use-sheet-state.ts +3 -3
  147. package/src/{vue → components/sheet}/use-tool-groups.ts +2 -2
  148. package/src/{vue → components/sheet}/use-tool-popup.ts +2 -2
  149. package/src/index.ts +24 -188
  150. package/src/report/__test__/binding.test.ts +218 -0
  151. package/src/report/__test__/connector.test.ts +218 -0
  152. package/src/report/__test__/export-xlsx.test.ts +118 -0
  153. package/src/report/__test__/filter-bar.test.ts +58 -0
  154. package/src/report/__test__/params.test.ts +156 -0
  155. package/src/report/__test__/render.test.ts +728 -0
  156. package/src/report/__test__/rules.test.ts +131 -0
  157. package/src/report/__test__/template.test.ts +355 -0
  158. package/src/report/binding.ts +243 -0
  159. package/src/report/connector.ts +205 -0
  160. package/src/report/export-xlsx.ts +118 -0
  161. package/src/report/filter-bar.ts +36 -0
  162. package/src/report/index.ts +13 -0
  163. package/src/report/params.ts +96 -0
  164. package/src/report/render/__test__/aggregate.test.ts +16 -0
  165. package/src/report/render/__test__/coordinate.test.ts +405 -0
  166. package/src/report/render/aggregate.ts +240 -0
  167. package/src/report/render/builder.ts +211 -0
  168. package/src/report/render/coordinate.ts +1239 -0
  169. package/src/report/render/index.ts +30 -0
  170. package/src/report/render/style-resolver.ts +68 -0
  171. package/src/report/render/template-index.ts +200 -0
  172. package/src/report/rules/evaluate.ts +113 -0
  173. package/src/report/rules/index.ts +7 -0
  174. package/src/report/template.ts +141 -0
  175. package/src/report/types.ts +96 -0
  176. package/src/tools/builtin.ts +2 -2
  177. package/src/types/index.ts +2 -6
  178. package/src/types/report-designer.ts +36 -0
  179. package/src/types/report-viewer.ts +37 -0
  180. package/src/types/sheet.ts +22 -1
  181. /package/dist/{vue → components/sheet}/style.d.ts +0 -0
  182. /package/dist/{vue → components/sheet}/style.js +0 -0
  183. /package/dist/{vue → components/sheet}/style2.css +0 -0
  184. /package/dist/{vue → components/sheet}/use-formula-suggest.js +0 -0
  185. /package/src/{vue → components/sheet}/__test__/import-file.test.ts +0 -0
  186. /package/src/{vue → components/sheet}/__test__/insert-count-menu-item.test.ts +0 -0
  187. /package/src/{vue → components/sheet}/__test__/use-formula-ref-select.test.ts +0 -0
  188. /package/src/{vue → components/sheet}/__test__/use-formula-suggest.test.ts +0 -0
  189. /package/src/{vue → components/sheet}/formula-suggest-list.vue +0 -0
  190. /package/src/{vue → components/sheet}/import-file.ts +0 -0
  191. /package/src/{vue → components/sheet}/index.ts +0 -0
  192. /package/src/{vue → components/sheet}/insert-count-menu-item.vue +0 -0
  193. /package/src/{vue → components/sheet}/parsing.ts +0 -0
  194. /package/src/{vue → components/sheet}/popups/border-preset-glyph.vue +0 -0
  195. /package/src/{vue → components/sheet}/popups/import.worker.ts +0 -0
  196. /package/src/{vue → components/sheet}/sheet-tabs.vue +0 -0
  197. /package/src/{vue → components/sheet}/style.scss +0 -0
  198. /package/src/{vue → components/sheet}/style.ts +0 -0
  199. /package/src/{vue → components/sheet}/use-formula-ref-select.ts +0 -0
  200. /package/src/{vue → components/sheet}/use-formula-suggest.ts +0 -0
  201. /package/src/{vue → components/sheet}/use-sheet-tabs-bar.ts +0 -0
  202. /package/src/{vue → components/sheet}/use-toolbar-scroll.ts +0 -0
@@ -0,0 +1,394 @@
1
+ import { buildParamDefs } from "../../report/params.js";
2
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, onBeforeUnmount, openBlock, ref, shallowRef, toDisplayString, unref, watch, withCtx } from "vue";
3
+ import { UButton, UCodeEditor, UInput, UPopConfirm, USelect, UTable, UTabs, UTag, defineTableColumns } from "@veltra/desktop";
4
+ import { bem } from "@veltra/utils";
5
+ //#region src/components/report/hub-dataset-editor.vue
6
+ const _sfc_main = /*@__PURE__*/ defineComponent({
7
+ name: "UReportHubDatasetEditor",
8
+ __name: "hub-dataset-editor",
9
+ props: {
10
+ hub: {},
11
+ datasetId: {}
12
+ },
13
+ emits: ["remove"],
14
+ setup(__props, { emit: __emit }) {
15
+ const props = __props;
16
+ const emit = __emit;
17
+ const cls = bem("report-hub-dataset-editor");
18
+ const detailTab = ref("schema");
19
+ const detailTabItems = [{
20
+ key: "schema",
21
+ name: "字段 Schema"
22
+ }, {
23
+ key: "preview",
24
+ name: "数据预览"
25
+ }];
26
+ const paramTypeOptions = [
27
+ {
28
+ label: "文本",
29
+ value: "text"
30
+ },
31
+ {
32
+ label: "数字",
33
+ value: "number"
34
+ },
35
+ {
36
+ label: "日期",
37
+ value: "date"
38
+ },
39
+ {
40
+ label: "日期范围",
41
+ value: "date-range"
42
+ },
43
+ {
44
+ label: "下拉",
45
+ value: "select"
46
+ }
47
+ ];
48
+ const dataset = computed(() => props.hub.datasets.value.find((item) => item.id === props.datasetId));
49
+ const describing = ref(false);
50
+ const describeError = shallowRef("");
51
+ let describeSeq = 0;
52
+ const previewing = ref(false);
53
+ const previewError = shallowRef("");
54
+ const previewRows = shallowRef([]);
55
+ const previewFields = shallowRef([]);
56
+ function resetPreview() {
57
+ previewing.value = false;
58
+ previewError.value = "";
59
+ previewRows.value = [];
60
+ previewFields.value = [];
61
+ }
62
+ const sqlDraft = ref("");
63
+ let sqlTimer;
64
+ watch(() => props.datasetId, () => {
65
+ sqlDraft.value = dataset.value?.sql ?? "";
66
+ resetPreview();
67
+ runDescribe();
68
+ }, { immediate: true });
69
+ function onSqlChange(value) {
70
+ sqlDraft.value = value;
71
+ if (sqlTimer) clearTimeout(sqlTimer);
72
+ sqlTimer = setTimeout(() => {
73
+ props.hub.updateDataset(props.datasetId, { sql: value });
74
+ runDescribe();
75
+ }, 280);
76
+ }
77
+ onBeforeUnmount(() => {
78
+ if (sqlTimer) clearTimeout(sqlTimer);
79
+ });
80
+ async function runDescribe() {
81
+ const seq = ++describeSeq;
82
+ if (!sqlDraft.value.trim()) {
83
+ describeError.value = "";
84
+ props.hub.updateDataset(props.datasetId, { fields: void 0 });
85
+ return;
86
+ }
87
+ describing.value = true;
88
+ const result = await props.hub.describeDataset(props.datasetId);
89
+ if (seq !== describeSeq) return;
90
+ describing.value = false;
91
+ describeError.value = result.ok ? "" : result.error.message;
92
+ }
93
+ const paramRows = computed(() => {
94
+ const current = dataset.value;
95
+ if (!current || !current.sql.trim()) return [];
96
+ return buildParamDefs(current.sql, current.paramOverrides);
97
+ });
98
+ const schemaRows = computed(() => {
99
+ const current = dataset.value;
100
+ if (!current) return [];
101
+ return (current.fields ?? []).map((field) => ({
102
+ ...field,
103
+ label: current.fieldOverrides?.[field.name]?.label ?? field.label
104
+ }));
105
+ });
106
+ async function runPreview() {
107
+ previewing.value = true;
108
+ previewError.value = "";
109
+ const result = await props.hub.previewDataset(props.datasetId);
110
+ previewing.value = false;
111
+ if (result.ok) {
112
+ previewRows.value = result.data.rows;
113
+ previewFields.value = result.data.fields;
114
+ } else {
115
+ previewRows.value = [];
116
+ previewError.value = result.error.message;
117
+ }
118
+ }
119
+ watch(detailTab, (tab) => {
120
+ if (tab === "preview") runPreview();
121
+ });
122
+ const paramColumns = defineTableColumns([
123
+ {
124
+ key: "id",
125
+ name: "参数名",
126
+ minWidth: 100
127
+ },
128
+ {
129
+ key: "label",
130
+ name: "显示名",
131
+ minWidth: 120
132
+ },
133
+ {
134
+ key: "type",
135
+ name: "类型",
136
+ width: 120
137
+ },
138
+ {
139
+ key: "defaultValue",
140
+ name: "默认值",
141
+ minWidth: 140
142
+ },
143
+ {
144
+ key: "options",
145
+ name: "选项(select)",
146
+ minWidth: 160
147
+ }
148
+ ]);
149
+ const schemaColumns = defineTableColumns([
150
+ {
151
+ key: "name",
152
+ name: "字段名(name)",
153
+ minWidth: 140
154
+ },
155
+ {
156
+ key: "label",
157
+ name: "中文描述(label)",
158
+ minWidth: 160
159
+ },
160
+ {
161
+ key: "type",
162
+ name: "类型",
163
+ width: 88
164
+ }
165
+ ]);
166
+ const previewColumns = computed(() => defineTableColumns(previewFields.value.map((field) => ({
167
+ key: field.name,
168
+ name: field.label,
169
+ minWidth: field.type === "number" ? 88 : 112
170
+ }))));
171
+ function fieldTypeColor(type) {
172
+ if (type === "number") return "success";
173
+ if (type === "date") return "warning";
174
+ return "info";
175
+ }
176
+ function formatDefaultValue(value) {
177
+ if (Array.isArray(value)) return value.join(", ");
178
+ return String(value ?? "");
179
+ }
180
+ function formatOptions(options) {
181
+ if (!options?.length) return "";
182
+ return options.map((item) => `${item.label}|${item.value}`).join(",");
183
+ }
184
+ function parseOptions(raw) {
185
+ return raw.split(",").map((part) => part.trim()).filter(Boolean).map((part) => {
186
+ const [label, value] = part.split("|");
187
+ const text = (label ?? "").trim();
188
+ return {
189
+ label: text,
190
+ value: (value ?? text).trim()
191
+ };
192
+ });
193
+ }
194
+ function patchDataset(patch) {
195
+ props.hub.updateDataset(props.datasetId, patch);
196
+ }
197
+ function patchParam(paramId, patch) {
198
+ const current = dataset.value;
199
+ if (!current) return;
200
+ patchDataset({ paramOverrides: {
201
+ ...current.paramOverrides,
202
+ [paramId]: {
203
+ ...current.paramOverrides?.[paramId],
204
+ ...patch
205
+ }
206
+ } });
207
+ }
208
+ function patchFieldLabel(fieldName, label) {
209
+ const current = dataset.value;
210
+ if (!current) return;
211
+ patchDataset({ fieldOverrides: {
212
+ ...current.fieldOverrides,
213
+ [fieldName]: {
214
+ ...current.fieldOverrides?.[fieldName],
215
+ label
216
+ }
217
+ } });
218
+ }
219
+ return (_ctx, _cache) => {
220
+ return dataset.value ? (openBlock(), createElementBlock("section", {
221
+ key: 0,
222
+ class: normalizeClass(unref(cls).b)
223
+ }, [
224
+ createElementVNode("div", { class: normalizeClass(unref(cls).e("head")) }, [createElementVNode("div", { class: normalizeClass(unref(cls).e("rename")) }, [createElementVNode("span", { class: normalizeClass(unref(cls).e("label")) }, "数据集名称", 2), createVNode(unref(UInput), {
225
+ "model-value": dataset.value.label,
226
+ size: "small",
227
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = (v) => patchDataset({ label: String(v ?? "") }))
228
+ }, null, 8, ["model-value"])], 2), createVNode(unref(UPopConfirm), {
229
+ title: "确定删除该数据集?",
230
+ onConfirm: _cache[1] || (_cache[1] = ($event) => emit("remove"))
231
+ }, {
232
+ reference: withCtx(() => [createVNode(unref(UButton), {
233
+ size: "small",
234
+ type: "danger",
235
+ plain: ""
236
+ }, {
237
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode("删除数据集", -1)])]),
238
+ _: 1
239
+ })]),
240
+ _: 1
241
+ })], 2),
242
+ createElementVNode("div", { class: normalizeClass(unref(cls).e("sql")) }, [
243
+ createElementVNode("p", { class: normalizeClass(unref(cls).e("section-title")) }, "SQL 查询", 2),
244
+ createVNode(unref(UCodeEditor), {
245
+ modelValue: sqlDraft.value,
246
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => sqlDraft.value = $event),
247
+ lang: "sql",
248
+ langs: ["sql"],
249
+ "default-lines": 6,
250
+ onChange: onSqlChange
251
+ }, null, 8, ["modelValue"]),
252
+ describeError.value ? (openBlock(), createElementBlock("p", {
253
+ key: 0,
254
+ class: normalizeClass(unref(cls).e("sql-error")),
255
+ role: "alert"
256
+ }, toDisplayString(describeError.value), 3)) : createCommentVNode("v-if", true)
257
+ ], 2),
258
+ paramRows.value.length ? (openBlock(), createElementBlock("div", {
259
+ key: 0,
260
+ class: normalizeClass(unref(cls).e("params"))
261
+ }, [createElementVNode("p", { class: normalizeClass(unref(cls).e("section-title")) }, "查询参数(从 SQL 自动提取)", 2), createVNode(unref(UTable), {
262
+ class: normalizeClass(unref(cls).e("param-table")),
263
+ data: paramRows.value,
264
+ columns: unref(paramColumns),
265
+ border: "",
266
+ "text-ellipsis": ""
267
+ }, {
268
+ "column:label": withCtx(({ rowData }) => [createVNode(unref(UInput), {
269
+ "model-value": rowData.label,
270
+ size: "small",
271
+ "onUpdate:modelValue": (v) => patchParam(rowData.id, { label: String(v ?? "") })
272
+ }, null, 8, ["model-value", "onUpdate:modelValue"])]),
273
+ "column:type": withCtx(({ rowData }) => [createVNode(unref(USelect), {
274
+ "model-value": rowData.type,
275
+ size: "small",
276
+ options: paramTypeOptions,
277
+ "onUpdate:modelValue": (v) => patchParam(rowData.id, { type: v })
278
+ }, null, 8, ["model-value", "onUpdate:modelValue"])]),
279
+ "column:defaultValue": withCtx(({ rowData }) => [rowData.type === "number" ? (openBlock(), createBlock(unref(UInput), {
280
+ key: 0,
281
+ "model-value": String(rowData.defaultValue ?? ""),
282
+ size: "small",
283
+ type: "number",
284
+ "onUpdate:modelValue": (v) => patchParam(rowData.id, { defaultValue: Number(v) })
285
+ }, null, 8, ["model-value", "onUpdate:modelValue"])) : rowData.type === "date" ? (openBlock(), createBlock(unref(UInput), {
286
+ key: 1,
287
+ "model-value": String(rowData.defaultValue ?? ""),
288
+ size: "small",
289
+ type: "date",
290
+ "onUpdate:modelValue": (v) => patchParam(rowData.id, { defaultValue: v })
291
+ }, null, 8, ["model-value", "onUpdate:modelValue"])) : rowData.type === "select" ? (openBlock(), createBlock(unref(USelect), {
292
+ key: 2,
293
+ "model-value": String(rowData.defaultValue ?? ""),
294
+ size: "small",
295
+ options: rowData.options ?? [],
296
+ "onUpdate:modelValue": (v) => patchParam(rowData.id, { defaultValue: v })
297
+ }, null, 8, [
298
+ "model-value",
299
+ "options",
300
+ "onUpdate:modelValue"
301
+ ])) : (openBlock(), createBlock(unref(UInput), {
302
+ key: 3,
303
+ "model-value": formatDefaultValue(rowData.defaultValue),
304
+ size: "small",
305
+ "onUpdate:modelValue": (v) => patchParam(rowData.id, { defaultValue: v })
306
+ }, null, 8, ["model-value", "onUpdate:modelValue"]))]),
307
+ "column:options": withCtx(({ rowData }) => [rowData.type === "select" ? (openBlock(), createBlock(unref(UInput), {
308
+ key: 0,
309
+ "model-value": formatOptions(rowData.options),
310
+ size: "small",
311
+ placeholder: "华东|华东,华南|华南",
312
+ "onUpdate:modelValue": (v) => patchParam(rowData.id, { options: parseOptions(String(v ?? "")) })
313
+ }, null, 8, ["model-value", "onUpdate:modelValue"])) : (openBlock(), createElementBlock("span", {
314
+ key: 1,
315
+ class: normalizeClass(unref(cls).e("muted"))
316
+ }, "—", 2))]),
317
+ _: 1
318
+ }, 8, [
319
+ "class",
320
+ "data",
321
+ "columns"
322
+ ])], 2)) : createCommentVNode("v-if", true),
323
+ createVNode(unref(UTabs), {
324
+ modelValue: detailTab.value,
325
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => detailTab.value = $event),
326
+ items: detailTabItems,
327
+ class: normalizeClass(unref(cls).e("tabs"))
328
+ }, {
329
+ schema: withCtx(() => [describing.value ? (openBlock(), createElementBlock("p", {
330
+ key: 0,
331
+ class: normalizeClass(unref(cls).e("muted"))
332
+ }, "正在解析字段…", 2)) : (openBlock(), createBlock(unref(UTable), {
333
+ key: 1,
334
+ class: normalizeClass(unref(cls).e("schema-table")),
335
+ data: schemaRows.value,
336
+ columns: unref(schemaColumns),
337
+ border: "",
338
+ "text-ellipsis": ""
339
+ }, {
340
+ "column:label": withCtx(({ rowData }) => [createVNode(unref(UInput), {
341
+ "model-value": rowData.label,
342
+ size: "small",
343
+ placeholder: "中文显示名",
344
+ "onUpdate:modelValue": (v) => patchFieldLabel(rowData.name, String(v ?? ""))
345
+ }, null, 8, ["model-value", "onUpdate:modelValue"])]),
346
+ "column:type": withCtx(({ rowData }) => [createVNode(unref(UTag), {
347
+ size: "small",
348
+ type: fieldTypeColor(rowData.type)
349
+ }, {
350
+ default: withCtx(() => [createTextVNode(toDisplayString(rowData.type), 1)]),
351
+ _: 2
352
+ }, 1032, ["type"])]),
353
+ _: 1
354
+ }, 8, [
355
+ "class",
356
+ "data",
357
+ "columns"
358
+ ]))]),
359
+ preview: withCtx(() => [
360
+ createElementVNode("div", { class: normalizeClass(unref(cls).e("preview-actions")) }, [createVNode(unref(UButton), {
361
+ size: "small",
362
+ plain: "",
363
+ loading: previewing.value,
364
+ onClick: runPreview
365
+ }, {
366
+ default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode(" 刷新预览(按参数默认值取数) ", -1)])]),
367
+ _: 1
368
+ }, 8, ["loading"])], 2),
369
+ createVNode(unref(UTable), {
370
+ class: normalizeClass(unref(cls).e("preview-table")),
371
+ data: previewRows.value,
372
+ columns: previewColumns.value,
373
+ "show-index": "",
374
+ border: "",
375
+ "text-ellipsis": ""
376
+ }, null, 8, [
377
+ "class",
378
+ "data",
379
+ "columns"
380
+ ]),
381
+ previewError.value ? (openBlock(), createElementBlock("p", {
382
+ key: 0,
383
+ class: normalizeClass(unref(cls).e("preview-error")),
384
+ role: "alert"
385
+ }, toDisplayString(previewError.value), 3)) : createCommentVNode("v-if", true)
386
+ ]),
387
+ _: 1
388
+ }, 8, ["modelValue", "class"])
389
+ ], 2)) : createCommentVNode("v-if", true);
390
+ };
391
+ }
392
+ });
393
+ //#endregion
394
+ export { _sfc_main as default };