@shwfed/config 2.2.5 → 2.3.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 (72) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/config.d.vue.ts +61 -0
  3. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/config.vue +187 -0
  4. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/config.vue.d.ts +61 -0
  5. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/runtime.d.vue.ts +8 -0
  6. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/runtime.vue +62 -0
  7. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/runtime.vue.d.ts +8 -0
  8. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.d.ts +40 -0
  9. package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.js +87 -0
  10. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +8 -8
  11. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +8 -8
  12. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +8 -8
  13. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +8 -8
  14. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +9 -15
  15. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.d.vue.ts +2 -2
  16. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.vue +32 -52
  17. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/config.vue.d.ts +2 -2
  18. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/runtime.vue +19 -8
  19. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.d.ts +2 -2
  20. package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.js +4 -3
  21. package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/config.vue +25 -0
  22. package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/runtime.vue +2 -8
  23. package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/schema.d.ts +4 -0
  24. package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch/schema.js +5 -0
  25. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.d.vue.ts +133 -0
  26. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.vue +533 -0
  27. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.vue.d.ts +133 -0
  28. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/runtime.d.vue.ts +9 -0
  29. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/runtime.vue +237 -0
  30. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/runtime.vue.d.ts +9 -0
  31. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/schema.d.ts +124 -0
  32. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/schema.js +96 -0
  33. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/config.d.vue.ts +10 -0
  34. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/config.vue +475 -0
  35. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/config.vue.d.ts +10 -0
  36. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.d.vue.ts +9 -0
  37. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.vue +156 -0
  38. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/runtime.vue.d.ts +9 -0
  39. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.d.ts +56 -0
  40. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.number-input/schema.js +81 -0
  41. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/config.d.vue.ts +10 -0
  42. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/config.vue +310 -0
  43. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/config.vue.d.ts +10 -0
  44. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/runtime.d.vue.ts +9 -0
  45. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/runtime.vue +81 -0
  46. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/runtime.vue.d.ts +9 -0
  47. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/schema.d.ts +57 -0
  48. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch/schema.js +59 -0
  49. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/config.d.vue.ts +10 -0
  50. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/config.vue +292 -0
  51. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/config.vue.d.ts +10 -0
  52. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.d.vue.ts +9 -0
  53. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.vue +140 -0
  54. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/runtime.vue.d.ts +9 -0
  55. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.d.ts +50 -0
  56. package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.text-input/schema.js +53 -0
  57. package/dist/runtime/components/table/config.d.vue.ts +2 -0
  58. package/dist/runtime/components/table/config.vue +136 -109
  59. package/dist/runtime/components/table/config.vue.d.ts +2 -0
  60. package/dist/runtime/components/table/index.d.vue.ts +2 -2
  61. package/dist/runtime/components/table/index.vue +46 -53
  62. package/dist/runtime/components/table/index.vue.d.ts +2 -2
  63. package/dist/runtime/components/table/row-provider.d.vue.ts +23 -0
  64. package/dist/runtime/components/table/row-provider.vue +55 -0
  65. package/dist/runtime/components/table/row-provider.vue.d.ts +23 -0
  66. package/dist/runtime/components/table/schema.d.ts +17 -29
  67. package/dist/runtime/components/table/schema.js +22 -18
  68. package/dist/runtime/components/table/utils/shared.d.ts +28 -0
  69. package/dist/runtime/components/table/utils/shared.js +40 -0
  70. package/dist/runtime/components/ui/field/index.js +6 -1
  71. package/dist/runtime/components/ui/input/Input.vue +1 -1
  72. package/package.json +1 -1
@@ -0,0 +1,237 @@
1
+ <script setup>
2
+ import { Icon } from "@iconify/vue";
3
+ import { Effect } from "effect";
4
+ import { computed, nextTick, ref, watch } from "vue";
5
+ import { useI18n } from "vue-i18n";
6
+ import { cel as _rawCel } from "../../../../../utils/cel";
7
+ import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
8
+ import { getLocalizedText } from "../../../../../share/locale";
9
+ import {
10
+ Command,
11
+ CommandEmpty,
12
+ CommandGroup,
13
+ CommandInput,
14
+ CommandItem,
15
+ CommandList
16
+ } from "../../../../ui/command";
17
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../../../../ui/input-group";
18
+ import { Markdown } from "../../../../ui/markdown";
19
+ import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../../../../ui/popover";
20
+ import { useFormState } from "../../../../form/utils/state";
21
+ import { interpolateMarkdown } from "../../../utils/runtime";
22
+ defineOptions({ name: "ShwfedTableComboboxSingleRendererRuntime" });
23
+ const props = defineProps({
24
+ column: { type: null, required: true },
25
+ ctx: { type: Object, required: true }
26
+ });
27
+ const { locale, t } = useI18n({
28
+ inheritLocale: true,
29
+ messages: {
30
+ zh: {
31
+ "combobox-single-placeholder": "\u8BF7\u9009\u62E9",
32
+ "combobox-single-search-placeholder": "\u641C\u7D22\u2026",
33
+ "combobox-single-empty": "\u65E0\u5339\u914D\u9879"
34
+ },
35
+ en: {
36
+ "combobox-single-placeholder": "Select\u2026",
37
+ "combobox-single-search-placeholder": "Search\u2026",
38
+ "combobox-single-empty": "No matches"
39
+ },
40
+ ja: {
41
+ "combobox-single-placeholder": "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
42
+ "combobox-single-search-placeholder": "\u691C\u7D22\u2026",
43
+ "combobox-single-empty": "\u4E00\u81F4\u306A\u3057"
44
+ }
45
+ }
46
+ });
47
+ const formState = useFormState();
48
+ const inherited = injectCELContext();
49
+ const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
50
+ const placeholderText = computed(
51
+ () => props.column.placeholder ? getLocalizedText(props.column.placeholder, locale.value) : t("combobox-single-placeholder")
52
+ );
53
+ function evalBool(expression, label) {
54
+ if (!expression) return false;
55
+ try {
56
+ return Effect.runSync($cel(expression)) === true;
57
+ } catch (e) {
58
+ console.error(`[shwfed-table] combobox-single ${label} failed`, e);
59
+ return false;
60
+ }
61
+ }
62
+ const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
63
+ const isDisabled = computed(() => evalBool(props.column.disabled, "disabled"));
64
+ const isReadonly = computed(() => evalBool(props.column.readonly, "readonly"));
65
+ const effectiveReadonly = computed(
66
+ () => isReadonly.value || props.column.derived?.mode === "formula"
67
+ );
68
+ function safeInterpolate(tpl) {
69
+ try {
70
+ return interpolateMarkdown(tpl, $cel, {});
71
+ } catch (e) {
72
+ console.error(`[shwfed-table] combobox-single label interpolation failed`, e);
73
+ return tpl;
74
+ }
75
+ }
76
+ const entries = computed(
77
+ () => (props.column.items ?? []).map((item) => {
78
+ const labelTpl = getLocalizedText(item.label, locale.value) ?? "";
79
+ const tooltipTpl = item.tooltip ? getLocalizedText(item.tooltip, locale.value) : void 0;
80
+ return {
81
+ key: item.id,
82
+ value: item.value.value,
83
+ label: labelTpl ? safeInterpolate(labelTpl) : "",
84
+ tooltip: tooltipTpl ? safeInterpolate(tooltipTpl) : void 0
85
+ };
86
+ })
87
+ );
88
+ const cellValue = computed(() => formState.getAt(props.column.binding));
89
+ function isEqual(a, b) {
90
+ if (a === b) return true;
91
+ if (a == null || b == null) return false;
92
+ if (typeof a === "object" && typeof b === "object") {
93
+ try {
94
+ return JSON.stringify(a) === JSON.stringify(b);
95
+ } catch {
96
+ return false;
97
+ }
98
+ }
99
+ return false;
100
+ }
101
+ const selectedEntry = computed(
102
+ () => entries.value.find((entry) => isEqual(entry.value, cellValue.value))
103
+ );
104
+ const selectedKey = computed(() => selectedEntry.value?.key);
105
+ const selectedLabel = computed(() => selectedEntry.value?.label ?? "");
106
+ const open = ref(false);
107
+ function handleSelect(key) {
108
+ if (typeof key !== "string") return;
109
+ const entry = entries.value.find((e) => e.key === key);
110
+ if (!entry) return;
111
+ formState.setAt(props.column.binding, entry.value);
112
+ void nextTick().then(() => {
113
+ open.value = false;
114
+ });
115
+ }
116
+ const showClear = computed(
117
+ () => !isDisabled.value && selectedEntry.value !== void 0
118
+ );
119
+ function handleClear() {
120
+ formState.setAt(props.column.binding, null);
121
+ open.value = false;
122
+ }
123
+ const hoveredKey = ref(null);
124
+ watch(open, (isOpen) => {
125
+ hoveredKey.value = isOpen ? entries.value[0]?.key ?? null : null;
126
+ });
127
+ const hoveredEntry = computed(
128
+ () => entries.value.find((e) => e.key === hoveredKey.value)
129
+ );
130
+ const hoveredTooltip = computed(() => hoveredEntry.value?.tooltip);
131
+ const anyHasTooltip = computed(
132
+ () => entries.value.some((e) => e.tooltip != null && e.tooltip.length > 0)
133
+ );
134
+ </script>
135
+
136
+ <template>
137
+ <!--
138
+ Row budget matches the text-input cell: 2px outer inset around an `h-7`
139
+ (28px) trigger, total 32px. Every branch (hidden / readonly / editable)
140
+ is sized identically so rows do not jump when a CEL condition flips.
141
+ Trigger is a read-only `InputGroupInput` styled to read as editable — a
142
+ faded border idle, snapping to full on hover/focus — and an `h-7` +
143
+ `text-[0.75rem] md:text-[0.75rem]` override (both breakpoints, since
144
+ `Input`'s default `md:text-sm` would beat an unprefixed override at md+).
145
+ -->
146
+ <div class="p-[0.125rem] w-full">
147
+ <span
148
+ v-if="isHidden"
149
+ class="block h-7 w-full"
150
+ />
151
+ <span
152
+ v-else-if="effectiveReadonly"
153
+ class="flex items-center h-7 w-full px-2 text-[0.75rem] text-zinc-700 truncate"
154
+ >
155
+ {{ selectedLabel || "\u2014" }}
156
+ </span>
157
+ <Popover
158
+ v-else
159
+ v-model:open="open"
160
+ >
161
+ <PopoverAnchor as-child>
162
+ <InputGroup
163
+ 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"
164
+ :data-disabled="isDisabled ? 'true' : void 0"
165
+ >
166
+ <PopoverTrigger as-child>
167
+ <InputGroupInput
168
+ :model-value="selectedLabel"
169
+ :disabled="isDisabled"
170
+ :placeholder="placeholderText"
171
+ class="h-7 text-[0.75rem] md:text-[0.75rem] px-2 cursor-pointer text-left"
172
+ readonly
173
+ />
174
+ </PopoverTrigger>
175
+ <InputGroupAddon
176
+ v-if="showClear"
177
+ align="inline-end"
178
+ class="[@media(hover:hover)]:opacity-0 transition-opacity group-hover/combobox-single:opacity-100 focus-within:opacity-100"
179
+ >
180
+ <InputGroupButton
181
+ size="icon-xs"
182
+ data-slot="combobox-single-clear"
183
+ class="size-4 text-zinc-500 hover:text-zinc-700"
184
+ tabindex="-1"
185
+ @mousedown.prevent
186
+ @click.stop="handleClear"
187
+ >
188
+ <Icon
189
+ icon="fluent:dismiss-20-regular"
190
+ class="size-3"
191
+ />
192
+ </InputGroupButton>
193
+ </InputGroupAddon>
194
+ </InputGroup>
195
+ </PopoverAnchor>
196
+ <PopoverContent
197
+ class="p-0"
198
+ :style="{ width: 'var(--reka-popover-trigger-width)' }"
199
+ >
200
+ <Command
201
+ :model-value="selectedKey"
202
+ :disabled="isDisabled"
203
+ selection-behavior="toggle"
204
+ @update:model-value="handleSelect"
205
+ >
206
+ <CommandInput :placeholder="t('combobox-single-search-placeholder')" />
207
+ <CommandList>
208
+ <CommandEmpty class="py-6 text-center text-sm text-zinc-500">
209
+ {{ t("combobox-single-empty") }}
210
+ </CommandEmpty>
211
+ <CommandGroup>
212
+ <CommandItem
213
+ v-for="entry in entries"
214
+ :key="entry.key"
215
+ :value="entry.key"
216
+ @mouseenter="hoveredKey = entry.key"
217
+ @focus="hoveredKey = entry.key"
218
+ >
219
+ {{ entry.label }}
220
+ </CommandItem>
221
+ </CommandGroup>
222
+ </CommandList>
223
+ <div
224
+ v-if="anyHasTooltip && hoveredTooltip"
225
+ class="border-t border-zinc-200 px-3 py-2"
226
+ >
227
+ <Markdown
228
+ :source="hoveredTooltip"
229
+ block
230
+ class="prose prose-sm prose-zinc"
231
+ />
232
+ </div>
233
+ </Command>
234
+ </PopoverContent>
235
+ </Popover>
236
+ </div>
237
+ </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;
@@ -0,0 +1,124 @@
1
+ import { Schema } from 'effect';
2
+ import type { ColumnDef } from '@tanstack/vue-table';
3
+ import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
4
+ import type { ColumnDefDeps } from '../../../utils/resolve.js';
5
+ export declare const type: "com.shwfed.table.column.combobox-single";
6
+ export declare const compatibilityDate: "2026-05-20";
7
+ export declare const metadata: {
8
+ readonly name: "下拉单选";
9
+ readonly icon: "fluent:chevron-down-20-regular";
10
+ };
11
+ export declare function itemSchema(configure: (env: Environment) => void): Schema.Struct<{
12
+ id: Schema.refine<string, typeof Schema.String>;
13
+ label: Schema.refine<readonly [{
14
+ readonly locale: "zh";
15
+ readonly message: string;
16
+ }, ...{
17
+ readonly locale: "en" | "ja" | "ko";
18
+ readonly message: string;
19
+ }[]], Schema.TupleType<readonly [Schema.Struct<{
20
+ locale: Schema.Literal<["zh"]>;
21
+ message: Schema.SchemaClass<string, string, never>;
22
+ }>], [Schema.Struct<{
23
+ locale: Schema.Literal<["ja", "en", "ko"]>;
24
+ message: Schema.SchemaClass<string, string, never>;
25
+ }>]>>;
26
+ value: Schema.Union<[Schema.Struct<{
27
+ kind: Schema.Literal<["text"]>;
28
+ value: typeof Schema.String;
29
+ }>, Schema.Struct<{
30
+ kind: Schema.Literal<["number"]>;
31
+ value: typeof Schema.Number;
32
+ }>]>;
33
+ tooltip: Schema.optional<Schema.refine<readonly [{
34
+ readonly locale: "zh";
35
+ readonly message: string;
36
+ }, ...{
37
+ readonly locale: "en" | "ja" | "ko";
38
+ readonly message: string;
39
+ }[]], Schema.TupleType<readonly [Schema.Struct<{
40
+ locale: Schema.Literal<["zh"]>;
41
+ message: Schema.SchemaClass<string, string, never>;
42
+ }>], [Schema.Struct<{
43
+ locale: Schema.Literal<["ja", "en", "ko"]>;
44
+ message: Schema.SchemaClass<string, string, never>;
45
+ }>]>>>;
46
+ }>;
47
+ export declare function schema(configure: (env: Environment) => void): Schema.Struct<{
48
+ placeholder: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
49
+ locale: Schema.Literal<["zh"]>;
50
+ message: Schema.SchemaClass<string, string, never>;
51
+ }>], [Schema.Struct<{
52
+ locale: Schema.Literal<["ja", "en", "ko"]>;
53
+ message: Schema.SchemaClass<string, string, never>;
54
+ }>]>>;
55
+ hidden: Schema.optional<Schema.Schema<string, string, never>>;
56
+ disabled: Schema.optional<Schema.Schema<string, string, never>>;
57
+ readonly: Schema.optional<Schema.Schema<string, string, never>>;
58
+ derived: Schema.optional<Schema.Struct<{
59
+ mode: Schema.Literal<["formula", "prefill"]>;
60
+ expression: Schema.Schema<string, string, never>;
61
+ }>>;
62
+ items: Schema.optionalWith<Schema.Array$<Schema.Struct<{
63
+ id: Schema.refine<string, typeof Schema.String>;
64
+ label: Schema.refine<readonly [{
65
+ readonly locale: "zh";
66
+ readonly message: string;
67
+ }, ...{
68
+ readonly locale: "en" | "ja" | "ko";
69
+ readonly message: string;
70
+ }[]], Schema.TupleType<readonly [Schema.Struct<{
71
+ locale: Schema.Literal<["zh"]>;
72
+ message: Schema.SchemaClass<string, string, never>;
73
+ }>], [Schema.Struct<{
74
+ locale: Schema.Literal<["ja", "en", "ko"]>;
75
+ message: Schema.SchemaClass<string, string, never>;
76
+ }>]>>;
77
+ value: Schema.Union<[Schema.Struct<{
78
+ kind: Schema.Literal<["text"]>;
79
+ value: typeof Schema.String;
80
+ }>, Schema.Struct<{
81
+ kind: Schema.Literal<["number"]>;
82
+ value: typeof Schema.Number;
83
+ }>]>;
84
+ tooltip: Schema.optional<Schema.refine<readonly [{
85
+ readonly locale: "zh";
86
+ readonly message: string;
87
+ }, ...{
88
+ readonly locale: "en" | "ja" | "ko";
89
+ readonly message: string;
90
+ }[]], Schema.TupleType<readonly [Schema.Struct<{
91
+ locale: Schema.Literal<["zh"]>;
92
+ message: Schema.SchemaClass<string, string, never>;
93
+ }>], [Schema.Struct<{
94
+ locale: Schema.Literal<["ja", "en", "ko"]>;
95
+ message: Schema.SchemaClass<string, string, never>;
96
+ }>]>>>;
97
+ }>>, {
98
+ default: () => readonly [];
99
+ }>;
100
+ title: Schema.TupleType<readonly [Schema.Struct<{
101
+ locale: Schema.Literal<["zh"]>;
102
+ message: Schema.SchemaClass<string, string, never>;
103
+ }>], [Schema.Struct<{
104
+ locale: Schema.Literal<["ja", "en", "ko"]>;
105
+ message: Schema.SchemaClass<string, string, never>;
106
+ }>]>;
107
+ binding: Schema.refine<string, typeof Schema.String>;
108
+ enableSorting: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
109
+ size: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
110
+ grow: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
111
+ tooltip: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
112
+ locale: Schema.Literal<["zh"]>;
113
+ message: Schema.SchemaClass<string, string, never>;
114
+ }>], [Schema.Struct<{
115
+ locale: Schema.Literal<["ja", "en", "ko"]>;
116
+ message: Schema.SchemaClass<string, string, never>;
117
+ }>]>>;
118
+ id: Schema.refine<string, typeof Schema.String>;
119
+ groupId: Schema.optional<typeof Schema.UUID>;
120
+ type: Schema.Literal<["com.shwfed.table.column.combobox-single"]>;
121
+ compatibilityDate: Schema.Literal<["2026-05-20"]>;
122
+ }>;
123
+ export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
124
+ export declare function toColumnDef(value: Value, { getLocaleText }: ColumnDefDeps): Partial<ColumnDef<unknown, unknown>>;
@@ -0,0 +1,96 @@
1
+ import { Schema } from "effect";
2
+ import { getProperty } from "dot-prop";
3
+ import { Locale } from "../../../../../share/locale.js";
4
+ import {
5
+ CelRowAccess,
6
+ derivedRowField,
7
+ editableColumnFields,
8
+ editableHeader,
9
+ LocaleMarkdownWithRow
10
+ } from "../../../utils/shared.js";
11
+ export const type = "com.shwfed.table.column.combobox-single";
12
+ export const compatibilityDate = "2026-05-20";
13
+ export const metadata = {
14
+ name: "\u4E0B\u62C9\u5355\u9009",
15
+ icon: "fluent:chevron-down-20-regular"
16
+ };
17
+ export function itemSchema(configure) {
18
+ const LocaleMd = LocaleMarkdownWithRow(configure);
19
+ const TextValue = Schema.Struct({
20
+ kind: Schema.Literal("text"),
21
+ value: Schema.String
22
+ });
23
+ const NumberValue = Schema.Struct({
24
+ kind: Schema.Literal("number"),
25
+ value: Schema.Number
26
+ });
27
+ const ItemValue = Schema.Union(TextValue, NumberValue).annotations({
28
+ title: "\u503C",
29
+ description: "\u9009\u9879\u7ED1\u5B9A\u7684\u503C\uFF0C\u53EF\u4EE5\u662F\u6587\u672C\u6216\u6570\u5B57"
30
+ });
31
+ return Schema.Struct({
32
+ id: Schema.UUID.annotations({ description: "\u9009\u9879\u552F\u4E00\u6807\u8BC6\uFF0C\u7528\u4E8E\u7A33\u5B9A\u7684 v-for key" }),
33
+ label: LocaleMd.annotations({
34
+ title: "\u6807\u7B7E",
35
+ description: "\u9009\u9879\u5C55\u793A\u7684\u672C\u5730\u5316\u6587\u672C\uFF0C\u652F\u6301 Markdown \u4E0E `{{ row.foo }}` / `{{ form.bar }}` \u63D2\u503C"
36
+ }),
37
+ value: ItemValue,
38
+ tooltip: Schema.optional(LocaleMd.annotations({
39
+ title: "\u63D0\u793A",
40
+ description: "\u9F20\u6807\u60AC\u505C\u5728\u9009\u9879\u4E0A\u65F6\u5C55\u793A\u7684\u672C\u5730\u5316\u63D0\u793A\uFF0C\u652F\u6301 Markdown"
41
+ }))
42
+ }).annotations({
43
+ title: "ComboboxSingleItem"
44
+ });
45
+ }
46
+ export function schema(configure) {
47
+ const CelBool = CelRowAccess(configure, { resultType: "bool" });
48
+ const Item = itemSchema(configure);
49
+ return Schema.Struct({
50
+ type: Schema.Literal(type),
51
+ compatibilityDate: Schema.Literal(compatibilityDate),
52
+ ...editableColumnFields(),
53
+ placeholder: Schema.optional(Locale.annotations({
54
+ title: "\u5360\u4F4D\u7B26",
55
+ description: "\u672A\u9009\u4E2D\u4EFB\u4F55\u9009\u9879\u65F6\u8F93\u5165\u6846\u4E2D\u7684\u5360\u4F4D\u6587\u672C"
56
+ })),
57
+ hidden: Schema.optional(CelBool.annotations({
58
+ title: "\u9690\u85CF\u6761\u4EF6",
59
+ description: "\u8FD4\u56DE `true` \u65F6\u8BE5\u884C\u7684\u4E0B\u62C9\u6846\u4E0D\u6E32\u67D3\uFF08\u5176\u4F59\u884C\u4E0D\u53D7\u5F71\u54CD\uFF09"
60
+ })),
61
+ disabled: Schema.optional(CelBool.annotations({
62
+ title: "\u7981\u7528\u6761\u4EF6",
63
+ description: "\u8FD4\u56DE `true` \u65F6\u4E0B\u62C9\u6846\u4ECD\u7136\u6E32\u67D3\u4F46\u4E0D\u53EF\u9009\u62E9"
64
+ })),
65
+ readonly: Schema.optional(CelBool.annotations({
66
+ title: "\u53EA\u8BFB\u6761\u4EF6",
67
+ description: "\u8FD4\u56DE `true` \u65F6\u4EC5\u4EE5\u7EAF\u6587\u672C\u5C55\u793A\u5F53\u524D\u9009\u9879\u7684\u6807\u7B7E"
68
+ })),
69
+ derived: derivedRowField(configure, "dyn"),
70
+ items: Schema.optionalWith(Schema.Array(Item).annotations({
71
+ title: "\u9009\u9879",
72
+ description: "\u4E0B\u62C9\u6846\u53EF\u9009\u9879\u5217\u8868"
73
+ }), { default: () => [] })
74
+ }).annotations({ title: "ComboboxSingleRenderer", description: "\u4E0B\u62C9\u5355\u9009\u6E32\u67D3\u5668\uFF08\u53EF\u7F16\u8F91\uFF09" });
75
+ }
76
+ export function toColumnDef(value, { getLocaleText }) {
77
+ return {
78
+ header: editableHeader(getLocaleText(value.title)),
79
+ // `binding` is a dot-prop path (validated non-empty); the cell renderer
80
+ // reads through the same path it writes to. Sorting falls back to the
81
+ // raw bound value — reusing the resolved item label would require
82
+ // matching against `items` (and running CEL for label interpolation)
83
+ // inside the sort comparator.
84
+ accessorFn: (row) => {
85
+ if (!row || typeof row !== "object") return void 0;
86
+ return getProperty(row, value.binding);
87
+ },
88
+ enableSorting: value.enableSorting ?? false,
89
+ sortingFn: "alphanumeric",
90
+ size: value.size,
91
+ meta: {
92
+ grow: value.grow ?? false,
93
+ tooltip: getLocaleText(value.tooltip)
94
+ }
95
+ };
96
+ }
@@ -0,0 +1,10 @@
1
+ type __VLS_ModelProps = {
2
+ modelValue: Record<string, any>;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ "update:modelValue": (value: Record<string, any>) => any;
6
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
7
+ "onUpdate:modelValue"?: ((value: Record<string, any>) => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;