@shwfed/config 2.1.0 → 2.1.1

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 (65) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/form/ai/fields-button.d.vue.ts +13 -0
  3. package/dist/runtime/components/form/ai/fields-button.vue +458 -0
  4. package/dist/runtime/components/form/ai/fields-button.vue.d.ts +13 -0
  5. package/dist/runtime/components/form/ai/fields-task.md +71 -0
  6. package/dist/runtime/components/form/config.d.vue.ts +1 -1
  7. package/dist/runtime/components/form/config.vue +4 -36
  8. package/dist/runtime/components/form/config.vue.d.ts +1 -1
  9. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +18 -18
  10. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +18 -18
  11. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.d.vue.ts +4 -4
  12. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue.d.ts +4 -4
  13. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +22 -22
  14. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +22 -22
  15. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.d.vue.ts +2 -2
  16. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.vue.d.ts +2 -2
  17. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.d.vue.ts +4 -4
  18. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.vue.d.ts +4 -4
  19. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.d.vue.ts +12 -12
  20. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue +87 -11
  21. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue.d.ts +12 -12
  22. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/runtime.vue +18 -6
  23. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/schema.d.ts +1 -1
  24. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/schema.js +11 -4
  25. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.d.vue.ts +10 -10
  26. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.vue.d.ts +10 -10
  27. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.d.vue.ts +12 -12
  28. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.vue.d.ts +12 -12
  29. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/config.d.vue.ts +2 -2
  30. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/config.vue +15 -0
  31. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/config.vue.d.ts +2 -2
  32. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/row.d.vue.ts +1 -0
  33. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/row.vue +13 -4
  34. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/row.vue.d.ts +1 -0
  35. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/runtime.vue +1 -0
  36. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/schema.d.ts +1 -1
  37. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/schema.js +5 -1
  38. package/dist/runtime/components/form/index.vue +5 -4
  39. package/dist/runtime/components/form/unit-config.d.vue.ts +16 -0
  40. package/dist/runtime/components/form/unit-config.vue +30 -3
  41. package/dist/runtime/components/form/unit-config.vue.d.ts +16 -0
  42. package/dist/runtime/components/form/utils/cel-scope.d.ts +13 -0
  43. package/dist/runtime/components/form/utils/cel-scope.js +32 -0
  44. package/dist/runtime/components/form/utils/schema-meta.d.ts +13 -0
  45. package/dist/runtime/components/form/utils/schema-meta.js +15 -0
  46. package/dist/runtime/components/table/ai/columns-task.md +10 -1
  47. package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.markdown/config.vue +2 -2
  48. package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.markdown/runtime.vue +14 -4
  49. package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.markdown/schema.js +3 -2
  50. package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/config.vue +2 -2
  51. package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/runtime.vue +14 -4
  52. package/dist/runtime/components/table/columns/2026-04-14/com.shwfed.table.column.text/schema.js +3 -2
  53. package/dist/runtime/components/table/utils/shared.d.ts +2 -1
  54. package/dist/runtime/components/ui/date-range-picker/DateRangePickerDateTimePanel.d.vue.ts +1 -1
  55. package/dist/runtime/components/ui/date-range-picker/DateRangePickerDateTimePanel.vue.d.ts +1 -1
  56. package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.d.vue.ts +1 -1
  57. package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.vue.d.ts +1 -1
  58. package/dist/runtime/share/expression.d.ts +1 -2
  59. package/dist/runtime/share/slot-renderer.vue +7 -6
  60. package/dist/runtime/vendor/cel-js/CLAUDE.md +1 -1
  61. package/dist/runtime/vendor/cel-js/PROMPT.md +6 -1
  62. package/dist/runtime/vendor/cel-js/lib/http-builder.d.ts +3 -2
  63. package/dist/runtime/vendor/cel-js/lib/http-builtins.d.ts +4 -3
  64. package/dist/runtime/vendor/cel-js/lib/http-builtins.js +4 -0
  65. package/package.json +1 -1
@@ -16,7 +16,8 @@ import {
16
16
  InputGroupAddon,
17
17
  InputGroupButton,
18
18
  InputGroupInput,
19
- InputGroupNumberField
19
+ InputGroupNumberField,
20
+ InputGroupText
20
21
  } from "../../../../ui/input-group";
21
22
  import { Locale as LocaleField } from "../../../../ui/locale";
22
23
  import { Markdown } from "../../../../ui/markdown";
@@ -41,8 +42,11 @@ const ROUNDING_MODE_OPTIONS = [
41
42
  { value: "floor", label: "\u5411\u4E0B\u53D6\u6574" },
42
43
  { value: "ceil", label: "\u5411\u4E0A\u53D6\u6574" }
43
44
  ];
44
- const pathText = computed({
45
- get: () => value.value.binding ?? "",
45
+ const bindingMode = computed(
46
+ () => Array.isArray(value.value.binding) ? "split" : "single"
47
+ );
48
+ const singlePathText = computed({
49
+ get: () => typeof value.value.binding === "string" ? value.value.binding : "",
46
50
  set: (next) => {
47
51
  const trimmed = next.trim();
48
52
  if (trimmed.length === 0) {
@@ -53,6 +57,28 @@ const pathText = computed({
53
57
  }
54
58
  }
55
59
  });
60
+ const splitStartText = computed(
61
+ () => Array.isArray(value.value.binding) ? value.value.binding[0] : ""
62
+ );
63
+ const splitEndText = computed(
64
+ () => Array.isArray(value.value.binding) ? value.value.binding[1] : ""
65
+ );
66
+ function setSplitStart(next) {
67
+ const cur = Array.isArray(value.value.binding) ? value.value.binding : ["", ""];
68
+ value.value = { ...value.value, binding: [next.trim(), cur[1]] };
69
+ }
70
+ function setSplitEnd(next) {
71
+ const cur = Array.isArray(value.value.binding) ? value.value.binding : ["", ""];
72
+ value.value = { ...value.value, binding: [cur[0], next.trim()] };
73
+ }
74
+ function toggleBindingMode() {
75
+ if (bindingMode.value === "single") {
76
+ value.value = { ...value.value, binding: ["", ""] };
77
+ } else {
78
+ const { binding: _omit, ...rest } = value.value;
79
+ value.value = rest;
80
+ }
81
+ }
56
82
  const currentRoundingModeLabel = computed(
57
83
  () => ROUNDING_MODE_OPTIONS.find((o) => o.value === (value.value.roundingMode ?? "round"))?.label
58
84
  );
@@ -121,20 +147,70 @@ function setSeparatorIcon(next) {
121
147
  <FieldLabel class="text-xs text-zinc-500">
122
148
  <template #tooltip>
123
149
  <Markdown
124
- source="写入表单状态的嵌套键路径,使用 `.` 分隔;写入值为 `[start, end]` 数值数组"
150
+ source="写入表单状态的嵌套键路径,使用 `.` 分隔。单路径模式写入 `[start, end]` 数值数组;拆分模式分别写入起始与结束两端"
125
151
  block
126
152
  class="prose prose-sm prose-zinc"
127
153
  />
128
154
  </template>
129
155
  {{ fieldTitle("binding") }}
130
156
  </FieldLabel>
131
- <InputGroup>
132
- <InputGroupInput
133
- v-model="pathText"
134
- placeholder="例:score.range"
135
- class="font-mono"
136
- />
137
- </InputGroup>
157
+ <template v-if="bindingMode === 'single'">
158
+ <InputGroup>
159
+ <InputGroupInput
160
+ v-model="singlePathText"
161
+ placeholder="例:score.range"
162
+ class="font-mono"
163
+ />
164
+ <InputGroupAddon align="inline-end">
165
+ <InputGroupButton
166
+ size="icon-xs"
167
+ aria-label="拆分起止绑定路径"
168
+ @click="toggleBindingMode"
169
+ >
170
+ <Icon icon="fluent:split-horizontal-20-regular" />
171
+ </InputGroupButton>
172
+ </InputGroupAddon>
173
+ </InputGroup>
174
+ </template>
175
+ <template v-else>
176
+ <div class="grid grid-cols-2 gap-2">
177
+ <InputGroup>
178
+ <InputGroupAddon align="inline-start">
179
+ <InputGroupText class="text-xs text-zinc-400">
180
+
181
+ </InputGroupText>
182
+ </InputGroupAddon>
183
+ <InputGroupInput
184
+ :model-value="splitStartText"
185
+ placeholder="例:score.start"
186
+ class="font-mono"
187
+ @update:model-value="(v) => setSplitStart(String(v ?? ''))"
188
+ />
189
+ </InputGroup>
190
+ <InputGroup>
191
+ <InputGroupAddon align="inline-start">
192
+ <InputGroupText class="text-xs text-zinc-400">
193
+
194
+ </InputGroupText>
195
+ </InputGroupAddon>
196
+ <InputGroupInput
197
+ :model-value="splitEndText"
198
+ placeholder="例:score.end"
199
+ class="font-mono"
200
+ @update:model-value="(v) => setSplitEnd(String(v ?? ''))"
201
+ />
202
+ <InputGroupAddon align="inline-end">
203
+ <InputGroupButton
204
+ size="icon-xs"
205
+ aria-label="合并起止绑定路径"
206
+ @click="toggleBindingMode"
207
+ >
208
+ <Icon icon="fluent:merge-vertical-20-regular" />
209
+ </InputGroupButton>
210
+ </InputGroupAddon>
211
+ </InputGroup>
212
+ </div>
213
+ </template>
138
214
  </Field>
139
215
  </div>
140
216
 
@@ -29,12 +29,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
29
29
  readonly max?: string | undefined;
30
30
  readonly step?: number | undefined;
31
31
  readonly readonly?: string | undefined;
32
- readonly binding?: string | undefined;
33
- readonly derived?: {
34
- readonly mode: "formula" | "prefill";
35
- readonly expression: string;
36
- } | undefined;
37
- readonly rangeSeparatorIcon?: string | undefined;
38
32
  readonly startPlaceholder?: readonly [{
39
33
  readonly locale: "zh";
40
34
  readonly message: string;
@@ -49,8 +43,14 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
49
43
  readonly locale: "en" | "ja" | "ko";
50
44
  readonly message: string;
51
45
  }[]] | undefined;
46
+ readonly binding?: string | readonly [string, string] | undefined;
47
+ readonly derived?: {
48
+ readonly mode: "formula" | "prefill";
49
+ readonly expression: string;
50
+ } | undefined;
52
51
  readonly precision?: number | undefined;
53
52
  readonly roundingMode?: "round" | "floor" | "ceil" | undefined;
53
+ readonly rangeSeparatorIcon?: string | undefined;
54
54
  }) => any;
55
55
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
56
56
  "onUpdate:modelValue"?: ((value: {
@@ -79,12 +79,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
79
79
  readonly max?: string | undefined;
80
80
  readonly step?: number | undefined;
81
81
  readonly readonly?: string | undefined;
82
- readonly binding?: string | undefined;
83
- readonly derived?: {
84
- readonly mode: "formula" | "prefill";
85
- readonly expression: string;
86
- } | undefined;
87
- readonly rangeSeparatorIcon?: string | undefined;
88
82
  readonly startPlaceholder?: readonly [{
89
83
  readonly locale: "zh";
90
84
  readonly message: string;
@@ -99,8 +93,14 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
99
93
  readonly locale: "en" | "ja" | "ko";
100
94
  readonly message: string;
101
95
  }[]] | undefined;
96
+ readonly binding?: string | readonly [string, string] | undefined;
97
+ readonly derived?: {
98
+ readonly mode: "formula" | "prefill";
99
+ readonly expression: string;
100
+ } | undefined;
102
101
  readonly precision?: number | undefined;
103
102
  readonly roundingMode?: "round" | "floor" | "ceil" | undefined;
103
+ readonly rangeSeparatorIcon?: string | undefined;
104
104
  }) => any) | undefined;
105
105
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
106
106
  declare const _default: typeof __VLS_export;
@@ -70,20 +70,32 @@ function asRange(raw) {
70
70
  if (!Number.isFinite(a) || !Number.isFinite(b)) return void 0;
71
71
  return [a, b];
72
72
  }
73
+ function asNumber(raw) {
74
+ return typeof raw === "number" && Number.isFinite(raw) ? raw : void 0;
75
+ }
73
76
  const uncontrolled = ref(void 0);
74
77
  const model = computed({
75
78
  get: () => {
76
- const path = props.config.binding;
77
- if (path == null) return uncontrolled.value;
78
- return asRange(getAt(path));
79
+ const binding = props.config.binding;
80
+ if (binding == null) return uncontrolled.value;
81
+ if (typeof binding === "string") return asRange(getAt(binding));
82
+ const a = asNumber(getAt(binding[0]));
83
+ const b = asNumber(getAt(binding[1]));
84
+ if (a == null || b == null) return void 0;
85
+ return [a, b];
79
86
  },
80
87
  set: (next) => {
81
- const path = props.config.binding;
82
- if (path == null) {
88
+ const binding = props.config.binding;
89
+ if (binding == null) {
83
90
  uncontrolled.value = next;
84
91
  return;
85
92
  }
86
- setAt(path, next ?? null);
93
+ if (typeof binding === "string") {
94
+ setAt(binding, next ?? null);
95
+ return;
96
+ }
97
+ setAt(binding[0], next?.[0] ?? null);
98
+ setAt(binding[1], next?.[1] ?? null);
87
99
  }
88
100
  });
89
101
  const localStart = ref(model.value?.[0]);
@@ -46,7 +46,7 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
46
46
  message: Schema.SchemaClass<string, string, never>;
47
47
  }>]>>;
48
48
  orientation: Schema.optional<Schema.Literal<["vertical", "floating"]>>;
49
- binding: Schema.optional<Schema.refine<string, typeof Schema.String>>;
49
+ binding: Schema.optional<Schema.Union<[Schema.filter<typeof Schema.String>, Schema.filter<Schema.Tuple2<Schema.filter<typeof Schema.String>, Schema.filter<typeof Schema.String>>>]>>;
50
50
  disabled: Schema.optional<Schema.Schema<string, string, never>>;
51
51
  readonly: Schema.optional<Schema.Schema<string, string, never>>;
52
52
  derived: Schema.optional<Schema.Struct<{
@@ -4,6 +4,16 @@ import { Locale } from "../../../../../share/locale.js";
4
4
  import { commonFieldFields, derivedField, FieldOrientationSchema } from "../../../utils/common.js";
5
5
  export const type = "com.shwfed.form.field.numberrange";
6
6
  export const compatibilityDate = "2026-04-28";
7
+ const BindingPath = Schema.String.pipe(Schema.minLength(1));
8
+ const SplitBinding = Schema.Tuple(BindingPath, BindingPath).pipe(
9
+ Schema.filter(([a, b]) => a !== b, {
10
+ message: () => "\u8D77\u59CB\u4E0E\u7ED3\u675F\u7ED1\u5B9A\u8DEF\u5F84\u4E0D\u80FD\u76F8\u540C"
11
+ })
12
+ );
13
+ const bindingSchema = Schema.Union(BindingPath, SplitBinding).annotations({
14
+ title: "\u7ED1\u5B9A\u8DEF\u5F84",
15
+ description: "\u5199\u5165\u8868\u5355\u72B6\u6001\u7684 `dot-prop` \u8DEF\u5F84\uFF1B\u586B\u5199\u5355\u4E2A\u8DEF\u5F84\u65F6\u5199\u5165 `[start, end]` \u6570\u503C\u6570\u7EC4\uFF0C\u4F8B\u5982 `score.range`\uFF1B\u586B\u5199 `[\u8D77\u59CB\u8DEF\u5F84, \u7ED3\u675F\u8DEF\u5F84]` \u5143\u7EC4\u65F6\u5206\u522B\u5199\u5165\u4E24\u7AEF\uFF1B\u7559\u7A7A\u5219\u4E3A\u975E\u53D7\u63A7\u5B57\u6BB5"
16
+ });
7
17
  export const metadata = {
8
18
  name: "\u6570\u503C\u8303\u56F4",
9
19
  icon: "fluent:arrow-bidirectional-left-right-20-regular",
@@ -34,10 +44,7 @@ export function schema(configure) {
34
44
  description: "\u9F20\u6807\u60AC\u505C\u5728\u6807\u7B7E\u4E0A\u65F6\u5C55\u793A\u7684\u8BF4\u660E"
35
45
  })),
36
46
  orientation: Schema.optional(FieldOrientationSchema),
37
- binding: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
38
- title: "\u7ED1\u5B9A\u8DEF\u5F84",
39
- description: "\u5199\u5165\u8868\u5355\u72B6\u6001\u7684 `dot-prop` \u8DEF\u5F84\uFF0C\u4F8B\u5982 `score.range`\uFF1B\u5199\u5165\u503C\u4E3A `[start, end]` \u6570\u503C\u6570\u7EC4\uFF1B\u7559\u7A7A\u5219\u4E3A\u975E\u53D7\u63A7\u5B57\u6BB5"
40
- })),
47
+ binding: Schema.optional(bindingSchema),
41
48
  disabled: Schema.optional(CelBool.annotations({
42
49
  title: "\u7981\u7528\u6761\u4EF6",
43
50
  description: "\u8FD4\u56DE `true` \u65F6\u8F93\u5165\u6846\u4ECD\u7136\u6E32\u67D3\u4F46\u4E0D\u53EF\u7F16\u8F91"
@@ -25,11 +25,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
25
25
  readonly displayName?: string | undefined;
26
26
  readonly compatibilityDate: "2026-04-28";
27
27
  readonly readonly?: string | undefined;
28
- readonly binding?: string | undefined;
29
- readonly derived?: {
30
- readonly mode: "formula" | "prefill";
31
- readonly expression: string;
32
- } | undefined;
33
28
  readonly trueLabel?: readonly [{
34
29
  readonly locale: "zh";
35
30
  readonly message: string;
@@ -44,6 +39,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
44
39
  readonly locale: "en" | "ja" | "ko";
45
40
  readonly message: string;
46
41
  }[]] | undefined;
42
+ readonly binding?: string | undefined;
43
+ readonly derived?: {
44
+ readonly mode: "formula" | "prefill";
45
+ readonly expression: string;
46
+ } | undefined;
47
47
  }) => any;
48
48
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
49
49
  "onUpdate:modelValue"?: ((value: {
@@ -68,11 +68,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
68
68
  readonly displayName?: string | undefined;
69
69
  readonly compatibilityDate: "2026-04-28";
70
70
  readonly readonly?: string | undefined;
71
- readonly binding?: string | undefined;
72
- readonly derived?: {
73
- readonly mode: "formula" | "prefill";
74
- readonly expression: string;
75
- } | undefined;
76
71
  readonly trueLabel?: readonly [{
77
72
  readonly locale: "zh";
78
73
  readonly message: string;
@@ -87,6 +82,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
87
82
  readonly locale: "en" | "ja" | "ko";
88
83
  readonly message: string;
89
84
  }[]] | undefined;
85
+ readonly binding?: string | undefined;
86
+ readonly derived?: {
87
+ readonly mode: "formula" | "prefill";
88
+ readonly expression: string;
89
+ } | undefined;
90
90
  }) => any) | undefined;
91
91
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
92
92
  declare const _default: typeof __VLS_export;
@@ -25,11 +25,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
25
25
  readonly displayName?: string | undefined;
26
26
  readonly compatibilityDate: "2026-04-28";
27
27
  readonly readonly?: string | undefined;
28
- readonly binding?: string | undefined;
29
- readonly derived?: {
30
- readonly mode: "formula" | "prefill";
31
- readonly expression: string;
32
- } | undefined;
33
28
  readonly trueLabel?: readonly [{
34
29
  readonly locale: "zh";
35
30
  readonly message: string;
@@ -44,6 +39,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
44
39
  readonly locale: "en" | "ja" | "ko";
45
40
  readonly message: string;
46
41
  }[]] | undefined;
42
+ readonly binding?: string | undefined;
43
+ readonly derived?: {
44
+ readonly mode: "formula" | "prefill";
45
+ readonly expression: string;
46
+ } | undefined;
47
47
  }) => any;
48
48
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
49
49
  "onUpdate:modelValue"?: ((value: {
@@ -68,11 +68,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
68
68
  readonly displayName?: string | undefined;
69
69
  readonly compatibilityDate: "2026-04-28";
70
70
  readonly readonly?: string | undefined;
71
- readonly binding?: string | undefined;
72
- readonly derived?: {
73
- readonly mode: "formula" | "prefill";
74
- readonly expression: string;
75
- } | undefined;
76
71
  readonly trueLabel?: readonly [{
77
72
  readonly locale: "zh";
78
73
  readonly message: string;
@@ -87,6 +82,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
87
82
  readonly locale: "en" | "ja" | "ko";
88
83
  readonly message: string;
89
84
  }[]] | undefined;
85
+ readonly binding?: string | undefined;
86
+ readonly derived?: {
87
+ readonly mode: "formula" | "prefill";
88
+ readonly expression: string;
89
+ } | undefined;
90
90
  }) => any) | undefined;
91
91
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
92
92
  declare const _default: typeof __VLS_export;
@@ -42,12 +42,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
42
42
  readonly message: string;
43
43
  }[]] | undefined;
44
44
  readonly readonly?: string | undefined;
45
- readonly binding?: string | undefined;
46
- readonly accept?: readonly string[] | undefined;
47
- readonly maxFileSize?: number | undefined;
48
- readonly maxTotalSize?: number | undefined;
49
- readonly maxFiles?: number | undefined;
50
- readonly templateIcon?: string | undefined;
51
45
  readonly templateLabel?: readonly [{
52
46
  readonly locale: "zh";
53
47
  readonly message: string;
@@ -55,6 +49,12 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
55
49
  readonly locale: "en" | "ja" | "ko";
56
50
  readonly message: string;
57
51
  }[]] | undefined;
52
+ readonly binding?: string | undefined;
53
+ readonly accept?: readonly string[] | undefined;
54
+ readonly maxFileSize?: number | undefined;
55
+ readonly maxTotalSize?: number | undefined;
56
+ readonly maxFiles?: number | undefined;
57
+ readonly templateIcon?: string | undefined;
58
58
  }) => any;
59
59
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
60
60
  "onUpdate:modelValue"?: ((value: {
@@ -96,12 +96,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
96
96
  readonly message: string;
97
97
  }[]] | undefined;
98
98
  readonly readonly?: string | undefined;
99
- readonly binding?: string | undefined;
100
- readonly accept?: readonly string[] | undefined;
101
- readonly maxFileSize?: number | undefined;
102
- readonly maxTotalSize?: number | undefined;
103
- readonly maxFiles?: number | undefined;
104
- readonly templateIcon?: string | undefined;
105
99
  readonly templateLabel?: readonly [{
106
100
  readonly locale: "zh";
107
101
  readonly message: string;
@@ -109,6 +103,12 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
109
103
  readonly locale: "en" | "ja" | "ko";
110
104
  readonly message: string;
111
105
  }[]] | undefined;
106
+ readonly binding?: string | undefined;
107
+ readonly accept?: readonly string[] | undefined;
108
+ readonly maxFileSize?: number | undefined;
109
+ readonly maxTotalSize?: number | undefined;
110
+ readonly maxFiles?: number | undefined;
111
+ readonly templateIcon?: string | undefined;
112
112
  }) => any) | undefined;
113
113
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
114
114
  declare const _default: typeof __VLS_export;
@@ -42,12 +42,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
42
42
  readonly message: string;
43
43
  }[]] | undefined;
44
44
  readonly readonly?: string | undefined;
45
- readonly binding?: string | undefined;
46
- readonly accept?: readonly string[] | undefined;
47
- readonly maxFileSize?: number | undefined;
48
- readonly maxTotalSize?: number | undefined;
49
- readonly maxFiles?: number | undefined;
50
- readonly templateIcon?: string | undefined;
51
45
  readonly templateLabel?: readonly [{
52
46
  readonly locale: "zh";
53
47
  readonly message: string;
@@ -55,6 +49,12 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
55
49
  readonly locale: "en" | "ja" | "ko";
56
50
  readonly message: string;
57
51
  }[]] | undefined;
52
+ readonly binding?: string | undefined;
53
+ readonly accept?: readonly string[] | undefined;
54
+ readonly maxFileSize?: number | undefined;
55
+ readonly maxTotalSize?: number | undefined;
56
+ readonly maxFiles?: number | undefined;
57
+ readonly templateIcon?: string | undefined;
58
58
  }) => any;
59
59
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
60
60
  "onUpdate:modelValue"?: ((value: {
@@ -96,12 +96,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
96
96
  readonly message: string;
97
97
  }[]] | undefined;
98
98
  readonly readonly?: string | undefined;
99
- readonly binding?: string | undefined;
100
- readonly accept?: readonly string[] | undefined;
101
- readonly maxFileSize?: number | undefined;
102
- readonly maxTotalSize?: number | undefined;
103
- readonly maxFiles?: number | undefined;
104
- readonly templateIcon?: string | undefined;
105
99
  readonly templateLabel?: readonly [{
106
100
  readonly locale: "zh";
107
101
  readonly message: string;
@@ -109,6 +103,12 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
109
103
  readonly locale: "en" | "ja" | "ko";
110
104
  readonly message: string;
111
105
  }[]] | undefined;
106
+ readonly binding?: string | undefined;
107
+ readonly accept?: readonly string[] | undefined;
108
+ readonly maxFileSize?: number | undefined;
109
+ readonly maxTotalSize?: number | undefined;
110
+ readonly maxFiles?: number | undefined;
111
+ readonly templateIcon?: string | undefined;
112
112
  }) => any) | undefined;
113
113
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
114
114
  declare const _default: typeof __VLS_export;
@@ -26,6 +26,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
26
26
  readonly compatibilityDate: "2026-05-13";
27
27
  readonly min?: number | undefined;
28
28
  readonly max?: number | undefined;
29
+ readonly binding?: string | undefined;
29
30
  readonly unit: Readonly<{
30
31
  fields: ReadonlyArray<import("../../../schema.js").FieldValue>;
31
32
  layouts: readonly Readonly<{
@@ -34,7 +35,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
34
35
  layout: import("../../../schema.js").LayoutValue;
35
36
  }>[];
36
37
  }>;
37
- readonly binding?: string | undefined;
38
38
  readonly addLabel?: readonly [{
39
39
  readonly locale: "zh";
40
40
  readonly message: string;
@@ -75,6 +75,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
75
75
  readonly compatibilityDate: "2026-05-13";
76
76
  readonly min?: number | undefined;
77
77
  readonly max?: number | undefined;
78
+ readonly binding?: string | undefined;
78
79
  readonly unit: Readonly<{
79
80
  fields: ReadonlyArray<import("../../../schema.js").FieldValue>;
80
81
  layouts: readonly Readonly<{
@@ -83,7 +84,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
83
84
  layout: import("../../../schema.js").LayoutValue;
84
85
  }>[];
85
86
  }>;
86
- readonly binding?: string | undefined;
87
87
  readonly addLabel?: readonly [{
88
88
  readonly locale: "zh";
89
89
  readonly message: string;
@@ -40,6 +40,20 @@ const unitModel = computed({
40
40
  const EXTRAS = [
41
41
  { id: "general", label: "\u901A\u7528\u914D\u7F6E", icon: "fluent:settings-20-regular" }
42
42
  ];
43
+ const FIELD_CEL_SCOPE = {
44
+ item: {
45
+ type: "dyn",
46
+ label: "item",
47
+ description: "\u5F53\u524D\u5217\u8868\u9879",
48
+ value: void 0
49
+ },
50
+ index: {
51
+ type: "number",
52
+ label: "index",
53
+ description: "\u5F53\u524D\u5217\u8868\u9879\u7D22\u5F15\uFF0C\u4ECE 0 \u5F00\u59CB",
54
+ value: void 0
55
+ }
56
+ };
43
57
  const selection = ref({ kind: "extras", id: "general" });
44
58
  const pathText = computed({
45
59
  get: () => value.value.binding ?? "",
@@ -79,6 +93,7 @@ const reorderable = computed({
79
93
  v-model="unitModel"
80
94
  v-model:selection="selection"
81
95
  :extras="EXTRAS"
96
+ :field-cel-scope="FIELD_CEL_SCOPE"
82
97
  >
83
98
  <template #extras-pane>
84
99
  <div class="flex flex-col gap-3 p-6">
@@ -26,6 +26,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
26
26
  readonly compatibilityDate: "2026-05-13";
27
27
  readonly min?: number | undefined;
28
28
  readonly max?: number | undefined;
29
+ readonly binding?: string | undefined;
29
30
  readonly unit: Readonly<{
30
31
  fields: ReadonlyArray<import("../../../schema.js").FieldValue>;
31
32
  layouts: readonly Readonly<{
@@ -34,7 +35,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
34
35
  layout: import("../../../schema.js").LayoutValue;
35
36
  }>[];
36
37
  }>;
37
- readonly binding?: string | undefined;
38
38
  readonly addLabel?: readonly [{
39
39
  readonly locale: "zh";
40
40
  readonly message: string;
@@ -75,6 +75,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
75
75
  readonly compatibilityDate: "2026-05-13";
76
76
  readonly min?: number | undefined;
77
77
  readonly max?: number | undefined;
78
+ readonly binding?: string | undefined;
78
79
  readonly unit: Readonly<{
79
80
  fields: ReadonlyArray<import("../../../schema.js").FieldValue>;
80
81
  layouts: readonly Readonly<{
@@ -83,7 +84,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
83
84
  layout: import("../../../schema.js").LayoutValue;
84
85
  }>[];
85
86
  }>;
86
- readonly binding?: string | undefined;
87
87
  readonly addLabel?: readonly [{
88
88
  readonly locale: "zh";
89
89
  readonly message: string;
@@ -2,6 +2,7 @@ import type { FormUnitValue } from '../../../schema.js';
2
2
  import { type FormState } from '../../../utils/state.js';
3
3
  type __VLS_Props = {
4
4
  unit: FormUnitValue;
5
+ index: number;
5
6
  };
6
7
  type __VLS_ModelProps = {
7
8
  modelValue: FormState;
@@ -10,7 +10,8 @@ import { provideFormState } from "../../../utils/state";
10
10
  defineOptions({ name: "ShwfedListFieldRow" });
11
11
  const state = defineModel({ type: Object, ...{ required: true } });
12
12
  const props = defineProps({
13
- unit: { type: Object, required: true }
13
+ unit: { type: Object, required: true },
14
+ index: { type: Number, required: true }
14
15
  });
15
16
  const formState = provideFormState(state);
16
17
  provideCELContext({
@@ -19,6 +20,12 @@ provideCELContext({
19
20
  label: "item",
20
21
  description: "\u5F53\u524D\u5217\u8868\u9879",
21
22
  value: () => state.value ?? {}
23
+ },
24
+ index: {
25
+ type: "number",
26
+ label: "index",
27
+ description: "\u5F53\u524D\u5217\u8868\u9879\u7D22\u5F15\uFF0C\u4ECE 0 \u5F00\u59CB",
28
+ value: () => props.index
22
29
  }
23
30
  });
24
31
  const inherited = injectCELContext();
@@ -83,14 +90,16 @@ const gridStyle = computed(() => {
83
90
  const hi = Math.min(l.rows, y2 - 1);
84
91
  for (let r = lo; r <= hi; r++) grows[r - 1] = true;
85
92
  }
86
- rowTemplate = grows.map((g) => g ? "auto" : "minmax(0, 1fr)").join(" ");
93
+ rowTemplate = grows.map((g) => g ? "auto" : "minmax(auto, 1fr)").join(" ");
87
94
  }
95
+ const gap = `calc(${l.gap ?? DEFAULT_GAP} * 0.25rem)`;
96
+ const colGap = l.columns > 1 ? `min(${gap}, calc(100% / ${l.columns - 1}))` : gap;
88
97
  const parts = [
89
98
  "display: grid",
90
99
  `grid-template-columns: ${colTemplate}`,
91
100
  rowTemplate ? `grid-template-rows: ${rowTemplate}` : "",
92
- // Missing `gap` falls back to `DEFAULT_GAP`; see ../../../index.vue.
93
- `gap: calc(${l.gap ?? DEFAULT_GAP} * 0.25rem)`,
101
+ `column-gap: ${colGap}`,
102
+ `row-gap: ${gap}`,
94
103
  l.style ?? ""
95
104
  ].filter(Boolean);
96
105
  return parts.join("; ");
@@ -2,6 +2,7 @@ import type { FormUnitValue } from '../../../schema.js';
2
2
  import { type FormState } from '../../../utils/state.js';
3
3
  type __VLS_Props = {
4
4
  unit: FormUnitValue;
5
+ index: number;
5
6
  };
6
7
  type __VLS_ModelProps = {
7
8
  modelValue: FormState;
@@ -185,6 +185,7 @@ function rowConfig(i) {
185
185
  <Row
186
186
  :model-value="item"
187
187
  :unit="config.unit"
188
+ :index="i"
188
189
  @update:model-value="(next) => updateRow(i, next)"
189
190
  />
190
191
  </div>
@@ -40,11 +40,11 @@ export declare function schema(configure: (env: Environment) => void): Schema.re
40
40
  readonly compatibilityDate: "2026-05-13";
41
41
  readonly min?: number | undefined;
42
42
  readonly max?: number | undefined;
43
+ readonly binding?: string | undefined;
43
44
  readonly unit: Readonly<{
44
45
  fields: ReadonlyArray<import("../../../schema.js").FieldValue>;
45
46
  layouts: ReadonlyArray<import("../../../schema.js").LayoutSetValue>;
46
47
  }>;
47
- readonly binding?: string | undefined;
48
48
  readonly addLabel?: readonly [{
49
49
  readonly locale: "zh";
50
50
  readonly message: string;
@@ -15,9 +15,13 @@ export function schema(configure) {
15
15
  const CelBool = Expression({ configure, resultType: "bool" });
16
16
  const unitConfigure = (env) => {
17
17
  configure(env);
18
- if (!env.getDefinitions().variables.some((v) => v.name === "item")) {
18
+ const declared = new Set(env.getDefinitions().variables.map((v) => v.name));
19
+ if (!declared.has("item")) {
19
20
  env.registerVariable("item", "dyn", { description: "\u5F53\u524D\u5217\u8868\u9879" });
20
21
  }
22
+ if (!declared.has("index")) {
23
+ env.registerVariable("index", "number", { description: "\u5F53\u524D\u5217\u8868\u9879\u7D22\u5F15\uFF0C\u4ECE 0 \u5F00\u59CB" });
24
+ }
21
25
  };
22
26
  const Unit = Schema.suspend(() => FormUnit(unitConfigure));
23
27
  return Schema.Struct({