@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.single";
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.single";
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,402 @@
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, nextTick, ref, watch } 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: "ShwfedComboboxSingleFieldRuntime" });
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-single-placeholder": "\u8BF7\u9009\u62E9",
37
+ "combobox-single-search-placeholder": "\u641C\u7D22\u2026",
38
+ "combobox-single-empty": "\u65E0\u5339\u914D\u9879",
39
+ "combobox-single-loading": "\u52A0\u8F7D\u4E2D\u2026"
40
+ },
41
+ en: {
42
+ "combobox-single-placeholder": "Select\u2026",
43
+ "combobox-single-search-placeholder": "Search\u2026",
44
+ "combobox-single-empty": "No matches",
45
+ "combobox-single-loading": "Loading\u2026"
46
+ },
47
+ ja: {
48
+ "combobox-single-placeholder": "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
49
+ "combobox-single-search-placeholder": "\u691C\u7D22\u2026",
50
+ "combobox-single-empty": "\u4E00\u81F4\u306A\u3057",
51
+ "combobox-single-loading": "\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026"
52
+ }
53
+ }
54
+ });
55
+ const { state, getAt, setAt, setAtSilent } = 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-single-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 tooltipTpl = item.tooltip ? getLocalizedText(item.tooltip, locale.value) : void 0;
168
+ const ctx = { form: state.value ?? {} };
169
+ const kw = (item.keywords ?? []).filter(Boolean).join(" ");
170
+ return {
171
+ key: item.id,
172
+ value: item.value.value,
173
+ label: labelTpl ? safeInterpolate(labelTpl, ctx) : "",
174
+ tooltip: tooltipTpl ? safeInterpolate(tooltipTpl, ctx) : void 0,
175
+ keywords: kw.length > 0 ? kw : void 0
176
+ };
177
+ });
178
+ }
179
+ let raw;
180
+ try {
181
+ raw = Effect.runSync($cel(opts.options, { form: state.value ?? {}, json: json.value }));
182
+ } catch (err) {
183
+ console.error(`[shwfed-form] failed to evaluate options for ${props.fieldId}:`, err);
184
+ return [];
185
+ }
186
+ if (!Array.isArray(raw)) return [];
187
+ return raw.map((option, idx) => ({
188
+ key: String(idx),
189
+ value: remoteValueOf(option),
190
+ label: remoteLabelOf(option),
191
+ keywords: remoteKeywordsOf(option)
192
+ }));
193
+ });
194
+ const uncontrolled = ref(void 0);
195
+ const model = computed({
196
+ get: () => {
197
+ const path = props.config.binding;
198
+ if (path == null) return uncontrolled.value;
199
+ return getAt(path);
200
+ },
201
+ set: (next) => {
202
+ const path = props.config.binding;
203
+ if (path == null) {
204
+ uncontrolled.value = next;
205
+ return;
206
+ }
207
+ setAt(path, next);
208
+ }
209
+ });
210
+ let lastRequestSignature;
211
+ watchDebounced(
212
+ requestSignature,
213
+ () => {
214
+ if (lastRequestSignature != null) {
215
+ const path = props.config.binding;
216
+ if (path == null) uncontrolled.value = void 0;
217
+ else setAtSilent(path, void 0);
218
+ }
219
+ lastRequestSignature = requestSignature.value;
220
+ void fetchOptions();
221
+ },
222
+ { debounce: 200, immediate: true }
223
+ );
224
+ function isEqual(a, b) {
225
+ if (a === b) return true;
226
+ if (a == null || b == null) return false;
227
+ if (typeof a === "object" && typeof b === "object") {
228
+ try {
229
+ return JSON.stringify(a) === JSON.stringify(b);
230
+ } catch {
231
+ return false;
232
+ }
233
+ }
234
+ return false;
235
+ }
236
+ const selectedEntry = computed(
237
+ () => entries.value.find((entry) => isEqual(entry.value, model.value))
238
+ );
239
+ const selectedKey = computed(() => selectedEntry.value?.key);
240
+ const selectedLabel = computed(() => selectedEntry.value?.label ?? "");
241
+ const open = ref(false);
242
+ function handleSelect(key) {
243
+ if (typeof key !== "string") return;
244
+ const entry = entries.value.find((e) => e.key === key);
245
+ if (!entry) return;
246
+ model.value = entry.value;
247
+ void nextTick().then(() => {
248
+ open.value = false;
249
+ });
250
+ }
251
+ const showClear = computed(
252
+ () => !isDisabled.value && selectedEntry.value !== void 0
253
+ );
254
+ function handleClear() {
255
+ model.value = void 0;
256
+ open.value = false;
257
+ }
258
+ const hoveredKey = ref(null);
259
+ watch(open, (isOpen) => {
260
+ hoveredKey.value = isOpen ? entries.value[0]?.key ?? null : null;
261
+ });
262
+ const hoveredEntry = computed(
263
+ () => entries.value.find((e) => e.key === hoveredKey.value)
264
+ );
265
+ const hoveredTooltip = computed(() => hoveredEntry.value?.tooltip);
266
+ const anyHasTooltip = computed(
267
+ () => entries.value.some((e) => e.tooltip != null && e.tooltip.length > 0)
268
+ );
269
+ </script>
270
+
271
+ <template>
272
+ <Field
273
+ :orientation="config.orientation ?? DEFAULT_FIELD_ORIENTATION"
274
+ :data-disabled="isDisabled || void 0"
275
+ >
276
+ <FieldLabel
277
+ v-if="labelText"
278
+ :for="fieldId"
279
+ class="text-xs text-zinc-500"
280
+ >
281
+ <template
282
+ v-if="tooltipText"
283
+ #tooltip
284
+ >
285
+ <Markdown
286
+ :source="tooltipText"
287
+ class="prose prose-xs prose-zinc"
288
+ />
289
+ </template>
290
+ {{ labelText }}
291
+ </FieldLabel>
292
+ <div
293
+ v-if="effectiveReadonly"
294
+ class="min-h-9 py-1.5 text-sm text-zinc-700"
295
+ >
296
+ <Markdown
297
+ v-if="selectedLabel"
298
+ :source="selectedLabel"
299
+ />
300
+ <template v-else>
301
+
302
+ </template>
303
+ </div>
304
+ <Popover
305
+ v-else
306
+ v-model:open="open"
307
+ >
308
+ <PopoverAnchor as-child>
309
+ <InputGroup
310
+ class="group/combobox-single"
311
+ :data-disabled="isDisabled ? 'true' : void 0"
312
+ >
313
+ <PopoverTrigger as-child>
314
+ <InputGroupInput
315
+ :id="fieldId"
316
+ :model-value="selectedLabel"
317
+ :disabled="isDisabled"
318
+ :placeholder="placeholderText"
319
+ class="cursor-pointer text-left"
320
+ readonly
321
+ />
322
+ </PopoverTrigger>
323
+ <InputGroupAddon
324
+ v-if="isLoading"
325
+ align="inline-end"
326
+ class="text-zinc-400"
327
+ >
328
+ <Icon
329
+ icon="fluent:spinner-ios-20-regular"
330
+ class="animate-spin"
331
+ />
332
+ </InputGroupAddon>
333
+ <InputGroupAddon
334
+ v-else-if="showClear"
335
+ align="inline-end"
336
+ class="[@media(hover:hover)]:opacity-0 transition-opacity group-hover/combobox-single:opacity-100 focus-within:opacity-100"
337
+ >
338
+ <InputGroupButton
339
+ size="icon-xs"
340
+ data-slot="combobox-single-clear"
341
+ class="text-zinc-500 hover:text-zinc-700"
342
+ tabindex="-1"
343
+ @mousedown.prevent
344
+ @click.stop="handleClear"
345
+ >
346
+ <Icon icon="fluent:dismiss-20-regular" />
347
+ </InputGroupButton>
348
+ </InputGroupAddon>
349
+ </InputGroup>
350
+ </PopoverAnchor>
351
+ <PopoverContent
352
+ class="p-0"
353
+ :style="{ width: 'var(--reka-popover-trigger-width)' }"
354
+ >
355
+ <Command
356
+ :model-value="selectedKey"
357
+ :disabled="isDisabled"
358
+ selection-behavior="toggle"
359
+ @update:model-value="handleSelect"
360
+ >
361
+ <CommandInput :placeholder="t('combobox-single-search-placeholder')" />
362
+ <CommandList>
363
+ <div
364
+ v-if="!isStatic && entries.length === 0"
365
+ data-slot="combobox-single-empty"
366
+ class="py-6 text-center text-sm text-zinc-500"
367
+ >
368
+ {{ isLoading ? t("combobox-single-loading") : t("combobox-single-empty") }}
369
+ </div>
370
+ <template v-else>
371
+ <CommandEmpty class="py-6 text-center text-sm text-zinc-500">
372
+ {{ t("combobox-single-empty") }}
373
+ </CommandEmpty>
374
+ <CommandGroup>
375
+ <CommandItem
376
+ v-for="entry in entries"
377
+ :key="entry.key"
378
+ :value="entry.key"
379
+ :keywords="entry.keywords"
380
+ @mouseenter="hoveredKey = entry.key"
381
+ @focus="hoveredKey = entry.key"
382
+ >
383
+ <Markdown :source="entry.label" />
384
+ </CommandItem>
385
+ </CommandGroup>
386
+ </template>
387
+ </CommandList>
388
+ <div
389
+ v-if="anyHasTooltip && hoveredTooltip"
390
+ class="border-t border-zinc-200 px-3 py-2"
391
+ >
392
+ <Markdown
393
+ :source="hoveredTooltip"
394
+ block
395
+ class="prose prose-sm prose-zinc"
396
+ />
397
+ </div>
398
+ </Command>
399
+ </PopoverContent>
400
+ </Popover>
401
+ </Field>
402
+ </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;