@shwfed/config 2.3.21 → 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 +1096 -641
- package/dist/module.json +1 -1
- package/dist/preview/assets/{config-BkTFAoSA.js → config-5rB9Rnmf.js} +1 -1
- package/dist/preview/assets/{config-__RnmfhP.js → config-BLxl7ROb.js} +1 -1
- package/dist/preview/assets/{config-Bo9NgVie.js → config-BWMtPN22.js} +1 -1
- package/dist/preview/assets/{config-BH2Cgm6Z.js → config-C-EOrL-v.js} +1 -1
- package/dist/preview/assets/{config-CIxAb4Oe.js → config-CJADmi-_.js} +1 -1
- package/dist/preview/assets/{config-D-6Tgeq0.js → config-DUNvg-mJ.js} +1 -1
- package/dist/preview/assets/{config--_6I2ueu.js → config-EtlOM9yx.js} +1 -1
- package/dist/preview/assets/{config-BdEFFxuI.js → config-f66PEpZ5.js} +1 -1
- package/dist/preview/assets/{config-MKO1-4J8.js → config-pVNUrcvS.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-DeVEbdbZ.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-CJMxrUKZ.css +1 -0
- package/dist/preview/assets/index-DFYLO8qf.js +1 -0
- package/dist/preview/assets/{runtime-BsM6WFl4.js → runtime-B9GkQToM.js} +1 -1
- package/dist/preview/assets/{runtime-Be9JgLOm.js → runtime-C0v-S40R.js} +1 -1
- package/dist/preview/assets/{runtime-Cqi_SqJY.js → runtime-CFPeFbAB.js} +1 -1
- package/dist/preview/assets/{runtime-Cec8NzXu.js → runtime-CI38ypkY.js} +1 -1
- package/dist/preview/assets/{runtime-w4O6Z5Ly.js → runtime-CUBGWRtC.js} +1 -1
- package/dist/preview/assets/{runtime-BKO8_nF6.js → runtime-DcqfhaaX.js} +1 -1
- package/dist/preview/assets/{runtime-BrUg4LS5.js → runtime-DoLJtHV2.js} +1 -1
- package/dist/preview/assets/{runtime-H9vie18v.js → runtime-P99-0gRD.js} +1 -1
- package/dist/preview/assets/{runtime-C-k7G8_4.js → runtime-qQ5mJdRv.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/actions/schema.js +1 -1
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +52 -52
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +52 -52
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +52 -52
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +52 -52
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +26 -26
- 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-24/com.shwfed.table.column.combobox-single.remote.options-remote/schema.d.ts +1 -1
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/schema.js +3 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/schema.d.ts +1 -1
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/schema.js +3 -2
- 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/dist/runtime/components/table/config.vue +2 -8
- package/dist/runtime/components/table/schema.d.ts +53 -52
- package/dist/runtime/components/table/schema.js +12 -6
- package/package.json +1 -1
- package/dist/preview/assets/index-Bfdy_BZY.js +0 -643
- package/dist/preview/assets/index-CzcHfDck.js +0 -1
- package/dist/preview/assets/index-DomLsyPH.css +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
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-static";
|
|
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 items: readonly {
|
|
29
|
+
readonly label: readonly [{
|
|
30
|
+
readonly locale: "zh";
|
|
31
|
+
readonly message: string;
|
|
32
|
+
}, ...{
|
|
33
|
+
readonly locale: "en" | "ja" | "ko";
|
|
34
|
+
readonly message: string;
|
|
35
|
+
}[]];
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly tooltip?: readonly [{
|
|
38
|
+
readonly locale: "zh";
|
|
39
|
+
readonly message: string;
|
|
40
|
+
}, ...{
|
|
41
|
+
readonly locale: "en" | "ja" | "ko";
|
|
42
|
+
readonly message: string;
|
|
43
|
+
}[]] | undefined;
|
|
44
|
+
readonly value: {
|
|
45
|
+
readonly value: string;
|
|
46
|
+
readonly kind: "text";
|
|
47
|
+
} | {
|
|
48
|
+
readonly value: number;
|
|
49
|
+
readonly kind: "number";
|
|
50
|
+
};
|
|
51
|
+
}[];
|
|
52
|
+
readonly triggers?: readonly {
|
|
53
|
+
readonly target: string;
|
|
54
|
+
readonly operation: string;
|
|
55
|
+
}[] | undefined;
|
|
56
|
+
readonly groupId?: string | undefined;
|
|
57
|
+
readonly placeholder?: readonly [{
|
|
58
|
+
readonly locale: "zh";
|
|
59
|
+
readonly message: string;
|
|
60
|
+
}, ...{
|
|
61
|
+
readonly locale: "en" | "ja" | "ko";
|
|
62
|
+
readonly message: string;
|
|
63
|
+
}[]] | undefined;
|
|
64
|
+
readonly readonly?: string | undefined;
|
|
65
|
+
readonly grow?: boolean | undefined;
|
|
66
|
+
readonly accessor: string;
|
|
67
|
+
readonly enableSorting?: boolean | undefined;
|
|
68
|
+
readonly successMessage?: string | undefined;
|
|
69
|
+
}) => any;
|
|
70
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
71
|
+
"onUpdate:modelValue"?: ((value: {
|
|
72
|
+
readonly size?: number | undefined;
|
|
73
|
+
readonly onChange?: string | undefined;
|
|
74
|
+
readonly disabled?: string | undefined;
|
|
75
|
+
readonly type: "com.shwfed.table.column.combobox-multi.remote.options-static";
|
|
76
|
+
readonly id: string;
|
|
77
|
+
readonly title: readonly [{
|
|
78
|
+
readonly locale: "zh";
|
|
79
|
+
readonly message: string;
|
|
80
|
+
}, ...{
|
|
81
|
+
readonly locale: "en" | "ja" | "ko";
|
|
82
|
+
readonly message: string;
|
|
83
|
+
}[]];
|
|
84
|
+
readonly hidden?: string | undefined;
|
|
85
|
+
readonly tooltip?: readonly [{
|
|
86
|
+
readonly locale: "zh";
|
|
87
|
+
readonly message: string;
|
|
88
|
+
}, ...{
|
|
89
|
+
readonly locale: "en" | "ja" | "ko";
|
|
90
|
+
readonly message: string;
|
|
91
|
+
}[]] | undefined;
|
|
92
|
+
readonly compatibilityDate: "2026-05-25";
|
|
93
|
+
readonly items: readonly {
|
|
94
|
+
readonly label: readonly [{
|
|
95
|
+
readonly locale: "zh";
|
|
96
|
+
readonly message: string;
|
|
97
|
+
}, ...{
|
|
98
|
+
readonly locale: "en" | "ja" | "ko";
|
|
99
|
+
readonly message: string;
|
|
100
|
+
}[]];
|
|
101
|
+
readonly id: string;
|
|
102
|
+
readonly tooltip?: readonly [{
|
|
103
|
+
readonly locale: "zh";
|
|
104
|
+
readonly message: string;
|
|
105
|
+
}, ...{
|
|
106
|
+
readonly locale: "en" | "ja" | "ko";
|
|
107
|
+
readonly message: string;
|
|
108
|
+
}[]] | undefined;
|
|
109
|
+
readonly value: {
|
|
110
|
+
readonly value: string;
|
|
111
|
+
readonly kind: "text";
|
|
112
|
+
} | {
|
|
113
|
+
readonly value: number;
|
|
114
|
+
readonly kind: "number";
|
|
115
|
+
};
|
|
116
|
+
}[];
|
|
117
|
+
readonly triggers?: readonly {
|
|
118
|
+
readonly target: string;
|
|
119
|
+
readonly operation: string;
|
|
120
|
+
}[] | undefined;
|
|
121
|
+
readonly groupId?: string | undefined;
|
|
122
|
+
readonly placeholder?: readonly [{
|
|
123
|
+
readonly locale: "zh";
|
|
124
|
+
readonly message: string;
|
|
125
|
+
}, ...{
|
|
126
|
+
readonly locale: "en" | "ja" | "ko";
|
|
127
|
+
readonly message: string;
|
|
128
|
+
}[]] | undefined;
|
|
129
|
+
readonly readonly?: string | undefined;
|
|
130
|
+
readonly grow?: boolean | undefined;
|
|
131
|
+
readonly accessor: string;
|
|
132
|
+
readonly enableSorting?: boolean | undefined;
|
|
133
|
+
readonly successMessage?: string | undefined;
|
|
134
|
+
}) => any) | undefined;
|
|
135
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
136
|
+
declare const _default: typeof __VLS_export;
|
|
137
|
+
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,287 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Icon } from "@iconify/vue";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
import { Fetch } from "fx-fetch";
|
|
5
|
+
import { toast } from "vue-sonner";
|
|
6
|
+
import { computed, ref, watch } from "vue";
|
|
7
|
+
import { useI18n } from "vue-i18n";
|
|
8
|
+
import { cel as _rawCel } from "../../../../../utils/cel";
|
|
9
|
+
import { celBindings, injectCELContext } from "../../../../../utils/cel-context";
|
|
10
|
+
import { getLocalizedText } from "../../../../../share/locale";
|
|
11
|
+
import { dispatchTriggers, useEventChannel } from "../../../../../share/event-bus";
|
|
12
|
+
import {
|
|
13
|
+
Command,
|
|
14
|
+
CommandEmpty,
|
|
15
|
+
CommandGroup,
|
|
16
|
+
CommandInput,
|
|
17
|
+
CommandItem,
|
|
18
|
+
CommandList
|
|
19
|
+
} from "../../../../ui/command";
|
|
20
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "../../../../ui/input-group";
|
|
21
|
+
import { Markdown } from "../../../../ui/markdown";
|
|
22
|
+
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../../../../ui/popover";
|
|
23
|
+
import { interpolateMarkdown } from "../../../utils/runtime";
|
|
24
|
+
defineOptions({ name: "ShwfedTableComboboxMultiRemoteOptionsStaticRuntime" });
|
|
25
|
+
const props = defineProps({
|
|
26
|
+
column: { type: null, required: true },
|
|
27
|
+
ctx: { type: Object, required: true }
|
|
28
|
+
});
|
|
29
|
+
const { locale, t } = useI18n({
|
|
30
|
+
inheritLocale: true,
|
|
31
|
+
messages: {
|
|
32
|
+
zh: {
|
|
33
|
+
"combobox-multi-placeholder": "\u8BF7\u9009\u62E9",
|
|
34
|
+
"combobox-multi-search-placeholder": "\u641C\u7D22\u2026",
|
|
35
|
+
"combobox-multi-empty": "\u65E0\u5339\u914D\u9879"
|
|
36
|
+
},
|
|
37
|
+
en: {
|
|
38
|
+
"combobox-multi-placeholder": "Select\u2026",
|
|
39
|
+
"combobox-multi-search-placeholder": "Search\u2026",
|
|
40
|
+
"combobox-multi-empty": "No matches"
|
|
41
|
+
},
|
|
42
|
+
ja: {
|
|
43
|
+
"combobox-multi-placeholder": "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
44
|
+
"combobox-multi-search-placeholder": "\u691C\u7D22\u2026",
|
|
45
|
+
"combobox-multi-empty": "\u4E00\u81F4\u306A\u3057"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const inherited = injectCELContext();
|
|
50
|
+
const $cel = (expression, context) => _rawCel(expression, { ...celBindings(inherited), ...context });
|
|
51
|
+
const eventChannel = useEventChannel();
|
|
52
|
+
const placeholderText = computed(
|
|
53
|
+
() => props.column.placeholder ? getLocalizedText(props.column.placeholder, locale.value) : t("combobox-multi-placeholder")
|
|
54
|
+
);
|
|
55
|
+
function evalBool(expression, label) {
|
|
56
|
+
if (!expression) return false;
|
|
57
|
+
try {
|
|
58
|
+
return Effect.runSync($cel(expression)) === true;
|
|
59
|
+
} catch (e) {
|
|
60
|
+
console.error(`[shwfed-table] combobox-multi.remote.options-static ${label} failed`, e);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const isHidden = computed(() => evalBool(props.column.hidden, "hidden"));
|
|
65
|
+
const isDisabledByConfig = computed(() => evalBool(props.column.disabled, "disabled"));
|
|
66
|
+
const isReadonly = computed(() => evalBool(props.column.readonly, "readonly"));
|
|
67
|
+
const isInteractive = computed(() => !!props.column.onChange);
|
|
68
|
+
const pending = ref(false);
|
|
69
|
+
function safeInterpolate(tpl) {
|
|
70
|
+
try {
|
|
71
|
+
return interpolateMarkdown(tpl, $cel, {});
|
|
72
|
+
} catch (e) {
|
|
73
|
+
console.error("[shwfed-table] combobox-multi.remote.options-static label interpolation failed", e);
|
|
74
|
+
return tpl;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const entries = computed(
|
|
78
|
+
() => (props.column.items ?? []).map((item) => {
|
|
79
|
+
const labelTpl = getLocalizedText(item.label, locale.value) ?? "";
|
|
80
|
+
const tooltipTpl = item.tooltip ? getLocalizedText(item.tooltip, locale.value) : void 0;
|
|
81
|
+
return {
|
|
82
|
+
key: item.id,
|
|
83
|
+
value: item.value.value,
|
|
84
|
+
label: labelTpl ? safeInterpolate(labelTpl) : "",
|
|
85
|
+
tooltip: tooltipTpl ? safeInterpolate(tooltipTpl) : void 0
|
|
86
|
+
};
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
const cellValue = computed(() => {
|
|
90
|
+
const raw = props.ctx.cell.getValue();
|
|
91
|
+
return Array.isArray(raw) ? raw : [];
|
|
92
|
+
});
|
|
93
|
+
function isEqual(a, b) {
|
|
94
|
+
if (a === b) return true;
|
|
95
|
+
if (a == null || b == null) return false;
|
|
96
|
+
if (typeof a === "object" && typeof b === "object") {
|
|
97
|
+
try {
|
|
98
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
99
|
+
} catch {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
const selectedEntries = computed(() => {
|
|
106
|
+
const list = [];
|
|
107
|
+
for (const v of cellValue.value) {
|
|
108
|
+
const entry = entries.value.find((e) => isEqual(e.value, v));
|
|
109
|
+
if (entry) list.push(entry);
|
|
110
|
+
}
|
|
111
|
+
return list;
|
|
112
|
+
});
|
|
113
|
+
const selectedKeys = computed(() => selectedEntries.value.map((e) => e.key));
|
|
114
|
+
const selectedKeySet = computed(() => new Set(selectedKeys.value));
|
|
115
|
+
const triggerLabel = computed(() => {
|
|
116
|
+
const arr = selectedEntries.value;
|
|
117
|
+
if (arr.length === 0) return "";
|
|
118
|
+
if (arr.length === 1) return arr[0].label;
|
|
119
|
+
return `${arr[0].label} +${arr.length - 1}`;
|
|
120
|
+
});
|
|
121
|
+
const open = ref(false);
|
|
122
|
+
const isDisabled = computed(
|
|
123
|
+
() => !isInteractive.value || isDisabledByConfig.value || pending.value
|
|
124
|
+
);
|
|
125
|
+
async function submit(next) {
|
|
126
|
+
const { onChange, successMessage } = props.column;
|
|
127
|
+
if (!onChange) return;
|
|
128
|
+
pending.value = true;
|
|
129
|
+
const program = Effect.gen(function* () {
|
|
130
|
+
const builder = yield* $cel(onChange, { value: next });
|
|
131
|
+
return yield* builder.json();
|
|
132
|
+
});
|
|
133
|
+
try {
|
|
134
|
+
const body = await Effect.runPromise(Effect.provide(program, Fetch.layer));
|
|
135
|
+
if (successMessage) {
|
|
136
|
+
try {
|
|
137
|
+
const message = Effect.runSync($cel(successMessage, { json: body }));
|
|
138
|
+
if (message) toast.success(message);
|
|
139
|
+
} catch (e) {
|
|
140
|
+
console.error("[shwfed-table] combobox-multi.remote.options-static successMessage failed", e);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
await Effect.runPromise(dispatchTriggers(eventChannel, props.column.triggers));
|
|
144
|
+
} catch (e) {
|
|
145
|
+
console.error("[shwfed-table] combobox-multi.remote.options-static onChange failed", e);
|
|
146
|
+
toast.error("\u8BF7\u6C42\u5931\u8D25");
|
|
147
|
+
} finally {
|
|
148
|
+
pending.value = false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function handleSelect(next) {
|
|
152
|
+
const keys = Array.isArray(next) ? next.filter((k) => typeof k === "string") : [];
|
|
153
|
+
const mapped = [];
|
|
154
|
+
for (const key of keys) {
|
|
155
|
+
const entry = entries.value.find((e) => e.key === key);
|
|
156
|
+
if (entry) mapped.push(entry.value);
|
|
157
|
+
}
|
|
158
|
+
void submit(mapped);
|
|
159
|
+
}
|
|
160
|
+
const showClear = computed(
|
|
161
|
+
() => !isDisabled.value && selectedEntries.value.length > 0
|
|
162
|
+
);
|
|
163
|
+
function handleClear() {
|
|
164
|
+
open.value = false;
|
|
165
|
+
void submit([]);
|
|
166
|
+
}
|
|
167
|
+
const hoveredKey = ref(null);
|
|
168
|
+
watch(open, (isOpen) => {
|
|
169
|
+
hoveredKey.value = isOpen ? entries.value[0]?.key ?? null : null;
|
|
170
|
+
});
|
|
171
|
+
const hoveredEntry = computed(
|
|
172
|
+
() => entries.value.find((e) => e.key === hoveredKey.value)
|
|
173
|
+
);
|
|
174
|
+
const hoveredTooltip = computed(() => hoveredEntry.value?.tooltip);
|
|
175
|
+
const anyHasTooltip = computed(
|
|
176
|
+
() => entries.value.some((e) => e.tooltip != null && e.tooltip.length > 0)
|
|
177
|
+
);
|
|
178
|
+
</script>
|
|
179
|
+
|
|
180
|
+
<template>
|
|
181
|
+
<div class="p-[0.125rem] w-full">
|
|
182
|
+
<span
|
|
183
|
+
v-if="isHidden"
|
|
184
|
+
class="block h-7 w-full"
|
|
185
|
+
/>
|
|
186
|
+
<span
|
|
187
|
+
v-else-if="isReadonly || !isInteractive"
|
|
188
|
+
class="flex items-center h-7 w-full px-2 text-[0.75rem] text-zinc-700 truncate"
|
|
189
|
+
>
|
|
190
|
+
{{ triggerLabel || "\u2014" }}
|
|
191
|
+
</span>
|
|
192
|
+
<Popover
|
|
193
|
+
v-else
|
|
194
|
+
v-model:open="open"
|
|
195
|
+
>
|
|
196
|
+
<PopoverAnchor as-child>
|
|
197
|
+
<InputGroup
|
|
198
|
+
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"
|
|
199
|
+
:data-disabled="isDisabled ? 'true' : void 0"
|
|
200
|
+
>
|
|
201
|
+
<PopoverTrigger as-child>
|
|
202
|
+
<InputGroupInput
|
|
203
|
+
:model-value="triggerLabel"
|
|
204
|
+
:disabled="isDisabled"
|
|
205
|
+
:placeholder="placeholderText"
|
|
206
|
+
class="h-7 text-[0.75rem] md:text-[0.75rem] px-2 cursor-pointer text-left"
|
|
207
|
+
readonly
|
|
208
|
+
/>
|
|
209
|
+
</PopoverTrigger>
|
|
210
|
+
<InputGroupAddon
|
|
211
|
+
v-if="pending"
|
|
212
|
+
align="inline-end"
|
|
213
|
+
class="text-zinc-400"
|
|
214
|
+
>
|
|
215
|
+
<Icon
|
|
216
|
+
icon="fluent:spinner-ios-20-regular"
|
|
217
|
+
class="size-3 animate-spin"
|
|
218
|
+
/>
|
|
219
|
+
</InputGroupAddon>
|
|
220
|
+
<InputGroupAddon
|
|
221
|
+
v-else-if="showClear"
|
|
222
|
+
align="inline-end"
|
|
223
|
+
class="[@media(hover:hover)]:opacity-0 transition-opacity group-hover/combobox-multi:opacity-100 focus-within:opacity-100"
|
|
224
|
+
>
|
|
225
|
+
<InputGroupButton
|
|
226
|
+
size="icon-xs"
|
|
227
|
+
data-slot="combobox-multi-clear"
|
|
228
|
+
class="size-4 text-zinc-500 hover:text-zinc-700"
|
|
229
|
+
tabindex="-1"
|
|
230
|
+
@mousedown.prevent
|
|
231
|
+
@click.stop="handleClear"
|
|
232
|
+
>
|
|
233
|
+
<Icon
|
|
234
|
+
icon="fluent:dismiss-20-regular"
|
|
235
|
+
class="size-3"
|
|
236
|
+
/>
|
|
237
|
+
</InputGroupButton>
|
|
238
|
+
</InputGroupAddon>
|
|
239
|
+
</InputGroup>
|
|
240
|
+
</PopoverAnchor>
|
|
241
|
+
<PopoverContent
|
|
242
|
+
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]"
|
|
243
|
+
:style="{ width: 'var(--reka-popover-trigger-width)' }"
|
|
244
|
+
>
|
|
245
|
+
<Command
|
|
246
|
+
:model-value="selectedKeys"
|
|
247
|
+
:multiple="true"
|
|
248
|
+
:disabled="isDisabled"
|
|
249
|
+
@update:model-value="handleSelect"
|
|
250
|
+
>
|
|
251
|
+
<CommandInput :placeholder="t('combobox-multi-search-placeholder')" />
|
|
252
|
+
<CommandList>
|
|
253
|
+
<CommandEmpty class="py-3 text-center text-[0.75rem] text-zinc-500">
|
|
254
|
+
{{ t("combobox-multi-empty") }}
|
|
255
|
+
</CommandEmpty>
|
|
256
|
+
<CommandGroup>
|
|
257
|
+
<CommandItem
|
|
258
|
+
v-for="entry in entries"
|
|
259
|
+
:key="entry.key"
|
|
260
|
+
:value="entry.key"
|
|
261
|
+
@mouseenter="hoveredKey = entry.key"
|
|
262
|
+
@focus="hoveredKey = entry.key"
|
|
263
|
+
>
|
|
264
|
+
<span class="flex-1">{{ entry.label }}</span>
|
|
265
|
+
<Icon
|
|
266
|
+
v-if="selectedKeySet.has(entry.key)"
|
|
267
|
+
icon="fluent:checkmark-20-regular"
|
|
268
|
+
class="size-3 text-zinc-700"
|
|
269
|
+
/>
|
|
270
|
+
</CommandItem>
|
|
271
|
+
</CommandGroup>
|
|
272
|
+
</CommandList>
|
|
273
|
+
<div
|
|
274
|
+
v-if="anyHasTooltip && hoveredTooltip"
|
|
275
|
+
class="border-t border-zinc-200 px-2 py-1.5"
|
|
276
|
+
>
|
|
277
|
+
<Markdown
|
|
278
|
+
:source="hoveredTooltip"
|
|
279
|
+
block
|
|
280
|
+
class="prose prose-xs prose-zinc"
|
|
281
|
+
/>
|
|
282
|
+
</div>
|
|
283
|
+
</Command>
|
|
284
|
+
</PopoverContent>
|
|
285
|
+
</Popover>
|
|
286
|
+
</div>
|
|
287
|
+
</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,126 @@
|
|
|
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.remote.options-static";
|
|
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
|
+
items: Schema.optionalWith<Schema.Array$<Schema.Struct<{
|
|
59
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
60
|
+
label: Schema.refine<readonly [{
|
|
61
|
+
readonly locale: "zh";
|
|
62
|
+
readonly message: string;
|
|
63
|
+
}, ...{
|
|
64
|
+
readonly locale: "en" | "ja" | "ko";
|
|
65
|
+
readonly message: string;
|
|
66
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
67
|
+
locale: Schema.Literal<["zh"]>;
|
|
68
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
69
|
+
}>], [Schema.Struct<{
|
|
70
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
71
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
72
|
+
}>]>>;
|
|
73
|
+
value: Schema.Union<[Schema.Struct<{
|
|
74
|
+
kind: Schema.Literal<["text"]>;
|
|
75
|
+
value: typeof Schema.String;
|
|
76
|
+
}>, Schema.Struct<{
|
|
77
|
+
kind: Schema.Literal<["number"]>;
|
|
78
|
+
value: typeof Schema.Number;
|
|
79
|
+
}>]>;
|
|
80
|
+
tooltip: Schema.optional<Schema.refine<readonly [{
|
|
81
|
+
readonly locale: "zh";
|
|
82
|
+
readonly message: string;
|
|
83
|
+
}, ...{
|
|
84
|
+
readonly locale: "en" | "ja" | "ko";
|
|
85
|
+
readonly message: string;
|
|
86
|
+
}[]], Schema.TupleType<readonly [Schema.Struct<{
|
|
87
|
+
locale: Schema.Literal<["zh"]>;
|
|
88
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
89
|
+
}>], [Schema.Struct<{
|
|
90
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
91
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
92
|
+
}>]>>>;
|
|
93
|
+
}>>, {
|
|
94
|
+
default: () => readonly [];
|
|
95
|
+
}>;
|
|
96
|
+
onChange: Schema.optional<Schema.Schema<string, string, never>>;
|
|
97
|
+
successMessage: Schema.optional<Schema.Schema<string, string, never>>;
|
|
98
|
+
triggers: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
99
|
+
target: Schema.refine<string, typeof Schema.String>;
|
|
100
|
+
operation: Schema.SchemaClass<string, string, never>;
|
|
101
|
+
}>>>;
|
|
102
|
+
title: Schema.TupleType<readonly [Schema.Struct<{
|
|
103
|
+
locale: Schema.Literal<["zh"]>;
|
|
104
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
105
|
+
}>], [Schema.Struct<{
|
|
106
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
107
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
108
|
+
}>]>;
|
|
109
|
+
accessor: Schema.Schema<string, string, never>;
|
|
110
|
+
enableSorting: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
111
|
+
size: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
|
|
112
|
+
grow: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
113
|
+
tooltip: Schema.optional<Schema.TupleType<readonly [Schema.Struct<{
|
|
114
|
+
locale: Schema.Literal<["zh"]>;
|
|
115
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
116
|
+
}>], [Schema.Struct<{
|
|
117
|
+
locale: Schema.Literal<["ja", "en", "ko"]>;
|
|
118
|
+
message: Schema.SchemaClass<string, string, never>;
|
|
119
|
+
}>]>>;
|
|
120
|
+
id: Schema.refine<string, typeof Schema.String>;
|
|
121
|
+
groupId: Schema.optional<typeof Schema.UUID>;
|
|
122
|
+
type: Schema.Literal<["com.shwfed.table.column.combobox-multi.remote.options-static"]>;
|
|
123
|
+
compatibilityDate: Schema.Literal<["2026-05-25"]>;
|
|
124
|
+
}>;
|
|
125
|
+
export type Value = Schema.Schema.Type<ReturnType<typeof schema>>;
|
|
126
|
+
export declare function toColumnDef(value: Value, { getLocaleText, $cel, inheritedContext }: ColumnDefDeps): Partial<ColumnDef<unknown, unknown>>;
|