@shwfed/config 2.3.26 → 2.3.28

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 (84) hide show
  1. package/dist/mcp.mjs +1211 -701
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/{config-BkimX91E.js → config--PcXQV_r.js} +1 -1
  4. package/dist/preview/assets/{config-CO2iovZD.js → config-5KVDXgUF.js} +1 -1
  5. package/dist/preview/assets/{config-u1rl9w2L.js → config-B5avpKJE.js} +1 -1
  6. package/dist/preview/assets/{config-DgZ4NYoA.js → config-CJHPt8Gx.js} +1 -1
  7. package/dist/preview/assets/{config-ypYLVfRE.js → config-CNo3isHa.js} +1 -1
  8. package/dist/preview/assets/{config-Cm9t0CvW.js → config-CQHS6cZe.js} +1 -1
  9. package/dist/preview/assets/{config-DPFHMkHc.js → config-D0_1yZdF.js} +1 -1
  10. package/dist/preview/assets/{config-Dzqe6v-x.js → config-DDfTl9Cs.js} +1 -1
  11. package/dist/preview/assets/{config-BATy87wV.js → config-fvkC2rB8.js} +1 -1
  12. package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-CliXxe84.js → definition.vue_vue_type_script_setup_true_lang-RM-qDh0R.js} +1 -1
  13. package/dist/preview/assets/index-DNd8J9Zv.js +643 -0
  14. package/dist/preview/assets/index-DrIMqXAa.js +1 -0
  15. package/dist/preview/assets/index-a2QwAots.css +1 -0
  16. package/dist/preview/assets/{runtime-Dtc1ETUF.js → runtime-BGTWf-O7.js} +1 -1
  17. package/dist/preview/assets/{runtime-B_FMZ5eD.js → runtime-BPjZQmcY.js} +1 -1
  18. package/dist/preview/assets/{runtime-BTROwcw4.js → runtime-Bq3fmxeF.js} +1 -1
  19. package/dist/preview/assets/{runtime-Dsx8Y56q.js → runtime-CCbyrqQT.js} +1 -1
  20. package/dist/preview/assets/{runtime-T_tUqLxO.js → runtime-C_XX6a0C.js} +1 -1
  21. package/dist/preview/assets/{runtime-BR6-W3u_.js → runtime-CtqwtTE_.js} +1 -1
  22. package/dist/preview/assets/{runtime-D1xLbTQ9.js → runtime-DcrzodsN.js} +1 -1
  23. package/dist/preview/assets/{runtime-CTpsTb-X.js → runtime-Dr_10emf.js} +1 -1
  24. package/dist/preview/assets/{runtime-Cj0kLSqP.js → runtime-Dy4ZmQ-n.js} +1 -1
  25. package/dist/preview/index.html +2 -2
  26. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.tabs/config.d.vue.ts +2 -0
  27. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.tabs/config.vue +57 -3
  28. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.tabs/config.vue.d.ts +2 -0
  29. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.tabs/runtime.d.vue.ts +2 -0
  30. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.tabs/runtime.vue +1 -0
  31. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.tabs/runtime.vue.d.ts +2 -0
  32. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.tabs/schema.d.ts +2 -0
  33. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.tabs/schema.js +4 -0
  34. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.d.vue.ts +4 -4
  35. package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue.d.ts +4 -4
  36. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +127 -0
  37. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.vue +593 -0
  38. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +127 -0
  39. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/runtime.d.vue.ts +8 -0
  40. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/runtime.vue +465 -0
  41. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/runtime.vue.d.ts +8 -0
  42. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/schema.d.ts +95 -0
  43. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/schema.js +112 -0
  44. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +125 -0
  45. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.vue +525 -0
  46. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +125 -0
  47. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/runtime.d.vue.ts +8 -0
  48. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/runtime.vue +460 -0
  49. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/runtime.vue.d.ts +8 -0
  50. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/schema.d.ts +92 -0
  51. package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/schema.js +104 -0
  52. package/dist/runtime/components/form/fields/2026-05-26/tree-combobox-shared.d.ts +35 -0
  53. package/dist/runtime/components/form/fields/2026-05-26/tree-combobox-shared.js +31 -0
  54. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/runtime.vue +36 -13
  55. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/runtime.vue +36 -12
  56. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/runtime.vue +0 -1
  57. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +131 -0
  58. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.vue +607 -0
  59. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +131 -0
  60. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/runtime.d.vue.ts +9 -0
  61. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/runtime.vue +447 -0
  62. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/runtime.vue.d.ts +9 -0
  63. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/schema.d.ts +90 -0
  64. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/schema.js +143 -0
  65. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +129 -0
  66. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.vue +538 -0
  67. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +129 -0
  68. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/runtime.d.vue.ts +9 -0
  69. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/runtime.vue +429 -0
  70. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/runtime.vue.d.ts +9 -0
  71. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/schema.d.ts +87 -0
  72. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/schema.js +135 -0
  73. package/dist/runtime/components/table/columns/2026-05-27/tree-combobox-shared.d.ts +35 -0
  74. package/dist/runtime/components/table/columns/2026-05-27/tree-combobox-shared.js +31 -0
  75. package/dist/runtime/components/table/config.vue +29 -0
  76. package/dist/runtime/components/ui/command/CommandItem.vue +12 -4
  77. package/dist/runtime/components/ui/tree/Tree.d.vue.ts +2 -0
  78. package/dist/runtime/components/ui/tree/Tree.vue +7 -2
  79. package/dist/runtime/components/ui/tree/Tree.vue.d.ts +2 -0
  80. package/dist/runtime/components/ui/tree/TreeNode.vue +16 -26
  81. package/package.json +1 -1
  82. package/dist/preview/assets/index-6rM4rqXR.js +0 -1
  83. package/dist/preview/assets/index-BCE-G4Ha.css +0 -1
  84. package/dist/preview/assets/index-wBVA0mNO.js +0 -643
@@ -0,0 +1,127 @@
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.tree.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 displayName?: string | undefined;
26
+ readonly compatibilityDate: "2026-05-26";
27
+ readonly orientation?: "vertical" | "floating" | undefined;
28
+ readonly placeholder?: readonly [{
29
+ readonly locale: "zh";
30
+ readonly message: string;
31
+ }, ...{
32
+ readonly locale: "en" | "ja" | "ko";
33
+ readonly message: string;
34
+ }[]] | undefined;
35
+ readonly readonly?: string | undefined;
36
+ readonly binding?: string | undefined;
37
+ readonly derived?: {
38
+ readonly mode: "formula" | "prefill";
39
+ readonly expression: string;
40
+ } | undefined;
41
+ readonly dataSource: {
42
+ readonly data: string;
43
+ readonly request?: string | undefined;
44
+ };
45
+ readonly nodeKey: string;
46
+ readonly nodeChildren: string;
47
+ readonly nodeLabel: readonly [{
48
+ readonly locale: "zh";
49
+ readonly message: string;
50
+ }, ...{
51
+ readonly locale: "en" | "ja" | "ko";
52
+ readonly message: string;
53
+ }[]];
54
+ readonly expandAll: boolean;
55
+ readonly cascade: "independent" | "cascade-down" | "cascade-both";
56
+ readonly nodeTooltip?: readonly [{
57
+ readonly locale: "zh";
58
+ readonly message: string;
59
+ }, ...{
60
+ readonly locale: "en" | "ja" | "ko";
61
+ readonly message: string;
62
+ }[]] | undefined;
63
+ readonly nodeSelectable?: string | undefined;
64
+ }) => any;
65
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
66
+ "onUpdate:modelValue"?: ((value: {
67
+ readonly label?: readonly [{
68
+ readonly locale: "zh";
69
+ readonly message: string;
70
+ }, ...{
71
+ readonly locale: "en" | "ja" | "ko";
72
+ readonly message: string;
73
+ }[]] | undefined;
74
+ readonly disabled?: string | undefined;
75
+ readonly type: "com.shwfed.form.field.tree.combobox.multi";
76
+ readonly id: string;
77
+ readonly hidden?: string | undefined;
78
+ readonly tooltip?: readonly [{
79
+ readonly locale: "zh";
80
+ readonly message: string;
81
+ }, ...{
82
+ readonly locale: "en" | "ja" | "ko";
83
+ readonly message: string;
84
+ }[]] | undefined;
85
+ readonly displayName?: string | undefined;
86
+ readonly compatibilityDate: "2026-05-26";
87
+ readonly orientation?: "vertical" | "floating" | undefined;
88
+ readonly placeholder?: readonly [{
89
+ readonly locale: "zh";
90
+ readonly message: string;
91
+ }, ...{
92
+ readonly locale: "en" | "ja" | "ko";
93
+ readonly message: string;
94
+ }[]] | undefined;
95
+ readonly readonly?: string | undefined;
96
+ readonly binding?: string | undefined;
97
+ readonly derived?: {
98
+ readonly mode: "formula" | "prefill";
99
+ readonly expression: string;
100
+ } | undefined;
101
+ readonly dataSource: {
102
+ readonly data: string;
103
+ readonly request?: string | undefined;
104
+ };
105
+ readonly nodeKey: string;
106
+ readonly nodeChildren: string;
107
+ readonly nodeLabel: readonly [{
108
+ readonly locale: "zh";
109
+ readonly message: string;
110
+ }, ...{
111
+ readonly locale: "en" | "ja" | "ko";
112
+ readonly message: string;
113
+ }[]];
114
+ readonly expandAll: boolean;
115
+ readonly cascade: "independent" | "cascade-down" | "cascade-both";
116
+ readonly nodeTooltip?: readonly [{
117
+ readonly locale: "zh";
118
+ readonly message: string;
119
+ }, ...{
120
+ readonly locale: "en" | "ja" | "ko";
121
+ readonly message: string;
122
+ }[]] | undefined;
123
+ readonly nodeSelectable?: string | undefined;
124
+ }) => any) | undefined;
125
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
126
+ declare const _default: typeof __VLS_export;
127
+ 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,465 @@
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, shallowRef, 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, InputGroupAddon, InputGroupButton, InputGroupInput } from "../../../../ui/input-group";
12
+ import { Markdown } from "../../../../ui/markdown";
13
+ import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../../../../ui/popover";
14
+ import { Skeleton } from "../../../../ui/skeleton";
15
+ import { Tree as UiTree } from "../../../../ui/tree";
16
+ import { interpolateMarkdown } from "../../../../table/utils/runtime";
17
+ import { DEFAULT_FIELD_ORIENTATION } from "../../../utils/common";
18
+ import { useFormReadonly } from "../../../utils/readonly";
19
+ import { useFormState } from "../../../utils/state";
20
+ import {
21
+ findWrappedPath,
22
+ getWrappedChildren,
23
+ wrapStructuralAll
24
+ } from "../tree-combobox-shared";
25
+ defineOptions({ name: "ShwfedTreeComboboxMultiFieldRuntime" });
26
+ const props = defineProps({
27
+ fieldId: { type: String, required: true },
28
+ config: { type: null, required: true }
29
+ });
30
+ const { locale, t } = useI18n({
31
+ inheritLocale: true,
32
+ messages: {
33
+ zh: {
34
+ "tree-combobox-multi-placeholder": "\u8BF7\u9009\u62E9",
35
+ "tree-combobox-multi-search-placeholder": "\u641C\u7D22\u2026",
36
+ "tree-combobox-multi-search-clear": "\u6E05\u9664\u641C\u7D22",
37
+ "tree-combobox-multi-empty": "\u65E0\u53EF\u9009\u9879",
38
+ "tree-combobox-multi-load-error": "\u52A0\u8F7D\u5931\u8D25",
39
+ "tree-combobox-multi-retry": "\u91CD\u8BD5",
40
+ "tree-combobox-multi-readonly-empty": "\u2014"
41
+ },
42
+ en: {
43
+ "tree-combobox-multi-placeholder": "Select\u2026",
44
+ "tree-combobox-multi-search-placeholder": "Search\u2026",
45
+ "tree-combobox-multi-search-clear": "Clear search",
46
+ "tree-combobox-multi-empty": "No options",
47
+ "tree-combobox-multi-load-error": "Failed to load",
48
+ "tree-combobox-multi-retry": "Retry",
49
+ "tree-combobox-multi-readonly-empty": "\u2014"
50
+ },
51
+ ja: {
52
+ "tree-combobox-multi-placeholder": "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
53
+ "tree-combobox-multi-search-placeholder": "\u691C\u7D22\u2026",
54
+ "tree-combobox-multi-search-clear": "\u691C\u7D22\u3092\u30AF\u30EA\u30A2",
55
+ "tree-combobox-multi-empty": "\u9078\u629E\u80A2\u306A\u3057",
56
+ "tree-combobox-multi-load-error": "\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
57
+ "tree-combobox-multi-retry": "\u518D\u8A66\u884C",
58
+ "tree-combobox-multi-readonly-empty": "\u2014"
59
+ }
60
+ }
61
+ });
62
+ const { state, getAt, setAt } = useFormState();
63
+ const inherited = injectCELContext();
64
+ const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
65
+ const labelText = computed(() => getLocalizedText(props.config.label, locale.value));
66
+ const tooltipText = computed(
67
+ () => props.config.tooltip ? getLocalizedText(props.config.tooltip, locale.value) : void 0
68
+ );
69
+ const placeholderText = computed(
70
+ () => props.config.placeholder ? getLocalizedText(props.config.placeholder, locale.value) : t("tree-combobox-multi-placeholder")
71
+ );
72
+ function evalBool(expression, label) {
73
+ if (!expression) return false;
74
+ try {
75
+ return Effect.runSync($cel(expression, { form: state.value ?? {} }));
76
+ } catch (err) {
77
+ console.error(`[shwfed-form] failed to evaluate ${label} for ${props.fieldId}:`, err);
78
+ return false;
79
+ }
80
+ }
81
+ const isDisabled = computed(() => evalBool(props.config.disabled, "disabled"));
82
+ const formReadonly = useFormReadonly();
83
+ const isReadonly = computed(
84
+ () => props.config.readonly != null ? evalBool(props.config.readonly, "readonly") : formReadonly.value
85
+ );
86
+ const effectiveReadonly = computed(() => isReadonly.value || props.config.derived?.mode === "formula");
87
+ const uncontrolled = ref([]);
88
+ const model = computed({
89
+ get: () => {
90
+ const path = props.config.binding;
91
+ const raw = path == null ? uncontrolled.value : getAt(path);
92
+ return Array.isArray(raw) ? raw.map((v) => String(v)) : [];
93
+ },
94
+ set: (next) => {
95
+ const coerced = next.map((v) => String(v));
96
+ const path = props.config.binding;
97
+ if (path == null) {
98
+ uncontrolled.value = coerced;
99
+ return;
100
+ }
101
+ setAt(path, coerced);
102
+ }
103
+ });
104
+ function nodeCtx(raw) {
105
+ return { form: state.value ?? {}, node: raw };
106
+ }
107
+ function nodeKey(raw) {
108
+ try {
109
+ return String(Effect.runSync($cel(props.config.nodeKey, nodeCtx(raw))));
110
+ } catch (err) {
111
+ console.error(`[shwfed-form] failed to evaluate nodeKey for ${props.fieldId}:`, err);
112
+ return "";
113
+ }
114
+ }
115
+ function nodeChildrenList(raw) {
116
+ let v;
117
+ try {
118
+ v = Effect.runSync($cel(props.config.nodeChildren, nodeCtx(raw)));
119
+ } catch (err) {
120
+ console.error(`[shwfed-form] failed to evaluate nodeChildren for ${props.fieldId}:`, err);
121
+ return void 0;
122
+ }
123
+ if (v == null) return void 0;
124
+ if (!Array.isArray(v)) return void 0;
125
+ return v;
126
+ }
127
+ function safeInterpolate(tpl, raw) {
128
+ try {
129
+ return interpolateMarkdown(tpl, $cel, nodeCtx(raw));
130
+ } catch (err) {
131
+ console.error(`[shwfed-form] failed to interpolate node text for ${props.fieldId}:`, err);
132
+ return tpl;
133
+ }
134
+ }
135
+ function wrappedLabelText(w) {
136
+ const tpl = getLocalizedText(props.config.nodeLabel, locale.value) ?? "";
137
+ return tpl ? safeInterpolate(tpl, w.raw) : "";
138
+ }
139
+ function wrappedTooltipText(w) {
140
+ if (!props.config.nodeTooltip) return void 0;
141
+ const tpl = getLocalizedText(props.config.nodeTooltip, locale.value);
142
+ return tpl ? safeInterpolate(tpl, w.raw) : void 0;
143
+ }
144
+ function wrappedSelectable(w, _depth) {
145
+ if (isDisabled.value) return false;
146
+ const expr = props.config.nodeSelectable;
147
+ if (!expr) return true;
148
+ try {
149
+ return Effect.runSync($cel(expr, nodeCtx(w.raw)));
150
+ } catch {
151
+ return false;
152
+ }
153
+ }
154
+ const rawRoots = shallowRef([]);
155
+ const loading = ref(false);
156
+ const fetchError = ref(null);
157
+ async function fetchTree() {
158
+ const dataSource = props.config.dataSource;
159
+ if (!dataSource) {
160
+ rawRoots.value = [];
161
+ return;
162
+ }
163
+ const effect = Effect.gen(function* () {
164
+ let jsonOpt = Option.none();
165
+ if (dataSource.request) {
166
+ const builder = yield* $cel(dataSource.request, {
167
+ form: state.value ?? {}
168
+ });
169
+ const response = yield* builder.json();
170
+ jsonOpt = Option.some(response);
171
+ }
172
+ const dataRaw = yield* $cel(dataSource.data, {
173
+ form: state.value ?? {},
174
+ json: jsonOpt
175
+ });
176
+ return Array.isArray(dataRaw) ? dataRaw : [];
177
+ });
178
+ const program = Effect.gen(function* () {
179
+ const showMaskFiber = yield* Effect.fork(
180
+ Effect.sync(() => {
181
+ loading.value = true;
182
+ }).pipe(Effect.delay("30 millis"))
183
+ );
184
+ return yield* Effect.ensuring(effect, Fiber.interrupt(showMaskFiber));
185
+ }).pipe(
186
+ Effect.ensuring(Effect.sync(() => {
187
+ loading.value = false;
188
+ }))
189
+ );
190
+ try {
191
+ const result = await Effect.runPromise(Effect.provide(program, Fetch.layer));
192
+ rawRoots.value = result;
193
+ fetchError.value = null;
194
+ } catch (e) {
195
+ console.warn("[shwfed-form] tree-combobox dataSource fetch failed", e);
196
+ fetchError.value = e;
197
+ }
198
+ }
199
+ watch(
200
+ () => [props.config.dataSource?.request, props.config.dataSource?.data],
201
+ () => {
202
+ void fetchTree();
203
+ },
204
+ { immediate: true }
205
+ );
206
+ const roots = computed(
207
+ () => wrapStructuralAll(rawRoots.value, {
208
+ nodeKey,
209
+ nodeChildren: nodeChildrenList
210
+ })
211
+ );
212
+ function labelForKey(k) {
213
+ const path = findWrappedPath(roots.value, k);
214
+ if (!path || path.length === 0) return null;
215
+ const leaf = path[path.length - 1];
216
+ return wrappedLabelText(leaf);
217
+ }
218
+ const triggerLabel = computed(() => {
219
+ const arr = model.value;
220
+ if (arr.length === 0) return "";
221
+ const head = labelForKey(arr[0]);
222
+ if (head === null || head.length === 0) return "";
223
+ if (arr.length === 1) return head;
224
+ return `${head} + ${arr.length - 1}`;
225
+ });
226
+ const initialExpanded = computed(() => {
227
+ if (!props.config.expandAll) return [];
228
+ const out = [];
229
+ const stack = [...roots.value];
230
+ while (stack.length) {
231
+ const n = stack.pop();
232
+ if (n.kind === "branch") {
233
+ out.push(n.key);
234
+ stack.push(...n.children);
235
+ }
236
+ }
237
+ return out;
238
+ });
239
+ const filterQuery = ref("");
240
+ function filterPredicate(w, query) {
241
+ const q = query.trim().toLowerCase();
242
+ if (!q) return true;
243
+ return wrappedLabelText(w).trim().toLowerCase().includes(q);
244
+ }
245
+ const open = ref(false);
246
+ function handleUpdate(next) {
247
+ const arr = Array.isArray(next) ? next : [];
248
+ model.value = arr;
249
+ }
250
+ const showClear = computed(
251
+ () => !isDisabled.value && !loading.value && model.value.length > 0
252
+ );
253
+ function handleClear() {
254
+ model.value = [];
255
+ open.value = false;
256
+ }
257
+ const hoveredKey = ref(null);
258
+ watch(open, (isOpen) => {
259
+ if (!isOpen) hoveredKey.value = null;
260
+ });
261
+ function collectTooltipNodes(out, siblings) {
262
+ for (const n of siblings) {
263
+ if (wrappedTooltipText(n)) out.push(n.key);
264
+ if (n.kind === "branch") collectTooltipNodes(out, n.children);
265
+ }
266
+ }
267
+ const anyHasTooltip = computed(() => {
268
+ if (!props.config.nodeTooltip) return false;
269
+ const out = [];
270
+ collectTooltipNodes(out, roots.value);
271
+ return out.length > 0;
272
+ });
273
+ const hoveredTooltip = computed(() => {
274
+ const k = hoveredKey.value;
275
+ if (!k) return void 0;
276
+ const path = findWrappedPath(roots.value, k);
277
+ if (!path || path.length === 0) return void 0;
278
+ return wrappedTooltipText(path[path.length - 1]);
279
+ });
280
+ </script>
281
+
282
+ <template>
283
+ <Field
284
+ :orientation="config.orientation ?? DEFAULT_FIELD_ORIENTATION"
285
+ :data-disabled="isDisabled || void 0"
286
+ >
287
+ <FieldLabel
288
+ v-if="labelText"
289
+ :for="fieldId"
290
+ class="text-xs text-zinc-500"
291
+ >
292
+ <template
293
+ v-if="tooltipText"
294
+ #tooltip
295
+ >
296
+ <Markdown
297
+ :source="tooltipText"
298
+ class="prose prose-xs prose-zinc"
299
+ />
300
+ </template>
301
+ {{ labelText }}
302
+ </FieldLabel>
303
+
304
+ <div
305
+ v-if="effectiveReadonly"
306
+ class="min-h-9 py-1.5 text-sm text-zinc-700"
307
+ >
308
+ {{ triggerLabel || t("tree-combobox-multi-readonly-empty") }}
309
+ </div>
310
+
311
+ <Popover
312
+ v-else
313
+ v-model:open="open"
314
+ >
315
+ <PopoverAnchor as-child>
316
+ <InputGroup
317
+ class="group/tree-combobox-multi"
318
+ :data-disabled="isDisabled ? 'true' : void 0"
319
+ >
320
+ <PopoverTrigger as-child>
321
+ <InputGroupInput
322
+ :id="fieldId"
323
+ :model-value="triggerLabel"
324
+ :disabled="isDisabled"
325
+ :placeholder="placeholderText"
326
+ class="cursor-pointer text-left"
327
+ readonly
328
+ />
329
+ </PopoverTrigger>
330
+ <InputGroupAddon
331
+ v-if="loading"
332
+ align="inline-end"
333
+ data-slot="tree-combobox-multi-loading"
334
+ class="text-zinc-400"
335
+ >
336
+ <Icon
337
+ icon="fluent:spinner-ios-20-regular"
338
+ class="animate-spin"
339
+ />
340
+ </InputGroupAddon>
341
+ <InputGroupAddon
342
+ v-else-if="showClear"
343
+ align="inline-end"
344
+ class="[@media(hover:hover)]:opacity-0 transition-opacity group-hover/tree-combobox-multi:opacity-100 focus-within:opacity-100"
345
+ >
346
+ <InputGroupButton
347
+ size="icon-xs"
348
+ data-slot="tree-combobox-multi-clear"
349
+ class="text-zinc-500 hover:text-zinc-700"
350
+ tabindex="-1"
351
+ @mousedown.prevent
352
+ @click.stop="handleClear"
353
+ >
354
+ <Icon icon="fluent:dismiss-20-regular" />
355
+ </InputGroupButton>
356
+ </InputGroupAddon>
357
+ </InputGroup>
358
+ </PopoverAnchor>
359
+ <PopoverContent
360
+ class="p-0"
361
+ :style="{ width: 'var(--reka-popover-trigger-width)' }"
362
+ >
363
+ <div
364
+ data-slot="tree-combobox-multi-search"
365
+ class="flex h-9 items-center gap-2 border-b border-zinc-200 px-3"
366
+ >
367
+ <Icon
368
+ icon="fluent:search-20-filled"
369
+ class="size-3.5 shrink-0 opacity-50"
370
+ />
371
+ <input
372
+ v-model="filterQuery"
373
+ :disabled="isDisabled"
374
+ :placeholder="t('tree-combobox-multi-search-placeholder')"
375
+ class="flex h-9 w-full bg-transparent text-sm outline-hidden placeholder:text-zinc-500 disabled:cursor-not-allowed disabled:opacity-50"
376
+ >
377
+ </div>
378
+ <div class="flex flex-col p-1">
379
+ <div
380
+ v-if="fetchError && roots.length === 0"
381
+ class="min-h-9 px-2 py-1.5 text-sm text-red-500"
382
+ >
383
+ {{ t("tree-combobox-multi-load-error") }}
384
+ </div>
385
+ <div
386
+ v-else-if="loading && roots.length === 0"
387
+ class="flex flex-col gap-1.5 px-2 py-1"
388
+ aria-busy="true"
389
+ >
390
+ <Skeleton class="h-5 w-2/3" />
391
+ <Skeleton class="h-5 w-1/2" />
392
+ <Skeleton class="h-5 w-3/5" />
393
+ </div>
394
+
395
+ <UiTree
396
+ v-else
397
+ :roots="roots"
398
+ :get-key="(w) => w.key"
399
+ :get-children="getWrappedChildren"
400
+ selection-mode="multi"
401
+ :cascade="config.cascade ?? 'independent'"
402
+ :model-value="model"
403
+ :selectable="wrappedSelectable"
404
+ :filter-predicate="filterPredicate"
405
+ :filter-query="filterQuery"
406
+ :initial-expanded="initialExpanded"
407
+ :show-focused-row="false"
408
+ :class="isDisabled ? 'pointer-events-none opacity-60' : void 0"
409
+ class="max-h-72 overflow-y-auto"
410
+ @update:model-value="handleUpdate"
411
+ >
412
+ <template #node="{ node, selected }">
413
+ <span
414
+ class="flex flex-1 min-w-0 items-center justify-between gap-2"
415
+ @mouseenter="hoveredKey = node.key"
416
+ @focusin="hoveredKey = node.key"
417
+ >
418
+ <Markdown
419
+ :source="wrappedLabelText(node)"
420
+ class="prose prose-sm prose-zinc text-zinc-700 min-w-0"
421
+ />
422
+ <Icon
423
+ v-if="selected"
424
+ icon="fluent:checkmark-20-regular"
425
+ class="size-3 shrink-0 text-zinc-700"
426
+ />
427
+ </span>
428
+ </template>
429
+
430
+ <template #empty>
431
+ <div class="min-h-9 px-2 py-1.5 text-sm text-zinc-400">
432
+ {{ t("tree-combobox-multi-empty") }}
433
+ </div>
434
+ </template>
435
+
436
+ <template #error="{ error, retry }">
437
+ <span class="inline-flex items-center gap-1 text-xs text-red-500">
438
+ {{ t("tree-combobox-multi-load-error") }}
439
+ <button
440
+ type="button"
441
+ class="underline hover:text-red-600"
442
+ @click.stop="retry"
443
+ >
444
+ {{ t("tree-combobox-multi-retry") }}
445
+ </button>
446
+ <span class="sr-only">{{ String(error) }}</span>
447
+ </span>
448
+ </template>
449
+ </UiTree>
450
+ </div>
451
+ <div
452
+ v-if="anyHasTooltip && hoveredTooltip"
453
+ data-slot="tree-combobox-multi-tooltip"
454
+ class="border-t border-zinc-200 px-3 py-2"
455
+ >
456
+ <Markdown
457
+ :source="hoveredTooltip"
458
+ block
459
+ class="prose prose-sm prose-zinc"
460
+ />
461
+ </div>
462
+ </PopoverContent>
463
+ </Popover>
464
+ </Field>
465
+ </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;