@shwfed/config 2.1.2 → 2.2.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 (51) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/config.d.vue.ts +8 -2
  3. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/config.vue.d.ts +8 -2
  4. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/runtime.d.vue.ts +8 -2
  5. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/runtime.vue.d.ts +8 -2
  6. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.form/schema.d.ts +8 -2
  7. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +8 -2
  8. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +8 -2
  9. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +8 -2
  10. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +8 -2
  11. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +12 -3
  12. package/dist/runtime/components/form/config.vue +36 -5
  13. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.d.vue.ts +2 -0
  14. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.vue +31 -0
  15. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.vue.d.ts +2 -0
  16. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/runtime.vue +12 -2
  17. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/schema.d.ts +1 -0
  18. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/schema.js +4 -0
  19. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.d.vue.ts +2 -0
  20. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue +31 -0
  21. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue.d.ts +2 -0
  22. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/runtime.vue +16 -8
  23. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/schema.d.ts +1 -0
  24. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/schema.js +4 -0
  25. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.d.vue.ts +8 -2
  26. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.vue +51 -15
  27. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.vue.d.ts +8 -2
  28. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/runtime.vue +16 -5
  29. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/schema.d.ts +9 -1
  30. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/schema.js +25 -4
  31. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/config.d.vue.ts +2 -2
  32. package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/config.vue.d.ts +2 -2
  33. package/dist/runtime/components/form/index.vue +4 -1
  34. package/dist/runtime/components/form/schema.d.ts +14 -4
  35. package/dist/runtime/components/form/schema.js +30 -10
  36. package/dist/runtime/components/form/utils/initial.d.ts +26 -0
  37. package/dist/runtime/components/form/utils/initial.js +11 -0
  38. package/dist/runtime/components/table/index.vue +3 -1
  39. package/dist/runtime/components/table/schema.d.ts +16 -4
  40. package/dist/runtime/plugins/i18n/index.js +8 -2
  41. package/dist/runtime/vendor/cel-js/CLAUDE.md +3 -1
  42. package/dist/runtime/vendor/cel-js/PROMPT.md +23 -7
  43. package/dist/runtime/vendor/cel-js/lib/http-builder.d.ts +6 -3
  44. package/dist/runtime/vendor/cel-js/lib/http-builder.js +24 -3
  45. package/dist/runtime/vendor/cel-js/lib/http-builtins.d.ts +3 -3
  46. package/dist/runtime/vendor/cel-js/lib/http-builtins.js +0 -4
  47. package/dist/runtime/vendor/cel-js/lib/operators.js +139 -11
  48. package/dist/runtime/vendor/cel-js/lib/parser.d.ts +2 -1
  49. package/dist/runtime/vendor/cel-js/lib/parser.js +20 -3
  50. package/dist/runtime/vendor/cel-js/lib/serialize.js +5 -1
  51. package/package.json +1 -1
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shwfed",
3
3
  "configKey": "shwfed",
4
- "version": "2.1.2",
4
+ "version": "2.2.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
@@ -10,7 +10,10 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
10
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
11
  "update:modelValue": (value: {
12
12
  readonly form: {
13
- readonly initial?: string | undefined;
13
+ readonly initial?: {
14
+ readonly data: string;
15
+ readonly request?: string | undefined;
16
+ } | undefined;
14
17
  readonly kind: "shwfed.component.form";
15
18
  readonly fields: readonly any[];
16
19
  readonly layouts: readonly {
@@ -39,7 +42,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
39
42
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
40
43
  "onUpdate:modelValue"?: ((value: {
41
44
  readonly form: {
42
- readonly initial?: string | undefined;
45
+ readonly initial?: {
46
+ readonly data: string;
47
+ readonly request?: string | undefined;
48
+ } | undefined;
43
49
  readonly kind: "shwfed.component.form";
44
50
  readonly fields: readonly any[];
45
51
  readonly layouts: readonly {
@@ -10,7 +10,10 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
10
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
11
  "update:modelValue": (value: {
12
12
  readonly form: {
13
- readonly initial?: string | undefined;
13
+ readonly initial?: {
14
+ readonly data: string;
15
+ readonly request?: string | undefined;
16
+ } | undefined;
14
17
  readonly kind: "shwfed.component.form";
15
18
  readonly fields: readonly any[];
16
19
  readonly layouts: readonly {
@@ -39,7 +42,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
39
42
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
40
43
  "onUpdate:modelValue"?: ((value: {
41
44
  readonly form: {
42
- readonly initial?: string | undefined;
45
+ readonly initial?: {
46
+ readonly data: string;
47
+ readonly request?: string | undefined;
48
+ } | undefined;
43
49
  readonly kind: "shwfed.component.form";
44
50
  readonly fields: readonly any[];
45
51
  readonly layouts: readonly {
@@ -12,7 +12,10 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
12
12
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
13
  "update:block": (value: {
14
14
  readonly form: {
15
- readonly initial?: string | undefined;
15
+ readonly initial?: {
16
+ readonly data: string;
17
+ readonly request?: string | undefined;
18
+ } | undefined;
16
19
  readonly kind: "shwfed.component.form";
17
20
  readonly fields: readonly any[];
18
21
  readonly layouts: readonly {
@@ -42,7 +45,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
42
45
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
43
46
  "onUpdate:block"?: ((value: {
44
47
  readonly form: {
45
- readonly initial?: string | undefined;
48
+ readonly initial?: {
49
+ readonly data: string;
50
+ readonly request?: string | undefined;
51
+ } | undefined;
46
52
  readonly kind: "shwfed.component.form";
47
53
  readonly fields: readonly any[];
48
54
  readonly layouts: readonly {
@@ -12,7 +12,10 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
12
12
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
13
  "update:block": (value: {
14
14
  readonly form: {
15
- readonly initial?: string | undefined;
15
+ readonly initial?: {
16
+ readonly data: string;
17
+ readonly request?: string | undefined;
18
+ } | undefined;
16
19
  readonly kind: "shwfed.component.form";
17
20
  readonly fields: readonly any[];
18
21
  readonly layouts: readonly {
@@ -42,7 +45,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
42
45
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
43
46
  "onUpdate:block"?: ((value: {
44
47
  readonly form: {
45
- readonly initial?: string | undefined;
48
+ readonly initial?: {
49
+ readonly data: string;
50
+ readonly request?: string | undefined;
51
+ } | undefined;
46
52
  readonly kind: "shwfed.component.form";
47
53
  readonly fields: readonly any[];
48
54
  readonly layouts: readonly {
@@ -22,7 +22,10 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
22
22
  type: Schema.tag<"com.shwfed.block.form">;
23
23
  compatibilityDate: Schema.tag<"2026-05-06">;
24
24
  form: Schema.refine<{
25
- readonly initial?: string | undefined;
25
+ readonly initial?: {
26
+ readonly data: string;
27
+ readonly request?: string | undefined;
28
+ } | undefined;
26
29
  readonly kind: "shwfed.component.form";
27
30
  readonly fields: readonly any[];
28
31
  readonly layouts: readonly {
@@ -77,7 +80,10 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
77
80
  }>;
78
81
  }>>>;
79
82
  kind: Schema.tag<"shwfed.component.form">;
80
- initial: Schema.optional<Schema.Schema<string, string, never>>;
83
+ initial: Schema.optional<Schema.Struct<{
84
+ request: Schema.optional<Schema.Schema<string, string, never>>;
85
+ data: Schema.Schema<string, string, never>;
86
+ }>>;
81
87
  readonly: Schema.optional<Schema.Schema<string, string, never>>;
82
88
  }>>;
83
89
  }>;
@@ -106,7 +106,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
106
106
  }[];
107
107
  } | undefined;
108
108
  readonly query?: {
109
- readonly initial?: string | undefined;
109
+ readonly initial?: {
110
+ readonly data: string;
111
+ readonly request?: string | undefined;
112
+ } | undefined;
110
113
  readonly kind: "shwfed.component.form";
111
114
  readonly fields: readonly any[];
112
115
  readonly layouts: readonly {
@@ -278,7 +281,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
278
281
  }[];
279
282
  } | undefined;
280
283
  readonly query?: {
281
- readonly initial?: string | undefined;
284
+ readonly initial?: {
285
+ readonly data: string;
286
+ readonly request?: string | undefined;
287
+ } | undefined;
282
288
  readonly kind: "shwfed.component.form";
283
289
  readonly fields: readonly any[];
284
290
  readonly layouts: readonly {
@@ -106,7 +106,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
106
106
  }[];
107
107
  } | undefined;
108
108
  readonly query?: {
109
- readonly initial?: string | undefined;
109
+ readonly initial?: {
110
+ readonly data: string;
111
+ readonly request?: string | undefined;
112
+ } | undefined;
110
113
  readonly kind: "shwfed.component.form";
111
114
  readonly fields: readonly any[];
112
115
  readonly layouts: readonly {
@@ -278,7 +281,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
278
281
  }[];
279
282
  } | undefined;
280
283
  readonly query?: {
281
- readonly initial?: string | undefined;
284
+ readonly initial?: {
285
+ readonly data: string;
286
+ readonly request?: string | undefined;
287
+ } | undefined;
282
288
  readonly kind: "shwfed.component.form";
283
289
  readonly fields: readonly any[];
284
290
  readonly layouts: readonly {
@@ -101,7 +101,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
101
101
  }[];
102
102
  } | undefined;
103
103
  readonly query?: {
104
- readonly initial?: string | undefined;
104
+ readonly initial?: {
105
+ readonly data: string;
106
+ readonly request?: string | undefined;
107
+ } | undefined;
105
108
  readonly kind: "shwfed.component.form";
106
109
  readonly fields: readonly any[];
107
110
  readonly layouts: readonly {
@@ -273,7 +276,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
273
276
  }[];
274
277
  } | undefined;
275
278
  readonly query?: {
276
- readonly initial?: string | undefined;
279
+ readonly initial?: {
280
+ readonly data: string;
281
+ readonly request?: string | undefined;
282
+ } | undefined;
277
283
  readonly kind: "shwfed.component.form";
278
284
  readonly fields: readonly any[];
279
285
  readonly layouts: readonly {
@@ -101,7 +101,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
101
101
  }[];
102
102
  } | undefined;
103
103
  readonly query?: {
104
- readonly initial?: string | undefined;
104
+ readonly initial?: {
105
+ readonly data: string;
106
+ readonly request?: string | undefined;
107
+ } | undefined;
105
108
  readonly kind: "shwfed.component.form";
106
109
  readonly fields: readonly any[];
107
110
  readonly layouts: readonly {
@@ -273,7 +276,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
273
276
  }[];
274
277
  } | undefined;
275
278
  readonly query?: {
276
- readonly initial?: string | undefined;
279
+ readonly initial?: {
280
+ readonly data: string;
281
+ readonly request?: string | undefined;
282
+ } | undefined;
277
283
  readonly kind: "shwfed.component.form";
278
284
  readonly fields: readonly any[];
279
285
  readonly layouts: readonly {
@@ -116,7 +116,10 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
116
116
  }[];
117
117
  } | undefined;
118
118
  readonly query?: {
119
- readonly initial?: string | undefined;
119
+ readonly initial?: {
120
+ readonly data: string;
121
+ readonly request?: string | undefined;
122
+ } | undefined;
120
123
  readonly kind: "shwfed.component.form";
121
124
  readonly fields: readonly any[];
122
125
  readonly layouts: readonly {
@@ -286,7 +289,10 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
286
289
  }>]>>;
287
290
  }>>;
288
291
  query: Schema.optional<Schema.refine<{
289
- readonly initial?: string | undefined;
292
+ readonly initial?: {
293
+ readonly data: string;
294
+ readonly request?: string | undefined;
295
+ } | undefined;
290
296
  readonly kind: "shwfed.component.form";
291
297
  readonly fields: readonly any[];
292
298
  readonly layouts: readonly {
@@ -341,7 +347,10 @@ export declare function schema(configure: (env: Environment) => void, _blockRef:
341
347
  }>;
342
348
  }>>>;
343
349
  kind: Schema.tag<"shwfed.component.form">;
344
- initial: Schema.optional<Schema.Schema<string, string, never>>;
350
+ initial: Schema.optional<Schema.Struct<{
351
+ request: Schema.optional<Schema.Schema<string, string, never>>;
352
+ data: Schema.Schema<string, string, never>;
353
+ }>>;
345
354
  readonly: Schema.optional<Schema.Schema<string, string, never>>;
346
355
  }>>>;
347
356
  cellStyle: Schema.optional<Schema.Schema<string, string, never>>;
@@ -32,13 +32,23 @@ const EXTRAS = [
32
32
  { id: "general", label: "\u901A\u7528\u914D\u7F6E", icon: "fluent:settings-20-regular" }
33
33
  ];
34
34
  const selection = ref({ kind: "extras", id: "general" });
35
- function updateInitial(value) {
35
+ function updateInitialData(value) {
36
36
  const next = { ...config.value };
37
37
  if (value.trim() === "") {
38
38
  const { initial: _omit, ...rest } = next;
39
39
  config.value = rest;
40
40
  } else {
41
- config.value = { ...next, initial: value };
41
+ config.value = { ...next, initial: { ...next.initial, data: value } };
42
+ }
43
+ }
44
+ function updateInitialRequest(value) {
45
+ const current = config.value.initial;
46
+ if (!current) return;
47
+ if (value.trim() === "") {
48
+ const { request: _omit, ...rest } = current;
49
+ config.value = { ...config.value, initial: rest };
50
+ } else {
51
+ config.value = { ...config.value, initial: { ...current, request: value } };
42
52
  }
43
53
  }
44
54
  function updateReadonly(value) {
@@ -73,15 +83,36 @@ function updateReadonly(value) {
73
83
  class="prose prose-sm prose-zinc"
74
84
  />
75
85
  </template>
76
- {{ generalFieldTitle("initial") }}
86
+ {{ generalFieldTitle("initial") }}(数据)
77
87
  </FieldLabel>
78
88
  <ExpressionEditor
79
- :model-value="config.initial ?? ''"
89
+ :model-value="config.initial?.data ?? ''"
80
90
  placeholder="如 { 'name': '', 'age': 0 }"
81
91
  result-type="dyn"
92
+ :extra-vars="{ json: { type: 'optional<dyn>', label: 'HTTP \u54CD\u5E94\u4F53', description: '\u300C\u8BF7\u6C42\u300D\u7684\u54CD\u5E94\u4F53\uFF08\u5DF2\u89E3\u6790 JSON\uFF09\uFF1B\u672A\u914D\u7F6E\u8BF7\u6C42\u65F6\u4E3A none' } }"
82
93
  multiline
83
94
  class="min-h-20"
84
- @update:model-value="updateInitial"
95
+ @update:model-value="updateInitialData"
96
+ />
97
+ </Field>
98
+
99
+ <Field orientation="vertical">
100
+ <FieldLabel class="text-xs text-zinc-500">
101
+ <template #tooltip>
102
+ <Markdown
103
+ source="可选的 HTTP 请求:返回 `HttpRequest`,由宿主发起,响应体作为 `json` 传给「数据」表达式"
104
+ block
105
+ class="prose prose-sm prose-zinc"
106
+ />
107
+ </template>
108
+ {{ generalFieldTitle("initial") }}(请求)
109
+ </FieldLabel>
110
+ <ExpressionEditor
111
+ :model-value="config.initial?.request ?? ''"
112
+ placeholder="如 http.get('https://api.example.com/record/1')"
113
+ result-type="HttpRequest"
114
+ class="min-h-10"
115
+ @update:model-value="updateInitialRequest"
85
116
  />
86
117
  </Field>
87
118
 
@@ -43,6 +43,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
43
43
  } | undefined;
44
44
  readonly precision?: number | undefined;
45
45
  readonly roundingMode?: "round" | "floor" | "ceil" | undefined;
46
+ readonly valueAsString?: boolean | undefined;
46
47
  }) => any;
47
48
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
48
49
  "onUpdate:modelValue"?: ((value: {
@@ -85,6 +86,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
85
86
  } | undefined;
86
87
  readonly precision?: number | undefined;
87
88
  readonly roundingMode?: "round" | "floor" | "ceil" | undefined;
89
+ readonly valueAsString?: boolean | undefined;
88
90
  }) => any) | undefined;
89
91
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
90
92
  declare const _default: typeof __VLS_export;
@@ -26,6 +26,7 @@ import {
26
26
  SelectTrigger,
27
27
  SelectValue
28
28
  } from "../../../../ui/select";
29
+ import { Switch } from "../../../../ui/switch";
29
30
  import { getStructFieldDescription, getStructFieldTitle } from "../../../schema";
30
31
  import { DEFAULT_FIELD_ORIENTATION, FIELD_ORIENTATION_OPTIONS } from "../../../utils/common";
31
32
  import { schema } from "./schema";
@@ -76,6 +77,14 @@ function onStepChange(v) {
76
77
  value.value = { ...value.value, step: v };
77
78
  }
78
79
  }
80
+ function onValueAsStringChange(next) {
81
+ if (next) {
82
+ value.value = { ...value.value, valueAsString: true };
83
+ } else {
84
+ const { valueAsString: _omit, ...rest } = value.value;
85
+ value.value = rest;
86
+ }
87
+ }
79
88
  </script>
80
89
 
81
90
  <template>
@@ -300,6 +309,28 @@ function onStepChange(v) {
300
309
  </Field>
301
310
  </div>
302
311
 
312
+ <Field orientation="vertical">
313
+ <FieldLabel class="text-xs text-zinc-500">
314
+ <template
315
+ v-if="fieldDescription('valueAsString')"
316
+ #tooltip
317
+ >
318
+ <Markdown
319
+ :source="fieldDescription('valueAsString')"
320
+ block
321
+ class="prose prose-sm prose-zinc"
322
+ />
323
+ </template>
324
+ {{ fieldTitle("valueAsString") }}
325
+ </FieldLabel>
326
+ <div>
327
+ <Switch
328
+ :model-value="value.valueAsString ?? false"
329
+ @update:model-value="onValueAsStringChange"
330
+ />
331
+ </div>
332
+ </Field>
333
+
303
334
  <div class="grid grid-cols-2 gap-3">
304
335
  <Field orientation="vertical">
305
336
  <FieldLabel class="text-xs text-zinc-500">
@@ -43,6 +43,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
43
43
  } | undefined;
44
44
  readonly precision?: number | undefined;
45
45
  readonly roundingMode?: "round" | "floor" | "ceil" | undefined;
46
+ readonly valueAsString?: boolean | undefined;
46
47
  }) => any;
47
48
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
48
49
  "onUpdate:modelValue"?: ((value: {
@@ -85,6 +86,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
85
86
  } | undefined;
86
87
  readonly precision?: number | undefined;
87
88
  readonly roundingMode?: "round" | "floor" | "ceil" | undefined;
89
+ readonly valueAsString?: boolean | undefined;
88
90
  }) => any) | undefined;
89
91
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
90
92
  declare const _default: typeof __VLS_export;
@@ -62,8 +62,18 @@ const formatOptions = computed(() => ({
62
62
  }));
63
63
  const { draft, commit } = useFieldValue({
64
64
  binding: () => props.config.binding,
65
- fromState: (raw) => typeof raw === "number" && Number.isFinite(raw) ? raw : void 0,
66
- toState: (next) => typeof next === "number" && Number.isFinite(next) ? next : null
65
+ fromState: (raw) => {
66
+ if (typeof raw === "number" && Number.isFinite(raw)) return raw;
67
+ if (typeof raw === "string" && raw.length > 0) {
68
+ const n = Number(raw);
69
+ return Number.isFinite(n) ? n : void 0;
70
+ }
71
+ return void 0;
72
+ },
73
+ toState: (next) => {
74
+ if (typeof next !== "number" || !Number.isFinite(next)) return null;
75
+ return props.config.valueAsString ? String(next) : next;
76
+ }
67
77
  });
68
78
  function applyRounding(n, precision, mode) {
69
79
  const factor = 10 ** precision;
@@ -49,6 +49,7 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
49
49
  precision: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
50
50
  roundingMode: Schema.optional<Schema.Literal<["round", "floor", "ceil"]>>;
51
51
  step: Schema.optional<Schema.refine<number, typeof Schema.Number>>;
52
+ valueAsString: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
52
53
  min: Schema.optional<Schema.Schema<string, string, never>>;
53
54
  max: Schema.optional<Schema.Schema<string, string, never>>;
54
55
  id: Schema.refine<string, typeof Schema.String>;
@@ -55,6 +55,10 @@ export function schema(configure) {
55
55
  title: "\u6B65\u957F",
56
56
  description: "\u53D6\u503C\u7684\u6700\u5C0F\u6B65\u957F\uFF1B\u7559\u7A7A\u65F6\u4E0D\u9650\u5236\uFF08\u4EFB\u610F\u7CBE\u5EA6\uFF09"
57
57
  })),
58
+ valueAsString: Schema.optional(Schema.Boolean.annotations({
59
+ title: "\u4EE5\u5B57\u7B26\u4E32\u8BFB\u5199",
60
+ description: "\u5F00\u542F\u540E\u8868\u5355\u72B6\u6001\u4EE5\u5B57\u7B26\u4E32\u5F62\u5F0F\u5B58\u50A8\u8BE5\u503C\uFF08\u9002\u7528\u4E8E\u540E\u7AEF\u4F7F\u7528 `DECIMAL` / `BIGINT` \u7B49\u9700\u8981\u539F\u6837\u56DE\u4F20\u7684\u5B57\u6BB5\uFF09\uFF1B\u5173\u95ED\u65F6\u82E5\u8BFB\u5230\u7684\u662F\u6570\u503C\u5B57\u7B26\u4E32\u4E5F\u4F1A\u88AB\u89E3\u6790\uFF0C\u4F46\u5199\u56DE\u4ECD\u4E3A\u6570\u503C\u3002\u6CE8\u610F\uFF1A\u8F93\u5165\u65F6\u4ECD\u7ECF\u8FC7 JavaScript \u6D6E\u70B9\u6570\uFF0C\u4EC5\u80FD\u5728\u300C\u88C5\u8F7D-\u56DE\u4F20\u300D\u672A\u7F16\u8F91\u573A\u666F\u4E0B\u4FDD\u7559\u7CBE\u5EA6"
61
+ })),
58
62
  min: Schema.optional(CelNumber.annotations({
59
63
  title: "\u6700\u5C0F\u503C",
60
64
  description: "\u5141\u8BB8\u8F93\u5165\u7684\u6700\u5C0F\u503C\u8868\u8FBE\u5F0F\uFF1B\u7559\u7A7A\u65F6\u4E0D\u9650\u5236\u4E0B\u9650"
@@ -51,6 +51,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
51
51
  readonly precision?: number | undefined;
52
52
  readonly roundingMode?: "round" | "floor" | "ceil" | undefined;
53
53
  readonly rangeSeparatorIcon?: string | undefined;
54
+ readonly valueAsString?: boolean | undefined;
54
55
  }) => any;
55
56
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
56
57
  "onUpdate:modelValue"?: ((value: {
@@ -101,6 +102,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
101
102
  readonly precision?: number | undefined;
102
103
  readonly roundingMode?: "round" | "floor" | "ceil" | undefined;
103
104
  readonly rangeSeparatorIcon?: string | undefined;
105
+ readonly valueAsString?: boolean | undefined;
104
106
  }) => any) | undefined;
105
107
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
106
108
  declare const _default: typeof __VLS_export;
@@ -28,6 +28,7 @@ import {
28
28
  SelectTrigger,
29
29
  SelectValue
30
30
  } from "../../../../ui/select";
31
+ import { Switch } from "../../../../ui/switch";
31
32
  import { getStructFieldDescription, getStructFieldTitle } from "../../../schema";
32
33
  import { DEFAULT_FIELD_ORIENTATION, FIELD_ORIENTATION_OPTIONS } from "../../../utils/common";
33
34
  import { schema } from "./schema";
@@ -112,6 +113,14 @@ function setSeparatorIcon(next) {
112
113
  value.value = { ...value.value, rangeSeparatorIcon: trimmed };
113
114
  }
114
115
  }
116
+ function onValueAsStringChange(next) {
117
+ if (next) {
118
+ value.value = { ...value.value, valueAsString: true };
119
+ } else {
120
+ const { valueAsString: _omit, ...rest } = value.value;
121
+ value.value = rest;
122
+ }
123
+ }
115
124
  </script>
116
125
 
117
126
  <template>
@@ -468,6 +477,28 @@ function setSeparatorIcon(next) {
468
477
  @update:model-value="setSeparatorIcon"
469
478
  />
470
479
  </Field>
480
+
481
+ <Field orientation="vertical">
482
+ <FieldLabel class="text-xs text-zinc-500">
483
+ <template
484
+ v-if="fieldDescription('valueAsString')"
485
+ #tooltip
486
+ >
487
+ <Markdown
488
+ :source="fieldDescription('valueAsString')"
489
+ block
490
+ class="prose prose-sm prose-zinc"
491
+ />
492
+ </template>
493
+ {{ fieldTitle("valueAsString") }}
494
+ </FieldLabel>
495
+ <div>
496
+ <Switch
497
+ :model-value="value.valueAsString ?? false"
498
+ @update:model-value="onValueAsStringChange"
499
+ />
500
+ </div>
501
+ </Field>
471
502
  </div>
472
503
 
473
504
  <div class="grid grid-cols-3 gap-3">
@@ -51,6 +51,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
51
51
  readonly precision?: number | undefined;
52
52
  readonly roundingMode?: "round" | "floor" | "ceil" | undefined;
53
53
  readonly rangeSeparatorIcon?: string | undefined;
54
+ readonly valueAsString?: boolean | undefined;
54
55
  }) => any;
55
56
  }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
56
57
  "onUpdate:modelValue"?: ((value: {
@@ -101,6 +102,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
101
102
  readonly precision?: number | undefined;
102
103
  readonly roundingMode?: "round" | "floor" | "ceil" | undefined;
103
104
  readonly rangeSeparatorIcon?: string | undefined;
105
+ readonly valueAsString?: boolean | undefined;
104
106
  }) => any) | undefined;
105
107
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
106
108
  declare const _default: typeof __VLS_export;
@@ -63,15 +63,23 @@ const formatOptions = computed(() => ({
63
63
  useGrouping: false,
64
64
  maximumFractionDigits: 20
65
65
  }));
66
+ function asNumber(raw) {
67
+ if (typeof raw === "number" && Number.isFinite(raw)) return raw;
68
+ if (typeof raw === "string" && raw.length > 0) {
69
+ const n = Number(raw);
70
+ return Number.isFinite(n) ? n : void 0;
71
+ }
72
+ return void 0;
73
+ }
66
74
  function asRange(raw) {
67
75
  if (!Array.isArray(raw) || raw.length !== 2) return void 0;
68
- const [a, b] = raw;
69
- if (typeof a !== "number" || typeof b !== "number") return void 0;
70
- if (!Number.isFinite(a) || !Number.isFinite(b)) return void 0;
76
+ const a = asNumber(raw[0]);
77
+ const b = asNumber(raw[1]);
78
+ if (a == null || b == null) return void 0;
71
79
  return [a, b];
72
80
  }
73
- function asNumber(raw) {
74
- return typeof raw === "number" && Number.isFinite(raw) ? raw : void 0;
81
+ function shape(n) {
82
+ return props.config.valueAsString ? String(n) : n;
75
83
  }
76
84
  const uncontrolled = ref(void 0);
77
85
  const model = computed({
@@ -91,11 +99,11 @@ const model = computed({
91
99
  return;
92
100
  }
93
101
  if (typeof binding === "string") {
94
- setAt(binding, next ?? null);
102
+ setAt(binding, next ? [shape(next[0]), shape(next[1])] : null);
95
103
  return;
96
104
  }
97
- setAt(binding[0], next?.[0] ?? null);
98
- setAt(binding[1], next?.[1] ?? null);
105
+ setAt(binding[0], next ? shape(next[0]) : null);
106
+ setAt(binding[1], next ? shape(next[1]) : null);
99
107
  }
100
108
  });
101
109
  const localStart = ref(model.value?.[0]);
@@ -56,6 +56,7 @@ export declare function schema(configure: (env: Environment) => void): Schema.St
56
56
  precision: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
57
57
  roundingMode: Schema.optional<Schema.Literal<["round", "floor", "ceil"]>>;
58
58
  step: Schema.optional<Schema.refine<number, typeof Schema.Number>>;
59
+ valueAsString: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
59
60
  min: Schema.optional<Schema.Schema<string, string, never>>;
60
61
  max: Schema.optional<Schema.Schema<string, string, never>>;
61
62
  rangeSeparatorIcon: Schema.optional<Schema.refine<string, typeof Schema.String>>;
@@ -66,6 +66,10 @@ export function schema(configure) {
66
66
  title: "\u6B65\u957F",
67
67
  description: "\u53D6\u503C\u7684\u6700\u5C0F\u6B65\u957F\uFF1B\u7559\u7A7A\u65F6\u4E0D\u9650\u5236\uFF08\u4EFB\u610F\u7CBE\u5EA6\uFF09"
68
68
  })),
69
+ valueAsString: Schema.optional(Schema.Boolean.annotations({
70
+ title: "\u4EE5\u5B57\u7B26\u4E32\u8BFB\u5199",
71
+ description: "\u5F00\u542F\u540E\u8868\u5355\u72B6\u6001\u4EE5\u5B57\u7B26\u4E32\u5F62\u5F0F\u5B58\u50A8\u4E24\u7AEF\u7684\u503C\uFF08\u9002\u7528\u4E8E\u540E\u7AEF\u4F7F\u7528 `DECIMAL` / `BIGINT` \u7B49\u9700\u8981\u539F\u6837\u56DE\u4F20\u7684\u5B57\u6BB5\uFF09\uFF1B\u5173\u95ED\u65F6\u82E5\u8BFB\u5230\u7684\u662F\u6570\u503C\u5B57\u7B26\u4E32\u4E5F\u4F1A\u88AB\u89E3\u6790\uFF0C\u4F46\u5199\u56DE\u4ECD\u4E3A\u6570\u503C\u3002\u6CE8\u610F\uFF1A\u8F93\u5165\u65F6\u4ECD\u7ECF\u8FC7 JavaScript \u6D6E\u70B9\u6570\uFF0C\u4EC5\u80FD\u5728\u300C\u88C5\u8F7D-\u56DE\u4F20\u300D\u672A\u7F16\u8F91\u573A\u666F\u4E0B\u4FDD\u7559\u7CBE\u5EA6"
72
+ })),
69
73
  min: Schema.optional(CelNumber.annotations({
70
74
  title: "\u6700\u5C0F\u503C",
71
75
  description: "\u5141\u8BB8\u8F93\u5165\u7684\u6700\u5C0F\u503C\u8868\u8FBE\u5F0F\uFF1B\u540C\u65F6\u4F5C\u7528\u4E8E\u8D77\u59CB\u4E0E\u7ED3\u675F\u8F93\u5165"
@@ -11,7 +11,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
11
11
  readonly locale: "en" | "ja" | "ko";
12
12
  readonly message: string;
13
13
  }[]] | undefined;
14
- readonly template?: string | undefined;
14
+ readonly template?: {
15
+ readonly download?: string | undefined;
16
+ readonly request: string;
17
+ } | undefined;
15
18
  readonly disabled?: string | undefined;
16
19
  readonly type: "com.shwfed.form.field.upload";
17
20
  readonly id: string;
@@ -65,7 +68,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
65
68
  readonly locale: "en" | "ja" | "ko";
66
69
  readonly message: string;
67
70
  }[]] | undefined;
68
- readonly template?: string | undefined;
71
+ readonly template?: {
72
+ readonly download?: string | undefined;
73
+ readonly request: string;
74
+ } | undefined;
69
75
  readonly disabled?: string | undefined;
70
76
  readonly type: "com.shwfed.form.field.upload";
71
77
  readonly id: string;