@shwfed/config 2.3.22 → 2.3.23
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.
- package/dist/mcp.mjs +1073 -624
- package/dist/module.json +1 -1
- package/dist/preview/assets/{config-B3mv60t8.js → config-5rB9Rnmf.js} +1 -1
- package/dist/preview/assets/{config-DY7n8WvE.js → config-BLxl7ROb.js} +1 -1
- package/dist/preview/assets/{config-CpvkgqGg.js → config-BWMtPN22.js} +1 -1
- package/dist/preview/assets/{config-DX6QxjI7.js → config-C-EOrL-v.js} +1 -1
- package/dist/preview/assets/{config-Cb9lQXQG.js → config-CJADmi-_.js} +1 -1
- package/dist/preview/assets/{config-D4fS9GYw.js → config-DUNvg-mJ.js} +1 -1
- package/dist/preview/assets/{config-CLjwrQXG.js → config-EtlOM9yx.js} +1 -1
- package/dist/preview/assets/{config-BiFAbTJq.js → config-f66PEpZ5.js} +1 -1
- package/dist/preview/assets/{config-DhwLB2Ee.js → config-pVNUrcvS.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-Hx2iV358.js → definition.vue_vue_type_script_setup_true_lang-DUu-CoTZ.js} +1 -1
- package/dist/preview/assets/index-B4xolIUJ.js +643 -0
- package/dist/preview/assets/{index-CDhwf1Dw.css → index-CJMxrUKZ.css} +1 -1
- package/dist/preview/assets/index-DFYLO8qf.js +1 -0
- package/dist/preview/assets/{runtime-CShAGyQk.js → runtime-B9GkQToM.js} +1 -1
- package/dist/preview/assets/{runtime-DIcMvC6H.js → runtime-C0v-S40R.js} +1 -1
- package/dist/preview/assets/{runtime-usxovPqT.js → runtime-CFPeFbAB.js} +1 -1
- package/dist/preview/assets/{runtime-ECoXJ0-J.js → runtime-CI38ypkY.js} +1 -1
- package/dist/preview/assets/{runtime-HQv4w652.js → runtime-CUBGWRtC.js} +1 -1
- package/dist/preview/assets/{runtime-Dl0d8KFj.js → runtime-DcqfhaaX.js} +1 -1
- package/dist/preview/assets/{runtime-BXZROm-z.js → runtime-DoLJtHV2.js} +1 -1
- package/dist/preview/assets/{runtime-BarNw942.js → runtime-P99-0gRD.js} +1 -1
- package/dist/preview/assets/{runtime-BazV3vOW.js → runtime-qQ5mJdRv.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/config.d.vue.ts +99 -0
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/config.vue +329 -0
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/config.vue.d.ts +99 -0
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/runtime.vue +265 -0
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/schema.d.ts +79 -0
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/schema.js +71 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/config.d.vue.ts +133 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/config.vue +533 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/config.vue.d.ts +133 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/runtime.vue +247 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/schema.d.ts +124 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/schema.js +94 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +109 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue +426 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +109 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/runtime.vue +356 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/schema.d.ts +85 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/schema.js +147 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +137 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue +586 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +137 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/runtime.vue +287 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/schema.d.ts +126 -0
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/schema.js +125 -0
- package/package.json +1 -1
- package/dist/preview/assets/index-B2gp2q3H.js +0 -643
- package/dist/preview/assets/index-Jytc_ICm.js +0 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Icon } from "@iconify/vue";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
import { computed, 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: "ShwfedTableComboboxMultiRendererRuntime" });
|
|
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-multi-placeholder": "\u8BF7\u9009\u62E9",
|
|
32
|
+
"combobox-multi-search-placeholder": "\u641C\u7D22\u2026",
|
|
33
|
+
"combobox-multi-empty": "\u65E0\u5339\u914D\u9879"
|
|
34
|
+
},
|
|
35
|
+
en: {
|
|
36
|
+
"combobox-multi-placeholder": "Select\u2026",
|
|
37
|
+
"combobox-multi-search-placeholder": "Search\u2026",
|
|
38
|
+
"combobox-multi-empty": "No matches"
|
|
39
|
+
},
|
|
40
|
+
ja: {
|
|
41
|
+
"combobox-multi-placeholder": "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
42
|
+
"combobox-multi-search-placeholder": "\u691C\u7D22\u2026",
|
|
43
|
+
"combobox-multi-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-multi-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-multi ${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-multi 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(() => {
|
|
89
|
+
const raw = formState.getAt(props.column.binding);
|
|
90
|
+
return Array.isArray(raw) ? raw : [];
|
|
91
|
+
});
|
|
92
|
+
function isEqual(a, b) {
|
|
93
|
+
if (a === b) return true;
|
|
94
|
+
if (a == null || b == null) return false;
|
|
95
|
+
if (typeof a === "object" && typeof b === "object") {
|
|
96
|
+
try {
|
|
97
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
98
|
+
} catch {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
const selectedEntries = computed(() => {
|
|
105
|
+
const list = [];
|
|
106
|
+
for (const v of cellValue.value) {
|
|
107
|
+
const entry = entries.value.find((e) => isEqual(e.value, v));
|
|
108
|
+
if (entry) list.push(entry);
|
|
109
|
+
}
|
|
110
|
+
return list;
|
|
111
|
+
});
|
|
112
|
+
const selectedKeys = computed(() => selectedEntries.value.map((e) => e.key));
|
|
113
|
+
const selectedKeySet = computed(() => new Set(selectedKeys.value));
|
|
114
|
+
const triggerLabel = computed(() => {
|
|
115
|
+
const arr = selectedEntries.value;
|
|
116
|
+
if (arr.length === 0) return "";
|
|
117
|
+
if (arr.length === 1) return arr[0].label;
|
|
118
|
+
return `${arr[0].label} +${arr.length - 1}`;
|
|
119
|
+
});
|
|
120
|
+
const open = ref(false);
|
|
121
|
+
function handleSelect(next) {
|
|
122
|
+
const keys = Array.isArray(next) ? next.filter((k) => typeof k === "string") : [];
|
|
123
|
+
const mapped = [];
|
|
124
|
+
for (const key of keys) {
|
|
125
|
+
const entry = entries.value.find((e) => e.key === key);
|
|
126
|
+
if (entry) mapped.push(entry.value);
|
|
127
|
+
}
|
|
128
|
+
formState.setAt(props.column.binding, mapped);
|
|
129
|
+
}
|
|
130
|
+
const showClear = computed(
|
|
131
|
+
() => !isDisabled.value && selectedEntries.value.length > 0
|
|
132
|
+
);
|
|
133
|
+
function handleClear() {
|
|
134
|
+
formState.setAt(props.column.binding, []);
|
|
135
|
+
open.value = false;
|
|
136
|
+
}
|
|
137
|
+
const hoveredKey = ref(null);
|
|
138
|
+
watch(open, (isOpen) => {
|
|
139
|
+
hoveredKey.value = isOpen ? entries.value[0]?.key ?? null : null;
|
|
140
|
+
});
|
|
141
|
+
const hoveredEntry = computed(
|
|
142
|
+
() => entries.value.find((e) => e.key === hoveredKey.value)
|
|
143
|
+
);
|
|
144
|
+
const hoveredTooltip = computed(() => hoveredEntry.value?.tooltip);
|
|
145
|
+
const anyHasTooltip = computed(
|
|
146
|
+
() => entries.value.some((e) => e.tooltip != null && e.tooltip.length > 0)
|
|
147
|
+
);
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<template>
|
|
151
|
+
<div class="p-[0.125rem] w-full">
|
|
152
|
+
<span
|
|
153
|
+
v-if="isHidden"
|
|
154
|
+
class="block h-7 w-full"
|
|
155
|
+
/>
|
|
156
|
+
<span
|
|
157
|
+
v-else-if="effectiveReadonly"
|
|
158
|
+
class="flex items-center h-7 w-full px-2 text-[0.75rem] text-zinc-700 truncate"
|
|
159
|
+
>
|
|
160
|
+
{{ triggerLabel || "\u2014" }}
|
|
161
|
+
</span>
|
|
162
|
+
<Popover
|
|
163
|
+
v-else
|
|
164
|
+
v-model:open="open"
|
|
165
|
+
>
|
|
166
|
+
<PopoverAnchor as-child>
|
|
167
|
+
<InputGroup
|
|
168
|
+
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"
|
|
169
|
+
:data-disabled="isDisabled ? 'true' : void 0"
|
|
170
|
+
>
|
|
171
|
+
<PopoverTrigger as-child>
|
|
172
|
+
<InputGroupInput
|
|
173
|
+
:model-value="triggerLabel"
|
|
174
|
+
:disabled="isDisabled"
|
|
175
|
+
:placeholder="placeholderText"
|
|
176
|
+
class="h-7 text-[0.75rem] md:text-[0.75rem] px-2 cursor-pointer text-left"
|
|
177
|
+
readonly
|
|
178
|
+
/>
|
|
179
|
+
</PopoverTrigger>
|
|
180
|
+
<InputGroupAddon
|
|
181
|
+
v-if="showClear"
|
|
182
|
+
align="inline-end"
|
|
183
|
+
class="[@media(hover:hover)]:opacity-0 transition-opacity group-hover/combobox-multi:opacity-100 focus-within:opacity-100"
|
|
184
|
+
>
|
|
185
|
+
<InputGroupButton
|
|
186
|
+
size="icon-xs"
|
|
187
|
+
data-slot="combobox-multi-clear"
|
|
188
|
+
class="size-4 text-zinc-500 hover:text-zinc-700"
|
|
189
|
+
tabindex="-1"
|
|
190
|
+
@mousedown.prevent
|
|
191
|
+
@click.stop="handleClear"
|
|
192
|
+
>
|
|
193
|
+
<Icon
|
|
194
|
+
icon="fluent:dismiss-20-regular"
|
|
195
|
+
class="size-3"
|
|
196
|
+
/>
|
|
197
|
+
</InputGroupButton>
|
|
198
|
+
</InputGroupAddon>
|
|
199
|
+
</InputGroup>
|
|
200
|
+
</PopoverAnchor>
|
|
201
|
+
<PopoverContent
|
|
202
|
+
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]"
|
|
203
|
+
:style="{ width: 'var(--reka-popover-trigger-width)' }"
|
|
204
|
+
>
|
|
205
|
+
<Command
|
|
206
|
+
:model-value="selectedKeys"
|
|
207
|
+
:multiple="true"
|
|
208
|
+
:disabled="isDisabled"
|
|
209
|
+
@update:model-value="handleSelect"
|
|
210
|
+
>
|
|
211
|
+
<CommandInput :placeholder="t('combobox-multi-search-placeholder')" />
|
|
212
|
+
<CommandList>
|
|
213
|
+
<CommandEmpty class="py-3 text-center text-[0.75rem] text-zinc-500">
|
|
214
|
+
{{ t("combobox-multi-empty") }}
|
|
215
|
+
</CommandEmpty>
|
|
216
|
+
<CommandGroup>
|
|
217
|
+
<CommandItem
|
|
218
|
+
v-for="entry in entries"
|
|
219
|
+
:key="entry.key"
|
|
220
|
+
:value="entry.key"
|
|
221
|
+
@mouseenter="hoveredKey = entry.key"
|
|
222
|
+
@focus="hoveredKey = entry.key"
|
|
223
|
+
>
|
|
224
|
+
<span class="flex-1">{{ entry.label }}</span>
|
|
225
|
+
<Icon
|
|
226
|
+
v-if="selectedKeySet.has(entry.key)"
|
|
227
|
+
icon="fluent:checkmark-20-regular"
|
|
228
|
+
class="size-3 text-zinc-700"
|
|
229
|
+
/>
|
|
230
|
+
</CommandItem>
|
|
231
|
+
</CommandGroup>
|
|
232
|
+
</CommandList>
|
|
233
|
+
<div
|
|
234
|
+
v-if="anyHasTooltip && hoveredTooltip"
|
|
235
|
+
class="border-t border-zinc-200 px-2 py-1.5"
|
|
236
|
+
>
|
|
237
|
+
<Markdown
|
|
238
|
+
:source="hoveredTooltip"
|
|
239
|
+
block
|
|
240
|
+
class="prose prose-xs prose-zinc"
|
|
241
|
+
/>
|
|
242
|
+
</div>
|
|
243
|
+
</Command>
|
|
244
|
+
</PopoverContent>
|
|
245
|
+
</Popover>
|
|
246
|
+
</div>
|
|
247
|
+
</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-multi";
|
|
6
|
+
export declare const compatibilityDate: "2026-05-25";
|
|
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-multi"]>;
|
|
121
|
+
compatibilityDate: Schema.Literal<["2026-05-25"]>;
|
|
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,94 @@
|
|
|
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-multi";
|
|
12
|
+
export const compatibilityDate = "2026-05-25";
|
|
13
|
+
export const metadata = {
|
|
14
|
+
name: "\u4E0B\u62C9\u591A\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: "ComboboxMultiItem"
|
|
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\u5DF2\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: "ComboboxMultiRenderer", description: "\u4E0B\u62C9\u591A\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; the cell renderer reads through the same
|
|
80
|
+
// path it writes to. The bound value is an array of selected item
|
|
81
|
+
// `value`s; sorting falls back to that raw array (basic comparator).
|
|
82
|
+
accessorFn: (row) => {
|
|
83
|
+
if (!row || typeof row !== "object") return void 0;
|
|
84
|
+
return getProperty(row, value.binding);
|
|
85
|
+
},
|
|
86
|
+
enableSorting: value.enableSorting ?? false,
|
|
87
|
+
sortingFn: "basic",
|
|
88
|
+
size: value.size,
|
|
89
|
+
meta: {
|
|
90
|
+
grow: value.grow ?? false,
|
|
91
|
+
tooltip: getLocaleText(value.tooltip)
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
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-multi.remote.options-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-25";
|
|
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 request: string;
|
|
42
|
+
readonly grow?: boolean | undefined;
|
|
43
|
+
readonly accessor: string;
|
|
44
|
+
readonly enableSorting?: boolean | undefined;
|
|
45
|
+
readonly options: string;
|
|
46
|
+
readonly optionValue: string;
|
|
47
|
+
readonly optionLabel: readonly [{
|
|
48
|
+
readonly locale: "zh";
|
|
49
|
+
readonly message: string;
|
|
50
|
+
}, ...{
|
|
51
|
+
readonly locale: "en" | "ja" | "ko";
|
|
52
|
+
readonly message: string;
|
|
53
|
+
}[]];
|
|
54
|
+
readonly successMessage?: string | undefined;
|
|
55
|
+
}) => any;
|
|
56
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
57
|
+
"onUpdate:modelValue"?: ((value: {
|
|
58
|
+
readonly size?: number | undefined;
|
|
59
|
+
readonly onChange?: string | undefined;
|
|
60
|
+
readonly disabled?: string | undefined;
|
|
61
|
+
readonly type: "com.shwfed.table.column.combobox-multi.remote.options-remote";
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly title: readonly [{
|
|
64
|
+
readonly locale: "zh";
|
|
65
|
+
readonly message: string;
|
|
66
|
+
}, ...{
|
|
67
|
+
readonly locale: "en" | "ja" | "ko";
|
|
68
|
+
readonly message: string;
|
|
69
|
+
}[]];
|
|
70
|
+
readonly hidden?: string | undefined;
|
|
71
|
+
readonly tooltip?: readonly [{
|
|
72
|
+
readonly locale: "zh";
|
|
73
|
+
readonly message: string;
|
|
74
|
+
}, ...{
|
|
75
|
+
readonly locale: "en" | "ja" | "ko";
|
|
76
|
+
readonly message: string;
|
|
77
|
+
}[]] | undefined;
|
|
78
|
+
readonly compatibilityDate: "2026-05-25";
|
|
79
|
+
readonly triggers?: readonly {
|
|
80
|
+
readonly target: string;
|
|
81
|
+
readonly operation: string;
|
|
82
|
+
}[] | undefined;
|
|
83
|
+
readonly groupId?: string | undefined;
|
|
84
|
+
readonly placeholder?: readonly [{
|
|
85
|
+
readonly locale: "zh";
|
|
86
|
+
readonly message: string;
|
|
87
|
+
}, ...{
|
|
88
|
+
readonly locale: "en" | "ja" | "ko";
|
|
89
|
+
readonly message: string;
|
|
90
|
+
}[]] | undefined;
|
|
91
|
+
readonly readonly?: string | undefined;
|
|
92
|
+
readonly request: string;
|
|
93
|
+
readonly grow?: boolean | undefined;
|
|
94
|
+
readonly accessor: string;
|
|
95
|
+
readonly enableSorting?: boolean | undefined;
|
|
96
|
+
readonly options: string;
|
|
97
|
+
readonly optionValue: string;
|
|
98
|
+
readonly optionLabel: readonly [{
|
|
99
|
+
readonly locale: "zh";
|
|
100
|
+
readonly message: string;
|
|
101
|
+
}, ...{
|
|
102
|
+
readonly locale: "en" | "ja" | "ko";
|
|
103
|
+
readonly message: string;
|
|
104
|
+
}[]];
|
|
105
|
+
readonly successMessage?: string | undefined;
|
|
106
|
+
}) => any) | undefined;
|
|
107
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
108
|
+
declare const _default: typeof __VLS_export;
|
|
109
|
+
export default _default;
|