@shwfed/config 2.9.12 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mcp.mjs +1610 -1107
- package/dist/module.json +1 -1
- package/dist/preview/assets/{FieldGroup.vue_vue_type_script_setup_true_lang-CpDhqXJp.js → FieldGroup.vue_vue_type_script_setup_true_lang-CCaOWk_7.js} +1 -1
- package/dist/preview/assets/{badge-Dsz2Rn8b.js → badge-D9_7atSJ.js} +1 -1
- package/dist/preview/assets/{config-vsMk-zRS.js → config-B2d8SiPi.js} +1 -1
- package/dist/preview/assets/{config-if9TvUw2.js → config-BLEovXei.js} +1 -1
- package/dist/preview/assets/{config-CRD1MpEn.js → config-Bf5Vckj3.js} +1 -1
- package/dist/preview/assets/{config-BePS5kQb.js → config-Bk2VSNeu.js} +1 -1
- package/dist/preview/assets/{config-X6-9yQmS.js → config-C8lCItmz.js} +1 -1
- package/dist/preview/assets/{config-CQLR1Zao.js → config-C9WPOoA7.js} +1 -1
- package/dist/preview/assets/{config-9-c5e5iP.js → config-CNKb25Qo.js} +1 -1
- package/dist/preview/assets/{config-DY7nQeRd.js → config-CQrqVV1U.js} +1 -1
- package/dist/preview/assets/{config-bFWnH6k3.js → config-DWA385pD.js} +1 -1
- package/dist/preview/assets/{config-Y2YuesjH.js → config-DYxMKhCU.js} +1 -1
- package/dist/preview/assets/{config-BCvaA0as.js → config-DZlaJUlF.js} +1 -1
- package/dist/preview/assets/{config-hrBgOr32.js → config-DyPl6K2G.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-CPrYbKjH.js → definition.vue_vue_type_script_setup_true_lang-CFzQ7icU.js} +1 -1
- package/dist/preview/assets/index-7BE56IYF.js +739 -0
- package/dist/preview/assets/{index-DJ5rzQJr.css → index-BnJ5p1Mx.css} +1 -1
- package/dist/preview/assets/index-Bwv0Yz_L.js +1 -0
- package/dist/preview/assets/{index-DFRXx_kG.js → index-CXOEVGFP.js} +1 -1
- package/dist/preview/assets/{item-auVJu6jy.js → item-DCVX69_o.js} +1 -1
- package/dist/preview/assets/{runtime-DyeSWij2.js → runtime-BD1A-g1h.js} +1 -1
- package/dist/preview/assets/{runtime-1DsatQOR.js → runtime-BNk4EliL.js} +1 -1
- package/dist/preview/assets/{runtime-Do_KQ5le.js → runtime-BO-KY3T_.js} +1 -1
- package/dist/preview/assets/{runtime-_5B97gRO.js → runtime-BsNSI1XP.js} +1 -1
- package/dist/preview/assets/{runtime-28a_li4U.js → runtime-Cbc5NH57.js} +1 -1
- package/dist/preview/assets/{runtime-DaaQn8fX.js → runtime-DEWGIyvr.js} +1 -1
- package/dist/preview/assets/{runtime-H7c112vi.js → runtime-DJ9ElxWB.js} +1 -1
- package/dist/preview/assets/{runtime-CBDARlsK.js → runtime-DSfMvph3.js} +1 -1
- package/dist/preview/assets/{runtime-CmgeUPz4.js → runtime-O6MNC3GA.js} +1 -1
- package/dist/preview/assets/{runtime-BDvuTpxY.js → runtime-r1wbrr4k.js} +1 -1
- package/dist/preview/assets/{schema-meta-Dc89aD6v.js → schema-meta-ovcuERKg.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/schema.d.ts +15 -0
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/schema.js +57 -1
- package/dist/runtime/components/actions/components/triggers-field.vue +12 -12
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +134 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +134 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +134 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +134 -0
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +195 -0
- package/dist/runtime/components/config/use-editor.js +1 -1
- package/dist/runtime/components/config/utils/validation-error.d.ts +1 -1
- package/dist/runtime/components/config/utils/validation-error.js +40 -7
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.markdown/runtime.vue +3 -3
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/runtime.vue +6 -5
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/runtime.vue +6 -5
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/runtime.vue +10 -8
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/runtime.vue +8 -6
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/runtime.vue +10 -8
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/runtime.vue +8 -6
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/runtime.vue +10 -8
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/runtime.vue +7 -5
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/runtime.vue +8 -6
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/runtime.vue +7 -6
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/runtime.vue +9 -7
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-04-29/com.shwfed.form.field.combobox.single/runtime.vue +8 -6
- package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/runtime.vue +5 -4
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/runtime.vue +12 -10
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/runtime.vue +5 -4
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.checkbox.group/runtime.vue +9 -7
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.radio.group/runtime.vue +9 -7
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.d.vue.ts +2 -0
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.vue.d.ts +2 -0
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.d.ts +2 -0
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.vue +13 -15
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/runtime.vue +8 -6
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.vue +10 -8
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/runtime.vue +10 -8
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/runtime.vue +13 -14
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/runtime.vue +13 -14
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.vue +14 -12
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.vue +14 -12
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.vue +13 -14
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.vue +13 -14
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue +13 -15
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue +15 -16
- package/dist/runtime/components/form/fields/2026-06-09/com.shwfed.form.field.upload/runtime.vue +8 -7
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/config.d.vue.ts +175 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/config.vue +782 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/config.vue.d.ts +175 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/runtime.vue +413 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/schema.d.ts +214 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/schema.js +191 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/config.d.vue.ts +175 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/config.vue +782 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/config.vue.d.ts +175 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/runtime.vue +426 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/schema.d.ts +214 -0
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/schema.js +191 -0
- package/dist/runtime/components/form/fields/2026-06-14/combobox-migrate.d.ts +18 -0
- package/dist/runtime/components/form/fields/2026-06-14/combobox-migrate.js +36 -0
- package/dist/runtime/components/form/utils/state.d.ts +11 -0
- package/dist/runtime/components/form/utils/state.js +5 -0
- package/dist/runtime/components/operations/2026-06-11/com.shwfed.operation.http.request.json/runtime.js +5 -3
- package/dist/runtime/components/operations/2026-06-11/com.shwfed.operation.http.request.json/schema.js +3 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/config.d.vue.ts +3 -3
- package/dist/runtime/components/table/config.vue +54 -20
- package/dist/runtime/components/table/config.vue.d.ts +3 -3
- package/dist/runtime/components/table/index.d.vue.ts +2 -0
- package/dist/runtime/components/table/index.vue +12 -3
- package/dist/runtime/components/table/index.vue.d.ts +2 -0
- package/dist/runtime/components/table/schema.d.ts +263 -0
- package/dist/runtime/components/table/schema.js +8 -4
- package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue +1 -1
- package/dist/runtime/share/expression.js +1 -0
- package/package.json +1 -1
- package/dist/preview/assets/index-BoyzyftU.js +0 -1
- package/dist/preview/assets/index-Bvlt8fEt.js +0 -734
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
|
|
3
|
+
import type { MigrateFn, MigrateSource } from '../../../utils/resolve.js';
|
|
4
|
+
export declare const type: "com.shwfed.form.field.combobox.single";
|
|
5
|
+
export declare const compatibilityDate: "2026-06-14";
|
|
6
|
+
export declare const metadata: {
|
|
7
|
+
readonly name: "下拉单选";
|
|
8
|
+
readonly icon: "fluent:chevron-down-20-regular";
|
|
9
|
+
readonly w: {
|
|
10
|
+
readonly initial: 8;
|
|
11
|
+
readonly min: 4;
|
|
12
|
+
readonly max: number;
|
|
13
|
+
};
|
|
14
|
+
readonly h: {
|
|
15
|
+
readonly initial: 2;
|
|
16
|
+
readonly min: 2;
|
|
17
|
+
readonly max: 2;
|
|
18
|
+
};
|
|
19
|
+
readonly selection: true;
|
|
20
|
+
};
|
|
21
|
+
export declare function itemSchema(configure: (env: Environment) => void): Schema.Struct<{
|
|
22
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
23
|
+
label: Schema.TupleType<readonly [Schema.Struct<{
|
|
24
|
+
locale: Schema.Literal<["zh"]>;
|
|
25
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
26
|
+
}>], [Schema.Struct<{
|
|
27
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
28
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
29
|
+
}>]>;
|
|
30
|
+
value: Schema.Union<[Schema.Struct<{
|
|
31
|
+
kind: Schema.Literal<["text"]>;
|
|
32
|
+
value: typeof Schema.String;
|
|
33
|
+
}>, Schema.Struct<{
|
|
34
|
+
kind: Schema.Literal<["number"]>;
|
|
35
|
+
value: typeof Schema.Number;
|
|
36
|
+
}>]>;
|
|
37
|
+
tooltip: Schema.optional<Schema.refine<readonly [{
|
|
38
|
+
readonly locale: "zh";
|
|
39
|
+
readonly message: string;
|
|
40
|
+
}, ...{
|
|
41
|
+
readonly locale: "en" | "ja" | "ko";
|
|
42
|
+
readonly message: string;
|
|
43
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
44
|
+
locale: Schema.Literal<["zh"]>;
|
|
45
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
46
|
+
}>], [Schema.Struct<{
|
|
47
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
48
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
49
|
+
}>]>>>;
|
|
50
|
+
keywords: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
51
|
+
}>;
|
|
52
|
+
export declare function remoteOptionsSchema(configure: (env: Environment) => void): Schema.Struct<{
|
|
53
|
+
kind: Schema.Literal<["remote"]>;
|
|
54
|
+
request: Schema.optional<Schema.Union<[Schema.Literal<[""]>, Schema.Schema<string, string, never>]>>;
|
|
55
|
+
options: Schema.Schema<string, string, never>;
|
|
56
|
+
optionValue: Schema.optionalWith<Schema.Schema<string, string, never>, {
|
|
57
|
+
default: () => string;
|
|
58
|
+
}>;
|
|
59
|
+
optionLabel: Schema.Schema<string, string, never>;
|
|
60
|
+
optionKeywords: Schema.optional<Schema.Schema<string, string, never>>;
|
|
61
|
+
}>;
|
|
62
|
+
export declare function optionsSchema(configure: (env: Environment) => void): Schema.Union<[Schema.Struct<{
|
|
63
|
+
kind: Schema.Literal<["static"]>;
|
|
64
|
+
items: Schema.optionalWith<Schema.Array$<Schema.Struct<{
|
|
65
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
66
|
+
label: Schema.TupleType<readonly [Schema.Struct<{
|
|
67
|
+
locale: Schema.Literal<["zh"]>;
|
|
68
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
69
|
+
}>], [Schema.Struct<{
|
|
70
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
71
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
72
|
+
}>]>;
|
|
73
|
+
value: Schema.Union<[Schema.Struct<{
|
|
74
|
+
kind: Schema.Literal<["text"]>;
|
|
75
|
+
value: typeof Schema.String;
|
|
76
|
+
}>, Schema.Struct<{
|
|
77
|
+
kind: Schema.Literal<["number"]>;
|
|
78
|
+
value: typeof Schema.Number;
|
|
79
|
+
}>]>;
|
|
80
|
+
tooltip: Schema.optional<Schema.refine<readonly [{
|
|
81
|
+
readonly locale: "zh";
|
|
82
|
+
readonly message: string;
|
|
83
|
+
}, ...{
|
|
84
|
+
readonly locale: "en" | "ja" | "ko";
|
|
85
|
+
readonly message: string;
|
|
86
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
87
|
+
locale: Schema.Literal<["zh"]>;
|
|
88
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
89
|
+
}>], [Schema.Struct<{
|
|
90
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
91
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
92
|
+
}>]>>>;
|
|
93
|
+
keywords: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
94
|
+
}>>, {
|
|
95
|
+
default: () => readonly [];
|
|
96
|
+
}>;
|
|
97
|
+
}>, Schema.Struct<{
|
|
98
|
+
kind: Schema.Literal<["remote"]>;
|
|
99
|
+
request: Schema.optional<Schema.Union<[Schema.Literal<[""]>, Schema.Schema<string, string, never>]>>;
|
|
100
|
+
options: Schema.Schema<string, string, never>;
|
|
101
|
+
optionValue: Schema.optionalWith<Schema.Schema<string, string, never>, {
|
|
102
|
+
default: () => string;
|
|
103
|
+
}>;
|
|
104
|
+
optionLabel: Schema.Schema<string, string, never>;
|
|
105
|
+
optionKeywords: Schema.optional<Schema.Schema<string, string, never>>;
|
|
106
|
+
}>]>;
|
|
107
|
+
export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
|
|
108
|
+
label: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
109
|
+
locale: Schema.Literal<["zh"]>;
|
|
110
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
111
|
+
}>], [Schema.Struct<{
|
|
112
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
113
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
114
|
+
}>]>>;
|
|
115
|
+
placeholder: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
116
|
+
locale: Schema.Literal<["zh"]>;
|
|
117
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
118
|
+
}>], [Schema.Struct<{
|
|
119
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
120
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
121
|
+
}>]>>;
|
|
122
|
+
tooltip: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
123
|
+
locale: Schema.Literal<["zh"]>;
|
|
124
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
125
|
+
}>], [Schema.Struct<{
|
|
126
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
127
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
128
|
+
}>]>>;
|
|
129
|
+
orientation: Schema.optional<Schema.Literal<["vertical", "floating"]>>;
|
|
130
|
+
binding: Schema.optional<Schema.refine<string, typeof Schema.String>>;
|
|
131
|
+
disabled: Schema.optional<Schema.Schema<string, string, never>>;
|
|
132
|
+
readonly: Schema.optional<Schema.Schema<string, string, never>>;
|
|
133
|
+
derived: Schema.optional<Schema.Struct<{
|
|
134
|
+
mode: Schema.Literal<["formula", "prefill"]>;
|
|
135
|
+
expression: Schema.Schema<string, string, never>;
|
|
136
|
+
}>>;
|
|
137
|
+
options: Schema.optionalWith<Schema.Union<[Schema.Struct<{
|
|
138
|
+
kind: Schema.Literal<["static"]>;
|
|
139
|
+
items: Schema.optionalWith<Schema.Array$<Schema.Struct<{
|
|
140
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
141
|
+
label: Schema.TupleType<readonly [Schema.Struct<{
|
|
142
|
+
locale: Schema.Literal<["zh"]>;
|
|
143
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
144
|
+
}>], [Schema.Struct<{
|
|
145
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
146
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
147
|
+
}>]>;
|
|
148
|
+
value: Schema.Union<[Schema.Struct<{
|
|
149
|
+
kind: Schema.Literal<["text"]>;
|
|
150
|
+
value: typeof Schema.String;
|
|
151
|
+
}>, Schema.Struct<{
|
|
152
|
+
kind: Schema.Literal<["number"]>;
|
|
153
|
+
value: typeof Schema.Number;
|
|
154
|
+
}>]>;
|
|
155
|
+
tooltip: Schema.optional<Schema.refine<readonly [{
|
|
156
|
+
readonly locale: "zh";
|
|
157
|
+
readonly message: string;
|
|
158
|
+
}, ...{
|
|
159
|
+
readonly locale: "en" | "ja" | "ko";
|
|
160
|
+
readonly message: string;
|
|
161
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
162
|
+
locale: Schema.Literal<["zh"]>;
|
|
163
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
164
|
+
}>], [Schema.Struct<{
|
|
165
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
166
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
167
|
+
}>]>>>;
|
|
168
|
+
keywords: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
169
|
+
}>>, {
|
|
170
|
+
default: () => readonly [];
|
|
171
|
+
}>;
|
|
172
|
+
}>, Schema.Struct<{
|
|
173
|
+
kind: Schema.Literal<["remote"]>;
|
|
174
|
+
request: Schema.optional<Schema.Union<[Schema.Literal<[""]>, Schema.Schema<string, string, never>]>>;
|
|
175
|
+
options: Schema.Schema<string, string, never>;
|
|
176
|
+
optionValue: Schema.optionalWith<Schema.Schema<string, string, never>, {
|
|
177
|
+
default: () => string;
|
|
178
|
+
}>;
|
|
179
|
+
optionLabel: Schema.Schema<string, string, never>;
|
|
180
|
+
optionKeywords: Schema.optional<Schema.Schema<string, string, never>>;
|
|
181
|
+
}>]>, {
|
|
182
|
+
default: () => {
|
|
183
|
+
kind: "static";
|
|
184
|
+
items: readonly [];
|
|
185
|
+
};
|
|
186
|
+
}>;
|
|
187
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
188
|
+
displayName: Schema.optional<Schema.SchemaClass<string, string, never>>;
|
|
189
|
+
hidden: Schema.optional<Schema.Schema<string, string, never>>;
|
|
190
|
+
required: Schema.optional<Schema.Schema<string, string, never>>;
|
|
191
|
+
validations: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
192
|
+
when: Schema.Schema<string, string, never>;
|
|
193
|
+
warning: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
194
|
+
message: Schema.refine<readonly [{
|
|
195
|
+
readonly locale: "zh";
|
|
196
|
+
readonly message: string;
|
|
197
|
+
}, ...{
|
|
198
|
+
readonly locale: "en" | "ja" | "ko";
|
|
199
|
+
readonly message: string;
|
|
200
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
201
|
+
locale: Schema.Literal<["zh"]>;
|
|
202
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
203
|
+
}>], [Schema.Struct<{
|
|
204
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
205
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
206
|
+
}>]>>;
|
|
207
|
+
}>>>;
|
|
208
|
+
type: Schema.Literal<["com.shwfed.form.field.combobox.single"]>;
|
|
209
|
+
compatibilityDate: Schema.Literal<["2026-06-14"]>;
|
|
210
|
+
}>;
|
|
211
|
+
export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
|
|
212
|
+
export declare function defaults(): Partial<Value>;
|
|
213
|
+
export declare const migrateFrom: ReadonlyArray<MigrateSource>;
|
|
214
|
+
export declare const migrate: MigrateFn;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { Expression, HttpRequestResult, LocaleMarkdown } from "../../../../../share/expression.js";
|
|
3
|
+
import { Locale } from "../../../../../share/locale.js";
|
|
4
|
+
import { commonFieldFields, derivedField, FieldOrientationSchema } from "../../../utils/common.js";
|
|
5
|
+
import { localeLabelToExpression } from "../combobox-migrate.js";
|
|
6
|
+
export const type = "com.shwfed.form.field.combobox.single";
|
|
7
|
+
export const compatibilityDate = "2026-06-14";
|
|
8
|
+
export const metadata = {
|
|
9
|
+
name: "\u4E0B\u62C9\u5355\u9009",
|
|
10
|
+
icon: "fluent:chevron-down-20-regular",
|
|
11
|
+
w: { initial: 8, min: 4, max: Infinity },
|
|
12
|
+
h: { initial: 2, min: 2, max: 2 },
|
|
13
|
+
// Publishes its resolved option to the `selections` registry (runtime.vue), so
|
|
14
|
+
// a sibling expression can read the full chosen record via `selections["<id>"]`.
|
|
15
|
+
selection: true
|
|
16
|
+
};
|
|
17
|
+
const isListType = (actual) => actual === "dyn" || actual.startsWith("list") || actual.startsWith("optional");
|
|
18
|
+
function configureWithOption(configure) {
|
|
19
|
+
return (env) => {
|
|
20
|
+
configure(env);
|
|
21
|
+
env.registerVariable("option", "dyn", { description: "`\u9009\u9879` \u8868\u8FBE\u5F0F\u4EA7\u51FA\u7684\u6570\u7EC4\u4E2D\u8FED\u4EE3\u5230\u7684\u5355\u4E2A\u5143\u7D20" });
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function configureWithJson(configure) {
|
|
25
|
+
return (env) => {
|
|
26
|
+
configure(env);
|
|
27
|
+
env.registerVariable("json", "dyn", { description: "HTTP \u54CD\u5E94\u4F53\uFF08\u5DF2\u89E3\u6790 JSON\uFF09\uFF1B\u672A\u914D\u7F6E\u8BF7\u6C42\u6216\u8BF7\u6C42\u5931\u8D25\u65F6\u4E3A `null`" });
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function itemSchema(configure) {
|
|
31
|
+
const LocaleMd = LocaleMarkdown({ configure });
|
|
32
|
+
const TextValue = Schema.Struct({
|
|
33
|
+
kind: Schema.Literal("text"),
|
|
34
|
+
value: Schema.String
|
|
35
|
+
});
|
|
36
|
+
const NumberValue = Schema.Struct({
|
|
37
|
+
kind: Schema.Literal("number"),
|
|
38
|
+
value: Schema.Number
|
|
39
|
+
});
|
|
40
|
+
const ItemValue = Schema.Union(TextValue, NumberValue).annotations({
|
|
41
|
+
title: "\u503C",
|
|
42
|
+
description: "\u9009\u9879\u7ED1\u5B9A\u7684\u503C\uFF0C\u53EF\u4EE5\u662F\u6587\u672C\u6216\u6570\u5B57"
|
|
43
|
+
});
|
|
44
|
+
return Schema.Struct({
|
|
45
|
+
id: Schema.UUID.annotations({ description: "\u9009\u9879\u552F\u4E00\u6807\u8BC6\uFF0C\u7528\u4E8E\u7A33\u5B9A\u7684 v-for key" }),
|
|
46
|
+
label: Locale.annotations({
|
|
47
|
+
title: "\u6807\u7B7E",
|
|
48
|
+
description: "\u9009\u9879\u5C55\u793A\u7684\u672C\u5730\u5316\u7EAF\u6587\u672C\uFF08\u4E0D\u652F\u6301 Markdown \u6216\u63D2\u503C\uFF09"
|
|
49
|
+
}),
|
|
50
|
+
value: ItemValue,
|
|
51
|
+
tooltip: Schema.optional(LocaleMd.annotations({
|
|
52
|
+
title: "\u63D0\u793A",
|
|
53
|
+
description: "\u9F20\u6807\u60AC\u505C\u5728\u9009\u9879\u4E0A\u65F6\u5C55\u793A\u7684\u672C\u5730\u5316\u63D0\u793A\uFF0C\u652F\u6301 Markdown"
|
|
54
|
+
})),
|
|
55
|
+
keywords: Schema.optional(Schema.Array(Schema.String).annotations({
|
|
56
|
+
title: "\u5173\u952E\u8BCD",
|
|
57
|
+
description: "\u9664\u6807\u7B7E\u4E4B\u5916\u53EF\u53C2\u4E0E\u641C\u7D22\u8FC7\u6EE4\u7684\u9644\u52A0\u8BCD\u6761\u5217\u8868\uFF08\u522B\u540D\u3001\u7F16\u7801\u3001\u62FC\u97F3\u7B49\uFF09\uFF1B\u4E0D\u5C55\u793A\uFF0C\u4EC5\u7528\u4E8E\u5339\u914D"
|
|
58
|
+
}))
|
|
59
|
+
}).annotations({
|
|
60
|
+
title: "ComboboxSingleItem"
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export function remoteOptionsSchema(configure) {
|
|
64
|
+
const CelRequest = Schema.Union(
|
|
65
|
+
Schema.Literal(""),
|
|
66
|
+
Expression({ configure, resultType: HttpRequestResult })
|
|
67
|
+
);
|
|
68
|
+
const CelOptions = Expression({ configure: configureWithJson(configure), resultType: isListType });
|
|
69
|
+
const CelOptionValue = Expression({ configure: configureWithOption(configure), resultType: "dyn" });
|
|
70
|
+
const CelOptionLabel = Expression({ configure: configureWithOption(configure), resultType: "dyn" });
|
|
71
|
+
const CelKeywords = Expression({
|
|
72
|
+
configure: configureWithOption(configure),
|
|
73
|
+
resultType: (actual) => actual === "dyn" || actual.startsWith("list") || actual.startsWith("optional")
|
|
74
|
+
});
|
|
75
|
+
return Schema.Struct({
|
|
76
|
+
kind: Schema.Literal("remote"),
|
|
77
|
+
request: Schema.optional(CelRequest.annotations({
|
|
78
|
+
title: "\u8BF7\u6C42",
|
|
79
|
+
description: "\u8FD4\u56DE `HttpRequest` \u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u53EF\u8BBF\u95EE `form` \u5F53\u524D\u72B6\u6001\u3002\u7559\u7A7A\u5219\u4E0D\u53D1\u8D77\u8BF7\u6C42\uFF0C\u76F4\u63A5\u5BF9 `form` \u6C42\u503C `\u9009\u9879` \u8868\u8FBE\u5F0F\uFF08\u6B64\u65F6 `json` \u4E3A `null`\uFF09"
|
|
80
|
+
})),
|
|
81
|
+
options: CelOptions.annotations({
|
|
82
|
+
title: "\u9009\u9879",
|
|
83
|
+
description: "\u63D0\u53D6\u9009\u9879\u6570\u7EC4\u7684 CEL \u8868\u8FBE\u5F0F\uFF1B\u53EF\u8BBF\u95EE `form` \u4E0E `json`\u3002\u4F8B\uFF1A`json.data` \u6216 `[{value: 'a', label: 'A'}]`"
|
|
84
|
+
}),
|
|
85
|
+
optionValue: Schema.optionalWith(CelOptionValue.annotations({
|
|
86
|
+
title: "\u9009\u9879\u503C",
|
|
87
|
+
description: "\u4ECE\u5F53\u524D `option` \u63D0\u53D6\u5199\u5165\u7ED1\u5B9A\u7684\u503C\uFF1B\u4F8B\uFF1A`option.value`"
|
|
88
|
+
}), { default: () => "option" }),
|
|
89
|
+
optionLabel: CelOptionLabel.annotations({
|
|
90
|
+
title: "\u9009\u9879\u6807\u7B7E",
|
|
91
|
+
description: '\u8FD4\u56DE\u9009\u9879\u5C55\u793A\u6587\u672C\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u8BBF\u95EE `option`\uFF1B\u4F8B\uFF1A`option.name` \u6216 `string(option.code) + " - " + option.name`'
|
|
92
|
+
}),
|
|
93
|
+
optionKeywords: Schema.optional(CelKeywords.annotations({
|
|
94
|
+
title: "\u5173\u952E\u8BCD",
|
|
95
|
+
description: "\u8FD4\u56DE\u5B57\u7B26\u4E32\u5217\u8868\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u8BBF\u95EE `option`\uFF1B\u8FD9\u4E9B\u8BCD\u6761\u53C2\u4E0E\u641C\u7D22\u8FC7\u6EE4\u4F46\u4E0D\u5C55\u793A\u3002\u4F8B\uFF1A`[option.code, option.pinyin]`"
|
|
96
|
+
}))
|
|
97
|
+
}).annotations({ title: "ComboboxSingleOptionsRemote", description: "\u7531 CEL \u8868\u8FBE\u5F0F\uFF08\u53EF\u9009\u8FDC\u7A0B\u62C9\u53D6\uFF09\u4EA7\u51FA\u7684\u9009\u9879\u5217\u8868" });
|
|
98
|
+
}
|
|
99
|
+
export function optionsSchema(configure) {
|
|
100
|
+
const Item = itemSchema(configure);
|
|
101
|
+
const StaticSpec = Schema.Struct({
|
|
102
|
+
kind: Schema.Literal("static"),
|
|
103
|
+
items: Schema.optionalWith(Schema.Array(Item).annotations({
|
|
104
|
+
title: "\u9009\u9879",
|
|
105
|
+
description: "\u4E0B\u62C9\u6846\u53EF\u9009\u9879\u5217\u8868"
|
|
106
|
+
}), { default: () => [] })
|
|
107
|
+
}).annotations({ title: "ComboboxSingleOptionsStatic", description: "\u9759\u6001\u914D\u7F6E\u7684\u9009\u9879\u5217\u8868" });
|
|
108
|
+
const RemoteSpec = remoteOptionsSchema(configure);
|
|
109
|
+
return Schema.Union(StaticSpec, RemoteSpec).annotations({
|
|
110
|
+
title: "\u9009\u9879\u6765\u6E90",
|
|
111
|
+
description: '\u9009\u9879\u53EF\u4EE5\u662F\u9759\u6001\u914D\u7F6E\uFF08`kind: "static"`\uFF09\u6216\u7531 CEL \u8868\u8FBE\u5F0F / \u8FDC\u7A0B\u63A5\u53E3\u4EA7\u51FA\uFF08`kind: "remote"`\uFF09'
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
export function schema(configure) {
|
|
115
|
+
const CelBool = Expression({ configure, resultType: "bool" });
|
|
116
|
+
const Options = optionsSchema(configure);
|
|
117
|
+
return Schema.Struct({
|
|
118
|
+
type: Schema.Literal(type),
|
|
119
|
+
compatibilityDate: Schema.Literal(compatibilityDate),
|
|
120
|
+
...commonFieldFields(configure),
|
|
121
|
+
label: Schema.optional(Locale.annotations({
|
|
122
|
+
title: "\u6807\u7B7E",
|
|
123
|
+
description: "\u5B57\u6BB5\u524D\u5C55\u793A\u7684\u6587\u672C\uFF1B\u7559\u7A7A\u5219\u4E0D\u6E32\u67D3\u6807\u7B7E"
|
|
124
|
+
})),
|
|
125
|
+
placeholder: Schema.optional(Locale.annotations({
|
|
126
|
+
title: "\u5360\u4F4D\u7B26",
|
|
127
|
+
description: "\u672A\u9009\u4E2D\u4EFB\u4F55\u9009\u9879\u65F6\u8F93\u5165\u6846\u4E2D\u7684\u5360\u4F4D\u6587\u672C"
|
|
128
|
+
})),
|
|
129
|
+
tooltip: Schema.optional(Locale.annotations({
|
|
130
|
+
title: "\u63D0\u793A",
|
|
131
|
+
description: "\u9F20\u6807\u60AC\u505C\u5728\u6807\u7B7E\u4E0A\u65F6\u5C55\u793A\u7684\u8BF4\u660E"
|
|
132
|
+
})),
|
|
133
|
+
orientation: Schema.optional(FieldOrientationSchema),
|
|
134
|
+
binding: Schema.optional(Schema.String.pipe(Schema.minLength(1)).annotations({
|
|
135
|
+
title: "\u7ED1\u5B9A\u8DEF\u5F84",
|
|
136
|
+
description: "\u5199\u5165\u8868\u5355\u72B6\u6001\u7684 `dot-prop` \u8DEF\u5F84\uFF0C\u4F8B\u5982 `user.role`\uFF1B\u7559\u7A7A\u5219\u4E3A\u975E\u53D7\u63A7\u5B57\u6BB5"
|
|
137
|
+
})),
|
|
138
|
+
disabled: Schema.optional(CelBool.annotations({
|
|
139
|
+
title: "\u7981\u7528\u6761\u4EF6",
|
|
140
|
+
description: "\u8FD4\u56DE `true` \u65F6\u4E0B\u62C9\u6846\u4ECD\u7136\u6E32\u67D3\u4F46\u4E0D\u53EF\u9009\u62E9"
|
|
141
|
+
})),
|
|
142
|
+
readonly: Schema.optional(CelBool.annotations({
|
|
143
|
+
title: "\u53EA\u8BFB\u6761\u4EF6",
|
|
144
|
+
description: "\u8FD4\u56DE `true` \u65F6\u4EC5\u4EE5\u7EAF\u6587\u672C\u5C55\u793A\u5F53\u524D\u9009\u9879\u7684\u6807\u7B7E"
|
|
145
|
+
})),
|
|
146
|
+
derived: derivedField(configure, "dyn"),
|
|
147
|
+
options: Schema.optionalWith(Options, {
|
|
148
|
+
default: () => ({ kind: "static", items: [] })
|
|
149
|
+
})
|
|
150
|
+
}).annotations({
|
|
151
|
+
title: "ComboboxSingleField",
|
|
152
|
+
description: "\u4E0B\u62C9\u5355\u9009\u8F93\u5165"
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
export function defaults() {
|
|
156
|
+
return {
|
|
157
|
+
options: { kind: "static", items: [] }
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
export const migrateFrom = [
|
|
161
|
+
{ type: "com.shwfed.form.field.combobox.single", compatibilityDate: "2026-05-28" }
|
|
162
|
+
];
|
|
163
|
+
export const migrate = (prev) => Effect.try({
|
|
164
|
+
try: () => {
|
|
165
|
+
if (!prev || typeof prev !== "object") {
|
|
166
|
+
throw new Error("\u4E0B\u62C9\u5355\u9009\u8FC1\u79FB\u5931\u8D25\uFF1A\u539F\u503C\u4E0D\u662F\u5BF9\u8C61");
|
|
167
|
+
}
|
|
168
|
+
const src = prev;
|
|
169
|
+
const srcType = src.type;
|
|
170
|
+
const srcDate = src.compatibilityDate;
|
|
171
|
+
if (srcType === "com.shwfed.form.field.combobox.single" && srcDate === "2026-05-28") {
|
|
172
|
+
const { options, type: _t, compatibilityDate: _c, ...rest } = src;
|
|
173
|
+
let nextOptions = options;
|
|
174
|
+
if (options && typeof options === "object") {
|
|
175
|
+
const opts = options;
|
|
176
|
+
if (opts.kind === "remote") {
|
|
177
|
+
const { optionLabel, ...remoteRest } = opts;
|
|
178
|
+
nextOptions = { ...remoteRest, optionLabel: localeLabelToExpression(optionLabel) };
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
...rest,
|
|
183
|
+
type,
|
|
184
|
+
compatibilityDate,
|
|
185
|
+
options: nextOptions
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
throw new Error(`\u4E0B\u62C9\u5355\u9009\u8FC1\u79FB\u5931\u8D25\uFF1A\u672A\u8BC6\u522B\u7684\u6765\u6E90 ${String(srcType)}@${String(srcDate)}`);
|
|
189
|
+
},
|
|
190
|
+
catch: (e) => e instanceof Error ? e : new Error(String(e))
|
|
191
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rewrite a `{{ }}`-interpolated template into a single CEL expression.
|
|
3
|
+
*
|
|
4
|
+
* - `''` / no content → `''` (valid empty-string literal)
|
|
5
|
+
* - whole template is one `{{ expr }}` → `expr` (kept bare; runtime coerces to string)
|
|
6
|
+
* - mixed literal + interpolation → `"lit" + string(expr) + …`
|
|
7
|
+
*
|
|
8
|
+
* Interpolated segments are wrapped in `string(...)` in the mixed case because
|
|
9
|
+
* CEL `+` requires matching operand types and the literal segments are strings;
|
|
10
|
+
* the old runtime stringified every interpolation, so this preserves behavior.
|
|
11
|
+
*/
|
|
12
|
+
export declare function templateToExpression(template: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Collapse a legacy `optionLabel` (a Locale list of `{{ }}` templates) into the
|
|
15
|
+
* single CEL expression the 2026-06-14 schema expects. Picks the zh entry (or
|
|
16
|
+
* the first), then rewrites its template. Anything unrecognized → `''`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function localeLabelToExpression(optionLabel: unknown): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const INTERPOLATION_RE = /\{\{(.*?)\}\}/gs;
|
|
2
|
+
function celString(text) {
|
|
3
|
+
const body = text.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
|
|
4
|
+
return `"${body}"`;
|
|
5
|
+
}
|
|
6
|
+
export function templateToExpression(template) {
|
|
7
|
+
const trimmed = template.trim();
|
|
8
|
+
if (trimmed.length === 0) return `''`;
|
|
9
|
+
const sole = /^\{\{([\s\S]*)\}\}$/.exec(trimmed);
|
|
10
|
+
if (sole && !sole[1].includes("{{")) {
|
|
11
|
+
const expr = sole[1].trim();
|
|
12
|
+
return expr.length > 0 ? expr : `''`;
|
|
13
|
+
}
|
|
14
|
+
const parts = [];
|
|
15
|
+
let last = 0;
|
|
16
|
+
let match;
|
|
17
|
+
INTERPOLATION_RE.lastIndex = 0;
|
|
18
|
+
while ((match = INTERPOLATION_RE.exec(template)) !== null) {
|
|
19
|
+
if (match.index > last) parts.push(celString(template.slice(last, match.index)));
|
|
20
|
+
const expr = match[1].trim();
|
|
21
|
+
if (expr.length > 0) parts.push(`string(${expr})`);
|
|
22
|
+
last = match.index + match[0].length;
|
|
23
|
+
}
|
|
24
|
+
if (last < template.length) parts.push(celString(template.slice(last)));
|
|
25
|
+
if (parts.length === 0) return `''`;
|
|
26
|
+
return parts.join(" + ");
|
|
27
|
+
}
|
|
28
|
+
export function localeLabelToExpression(optionLabel) {
|
|
29
|
+
if (!Array.isArray(optionLabel)) return `''`;
|
|
30
|
+
const zh = optionLabel.find(
|
|
31
|
+
(item) => !!item && typeof item === "object" && item.locale === "zh"
|
|
32
|
+
);
|
|
33
|
+
const chosen = zh ?? optionLabel[0];
|
|
34
|
+
const message = chosen && typeof chosen.message === "string" ? chosen.message : "";
|
|
35
|
+
return templateToExpression(message);
|
|
36
|
+
}
|
|
@@ -67,3 +67,14 @@ export type FormStateBag = {
|
|
|
67
67
|
export declare const FORM_STATE_KEY: InjectionKey<FormStateBag>;
|
|
68
68
|
export declare function provideFormState(state: Ref<unknown>, kind?: FormStateBagKind): FormStateBag;
|
|
69
69
|
export declare function useFormState(): FormStateBag;
|
|
70
|
+
/**
|
|
71
|
+
* The nearest `'form'`-kind bag enclosing the current field — what the CEL
|
|
72
|
+
* variable `form` means. Field runtimes bind `form:` from THIS bag's state,
|
|
73
|
+
* not from `useFormState()`'s: inside a `list` row the nearest bag is the
|
|
74
|
+
* row slice, but the design-time scope, `useDerived`, and the validation
|
|
75
|
+
* rules all resolve `form` to the outer form (the row is reachable as
|
|
76
|
+
* `item`). Walks the same `parent` chain `state.write` does; falls back to
|
|
77
|
+
* the nearest bag itself when no `'form'`-kind ancestor exists (a bare row
|
|
78
|
+
* bag — e.g. a table cell, where the row IS the record).
|
|
79
|
+
*/
|
|
80
|
+
export declare function useFormScope(): FormStateBag;
|
|
@@ -26,9 +26,11 @@ export const handler = (params, ctx) => {
|
|
|
26
26
|
const kind = TOAST_STYLES.has(result) ? result : "success";
|
|
27
27
|
if (titleExpression !== void 0) {
|
|
28
28
|
const title = yield* ctx.cel(titleExpression, { json, result, steps });
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
if (title.length > 0) {
|
|
30
|
+
const raw = getLocalizedText(description, ctx.locale()) ?? "";
|
|
31
|
+
const body = raw.length === 0 ? void 0 : interpolateMarkdown(raw, ctx.cel, { json, result, steps });
|
|
32
|
+
toast[kind](title, body === void 0 ? void 0 : { description: body });
|
|
33
|
+
}
|
|
32
34
|
}
|
|
33
35
|
if (Either.isLeft(outcome)) {
|
|
34
36
|
if (import.meta.dev) console.warn("[shwfed-operations] http request failed", outcome.left);
|
|
@@ -53,7 +53,8 @@ export function schema(configure) {
|
|
|
53
53
|
titleExpression: Schema.optional(CelToastString.annotations({
|
|
54
54
|
title: "\u63D0\u793A\u6807\u9898",
|
|
55
55
|
description: md`
|
|
56
|
-
|
|
56
|
+
配置后,作为提示的标题向用户展示。求值为空字符串时不提示——
|
|
57
|
+
可按 \`result\` 分支实现仅部分结果下提示,如 \`result == 'error' ? '请求失败' : ''\`。
|
|
57
58
|
`
|
|
58
59
|
})),
|
|
59
60
|
description: Schema.optional(Locale.annotations({
|
|
@@ -70,7 +71,7 @@ export function schema(configure) {
|
|
|
70
71
|
调用多个接口——前一个失败后,后续操作不再执行。后面的步骤可经 \`steps["<步骤标识>"]\`
|
|
71
72
|
引用前面步骤的响应。
|
|
72
73
|
|
|
73
|
-
toast
|
|
74
|
+
toast 完全由「提示标题」「提示内容」决定(含失败场景);不配置标题、或标题求值为空字符串则静默。
|
|
74
75
|
`
|
|
75
76
|
});
|
|
76
77
|
}
|
|
@@ -53,9 +53,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
53
53
|
readonly locale: "en" | "ja" | "ko";
|
|
54
54
|
readonly message: string;
|
|
55
55
|
}[]];
|
|
56
|
-
readonly successMessage?: string | undefined;
|
|
57
56
|
readonly accessor: string;
|
|
58
57
|
readonly sortKey?: string | undefined;
|
|
58
|
+
readonly successMessage?: string | undefined;
|
|
59
59
|
}) => any;
|
|
60
60
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
61
61
|
"onUpdate:modelValue"?: ((value: {
|
|
@@ -108,9 +108,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
108
108
|
readonly locale: "en" | "ja" | "ko";
|
|
109
109
|
readonly message: string;
|
|
110
110
|
}[]];
|
|
111
|
-
readonly successMessage?: string | undefined;
|
|
112
111
|
readonly accessor: string;
|
|
113
112
|
readonly sortKey?: string | undefined;
|
|
113
|
+
readonly successMessage?: string | undefined;
|
|
114
114
|
}) => any) | undefined;
|
|
115
115
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
116
116
|
declare const _default: typeof __VLS_export;
|
|
@@ -53,9 +53,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
53
53
|
readonly locale: "en" | "ja" | "ko";
|
|
54
54
|
readonly message: string;
|
|
55
55
|
}[]];
|
|
56
|
-
readonly successMessage?: string | undefined;
|
|
57
56
|
readonly accessor: string;
|
|
58
57
|
readonly sortKey?: string | undefined;
|
|
58
|
+
readonly successMessage?: string | undefined;
|
|
59
59
|
}) => any;
|
|
60
60
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
61
61
|
"onUpdate:modelValue"?: ((value: {
|
|
@@ -108,9 +108,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
108
108
|
readonly locale: "en" | "ja" | "ko";
|
|
109
109
|
readonly message: string;
|
|
110
110
|
}[]];
|
|
111
|
-
readonly successMessage?: string | undefined;
|
|
112
111
|
readonly accessor: string;
|
|
113
112
|
readonly sortKey?: string | undefined;
|
|
113
|
+
readonly successMessage?: string | undefined;
|
|
114
114
|
}) => any) | undefined;
|
|
115
115
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
116
116
|
declare const _default: typeof __VLS_export;
|
|
@@ -67,9 +67,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
67
67
|
readonly readonly?: string | undefined;
|
|
68
68
|
readonly grow?: boolean | undefined;
|
|
69
69
|
readonly enableSorting?: boolean | undefined;
|
|
70
|
-
readonly successMessage?: string | undefined;
|
|
71
70
|
readonly accessor: string;
|
|
72
71
|
readonly sortKey?: string | undefined;
|
|
72
|
+
readonly successMessage?: string | undefined;
|
|
73
73
|
}) => any;
|
|
74
74
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
75
75
|
"onUpdate:modelValue"?: ((value: {
|
|
@@ -136,9 +136,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
136
136
|
readonly readonly?: string | undefined;
|
|
137
137
|
readonly grow?: boolean | undefined;
|
|
138
138
|
readonly enableSorting?: boolean | undefined;
|
|
139
|
-
readonly successMessage?: string | undefined;
|
|
140
139
|
readonly accessor: string;
|
|
141
140
|
readonly sortKey?: string | undefined;
|
|
141
|
+
readonly successMessage?: string | undefined;
|
|
142
142
|
}) => any) | undefined;
|
|
143
143
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
144
144
|
declare const _default: typeof __VLS_export;
|
|
@@ -67,9 +67,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
67
67
|
readonly readonly?: string | undefined;
|
|
68
68
|
readonly grow?: boolean | undefined;
|
|
69
69
|
readonly enableSorting?: boolean | undefined;
|
|
70
|
-
readonly successMessage?: string | undefined;
|
|
71
70
|
readonly accessor: string;
|
|
72
71
|
readonly sortKey?: string | undefined;
|
|
72
|
+
readonly successMessage?: string | undefined;
|
|
73
73
|
}) => any;
|
|
74
74
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
75
75
|
"onUpdate:modelValue"?: ((value: {
|
|
@@ -136,9 +136,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
136
136
|
readonly readonly?: string | undefined;
|
|
137
137
|
readonly grow?: boolean | undefined;
|
|
138
138
|
readonly enableSorting?: boolean | undefined;
|
|
139
|
-
readonly successMessage?: string | undefined;
|
|
140
139
|
readonly accessor: string;
|
|
141
140
|
readonly sortKey?: string | undefined;
|
|
141
|
+
readonly successMessage?: string | undefined;
|
|
142
142
|
}) => any) | undefined;
|
|
143
143
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
144
144
|
declare const _default: typeof __VLS_export;
|
|
@@ -53,9 +53,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
53
53
|
readonly locale: "en" | "ja" | "ko";
|
|
54
54
|
readonly message: string;
|
|
55
55
|
}[]];
|
|
56
|
-
readonly successMessage?: string | undefined;
|
|
57
56
|
readonly accessor: string;
|
|
58
57
|
readonly sortKey?: string | undefined;
|
|
58
|
+
readonly successMessage?: string | undefined;
|
|
59
59
|
}) => any;
|
|
60
60
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
61
61
|
"onUpdate:modelValue"?: ((value: {
|
|
@@ -108,9 +108,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
108
108
|
readonly locale: "en" | "ja" | "ko";
|
|
109
109
|
readonly message: string;
|
|
110
110
|
}[]];
|
|
111
|
-
readonly successMessage?: string | undefined;
|
|
112
111
|
readonly accessor: string;
|
|
113
112
|
readonly sortKey?: string | undefined;
|
|
113
|
+
readonly successMessage?: string | undefined;
|
|
114
114
|
}) => any) | undefined;
|
|
115
115
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
116
116
|
declare const _default: typeof __VLS_export;
|
|
@@ -53,9 +53,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
53
53
|
readonly locale: "en" | "ja" | "ko";
|
|
54
54
|
readonly message: string;
|
|
55
55
|
}[]];
|
|
56
|
-
readonly successMessage?: string | undefined;
|
|
57
56
|
readonly accessor: string;
|
|
58
57
|
readonly sortKey?: string | undefined;
|
|
58
|
+
readonly successMessage?: string | undefined;
|
|
59
59
|
}) => any;
|
|
60
60
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
61
61
|
"onUpdate:modelValue"?: ((value: {
|
|
@@ -108,9 +108,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
108
108
|
readonly locale: "en" | "ja" | "ko";
|
|
109
109
|
readonly message: string;
|
|
110
110
|
}[]];
|
|
111
|
-
readonly successMessage?: string | undefined;
|
|
112
111
|
readonly accessor: string;
|
|
113
112
|
readonly sortKey?: string | undefined;
|
|
113
|
+
readonly successMessage?: string | undefined;
|
|
114
114
|
}) => any) | undefined;
|
|
115
115
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
116
116
|
declare const _default: typeof __VLS_export;
|