@shwfed/config 2.10.0 → 2.10.1

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 (97) hide show
  1. package/dist/mcp.mjs +4125 -3183
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/{FieldGroup.vue_vue_type_script_setup_true_lang-CCaOWk_7.js → FieldGroup.vue_vue_type_script_setup_true_lang-CuFusz5A.js} +1 -1
  4. package/dist/preview/assets/{badge-D9_7atSJ.js → badge-D5FPHSix.js} +1 -1
  5. package/dist/preview/assets/{config-B2d8SiPi.js → config-BHPiQ1lB.js} +1 -1
  6. package/dist/preview/assets/{config-DYxMKhCU.js → config-BWC-Zw21.js} +1 -1
  7. package/dist/preview/assets/{config-CNKb25Qo.js → config-Bg94Z7XN.js} +1 -1
  8. package/dist/preview/assets/{config-CQrqVV1U.js → config-BqSL4UAL.js} +1 -1
  9. package/dist/preview/assets/{config-Bk2VSNeu.js → config-CeRBpZbE.js} +1 -1
  10. package/dist/preview/assets/{config-C9WPOoA7.js → config-CfjcFb_E.js} +1 -1
  11. package/dist/preview/assets/{config-DZlaJUlF.js → config-DNUKa3lN.js} +1 -1
  12. package/dist/preview/assets/{config-BLEovXei.js → config-DVjZmomc.js} +1 -1
  13. package/dist/preview/assets/{config-DyPl6K2G.js → config-Djv6EQBY.js} +1 -1
  14. package/dist/preview/assets/{config-DWA385pD.js → config-PNpa6ENz.js} +1 -1
  15. package/dist/preview/assets/{config-C8lCItmz.js → config-ucxtM3wX.js} +1 -1
  16. package/dist/preview/assets/{config-Bf5Vckj3.js → config-urZuasV7.js} +1 -1
  17. package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-CFzQ7icU.js → definition.vue_vue_type_script_setup_true_lang-BzryfjdG.js} +1 -1
  18. package/dist/preview/assets/index-BE9O1XgB.js +1 -0
  19. package/dist/preview/assets/{index-CXOEVGFP.js → index-DCRQGu0g.js} +1 -1
  20. package/dist/preview/assets/index-yvElpEK3.js +743 -0
  21. package/dist/preview/assets/{item-DCVX69_o.js → item-CTkdtkvl.js} +1 -1
  22. package/dist/preview/assets/{runtime-r1wbrr4k.js → runtime-3rajYvjp.js} +1 -1
  23. package/dist/preview/assets/{runtime-BNk4EliL.js → runtime-4A3oiig9.js} +1 -1
  24. package/dist/preview/assets/{runtime-Cbc5NH57.js → runtime-BOGZFWxF.js} +1 -1
  25. package/dist/preview/assets/{runtime-BO-KY3T_.js → runtime-BqroTX7H.js} +1 -1
  26. package/dist/preview/assets/{runtime-O6MNC3GA.js → runtime-CBBae0-H.js} +1 -1
  27. package/dist/preview/assets/{runtime-DEWGIyvr.js → runtime-CBuV3vwL.js} +1 -1
  28. package/dist/preview/assets/{runtime-DJ9ElxWB.js → runtime-CI8yzwXd.js} +1 -1
  29. package/dist/preview/assets/{runtime-DSfMvph3.js → runtime-CcyhgOum.js} +1 -1
  30. package/dist/preview/assets/{runtime-BD1A-g1h.js → runtime-CkQ-mNoH.js} +1 -1
  31. package/dist/preview/assets/{runtime-BsNSI1XP.js → runtime-DmxKfudS.js} +1 -1
  32. package/dist/preview/assets/{schema-meta-ovcuERKg.js → schema-meta-BFzIzGiN.js} +1 -1
  33. package/dist/preview/index.html +1 -1
  34. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/runtime.vue +5 -1
  35. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.vue +16 -3
  36. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/runtime.vue +5 -1
  37. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/runtime.vue +5 -1
  38. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.vue +17 -3
  39. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/runtime.vue +5 -1
  40. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/runtime.vue +5 -1
  41. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/runtime.vue +5 -1
  42. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/runtime.vue +5 -1
  43. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/runtime.vue +5 -1
  44. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/runtime.vue +5 -1
  45. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/runtime.vue +5 -1
  46. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/runtime.vue +5 -1
  47. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/runtime.vue +5 -1
  48. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/runtime.vue +5 -1
  49. package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/runtime.vue +5 -1
  50. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/runtime.vue +5 -1
  51. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/runtime.vue +5 -1
  52. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/runtime.vue +5 -1
  53. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/runtime.vue +5 -1
  54. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.d.vue.ts +179 -0
  55. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue +942 -0
  56. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue.d.ts +179 -0
  57. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/runtime.d.vue.ts +9 -0
  58. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/runtime.vue +499 -0
  59. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/runtime.vue.d.ts +9 -0
  60. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/schema.d.ts +223 -0
  61. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/schema.js +276 -0
  62. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.d.vue.ts +179 -0
  63. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue +942 -0
  64. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue.d.ts +179 -0
  65. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/runtime.d.vue.ts +9 -0
  66. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/runtime.vue +438 -0
  67. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/runtime.vue.d.ts +9 -0
  68. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/schema.d.ts +223 -0
  69. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/schema.js +276 -0
  70. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +123 -0
  71. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue +646 -0
  72. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +123 -0
  73. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/runtime.d.vue.ts +9 -0
  74. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/runtime.vue +500 -0
  75. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/runtime.vue.d.ts +9 -0
  76. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/schema.d.ts +83 -0
  77. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/schema.js +179 -0
  78. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +121 -0
  79. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue +577 -0
  80. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +121 -0
  81. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/runtime.d.vue.ts +9 -0
  82. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/runtime.vue +465 -0
  83. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/runtime.vue.d.ts +9 -0
  84. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/schema.d.ts +80 -0
  85. package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/schema.js +171 -0
  86. package/dist/runtime/components/table/columns/2026-06-14/combobox-migrate.d.ts +18 -0
  87. package/dist/runtime/components/table/columns/2026-06-14/combobox-migrate.js +36 -0
  88. package/dist/runtime/components/table/columns/2026-06-14/tree-combobox-shared.d.ts +35 -0
  89. package/dist/runtime/components/table/columns/2026-06-14/tree-combobox-shared.js +31 -0
  90. package/dist/runtime/components/table/index.d.vue.ts +2 -0
  91. package/dist/runtime/components/table/index.vue +24 -0
  92. package/dist/runtime/components/table/index.vue.d.ts +2 -0
  93. package/dist/runtime/components/table/utils/shared.d.ts +1 -0
  94. package/dist/runtime/components/table/utils/shared.js +7 -13
  95. package/package.json +1 -1
  96. package/dist/preview/assets/index-7BE56IYF.js +0 -739
  97. package/dist/preview/assets/index-Bwv0Yz_L.js +0 -1
@@ -0,0 +1,179 @@
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 size?: number | undefined;
8
+ readonly disabled?: string | undefined;
9
+ readonly type: "com.shwfed.table.column.combobox-single";
10
+ readonly id: string;
11
+ readonly title: readonly [{
12
+ readonly locale: "zh";
13
+ readonly message: string;
14
+ }, ...{
15
+ readonly locale: "en" | "ja" | "ko";
16
+ readonly message: string;
17
+ }[]];
18
+ readonly hidden?: string | undefined;
19
+ readonly tooltip?: readonly [{
20
+ readonly locale: "zh";
21
+ readonly message: string;
22
+ }, ...{
23
+ readonly locale: "en" | "ja" | "ko";
24
+ readonly message: string;
25
+ }[]] | undefined;
26
+ readonly compatibilityDate: "2026-06-14";
27
+ readonly groupId?: string | 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 grow?: boolean | undefined;
37
+ readonly enableSorting?: boolean | undefined;
38
+ readonly options: {
39
+ readonly kind: "remote";
40
+ readonly request: string;
41
+ readonly options: string;
42
+ readonly optionValue: string;
43
+ readonly optionLabel: string;
44
+ readonly optionKeywords?: string | undefined;
45
+ } | {
46
+ readonly kind: "static";
47
+ readonly items: readonly {
48
+ readonly label: readonly [{
49
+ readonly locale: "zh";
50
+ readonly message: string;
51
+ }, ...{
52
+ readonly locale: "en" | "ja" | "ko";
53
+ readonly message: string;
54
+ }[]];
55
+ readonly id: string;
56
+ readonly tooltip?: readonly [{
57
+ readonly locale: "zh";
58
+ readonly message: string;
59
+ }, ...{
60
+ readonly locale: "en" | "ja" | "ko";
61
+ readonly message: string;
62
+ }[]] | undefined;
63
+ readonly value: {
64
+ readonly value: string;
65
+ readonly kind: "text";
66
+ } | {
67
+ readonly value: number;
68
+ readonly kind: "number";
69
+ };
70
+ readonly keywords?: readonly string[] | undefined;
71
+ }[];
72
+ };
73
+ readonly sortKey?: string | undefined;
74
+ readonly write: {
75
+ readonly kind: "binding";
76
+ readonly binding: string;
77
+ } | {
78
+ readonly onChange?: string | undefined;
79
+ readonly kind: "remote";
80
+ readonly triggers?: readonly {
81
+ readonly id?: string | undefined;
82
+ readonly params?: unknown;
83
+ readonly compatibilityDate?: string | undefined;
84
+ readonly target: string;
85
+ readonly operation: string;
86
+ }[] | undefined;
87
+ readonly accessor: string;
88
+ readonly successMessage?: string | undefined;
89
+ };
90
+ }) => any;
91
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
92
+ "onUpdate:modelValue"?: ((value: {
93
+ readonly size?: number | undefined;
94
+ readonly disabled?: string | undefined;
95
+ readonly type: "com.shwfed.table.column.combobox-single";
96
+ readonly id: string;
97
+ readonly title: readonly [{
98
+ readonly locale: "zh";
99
+ readonly message: string;
100
+ }, ...{
101
+ readonly locale: "en" | "ja" | "ko";
102
+ readonly message: string;
103
+ }[]];
104
+ readonly hidden?: string | undefined;
105
+ readonly tooltip?: readonly [{
106
+ readonly locale: "zh";
107
+ readonly message: string;
108
+ }, ...{
109
+ readonly locale: "en" | "ja" | "ko";
110
+ readonly message: string;
111
+ }[]] | undefined;
112
+ readonly compatibilityDate: "2026-06-14";
113
+ readonly groupId?: string | undefined;
114
+ readonly placeholder?: readonly [{
115
+ readonly locale: "zh";
116
+ readonly message: string;
117
+ }, ...{
118
+ readonly locale: "en" | "ja" | "ko";
119
+ readonly message: string;
120
+ }[]] | undefined;
121
+ readonly readonly?: string | undefined;
122
+ readonly grow?: boolean | undefined;
123
+ readonly enableSorting?: boolean | undefined;
124
+ readonly options: {
125
+ readonly kind: "remote";
126
+ readonly request: string;
127
+ readonly options: string;
128
+ readonly optionValue: string;
129
+ readonly optionLabel: string;
130
+ readonly optionKeywords?: string | undefined;
131
+ } | {
132
+ readonly kind: "static";
133
+ readonly items: readonly {
134
+ readonly label: readonly [{
135
+ readonly locale: "zh";
136
+ readonly message: string;
137
+ }, ...{
138
+ readonly locale: "en" | "ja" | "ko";
139
+ readonly message: string;
140
+ }[]];
141
+ readonly id: string;
142
+ readonly tooltip?: readonly [{
143
+ readonly locale: "zh";
144
+ readonly message: string;
145
+ }, ...{
146
+ readonly locale: "en" | "ja" | "ko";
147
+ readonly message: string;
148
+ }[]] | undefined;
149
+ readonly value: {
150
+ readonly value: string;
151
+ readonly kind: "text";
152
+ } | {
153
+ readonly value: number;
154
+ readonly kind: "number";
155
+ };
156
+ readonly keywords?: readonly string[] | undefined;
157
+ }[];
158
+ };
159
+ readonly sortKey?: string | undefined;
160
+ readonly write: {
161
+ readonly kind: "binding";
162
+ readonly binding: string;
163
+ } | {
164
+ readonly onChange?: string | undefined;
165
+ readonly kind: "remote";
166
+ readonly triggers?: readonly {
167
+ readonly id?: string | undefined;
168
+ readonly params?: unknown;
169
+ readonly compatibilityDate?: string | undefined;
170
+ readonly target: string;
171
+ readonly operation: string;
172
+ }[] | undefined;
173
+ readonly accessor: string;
174
+ readonly successMessage?: string | undefined;
175
+ };
176
+ }) => any) | undefined;
177
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
178
+ declare const _default: typeof __VLS_export;
179
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import type { CellContext } from '@tanstack/vue-table';
2
+ import type { Value } from './schema.js';
3
+ type __VLS_Props = {
4
+ column: Value;
5
+ ctx: CellContext<unknown, unknown>;
6
+ };
7
+ 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>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;
@@ -0,0 +1,438 @@
1
+ <script setup>
2
+ import { Icon } from "@iconify/vue";
3
+ import { Effect, Option } from "effect";
4
+ import { Fetch } from "fx-fetch";
5
+ import { watchDebounced } from "@vueuse/core";
6
+ import { toast } from "vue-sonner";
7
+ import { computed, nextTick, ref, watch } from "vue";
8
+ import { useI18n } from "vue-i18n";
9
+ import { asRequest, fetchJsonOption } from "../../../../../share/request";
10
+ import { cel as _rawCel } from "../../../../../utils/cel";
11
+ import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
12
+ import { useFormReadonly } from "../../../../form/utils/readonly";
13
+ import { publishSelection } from "../../../../../utils/selections-registry";
14
+ import { getLocalizedText } from "../../../../../share/locale";
15
+ import { dispatchTriggers, useEventChannel } from "../../../../../share/event-bus";
16
+ import {
17
+ Command,
18
+ CommandEmpty,
19
+ CommandGroup,
20
+ CommandInput,
21
+ CommandItem,
22
+ CommandList
23
+ } from "../../../../ui/command";
24
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../../../../ui/input-group";
25
+ import { Markdown } from "../../../../ui/markdown";
26
+ import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../../../../ui/popover";
27
+ import { useFormState } from "../../../../form/utils/state";
28
+ import { interpolateMarkdown } from "../../../utils/runtime";
29
+ import { useSharedFetchLayer } from "../../../utils/shared-fetch";
30
+ defineOptions({ name: "ShwfedTableComboboxSingleRuntime" });
31
+ const props = defineProps({
32
+ column: { type: null, required: true },
33
+ ctx: { type: Object, required: true }
34
+ });
35
+ const { locale, t } = useI18n({
36
+ inheritLocale: true,
37
+ messages: {
38
+ zh: {
39
+ "combobox-single-placeholder": "\u8BF7\u9009\u62E9",
40
+ "combobox-single-search-placeholder": "\u641C\u7D22\u2026",
41
+ "combobox-single-empty": "\u65E0\u5339\u914D\u9879",
42
+ "combobox-single-loading": "\u52A0\u8F7D\u4E2D\u2026"
43
+ },
44
+ en: {
45
+ "combobox-single-placeholder": "Select\u2026",
46
+ "combobox-single-search-placeholder": "Search\u2026",
47
+ "combobox-single-empty": "No matches",
48
+ "combobox-single-loading": "Loading\u2026"
49
+ },
50
+ ja: {
51
+ "combobox-single-placeholder": "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
52
+ "combobox-single-search-placeholder": "\u691C\u7D22\u2026",
53
+ "combobox-single-empty": "\u4E00\u81F4\u306A\u3057",
54
+ "combobox-single-loading": "\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026"
55
+ }
56
+ }
57
+ });
58
+ const formState = useFormState();
59
+ const inherited = injectCELContext();
60
+ const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
61
+ const eventChannel = useEventChannel();
62
+ const sharedFetchLayer = useSharedFetchLayer();
63
+ const row = computed(() => props.ctx.row.original);
64
+ const rowIndex = computed(() => props.ctx.row.index);
65
+ const placeholderText = computed(
66
+ () => props.column.placeholder ? getLocalizedText(props.column.placeholder, locale.value) : t("combobox-single-placeholder")
67
+ );
68
+ function evalBool(expression, label) {
69
+ if (!expression) return false;
70
+ try {
71
+ return Effect.runSync($cel(expression, { row: row.value, index: rowIndex.value })) === true;
72
+ } catch (e) {
73
+ console.error(`[shwfed-table] combobox-single ${label} failed`, e);
74
+ return false;
75
+ }
76
+ }
77
+ const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
78
+ const isDisabledByConfig = computed(() => evalBool(props.column.disabled, "disabled"));
79
+ const formReadonly = useFormReadonly();
80
+ const isReadonly = computed(
81
+ () => props.column.readonly != null ? evalBool(props.column.readonly, "readonly") : formReadonly.value
82
+ );
83
+ const isInteractive = computed(
84
+ () => props.column.write.kind === "binding" || !!props.column.write.onChange
85
+ );
86
+ const pending = ref(false);
87
+ function safeInterpolate(tpl, context) {
88
+ try {
89
+ return interpolateMarkdown(tpl, $cel, context);
90
+ } catch (e) {
91
+ console.error("[shwfed-table] combobox-single label interpolation failed", e);
92
+ return tpl;
93
+ }
94
+ }
95
+ const staticEntries = computed(() => {
96
+ if (props.column.options.kind !== "static") return [];
97
+ return props.column.options.items.map((item) => {
98
+ const tooltipTpl = item.tooltip ? getLocalizedText(item.tooltip, locale.value) : void 0;
99
+ return {
100
+ key: item.id,
101
+ value: item.value.value,
102
+ label: getLocalizedText(item.label, locale.value) ?? "",
103
+ tooltip: tooltipTpl ? safeInterpolate(tooltipTpl, {}) : void 0,
104
+ keywords: (item.keywords ?? []).join(" "),
105
+ raw: item
106
+ };
107
+ });
108
+ });
109
+ const remoteJson = ref(null);
110
+ const remoteLoading = ref(false);
111
+ let fetchSeq = 0;
112
+ const requestSignature = computed(() => {
113
+ if (props.column.options.kind !== "remote") return null;
114
+ const expr = props.column.options.request;
115
+ if (!expr) return null;
116
+ try {
117
+ const req = asRequest(Effect.runSync(
118
+ $cel(expr, { row: row.value, index: rowIndex.value })
119
+ ));
120
+ return Option.isSome(req) ? JSON.stringify(req.value.describe()) : null;
121
+ } catch {
122
+ return null;
123
+ }
124
+ });
125
+ async function fetchOptions() {
126
+ const seq = ++fetchSeq;
127
+ if (props.column.options.kind !== "remote" || requestSignature.value == null) {
128
+ remoteJson.value = null;
129
+ remoteLoading.value = false;
130
+ return;
131
+ }
132
+ const expr = props.column.options.request;
133
+ remoteLoading.value = true;
134
+ const program = Effect.gen(function* () {
135
+ const json = yield* fetchJsonOption(yield* $cel(expr, { row: row.value, index: rowIndex.value }));
136
+ return Option.getOrNull(json);
137
+ });
138
+ try {
139
+ const result = await Effect.runPromise(Effect.provide(program, sharedFetchLayer));
140
+ if (seq === fetchSeq) remoteJson.value = result;
141
+ } catch {
142
+ if (seq === fetchSeq) remoteJson.value = null;
143
+ } finally {
144
+ if (seq === fetchSeq) remoteLoading.value = false;
145
+ }
146
+ }
147
+ watchDebounced(
148
+ requestSignature,
149
+ () => {
150
+ void fetchOptions();
151
+ },
152
+ { debounce: 200, immediate: true }
153
+ );
154
+ function valueOf(option) {
155
+ if (props.column.options.kind !== "remote") return void 0;
156
+ try {
157
+ return Effect.runSync($cel(props.column.options.optionValue, {
158
+ row: row.value,
159
+ index: rowIndex.value,
160
+ option
161
+ }));
162
+ } catch (e) {
163
+ console.error("[shwfed-table] combobox-single optionValue failed", e);
164
+ return void 0;
165
+ }
166
+ }
167
+ function labelOf(option) {
168
+ if (props.column.options.kind !== "remote") return "";
169
+ try {
170
+ const raw = Effect.runSync($cel(props.column.options.optionLabel, {
171
+ row: row.value,
172
+ index: rowIndex.value,
173
+ option
174
+ }));
175
+ return raw == null ? "" : String(raw);
176
+ } catch (e) {
177
+ console.error("[shwfed-table] combobox-single optionLabel failed", e);
178
+ return "";
179
+ }
180
+ }
181
+ function keywordsOf(option) {
182
+ if (props.column.options.kind !== "remote") return "";
183
+ const expr = props.column.options.optionKeywords;
184
+ if (!expr) return "";
185
+ try {
186
+ const raw = Effect.runSync($cel(expr, {
187
+ row: row.value,
188
+ index: rowIndex.value,
189
+ option
190
+ }));
191
+ if (!Array.isArray(raw)) return "";
192
+ return raw.map((k) => String(k ?? "")).filter((k) => k.length > 0).join(" ");
193
+ } catch (e) {
194
+ console.error("[shwfed-table] combobox-single optionKeywords failed", e);
195
+ return "";
196
+ }
197
+ }
198
+ const remoteEntries = computed(() => {
199
+ if (props.column.options.kind !== "remote") return [];
200
+ let raw;
201
+ try {
202
+ raw = Effect.runSync($cel(props.column.options.options, {
203
+ row: row.value,
204
+ index: rowIndex.value,
205
+ json: remoteJson.value
206
+ }));
207
+ } catch (e) {
208
+ console.error("[shwfed-table] combobox-single options failed", e);
209
+ return [];
210
+ }
211
+ if (!Array.isArray(raw)) return [];
212
+ return raw.map((option, idx) => ({
213
+ key: String(idx),
214
+ label: labelOf(option),
215
+ value: valueOf(option),
216
+ keywords: keywordsOf(option),
217
+ raw: option
218
+ }));
219
+ });
220
+ const entries = computed(
221
+ () => props.column.options.kind === "static" ? staticEntries.value : remoteEntries.value
222
+ );
223
+ const isLoading = computed(() => props.column.options.kind === "remote" && remoteLoading.value);
224
+ const cellValue = computed(
225
+ () => props.column.write.kind === "binding" ? formState.getAt(props.column.write.binding) : props.ctx.cell.getValue()
226
+ );
227
+ function isEqual(a, b) {
228
+ if (a === b) return true;
229
+ if (a == null || b == null) return false;
230
+ if (typeof a === "object" && typeof b === "object") {
231
+ try {
232
+ return JSON.stringify(a) === JSON.stringify(b);
233
+ } catch {
234
+ return false;
235
+ }
236
+ }
237
+ return false;
238
+ }
239
+ const selectedEntry = computed(
240
+ () => entries.value.find((entry) => isEqual(entry.value, cellValue.value))
241
+ );
242
+ const selectedKey = computed(() => selectedEntry.value?.key);
243
+ const selectedLabel = computed(() => selectedEntry.value?.label ?? "");
244
+ publishSelection(
245
+ props.column.id,
246
+ () => selectedEntry.value,
247
+ { identity: (entry) => entry.key, raw: (entry) => entry.raw }
248
+ );
249
+ const open = ref(false);
250
+ const isDisabled = computed(
251
+ () => !isInteractive.value || isDisabledByConfig.value || pending.value
252
+ );
253
+ async function submit(next) {
254
+ const write = props.column.write;
255
+ if (write.kind === "binding") {
256
+ formState.setAt(write.binding, next);
257
+ return;
258
+ }
259
+ const { onChange, successMessage, triggers } = write;
260
+ if (!onChange) return;
261
+ pending.value = true;
262
+ const program = Effect.gen(function* () {
263
+ const builder = yield* $cel(onChange, {
264
+ row: row.value,
265
+ index: rowIndex.value,
266
+ value: next
267
+ });
268
+ return yield* builder.json();
269
+ });
270
+ try {
271
+ const body = await Effect.runPromise(Effect.provide(program, Fetch.layer));
272
+ if (successMessage) {
273
+ try {
274
+ const message = Effect.runSync($cel(successMessage, { json: body }));
275
+ if (message) toast.success(message);
276
+ } catch (e) {
277
+ console.error("[shwfed-table] combobox-single successMessage failed", e);
278
+ }
279
+ }
280
+ await Effect.runPromise(dispatchTriggers(eventChannel, triggers, $cel));
281
+ } catch (e) {
282
+ console.error("[shwfed-table] combobox-single onChange failed", e);
283
+ toast.error("\u8BF7\u6C42\u5931\u8D25");
284
+ } finally {
285
+ pending.value = false;
286
+ }
287
+ }
288
+ function handleSelect(key) {
289
+ if (typeof key !== "string") return;
290
+ const entry = entries.value.find((e) => e.key === key);
291
+ if (!entry) return;
292
+ void nextTick().then(() => {
293
+ open.value = false;
294
+ });
295
+ void submit(entry.value);
296
+ }
297
+ const showClear = computed(
298
+ () => !isDisabled.value && selectedEntry.value !== void 0
299
+ );
300
+ function handleClear() {
301
+ open.value = false;
302
+ void submit(null);
303
+ }
304
+ const hoveredKey = ref(null);
305
+ watch(open, (isOpen) => {
306
+ hoveredKey.value = isOpen ? entries.value[0]?.key ?? null : null;
307
+ });
308
+ const hoveredEntry = computed(
309
+ () => entries.value.find((e) => e.key === hoveredKey.value)
310
+ );
311
+ const hoveredTooltip = computed(() => hoveredEntry.value?.tooltip);
312
+ const anyHasTooltip = computed(
313
+ () => entries.value.some((e) => e.tooltip != null && e.tooltip.length > 0)
314
+ );
315
+ </script>
316
+
317
+ <template>
318
+ <div class="p-[0.125rem] w-full">
319
+ <span
320
+ v-if="isHidden"
321
+ class="block h-7 w-full"
322
+ />
323
+ <!--
324
+ Readonly empty state mirrors the `text` column exactly: a centered,
325
+ faded, non-selectable `-` in `font-mono`, so a readonly grid reads
326
+ uniformly regardless of column type. A resolved label keeps the
327
+ left-aligned dark text.
328
+ -->
329
+ <span
330
+ v-else-if="isReadonly || !isInteractive"
331
+ :class="[
332
+ 'flex items-center h-7 w-full px-2 text-[0.75rem] truncate',
333
+ selectedLabel ? 'text-zinc-700' : 'justify-center font-mono text-zinc-300 select-none'
334
+ ]"
335
+ >
336
+ {{ selectedLabel || "-" }}
337
+ </span>
338
+ <Popover
339
+ v-else
340
+ v-model:open="open"
341
+ >
342
+ <PopoverAnchor as-child>
343
+ <InputGroup
344
+ class="group/combobox-single h-7 rounded border-zinc-200/30 hover:border-zinc-200 focus-within:border-zinc-200 transition-colors ease-out duration-180"
345
+ :data-disabled="isDisabled ? 'true' : void 0"
346
+ >
347
+ <PopoverTrigger as-child>
348
+ <InputGroupInput
349
+ :model-value="selectedLabel"
350
+ :disabled="isDisabled"
351
+ :placeholder="placeholderText"
352
+ class="h-7 text-[0.75rem] md:text-[0.75rem] px-2 cursor-pointer text-left"
353
+ readonly
354
+ />
355
+ </PopoverTrigger>
356
+ <InputGroupAddon
357
+ v-if="pending || isLoading"
358
+ align="inline-end"
359
+ class="text-zinc-400"
360
+ >
361
+ <Icon
362
+ icon="fluent:spinner-ios-20-regular"
363
+ class="size-3 animate-spin"
364
+ />
365
+ </InputGroupAddon>
366
+ <InputGroupAddon
367
+ v-else-if="showClear"
368
+ align="inline-end"
369
+ class="[@media(hover:hover)]:opacity-0 transition-opacity group-hover/combobox-single:opacity-100 focus-within:opacity-100"
370
+ >
371
+ <InputGroupButton
372
+ size="icon-xs"
373
+ data-slot="combobox-single-clear"
374
+ class="size-4 text-zinc-500 hover:text-zinc-700"
375
+ tabindex="-1"
376
+ @mousedown.prevent
377
+ @click.stop="handleClear"
378
+ >
379
+ <Icon
380
+ icon="fluent:dismiss-20-regular"
381
+ class="size-3"
382
+ />
383
+ </InputGroupButton>
384
+ </InputGroupAddon>
385
+ </InputGroup>
386
+ </PopoverAnchor>
387
+ <PopoverContent
388
+ class="w-auto p-0 [&_[data-slot=command-input-wrapper]]:h-7 [&_[data-slot=command-input-wrapper]]:px-2 [&_[data-slot=command-input-wrapper]_svg]:size-3 [&_[data-slot=command-input]]:h-7 [&_[data-slot=command-input]]:py-0 [&_[data-slot=command-input]]:text-[0.75rem] [&_[data-slot=command-item]]:px-2 [&_[data-slot=command-item]]:py-1 [&_[data-slot=command-item]]:text-[0.75rem]"
389
+ :style="{ width: 'var(--reka-popover-trigger-width)' }"
390
+ >
391
+ <Command
392
+ :model-value="selectedKey"
393
+ :disabled="isDisabled"
394
+ selection-behavior="toggle"
395
+ @update:model-value="handleSelect"
396
+ >
397
+ <CommandInput :placeholder="t('combobox-single-search-placeholder')" />
398
+ <CommandList>
399
+ <div
400
+ v-if="entries.length === 0"
401
+ data-slot="combobox-single-empty"
402
+ class="py-3 text-center text-[0.75rem] text-zinc-500"
403
+ >
404
+ {{ isLoading ? t("combobox-single-loading") : t("combobox-single-empty") }}
405
+ </div>
406
+ <template v-else>
407
+ <CommandEmpty class="py-3 text-center text-[0.75rem] text-zinc-500">
408
+ {{ t("combobox-single-empty") }}
409
+ </CommandEmpty>
410
+ <CommandGroup>
411
+ <CommandItem
412
+ v-for="entry in entries"
413
+ :key="entry.key"
414
+ :value="entry.key"
415
+ :keywords="entry.keywords || void 0"
416
+ @mouseenter="hoveredKey = entry.key"
417
+ @focus="hoveredKey = entry.key"
418
+ >
419
+ <span class="flex-1">{{ entry.label }}</span>
420
+ </CommandItem>
421
+ </CommandGroup>
422
+ </template>
423
+ </CommandList>
424
+ <div
425
+ v-if="anyHasTooltip && hoveredTooltip"
426
+ class="border-t border-zinc-200 px-2 py-1.5"
427
+ >
428
+ <Markdown
429
+ :source="hoveredTooltip"
430
+ block
431
+ class="prose prose-xs prose-zinc"
432
+ />
433
+ </div>
434
+ </Command>
435
+ </PopoverContent>
436
+ </Popover>
437
+ </div>
438
+ </template>
@@ -0,0 +1,9 @@
1
+ import type { CellContext } from '@tanstack/vue-table';
2
+ import type { Value } from './schema.js';
3
+ type __VLS_Props = {
4
+ column: Value;
5
+ ctx: CellContext<unknown, unknown>;
6
+ };
7
+ 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>;
8
+ declare const _default: typeof __VLS_export;
9
+ export default _default;