@shwfed/config 2.12.8 → 2.12.10
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/module.json +1 -1
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.d.vue.ts +68 -68
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/config.vue.d.ts +68 -68
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.d.vue.ts +68 -68
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/runtime.vue.d.ts +68 -68
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +34 -34
- package/dist/runtime/components/config/blocks/2026-06-17/com.shwfed.block.tree.single/runtime.vue +20 -2
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue.d.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.vue.d.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.vue.d.ts +18 -18
- package/dist/runtime/components/operations/2026-07-06/com.shwfed.operation.table.add-row/config.d.vue.ts +15 -0
- package/dist/runtime/components/operations/2026-07-06/com.shwfed.operation.table.add-row/config.vue +47 -0
- package/dist/runtime/components/operations/2026-07-06/com.shwfed.operation.table.add-row/config.vue.d.ts +15 -0
- package/dist/runtime/components/operations/2026-07-06/com.shwfed.operation.table.add-row/schema.d.ts +12 -0
- package/dist/runtime/components/operations/2026-07-06/com.shwfed.operation.table.add-row/schema.js +28 -0
- package/dist/runtime/components/operations/utils/resolve.d.ts +7 -1
- package/dist/runtime/components/operations/utils/resolve.js +14 -6
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/config.vue +93 -4
- package/dist/runtime/components/table/index.vue +50 -2
- package/dist/runtime/components/table/schema.d.ts +70 -69
- package/dist/runtime/components/table/schema.js +13 -1
- package/dist/runtime/share/clipboard.d.ts +1 -1
- package/dist/runtime/share/clipboard.js +1 -1
- package/package.json +1 -1
|
@@ -45,10 +45,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
45
45
|
readonly data: string;
|
|
46
46
|
readonly request?: string | undefined;
|
|
47
47
|
};
|
|
48
|
-
readonly enableSorting?: boolean | undefined;
|
|
49
48
|
readonly nodeKey: string;
|
|
50
49
|
readonly nodeChildren: string;
|
|
51
50
|
readonly nodeLabel: string;
|
|
51
|
+
readonly enableSorting?: boolean | undefined;
|
|
52
52
|
readonly cascade: "independent" | "cascade-down" | "cascade-both";
|
|
53
53
|
readonly nodeTooltip?: readonly [{
|
|
54
54
|
readonly locale: "zh";
|
|
@@ -104,10 +104,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
104
104
|
readonly data: string;
|
|
105
105
|
readonly request?: string | undefined;
|
|
106
106
|
};
|
|
107
|
-
readonly enableSorting?: boolean | undefined;
|
|
108
107
|
readonly nodeKey: string;
|
|
109
108
|
readonly nodeChildren: string;
|
|
110
109
|
readonly nodeLabel: string;
|
|
110
|
+
readonly enableSorting?: boolean | undefined;
|
|
111
111
|
readonly cascade: "independent" | "cascade-down" | "cascade-both";
|
|
112
112
|
readonly nodeTooltip?: readonly [{
|
|
113
113
|
readonly locale: "zh";
|
|
@@ -45,10 +45,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
45
45
|
readonly data: string;
|
|
46
46
|
readonly request?: string | undefined;
|
|
47
47
|
};
|
|
48
|
-
readonly enableSorting?: boolean | undefined;
|
|
49
48
|
readonly nodeKey: string;
|
|
50
49
|
readonly nodeChildren: string;
|
|
51
50
|
readonly nodeLabel: string;
|
|
51
|
+
readonly enableSorting?: boolean | undefined;
|
|
52
52
|
readonly nodeTooltip?: readonly [{
|
|
53
53
|
readonly locale: "zh";
|
|
54
54
|
readonly message: string;
|
|
@@ -103,10 +103,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
103
103
|
readonly data: string;
|
|
104
104
|
readonly request?: string | undefined;
|
|
105
105
|
};
|
|
106
|
-
readonly enableSorting?: boolean | undefined;
|
|
107
106
|
readonly nodeKey: string;
|
|
108
107
|
readonly nodeChildren: string;
|
|
109
108
|
readonly nodeLabel: string;
|
|
109
|
+
readonly enableSorting?: boolean | undefined;
|
|
110
110
|
readonly nodeTooltip?: readonly [{
|
|
111
111
|
readonly locale: "zh";
|
|
112
112
|
readonly message: string;
|
|
@@ -45,10 +45,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
45
45
|
readonly data: string;
|
|
46
46
|
readonly request?: string | undefined;
|
|
47
47
|
};
|
|
48
|
-
readonly enableSorting?: boolean | undefined;
|
|
49
48
|
readonly nodeKey: string;
|
|
50
49
|
readonly nodeChildren: string;
|
|
51
50
|
readonly nodeLabel: string;
|
|
51
|
+
readonly enableSorting?: boolean | undefined;
|
|
52
52
|
readonly nodeTooltip?: readonly [{
|
|
53
53
|
readonly locale: "zh";
|
|
54
54
|
readonly message: string;
|
|
@@ -103,10 +103,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
103
103
|
readonly data: string;
|
|
104
104
|
readonly request?: string | undefined;
|
|
105
105
|
};
|
|
106
|
-
readonly enableSorting?: boolean | undefined;
|
|
107
106
|
readonly nodeKey: string;
|
|
108
107
|
readonly nodeChildren: string;
|
|
109
108
|
readonly nodeLabel: string;
|
|
109
|
+
readonly enableSorting?: boolean | undefined;
|
|
110
110
|
readonly nodeTooltip?: readonly [{
|
|
111
111
|
readonly locale: "zh";
|
|
112
112
|
readonly message: string;
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "../../composables/useTreeDnd";
|
|
14
14
|
import { getStructFieldDescription, getStructFieldTitle } from "./utils/schema-meta";
|
|
15
15
|
import { provideEventAncestor } from "../../share/event-bus";
|
|
16
|
+
import { readClip, reidFragment, writeClip } from "../../share/clipboard";
|
|
16
17
|
import { Markdown } from "../ui/markdown";
|
|
17
18
|
import { Badge } from "../ui/badge";
|
|
18
19
|
import { ScrollArea } from "../ui/scroll-area";
|
|
@@ -251,6 +252,9 @@ function writeGeneralPatch(patch) {
|
|
|
251
252
|
const editingGeneralConfig = computed(() => readGeneral());
|
|
252
253
|
const selected = ref(props.hideDataSource ? { kind: "general" } : { kind: "ai" });
|
|
253
254
|
const fieldErrors = ref({});
|
|
255
|
+
const pickedColumnIds = ref([]);
|
|
256
|
+
const pickedColumnIdSet = computed(() => new Set(pickedColumnIds.value));
|
|
257
|
+
const pickAnchor = ref(null);
|
|
254
258
|
watch(
|
|
255
259
|
config,
|
|
256
260
|
(value) => {
|
|
@@ -524,6 +528,10 @@ function deleteColumn(columnId) {
|
|
|
524
528
|
resolveSelection();
|
|
525
529
|
}
|
|
526
530
|
function resolveSelection() {
|
|
531
|
+
const live = new Set(editingColumns.value.map((c) => c.id));
|
|
532
|
+
if (pickedColumnIds.value.some((id) => !live.has(id))) {
|
|
533
|
+
pickedColumnIds.value = pickedColumnIds.value.filter((id) => live.has(id));
|
|
534
|
+
}
|
|
527
535
|
const s = selected.value;
|
|
528
536
|
if (s.kind === "ai") return;
|
|
529
537
|
if (s.kind === "general") return;
|
|
@@ -552,9 +560,88 @@ function selectQuery() {
|
|
|
552
560
|
function selectGroup(id) {
|
|
553
561
|
selected.value = { kind: "group", id };
|
|
554
562
|
}
|
|
555
|
-
|
|
563
|
+
const orderedColumnIds = computed(
|
|
564
|
+
() => renderEntries.value.filter((e) => e.kind === "column").map((e) => e.columnId)
|
|
565
|
+
);
|
|
566
|
+
function columnRange(a, b) {
|
|
567
|
+
const ord = orderedColumnIds.value;
|
|
568
|
+
const ia = ord.indexOf(a);
|
|
569
|
+
const ib = ord.indexOf(b);
|
|
570
|
+
if (ia === -1 || ib === -1) return [b];
|
|
571
|
+
const [lo, hi] = ia <= ib ? [ia, ib] : [ib, ia];
|
|
572
|
+
return ord.slice(lo, hi + 1);
|
|
573
|
+
}
|
|
574
|
+
function selectColumn(id, e) {
|
|
575
|
+
const meta = !!e && (e.metaKey || e.ctrlKey);
|
|
576
|
+
if (meta && e.shiftKey) {
|
|
577
|
+
const range = pickAnchor.value ? columnRange(pickAnchor.value, id) : [id];
|
|
578
|
+
const set = new Set(pickedColumnIds.value);
|
|
579
|
+
for (const cid of range) set.add(cid);
|
|
580
|
+
pickedColumnIds.value = orderedColumnIds.value.filter((cid) => set.has(cid));
|
|
581
|
+
pickAnchor.value = id;
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
if (meta) {
|
|
585
|
+
const set = new Set(pickedColumnIds.value);
|
|
586
|
+
if (set.has(id)) set.delete(id);
|
|
587
|
+
else set.add(id);
|
|
588
|
+
pickedColumnIds.value = orderedColumnIds.value.filter((cid) => set.has(cid));
|
|
589
|
+
pickAnchor.value = id;
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
pickedColumnIds.value = [];
|
|
593
|
+
pickAnchor.value = null;
|
|
556
594
|
selected.value = { kind: "column", id };
|
|
557
595
|
}
|
|
596
|
+
watch(selected, (s) => {
|
|
597
|
+
if (s.kind !== "column") {
|
|
598
|
+
pickedColumnIds.value = [];
|
|
599
|
+
pickAnchor.value = null;
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
async function copyColumns() {
|
|
603
|
+
if (pickedColumnIds.value.length === 0) return;
|
|
604
|
+
const set = pickedColumnIdSet.value;
|
|
605
|
+
const cols = orderedColumnIds.value.filter((id) => set.has(id)).map((id) => editingColumns.value.find((c) => c.id === id)).filter((c) => !!c).map(({ groupId: _g, ...rest }) => rest);
|
|
606
|
+
if (cols.length === 0) return;
|
|
607
|
+
const ok = await writeClip("table", cols);
|
|
608
|
+
if (ok) toast.success(`\u5DF2\u590D\u5236 ${cols.length} \u5217`);
|
|
609
|
+
else toast.error("\u590D\u5236\u5931\u8D25");
|
|
610
|
+
}
|
|
611
|
+
async function pasteColumns() {
|
|
612
|
+
const clip = await readClip();
|
|
613
|
+
if (!clip || clip.surface !== "table") return;
|
|
614
|
+
const { items } = reidFragment(clip.items);
|
|
615
|
+
const pasted = items.map(({ groupId: _g, ...rest }) => rest);
|
|
616
|
+
if (pasted.length === 0) return;
|
|
617
|
+
editingColumns.value = [...editingColumns.value, ...pasted];
|
|
618
|
+
const ids = pasted.map((c) => c.id);
|
|
619
|
+
pickedColumnIds.value = ids;
|
|
620
|
+
pickAnchor.value = ids[ids.length - 1] ?? null;
|
|
621
|
+
if (ids.length > 0) selected.value = { kind: "column", id: ids[ids.length - 1] };
|
|
622
|
+
toast.success(`\u5DF2\u7C98\u8D34 ${pasted.length} \u5217`);
|
|
623
|
+
}
|
|
624
|
+
function isTextInput(el) {
|
|
625
|
+
if (!(el instanceof HTMLElement)) return false;
|
|
626
|
+
const tag = el.tagName;
|
|
627
|
+
return tag === "INPUT" || tag === "TEXTAREA" || el.isContentEditable;
|
|
628
|
+
}
|
|
629
|
+
function onColumnListKeydown(e) {
|
|
630
|
+
if (isTextInput(e.target)) return;
|
|
631
|
+
const mod = e.metaKey || e.ctrlKey;
|
|
632
|
+
if (!mod || e.shiftKey || e.altKey) return;
|
|
633
|
+
const key = e.key.toLowerCase();
|
|
634
|
+
if (key === "c") {
|
|
635
|
+
if (pickedColumnIds.value.length === 0) return;
|
|
636
|
+
const sel = window.getSelection();
|
|
637
|
+
if (sel && !sel.isCollapsed) return;
|
|
638
|
+
e.preventDefault();
|
|
639
|
+
void copyColumns();
|
|
640
|
+
} else if (key === "v") {
|
|
641
|
+
e.preventDefault();
|
|
642
|
+
void pasteColumns();
|
|
643
|
+
}
|
|
644
|
+
}
|
|
558
645
|
const breadcrumbExt = inject(BREADCRUMB_EXTENSION_KEY, null);
|
|
559
646
|
if (breadcrumbExt) {
|
|
560
647
|
const crumb = breadcrumbExt.add();
|
|
@@ -1074,7 +1161,9 @@ const tableQueryValue = computed({
|
|
|
1074
1161
|
<div class="flex min-h-128 gap-6">
|
|
1075
1162
|
<div
|
|
1076
1163
|
v-if="!isDrilled"
|
|
1077
|
-
class="flex w-64 shrink-0 flex-col"
|
|
1164
|
+
class="flex w-64 shrink-0 flex-col outline-none"
|
|
1165
|
+
tabindex="-1"
|
|
1166
|
+
@keydown="onColumnListKeydown"
|
|
1078
1167
|
>
|
|
1079
1168
|
<ScrollArea class="flex-1">
|
|
1080
1169
|
<div class="flex flex-col gap-1">
|
|
@@ -1224,10 +1313,10 @@ const tableQueryValue = computed({
|
|
|
1224
1313
|
class="row group column-row"
|
|
1225
1314
|
:class="[
|
|
1226
1315
|
entry.groupId ? 'pl-6' : 'pl-2',
|
|
1227
|
-
selected.kind === 'column' && selected.id === entry.columnId ? 'bg-[color-mix(in_srgb,var(--primary)_10%,white)] text-(--primary)' : 'text-zinc-600 hover:bg-zinc-50'
|
|
1316
|
+
selected.kind === 'column' && selected.id === entry.columnId ? 'bg-[color-mix(in_srgb,var(--primary)_10%,white)] text-(--primary)' : pickedColumnIdSet.has(entry.columnId) ? 'bg-zinc-100 text-zinc-700' : 'text-zinc-600 hover:bg-zinc-50'
|
|
1228
1317
|
]"
|
|
1229
1318
|
:data-instruction="dnd.instructionFor(entry.columnId) ?? void 0"
|
|
1230
|
-
@click.stop="selectColumn(entry.columnId)"
|
|
1319
|
+
@click.stop="selectColumn(entry.columnId, $event)"
|
|
1231
1320
|
>
|
|
1232
1321
|
<Icon
|
|
1233
1322
|
icon="fluent:re-order-dots-vertical-20-filled"
|
|
@@ -10,14 +10,16 @@ import {
|
|
|
10
10
|
useVueTable
|
|
11
11
|
} from "@tanstack/vue-table";
|
|
12
12
|
import { useVirtualizer } from "@tanstack/vue-virtual";
|
|
13
|
+
import { watchDebounced } from "@vueuse/core";
|
|
13
14
|
import { Effect, Fiber, Option } from "effect";
|
|
14
15
|
import { Fetch } from "fx-fetch";
|
|
15
16
|
import { Pagination, ScrollArea } from "reka-ui/namespaced";
|
|
16
17
|
import { computed, h, onMounted, ref, toRaw, watch } from "vue";
|
|
17
|
-
import { fetchJsonOption } from "../../share/request";
|
|
18
|
+
import { asRequest, fetchJsonOption } from "../../share/request";
|
|
18
19
|
import { useI18n } from "vue-i18n";
|
|
19
|
-
import { celBindings, provideCELContext, injectCELContext } from "../../utils/cel-context";
|
|
20
|
+
import { celBindings, celScope, provideCELContext, injectCELContext } from "../../utils/cel-context";
|
|
20
21
|
import TableRowProvider from "./row-provider.vue";
|
|
22
|
+
import * as addRowOp from "../operations/2026-07-06/com.shwfed.operation.table.add-row/schema";
|
|
21
23
|
import { getLocalizedText } from "../../share/locale";
|
|
22
24
|
import { Button } from "../ui/button";
|
|
23
25
|
import { Markdown } from "../ui/markdown";
|
|
@@ -492,6 +494,32 @@ provideEventTarget(tableInstanceId, {
|
|
|
492
494
|
// `table` form field) sees the live list. Intended for client-side data:
|
|
493
495
|
// with server pagination (`dataSource.total`) `rowData` is only the
|
|
494
496
|
// current page, so a fetch will overwrite these edits.
|
|
497
|
+
// `add-row` is a host-coupled operation: it is declared in the operations
|
|
498
|
+
// registry for its param editor, but ships no generic `runtime.ts` (the
|
|
499
|
+
// append touches THIS instance's private `rowData`), so the handler is
|
|
500
|
+
// hand-wired here. Its optional `newRow` param is a CEL expression evaluated
|
|
501
|
+
// at click time against the *emit-site* scope (the dispatching button's own
|
|
502
|
+
// `cel`, where a row action's `row` is live). An object result seeds the new
|
|
503
|
+
// row; absent / non-object / evaluation error → a bare `{}` (the param-less
|
|
504
|
+
// default). Falls back to the table's own evaluator when no emit-site `cel`.
|
|
505
|
+
[addRowOp.type]: (params, cel) => {
|
|
506
|
+
const expr = params?.newRow;
|
|
507
|
+
if (!expr) {
|
|
508
|
+
return Effect.sync(() => {
|
|
509
|
+
rowData.value = [...rowData.value, {}];
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
return (cel ? cel(expr) : $cel(expr, mergeCelContext({}))).pipe(
|
|
513
|
+
Effect.map((result) => result !== null && typeof result === "object" && !Array.isArray(result) ? { ...result } : {}),
|
|
514
|
+
Effect.catchAll(() => Effect.succeed({})),
|
|
515
|
+
Effect.map((seed) => {
|
|
516
|
+
rowData.value = [...rowData.value, seed];
|
|
517
|
+
})
|
|
518
|
+
);
|
|
519
|
+
},
|
|
520
|
+
// Back-compat: triggers authored before `add-row` moved into the operations
|
|
521
|
+
// registry carry the bare `operation: 'add-row'` (no params). Keep appending
|
|
522
|
+
// an empty row for them.
|
|
495
523
|
"add-row": () => Effect.sync(() => {
|
|
496
524
|
rowData.value = [...rowData.value, {}];
|
|
497
525
|
}),
|
|
@@ -533,6 +561,26 @@ watch(
|
|
|
533
561
|
if (next && next !== prev) void fetchDataSource();
|
|
534
562
|
}
|
|
535
563
|
);
|
|
564
|
+
const requestSignature = computed(() => {
|
|
565
|
+
const expr = config.value?.dataSource?.request;
|
|
566
|
+
if (!expr) return null;
|
|
567
|
+
try {
|
|
568
|
+
const req = asRequest(Effect.runSync($cel(
|
|
569
|
+
expr,
|
|
570
|
+
celScope(inheritedContext, { query: {}, sorts: [], pageIndex: 0, pageSize: 0 })
|
|
571
|
+
)));
|
|
572
|
+
return Option.isSome(req) ? JSON.stringify(req.value.describe()) : null;
|
|
573
|
+
} catch {
|
|
574
|
+
return null;
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
watchDebounced(
|
|
578
|
+
requestSignature,
|
|
579
|
+
(next, prev) => {
|
|
580
|
+
if (next !== null && next !== prev) void fetchDataSource();
|
|
581
|
+
},
|
|
582
|
+
{ debounce: 200 }
|
|
583
|
+
);
|
|
536
584
|
const sortedRowIndexMap = computed(() => {
|
|
537
585
|
const map = /* @__PURE__ */ new Map();
|
|
538
586
|
tableApi.getSortedRowModel().flatRows.forEach((row, i) => {
|
|
@@ -24,7 +24,8 @@ export declare const metadata: {
|
|
|
24
24
|
readonly name: "清空所有选中行";
|
|
25
25
|
readonly icon: "fluent:select-all-off-20-regular";
|
|
26
26
|
}, {
|
|
27
|
-
readonly id: "add-row";
|
|
27
|
+
readonly id: "com.shwfed.operation.table.add-row";
|
|
28
|
+
readonly compatibilityDate: "2026-07-06";
|
|
28
29
|
readonly name: "新增一行";
|
|
29
30
|
readonly icon: "fluent:add-20-regular";
|
|
30
31
|
}, {
|
|
@@ -157,6 +158,40 @@ export declare function TableConfig(configure: (env: Environment) => void): Sche
|
|
|
157
158
|
readonly message: string;
|
|
158
159
|
}[]] | undefined;
|
|
159
160
|
}[];
|
|
161
|
+
readonly query?: {
|
|
162
|
+
readonly style?: string | undefined;
|
|
163
|
+
readonly id?: string | undefined;
|
|
164
|
+
readonly initial?: {
|
|
165
|
+
readonly data: string;
|
|
166
|
+
readonly request?: string | undefined;
|
|
167
|
+
} | undefined;
|
|
168
|
+
readonly displayName?: string | undefined;
|
|
169
|
+
readonly kind: "shwfed.component.form";
|
|
170
|
+
readonly fields: readonly any[];
|
|
171
|
+
readonly layouts: readonly {
|
|
172
|
+
readonly name: string;
|
|
173
|
+
readonly layout: {
|
|
174
|
+
readonly style?: string | undefined;
|
|
175
|
+
readonly columns: number;
|
|
176
|
+
readonly gap?: number | undefined;
|
|
177
|
+
readonly rows?: number | undefined;
|
|
178
|
+
readonly placements: {
|
|
179
|
+
readonly [x: string]: {
|
|
180
|
+
readonly area: readonly [readonly [number, number], readonly [number, number]];
|
|
181
|
+
readonly v?: "stretch" | "center" | "end" | "start" | undefined;
|
|
182
|
+
readonly h?: "stretch" | "center" | "end" | "start" | undefined;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
readonly media?: string | undefined;
|
|
187
|
+
}[];
|
|
188
|
+
readonly readonly?: string | undefined;
|
|
189
|
+
} | undefined;
|
|
190
|
+
readonly dataSource?: {
|
|
191
|
+
readonly data: string;
|
|
192
|
+
readonly total?: string | undefined;
|
|
193
|
+
readonly request?: string | undefined;
|
|
194
|
+
} | undefined;
|
|
160
195
|
readonly actions?: {
|
|
161
196
|
readonly size: "default" | "sm" | "xs";
|
|
162
197
|
readonly style?: string | undefined;
|
|
@@ -224,40 +259,6 @@ export declare function TableConfig(configure: (env: Environment) => void): Sche
|
|
|
224
259
|
readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
|
|
225
260
|
}[];
|
|
226
261
|
} | undefined;
|
|
227
|
-
readonly query?: {
|
|
228
|
-
readonly style?: string | undefined;
|
|
229
|
-
readonly id?: string | undefined;
|
|
230
|
-
readonly initial?: {
|
|
231
|
-
readonly data: string;
|
|
232
|
-
readonly request?: string | undefined;
|
|
233
|
-
} | undefined;
|
|
234
|
-
readonly displayName?: string | undefined;
|
|
235
|
-
readonly kind: "shwfed.component.form";
|
|
236
|
-
readonly fields: readonly any[];
|
|
237
|
-
readonly layouts: readonly {
|
|
238
|
-
readonly name: string;
|
|
239
|
-
readonly layout: {
|
|
240
|
-
readonly style?: string | undefined;
|
|
241
|
-
readonly columns: number;
|
|
242
|
-
readonly gap?: number | undefined;
|
|
243
|
-
readonly rows?: number | undefined;
|
|
244
|
-
readonly placements: {
|
|
245
|
-
readonly [x: string]: {
|
|
246
|
-
readonly area: readonly [readonly [number, number], readonly [number, number]];
|
|
247
|
-
readonly v?: "stretch" | "center" | "end" | "start" | undefined;
|
|
248
|
-
readonly h?: "stretch" | "center" | "end" | "start" | undefined;
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
};
|
|
252
|
-
readonly media?: string | undefined;
|
|
253
|
-
}[];
|
|
254
|
-
readonly readonly?: string | undefined;
|
|
255
|
-
} | undefined;
|
|
256
|
-
readonly dataSource?: {
|
|
257
|
-
readonly data: string;
|
|
258
|
-
readonly total?: string | undefined;
|
|
259
|
-
readonly request?: string | undefined;
|
|
260
|
-
} | undefined;
|
|
261
262
|
readonly bottomActions?: {
|
|
262
263
|
readonly size: "default" | "sm" | "xs";
|
|
263
264
|
readonly style?: string | undefined;
|
|
@@ -826,6 +827,40 @@ export declare function createTableConfig(body: Omit<Schema.Schema.Type<ReturnTy
|
|
|
826
827
|
readonly message: string;
|
|
827
828
|
}[]] | undefined;
|
|
828
829
|
}[];
|
|
830
|
+
query?: {
|
|
831
|
+
readonly style?: string | undefined;
|
|
832
|
+
readonly id?: string | undefined;
|
|
833
|
+
readonly initial?: {
|
|
834
|
+
readonly data: string;
|
|
835
|
+
readonly request?: string | undefined;
|
|
836
|
+
} | undefined;
|
|
837
|
+
readonly displayName?: string | undefined;
|
|
838
|
+
readonly kind: "shwfed.component.form";
|
|
839
|
+
readonly fields: readonly any[];
|
|
840
|
+
readonly layouts: readonly {
|
|
841
|
+
readonly name: string;
|
|
842
|
+
readonly layout: {
|
|
843
|
+
readonly style?: string | undefined;
|
|
844
|
+
readonly columns: number;
|
|
845
|
+
readonly gap?: number | undefined;
|
|
846
|
+
readonly rows?: number | undefined;
|
|
847
|
+
readonly placements: {
|
|
848
|
+
readonly [x: string]: {
|
|
849
|
+
readonly area: readonly [readonly [number, number], readonly [number, number]];
|
|
850
|
+
readonly v?: "stretch" | "center" | "end" | "start" | undefined;
|
|
851
|
+
readonly h?: "stretch" | "center" | "end" | "start" | undefined;
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
};
|
|
855
|
+
readonly media?: string | undefined;
|
|
856
|
+
}[];
|
|
857
|
+
readonly readonly?: string | undefined;
|
|
858
|
+
} | undefined;
|
|
859
|
+
dataSource?: {
|
|
860
|
+
readonly data: string;
|
|
861
|
+
readonly total?: string | undefined;
|
|
862
|
+
readonly request?: string | undefined;
|
|
863
|
+
} | undefined;
|
|
829
864
|
actions?: {
|
|
830
865
|
readonly size: "default" | "sm" | "xs";
|
|
831
866
|
readonly style?: string | undefined;
|
|
@@ -893,40 +928,6 @@ export declare function createTableConfig(body: Omit<Schema.Schema.Type<ReturnTy
|
|
|
893
928
|
readonly variant?: "default" | "link" | "destructive" | "primary" | "ghost" | undefined;
|
|
894
929
|
}[];
|
|
895
930
|
} | undefined;
|
|
896
|
-
query?: {
|
|
897
|
-
readonly style?: string | undefined;
|
|
898
|
-
readonly id?: string | undefined;
|
|
899
|
-
readonly initial?: {
|
|
900
|
-
readonly data: string;
|
|
901
|
-
readonly request?: string | undefined;
|
|
902
|
-
} | undefined;
|
|
903
|
-
readonly displayName?: string | undefined;
|
|
904
|
-
readonly kind: "shwfed.component.form";
|
|
905
|
-
readonly fields: readonly any[];
|
|
906
|
-
readonly layouts: readonly {
|
|
907
|
-
readonly name: string;
|
|
908
|
-
readonly layout: {
|
|
909
|
-
readonly style?: string | undefined;
|
|
910
|
-
readonly columns: number;
|
|
911
|
-
readonly gap?: number | undefined;
|
|
912
|
-
readonly rows?: number | undefined;
|
|
913
|
-
readonly placements: {
|
|
914
|
-
readonly [x: string]: {
|
|
915
|
-
readonly area: readonly [readonly [number, number], readonly [number, number]];
|
|
916
|
-
readonly v?: "stretch" | "center" | "end" | "start" | undefined;
|
|
917
|
-
readonly h?: "stretch" | "center" | "end" | "start" | undefined;
|
|
918
|
-
};
|
|
919
|
-
};
|
|
920
|
-
};
|
|
921
|
-
readonly media?: string | undefined;
|
|
922
|
-
}[];
|
|
923
|
-
readonly readonly?: string | undefined;
|
|
924
|
-
} | undefined;
|
|
925
|
-
dataSource?: {
|
|
926
|
-
readonly data: string;
|
|
927
|
-
readonly total?: string | undefined;
|
|
928
|
-
readonly request?: string | undefined;
|
|
929
|
-
} | undefined;
|
|
930
931
|
bottomActions?: {
|
|
931
932
|
readonly size: "default" | "sm" | "xs";
|
|
932
933
|
readonly style?: string | undefined;
|
|
@@ -4,6 +4,7 @@ import { Locale } from "../../share/locale.js";
|
|
|
4
4
|
import { md } from "../../share/markdown.js";
|
|
5
5
|
import { ActionSchemaFields } from "../actions/schema.js";
|
|
6
6
|
import { FormConfig } from "../form/schema.js";
|
|
7
|
+
import * as addRowOp from "../operations/2026-07-06/com.shwfed.operation.table.add-row/schema.js";
|
|
7
8
|
import { allColumnSchemas } from "./utils/resolve.js";
|
|
8
9
|
import { CelRowAccess, registerRowVariablesIfAbsent } from "./utils/shared.js";
|
|
9
10
|
export { getStructFieldTitle, getStructFieldDescription } from "./utils/schema-meta.js";
|
|
@@ -21,7 +22,18 @@ export const metadata = {
|
|
|
21
22
|
{ id: "reset-pagination", name: "\u91CD\u7F6E\u5206\u9875\u5E76\u6267\u884C\u641C\u7D22", icon: "fluent:arrow-previous-20-regular" },
|
|
22
23
|
{ id: "search", name: "\u6267\u884C\u641C\u7D22", icon: "fluent:search-20-regular" },
|
|
23
24
|
{ id: "clear-selection", name: "\u6E05\u7A7A\u6240\u6709\u9009\u4E2D\u884C", icon: "fluent:select-all-off-20-regular" },
|
|
24
|
-
|
|
25
|
+
// Parameterized (but host-coupled) op: `compatibilityDate` marks it as
|
|
26
|
+
// carrying params, so the trigger editor renders the op's `config.vue` and
|
|
27
|
+
// seeds its params. Unlike the generic ops (alert / 发送请求) it ships no
|
|
28
|
+
// `runtime.ts` — the row append touches this instance's private `rowData`,
|
|
29
|
+
// so the handler is hand-wired in `index.vue`'s `provideEventTarget`. `id`
|
|
30
|
+
// doubles as the operation-block `type`.
|
|
31
|
+
{
|
|
32
|
+
id: addRowOp.type,
|
|
33
|
+
compatibilityDate: addRowOp.compatibilityDate,
|
|
34
|
+
name: addRowOp.metadata.name,
|
|
35
|
+
icon: addRowOp.metadata.icon
|
|
36
|
+
},
|
|
25
37
|
{ id: "duplicate-selected", name: "\u590D\u5236\u9009\u4E2D\u884C", icon: "fluent:copy-20-regular" },
|
|
26
38
|
{ id: "delete-selected", name: "\u5220\u9664\u9009\u4E2D\u884C", icon: "fluent:delete-20-regular" }
|
|
27
39
|
]
|
|
@@ -57,7 +57,7 @@ export function parseClip(text) {
|
|
|
57
57
|
try {
|
|
58
58
|
const o = JSON.parse(text);
|
|
59
59
|
if (!o || o[CLIP_KEY] !== CLIP_VERSION) return null;
|
|
60
|
-
if (o.surface !== "form" && o.surface !== "block") return null;
|
|
60
|
+
if (o.surface !== "form" && o.surface !== "block" && o.surface !== "table") return null;
|
|
61
61
|
if (!Array.isArray(o.items)) return null;
|
|
62
62
|
const placements = isPlainObject(o.placements) ? o.placements : void 0;
|
|
63
63
|
return { surface: o.surface, items: o.items, placements };
|