@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-multi";
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-multi";
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,499 @@
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, ref } 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: "ShwfedTableComboboxMultiRuntime" });
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-multi-placeholder": "\u8BF7\u9009\u62E9",
40
+ "combobox-multi-search-placeholder": "\u641C\u7D22\u2026",
41
+ "combobox-multi-empty": "\u65E0\u5339\u914D\u9879",
42
+ "combobox-multi-loading": "\u52A0\u8F7D\u4E2D\u2026"
43
+ },
44
+ en: {
45
+ "combobox-multi-placeholder": "Select\u2026",
46
+ "combobox-multi-search-placeholder": "Search\u2026",
47
+ "combobox-multi-empty": "No matches",
48
+ "combobox-multi-loading": "Loading\u2026"
49
+ },
50
+ ja: {
51
+ "combobox-multi-placeholder": "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
52
+ "combobox-multi-search-placeholder": "\u691C\u7D22\u2026",
53
+ "combobox-multi-empty": "\u4E00\u81F4\u306A\u3057",
54
+ "combobox-multi-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-multi-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-multi ${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-multi 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-multi 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-multi 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-multi 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-multi 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
+ const raw = props.column.write.kind === "binding" ? formState.getAt(props.column.write.binding) : props.ctx.cell.getValue();
226
+ return Array.isArray(raw) ? raw : [];
227
+ });
228
+ function isEqual(a, b) {
229
+ if (a === b) return true;
230
+ if (a == null || b == null) return false;
231
+ if (typeof a === "object" && typeof b === "object") {
232
+ try {
233
+ return JSON.stringify(a) === JSON.stringify(b);
234
+ } catch {
235
+ return false;
236
+ }
237
+ }
238
+ return false;
239
+ }
240
+ const committedEntries = computed(() => {
241
+ const list = [];
242
+ for (const v of cellValue.value) {
243
+ const entry = entries.value.find((e) => isEqual(e.value, v));
244
+ if (entry) list.push(entry);
245
+ }
246
+ return list;
247
+ });
248
+ const committedKeys = computed(() => committedEntries.value.map((e) => e.key));
249
+ const draftKeys = ref(null);
250
+ const draftDirty = ref(false);
251
+ const selectedKeys = computed(() => draftKeys.value ?? committedKeys.value);
252
+ const selectedKeySet = computed(() => new Set(selectedKeys.value));
253
+ const selectedEntries = computed(
254
+ () => selectedKeys.value.map((k) => entries.value.find((e) => e.key === k)).filter((e) => !!e)
255
+ );
256
+ publishSelection(
257
+ props.column.id,
258
+ () => selectedEntries.value.length > 0 ? selectedEntries.value : void 0,
259
+ {
260
+ identity: (list) => list.map((e) => e.key).join(" "),
261
+ raw: (list) => list.map((e) => e.raw)
262
+ }
263
+ );
264
+ const triggerLabel = computed(() => {
265
+ const arr = selectedEntries.value;
266
+ if (arr.length === 0) return "";
267
+ if (arr.length === 1) return arr[0].label;
268
+ return `${arr[0].label} +${arr.length - 1}`;
269
+ });
270
+ const readonlyLabel = computed(() => {
271
+ const labels = selectedEntries.value.map((e) => e.label).filter((l) => l.length > 0);
272
+ if (labels.length === 0) return "";
273
+ try {
274
+ return new Intl.ListFormat(locale.value, { type: "conjunction", style: "narrow" }).format(labels);
275
+ } catch {
276
+ return labels.join("\u3001");
277
+ }
278
+ });
279
+ const open = ref(false);
280
+ const isDisabled = computed(
281
+ () => !isInteractive.value || isDisabledByConfig.value || pending.value
282
+ );
283
+ async function submit(next) {
284
+ const write = props.column.write;
285
+ if (write.kind === "binding") {
286
+ formState.setAt(write.binding, next);
287
+ return;
288
+ }
289
+ const { onChange, successMessage, triggers } = write;
290
+ if (!onChange) return;
291
+ pending.value = true;
292
+ const program = Effect.gen(function* () {
293
+ const builder = yield* $cel(onChange, {
294
+ row: row.value,
295
+ index: rowIndex.value,
296
+ value: next
297
+ });
298
+ return yield* builder.json();
299
+ });
300
+ try {
301
+ const body = await Effect.runPromise(Effect.provide(program, Fetch.layer));
302
+ if (successMessage) {
303
+ try {
304
+ const message = Effect.runSync($cel(successMessage, { json: body }));
305
+ if (message) toast.success(message);
306
+ } catch (e) {
307
+ console.error("[shwfed-table] combobox-multi successMessage failed", e);
308
+ }
309
+ }
310
+ await Effect.runPromise(dispatchTriggers(eventChannel, triggers, $cel));
311
+ } catch (e) {
312
+ console.error("[shwfed-table] combobox-multi onChange failed", e);
313
+ toast.error("\u8BF7\u6C42\u5931\u8D25");
314
+ } finally {
315
+ pending.value = false;
316
+ }
317
+ }
318
+ async function commit(keys) {
319
+ draftKeys.value = [...keys];
320
+ const mapped = [];
321
+ for (const key of keys) {
322
+ const entry = entries.value.find((e) => e.key === key);
323
+ if (entry) mapped.push(entry.value);
324
+ }
325
+ try {
326
+ await submit(mapped);
327
+ } finally {
328
+ draftKeys.value = null;
329
+ }
330
+ }
331
+ function handleSelect(next) {
332
+ const keys = Array.isArray(next) ? next.filter((k) => typeof k === "string") : [];
333
+ draftKeys.value = keys;
334
+ draftDirty.value = true;
335
+ }
336
+ const showClear = computed(
337
+ () => !isDisabled.value && selectedEntries.value.length > 0
338
+ );
339
+ const hoveredKey = ref(null);
340
+ function handleOpenChange(next) {
341
+ if (next === open.value) return;
342
+ open.value = next;
343
+ hoveredKey.value = next ? entries.value[0]?.key ?? null : null;
344
+ if (next) {
345
+ draftKeys.value = [...committedKeys.value];
346
+ draftDirty.value = false;
347
+ return;
348
+ }
349
+ const wasDirty = draftDirty.value;
350
+ draftDirty.value = false;
351
+ if (!wasDirty) {
352
+ draftKeys.value = null;
353
+ return;
354
+ }
355
+ void commit(draftKeys.value ?? []);
356
+ }
357
+ function handleClear() {
358
+ draftDirty.value = false;
359
+ open.value = false;
360
+ hoveredKey.value = null;
361
+ void commit([]);
362
+ }
363
+ const hoveredEntry = computed(
364
+ () => entries.value.find((e) => e.key === hoveredKey.value)
365
+ );
366
+ const hoveredTooltip = computed(() => hoveredEntry.value?.tooltip);
367
+ const anyHasTooltip = computed(
368
+ () => entries.value.some((e) => e.tooltip != null && e.tooltip.length > 0)
369
+ );
370
+ </script>
371
+
372
+ <template>
373
+ <div class="p-[0.125rem] w-full">
374
+ <span
375
+ v-if="isHidden"
376
+ class="block h-7 w-full"
377
+ />
378
+ <!--
379
+ Readonly empty state mirrors the `text` column exactly: a centered,
380
+ faded, non-selectable `-` in `font-mono`, so a readonly grid reads
381
+ uniformly regardless of column type. A resolved label keeps the
382
+ left-aligned dark text.
383
+ -->
384
+ <span
385
+ v-else-if="isReadonly || !isInteractive"
386
+ :class="[
387
+ 'flex items-center h-7 w-full px-2 text-[0.75rem] truncate',
388
+ readonlyLabel ? 'text-zinc-700' : 'justify-center font-mono text-zinc-300 select-none'
389
+ ]"
390
+ >
391
+ {{ readonlyLabel || "-" }}
392
+ </span>
393
+ <Popover
394
+ v-else
395
+ :open="open"
396
+ @update:open="handleOpenChange"
397
+ >
398
+ <PopoverAnchor as-child>
399
+ <InputGroup
400
+ class="group/combobox-multi h-7 rounded border-zinc-200/30 hover:border-zinc-200 focus-within:border-zinc-200 transition-colors ease-out duration-180"
401
+ :data-disabled="isDisabled ? 'true' : void 0"
402
+ >
403
+ <PopoverTrigger as-child>
404
+ <InputGroupInput
405
+ :model-value="triggerLabel"
406
+ :disabled="isDisabled"
407
+ :placeholder="placeholderText"
408
+ class="h-7 text-[0.75rem] md:text-[0.75rem] px-2 cursor-pointer text-left"
409
+ readonly
410
+ />
411
+ </PopoverTrigger>
412
+ <InputGroupAddon
413
+ v-if="pending || isLoading"
414
+ align="inline-end"
415
+ class="text-zinc-400"
416
+ >
417
+ <Icon
418
+ icon="fluent:spinner-ios-20-regular"
419
+ class="size-3 animate-spin"
420
+ />
421
+ </InputGroupAddon>
422
+ <InputGroupAddon
423
+ v-else-if="showClear"
424
+ align="inline-end"
425
+ class="[@media(hover:hover)]:opacity-0 transition-opacity group-hover/combobox-multi:opacity-100 focus-within:opacity-100"
426
+ >
427
+ <InputGroupButton
428
+ size="icon-xs"
429
+ data-slot="combobox-multi-clear"
430
+ class="size-4 text-zinc-500 hover:text-zinc-700"
431
+ tabindex="-1"
432
+ @mousedown.prevent
433
+ @click.stop="handleClear"
434
+ >
435
+ <Icon
436
+ icon="fluent:dismiss-20-regular"
437
+ class="size-3"
438
+ />
439
+ </InputGroupButton>
440
+ </InputGroupAddon>
441
+ </InputGroup>
442
+ </PopoverAnchor>
443
+ <PopoverContent
444
+ 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]"
445
+ :style="{ width: 'var(--reka-popover-trigger-width)' }"
446
+ >
447
+ <Command
448
+ :model-value="selectedKeys"
449
+ :multiple="true"
450
+ :disabled="isDisabled"
451
+ @update:model-value="handleSelect"
452
+ >
453
+ <CommandInput :placeholder="t('combobox-multi-search-placeholder')" />
454
+ <CommandList>
455
+ <div
456
+ v-if="entries.length === 0"
457
+ data-slot="combobox-multi-empty"
458
+ class="py-3 text-center text-[0.75rem] text-zinc-500"
459
+ >
460
+ {{ isLoading ? t("combobox-multi-loading") : t("combobox-multi-empty") }}
461
+ </div>
462
+ <template v-else>
463
+ <CommandEmpty class="py-3 text-center text-[0.75rem] text-zinc-500">
464
+ {{ t("combobox-multi-empty") }}
465
+ </CommandEmpty>
466
+ <CommandGroup>
467
+ <CommandItem
468
+ v-for="entry in entries"
469
+ :key="entry.key"
470
+ :value="entry.key"
471
+ :keywords="entry.keywords || void 0"
472
+ @mouseenter="hoveredKey = entry.key"
473
+ @focus="hoveredKey = entry.key"
474
+ >
475
+ <span class="flex-1">{{ entry.label }}</span>
476
+ <Icon
477
+ v-if="selectedKeySet.has(entry.key)"
478
+ icon="fluent:checkmark-20-regular"
479
+ class="size-3 text-zinc-700"
480
+ />
481
+ </CommandItem>
482
+ </CommandGroup>
483
+ </template>
484
+ </CommandList>
485
+ <div
486
+ v-if="anyHasTooltip && hoveredTooltip"
487
+ class="border-t border-zinc-200 px-2 py-1.5"
488
+ >
489
+ <Markdown
490
+ :source="hoveredTooltip"
491
+ block
492
+ class="prose prose-xs prose-zinc"
493
+ />
494
+ </div>
495
+ </Command>
496
+ </PopoverContent>
497
+ </Popover>
498
+ </div>
499
+ </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;