@shwfed/config 2.3.11 → 2.3.12

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 (91) hide show
  1. package/dist/mcp.mjs +664 -525
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/{config-DNokxY7M.js → config-B-1L3Ra-.js} +1 -1
  4. package/dist/preview/assets/{config-_uPI8qV-.js → config-Cf5kO84H.js} +1 -1
  5. package/dist/preview/assets/{config-Bp91DUdU.js → config-DTQkLHVw.js} +1 -1
  6. package/dist/preview/assets/{config-_msO_f2R.js → config-DqxN0Byp.js} +1 -1
  7. package/dist/preview/assets/{config-BZahzuEc.js → config-QUQ71Eo6.js} +1 -1
  8. package/dist/preview/assets/{config-BnZQO-Sp.js → config-oO93sSer.js} +1 -1
  9. package/dist/preview/assets/{config-Be-2ZA2R.js → config-sJ5XKUJy.js} +1 -1
  10. package/dist/preview/assets/{config-57-v4VXo.js → config-zCMkbPQt.js} +1 -1
  11. package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-BtScXbs1.js → definition.vue_vue_type_script_setup_true_lang-D-OVRv68.js} +1 -1
  12. package/dist/preview/assets/index-Br_eXThF.css +1 -0
  13. package/dist/preview/assets/index-D8QyOVfp.js +637 -0
  14. package/dist/preview/assets/index-b_t8yWJJ.js +1 -0
  15. package/dist/preview/assets/{runtime-BBms4myv.js → runtime-10_7L7Gz.js} +1 -1
  16. package/dist/preview/assets/{runtime-cKWSGFod.js → runtime-B2EP6060.js} +1 -1
  17. package/dist/preview/assets/{runtime-B9u14qqB.js → runtime-BxlgShjU.js} +1 -1
  18. package/dist/preview/assets/{runtime-Dk9u-Ybw.js → runtime-Cv2doZNu.js} +1 -1
  19. package/dist/preview/assets/{runtime-XXqIAt53.js → runtime-CzDUrqSa.js} +1 -1
  20. package/dist/preview/assets/{runtime-CfR7ZAND.js → runtime-DcYhXvSk.js} +1 -1
  21. package/dist/preview/assets/{runtime-w7V-p3t1.js → runtime-DlDhRVII.js} +1 -1
  22. package/dist/preview/assets/{runtime-D3EyeiyA.js → runtime-cmkN6aik.js} +1 -1
  23. package/dist/preview/index.html +2 -2
  24. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +1 -1
  25. package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/schema.d.ts +4 -0
  26. package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/schema.js +6 -17
  27. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +18 -18
  28. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +18 -18
  29. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.d.vue.ts +4 -4
  30. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue.d.ts +4 -4
  31. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +22 -22
  32. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +22 -22
  33. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.d.vue.ts +2 -2
  34. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.vue.d.ts +2 -2
  35. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.d.vue.ts +4 -4
  36. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.vue.d.ts +4 -4
  37. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.d.vue.ts +12 -12
  38. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue.d.ts +12 -12
  39. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.d.vue.ts +10 -10
  40. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.vue.d.ts +10 -10
  41. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.d.vue.ts +12 -12
  42. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.vue.d.ts +12 -12
  43. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.d.vue.ts +133 -0
  44. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue +605 -0
  45. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue.d.ts +133 -0
  46. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.d.vue.ts +8 -0
  47. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.vue +324 -0
  48. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.vue.d.ts +8 -0
  49. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/schema.d.ts +99 -0
  50. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/schema.js +129 -0
  51. package/dist/runtime/components/form/unit-config.vue +0 -23
  52. package/dist/runtime/components/table/config.d.vue.ts +2 -2
  53. package/dist/runtime/components/table/config.vue +5 -45
  54. package/dist/runtime/components/table/config.vue.d.ts +2 -2
  55. package/dist/runtime/components/table/schema.d.ts +9 -2
  56. package/dist/runtime/components/table/schema.js +30 -14
  57. package/dist/runtime/components/ui/date-range-picker/DateRangePickerDateTimePanel.d.vue.ts +1 -1
  58. package/dist/runtime/components/ui/date-range-picker/DateRangePickerDateTimePanel.vue.d.ts +1 -1
  59. package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.d.vue.ts +1 -1
  60. package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.vue.d.ts +1 -1
  61. package/dist/runtime/components/ui/tree/Tree.d.vue.ts +57 -0
  62. package/dist/runtime/components/ui/tree/Tree.vue +325 -0
  63. package/dist/runtime/components/ui/tree/Tree.vue.d.ts +57 -0
  64. package/dist/runtime/components/ui/tree/TreeNode.d.vue.ts +53 -0
  65. package/dist/runtime/components/ui/tree/TreeNode.vue +299 -0
  66. package/dist/runtime/components/ui/tree/TreeNode.vue.d.ts +53 -0
  67. package/dist/runtime/components/ui/tree/index.d.ts +3 -0
  68. package/dist/runtime/components/ui/tree/index.js +2 -0
  69. package/dist/runtime/components/ui/tree/types.d.ts +120 -0
  70. package/dist/runtime/components/ui/tree/types.js +0 -0
  71. package/dist/runtime/components/ui/tree/useTreeState.d.ts +95 -0
  72. package/dist/runtime/components/ui/tree/useTreeState.js +369 -0
  73. package/dist/runtime/shims.d.ts +2 -0
  74. package/package.json +1 -1
  75. package/dist/preview/assets/index-DDbl2Atj.js +0 -1
  76. package/dist/preview/assets/index-DGa3Oj3y.js +0 -1075
  77. package/dist/preview/assets/index-mbGtsgdv.css +0 -1
  78. package/dist/runtime/components/form/ai/fields-button.d.vue.ts +0 -13
  79. package/dist/runtime/components/form/ai/fields-button.vue +0 -460
  80. package/dist/runtime/components/form/ai/fields-button.vue.d.ts +0 -13
  81. package/dist/runtime/components/form/ai/fields-task.md +0 -71
  82. package/dist/runtime/components/table/ai/columns-button.d.vue.ts +0 -12
  83. package/dist/runtime/components/table/ai/columns-button.vue +0 -492
  84. package/dist/runtime/components/table/ai/columns-button.vue.d.ts +0 -12
  85. package/dist/runtime/components/table/ai/columns-task.md +0 -53
  86. package/dist/runtime/components/table/ai/data-source-button.d.vue.ts +0 -20
  87. package/dist/runtime/components/table/ai/data-source-button.vue +0 -324
  88. package/dist/runtime/components/table/ai/data-source-button.vue.d.ts +0 -20
  89. package/dist/runtime/components/table/ai/data-source-task.md +0 -17
  90. package/dist/runtime/utils/ai/cel-prompt.d.ts +0 -11
  91. package/dist/runtime/utils/ai/cel-prompt.js +0 -27
@@ -0,0 +1,129 @@
1
+ import { Schema } from "effect";
2
+ import { Expression, LocaleMarkdown } from "../../../../../share/expression.js";
3
+ import { Locale } from "../../../../../share/locale.js";
4
+ import { DataSource } from "../../../../table/schema.js";
5
+ import { commonFieldFields, derivedField } from "../../../utils/common.js";
6
+ export const type = "com.shwfed.form.field.tree.multi";
7
+ export const compatibilityDate = "2026-05-23";
8
+ export const metadata = {
9
+ name: "\u6811\uFF08\u591A\u9009\uFF09",
10
+ icon: "fluent:tree-evergreen-20-regular",
11
+ w: { initial: 8, min: 4, max: Infinity },
12
+ h: { initial: 8, min: 4, max: Infinity, grow: true }
13
+ };
14
+ export function schema(configure) {
15
+ const CelBool = Expression({ configure, resultType: "bool" });
16
+ const nodeConfigure = (env) => {
17
+ configure(env);
18
+ env.registerVariable("node", "dyn", { description: "\u5F53\u524D\u8282\u70B9\uFF1B\u7531 `\u6570\u636E` \u8868\u8FBE\u5F0F\u8FD4\u56DE\u7684\u6BCF\u4E00\u9879" });
19
+ };
20
+ const CelNodeKey = Expression({
21
+ configure: nodeConfigure,
22
+ resultType: (t) => t === "string" || t === "number" || t === "dyn"
23
+ });
24
+ const CelNodeChildren = Expression({
25
+ configure: nodeConfigure,
26
+ // Accept lists, optional lists, and `dyn` — CEL infers an empty literal
27
+ // such as `[]` as `list<dyn>` which a strict `list<dyn>` predicate would
28
+ // accept, but a configured expression like `has(node.kids) ? node.kids :
29
+ // null` lands on `dyn` once one branch is `null`. The looser predicate
30
+ // mirrors the table's `data` expression.
31
+ resultType: (t) => t === "dyn" || t.startsWith("list") || t.startsWith("optional")
32
+ });
33
+ const CelNodeBool = Expression({ configure: nodeConfigure, resultType: "bool" });
34
+ const NodeLocaleMd = LocaleMarkdown({ configure: nodeConfigure });
35
+ const CelKeywords = Expression({
36
+ configure: nodeConfigure,
37
+ // Empty list literals (`[]`) check as `list<dyn>`, and a
38
+ // `node.?keywords` access lands on `optional<dyn>` — accept either by
39
+ // sharing the same loose predicate the data expression uses.
40
+ resultType: (t) => t === "dyn" || t.startsWith("list") || t.startsWith("optional")
41
+ });
42
+ return Schema.Struct({
43
+ type: Schema.Literal(type),
44
+ compatibilityDate: Schema.Literal(compatibilityDate),
45
+ ...commonFieldFields(configure),
46
+ label: Schema.optional(Locale.annotations({
47
+ title: "\u6807\u7B7E",
48
+ description: "\u5B57\u6BB5\u524D\u5C55\u793A\u7684\u6587\u672C\uFF1B\u7559\u7A7A\u5219\u4E0D\u6E32\u67D3\u6807\u7B7E"
49
+ })),
50
+ tooltip: Schema.optional(Locale.annotations({
51
+ title: "\u63D0\u793A",
52
+ description: "\u9F20\u6807\u60AC\u505C\u5728\u6807\u7B7E\u4E0A\u65F6\u5C55\u793A\u7684\u8BF4\u660E"
53
+ })),
54
+ binding: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
55
+ title: "\u7ED1\u5B9A\u8DEF\u5F84",
56
+ description: "\u5199\u5165\u8868\u5355\u72B6\u6001\u7684 `dot-prop` \u8DEF\u5F84\uFF1B\u5199\u5165\u503C\u4E3A\u5DF2\u52FE\u9009\u8282\u70B9 ID \u7684\u6570\u7EC4\uFF1B\u7559\u7A7A\u5219\u4E3A\u975E\u53D7\u63A7\u5B57\u6BB5"
57
+ })),
58
+ disabled: Schema.optional(CelBool.annotations({
59
+ title: "\u7981\u7528\u6761\u4EF6",
60
+ description: "\u8FD4\u56DE `true` \u65F6\u4ECD\u6E32\u67D3\u4F46\u4E0D\u53EF\u52FE\u9009"
61
+ })),
62
+ readonly: Schema.optional(CelBool.annotations({
63
+ title: "\u53EA\u8BFB\u6761\u4EF6",
64
+ description: "\u8FD4\u56DE `true` \u65F6\u4EC5\u4EE5\u7EAF\u6587\u672C\u5C55\u793A\u5F53\u524D\u5DF2\u52FE\u9009\u8282\u70B9\u7684\u6807\u7B7E"
65
+ })),
66
+ derived: derivedField(configure, "dyn"),
67
+ dataSource: DataSource(configure).annotations({
68
+ title: "\u6570\u636E\u6E90",
69
+ description: "\u8FD4\u56DE\u5B8C\u6574\u6811\uFF08\u6839\u8282\u70B9\u5217\u8868\uFF09\u7684\u6570\u636E\u6E90\uFF1B\u6811\u901A\u8FC7 `\u8282\u70B9\u5B50\u7EA7` \u8868\u8FBE\u5F0F\u9010\u5C42\u5411\u4E0B\u8BFB\u53D6\u5B50\u7EA7"
70
+ }),
71
+ nodeKey: CelNodeKey.annotations({
72
+ title: "\u8282\u70B9 ID",
73
+ description: "\u4E3A\u6BCF\u4E2A\u8282\u70B9\u8BA1\u7B97\u7A33\u5B9A\u552F\u4E00 ID \u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u8BBF\u95EE `node`\uFF1B\u8FD0\u884C\u65F6\u4EE5\u5B57\u7B26\u4E32\u5F62\u5F0F\u5B58\u50A8"
74
+ }),
75
+ nodeChildren: CelNodeChildren.annotations({
76
+ title: "\u8282\u70B9\u5B50\u7EA7",
77
+ description: "\u8FD4\u56DE\u5F53\u524D\u8282\u70B9\u7684\u5B50\u7EA7\u5217\u8868\u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u8FD4\u56DE `none` / `null` \u89C6\u4E3A\u53F6\u5B50\u8282\u70B9"
78
+ }),
79
+ nodeLabel: NodeLocaleMd.annotations({
80
+ title: "\u8282\u70B9\u6807\u7B7E",
81
+ description: "\u8282\u70B9\u5C55\u793A\u7684\u672C\u5730\u5316\u6587\u672C\uFF0C\u652F\u6301 Markdown \u4E0E `{{ node.foo }}` / `{{ form.foo }}` \u63D2\u503C"
82
+ }),
83
+ nodeTooltip: Schema.optional(NodeLocaleMd.annotations({
84
+ title: "\u8282\u70B9\u63D0\u793A",
85
+ description: "\u9F20\u6807\u60AC\u505C\u5728\u8282\u70B9\u4E0A\u65F6\u5C55\u793A\u7684\u672C\u5730\u5316\u63D0\u793A\uFF0C\u652F\u6301 Markdown \u4E0E\u63D2\u503C"
86
+ })),
87
+ nodeSelectable: Schema.optional(CelNodeBool.annotations({
88
+ title: "\u8282\u70B9\u53EF\u9009\u6761\u4EF6",
89
+ description: "\u8FD4\u56DE `true` \u8868\u793A\u8BE5\u8282\u70B9\u53EF\u88AB\u52FE\u9009\uFF1B\u7EA7\u8054\u9009\u62E9\u4ECD\u5C0A\u91CD\u8BE5\u6761\u4EF6"
90
+ })),
91
+ cascade: Schema.optionalWith(Schema.Literal("independent", "cascade-down", "cascade-both"), {
92
+ default: () => "cascade-both"
93
+ }).annotations({
94
+ title: "\u7EA7\u8054\u6A21\u5F0F",
95
+ description: "`\u72EC\u7ACB`\uFF1A\u4EC5\u52FE\u9009\u5F53\u524D\u8282\u70B9\uFF1B`\u5411\u4E0B\u7EA7\u8054`\uFF1A\u52FE\u9009\u7236\u8282\u70B9\u540C\u65F6\u52FE\u9009\u6240\u6709\u53EF\u9009\u540E\u4EE3\uFF1B`\u53CC\u5411\u7EA7\u8054`\uFF1A\u5728\u5411\u4E0B\u7EA7\u8054\u57FA\u7840\u4E0A\uFF0C\u7236\u8282\u70B9\u53CD\u6620\u540E\u4EE3\u52FE\u9009\u72B6\u6001\uFF08\u90E8\u5206\u9009\u4E2D\u663E\u793A\u4E3A\u534A\u9009\uFF09"
96
+ }),
97
+ expandAll: Schema.optionalWith(Schema.Boolean, { default: () => false }).annotations({
98
+ title: "\u9ED8\u8BA4\u5168\u90E8\u5C55\u5F00",
99
+ description: "\u5F00\u542F\u540E\u6302\u8F7D\u65F6\u5C55\u5F00\u6240\u6709\u975E\u53F6\u5B50\u8282\u70B9"
100
+ }),
101
+ filter: Schema.optional(Schema.Struct({
102
+ enabled: Schema.Boolean.annotations({ title: "\u542F\u7528", description: "\u662F\u5426\u5728\u6811\u4E0A\u65B9\u663E\u793A\u641C\u7D22\u8F93\u5165\u6846" }),
103
+ label: Schema.optional(Locale.annotations({
104
+ title: "\u6807\u7B7E",
105
+ description: "\u641C\u7D22\u8F93\u5165\u6846\u7684\u6D6E\u52A8\u6807\u7B7E\uFF1B\u7559\u7A7A\u5219\u4F7F\u7528\u9ED8\u8BA4\u503C\u300C\u641C\u7D22\u300D"
106
+ })),
107
+ keywords: Schema.optional(CelKeywords.annotations({
108
+ title: "\u989D\u5916\u5173\u952E\u8BCD",
109
+ description: "\u8FD4\u56DE\u5B57\u7B26\u4E32\u5217\u8868\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u8BBF\u95EE `node`\uFF1B\u5339\u914D\u89C4\u5219\u4E3A\u300C\u8282\u70B9\u6807\u7B7E \u6216 \u4EFB\u4E00\u5173\u952E\u8BCD\u300D\u5305\u542B\u641C\u7D22\u8BCD\uFF08\u4E0D\u533A\u5206\u5927\u5C0F\u5199\uFF09"
110
+ }))
111
+ }).annotations({
112
+ title: "\u8FC7\u6EE4",
113
+ description: "\u5BA2\u6237\u7AEF\u8FC7\u6EE4\uFF1B\u8FC7\u6EE4\u4E0D\u4F1A\u5F71\u54CD\u5DF2\u9009\u4E2D\u7684\u8282\u70B9 ID"
114
+ }))
115
+ }).annotations({
116
+ title: "TreeMultiField",
117
+ description: "\u57FA\u4E8E\u6811\u5F62\u6570\u636E\u7684\u591A\u9009\u8F93\u5165"
118
+ });
119
+ }
120
+ export function defaults() {
121
+ return {
122
+ dataSource: { data: "[]" },
123
+ nodeKey: "string(node.id)",
124
+ nodeChildren: "has(node.children) ? node.children : null",
125
+ nodeLabel: [{ locale: "zh", message: "{{ node.label }}" }],
126
+ cascade: "cascade-both",
127
+ expandAll: false
128
+ };
129
+ }
@@ -21,7 +21,6 @@ import { Button } from "../ui/button";
21
21
  import { ScrollArea } from "../ui/scroll-area";
22
22
  import { Separator } from "../ui/separator";
23
23
  import { FIELDS, findField } from "./utils/resolve";
24
- import ShwfedFormAiFieldsButton from "./ai/fields-button.vue";
25
24
  defineOptions({ name: "ShwfedFormUnitConfig" });
26
25
  const unit = defineModel({ type: Object, ...{ required: true } });
27
26
  const selection = defineModel("selection", { type: Object, ...{
@@ -177,16 +176,6 @@ function removeFields(ids) {
177
176
  stack.value = stack.value.slice(0, -1);
178
177
  }
179
178
  }
180
- function applyAiFields(generated) {
181
- const valid = generated.filter(
182
- (f) => !!findField(f.type, f.compatibilityDate)
183
- );
184
- if (valid.length === 0) return;
185
- unit.value = {
186
- ...unit.value,
187
- fields: [...unit.value.fields, ...valid]
188
- };
189
- }
190
179
  function updateActiveField(next) {
191
180
  const id = activeFieldId.value;
192
181
  if (!id) return;
@@ -330,12 +319,6 @@ function isExtraActive(id) {
330
319
  </button>
331
320
  </div>
332
321
  </ScrollArea>
333
-
334
- <ShwfedFormAiFieldsButton
335
- :configure="configure"
336
- :fields="unit.fields"
337
- @apply="applyAiFields"
338
- />
339
322
  </template>
340
323
  </Teleport>
341
324
 
@@ -413,12 +396,6 @@ function isExtraActive(id) {
413
396
  </button>
414
397
  </div>
415
398
  </ScrollArea>
416
-
417
- <ShwfedFormAiFieldsButton
418
- :configure="configure"
419
- :fields="unit.fields"
420
- @apply="applyAiFields"
421
- />
422
399
  </template>
423
400
  </div>
424
401
 
@@ -9,9 +9,9 @@ type __VLS_ModelProps = {
9
9
  modelValue: AnyRecord;
10
10
  };
11
11
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
12
- declare var __VLS_232: {};
12
+ declare var __VLS_219: {};
13
13
  type __VLS_Slots = {} & {
14
- 'general-extra'?: (props: typeof __VLS_232) => any;
14
+ 'general-extra'?: (props: typeof __VLS_219) => any;
15
15
  };
16
16
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
17
  "update:modelValue": (value: AnyRecord) => any;
@@ -5,7 +5,7 @@ import { BREADCRUMB_EXTENSION_KEY } from "../config/breadcrumb-extension";
5
5
  import { TABLE_COLUMN_LAYOUT_KEY } from "./column-layout";
6
6
  import { Icon } from "@iconify/vue";
7
7
  import { ParseResult, Schema } from "effect";
8
- import { TableConfig, Pagination, ColumnGroup, DataSource, metadata as tableMetadata } from "./schema";
8
+ import { TableConfig, Pagination, ColumnGroup, tableDataSource, metadata as tableMetadata } from "./schema";
9
9
  import { COLUMNS, findColumn as findColumnEntry } from "./utils/resolve";
10
10
  import {
11
11
  useTreeDnd
@@ -34,8 +34,6 @@ import {
34
34
  import ActionsConfigEditor from "../actions/config.vue";
35
35
  import ShwfedFormConfig from "../form/config.vue";
36
36
  import { defaultFormConfig } from "../form/schema";
37
- import TableAiColumnsButton from "./ai/columns-button.vue";
38
- import TableAiDataSourceButton from "./ai/data-source-button.vue";
39
37
  import { Environment } from "../../vendor/cel-js/lib/index";
40
38
  defineOptions({ name: "ShwfedTableConfig" });
41
39
  const RowKeyCELContext = defineComponent({
@@ -168,7 +166,7 @@ function configureTableQuery(env) {
168
166
  configure(env);
169
167
  }
170
168
  const tableConfigSchema = TableConfig(configure);
171
- const dataSourceSchema = DataSource(configure);
169
+ const dataSourceSchema = tableDataSource(configure);
172
170
  const pickerEntries = computed(() => COLUMNS.filter((e) => !e.deprecated));
173
171
  const advertisedHostContext = (() => {
174
172
  const probe = new Environment({ unlistedVariablesAreDyn: false });
@@ -925,30 +923,6 @@ function setDataSourceField(key, value) {
925
923
  ds[key] = value;
926
924
  writeGeneralPatch({ dataSource: ds });
927
925
  }
928
- function applyAiDataSource(value) {
929
- const cur = readGeneral();
930
- const ds = { ...cur.dataSource ?? {} };
931
- if (value.data !== void 0) ds.data = value.data;
932
- if (value.request !== void 0) {
933
- if (value.request) ds.request = value.request;
934
- else delete ds.request;
935
- }
936
- if (value.total !== void 0) {
937
- if (value.total) ds.total = value.total;
938
- else delete ds.total;
939
- }
940
- writeGeneralPatch({ dataSource: ds });
941
- }
942
- function applyAiColumns(value) {
943
- const next = value.filter(
944
- (c) => c?.type !== "com.shwfed.table.column.actions" && findColumnEntry(c?.type, c?.compatibilityDate)
945
- );
946
- const w = snapshot();
947
- w.columns = next;
948
- reconcilePinningW(w);
949
- commit(w);
950
- resolveSelection();
951
- }
952
926
  function updateDataSourceOptional(key, value) {
953
927
  const cur = readGeneral();
954
928
  const { [key]: _omit, ...rest } = cur.dataSource ?? {};
@@ -1242,13 +1216,6 @@ const tableQueryValue = computed({
1242
1216
  </CommandItem>
1243
1217
  </CommandGroup>
1244
1218
  </InputGroupCombobox>
1245
- <InputGroupAddon align="inline-end">
1246
- <TableAiColumnsButton
1247
- :data-source="editingGeneralConfig.dataSource"
1248
- :columns="editingColumns"
1249
- @apply="applyAiColumns"
1250
- />
1251
- </InputGroupAddon>
1252
1219
  </InputGroup>
1253
1220
  </div>
1254
1221
  </div>
@@ -1320,16 +1287,9 @@ const tableQueryValue = computed({
1320
1287
  <slot name="general-extra" />
1321
1288
 
1322
1289
  <template v-if="!hideDataSource">
1323
- <div class="flex items-center gap-2">
1324
- <h3 class="text-xs font-medium text-zinc-500">
1325
- {{ generalFieldTitle("dataSource") }}
1326
- </h3>
1327
- <TableAiDataSourceButton
1328
- :data-source="editingGeneralConfig.dataSource"
1329
- :columns="editingColumns"
1330
- @apply="applyAiDataSource"
1331
- />
1332
- </div>
1290
+ <h3 class="text-xs font-medium text-zinc-500">
1291
+ {{ generalFieldTitle("dataSource") }}
1292
+ </h3>
1333
1293
 
1334
1294
  <div class="space-y-4">
1335
1295
  <Field orientation="vertical">
@@ -9,9 +9,9 @@ type __VLS_ModelProps = {
9
9
  modelValue: AnyRecord;
10
10
  };
11
11
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
12
- declare var __VLS_232: {};
12
+ declare var __VLS_219: {};
13
13
  type __VLS_Slots = {} & {
14
- 'general-extra'?: (props: typeof __VLS_232) => any;
14
+ 'general-extra'?: (props: typeof __VLS_219) => any;
15
15
  };
16
16
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
17
  "update:modelValue": (value: AnyRecord) => any;
@@ -95,10 +95,17 @@ export declare const ColumnGroup: Schema.Struct<{
95
95
  message: Schema.SchemaClass<string, string, never>;
96
96
  }>]>>;
97
97
  }>;
98
- export declare function DataSource(configure: (env: Environment) => void): Schema.Struct<{
98
+ export declare function DataSource(configure: (env: Environment) => void, extras?: {
99
+ request?: (env: Environment) => void;
100
+ data?: (env: Environment) => void;
101
+ }): Schema.Struct<{
99
102
  request: Schema.optional<Schema.Schema<string, string, never>>;
100
103
  data: Schema.Schema<string, string, never>;
104
+ }>;
105
+ export declare function tableDataSource(configure: (env: Environment) => void): Schema.Struct<{
101
106
  total: Schema.optional<Schema.Schema<string, string, never>>;
107
+ request: Schema.optional<Schema.Schema<string, string, never>>;
108
+ data: Schema.Schema<string, string, never>;
102
109
  }>;
103
110
  export declare function TableConfig(configure: (env: Environment) => void): Schema.refine<{
104
111
  readonly style?: string | undefined;
@@ -295,9 +302,9 @@ export declare function TableConfig(configure: (env: Environment) => void): Sche
295
302
  default: () => never[];
296
303
  }>;
297
304
  dataSource: Schema.optional<Schema.Struct<{
305
+ total: Schema.optional<Schema.Schema<string, string, never>>;
298
306
  request: Schema.optional<Schema.Schema<string, string, never>>;
299
307
  data: Schema.Schema<string, string, never>;
300
- total: Schema.optional<Schema.Schema<string, string, never>>;
301
308
  }>>;
302
309
  actions: Schema.optional<Schema.Struct<{
303
310
  size: Schema.optionalWith<Schema.Literal<["default", "sm", "xs"]>, {
@@ -127,13 +127,11 @@ export const ColumnGroup = Schema.Struct({
127
127
  description: "\u5217\u5206\u7EC4\u5B9A\u4E49"
128
128
  });
129
129
  const QUERY_VAR_DESCRIPTION = "\u641C\u7D22\u6761\u4EF6\u5F53\u524D\u72B6\u6001\uFF1B\u672A\u914D\u7F6E\u641C\u7D22\u6761\u4EF6\u65F6\u4E3A\u7A7A\u5BF9\u8C61";
130
- export function DataSource(configure) {
130
+ export function DataSource(configure, extras) {
131
131
  const CelRequest = Expression({
132
132
  configure: (env) => {
133
133
  configure(env);
134
- env.registerVariable("pageIndex", "number", { description: "\u5F53\u524D\u9875\u7801\uFF08\u4ECE 0 \u5F00\u59CB\uFF09\uFF1B\u672A\u542F\u7528\u5206\u9875\u65F6\u4E3A 0" });
135
- env.registerVariable("pageSize", "number", { description: "\u6BCF\u9875\u884C\u6570\uFF1B\u672A\u542F\u7528\u5206\u9875\u65F6\u4E3A 0" });
136
- env.registerVariable("query", "dyn", { description: QUERY_VAR_DESCRIPTION });
134
+ extras?.request?.(env);
137
135
  },
138
136
  resultType: "HttpRequest"
139
137
  });
@@ -143,10 +141,35 @@ export function DataSource(configure) {
143
141
  env.registerVariable("json", "optional<dyn>", {
144
142
  description: "HTTP \u54CD\u5E94\u4F53\uFF08\u5DF2\u89E3\u6790 JSON\uFF09\uFF1B\u672A\u914D\u7F6E request \u65F6\u4E3A none"
145
143
  });
146
- env.registerVariable("query", "dyn", { description: QUERY_VAR_DESCRIPTION });
144
+ extras?.data?.(env);
147
145
  },
148
146
  resultType: (type) => type.startsWith("list") || type === "dyn" || type.startsWith("optional")
149
147
  });
148
+ return Schema.Struct({
149
+ request: Schema.optional(CelRequest).annotations({
150
+ title: "\u8BF7\u6C42",
151
+ description: "\u53EF\u9009\u7684 HTTP \u8BF7\u6C42\u8868\u8FBE\u5F0F\uFF1B\u672A\u914D\u7F6E\u65F6\u6570\u636E\u4ECE `data` \u8868\u8FBE\u5F0F\u4E2D\u8BFB\u53D6\uFF08\u901A\u5E38\u5F15\u7528\u4E0A\u4E0B\u6587\u53D8\u91CF\uFF09"
152
+ }),
153
+ data: CelRows.annotations({
154
+ title: "\u6570\u636E",
155
+ description: "\u8FD4\u56DE\u884C\u6570\u636E\u5217\u8868\uFF08`list<dyn>`\uFF09\u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u5728\u914D\u7F6E\u4E86 `request` \u65F6\u53EF\u901A\u8FC7 `json` \u5F15\u7528\u54CD\u5E94\u4F53"
156
+ })
157
+ }).annotations({
158
+ title: "DataSource",
159
+ description: "\u6570\u636E\u6E90\u914D\u7F6E"
160
+ });
161
+ }
162
+ export function tableDataSource(configure) {
163
+ const base = DataSource(configure, {
164
+ request: (env) => {
165
+ env.registerVariable("pageIndex", "number", { description: "\u5F53\u524D\u9875\u7801\uFF08\u4ECE 0 \u5F00\u59CB\uFF09\uFF1B\u672A\u542F\u7528\u5206\u9875\u65F6\u4E3A 0" });
166
+ env.registerVariable("pageSize", "number", { description: "\u6BCF\u9875\u884C\u6570\uFF1B\u672A\u542F\u7528\u5206\u9875\u65F6\u4E3A 0" });
167
+ env.registerVariable("query", "dyn", { description: QUERY_VAR_DESCRIPTION });
168
+ },
169
+ data: (env) => {
170
+ env.registerVariable("query", "dyn", { description: QUERY_VAR_DESCRIPTION });
171
+ }
172
+ });
150
173
  const CelTotal = Expression({
151
174
  configure: (env) => {
152
175
  configure(env);
@@ -158,14 +181,7 @@ export function DataSource(configure) {
158
181
  resultType: (type) => type === "number" || type === "dyn" || type.startsWith("optional")
159
182
  });
160
183
  return Schema.Struct({
161
- request: Schema.optional(CelRequest).annotations({
162
- title: "\u8BF7\u6C42",
163
- description: "\u53EF\u9009\u7684 HTTP \u8BF7\u6C42\u8868\u8FBE\u5F0F\uFF1B\u672A\u914D\u7F6E\u65F6\u6570\u636E\u4ECE `data` \u8868\u8FBE\u5F0F\u4E2D\u8BFB\u53D6\uFF08\u901A\u5E38\u5F15\u7528\u4E0A\u4E0B\u6587\u53D8\u91CF\uFF09"
164
- }),
165
- data: CelRows.annotations({
166
- title: "\u6570\u636E",
167
- description: "\u8FD4\u56DE\u884C\u6570\u636E\u5217\u8868\uFF08`list<dyn>`\uFF09\u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u5728\u914D\u7F6E\u4E86 `request` \u65F6\u53EF\u901A\u8FC7 `json` \u5F15\u7528\u54CD\u5E94\u4F53"
168
- }),
184
+ ...base.fields,
169
185
  total: Schema.optional(CelTotal).annotations({
170
186
  title: "\u603B\u6570",
171
187
  description: "\u8FD4\u56DE\u603B\u884C\u6570\uFF08`number`\uFF09\u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u914D\u7F6E\u540E\u542F\u7528\u670D\u52A1\u7AEF\u5206\u9875\uFF0C\u7559\u7A7A\u5219\u8D70\u524D\u7AEF\u5206\u9875"
@@ -198,7 +214,7 @@ export function TableConfig(configure) {
198
214
  const CelRowKey = CelRowAccess(configure, {
199
215
  resultType: (type) => type === "string" || type === "number" || type === "dyn"
200
216
  });
201
- const dataSourceSchema = DataSource(configure);
217
+ const dataSourceSchema = tableDataSource(configure);
202
218
  const { fields: actionFields } = ActionSchemaFields((env) => {
203
219
  configure(env);
204
220
  env.registerVariable("selected", "list<dyn>", {
@@ -14,10 +14,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
14
14
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
15
  "onUpdate:modelValue"?: ((args_0: DateRange | undefined) => any) | undefined;
16
16
  }>, {
17
- rangeSeparatorIcon: string;
18
17
  numberOfMonths: number;
19
18
  granularity: "hour" | "minute" | "second";
20
19
  hourCycle: 12 | 24;
20
+ rangeSeparatorIcon: string;
21
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
22
  declare const _default: typeof __VLS_export;
23
23
  export default _default;
@@ -14,10 +14,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
14
14
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
15
  "onUpdate:modelValue"?: ((args_0: DateRange | undefined) => any) | undefined;
16
16
  }>, {
17
- rangeSeparatorIcon: string;
18
17
  numberOfMonths: number;
19
18
  granularity: "hour" | "minute" | "second";
20
19
  hourCycle: 12 | 24;
20
+ rangeSeparatorIcon: string;
21
21
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
22
  declare const _default: typeof __VLS_export;
23
23
  export default _default;
@@ -24,11 +24,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
24
24
  "onUpdate:endValue"?: ((args_0: Time | undefined) => any) | undefined;
25
25
  }>, {
26
26
  size: "sm" | "md" | "lg";
27
- rangeSeparatorIcon: string;
28
27
  granularity: "hour" | "minute" | "second";
29
28
  hourCycle: 12 | 24;
30
29
  clearable: boolean;
31
30
  clearIcon: string;
31
+ rangeSeparatorIcon: string;
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
33
  declare const _default: typeof __VLS_export;
34
34
  export default _default;
@@ -24,11 +24,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
24
24
  "onUpdate:endValue"?: ((args_0: Time | undefined) => any) | undefined;
25
25
  }>, {
26
26
  size: "sm" | "md" | "lg";
27
- rangeSeparatorIcon: string;
28
27
  granularity: "hour" | "minute" | "second";
29
28
  hourCycle: 12 | 24;
30
29
  clearable: boolean;
31
30
  clearIcon: string;
31
+ rangeSeparatorIcon: string;
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
33
  declare const _default: typeof __VLS_export;
34
34
  export default _default;
@@ -0,0 +1,57 @@
1
+ import type { CascadeMode, DropContext, GetChildren, LoadChildren, MoveEventPayload, NodeKey, SelectedPaneSlotProps, SelectionMode, TreeHandle } from './types.js';
2
+ declare const __VLS_export: <Node>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<{
4
+ /** Root-level nodes. Use `v-model:roots` for controlled mode. */
5
+ roots: Node[];
6
+ getKey: (node: Node) => NodeKey;
7
+ getChildren?: GetChildren<Node>;
8
+ loadChildren?: LoadChildren<Node>;
9
+ /** `'none' | 'single' | 'multi'`. Default `'none'`. */
10
+ selectionMode?: SelectionMode;
11
+ /** Multi cascade mode. Ignored for `single` / `none`. */
12
+ cascade?: CascadeMode;
13
+ /** v-model for selection. Shape depends on `selectionMode`. */
14
+ modelValue?: NodeKey | NodeKey[] | undefined;
15
+ /** Per-node gate. */
16
+ selectable?: (node: Node, depth: number) => boolean;
17
+ /** Per-node draggable gate. Defaults to global `draggable` prop. */
18
+ draggable?: ((node: Node, depth: number) => boolean) | boolean;
19
+ /** Drop gate; required to enable drag-and-drop. */
20
+ canDrop?: (ctx: DropContext<Node>) => boolean;
21
+ /** Render-time filter. Does NOT mutate selection. */
22
+ filterPredicate?: (node: Node, query: string) => boolean;
23
+ filterQuery?: string;
24
+ /** Initial expanded set (uncontrolled). */
25
+ initialExpanded?: NodeKey[];
26
+ } & {
27
+ onMove?: ((payload: MoveEventPayload) => any) | undefined;
28
+ "onUpdate:modelValue"?: ((value: string | string[] | undefined) => any) | undefined;
29
+ "onUpdate:roots"?: ((value: Node[]) => any) | undefined;
30
+ }> & (typeof globalThis extends {
31
+ __VLS_PROPS_FALLBACK: infer P;
32
+ } ? P : {});
33
+ expose: (exposed: import("vue").ShallowUnwrapRef<TreeHandle<Node>>) => void;
34
+ attrs: any;
35
+ slots: {
36
+ node?: (p: import("./types.js").NodeSlotProps<Node>) => unknown;
37
+ actions?: (p: import("./types.js").ActionsSlotProps<Node>) => unknown;
38
+ empty?: () => unknown;
39
+ error?: (p: import("./types.js").ErrorSlotProps<Node>) => unknown;
40
+ 'loading-children'?: (p: import("./types.js").LoadingChildrenSlotProps<Node>) => unknown;
41
+ 'selected-pane'?: (p: SelectedPaneSlotProps<Node>) => unknown;
42
+ };
43
+ emit: {
44
+ (e: "update:modelValue", value: NodeKey | NodeKey[] | undefined): void;
45
+ (e: "update:roots", value: Node[]): void;
46
+ (e: "move", payload: MoveEventPayload): void;
47
+ };
48
+ }>) => import("vue").VNode & {
49
+ __ctx?: Awaited<typeof __VLS_setup>;
50
+ };
51
+ declare const _default: typeof __VLS_export;
52
+ export default _default;
53
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
54
+ [K in keyof T]: T[K];
55
+ } : {
56
+ [K in keyof T as K]: T[K];
57
+ }) & {};