@shwfed/config 2.3.11 → 2.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/mcp.mjs +1157 -733
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/{config-BZahzuEc.js → config-0UIjgMSM.js} +1 -1
  4. package/dist/preview/assets/{config-57-v4VXo.js → config-9eu0BvKT.js} +1 -1
  5. package/dist/preview/assets/{config-BnZQO-Sp.js → config-B1jKkIYg.js} +1 -1
  6. package/dist/preview/assets/{config-DNokxY7M.js → config-BpTg08Vv.js} +1 -1
  7. package/dist/preview/assets/{config-_uPI8qV-.js → config-CDjs2Ohl.js} +1 -1
  8. package/dist/preview/assets/{config-_msO_f2R.js → config-CVS1PW6h.js} +1 -1
  9. package/dist/preview/assets/{config-Be-2ZA2R.js → config-DoQjG5TI.js} +1 -1
  10. package/dist/preview/assets/{config-Bp91DUdU.js → config-f56G9OU7.js} +1 -1
  11. package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-BtScXbs1.js → definition.vue_vue_type_script_setup_true_lang-DbnaeqGK.js} +1 -1
  12. package/dist/preview/assets/index-Br_eXThF.css +1 -0
  13. package/dist/preview/assets/index-DDthcoXk.js +637 -0
  14. package/dist/preview/assets/index-DhkKZ2ii.js +1 -0
  15. package/dist/preview/assets/{runtime-Dk9u-Ybw.js → runtime-BICQC6bF.js} +1 -1
  16. package/dist/preview/assets/{runtime-CfR7ZAND.js → runtime-BkZp9k_z.js} +1 -1
  17. package/dist/preview/assets/{runtime-XXqIAt53.js → runtime-BqFFtMNw.js} +1 -1
  18. package/dist/preview/assets/{runtime-BBms4myv.js → runtime-COMOofol.js} +1 -1
  19. package/dist/preview/assets/{runtime-D3EyeiyA.js → runtime-CPPOlC0F.js} +1 -1
  20. package/dist/preview/assets/{runtime-cKWSGFod.js → runtime-DejxoCBP.js} +1 -1
  21. package/dist/preview/assets/{runtime-w7V-p3t1.js → runtime-YYdaCEw3.js} +1 -1
  22. package/dist/preview/assets/{runtime-B9u14qqB.js → runtime-hKRNY9F6.js} +1 -1
  23. package/dist/preview/index.html +2 -2
  24. package/dist/runtime/components/actions/utils/resolve.js +6 -2
  25. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +1 -1
  26. package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/schema.d.ts +4 -0
  27. package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/schema.js +6 -17
  28. package/dist/runtime/components/config/utils/resolve.js +3 -1
  29. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +18 -18
  30. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +18 -18
  31. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.d.vue.ts +4 -4
  32. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue.d.ts +4 -4
  33. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +22 -22
  34. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +22 -22
  35. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.d.vue.ts +2 -2
  36. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.vue.d.ts +2 -2
  37. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.d.vue.ts +4 -4
  38. package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.vue.d.ts +4 -4
  39. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.d.vue.ts +12 -12
  40. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue.d.ts +12 -12
  41. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.d.vue.ts +10 -10
  42. package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.vue.d.ts +10 -10
  43. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.d.vue.ts +12 -12
  44. package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.vue.d.ts +12 -12
  45. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.d.vue.ts +133 -0
  46. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue +605 -0
  47. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue.d.ts +133 -0
  48. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.d.vue.ts +8 -0
  49. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.vue +324 -0
  50. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.vue.d.ts +8 -0
  51. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/schema.d.ts +99 -0
  52. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/schema.js +129 -0
  53. package/dist/runtime/components/form/unit-config.vue +0 -23
  54. package/dist/runtime/components/form/utils/resolve.js +3 -1
  55. package/dist/runtime/components/table/config.d.vue.ts +2 -2
  56. package/dist/runtime/components/table/config.vue +5 -45
  57. package/dist/runtime/components/table/config.vue.d.ts +2 -2
  58. package/dist/runtime/components/table/schema.d.ts +9 -2
  59. package/dist/runtime/components/table/schema.js +30 -14
  60. package/dist/runtime/components/table/utils/resolve.js +3 -1
  61. package/dist/runtime/components/ui/date-range-picker/DateRangePickerDateTimePanel.d.vue.ts +1 -1
  62. package/dist/runtime/components/ui/date-range-picker/DateRangePickerDateTimePanel.vue.d.ts +1 -1
  63. package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.d.vue.ts +1 -1
  64. package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.vue.d.ts +1 -1
  65. package/dist/runtime/components/ui/tree/Tree.d.vue.ts +57 -0
  66. package/dist/runtime/components/ui/tree/Tree.vue +325 -0
  67. package/dist/runtime/components/ui/tree/Tree.vue.d.ts +57 -0
  68. package/dist/runtime/components/ui/tree/TreeNode.d.vue.ts +53 -0
  69. package/dist/runtime/components/ui/tree/TreeNode.vue +299 -0
  70. package/dist/runtime/components/ui/tree/TreeNode.vue.d.ts +53 -0
  71. package/dist/runtime/components/ui/tree/index.d.ts +3 -0
  72. package/dist/runtime/components/ui/tree/index.js +2 -0
  73. package/dist/runtime/components/ui/tree/types.d.ts +120 -0
  74. package/dist/runtime/components/ui/tree/types.js +0 -0
  75. package/dist/runtime/components/ui/tree/useTreeState.d.ts +95 -0
  76. package/dist/runtime/components/ui/tree/useTreeState.js +369 -0
  77. package/dist/runtime/shims.d.ts +2 -0
  78. package/package.json +1 -1
  79. package/dist/preview/assets/index-DDbl2Atj.js +0 -1
  80. package/dist/preview/assets/index-DGa3Oj3y.js +0 -1075
  81. package/dist/preview/assets/index-mbGtsgdv.css +0 -1
  82. package/dist/runtime/components/form/ai/fields-button.d.vue.ts +0 -13
  83. package/dist/runtime/components/form/ai/fields-button.vue +0 -460
  84. package/dist/runtime/components/form/ai/fields-button.vue.d.ts +0 -13
  85. package/dist/runtime/components/form/ai/fields-task.md +0 -71
  86. package/dist/runtime/components/table/ai/columns-button.d.vue.ts +0 -12
  87. package/dist/runtime/components/table/ai/columns-button.vue +0 -492
  88. package/dist/runtime/components/table/ai/columns-button.vue.d.ts +0 -12
  89. package/dist/runtime/components/table/ai/columns-task.md +0 -53
  90. package/dist/runtime/components/table/ai/data-source-button.d.vue.ts +0 -20
  91. package/dist/runtime/components/table/ai/data-source-button.vue +0 -324
  92. package/dist/runtime/components/table/ai/data-source-button.vue.d.ts +0 -20
  93. package/dist/runtime/components/table/ai/data-source-task.md +0 -17
  94. package/dist/runtime/utils/ai/cel-prompt.d.ts +0 -11
  95. package/dist/runtime/utils/ai/cel-prompt.js +0 -27
@@ -0,0 +1,133 @@
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 filter?: {
8
+ readonly label?: readonly [{
9
+ readonly locale: "zh";
10
+ readonly message: string;
11
+ }, ...{
12
+ readonly locale: "en" | "ja" | "ko";
13
+ readonly message: string;
14
+ }[]] | undefined;
15
+ readonly enabled: boolean;
16
+ readonly keywords?: string | undefined;
17
+ } | undefined;
18
+ readonly label?: readonly [{
19
+ readonly locale: "zh";
20
+ readonly message: string;
21
+ }, ...{
22
+ readonly locale: "en" | "ja" | "ko";
23
+ readonly message: string;
24
+ }[]] | undefined;
25
+ readonly disabled?: string | undefined;
26
+ readonly type: "com.shwfed.form.field.tree.multi";
27
+ readonly id: string;
28
+ readonly hidden?: string | undefined;
29
+ readonly tooltip?: readonly [{
30
+ readonly locale: "zh";
31
+ readonly message: string;
32
+ }, ...{
33
+ readonly locale: "en" | "ja" | "ko";
34
+ readonly message: string;
35
+ }[]] | undefined;
36
+ readonly displayName?: string | undefined;
37
+ readonly compatibilityDate: "2026-05-23";
38
+ readonly readonly?: string | undefined;
39
+ readonly binding?: string | undefined;
40
+ readonly derived?: {
41
+ readonly mode: "formula" | "prefill";
42
+ readonly expression: string;
43
+ } | undefined;
44
+ readonly dataSource: {
45
+ readonly data: string;
46
+ readonly request?: string | undefined;
47
+ };
48
+ readonly cascade: "independent" | "cascade-down" | "cascade-both";
49
+ readonly nodeKey: string;
50
+ readonly nodeChildren: string;
51
+ readonly nodeLabel: readonly [{
52
+ readonly locale: "zh";
53
+ readonly message: string;
54
+ }, ...{
55
+ readonly locale: "en" | "ja" | "ko";
56
+ readonly message: string;
57
+ }[]];
58
+ readonly nodeTooltip?: readonly [{
59
+ readonly locale: "zh";
60
+ readonly message: string;
61
+ }, ...{
62
+ readonly locale: "en" | "ja" | "ko";
63
+ readonly message: string;
64
+ }[]] | undefined;
65
+ readonly nodeSelectable?: string | undefined;
66
+ readonly expandAll: boolean;
67
+ }) => any;
68
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
69
+ "onUpdate:modelValue"?: ((value: {
70
+ readonly filter?: {
71
+ readonly label?: readonly [{
72
+ readonly locale: "zh";
73
+ readonly message: string;
74
+ }, ...{
75
+ readonly locale: "en" | "ja" | "ko";
76
+ readonly message: string;
77
+ }[]] | undefined;
78
+ readonly enabled: boolean;
79
+ readonly keywords?: string | undefined;
80
+ } | undefined;
81
+ readonly label?: readonly [{
82
+ readonly locale: "zh";
83
+ readonly message: string;
84
+ }, ...{
85
+ readonly locale: "en" | "ja" | "ko";
86
+ readonly message: string;
87
+ }[]] | undefined;
88
+ readonly disabled?: string | undefined;
89
+ readonly type: "com.shwfed.form.field.tree.multi";
90
+ readonly id: string;
91
+ readonly hidden?: string | undefined;
92
+ readonly tooltip?: readonly [{
93
+ readonly locale: "zh";
94
+ readonly message: string;
95
+ }, ...{
96
+ readonly locale: "en" | "ja" | "ko";
97
+ readonly message: string;
98
+ }[]] | undefined;
99
+ readonly displayName?: string | undefined;
100
+ readonly compatibilityDate: "2026-05-23";
101
+ readonly readonly?: string | undefined;
102
+ readonly binding?: string | undefined;
103
+ readonly derived?: {
104
+ readonly mode: "formula" | "prefill";
105
+ readonly expression: string;
106
+ } | undefined;
107
+ readonly dataSource: {
108
+ readonly data: string;
109
+ readonly request?: string | undefined;
110
+ };
111
+ readonly cascade: "independent" | "cascade-down" | "cascade-both";
112
+ readonly nodeKey: string;
113
+ readonly nodeChildren: string;
114
+ readonly nodeLabel: readonly [{
115
+ readonly locale: "zh";
116
+ readonly message: string;
117
+ }, ...{
118
+ readonly locale: "en" | "ja" | "ko";
119
+ readonly message: string;
120
+ }[]];
121
+ readonly nodeTooltip?: readonly [{
122
+ readonly locale: "zh";
123
+ readonly message: string;
124
+ }, ...{
125
+ readonly locale: "en" | "ja" | "ko";
126
+ readonly message: string;
127
+ }[]] | undefined;
128
+ readonly nodeSelectable?: string | undefined;
129
+ readonly expandAll: boolean;
130
+ }) => any) | undefined;
131
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
132
+ declare const _default: typeof __VLS_export;
133
+ 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,324 @@
1
+ <script setup>
2
+ import { Icon } from "@iconify/vue";
3
+ import { Effect, Fiber, Option } from "effect";
4
+ import { Fetch } from "fx-fetch";
5
+ import { computed, ref, watch } from "vue";
6
+ import { useI18n } from "vue-i18n";
7
+ import { cel as _rawCel } from "../../../../../utils/cel";
8
+ import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
9
+ import { getLocalizedText } from "../../../../../share/locale";
10
+ import { Field, FieldLabel } from "../../../../ui/field";
11
+ import { InputGroup, InputGroupButton, InputGroupInput } from "../../../../ui/input-group";
12
+ import { Markdown } from "../../../../ui/markdown";
13
+ import { Tree as UiTree } from "../../../../ui/tree";
14
+ import { interpolateMarkdown } from "../../../../table/utils/runtime";
15
+ import { useFormReadonly } from "../../../utils/readonly";
16
+ import { useFormState } from "../../../utils/state";
17
+ defineOptions({ name: "ShwfedTreeMultiFieldRuntime" });
18
+ const props = defineProps({
19
+ fieldId: { type: String, required: true },
20
+ config: { type: null, required: true }
21
+ });
22
+ const { locale } = useI18n();
23
+ const { state, getAt, setAt } = useFormState();
24
+ const inherited = injectCELContext();
25
+ const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
26
+ const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
27
+ const tooltipText = computed(
28
+ () => props.config.tooltip ? getLocalizedText(props.config.tooltip, locale.value) : void 0
29
+ );
30
+ function evalBool(expression, label) {
31
+ if (!expression) return false;
32
+ try {
33
+ return Effect.runSync($cel(expression, { form: state.value ?? {} }));
34
+ } catch (err) {
35
+ console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
36
+ return false;
37
+ }
38
+ }
39
+ const isDisabled = computed(() => evalBool(props.config.disabled, "disabled"));
40
+ const formReadonly = useFormReadonly();
41
+ const isReadonly = computed(
42
+ () => props.config.readonly != null ? evalBool(props.config.readonly, "readonly") : formReadonly.value
43
+ );
44
+ const effectiveReadonly = computed(() => isReadonly.value || props.config.derived?.mode === "formula");
45
+ const uncontrolled = ref([]);
46
+ const model = computed({
47
+ get: () => {
48
+ const path = props.config.binding;
49
+ const raw = path == null ? uncontrolled.value : getAt(path);
50
+ return Array.isArray(raw) ? raw.map((v) => String(v)) : [];
51
+ },
52
+ set: (next) => {
53
+ const coerced = next.map((v) => String(v));
54
+ const path = props.config.binding;
55
+ if (path == null) {
56
+ uncontrolled.value = coerced;
57
+ return;
58
+ }
59
+ setAt(path, coerced);
60
+ }
61
+ });
62
+ const roots = ref([]);
63
+ const loading = ref(false);
64
+ const fetchError = ref(null);
65
+ async function fetchTree() {
66
+ const dataSource = props.config.dataSource;
67
+ if (!dataSource) {
68
+ roots.value = [];
69
+ return;
70
+ }
71
+ const effect = Effect.gen(function* () {
72
+ let jsonOpt = Option.none();
73
+ if (dataSource.request) {
74
+ const builder = yield* $cel(dataSource.request, {
75
+ form: state.value ?? {}
76
+ });
77
+ const response = yield* builder.json();
78
+ jsonOpt = Option.some(response);
79
+ }
80
+ const dataRaw = yield* $cel(dataSource.data, {
81
+ form: state.value ?? {},
82
+ json: jsonOpt
83
+ });
84
+ return Array.isArray(dataRaw) ? dataRaw : [];
85
+ });
86
+ const program = Effect.gen(function* () {
87
+ const showMaskFiber = yield* Effect.fork(
88
+ Effect.sync(() => {
89
+ loading.value = true;
90
+ }).pipe(Effect.delay("30 millis"))
91
+ );
92
+ return yield* Effect.ensuring(effect, Fiber.interrupt(showMaskFiber));
93
+ }).pipe(
94
+ Effect.ensuring(Effect.sync(() => {
95
+ loading.value = false;
96
+ }))
97
+ );
98
+ try {
99
+ const result = await Effect.runPromise(Effect.provide(program, Fetch.layer));
100
+ roots.value = result;
101
+ fetchError.value = null;
102
+ } catch (e) {
103
+ console.warn("[shwfed-form] tree dataSource fetch failed", e);
104
+ fetchError.value = e;
105
+ }
106
+ }
107
+ watch(
108
+ () => [props.config.dataSource?.request, props.config.dataSource?.data],
109
+ () => {
110
+ void fetchTree();
111
+ },
112
+ { immediate: true }
113
+ );
114
+ function nodeCtx(node) {
115
+ return { form: state.value ?? {}, node };
116
+ }
117
+ function getKey(node) {
118
+ try {
119
+ const v = Effect.runSync($cel(props.config.nodeKey, nodeCtx(node)));
120
+ return String(v);
121
+ } catch (err) {
122
+ console.error(`[shwfed-form] failed to evaluate nodeKey for ${props.fieldId}:`, err);
123
+ return "";
124
+ }
125
+ }
126
+ function getChildren(node) {
127
+ let raw;
128
+ try {
129
+ raw = Effect.runSync($cel(props.config.nodeChildren, nodeCtx(node)));
130
+ } catch (err) {
131
+ console.error(`[shwfed-form] failed to evaluate nodeChildren for ${props.fieldId}:`, err);
132
+ return void 0;
133
+ }
134
+ if (raw == null) return void 0;
135
+ if (!Array.isArray(raw)) return void 0;
136
+ if (raw.length === 0) return void 0;
137
+ return raw;
138
+ }
139
+ function nodeSelectable(node, _depth) {
140
+ if (isDisabled.value) return false;
141
+ const expr = props.config.nodeSelectable;
142
+ if (!expr) return true;
143
+ try {
144
+ return Effect.runSync($cel(expr, nodeCtx(node)));
145
+ } catch (err) {
146
+ console.error(`[shwfed-form] failed to evaluate nodeSelectable for ${props.fieldId}:`, err);
147
+ return false;
148
+ }
149
+ }
150
+ function safeInterpolate(tpl, node) {
151
+ try {
152
+ return interpolateMarkdown(tpl, $cel, { form: state.value ?? {}, node });
153
+ } catch (err) {
154
+ console.error(`[shwfed-form] failed to interpolate node text for ${props.fieldId}:`, err);
155
+ return tpl;
156
+ }
157
+ }
158
+ function nodeLabelText(node) {
159
+ const tpl = getLocalizedText(props.config.nodeLabel, locale.value) ?? "";
160
+ return tpl ? safeInterpolate(tpl, node) : "";
161
+ }
162
+ function nodeTooltipText(node) {
163
+ if (!props.config.nodeTooltip) return void 0;
164
+ const tpl = getLocalizedText(props.config.nodeTooltip, locale.value);
165
+ if (!tpl) return void 0;
166
+ return safeInterpolate(tpl, node);
167
+ }
168
+ const initialExpanded = computed(() => {
169
+ if (!props.config.expandAll) return [];
170
+ const out = [];
171
+ const stack = [...roots.value];
172
+ while (stack.length) {
173
+ const n = stack.pop();
174
+ const kids = getChildren(n);
175
+ if (kids && kids.length) {
176
+ out.push(getKey(n));
177
+ stack.push(...kids);
178
+ }
179
+ }
180
+ return out;
181
+ });
182
+ const filterQuery = ref("");
183
+ function evalKeywords(node) {
184
+ const expr = props.config.filter?.keywords;
185
+ if (!expr) return [];
186
+ try {
187
+ const raw = Effect.runSync($cel(expr, nodeCtx(node)));
188
+ if (!Array.isArray(raw)) return [];
189
+ return raw.map((v) => String(v));
190
+ } catch {
191
+ return [];
192
+ }
193
+ }
194
+ function filterPredicate(node, query) {
195
+ const q = query.trim().toLowerCase();
196
+ if (!q) return true;
197
+ const label = nodeLabelText(node).trim().toLowerCase();
198
+ if (label.includes(q)) return true;
199
+ for (const k of evalKeywords(node)) {
200
+ if (k.trim().toLowerCase().includes(q)) return true;
201
+ }
202
+ return false;
203
+ }
204
+ const filterLabelText = computed(() => {
205
+ const localized = props.config.filter?.label ? getLocalizedText(props.config.filter.label, locale.value) : void 0;
206
+ return localized && localized.length > 0 ? localized : "\u641C\u7D22";
207
+ });
208
+ const readonlyText = computed(() => {
209
+ const selected = new Set(model.value);
210
+ if (selected.size === 0) return "\u2014";
211
+ const found = /* @__PURE__ */ new Map();
212
+ const stack = [...roots.value];
213
+ while (stack.length) {
214
+ const n = stack.pop();
215
+ const k = getKey(n);
216
+ if (selected.has(k)) found.set(k, nodeLabelText(n));
217
+ const kids = getChildren(n);
218
+ if (kids && kids.length) stack.push(...kids);
219
+ }
220
+ const labels = model.value.map((id) => found.get(id) ?? id).filter((l) => l.length > 0);
221
+ return labels.length > 0 ? labels.join("\u3001") : "\u2014";
222
+ });
223
+ </script>
224
+
225
+ <template>
226
+ <Field
227
+ orientation="vertical"
228
+ :data-disabled="isDisabled || void 0"
229
+ >
230
+ <FieldLabel
231
+ v-if="labelText"
232
+ class="text-xs text-zinc-500"
233
+ >
234
+ <template
235
+ v-if="tooltipText"
236
+ #tooltip
237
+ >
238
+ <Markdown
239
+ :source="tooltipText"
240
+ class="prose prose-xs prose-zinc"
241
+ />
242
+ </template>
243
+ {{ labelText }}
244
+ </FieldLabel>
245
+
246
+ <div
247
+ v-if="effectiveReadonly"
248
+ class="min-h-9 py-1.5 text-sm text-zinc-700"
249
+ >
250
+ {{ readonlyText }}
251
+ </div>
252
+
253
+ <template v-else>
254
+ <Field
255
+ v-if="config.filter?.enabled"
256
+ orientation="floating"
257
+ >
258
+ <FieldLabel>{{ filterLabelText }}</FieldLabel>
259
+ <InputGroup>
260
+ <InputGroupInput
261
+ v-model="filterQuery"
262
+ :disabled="isDisabled"
263
+ />
264
+ <InputGroupButton
265
+ v-if="filterQuery.length > 0"
266
+ aria-label="清除搜索"
267
+ @click="filterQuery = ''"
268
+ >
269
+ <Icon icon="lucide:x" />
270
+ </InputGroupButton>
271
+ </InputGroup>
272
+ </Field>
273
+
274
+ <div
275
+ v-if="fetchError && roots.length === 0"
276
+ class="min-h-9 py-1.5 text-sm text-red-500"
277
+ >
278
+ 加载失败
279
+ </div>
280
+ <div
281
+ v-else-if="loading && roots.length === 0"
282
+ class="min-h-9 py-1.5 text-sm text-zinc-400"
283
+ >
284
+ 加载中…
285
+ </div>
286
+
287
+ <UiTree
288
+ v-else
289
+ v-model="model"
290
+ :roots="roots"
291
+ :get-key="getKey"
292
+ :get-children="getChildren"
293
+ selection-mode="multi"
294
+ :cascade="config.cascade ?? 'cascade-both'"
295
+ :selectable="nodeSelectable"
296
+ :filter-predicate="filterPredicate"
297
+ :filter-query="filterQuery"
298
+ :initial-expanded="initialExpanded"
299
+ :class="isDisabled ? 'pointer-events-none opacity-60' : void 0"
300
+ >
301
+ <template #node="{ node }">
302
+ <span class="flex flex-col gap-0.5">
303
+ <Markdown
304
+ :source="nodeLabelText(node)"
305
+ class="prose prose-sm prose-zinc text-zinc-700"
306
+ />
307
+ <Markdown
308
+ v-if="nodeTooltipText(node)"
309
+ :source="nodeTooltipText(node)"
310
+ block
311
+ class="prose prose-xs prose-zinc text-zinc-400"
312
+ />
313
+ </span>
314
+ </template>
315
+
316
+ <template #empty>
317
+ <div class="min-h-9 py-1.5 text-sm text-zinc-400">
318
+ 无可选项
319
+ </div>
320
+ </template>
321
+ </UiTree>
322
+ </template>
323
+ </Field>
324
+ </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;
@@ -0,0 +1,99 @@
1
+ import { Schema } from 'effect';
2
+ import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
3
+ export declare const type: "com.shwfed.form.field.tree.multi";
4
+ export declare const compatibilityDate: "2026-05-23";
5
+ export declare const metadata: {
6
+ readonly name: "树(多选)";
7
+ readonly icon: "fluent:tree-evergreen-20-regular";
8
+ readonly w: {
9
+ readonly initial: 8;
10
+ readonly min: 4;
11
+ readonly max: number;
12
+ };
13
+ readonly h: {
14
+ readonly initial: 8;
15
+ readonly min: 4;
16
+ readonly max: number;
17
+ readonly grow: true;
18
+ };
19
+ };
20
+ export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
21
+ label: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
22
+ locale: Schema.Literal<["zh"]>;
23
+ message: Schema.SchemaClass<string, string, never>;
24
+ }>], [Schema.Struct<{
25
+ locale: Schema.Literal<["ja", "en", "ko"]>;
26
+ message: Schema.SchemaClass<string, string, never>;
27
+ }>]>>;
28
+ tooltip: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
29
+ locale: Schema.Literal<["zh"]>;
30
+ message: Schema.SchemaClass<string, string, never>;
31
+ }>], [Schema.Struct<{
32
+ locale: Schema.Literal<["ja", "en", "ko"]>;
33
+ message: Schema.SchemaClass<string, string, never>;
34
+ }>]>>;
35
+ binding: Schema.optional<Schema.refine<string, typeof Schema.String>>;
36
+ disabled: Schema.optional<Schema.Schema<string, string, never>>;
37
+ readonly: Schema.optional<Schema.Schema<string, string, never>>;
38
+ derived: Schema.optional<Schema.Struct<{
39
+ mode: Schema.Literal<["formula", "prefill"]>;
40
+ expression: Schema.Schema<string, string, never>;
41
+ }>>;
42
+ dataSource: Schema.Struct<{
43
+ request: Schema.optional<Schema.Schema<string, string, never>>;
44
+ data: Schema.Schema<string, string, never>;
45
+ }>;
46
+ nodeKey: Schema.Schema<string, string, never>;
47
+ nodeChildren: Schema.Schema<string, string, never>;
48
+ nodeLabel: Schema.refine<readonly [{
49
+ readonly locale: "zh";
50
+ readonly message: string;
51
+ }, ...{
52
+ readonly locale: "en" | "ja" | "ko";
53
+ readonly message: string;
54
+ }[]], Schema.TupleType<readonly [Schema.Struct<{
55
+ locale: Schema.Literal<["zh"]>;
56
+ message: Schema.SchemaClass<string, string, never>;
57
+ }>], [Schema.Struct<{
58
+ locale: Schema.Literal<["ja", "en", "ko"]>;
59
+ message: Schema.SchemaClass<string, string, never>;
60
+ }>]>>;
61
+ nodeTooltip: Schema.optional<Schema.refine<readonly [{
62
+ readonly locale: "zh";
63
+ readonly message: string;
64
+ }, ...{
65
+ readonly locale: "en" | "ja" | "ko";
66
+ readonly message: string;
67
+ }[]], Schema.TupleType<readonly [Schema.Struct<{
68
+ locale: Schema.Literal<["zh"]>;
69
+ message: Schema.SchemaClass<string, string, never>;
70
+ }>], [Schema.Struct<{
71
+ locale: Schema.Literal<["ja", "en", "ko"]>;
72
+ message: Schema.SchemaClass<string, string, never>;
73
+ }>]>>>;
74
+ nodeSelectable: Schema.optional<Schema.Schema<string, string, never>>;
75
+ cascade: Schema.optionalWith<Schema.Literal<["independent", "cascade-down", "cascade-both"]>, {
76
+ default: () => "cascade-both";
77
+ }>;
78
+ expandAll: Schema.optionalWith<typeof Schema.Boolean, {
79
+ default: () => false;
80
+ }>;
81
+ filter: Schema.optional<Schema.Struct<{
82
+ enabled: Schema.SchemaClass<boolean, boolean, never>;
83
+ label: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
84
+ locale: Schema.Literal<["zh"]>;
85
+ message: Schema.SchemaClass<string, string, never>;
86
+ }>], [Schema.Struct<{
87
+ locale: Schema.Literal<["ja", "en", "ko"]>;
88
+ message: Schema.SchemaClass<string, string, never>;
89
+ }>]>>;
90
+ keywords: Schema.optional<Schema.Schema<string, string, never>>;
91
+ }>>;
92
+ id: Schema.refine<string, typeof Schema.String>;
93
+ displayName: Schema.optional<Schema.SchemaClass<string, string, never>>;
94
+ hidden: Schema.optional<Schema.Schema<string, string, never>>;
95
+ type: Schema.Literal<["com.shwfed.form.field.tree.multi"]>;
96
+ compatibilityDate: Schema.Literal<["2026-05-23"]>;
97
+ }>;
98
+ export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
99
+ export declare function defaults(): Partial<Value>;