@shwfed/config 2.3.24 → 2.3.25

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 (59) hide show
  1. package/dist/mcp.mjs +1059 -634
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/{config-DYAEfkYR.js → config-BYTuKQZr.js} +1 -1
  4. package/dist/preview/assets/{config-D5Kfssb7.js → config-BoE06fMj.js} +1 -1
  5. package/dist/preview/assets/{config-CWZxlCMJ.js → config-CV5P2_b2.js} +1 -1
  6. package/dist/preview/assets/{config-CaZpOvHG.js → config-CVAFGzPb.js} +1 -1
  7. package/dist/preview/assets/{config-B3at5Bue.js → config-CdH0Nxqa.js} +1 -1
  8. package/dist/preview/assets/{config-B-6Htwv0.js → config-CjlRnKnY.js} +1 -1
  9. package/dist/preview/assets/{config-CBHKrOP5.js → config-CrvG15To.js} +1 -1
  10. package/dist/preview/assets/{config-Bi9uFh4Y.js → config-DZXC8YJ4.js} +1 -1
  11. package/dist/preview/assets/{config-B2KjxFl5.js → config-QaYy6DCp.js} +1 -1
  12. package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-8BVrrrak.js → definition.vue_vue_type_script_setup_true_lang-CBPR0zl_.js} +1 -1
  13. package/dist/preview/assets/{index-CJMxrUKZ.css → index-BCE-G4Ha.css} +1 -1
  14. package/dist/preview/assets/index-BbnG2cVz.js +643 -0
  15. package/dist/preview/assets/index-NFKAYzMi.js +1 -0
  16. package/dist/preview/assets/{runtime-C1iENPNJ.js → runtime-1AP_-j3e.js} +1 -1
  17. package/dist/preview/assets/{runtime-CEP42oTV.js → runtime-BQiYt6n7.js} +1 -1
  18. package/dist/preview/assets/{runtime-aBsBSCeg.js → runtime-BsiLYYky.js} +1 -1
  19. package/dist/preview/assets/{runtime-CoRrnGx1.js → runtime-C-h7PIyx.js} +1 -1
  20. package/dist/preview/assets/{runtime-CRHn61GX.js → runtime-CGW3z1YJ.js} +1 -1
  21. package/dist/preview/assets/{runtime-Hvzx1ucy.js → runtime-C_R-VCbd.js} +1 -1
  22. package/dist/preview/assets/{runtime-C5CCMnHt.js → runtime-DGdEDDUA.js} +1 -1
  23. package/dist/preview/assets/{runtime-jrsJfwMb.js → runtime-DwXjew7j.js} +1 -1
  24. package/dist/preview/assets/{runtime-CqciI2ST.js → runtime-pM3u8QsQ.js} +1 -1
  25. package/dist/preview/index.html +2 -2
  26. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +4 -4
  27. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +4 -4
  28. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +4 -4
  29. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +4 -4
  30. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/config.d.vue.ts +26 -26
  31. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/config.vue +4 -14
  32. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/config.vue.d.ts +26 -26
  33. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/schema.d.ts +27 -1
  34. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/schema.js +14 -11
  35. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +26 -26
  36. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue +4 -12
  37. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +26 -26
  38. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/schema.d.ts +27 -1
  39. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/schema.js +14 -11
  40. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/config.d.vue.ts +163 -0
  41. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/config.vue +699 -0
  42. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/config.vue.d.ts +163 -0
  43. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/runtime.d.vue.ts +9 -0
  44. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/runtime.vue +349 -0
  45. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/runtime.vue.d.ts +9 -0
  46. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/schema.d.ts +251 -0
  47. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/schema.js +178 -0
  48. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +167 -0
  49. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue +732 -0
  50. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +167 -0
  51. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/runtime.d.vue.ts +9 -0
  52. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/runtime.vue +383 -0
  53. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/runtime.vue.d.ts +9 -0
  54. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/schema.d.ts +253 -0
  55. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/schema.js +230 -0
  56. package/dist/runtime/components/table/config.vue +40 -0
  57. package/package.json +1 -1
  58. package/dist/preview/assets/index-B3wadvvl.js +0 -1
  59. package/dist/preview/assets/index-DTsYYECD.js +0 -643
@@ -0,0 +1,167 @@
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 onChange?: string | undefined;
9
+ readonly disabled?: string | undefined;
10
+ readonly type: "com.shwfed.table.column.combobox-single.remote";
11
+ readonly id: string;
12
+ readonly title: readonly [{
13
+ readonly locale: "zh";
14
+ readonly message: string;
15
+ }, ...{
16
+ readonly locale: "en" | "ja" | "ko";
17
+ readonly message: string;
18
+ }[]];
19
+ readonly hidden?: string | undefined;
20
+ readonly tooltip?: readonly [{
21
+ readonly locale: "zh";
22
+ readonly message: string;
23
+ }, ...{
24
+ readonly locale: "en" | "ja" | "ko";
25
+ readonly message: string;
26
+ }[]] | undefined;
27
+ readonly compatibilityDate: "2026-05-26";
28
+ readonly triggers?: readonly {
29
+ readonly target: string;
30
+ readonly operation: string;
31
+ }[] | undefined;
32
+ readonly groupId?: string | undefined;
33
+ readonly placeholder?: readonly [{
34
+ readonly locale: "zh";
35
+ readonly message: string;
36
+ }, ...{
37
+ readonly locale: "en" | "ja" | "ko";
38
+ readonly message: string;
39
+ }[]] | undefined;
40
+ readonly readonly?: string | undefined;
41
+ readonly grow?: boolean | undefined;
42
+ readonly accessor: string;
43
+ readonly options: {
44
+ readonly kind: "remote";
45
+ readonly request: string;
46
+ readonly options: string;
47
+ readonly optionValue: string;
48
+ readonly optionLabel: readonly [{
49
+ readonly locale: "zh";
50
+ readonly message: string;
51
+ }, ...{
52
+ readonly locale: "en" | "ja" | "ko";
53
+ readonly message: string;
54
+ }[]];
55
+ } | {
56
+ readonly kind: "static";
57
+ readonly items: readonly {
58
+ readonly label: readonly [{
59
+ readonly locale: "zh";
60
+ readonly message: string;
61
+ }, ...{
62
+ readonly locale: "en" | "ja" | "ko";
63
+ readonly message: string;
64
+ }[]];
65
+ readonly id: string;
66
+ readonly tooltip?: readonly [{
67
+ readonly locale: "zh";
68
+ readonly message: string;
69
+ }, ...{
70
+ readonly locale: "en" | "ja" | "ko";
71
+ readonly message: string;
72
+ }[]] | undefined;
73
+ readonly value: {
74
+ readonly value: string;
75
+ readonly kind: "text";
76
+ } | {
77
+ readonly value: number;
78
+ readonly kind: "number";
79
+ };
80
+ }[];
81
+ };
82
+ readonly enableSorting?: boolean | undefined;
83
+ readonly successMessage?: string | undefined;
84
+ }) => any;
85
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
86
+ "onUpdate:modelValue"?: ((value: {
87
+ readonly size?: number | undefined;
88
+ readonly onChange?: string | undefined;
89
+ readonly disabled?: string | undefined;
90
+ readonly type: "com.shwfed.table.column.combobox-single.remote";
91
+ readonly id: string;
92
+ readonly title: readonly [{
93
+ readonly locale: "zh";
94
+ readonly message: string;
95
+ }, ...{
96
+ readonly locale: "en" | "ja" | "ko";
97
+ readonly message: string;
98
+ }[]];
99
+ readonly hidden?: string | undefined;
100
+ readonly tooltip?: readonly [{
101
+ readonly locale: "zh";
102
+ readonly message: string;
103
+ }, ...{
104
+ readonly locale: "en" | "ja" | "ko";
105
+ readonly message: string;
106
+ }[]] | undefined;
107
+ readonly compatibilityDate: "2026-05-26";
108
+ readonly triggers?: readonly {
109
+ readonly target: string;
110
+ readonly operation: string;
111
+ }[] | undefined;
112
+ readonly groupId?: string | undefined;
113
+ readonly placeholder?: readonly [{
114
+ readonly locale: "zh";
115
+ readonly message: string;
116
+ }, ...{
117
+ readonly locale: "en" | "ja" | "ko";
118
+ readonly message: string;
119
+ }[]] | undefined;
120
+ readonly readonly?: string | undefined;
121
+ readonly grow?: boolean | undefined;
122
+ readonly accessor: string;
123
+ readonly options: {
124
+ readonly kind: "remote";
125
+ readonly request: string;
126
+ readonly options: string;
127
+ readonly optionValue: string;
128
+ readonly optionLabel: readonly [{
129
+ readonly locale: "zh";
130
+ readonly message: string;
131
+ }, ...{
132
+ readonly locale: "en" | "ja" | "ko";
133
+ readonly message: string;
134
+ }[]];
135
+ } | {
136
+ readonly kind: "static";
137
+ readonly items: readonly {
138
+ readonly label: readonly [{
139
+ readonly locale: "zh";
140
+ readonly message: string;
141
+ }, ...{
142
+ readonly locale: "en" | "ja" | "ko";
143
+ readonly message: string;
144
+ }[]];
145
+ readonly id: string;
146
+ readonly tooltip?: readonly [{
147
+ readonly locale: "zh";
148
+ readonly message: string;
149
+ }, ...{
150
+ readonly locale: "en" | "ja" | "ko";
151
+ readonly message: string;
152
+ }[]] | undefined;
153
+ readonly value: {
154
+ readonly value: string;
155
+ readonly kind: "text";
156
+ } | {
157
+ readonly value: number;
158
+ readonly kind: "number";
159
+ };
160
+ }[];
161
+ };
162
+ readonly enableSorting?: boolean | undefined;
163
+ readonly successMessage?: string | undefined;
164
+ }) => any) | undefined;
165
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
166
+ declare const _default: typeof __VLS_export;
167
+ 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,383 @@
1
+ <script setup>
2
+ import { Icon } from "@iconify/vue";
3
+ import { Effect } 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 { cel as _rawCel } from "../../../../../utils/cel";
10
+ import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
11
+ import { getLocalizedText } from "../../../../../share/locale";
12
+ import { dispatchTriggers, useEventChannel } from "../../../../../share/event-bus";
13
+ import {
14
+ Command,
15
+ CommandEmpty,
16
+ CommandGroup,
17
+ CommandInput,
18
+ CommandItem,
19
+ CommandList
20
+ } from "../../../../ui/command";
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 { interpolateMarkdown } from "../../../utils/runtime";
25
+ import { useSharedFetchLayer } from "../../../utils/shared-fetch";
26
+ defineOptions({ name: "ShwfedTableComboboxSingleRemoteRuntime" });
27
+ const props = defineProps({
28
+ column: { type: null, required: true },
29
+ ctx: { type: Object, required: true }
30
+ });
31
+ const { locale, t } = useI18n({
32
+ inheritLocale: true,
33
+ messages: {
34
+ zh: {
35
+ "combobox-single-placeholder": "\u8BF7\u9009\u62E9",
36
+ "combobox-single-search-placeholder": "\u641C\u7D22\u2026",
37
+ "combobox-single-empty": "\u65E0\u5339\u914D\u9879",
38
+ "combobox-single-loading": "\u52A0\u8F7D\u4E2D\u2026"
39
+ },
40
+ en: {
41
+ "combobox-single-placeholder": "Select\u2026",
42
+ "combobox-single-search-placeholder": "Search\u2026",
43
+ "combobox-single-empty": "No matches",
44
+ "combobox-single-loading": "Loading\u2026"
45
+ },
46
+ ja: {
47
+ "combobox-single-placeholder": "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
48
+ "combobox-single-search-placeholder": "\u691C\u7D22\u2026",
49
+ "combobox-single-empty": "\u4E00\u81F4\u306A\u3057",
50
+ "combobox-single-loading": "\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026"
51
+ }
52
+ }
53
+ });
54
+ const inherited = injectCELContext();
55
+ const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
56
+ const eventChannel = useEventChannel();
57
+ const sharedFetchLayer = useSharedFetchLayer();
58
+ const row = computed(() => props.ctx.row.original);
59
+ const rowIndex = computed(() => props.ctx.row.index);
60
+ const placeholderText = computed(
61
+ () => props.column.placeholder ? getLocalizedText(props.column.placeholder, locale.value) : t("combobox-single-placeholder")
62
+ );
63
+ function evalBool(expression, label) {
64
+ if (!expression) return false;
65
+ try {
66
+ return Effect.runSync($cel(expression, { row: row.value, index: rowIndex.value })) === true;
67
+ } catch (e) {
68
+ console.error(`[shwfed-table] combobox-single.remote ${label} failed`, e);
69
+ return false;
70
+ }
71
+ }
72
+ const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
73
+ const isDisabledByConfig = computed(() => evalBool(props.column.disabled, "disabled"));
74
+ const isReadonly = computed(() => evalBool(props.column.readonly, "readonly"));
75
+ const isInteractive = computed(() => !!props.column.onChange);
76
+ const pending = ref(false);
77
+ function safeInterpolate(tpl, context) {
78
+ try {
79
+ return interpolateMarkdown(tpl, $cel, context);
80
+ } catch (e) {
81
+ console.error("[shwfed-table] combobox-single.remote label interpolation failed", e);
82
+ return tpl;
83
+ }
84
+ }
85
+ const staticEntries = computed(() => {
86
+ if (props.column.options.kind !== "static") return [];
87
+ return props.column.options.items.map((item) => {
88
+ const labelTpl = getLocalizedText(item.label, locale.value) ?? "";
89
+ const tooltipTpl = item.tooltip ? getLocalizedText(item.tooltip, locale.value) : void 0;
90
+ return {
91
+ key: item.id,
92
+ value: item.value.value,
93
+ label: labelTpl ? safeInterpolate(labelTpl, {}) : "",
94
+ tooltip: tooltipTpl ? safeInterpolate(tooltipTpl, {}) : void 0
95
+ };
96
+ });
97
+ });
98
+ const remoteJson = ref(null);
99
+ const remoteLoading = ref(false);
100
+ let fetchSeq = 0;
101
+ const requestSignature = computed(() => {
102
+ if (props.column.options.kind !== "remote") return null;
103
+ const expr = props.column.options.request;
104
+ if (!expr) return null;
105
+ try {
106
+ const builder = Effect.runSync(
107
+ $cel(expr, { row: row.value, index: rowIndex.value })
108
+ );
109
+ return JSON.stringify(builder.describe());
110
+ } catch {
111
+ return null;
112
+ }
113
+ });
114
+ async function fetchOptions() {
115
+ const seq = ++fetchSeq;
116
+ if (props.column.options.kind !== "remote" || requestSignature.value == null) {
117
+ remoteJson.value = null;
118
+ remoteLoading.value = false;
119
+ return;
120
+ }
121
+ const expr = props.column.options.request;
122
+ remoteLoading.value = true;
123
+ const program = Effect.gen(function* () {
124
+ const builder = yield* $cel(expr, { row: row.value, index: rowIndex.value });
125
+ return yield* builder.json();
126
+ });
127
+ try {
128
+ const result = await Effect.runPromise(Effect.provide(program, sharedFetchLayer));
129
+ if (seq === fetchSeq) remoteJson.value = result;
130
+ } catch {
131
+ if (seq === fetchSeq) remoteJson.value = null;
132
+ } finally {
133
+ if (seq === fetchSeq) remoteLoading.value = false;
134
+ }
135
+ }
136
+ watchDebounced(
137
+ requestSignature,
138
+ () => {
139
+ void fetchOptions();
140
+ },
141
+ { debounce: 200, immediate: true }
142
+ );
143
+ function valueOf(option) {
144
+ if (props.column.options.kind !== "remote") return void 0;
145
+ try {
146
+ return Effect.runSync($cel(props.column.options.optionValue, {
147
+ row: row.value,
148
+ index: rowIndex.value,
149
+ option
150
+ }));
151
+ } catch (e) {
152
+ console.error("[shwfed-table] combobox-single.remote optionValue failed", e);
153
+ return void 0;
154
+ }
155
+ }
156
+ function labelOf(option) {
157
+ if (props.column.options.kind !== "remote") return "";
158
+ const tpl = getLocalizedText(props.column.options.optionLabel, locale.value) ?? "";
159
+ if (!tpl) return "";
160
+ try {
161
+ return interpolateMarkdown(tpl, $cel, { row: row.value, index: rowIndex.value, option });
162
+ } catch (e) {
163
+ console.error("[shwfed-table] combobox-single.remote optionLabel failed", e);
164
+ return "";
165
+ }
166
+ }
167
+ const remoteEntries = computed(() => {
168
+ if (props.column.options.kind !== "remote") return [];
169
+ let raw;
170
+ try {
171
+ raw = Effect.runSync($cel(props.column.options.options, {
172
+ row: row.value,
173
+ index: rowIndex.value,
174
+ json: remoteJson.value
175
+ }));
176
+ } catch (e) {
177
+ console.error("[shwfed-table] combobox-single.remote options failed", e);
178
+ return [];
179
+ }
180
+ if (!Array.isArray(raw)) return [];
181
+ return raw.map((option, idx) => ({
182
+ key: String(idx),
183
+ label: labelOf(option),
184
+ value: valueOf(option)
185
+ }));
186
+ });
187
+ const entries = computed(
188
+ () => props.column.options.kind === "static" ? staticEntries.value : remoteEntries.value
189
+ );
190
+ const isLoading = computed(() => props.column.options.kind === "remote" && remoteLoading.value);
191
+ const cellValue = computed(() => props.ctx.cell.getValue());
192
+ function isEqual(a, b) {
193
+ if (a === b) return true;
194
+ if (a == null || b == null) return false;
195
+ if (typeof a === "object" && typeof b === "object") {
196
+ try {
197
+ return JSON.stringify(a) === JSON.stringify(b);
198
+ } catch {
199
+ return false;
200
+ }
201
+ }
202
+ return false;
203
+ }
204
+ const selectedEntry = computed(
205
+ () => entries.value.find((entry) => isEqual(entry.value, cellValue.value))
206
+ );
207
+ const selectedKey = computed(() => selectedEntry.value?.key);
208
+ const selectedLabel = computed(() => selectedEntry.value?.label ?? "");
209
+ const open = ref(false);
210
+ const isDisabled = computed(
211
+ () => !isInteractive.value || isDisabledByConfig.value || pending.value
212
+ );
213
+ async function submit(next) {
214
+ const { onChange, successMessage } = props.column;
215
+ if (!onChange) return;
216
+ pending.value = true;
217
+ const program = Effect.gen(function* () {
218
+ const builder = yield* $cel(onChange, {
219
+ row: row.value,
220
+ index: rowIndex.value,
221
+ value: next
222
+ });
223
+ return yield* builder.json();
224
+ });
225
+ try {
226
+ const body = await Effect.runPromise(Effect.provide(program, Fetch.layer));
227
+ if (successMessage) {
228
+ try {
229
+ const message = Effect.runSync($cel(successMessage, { json: body }));
230
+ if (message) toast.success(message);
231
+ } catch (e) {
232
+ console.error("[shwfed-table] combobox-single.remote successMessage failed", e);
233
+ }
234
+ }
235
+ await Effect.runPromise(dispatchTriggers(eventChannel, props.column.triggers));
236
+ } catch (e) {
237
+ console.error("[shwfed-table] combobox-single.remote onChange failed", e);
238
+ toast.error("\u8BF7\u6C42\u5931\u8D25");
239
+ } finally {
240
+ pending.value = false;
241
+ }
242
+ }
243
+ function handleSelect(key) {
244
+ if (typeof key !== "string") return;
245
+ const entry = entries.value.find((e) => e.key === key);
246
+ if (!entry) return;
247
+ void nextTick().then(() => {
248
+ open.value = false;
249
+ });
250
+ void submit(entry.value);
251
+ }
252
+ const showClear = computed(
253
+ () => !isDisabled.value && selectedEntry.value !== void 0
254
+ );
255
+ function handleClear() {
256
+ open.value = false;
257
+ void submit(null);
258
+ }
259
+ const hoveredKey = ref(null);
260
+ watch(open, (isOpen) => {
261
+ hoveredKey.value = isOpen ? entries.value[0]?.key ?? null : null;
262
+ });
263
+ const hoveredEntry = computed(
264
+ () => entries.value.find((e) => e.key === hoveredKey.value)
265
+ );
266
+ const hoveredTooltip = computed(() => hoveredEntry.value?.tooltip);
267
+ const anyHasTooltip = computed(
268
+ () => entries.value.some((e) => e.tooltip != null && e.tooltip.length > 0)
269
+ );
270
+ </script>
271
+
272
+ <template>
273
+ <div class="p-[0.125rem] w-full">
274
+ <span
275
+ v-if="isHidden"
276
+ class="block h-7 w-full"
277
+ />
278
+ <span
279
+ v-else-if="isReadonly || !isInteractive"
280
+ class="flex items-center h-7 w-full px-2 text-[0.75rem] text-zinc-700 truncate"
281
+ >
282
+ {{ selectedLabel || "\u2014" }}
283
+ </span>
284
+ <Popover
285
+ v-else
286
+ v-model:open="open"
287
+ >
288
+ <PopoverAnchor as-child>
289
+ <InputGroup
290
+ class="group/combobox-single-remote h-7 rounded border-zinc-200/30 hover:border-zinc-200 focus-within:border-zinc-200 transition-colors ease-out duration-180"
291
+ :data-disabled="isDisabled ? 'true' : void 0"
292
+ >
293
+ <PopoverTrigger as-child>
294
+ <InputGroupInput
295
+ :model-value="selectedLabel"
296
+ :disabled="isDisabled"
297
+ :placeholder="placeholderText"
298
+ class="h-7 text-[0.75rem] md:text-[0.75rem] px-2 cursor-pointer text-left"
299
+ readonly
300
+ />
301
+ </PopoverTrigger>
302
+ <InputGroupAddon
303
+ v-if="pending || isLoading"
304
+ align="inline-end"
305
+ class="text-zinc-400"
306
+ >
307
+ <Icon
308
+ icon="fluent:spinner-ios-20-regular"
309
+ class="size-3 animate-spin"
310
+ />
311
+ </InputGroupAddon>
312
+ <InputGroupAddon
313
+ v-else-if="showClear"
314
+ align="inline-end"
315
+ class="[@media(hover:hover)]:opacity-0 transition-opacity group-hover/combobox-single-remote:opacity-100 focus-within:opacity-100"
316
+ >
317
+ <InputGroupButton
318
+ size="icon-xs"
319
+ data-slot="combobox-single-remote-clear"
320
+ class="size-4 text-zinc-500 hover:text-zinc-700"
321
+ tabindex="-1"
322
+ @mousedown.prevent
323
+ @click.stop="handleClear"
324
+ >
325
+ <Icon
326
+ icon="fluent:dismiss-20-regular"
327
+ class="size-3"
328
+ />
329
+ </InputGroupButton>
330
+ </InputGroupAddon>
331
+ </InputGroup>
332
+ </PopoverAnchor>
333
+ <PopoverContent
334
+ 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]"
335
+ :style="{ width: 'var(--reka-popover-trigger-width)' }"
336
+ >
337
+ <Command
338
+ :model-value="selectedKey"
339
+ :disabled="isDisabled"
340
+ selection-behavior="toggle"
341
+ @update:model-value="handleSelect"
342
+ >
343
+ <CommandInput :placeholder="t('combobox-single-search-placeholder')" />
344
+ <CommandList>
345
+ <div
346
+ v-if="entries.length === 0"
347
+ data-slot="combobox-single-remote-empty"
348
+ class="py-3 text-center text-[0.75rem] text-zinc-500"
349
+ >
350
+ {{ isLoading ? t("combobox-single-loading") : t("combobox-single-empty") }}
351
+ </div>
352
+ <template v-else>
353
+ <CommandEmpty class="py-3 text-center text-[0.75rem] text-zinc-500">
354
+ {{ t("combobox-single-empty") }}
355
+ </CommandEmpty>
356
+ <CommandGroup>
357
+ <CommandItem
358
+ v-for="entry in entries"
359
+ :key="entry.key"
360
+ :value="entry.key"
361
+ @mouseenter="hoveredKey = entry.key"
362
+ @focus="hoveredKey = entry.key"
363
+ >
364
+ <span class="flex-1"><Markdown :source="entry.label" /></span>
365
+ </CommandItem>
366
+ </CommandGroup>
367
+ </template>
368
+ </CommandList>
369
+ <div
370
+ v-if="anyHasTooltip && hoveredTooltip"
371
+ class="border-t border-zinc-200 px-2 py-1.5"
372
+ >
373
+ <Markdown
374
+ :source="hoveredTooltip"
375
+ block
376
+ class="prose prose-xs prose-zinc"
377
+ />
378
+ </div>
379
+ </Command>
380
+ </PopoverContent>
381
+ </Popover>
382
+ </div>
383
+ </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;