@shwfed/config 2.3.28 → 2.3.29

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