@shwfed/config 2.9.13 → 2.10.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.
- package/dist/mcp.mjs +5020 -3637
- package/dist/module.json +1 -1
- package/dist/preview/assets/{FieldGroup.vue_vue_type_script_setup_true_lang-DZ_H-YRf.js → FieldGroup.vue_vue_type_script_setup_true_lang-CuFusz5A.js} +1 -1
- package/dist/preview/assets/{badge-DoNuZh0A.js → badge-D5FPHSix.js} +1 -1
- package/dist/preview/assets/{config-DTEJOYqA.js → config-BHPiQ1lB.js} +1 -1
- package/dist/preview/assets/{config-C6Cm7DWx.js → config-BWC-Zw21.js} +1 -1
- package/dist/preview/assets/{config-YGBoSq6x.js → config-Bg94Z7XN.js} +1 -1
- package/dist/preview/assets/{config-CLsjWZz2.js → config-BqSL4UAL.js} +1 -1
- package/dist/preview/assets/{config-ugF_BOWz.js → config-CeRBpZbE.js} +1 -1
- package/dist/preview/assets/{config-BDDuqAht.js → config-CfjcFb_E.js} +1 -1
- package/dist/preview/assets/{config-Bhc_Vu67.js → config-DNUKa3lN.js} +1 -1
- package/dist/preview/assets/{config-D4rFsdGO.js → config-DVjZmomc.js} +1 -1
- package/dist/preview/assets/{config-tdZMdIN3.js → config-Djv6EQBY.js} +1 -1
- package/dist/preview/assets/{config-CIYui2J_.js → config-PNpa6ENz.js} +1 -1
- package/dist/preview/assets/{config-Cla0Qngs.js → config-ucxtM3wX.js} +1 -1
- package/dist/preview/assets/{config-BrNZsgV0.js → config-urZuasV7.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-CgNXv26P.js → definition.vue_vue_type_script_setup_true_lang-BzryfjdG.js} +1 -1
- package/dist/preview/assets/index-BE9O1XgB.js +1 -0
- package/dist/preview/assets/{index-CzzwZ7bp.css → index-BnJ5p1Mx.css} +1 -1
- package/dist/preview/assets/{index-C3FdepLE.js → index-DCRQGu0g.js} +1 -1
- package/dist/preview/assets/index-yvElpEK3.js +743 -0
- package/dist/preview/assets/{item-DecwNzYq.js → item-CTkdtkvl.js} +1 -1
- package/dist/preview/assets/{runtime-DtP98Km5.js → runtime-3rajYvjp.js} +1 -1
- package/dist/preview/assets/{runtime-C8Ufkmiw.js → runtime-4A3oiig9.js} +1 -1
- package/dist/preview/assets/{runtime-blb90Fhv.js → runtime-BOGZFWxF.js} +1 -1
- package/dist/preview/assets/{runtime-BK7KNEyN.js → runtime-BqroTX7H.js} +1 -1
- package/dist/preview/assets/{runtime-DSUjc0Pk.js → runtime-CBBae0-H.js} +1 -1
- package/dist/preview/assets/{runtime-CYpXd7Pq.js → runtime-CBuV3vwL.js} +1 -1
- package/dist/preview/assets/{runtime-CjPtRd-T.js → runtime-CI8yzwXd.js} +1 -1
- package/dist/preview/assets/{runtime-C5hqSHRW.js → runtime-CcyhgOum.js} +1 -1
- package/dist/preview/assets/{runtime-C3dmOj9s.js → runtime-CkQ-mNoH.js} +1 -1
- package/dist/preview/assets/{runtime-DZ_AwduQ.js → runtime-DmxKfudS.js} +1 -1
- package/dist/preview/assets/{schema-meta-DWUHNP8E.js → schema-meta-BFzIzGiN.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/actions/components/triggers-field.vue +12 -12
- 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-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/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.vue +16 -3
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.vue +17 -3
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/runtime.vue +5 -1
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.d.vue.ts +179 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue +942 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue.d.ts +179 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/runtime.vue +499 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/schema.d.ts +223 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/schema.js +276 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.d.vue.ts +179 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue +942 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue.d.ts +179 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/runtime.vue +438 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/schema.d.ts +223 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/schema.js +276 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +123 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue +646 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +123 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/runtime.vue +500 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/schema.d.ts +83 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/schema.js +179 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +121 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue +577 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +121 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/runtime.vue +465 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/schema.d.ts +80 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/schema.js +171 -0
- package/dist/runtime/components/table/columns/2026-06-14/combobox-migrate.d.ts +18 -0
- package/dist/runtime/components/table/columns/2026-06-14/combobox-migrate.js +36 -0
- package/dist/runtime/components/table/columns/2026-06-14/tree-combobox-shared.d.ts +35 -0
- package/dist/runtime/components/table/columns/2026-06-14/tree-combobox-shared.js +31 -0
- package/dist/runtime/components/table/index.d.vue.ts +2 -0
- package/dist/runtime/components/table/index.vue +24 -0
- package/dist/runtime/components/table/index.vue.d.ts +2 -0
- package/dist/runtime/components/table/utils/shared.d.ts +1 -0
- package/dist/runtime/components/table/utils/shared.js +7 -13
- 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-B-QhiviS.js +0 -1
- package/dist/preview/assets/index-CWMhB7z4.js +0 -735
|
@@ -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;
|
|
@@ -5,6 +5,7 @@ import { computed, nextTick, ref, watch } from "vue";
|
|
|
5
5
|
import { useI18n } from "vue-i18n";
|
|
6
6
|
import { cel as _rawCel } from "../../../../../utils/cel";
|
|
7
7
|
import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
|
|
8
|
+
import { useFormReadonly } from "../../../../form/utils/readonly";
|
|
8
9
|
import { getLocalizedText } from "../../../../../share/locale";
|
|
9
10
|
import {
|
|
10
11
|
Command,
|
|
@@ -61,7 +62,10 @@ function evalBool(expression, label) {
|
|
|
61
62
|
}
|
|
62
63
|
const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
|
|
63
64
|
const isDisabled = computed(() => evalBool(props.column.disabled, "disabled"));
|
|
64
|
-
const
|
|
65
|
+
const formReadonly = useFormReadonly();
|
|
66
|
+
const isReadonly = computed(
|
|
67
|
+
() => props.column.readonly != null ? evalBool(props.column.readonly, "readonly") : formReadonly.value
|
|
68
|
+
);
|
|
65
69
|
const effectiveReadonly = computed(
|
|
66
70
|
() => isReadonly.value || props.column.derived?.mode === "formula"
|
|
67
71
|
);
|
|
@@ -5,6 +5,7 @@ import { computed, nextTick } from "vue";
|
|
|
5
5
|
import { useI18n } from "vue-i18n";
|
|
6
6
|
import { cel as _rawCel } from "../../../../../utils/cel";
|
|
7
7
|
import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
|
|
8
|
+
import { useFormReadonly } from "../../../../form/utils/readonly";
|
|
8
9
|
import { getLocalizedText } from "../../../../../share/locale";
|
|
9
10
|
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupNumberField } from "../../../../ui/input-group";
|
|
10
11
|
import { useFieldValue } from "../../../../form/utils/field-value";
|
|
@@ -40,7 +41,10 @@ function evalNumber(expression, label) {
|
|
|
40
41
|
}
|
|
41
42
|
const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
|
|
42
43
|
const isDisabled = computed(() => evalBool(props.column.disabled, "disabled"));
|
|
43
|
-
const
|
|
44
|
+
const formReadonly = useFormReadonly();
|
|
45
|
+
const isReadonly = computed(
|
|
46
|
+
() => props.column.readonly != null ? evalBool(props.column.readonly, "readonly") : formReadonly.value
|
|
47
|
+
);
|
|
44
48
|
const effectiveReadonly = computed(
|
|
45
49
|
() => isReadonly.value || props.column.derived?.mode === "formula"
|
|
46
50
|
);
|
|
@@ -108,11 +112,20 @@ async function onBlur() {
|
|
|
108
112
|
v-if="isHidden"
|
|
109
113
|
class="block h-7 w-full"
|
|
110
114
|
/>
|
|
115
|
+
<!--
|
|
116
|
+
Readonly empty state mirrors the `text` column exactly: a centered,
|
|
117
|
+
faded, non-selectable `-` in `font-mono`, so a readonly grid reads
|
|
118
|
+
uniformly regardless of column type. A present value keeps the
|
|
119
|
+
left-aligned dark text.
|
|
120
|
+
-->
|
|
111
121
|
<span
|
|
112
122
|
v-else-if="effectiveReadonly"
|
|
113
|
-
class="
|
|
123
|
+
:class="[
|
|
124
|
+
'flex items-center h-7 w-full px-2 text-[0.75rem] truncate',
|
|
125
|
+
draft !== void 0 ? 'text-zinc-700' : 'justify-center font-mono text-zinc-300 select-none'
|
|
126
|
+
]"
|
|
114
127
|
>
|
|
115
|
-
{{ draft ?? "
|
|
128
|
+
{{ draft ?? "-" }}
|
|
116
129
|
</span>
|
|
117
130
|
<InputGroup
|
|
118
131
|
v-else
|
package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/runtime.vue
CHANGED
|
@@ -4,6 +4,7 @@ import { computed } from "vue";
|
|
|
4
4
|
import { useI18n } from "vue-i18n";
|
|
5
5
|
import { cel as _rawCel } from "../../../../../utils/cel";
|
|
6
6
|
import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
|
|
7
|
+
import { useFormReadonly } from "../../../../form/utils/readonly";
|
|
7
8
|
import { getLocalizedText } from "../../../../../share/locale";
|
|
8
9
|
import { Switch } from "../../../../ui/switch";
|
|
9
10
|
import { useFieldValue } from "../../../../form/utils/field-value";
|
|
@@ -26,7 +27,10 @@ function evalBool(expression, label) {
|
|
|
26
27
|
}
|
|
27
28
|
const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
|
|
28
29
|
const isDisabled = computed(() => evalBool(props.column.disabled, "disabled"));
|
|
29
|
-
const
|
|
30
|
+
const formReadonly = useFormReadonly();
|
|
31
|
+
const isReadonly = computed(
|
|
32
|
+
() => props.column.readonly != null ? evalBool(props.column.readonly, "readonly") : formReadonly.value
|
|
33
|
+
);
|
|
30
34
|
const effectiveReadonly = computed(
|
|
31
35
|
() => isReadonly.value || props.column.derived?.mode === "formula"
|
|
32
36
|
);
|
|
@@ -4,6 +4,7 @@ import { computed } from "vue";
|
|
|
4
4
|
import { useI18n } from "vue-i18n";
|
|
5
5
|
import { cel as _rawCel } from "../../../../../utils/cel";
|
|
6
6
|
import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
|
|
7
|
+
import { useFormReadonly } from "../../../../form/utils/readonly";
|
|
7
8
|
import { getLocalizedText } from "../../../../../share/locale";
|
|
8
9
|
import { Switch } from "../../../../ui/switch";
|
|
9
10
|
import { useFieldValue } from "../../../../form/utils/field-value";
|
|
@@ -26,7 +27,10 @@ function evalBool(expression, label) {
|
|
|
26
27
|
}
|
|
27
28
|
const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
|
|
28
29
|
const isDisabled = computed(() => evalBool(props.column.disabled, "disabled"));
|
|
29
|
-
const
|
|
30
|
+
const formReadonly = useFormReadonly();
|
|
31
|
+
const isReadonly = computed(
|
|
32
|
+
() => props.column.readonly != null ? evalBool(props.column.readonly, "readonly") : formReadonly.value
|
|
33
|
+
);
|
|
30
34
|
const effectiveReadonly = computed(
|
|
31
35
|
() => isReadonly.value || props.column.derived?.mode === "formula"
|
|
32
36
|
);
|
|
@@ -5,6 +5,7 @@ import { useI18n } from "vue-i18n";
|
|
|
5
5
|
import { Icon } from "@iconify/vue";
|
|
6
6
|
import { cel as $cel } from "../../../../../utils/cel";
|
|
7
7
|
import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
|
|
8
|
+
import { useFormReadonly } from "../../../../form/utils/readonly";
|
|
8
9
|
import { getLocalizedText } from "../../../../../share/locale";
|
|
9
10
|
import {
|
|
10
11
|
InputGroup,
|
|
@@ -35,7 +36,10 @@ function evalBool(expression, label) {
|
|
|
35
36
|
}
|
|
36
37
|
const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
|
|
37
38
|
const isDisabled = computed(() => evalBool(props.column.disabled, "disabled"));
|
|
38
|
-
const
|
|
39
|
+
const formReadonly = useFormReadonly();
|
|
40
|
+
const isReadonly = computed(
|
|
41
|
+
() => props.column.readonly != null ? evalBool(props.column.readonly, "readonly") : formReadonly.value
|
|
42
|
+
);
|
|
39
43
|
const effectiveReadonly = computed(
|
|
40
44
|
() => isReadonly.value || props.column.derived?.mode === "formula"
|
|
41
45
|
);
|
|
@@ -89,11 +93,21 @@ function handleClear() {
|
|
|
89
93
|
v-if="isHidden"
|
|
90
94
|
class="block h-7 w-full"
|
|
91
95
|
/>
|
|
96
|
+
<!--
|
|
97
|
+
Readonly empty state mirrors the `text` column exactly: a centered,
|
|
98
|
+
faded, non-selectable `-` rendered in `font-mono`, so a readonly grid
|
|
99
|
+
reads uniformly regardless of which column type backs each cell. A
|
|
100
|
+
non-empty readonly value keeps the editable cell's left-aligned dark
|
|
101
|
+
text.
|
|
102
|
+
-->
|
|
92
103
|
<span
|
|
93
104
|
v-else-if="effectiveReadonly"
|
|
94
|
-
class="
|
|
105
|
+
:class="[
|
|
106
|
+
'flex items-center h-7 w-full px-2 text-[0.75rem] truncate',
|
|
107
|
+
draft ? 'text-zinc-700' : 'justify-center font-mono text-zinc-300 select-none'
|
|
108
|
+
]"
|
|
95
109
|
>
|
|
96
|
-
{{ draft || "
|
|
110
|
+
{{ draft || "-" }}
|
|
97
111
|
</span>
|
|
98
112
|
<!--
|
|
99
113
|
Idle border is faded to 30% so a whole grid of inputs reads as data, not
|
|
@@ -9,6 +9,7 @@ import { useI18n } from "vue-i18n";
|
|
|
9
9
|
import { asRequest, fetchJsonOption } from "../../../../../share/request";
|
|
10
10
|
import { cel as _rawCel } from "../../../../../utils/cel";
|
|
11
11
|
import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
|
|
12
|
+
import { useFormReadonly } from "../../../../form/utils/readonly";
|
|
12
13
|
import { getLocalizedText } from "../../../../../share/locale";
|
|
13
14
|
import { dispatchTriggers, useEventChannel } from "../../../../../share/event-bus";
|
|
14
15
|
import {
|
|
@@ -72,7 +73,10 @@ function evalBool(expression, label) {
|
|
|
72
73
|
}
|
|
73
74
|
const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
|
|
74
75
|
const isDisabledByConfig = computed(() => evalBool(props.column.disabled, "disabled"));
|
|
75
|
-
const
|
|
76
|
+
const formReadonly = useFormReadonly();
|
|
77
|
+
const isReadonly = computed(
|
|
78
|
+
() => props.column.readonly != null ? evalBool(props.column.readonly, "readonly") : formReadonly.value
|
|
79
|
+
);
|
|
76
80
|
const isInteractive = computed(() => !!props.column.onChange);
|
|
77
81
|
const pending = ref(false);
|
|
78
82
|
const json = ref(null);
|