@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,175 @@
|
|
|
1
|
+
import { type Value } from './schema.js';
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: Value;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
"update:modelValue": (value: {
|
|
7
|
+
readonly label?: readonly [{
|
|
8
|
+
readonly locale: "zh";
|
|
9
|
+
readonly message: string;
|
|
10
|
+
}, ...{
|
|
11
|
+
readonly locale: "en" | "ja" | "ko";
|
|
12
|
+
readonly message: string;
|
|
13
|
+
}[]] | undefined;
|
|
14
|
+
readonly disabled?: string | undefined;
|
|
15
|
+
readonly type: "com.shwfed.form.field.combobox.multi";
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly hidden?: string | undefined;
|
|
18
|
+
readonly tooltip?: readonly [{
|
|
19
|
+
readonly locale: "zh";
|
|
20
|
+
readonly message: string;
|
|
21
|
+
}, ...{
|
|
22
|
+
readonly locale: "en" | "ja" | "ko";
|
|
23
|
+
readonly message: string;
|
|
24
|
+
}[]] | undefined;
|
|
25
|
+
readonly required?: string | undefined;
|
|
26
|
+
readonly displayName?: string | undefined;
|
|
27
|
+
readonly compatibilityDate: "2026-06-14";
|
|
28
|
+
readonly orientation?: "vertical" | "floating" | undefined;
|
|
29
|
+
readonly placeholder?: readonly [{
|
|
30
|
+
readonly locale: "zh";
|
|
31
|
+
readonly message: string;
|
|
32
|
+
}, ...{
|
|
33
|
+
readonly locale: "en" | "ja" | "ko";
|
|
34
|
+
readonly message: string;
|
|
35
|
+
}[]] | undefined;
|
|
36
|
+
readonly readonly?: string | undefined;
|
|
37
|
+
readonly binding?: string | undefined;
|
|
38
|
+
readonly derived?: {
|
|
39
|
+
readonly mode: "formula" | "prefill";
|
|
40
|
+
readonly expression: string;
|
|
41
|
+
} | undefined;
|
|
42
|
+
readonly options: {
|
|
43
|
+
readonly kind: "remote";
|
|
44
|
+
readonly request?: string | undefined;
|
|
45
|
+
readonly options: string;
|
|
46
|
+
readonly optionValue: string;
|
|
47
|
+
readonly optionLabel: string;
|
|
48
|
+
readonly optionKeywords?: string | undefined;
|
|
49
|
+
} | {
|
|
50
|
+
readonly kind: "static";
|
|
51
|
+
readonly items: readonly {
|
|
52
|
+
readonly label: readonly [{
|
|
53
|
+
readonly locale: "zh";
|
|
54
|
+
readonly message: string;
|
|
55
|
+
}, ...{
|
|
56
|
+
readonly locale: "en" | "ja" | "ko";
|
|
57
|
+
readonly message: string;
|
|
58
|
+
}[]];
|
|
59
|
+
readonly id: string;
|
|
60
|
+
readonly tooltip?: readonly [{
|
|
61
|
+
readonly locale: "zh";
|
|
62
|
+
readonly message: string;
|
|
63
|
+
}, ...{
|
|
64
|
+
readonly locale: "en" | "ja" | "ko";
|
|
65
|
+
readonly message: string;
|
|
66
|
+
}[]] | undefined;
|
|
67
|
+
readonly value: {
|
|
68
|
+
readonly value: string;
|
|
69
|
+
readonly kind: "text";
|
|
70
|
+
} | {
|
|
71
|
+
readonly value: number;
|
|
72
|
+
readonly kind: "number";
|
|
73
|
+
};
|
|
74
|
+
readonly keywords?: readonly string[] | undefined;
|
|
75
|
+
}[];
|
|
76
|
+
};
|
|
77
|
+
readonly validations?: readonly {
|
|
78
|
+
readonly message: readonly [{
|
|
79
|
+
readonly locale: "zh";
|
|
80
|
+
readonly message: string;
|
|
81
|
+
}, ...{
|
|
82
|
+
readonly locale: "en" | "ja" | "ko";
|
|
83
|
+
readonly message: string;
|
|
84
|
+
}[]];
|
|
85
|
+
readonly warning?: boolean | undefined;
|
|
86
|
+
readonly when: string;
|
|
87
|
+
}[] | undefined;
|
|
88
|
+
}) => any;
|
|
89
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
90
|
+
"onUpdate:modelValue"?: ((value: {
|
|
91
|
+
readonly label?: readonly [{
|
|
92
|
+
readonly locale: "zh";
|
|
93
|
+
readonly message: string;
|
|
94
|
+
}, ...{
|
|
95
|
+
readonly locale: "en" | "ja" | "ko";
|
|
96
|
+
readonly message: string;
|
|
97
|
+
}[]] | undefined;
|
|
98
|
+
readonly disabled?: string | undefined;
|
|
99
|
+
readonly type: "com.shwfed.form.field.combobox.multi";
|
|
100
|
+
readonly id: string;
|
|
101
|
+
readonly hidden?: string | undefined;
|
|
102
|
+
readonly tooltip?: readonly [{
|
|
103
|
+
readonly locale: "zh";
|
|
104
|
+
readonly message: string;
|
|
105
|
+
}, ...{
|
|
106
|
+
readonly locale: "en" | "ja" | "ko";
|
|
107
|
+
readonly message: string;
|
|
108
|
+
}[]] | undefined;
|
|
109
|
+
readonly required?: string | undefined;
|
|
110
|
+
readonly displayName?: string | undefined;
|
|
111
|
+
readonly compatibilityDate: "2026-06-14";
|
|
112
|
+
readonly orientation?: "vertical" | "floating" | undefined;
|
|
113
|
+
readonly placeholder?: readonly [{
|
|
114
|
+
readonly locale: "zh";
|
|
115
|
+
readonly message: string;
|
|
116
|
+
}, ...{
|
|
117
|
+
readonly locale: "en" | "ja" | "ko";
|
|
118
|
+
readonly message: string;
|
|
119
|
+
}[]] | undefined;
|
|
120
|
+
readonly readonly?: string | undefined;
|
|
121
|
+
readonly binding?: string | undefined;
|
|
122
|
+
readonly derived?: {
|
|
123
|
+
readonly mode: "formula" | "prefill";
|
|
124
|
+
readonly expression: string;
|
|
125
|
+
} | undefined;
|
|
126
|
+
readonly options: {
|
|
127
|
+
readonly kind: "remote";
|
|
128
|
+
readonly request?: string | undefined;
|
|
129
|
+
readonly options: string;
|
|
130
|
+
readonly optionValue: string;
|
|
131
|
+
readonly optionLabel: string;
|
|
132
|
+
readonly optionKeywords?: string | undefined;
|
|
133
|
+
} | {
|
|
134
|
+
readonly kind: "static";
|
|
135
|
+
readonly items: readonly {
|
|
136
|
+
readonly label: readonly [{
|
|
137
|
+
readonly locale: "zh";
|
|
138
|
+
readonly message: string;
|
|
139
|
+
}, ...{
|
|
140
|
+
readonly locale: "en" | "ja" | "ko";
|
|
141
|
+
readonly message: string;
|
|
142
|
+
}[]];
|
|
143
|
+
readonly id: string;
|
|
144
|
+
readonly tooltip?: readonly [{
|
|
145
|
+
readonly locale: "zh";
|
|
146
|
+
readonly message: string;
|
|
147
|
+
}, ...{
|
|
148
|
+
readonly locale: "en" | "ja" | "ko";
|
|
149
|
+
readonly message: string;
|
|
150
|
+
}[]] | undefined;
|
|
151
|
+
readonly value: {
|
|
152
|
+
readonly value: string;
|
|
153
|
+
readonly kind: "text";
|
|
154
|
+
} | {
|
|
155
|
+
readonly value: number;
|
|
156
|
+
readonly kind: "number";
|
|
157
|
+
};
|
|
158
|
+
readonly keywords?: readonly string[] | undefined;
|
|
159
|
+
}[];
|
|
160
|
+
};
|
|
161
|
+
readonly validations?: readonly {
|
|
162
|
+
readonly message: readonly [{
|
|
163
|
+
readonly locale: "zh";
|
|
164
|
+
readonly message: string;
|
|
165
|
+
}, ...{
|
|
166
|
+
readonly locale: "en" | "ja" | "ko";
|
|
167
|
+
readonly message: string;
|
|
168
|
+
}[]];
|
|
169
|
+
readonly warning?: boolean | undefined;
|
|
170
|
+
readonly when: string;
|
|
171
|
+
}[] | undefined;
|
|
172
|
+
}) => any) | undefined;
|
|
173
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
174
|
+
declare const _default: typeof __VLS_export;
|
|
175
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Value } from './schema.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
fieldId: string;
|
|
4
|
+
config: Value;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Icon } from "@iconify/vue";
|
|
3
|
+
import { watchDebounced } from "@vueuse/core";
|
|
4
|
+
import { Effect, Option } from "effect";
|
|
5
|
+
import { Fetch } from "fx-fetch";
|
|
6
|
+
import { computed, ref } from "vue";
|
|
7
|
+
import { useI18n } from "vue-i18n";
|
|
8
|
+
import { asRequest, fetchJsonOption } from "../../../../../share/request";
|
|
9
|
+
import { cel as _rawCel } from "../../../../../utils/cel";
|
|
10
|
+
import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
|
|
11
|
+
import { publishSelection } from "../../../../../utils/selections-registry";
|
|
12
|
+
import { getLocalizedText } from "../../../../../share/locale";
|
|
13
|
+
import {
|
|
14
|
+
Command,
|
|
15
|
+
CommandEmpty,
|
|
16
|
+
CommandGroup,
|
|
17
|
+
CommandInput,
|
|
18
|
+
CommandItem,
|
|
19
|
+
CommandList
|
|
20
|
+
} from "../../../../ui/command";
|
|
21
|
+
import { Field, FieldLabel, FieldMessages } from "../../../../ui/field";
|
|
22
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../../../../ui/input-group";
|
|
23
|
+
import { Markdown } from "../../../../ui/markdown";
|
|
24
|
+
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../../../../ui/popover";
|
|
25
|
+
import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
|
|
26
|
+
import { useFormReadonly } from "../../../utils/readonly";
|
|
27
|
+
import { useFormScope, useFormState } from "../../../utils/state";
|
|
28
|
+
import { useFieldValidation } from "../../../utils/validation";
|
|
29
|
+
defineOptions({ name: "ShwfedComboboxMultiFieldRuntime" });
|
|
30
|
+
const props = defineProps({
|
|
31
|
+
fieldId: { type: String, required: true },
|
|
32
|
+
config: { type: null, required: true }
|
|
33
|
+
});
|
|
34
|
+
const { locale, t } = useI18n({
|
|
35
|
+
inheritLocale: true,
|
|
36
|
+
messages: {
|
|
37
|
+
zh: {
|
|
38
|
+
"combobox-multi-placeholder": "\u8BF7\u9009\u62E9",
|
|
39
|
+
"combobox-multi-search-placeholder": "\u641C\u7D22\u2026",
|
|
40
|
+
"combobox-multi-empty": "\u65E0\u5339\u914D\u9879",
|
|
41
|
+
"combobox-multi-loading": "\u52A0\u8F7D\u4E2D\u2026"
|
|
42
|
+
},
|
|
43
|
+
en: {
|
|
44
|
+
"combobox-multi-placeholder": "Select\u2026",
|
|
45
|
+
"combobox-multi-search-placeholder": "Search\u2026",
|
|
46
|
+
"combobox-multi-empty": "No matches",
|
|
47
|
+
"combobox-multi-loading": "Loading\u2026"
|
|
48
|
+
},
|
|
49
|
+
ja: {
|
|
50
|
+
"combobox-multi-placeholder": "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
51
|
+
"combobox-multi-search-placeholder": "\u691C\u7D22\u2026",
|
|
52
|
+
"combobox-multi-empty": "\u4E00\u81F4\u306A\u3057",
|
|
53
|
+
"combobox-multi-loading": "\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const { getAt, setAt } = useFormState();
|
|
58
|
+
const formScope = useFormScope();
|
|
59
|
+
const inherited = injectCELContext();
|
|
60
|
+
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
61
|
+
const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
|
|
62
|
+
const placeholderText = computed(
|
|
63
|
+
() => props.config.placeholder ? getLocalizedText(props.config.placeholder, locale.value) : t("combobox-multi-placeholder")
|
|
64
|
+
);
|
|
65
|
+
const tooltipText = computed(
|
|
66
|
+
() => props.config.tooltip ? getLocalizedText(props.config.tooltip, locale.value) : void 0
|
|
67
|
+
);
|
|
68
|
+
function evalBool(expression, label) {
|
|
69
|
+
if (!expression) return false;
|
|
70
|
+
try {
|
|
71
|
+
return Effect.runSync($cel(expression, { form: formScope.state.value ?? {} }));
|
|
72
|
+
} catch (err) {
|
|
73
|
+
console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const isDisabled = computed(() => evalBool(props.config.disabled, "disabled"));
|
|
78
|
+
const formReadonly = useFormReadonly();
|
|
79
|
+
const isReadonly = computed(
|
|
80
|
+
() => props.config.readonly != null ? evalBool(props.config.readonly, "readonly") : formReadonly.value
|
|
81
|
+
);
|
|
82
|
+
const effectiveReadonly = computed(() => isReadonly.value || props.config.derived?.mode === "formula");
|
|
83
|
+
const { isRequired, errors, warnings, visible } = useFieldValidation({
|
|
84
|
+
fieldId: () => props.fieldId,
|
|
85
|
+
config: () => props.config,
|
|
86
|
+
$cel,
|
|
87
|
+
locale: () => locale.value
|
|
88
|
+
});
|
|
89
|
+
const isStatic = computed(() => props.config.options.kind === "static");
|
|
90
|
+
const json = ref(null);
|
|
91
|
+
const isLoading = ref(false);
|
|
92
|
+
const requestSignature = computed(() => {
|
|
93
|
+
const opts = props.config.options;
|
|
94
|
+
if (opts.kind !== "remote") return null;
|
|
95
|
+
const expr = opts.request;
|
|
96
|
+
if (!expr) return null;
|
|
97
|
+
try {
|
|
98
|
+
const req = asRequest(Effect.runSync($cel(expr, { form: formScope.state.value ?? {} })));
|
|
99
|
+
return Option.isSome(req) ? JSON.stringify(req.value.describe()) : null;
|
|
100
|
+
} catch {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
let fetchSeq = 0;
|
|
105
|
+
async function fetchOptions() {
|
|
106
|
+
const seq = ++fetchSeq;
|
|
107
|
+
if (requestSignature.value == null) {
|
|
108
|
+
json.value = null;
|
|
109
|
+
isLoading.value = false;
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const opts = props.config.options;
|
|
113
|
+
const expr = opts.kind === "remote" ? opts.request : void 0;
|
|
114
|
+
if (!expr) {
|
|
115
|
+
json.value = null;
|
|
116
|
+
isLoading.value = false;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
isLoading.value = true;
|
|
120
|
+
const program = Effect.gen(function* () {
|
|
121
|
+
const body = yield* fetchJsonOption(yield* $cel(expr, { form: formScope.state.value ?? {} }));
|
|
122
|
+
return Option.getOrNull(body);
|
|
123
|
+
});
|
|
124
|
+
try {
|
|
125
|
+
const result = await Effect.runPromise(Effect.provide(program, Fetch.layer));
|
|
126
|
+
if (seq === fetchSeq) json.value = result;
|
|
127
|
+
} catch {
|
|
128
|
+
if (seq === fetchSeq) json.value = null;
|
|
129
|
+
} finally {
|
|
130
|
+
if (seq === fetchSeq) isLoading.value = false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function remoteValueOf(option) {
|
|
134
|
+
const opts = props.config.options;
|
|
135
|
+
if (opts.kind !== "remote") return void 0;
|
|
136
|
+
try {
|
|
137
|
+
return Effect.runSync($cel(opts.optionValue, { form: formScope.state.value ?? {}, option }));
|
|
138
|
+
} catch (err) {
|
|
139
|
+
console.error(`[shwfed-form] failed to evaluate optionValue for ${props.fieldId}:`, err);
|
|
140
|
+
return void 0;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function remoteLabelOf(option) {
|
|
144
|
+
const opts = props.config.options;
|
|
145
|
+
if (opts.kind !== "remote") return "";
|
|
146
|
+
try {
|
|
147
|
+
const raw = Effect.runSync($cel(opts.optionLabel, { form: formScope.state.value ?? {}, option }));
|
|
148
|
+
return raw == null ? "" : String(raw);
|
|
149
|
+
} catch (err) {
|
|
150
|
+
console.error(`[shwfed-form] failed to evaluate optionLabel for ${props.fieldId}:`, err);
|
|
151
|
+
return "";
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function remoteKeywordsOf(option) {
|
|
155
|
+
const opts = props.config.options;
|
|
156
|
+
if (opts.kind !== "remote" || !opts.optionKeywords) return void 0;
|
|
157
|
+
try {
|
|
158
|
+
const raw = Effect.runSync($cel(opts.optionKeywords, { form: formScope.state.value ?? {}, option }));
|
|
159
|
+
if (!Array.isArray(raw)) return void 0;
|
|
160
|
+
const joined = raw.map((k) => k == null ? "" : String(k)).filter(Boolean).join(" ");
|
|
161
|
+
return joined.length > 0 ? joined : void 0;
|
|
162
|
+
} catch (err) {
|
|
163
|
+
console.error(`[shwfed-form] failed to evaluate optionKeywords for ${props.fieldId}:`, err);
|
|
164
|
+
return void 0;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const entries = computed(() => {
|
|
168
|
+
const opts = props.config.options;
|
|
169
|
+
if (opts.kind === "static") {
|
|
170
|
+
return (opts.items ?? []).map((item) => {
|
|
171
|
+
const kw = (item.keywords ?? []).filter(Boolean).join(" ");
|
|
172
|
+
return {
|
|
173
|
+
key: item.id,
|
|
174
|
+
value: item.value.value,
|
|
175
|
+
label: getLocalizedText(item.label, locale.value) ?? "",
|
|
176
|
+
keywords: kw.length > 0 ? kw : void 0,
|
|
177
|
+
raw: item
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
let raw;
|
|
182
|
+
try {
|
|
183
|
+
raw = Effect.runSync($cel(opts.options, { form: formScope.state.value ?? {}, json: json.value }));
|
|
184
|
+
} catch (err) {
|
|
185
|
+
console.error(`[shwfed-form] failed to evaluate options for ${props.fieldId}:`, err);
|
|
186
|
+
return [];
|
|
187
|
+
}
|
|
188
|
+
if (!Array.isArray(raw)) return [];
|
|
189
|
+
return raw.map((option, idx) => ({
|
|
190
|
+
key: String(idx),
|
|
191
|
+
value: remoteValueOf(option),
|
|
192
|
+
label: remoteLabelOf(option),
|
|
193
|
+
keywords: remoteKeywordsOf(option),
|
|
194
|
+
raw: option
|
|
195
|
+
}));
|
|
196
|
+
});
|
|
197
|
+
const uncontrolled = ref([]);
|
|
198
|
+
const model = computed({
|
|
199
|
+
get: () => {
|
|
200
|
+
const path = props.config.binding;
|
|
201
|
+
const raw = path == null ? uncontrolled.value : getAt(path);
|
|
202
|
+
return Array.isArray(raw) ? raw : [];
|
|
203
|
+
},
|
|
204
|
+
set: (next) => {
|
|
205
|
+
const arr = Array.isArray(next) ? next : [];
|
|
206
|
+
const path = props.config.binding;
|
|
207
|
+
if (path == null) {
|
|
208
|
+
uncontrolled.value = arr;
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
setAt(path, arr);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
watchDebounced(
|
|
215
|
+
requestSignature,
|
|
216
|
+
() => {
|
|
217
|
+
void fetchOptions();
|
|
218
|
+
},
|
|
219
|
+
{ debounce: 200, immediate: true }
|
|
220
|
+
);
|
|
221
|
+
function isEqual(a, b) {
|
|
222
|
+
if (a === b) return true;
|
|
223
|
+
if (a == null || b == null) return false;
|
|
224
|
+
if (typeof a === "object" && typeof b === "object") {
|
|
225
|
+
try {
|
|
226
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
227
|
+
} catch {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
const selectedEntries = computed(() => {
|
|
234
|
+
const list = [];
|
|
235
|
+
for (const v of model.value) {
|
|
236
|
+
const entry = entries.value.find((e) => isEqual(e.value, v));
|
|
237
|
+
if (entry) list.push(entry);
|
|
238
|
+
}
|
|
239
|
+
return list;
|
|
240
|
+
});
|
|
241
|
+
const selectedKeys = computed(() => selectedEntries.value.map((e) => e.key));
|
|
242
|
+
const selectedKeySet = computed(() => new Set(selectedKeys.value));
|
|
243
|
+
publishSelection(
|
|
244
|
+
props.fieldId,
|
|
245
|
+
() => selectedEntries.value.length > 0 ? selectedEntries.value : void 0,
|
|
246
|
+
{
|
|
247
|
+
identity: (list) => list.map((e) => e.key).join("\0"),
|
|
248
|
+
raw: (list) => list.map((e) => e.raw)
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
const triggerLabel = computed(() => {
|
|
252
|
+
const arr = selectedEntries.value;
|
|
253
|
+
if (arr.length === 0) return "";
|
|
254
|
+
if (arr.length === 1) return arr[0].label;
|
|
255
|
+
return `${arr[0].label} +${arr.length - 1}`;
|
|
256
|
+
});
|
|
257
|
+
const readonlyLabel = computed(() => {
|
|
258
|
+
const labels = selectedEntries.value.map((e) => e.label).filter((l) => l.length > 0);
|
|
259
|
+
if (labels.length === 0) return "";
|
|
260
|
+
try {
|
|
261
|
+
return new Intl.ListFormat(locale.value, { type: "conjunction", style: "narrow" }).format(labels);
|
|
262
|
+
} catch {
|
|
263
|
+
return labels.join("\u3001");
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
const open = ref(false);
|
|
267
|
+
function handleSelect(next) {
|
|
268
|
+
const keys = Array.isArray(next) ? next.filter((k) => typeof k === "string") : [];
|
|
269
|
+
const mapped = [];
|
|
270
|
+
for (const key of keys) {
|
|
271
|
+
const entry = entries.value.find((e) => e.key === key);
|
|
272
|
+
if (entry) mapped.push(entry.value);
|
|
273
|
+
}
|
|
274
|
+
model.value = mapped;
|
|
275
|
+
}
|
|
276
|
+
const showClear = computed(
|
|
277
|
+
() => !isDisabled.value && selectedEntries.value.length > 0
|
|
278
|
+
);
|
|
279
|
+
function handleClear() {
|
|
280
|
+
model.value = [];
|
|
281
|
+
open.value = false;
|
|
282
|
+
}
|
|
283
|
+
</script>
|
|
284
|
+
|
|
285
|
+
<template>
|
|
286
|
+
<Field
|
|
287
|
+
:orientation="config.orientation ?? DEFAULT_FIELD_ORIENTATION"
|
|
288
|
+
:data-disabled="isDisabled || void 0"
|
|
289
|
+
>
|
|
290
|
+
<FieldLabel
|
|
291
|
+
v-if="labelText"
|
|
292
|
+
:for="fieldId"
|
|
293
|
+
class="text-xs text-zinc-500"
|
|
294
|
+
>
|
|
295
|
+
<template
|
|
296
|
+
v-if="tooltipText"
|
|
297
|
+
#tooltip
|
|
298
|
+
>
|
|
299
|
+
<Markdown
|
|
300
|
+
:source="tooltipText"
|
|
301
|
+
class="prose prose-xs prose-zinc"
|
|
302
|
+
/>
|
|
303
|
+
</template>
|
|
304
|
+
{{ labelText }}<span
|
|
305
|
+
v-if="isRequired"
|
|
306
|
+
aria-hidden="true"
|
|
307
|
+
class="text-red-600"
|
|
308
|
+
> *</span>
|
|
309
|
+
</FieldLabel>
|
|
310
|
+
<div
|
|
311
|
+
v-if="effectiveReadonly"
|
|
312
|
+
class="min-h-9 py-1.5 text-sm"
|
|
313
|
+
:class="readonlyLabel ? 'text-zinc-700' : 'font-mono text-zinc-300 select-none'"
|
|
314
|
+
>
|
|
315
|
+
{{ readonlyLabel || "-" }}
|
|
316
|
+
</div>
|
|
317
|
+
<Popover
|
|
318
|
+
v-else
|
|
319
|
+
v-model:open="open"
|
|
320
|
+
>
|
|
321
|
+
<PopoverAnchor as-child>
|
|
322
|
+
<InputGroup
|
|
323
|
+
class="group/combobox-multi"
|
|
324
|
+
:data-disabled="isDisabled ? 'true' : void 0"
|
|
325
|
+
>
|
|
326
|
+
<PopoverTrigger as-child>
|
|
327
|
+
<InputGroupInput
|
|
328
|
+
:id="fieldId"
|
|
329
|
+
:model-value="triggerLabel"
|
|
330
|
+
:disabled="isDisabled"
|
|
331
|
+
:placeholder="placeholderText"
|
|
332
|
+
class="cursor-pointer text-left"
|
|
333
|
+
readonly
|
|
334
|
+
/>
|
|
335
|
+
</PopoverTrigger>
|
|
336
|
+
<InputGroupAddon
|
|
337
|
+
v-if="isLoading"
|
|
338
|
+
align="inline-end"
|
|
339
|
+
class="text-zinc-400"
|
|
340
|
+
>
|
|
341
|
+
<Icon
|
|
342
|
+
icon="fluent:spinner-ios-20-regular"
|
|
343
|
+
class="animate-spin"
|
|
344
|
+
/>
|
|
345
|
+
</InputGroupAddon>
|
|
346
|
+
<InputGroupAddon
|
|
347
|
+
v-else-if="showClear"
|
|
348
|
+
align="inline-end"
|
|
349
|
+
class="[@media(hover:hover)]:opacity-0 transition-opacity group-hover/combobox-multi:opacity-100 focus-within:opacity-100"
|
|
350
|
+
>
|
|
351
|
+
<InputGroupButton
|
|
352
|
+
size="icon-xs"
|
|
353
|
+
data-slot="combobox-multi-clear"
|
|
354
|
+
class="text-zinc-500 hover:text-zinc-700"
|
|
355
|
+
tabindex="-1"
|
|
356
|
+
@mousedown.prevent
|
|
357
|
+
@click.stop="handleClear"
|
|
358
|
+
>
|
|
359
|
+
<Icon icon="fluent:dismiss-20-regular" />
|
|
360
|
+
</InputGroupButton>
|
|
361
|
+
</InputGroupAddon>
|
|
362
|
+
</InputGroup>
|
|
363
|
+
</PopoverAnchor>
|
|
364
|
+
<PopoverContent
|
|
365
|
+
class="p-0"
|
|
366
|
+
:style="{ width: 'var(--reka-popover-trigger-width)' }"
|
|
367
|
+
>
|
|
368
|
+
<Command
|
|
369
|
+
:model-value="selectedKeys"
|
|
370
|
+
:multiple="true"
|
|
371
|
+
:disabled="isDisabled"
|
|
372
|
+
@update:model-value="handleSelect"
|
|
373
|
+
>
|
|
374
|
+
<CommandInput :placeholder="t('combobox-multi-search-placeholder')" />
|
|
375
|
+
<CommandList>
|
|
376
|
+
<div
|
|
377
|
+
v-if="!isStatic && entries.length === 0"
|
|
378
|
+
data-slot="combobox-multi-empty"
|
|
379
|
+
class="py-6 text-center text-sm text-zinc-500"
|
|
380
|
+
>
|
|
381
|
+
{{ isLoading ? t("combobox-multi-loading") : t("combobox-multi-empty") }}
|
|
382
|
+
</div>
|
|
383
|
+
<template v-else>
|
|
384
|
+
<CommandEmpty class="py-6 text-center text-sm text-zinc-500">
|
|
385
|
+
{{ t("combobox-multi-empty") }}
|
|
386
|
+
</CommandEmpty>
|
|
387
|
+
<CommandGroup>
|
|
388
|
+
<CommandItem
|
|
389
|
+
v-for="entry in entries"
|
|
390
|
+
:key="entry.key"
|
|
391
|
+
:value="entry.key"
|
|
392
|
+
:keywords="entry.keywords"
|
|
393
|
+
>
|
|
394
|
+
<span class="flex-1">{{ entry.label }}</span>
|
|
395
|
+
<Icon
|
|
396
|
+
v-if="selectedKeySet.has(entry.key)"
|
|
397
|
+
icon="fluent:checkmark-20-regular"
|
|
398
|
+
class="size-4 text-zinc-700"
|
|
399
|
+
/>
|
|
400
|
+
</CommandItem>
|
|
401
|
+
</CommandGroup>
|
|
402
|
+
</template>
|
|
403
|
+
</CommandList>
|
|
404
|
+
</Command>
|
|
405
|
+
</PopoverContent>
|
|
406
|
+
</Popover>
|
|
407
|
+
<FieldMessages
|
|
408
|
+
v-if="visible"
|
|
409
|
+
:errors="errors"
|
|
410
|
+
:warnings="warnings"
|
|
411
|
+
/>
|
|
412
|
+
</Field>
|
|
413
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Value } from './schema.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
fieldId: string;
|
|
4
|
+
config: Value;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|