@shwfed/config 2.3.10 → 2.3.12
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 +946 -544
- package/dist/module.json +1 -1
- package/dist/preview/assets/{config-CyScbxXy.js → config-B-1L3Ra-.js} +1 -1
- package/dist/preview/assets/{config-ja_GMXxV.js → config-Cf5kO84H.js} +1 -1
- package/dist/preview/assets/{config-bxqg3yuv.js → config-DTQkLHVw.js} +1 -1
- package/dist/preview/assets/{config-HdWYFZ09.js → config-DqxN0Byp.js} +1 -1
- package/dist/preview/assets/{config-2R4XkSGs.js → config-QUQ71Eo6.js} +1 -1
- package/dist/preview/assets/{config-ykJZssgx.js → config-oO93sSer.js} +1 -1
- package/dist/preview/assets/{config-KcLrpkc1.js → config-sJ5XKUJy.js} +1 -1
- package/dist/preview/assets/{config-BxzDT_57.js → config-zCMkbPQt.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-CWyVRSOh.js → definition.vue_vue_type_script_setup_true_lang-D-OVRv68.js} +1 -1
- package/dist/preview/assets/index-Br_eXThF.css +1 -0
- package/dist/preview/assets/index-D8QyOVfp.js +637 -0
- package/dist/preview/assets/index-b_t8yWJJ.js +1 -0
- package/dist/preview/assets/{runtime-B8aUJIpn.js → runtime-10_7L7Gz.js} +1 -1
- package/dist/preview/assets/{runtime-CxA8fvQP.js → runtime-B2EP6060.js} +1 -1
- package/dist/preview/assets/{runtime-LBdh1D75.js → runtime-BxlgShjU.js} +1 -1
- package/dist/preview/assets/{runtime-DqZhDPHl.js → runtime-Cv2doZNu.js} +1 -1
- package/dist/preview/assets/{runtime-CpSiaWMP.js → runtime-CzDUrqSa.js} +1 -1
- package/dist/preview/assets/{runtime-D2K1s33u.js → runtime-DcYhXvSk.js} +1 -1
- package/dist/preview/assets/{runtime-DAXQmtLg.js → runtime-DlDhRVII.js} +1 -1
- package/dist/preview/assets/{runtime-C9XnvD5A.js → runtime-cmkN6aik.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.table/schema.d.ts +1 -1
- package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/schema.d.ts +4 -0
- package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/schema.js +6 -17
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +18 -18
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.d.vue.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue.d.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.d.vue.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.vue.d.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.d.vue.ts +12 -12
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue.d.ts +12 -12
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.d.vue.ts +10 -10
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.vue.d.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.d.vue.ts +12 -12
- package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/config.vue.d.ts +12 -12
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.d.vue.ts +133 -0
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue +605 -0
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue.d.ts +133 -0
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.vue +324 -0
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/schema.d.ts +99 -0
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/schema.js +129 -0
- package/dist/runtime/components/form/unit-config.vue +8 -27
- package/dist/runtime/components/form/utils/resolve.d.ts +48 -9
- package/dist/runtime/components/form/utils/resolve.js +59 -5
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/config.d.vue.ts +10 -0
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/config.vue +305 -0
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/config.vue.d.ts +10 -0
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/runtime.vue +81 -0
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/schema.d.ts +55 -0
- package/dist/runtime/components/table/columns/2026-05-13/com.shwfed.table.column.switch.remote/schema.js +82 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/config.d.vue.ts +10 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/config.vue +310 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/config.vue.d.ts +10 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/runtime.d.vue.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/runtime.vue +81 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/runtime.vue.d.ts +9 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/schema.d.ts +66 -0
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.switch.local/schema.js +71 -0
- package/dist/runtime/components/table/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/config.vue +7 -46
- package/dist/runtime/components/table/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/schema.d.ts +9 -2
- package/dist/runtime/components/table/schema.js +30 -14
- package/dist/runtime/components/table/utils/resolve.d.ts +53 -0
- package/dist/runtime/components/table/utils/resolve.js +66 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerDateTimePanel.d.vue.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerDateTimePanel.vue.d.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.d.vue.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.vue.d.ts +1 -1
- package/dist/runtime/components/ui/tree/Tree.d.vue.ts +57 -0
- package/dist/runtime/components/ui/tree/Tree.vue +325 -0
- package/dist/runtime/components/ui/tree/Tree.vue.d.ts +57 -0
- package/dist/runtime/components/ui/tree/TreeNode.d.vue.ts +53 -0
- package/dist/runtime/components/ui/tree/TreeNode.vue +299 -0
- package/dist/runtime/components/ui/tree/TreeNode.vue.d.ts +53 -0
- package/dist/runtime/components/ui/tree/index.d.ts +3 -0
- package/dist/runtime/components/ui/tree/index.js +2 -0
- package/dist/runtime/components/ui/tree/types.d.ts +120 -0
- package/dist/runtime/components/ui/tree/types.js +0 -0
- package/dist/runtime/components/ui/tree/useTreeState.d.ts +95 -0
- package/dist/runtime/components/ui/tree/useTreeState.js +369 -0
- package/dist/runtime/shims.d.ts +2 -0
- package/package.json +1 -1
- package/dist/preview/assets/index-BPKK3hGV.css +0 -1
- package/dist/preview/assets/index-D3pf2RjG.js +0 -1
- package/dist/preview/assets/index-OUd02U3g.js +0 -1075
- package/dist/runtime/components/form/ai/fields-button.d.vue.ts +0 -13
- package/dist/runtime/components/form/ai/fields-button.vue +0 -458
- package/dist/runtime/components/form/ai/fields-button.vue.d.ts +0 -13
- package/dist/runtime/components/form/ai/fields-task.md +0 -71
- package/dist/runtime/components/table/ai/columns-button.d.vue.ts +0 -12
- package/dist/runtime/components/table/ai/columns-button.vue +0 -491
- package/dist/runtime/components/table/ai/columns-button.vue.d.ts +0 -12
- package/dist/runtime/components/table/ai/columns-task.md +0 -53
- package/dist/runtime/components/table/ai/data-source-button.d.vue.ts +0 -20
- package/dist/runtime/components/table/ai/data-source-button.vue +0 -324
- package/dist/runtime/components/table/ai/data-source-button.vue.d.ts +0 -20
- package/dist/runtime/components/table/ai/data-source-task.md +0 -17
- package/dist/runtime/utils/ai/cel-prompt.d.ts +0 -11
- package/dist/runtime/utils/ai/cel-prompt.js +0 -27
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, watch } from "vue";
|
|
3
|
+
import { useTreeState } from "./useTreeState";
|
|
4
|
+
import TreeNode from "./TreeNode.vue";
|
|
5
|
+
defineOptions({ name: "UiTree" });
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
roots: { type: Array, required: true },
|
|
8
|
+
getKey: { type: Function, required: true },
|
|
9
|
+
getChildren: { type: Function, required: false, default: void 0 },
|
|
10
|
+
loadChildren: { type: Function, required: false, default: void 0 },
|
|
11
|
+
selectionMode: { type: String, required: false, default: "none" },
|
|
12
|
+
cascade: { type: String, required: false, default: "independent" },
|
|
13
|
+
modelValue: { type: null, required: false, default: void 0 },
|
|
14
|
+
selectable: { type: Function, required: false, default: () => true },
|
|
15
|
+
draggable: { type: [Function, Boolean], required: false, default: false },
|
|
16
|
+
canDrop: { type: Function, required: false, default: void 0 },
|
|
17
|
+
filterPredicate: { type: Function, required: false, default: void 0 },
|
|
18
|
+
filterQuery: { type: String, required: false, default: "" },
|
|
19
|
+
initialExpanded: { type: Array, required: false, default: () => [] }
|
|
20
|
+
});
|
|
21
|
+
const emit = defineEmits(["update:modelValue", "update:roots", "move"]);
|
|
22
|
+
defineSlots();
|
|
23
|
+
function readInitialSelection() {
|
|
24
|
+
if (props.selectionMode === "none") return [];
|
|
25
|
+
if (props.selectionMode === "single") {
|
|
26
|
+
const v2 = props.modelValue;
|
|
27
|
+
return typeof v2 === "string" ? [v2] : [];
|
|
28
|
+
}
|
|
29
|
+
const v = props.modelValue;
|
|
30
|
+
return Array.isArray(v) ? v.slice() : [];
|
|
31
|
+
}
|
|
32
|
+
const rootsRef = computed(() => props.roots);
|
|
33
|
+
function setRoots(next) {
|
|
34
|
+
emit("update:roots", next);
|
|
35
|
+
}
|
|
36
|
+
let lastEmittedSelection = readInitialSelection();
|
|
37
|
+
function onSelectionChange(next) {
|
|
38
|
+
lastEmittedSelection = next;
|
|
39
|
+
if (props.selectionMode === "single") {
|
|
40
|
+
emit("update:modelValue", next[0]);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
emit("update:modelValue", next);
|
|
44
|
+
}
|
|
45
|
+
const state = useTreeState({
|
|
46
|
+
rootsRef,
|
|
47
|
+
setRoots,
|
|
48
|
+
getKey: props.getKey,
|
|
49
|
+
getChildren: props.getChildren,
|
|
50
|
+
loadChildren: props.loadChildren,
|
|
51
|
+
selectionMode: () => props.selectionMode,
|
|
52
|
+
cascade: () => props.cascade,
|
|
53
|
+
selectable: (n, d) => props.selectable(n, d),
|
|
54
|
+
initialSelection: readInitialSelection,
|
|
55
|
+
initialExpanded: () => props.initialExpanded ?? [],
|
|
56
|
+
onSelectionChange
|
|
57
|
+
});
|
|
58
|
+
watch(rootsRef, () => state.syncRoots());
|
|
59
|
+
watch(
|
|
60
|
+
() => props.modelValue,
|
|
61
|
+
(v) => {
|
|
62
|
+
const desired = props.selectionMode === "single" ? typeof v === "string" ? [v] : [] : Array.isArray(v) ? v.slice() : [];
|
|
63
|
+
if (sameSet(desired, lastEmittedSelection)) return;
|
|
64
|
+
state.selected.clear();
|
|
65
|
+
for (const k of desired) state.selected.add(k);
|
|
66
|
+
lastEmittedSelection = desired;
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
function sameSet(a, b) {
|
|
70
|
+
if (a.length !== b.length) return false;
|
|
71
|
+
const s = new Set(a);
|
|
72
|
+
for (const k of b) if (!s.has(k)) return false;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
const tree = {
|
|
76
|
+
insert: (parentKey, node, index) => state.insert(parentKey, node, index),
|
|
77
|
+
remove: (key) => state.remove(key),
|
|
78
|
+
move: (key, newParentKey, index) => {
|
|
79
|
+
const loc = state.locate(key);
|
|
80
|
+
if (!loc) return;
|
|
81
|
+
const payload = {
|
|
82
|
+
key,
|
|
83
|
+
fromParentKey: loc.parent ? props.getKey(loc.parent) : null,
|
|
84
|
+
fromIndex: loc.index,
|
|
85
|
+
toParentKey: newParentKey,
|
|
86
|
+
toIndex: index
|
|
87
|
+
};
|
|
88
|
+
state.move(key, newParentKey, index);
|
|
89
|
+
emit("move", payload);
|
|
90
|
+
},
|
|
91
|
+
update: (key, patch) => state.update(key, patch),
|
|
92
|
+
expand: (key) => state.expand(key),
|
|
93
|
+
collapse: (key) => state.collapse(key),
|
|
94
|
+
select: (key) => state.selectKey(key),
|
|
95
|
+
deselect: (key) => state.deselectKey(key),
|
|
96
|
+
invalidate: (key) => state.invalidate(key),
|
|
97
|
+
retry: (key) => state.retry(key),
|
|
98
|
+
findPath: (key) => state.findPath(key),
|
|
99
|
+
snapshot: () => state.snapshot()
|
|
100
|
+
};
|
|
101
|
+
defineExpose(tree);
|
|
102
|
+
const isExpanded = (k) => state.expanded.has(k);
|
|
103
|
+
const isSelectedKey = (k) => state.selected.has(k);
|
|
104
|
+
const isVisuallySelected = (n, d) => state.isVisuallySelected(n, d);
|
|
105
|
+
const isIndeterminate = (n, d) => state.isIndeterminate(n, d);
|
|
106
|
+
const resolvedChildren = (n) => state.resolvedChildren(n);
|
|
107
|
+
const loadStateOf = (k) => state.loadState.get(k);
|
|
108
|
+
const isExpandable = (n) => state.isExpandable(n);
|
|
109
|
+
const draggableFn = (n, d) => typeof props.draggable === "function" ? props.draggable(n, d) : props.draggable;
|
|
110
|
+
function handleToggleExpand(key) {
|
|
111
|
+
state.toggleExpand(key);
|
|
112
|
+
}
|
|
113
|
+
function handleToggleSelect(key) {
|
|
114
|
+
if (props.selectionMode === "none") return;
|
|
115
|
+
if (props.selectionMode === "single") {
|
|
116
|
+
const loc = state.locate(key);
|
|
117
|
+
if (!loc || !props.selectable(loc.node, loc.depth)) return;
|
|
118
|
+
state.selectKey(key);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
state.toggleMulti(key);
|
|
122
|
+
}
|
|
123
|
+
function handleFocusRow(key) {
|
|
124
|
+
state.focusedKey.value = key;
|
|
125
|
+
}
|
|
126
|
+
function flatVisible() {
|
|
127
|
+
return state.flattenVisible(
|
|
128
|
+
props.filterPredicate && props.filterQuery ? (n) => {
|
|
129
|
+
if (props.filterPredicate(n, props.filterQuery)) return true;
|
|
130
|
+
const kids = resolvedChildren(n);
|
|
131
|
+
if (!kids || kids.length === 0) return false;
|
|
132
|
+
const stack = [...kids];
|
|
133
|
+
while (stack.length) {
|
|
134
|
+
const x = stack.pop();
|
|
135
|
+
if (props.filterPredicate(x, props.filterQuery)) return true;
|
|
136
|
+
const k = resolvedChildren(x);
|
|
137
|
+
if (k && k.length) stack.push(...k);
|
|
138
|
+
}
|
|
139
|
+
return false;
|
|
140
|
+
} : void 0
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
function moveFocus(delta) {
|
|
144
|
+
const list = flatVisible();
|
|
145
|
+
if (!list.length) return;
|
|
146
|
+
const cur = state.focusedKey.value;
|
|
147
|
+
let idx = list.findIndex((r) => r.key === cur);
|
|
148
|
+
if (idx === -1) idx = delta > 0 ? -1 : list.length;
|
|
149
|
+
const next = Math.max(0, Math.min(list.length - 1, idx + delta));
|
|
150
|
+
state.focusedKey.value = list[next].key;
|
|
151
|
+
}
|
|
152
|
+
function focusEdge(end) {
|
|
153
|
+
const list = flatVisible();
|
|
154
|
+
if (!list.length) return;
|
|
155
|
+
state.focusedKey.value = (end === "home" ? list[0] : list[list.length - 1]).key;
|
|
156
|
+
}
|
|
157
|
+
function onKeydown(e) {
|
|
158
|
+
if (props.selectionMode === "none" && !["ArrowUp", "ArrowDown", "Home", "End"].includes(e.key)) {
|
|
159
|
+
}
|
|
160
|
+
switch (e.key) {
|
|
161
|
+
case "ArrowDown":
|
|
162
|
+
e.preventDefault();
|
|
163
|
+
moveFocus(1);
|
|
164
|
+
break;
|
|
165
|
+
case "ArrowUp":
|
|
166
|
+
e.preventDefault();
|
|
167
|
+
moveFocus(-1);
|
|
168
|
+
break;
|
|
169
|
+
case "ArrowRight": {
|
|
170
|
+
e.preventDefault();
|
|
171
|
+
const k = state.focusedKey.value;
|
|
172
|
+
if (!k) return;
|
|
173
|
+
const loc = state.locate(k);
|
|
174
|
+
if (!loc) return;
|
|
175
|
+
if (state.isExpandable(loc.node) && !state.expanded.has(k)) {
|
|
176
|
+
state.expand(k);
|
|
177
|
+
} else {
|
|
178
|
+
moveFocus(1);
|
|
179
|
+
}
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
case "ArrowLeft": {
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
const k = state.focusedKey.value;
|
|
185
|
+
if (!k) return;
|
|
186
|
+
if (state.expanded.has(k)) {
|
|
187
|
+
state.collapse(k);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const loc = state.locate(k);
|
|
191
|
+
if (loc?.parent) state.focusedKey.value = props.getKey(loc.parent);
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
case "Home":
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
focusEdge("home");
|
|
197
|
+
break;
|
|
198
|
+
case "End":
|
|
199
|
+
e.preventDefault();
|
|
200
|
+
focusEdge("end");
|
|
201
|
+
break;
|
|
202
|
+
case " ":
|
|
203
|
+
// Space
|
|
204
|
+
case "Enter": {
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
const k = state.focusedKey.value;
|
|
207
|
+
if (!k) return;
|
|
208
|
+
handleToggleSelect(k);
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const isEmpty = computed(() => {
|
|
214
|
+
if (state.rootsView.value.length > 0) return false;
|
|
215
|
+
return true;
|
|
216
|
+
});
|
|
217
|
+
const selectedPanePayload = computed(() => ({
|
|
218
|
+
selected: state.selectedNodes.value,
|
|
219
|
+
tree
|
|
220
|
+
}));
|
|
221
|
+
</script>
|
|
222
|
+
|
|
223
|
+
<template>
|
|
224
|
+
<div
|
|
225
|
+
role="tree"
|
|
226
|
+
:aria-multiselectable="selectionMode === 'multi' ? 'true' : void 0"
|
|
227
|
+
tabindex="0"
|
|
228
|
+
data-slot="tree"
|
|
229
|
+
class="outline-none"
|
|
230
|
+
@keydown="onKeydown"
|
|
231
|
+
>
|
|
232
|
+
<div
|
|
233
|
+
v-if="$slots['selected-pane']"
|
|
234
|
+
data-slot="tree-selected-pane"
|
|
235
|
+
>
|
|
236
|
+
<slot
|
|
237
|
+
name="selected-pane"
|
|
238
|
+
v-bind="selectedPanePayload"
|
|
239
|
+
/>
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
<template v-if="isEmpty">
|
|
243
|
+
<div data-slot="tree-empty">
|
|
244
|
+
<slot name="empty" />
|
|
245
|
+
</div>
|
|
246
|
+
</template>
|
|
247
|
+
<template v-else>
|
|
248
|
+
<ul
|
|
249
|
+
role="group"
|
|
250
|
+
class="m-0 list-none p-0"
|
|
251
|
+
>
|
|
252
|
+
<TreeNode
|
|
253
|
+
v-for="(node, idx) in state.rootsView.value"
|
|
254
|
+
:key="getKey(node)"
|
|
255
|
+
:node="node"
|
|
256
|
+
:depth="0"
|
|
257
|
+
:pos-in-set="idx + 1"
|
|
258
|
+
:set-size="state.rootsView.value.length"
|
|
259
|
+
:parent-key="null"
|
|
260
|
+
:get-key="getKey"
|
|
261
|
+
:get-children="getChildren"
|
|
262
|
+
:has-loader="!!loadChildren"
|
|
263
|
+
:selection-mode="selectionMode"
|
|
264
|
+
:cascade="cascade"
|
|
265
|
+
:selectable="selectable"
|
|
266
|
+
:draggable="draggableFn"
|
|
267
|
+
:is-expanded="isExpanded"
|
|
268
|
+
:is-selected-key="isSelectedKey"
|
|
269
|
+
:is-visually-selected="isVisuallySelected"
|
|
270
|
+
:is-indeterminate="isIndeterminate"
|
|
271
|
+
:resolved-children="resolvedChildren"
|
|
272
|
+
:load-state-of="loadStateOf"
|
|
273
|
+
:filter-predicate="filterPredicate"
|
|
274
|
+
:filter-query="filterQuery"
|
|
275
|
+
:is-expandable="isExpandable"
|
|
276
|
+
:tree="tree"
|
|
277
|
+
:focused-key="state.focusedKey.value"
|
|
278
|
+
@toggle-expand="handleToggleExpand"
|
|
279
|
+
@toggle-select="handleToggleSelect"
|
|
280
|
+
@focus-row="handleFocusRow"
|
|
281
|
+
>
|
|
282
|
+
<!-- Forward node/actions/error/loading-children explicitly.
|
|
283
|
+
(`empty` and `selected-pane` are root-only and not propagated
|
|
284
|
+
down through child rows.) -->
|
|
285
|
+
<template
|
|
286
|
+
v-if="$slots.node"
|
|
287
|
+
#node="slotProps"
|
|
288
|
+
>
|
|
289
|
+
<slot
|
|
290
|
+
name="node"
|
|
291
|
+
v-bind="slotProps"
|
|
292
|
+
/>
|
|
293
|
+
</template>
|
|
294
|
+
<template
|
|
295
|
+
v-if="$slots.actions"
|
|
296
|
+
#actions="slotProps"
|
|
297
|
+
>
|
|
298
|
+
<slot
|
|
299
|
+
name="actions"
|
|
300
|
+
v-bind="slotProps"
|
|
301
|
+
/>
|
|
302
|
+
</template>
|
|
303
|
+
<template
|
|
304
|
+
v-if="$slots.error"
|
|
305
|
+
#error="slotProps"
|
|
306
|
+
>
|
|
307
|
+
<slot
|
|
308
|
+
name="error"
|
|
309
|
+
v-bind="slotProps"
|
|
310
|
+
/>
|
|
311
|
+
</template>
|
|
312
|
+
<template
|
|
313
|
+
v-if="$slots['loading-children']"
|
|
314
|
+
#loading-children="slotProps"
|
|
315
|
+
>
|
|
316
|
+
<slot
|
|
317
|
+
name="loading-children"
|
|
318
|
+
v-bind="slotProps"
|
|
319
|
+
/>
|
|
320
|
+
</template>
|
|
321
|
+
</TreeNode>
|
|
322
|
+
</ul>
|
|
323
|
+
</template>
|
|
324
|
+
</div>
|
|
325
|
+
</template>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { CascadeMode, DropContext, GetChildren, LoadChildren, MoveEventPayload, NodeKey, SelectedPaneSlotProps, SelectionMode, TreeHandle } from './types.js';
|
|
2
|
+
declare const __VLS_export: <Node>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<{
|
|
4
|
+
/** Root-level nodes. Use `v-model:roots` for controlled mode. */
|
|
5
|
+
roots: Node[];
|
|
6
|
+
getKey: (node: Node) => NodeKey;
|
|
7
|
+
getChildren?: GetChildren<Node>;
|
|
8
|
+
loadChildren?: LoadChildren<Node>;
|
|
9
|
+
/** `'none' | 'single' | 'multi'`. Default `'none'`. */
|
|
10
|
+
selectionMode?: SelectionMode;
|
|
11
|
+
/** Multi cascade mode. Ignored for `single` / `none`. */
|
|
12
|
+
cascade?: CascadeMode;
|
|
13
|
+
/** v-model for selection. Shape depends on `selectionMode`. */
|
|
14
|
+
modelValue?: NodeKey | NodeKey[] | undefined;
|
|
15
|
+
/** Per-node gate. */
|
|
16
|
+
selectable?: (node: Node, depth: number) => boolean;
|
|
17
|
+
/** Per-node draggable gate. Defaults to global `draggable` prop. */
|
|
18
|
+
draggable?: ((node: Node, depth: number) => boolean) | boolean;
|
|
19
|
+
/** Drop gate; required to enable drag-and-drop. */
|
|
20
|
+
canDrop?: (ctx: DropContext<Node>) => boolean;
|
|
21
|
+
/** Render-time filter. Does NOT mutate selection. */
|
|
22
|
+
filterPredicate?: (node: Node, query: string) => boolean;
|
|
23
|
+
filterQuery?: string;
|
|
24
|
+
/** Initial expanded set (uncontrolled). */
|
|
25
|
+
initialExpanded?: NodeKey[];
|
|
26
|
+
} & {
|
|
27
|
+
onMove?: ((payload: MoveEventPayload) => any) | undefined;
|
|
28
|
+
"onUpdate:modelValue"?: ((value: string | string[] | undefined) => any) | undefined;
|
|
29
|
+
"onUpdate:roots"?: ((value: Node[]) => any) | undefined;
|
|
30
|
+
}> & (typeof globalThis extends {
|
|
31
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
32
|
+
} ? P : {});
|
|
33
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<TreeHandle<Node>>) => void;
|
|
34
|
+
attrs: any;
|
|
35
|
+
slots: {
|
|
36
|
+
node?: (p: import("./types.js").NodeSlotProps<Node>) => unknown;
|
|
37
|
+
actions?: (p: import("./types.js").ActionsSlotProps<Node>) => unknown;
|
|
38
|
+
empty?: () => unknown;
|
|
39
|
+
error?: (p: import("./types.js").ErrorSlotProps<Node>) => unknown;
|
|
40
|
+
'loading-children'?: (p: import("./types.js").LoadingChildrenSlotProps<Node>) => unknown;
|
|
41
|
+
'selected-pane'?: (p: SelectedPaneSlotProps<Node>) => unknown;
|
|
42
|
+
};
|
|
43
|
+
emit: {
|
|
44
|
+
(e: "update:modelValue", value: NodeKey | NodeKey[] | undefined): void;
|
|
45
|
+
(e: "update:roots", value: Node[]): void;
|
|
46
|
+
(e: "move", payload: MoveEventPayload): void;
|
|
47
|
+
};
|
|
48
|
+
}>) => import("vue").VNode & {
|
|
49
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
50
|
+
};
|
|
51
|
+
declare const _default: typeof __VLS_export;
|
|
52
|
+
export default _default;
|
|
53
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
54
|
+
[K in keyof T]: T[K];
|
|
55
|
+
} : {
|
|
56
|
+
[K in keyof T as K]: T[K];
|
|
57
|
+
}) & {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ActionsSlotProps, CascadeMode, ErrorSlotProps, GetChildren, LoadingChildrenSlotProps, NodeKey, NodeSlotProps, SelectionMode, TreeHandle } from './types.js';
|
|
2
|
+
import type { LoadState } from './useTreeState.js';
|
|
3
|
+
declare const __VLS_export: <Node>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<{
|
|
5
|
+
node: Node;
|
|
6
|
+
depth: number;
|
|
7
|
+
posInSet: number;
|
|
8
|
+
setSize: number;
|
|
9
|
+
parentKey: NodeKey | null;
|
|
10
|
+
getKey: (n: Node) => NodeKey;
|
|
11
|
+
getChildren?: GetChildren<Node>;
|
|
12
|
+
hasLoader: boolean;
|
|
13
|
+
selectionMode: SelectionMode;
|
|
14
|
+
cascade: CascadeMode;
|
|
15
|
+
selectable: (n: Node, depth: number) => boolean;
|
|
16
|
+
draggable: (n: Node, depth: number) => boolean;
|
|
17
|
+
isExpanded: (key: NodeKey) => boolean;
|
|
18
|
+
isSelectedKey: (key: NodeKey) => boolean;
|
|
19
|
+
isVisuallySelected: (n: Node, depth: number) => boolean;
|
|
20
|
+
isIndeterminate: (n: Node, depth: number) => boolean;
|
|
21
|
+
resolvedChildren: (n: Node) => Node[] | undefined | null;
|
|
22
|
+
loadStateOf: (key: NodeKey) => LoadState<Node> | undefined;
|
|
23
|
+
filterPredicate?: (n: Node, query: string) => boolean;
|
|
24
|
+
filterQuery: string;
|
|
25
|
+
isExpandable: (n: Node) => boolean;
|
|
26
|
+
tree: TreeHandle<Node>;
|
|
27
|
+
focusedKey: NodeKey | null;
|
|
28
|
+
} & {
|
|
29
|
+
"onToggle-expand"?: ((key: string) => any) | undefined;
|
|
30
|
+
"onToggle-select"?: ((key: string) => any) | undefined;
|
|
31
|
+
"onFocus-row"?: ((key: string) => any) | undefined;
|
|
32
|
+
}> & (typeof globalThis extends {
|
|
33
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
34
|
+
} ? P : {});
|
|
35
|
+
expose: (exposed: {}) => void;
|
|
36
|
+
attrs: any;
|
|
37
|
+
slots: {
|
|
38
|
+
node?: (p: NodeSlotProps<Node>) => unknown;
|
|
39
|
+
actions?: (p: ActionsSlotProps<Node>) => unknown;
|
|
40
|
+
error?: (p: ErrorSlotProps<Node>) => unknown;
|
|
41
|
+
'loading-children'?: (p: LoadingChildrenSlotProps<Node>) => unknown;
|
|
42
|
+
};
|
|
43
|
+
emit: (e: "toggle-expand" | "toggle-select" | "focus-row", key: NodeKey) => void;
|
|
44
|
+
}>) => import("vue").VNode & {
|
|
45
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
46
|
+
};
|
|
47
|
+
declare const _default: typeof __VLS_export;
|
|
48
|
+
export default _default;
|
|
49
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
50
|
+
[K in keyof T]: T[K];
|
|
51
|
+
} : {
|
|
52
|
+
[K in keyof T as K]: T[K];
|
|
53
|
+
}) & {};
|