react-arborist 1.2.0 → 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +606 -144
- package/dist/components/{drop-cursor.d.ts → cursor.d.ts} +0 -0
- package/dist/components/default-container.d.ts +7 -0
- package/dist/components/default-cursor.d.ts +3 -0
- package/dist/components/default-drag-preview.d.ts +3 -0
- package/dist/components/default-node.d.ts +4 -0
- package/dist/components/default-row.d.ts +4 -0
- package/dist/components/drag-preview-container.d.ts +2 -0
- package/dist/components/list-inner-element.d.ts +2 -0
- package/dist/components/provider.d.ts +11 -0
- package/dist/components/row-container.d.ts +8 -0
- package/dist/components/tree-container.d.ts +2 -0
- package/dist/components/tree.d.ts +5 -4
- package/dist/context.d.ts +20 -2
- package/dist/data/create-index.d.ts +5 -0
- package/dist/data/create-list.d.ts +4 -0
- package/dist/data/create-root.d.ts +5 -0
- package/dist/data/simple-tree.d.ts +43 -0
- package/dist/dnd/compute-drop.d.ts +4 -4
- package/dist/dnd/drag-hook.d.ts +3 -4
- package/dist/dnd/drop-hook.d.ts +2 -3
- package/dist/hooks/use-fresh-node.d.ts +2 -0
- package/dist/hooks/use-simple-tree.d.ts +13 -0
- package/dist/hooks/use-validated-props.d.ts +3 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.js +1948 -973
- package/dist/index.js.map +1 -1
- package/dist/interfaces/node-api.d.ts +67 -0
- package/dist/interfaces/tree-api.d.ts +113 -0
- package/dist/module.js +1935 -979
- package/dist/module.js.map +1 -1
- package/dist/state/dnd-slice.d.ts +20 -0
- package/dist/state/drag-slice.d.ts +7 -0
- package/dist/state/edit-slice.d.ts +8 -0
- package/dist/state/focus-slice.d.ts +12 -0
- package/dist/state/initial.d.ts +3 -0
- package/dist/state/open-slice.d.ts +30 -0
- package/dist/state/root-reducer.d.ts +13 -0
- package/dist/state/selection-slice.d.ts +36 -0
- package/dist/types/dnd.d.ts +9 -0
- package/dist/types/handlers.d.ts +24 -0
- package/dist/types/renderers.d.ts +30 -0
- package/dist/types/state.d.ts +2 -0
- package/dist/types/tree-props.d.ts +44 -0
- package/dist/types/utils.d.ts +21 -0
- package/dist/utils.d.ts +15 -6
- package/package.json +11 -7
- package/src/components/cursor.tsx +15 -0
- package/src/components/default-container.tsx +238 -0
- package/src/components/{default-drop-cursor.tsx → default-cursor.tsx} +9 -8
- package/src/components/{preview.tsx → default-drag-preview.tsx} +25 -41
- package/src/components/default-node.tsx +50 -0
- package/src/components/default-row.tsx +21 -0
- package/src/components/drag-preview-container.tsx +26 -0
- package/src/components/list-inner-element.tsx +22 -0
- package/src/components/list-outer-element.tsx +26 -15
- package/src/components/provider.tsx +97 -0
- package/src/components/row-container.tsx +82 -0
- package/src/components/tree-container.tsx +13 -0
- package/src/components/tree.tsx +16 -44
- package/src/context.ts +36 -0
- package/src/data/create-index.ts +9 -0
- package/src/data/create-list.ts +56 -0
- package/src/data/create-root.ts +54 -0
- package/src/data/simple-tree.ts +103 -0
- package/src/dnd/compute-drop.ts +16 -16
- package/src/dnd/drag-hook.ts +25 -19
- package/src/dnd/drop-hook.ts +31 -17
- package/src/dnd/outer-drop-hook.ts +1 -1
- package/src/hooks/use-fresh-node.ts +16 -0
- package/src/hooks/use-simple-tree.ts +55 -0
- package/src/hooks/use-validated-props.ts +35 -0
- package/src/index.ts +9 -19
- package/src/interfaces/node-api.ts +187 -0
- package/src/interfaces/tree-api.ts +557 -0
- package/src/state/dnd-slice.ts +36 -0
- package/src/state/drag-slice.ts +31 -0
- package/src/state/edit-slice.ts +19 -0
- package/src/state/focus-slice.ts +28 -0
- package/src/state/initial.ts +14 -0
- package/src/state/open-slice.ts +53 -0
- package/src/state/root-reducer.ts +21 -0
- package/src/state/selection-slice.ts +75 -0
- package/src/types/dnd.ts +10 -0
- package/src/types/handlers.ts +24 -0
- package/src/types/renderers.ts +34 -0
- package/src/types/state.ts +3 -0
- package/src/types/tree-props.ts +64 -0
- package/src/types/utils.ts +26 -0
- package/src/utils.ts +125 -11
- package/tsconfig.json +1 -1
- package/dist/components/default-drop-cursor.d.ts +0 -3
- package/dist/components/list.d.ts +0 -4
- package/dist/components/preview.d.ts +0 -2
- package/dist/components/row.d.ts +0 -8
- package/dist/data/enrich-tree.d.ts +0 -2
- package/dist/data/flatten-tree.d.ts +0 -2
- package/dist/provider.d.ts +0 -3
- package/dist/reducer.d.ts +0 -46
- package/dist/selection/range.d.ts +0 -13
- package/dist/selection/selection-hook.d.ts +0 -4
- package/dist/selection/selection.d.ts +0 -33
- package/dist/tree-api.d.ts +0 -50
- package/dist/types.d.ts +0 -122
- package/src/components/drop-cursor.tsx +0 -12
- package/src/components/list.tsx +0 -25
- package/src/components/row.tsx +0 -112
- package/src/context.tsx +0 -13
- package/src/data/enrich-tree.ts +0 -74
- package/src/data/flatten-tree.ts +0 -17
- package/src/provider.tsx +0 -41
- package/src/reducer.ts +0 -161
- package/src/selection/range.ts +0 -41
- package/src/selection/selection-hook.ts +0 -25
- package/src/selection/selection.test.ts +0 -111
- package/src/selection/selection.ts +0 -186
- package/src/tree-api.ts +0 -230
- package/src/types.ts +0 -148
package/dist/module.js
CHANGED
|
@@ -1,431 +1,72 @@
|
|
|
1
|
-
import {jsx as $g00cZ$jsx,
|
|
2
|
-
import $g00cZ$react, {forwardRef as $g00cZ$forwardRef,
|
|
3
|
-
import {
|
|
1
|
+
import {jsxs as $g00cZ$jsxs, jsx as $g00cZ$jsx, Fragment as $g00cZ$Fragment} from "react/jsx-runtime";
|
|
2
|
+
import $g00cZ$react, {forwardRef as $g00cZ$forwardRef, useRef as $g00cZ$useRef, useMemo as $g00cZ$useMemo, useImperativeHandle as $g00cZ$useImperativeHandle, useEffect as $g00cZ$useEffect, createContext as $g00cZ$createContext, useContext as $g00cZ$useContext, memo as $g00cZ$memo, useCallback as $g00cZ$useCallback, useState as $g00cZ$useState} from "react";
|
|
3
|
+
import {useSyncExternalStore as $g00cZ$useSyncExternalStore} from "use-sync-external-store/shim";
|
|
4
4
|
import {HTML5Backend as $g00cZ$HTML5Backend, getEmptyImage as $g00cZ$getEmptyImage} from "react-dnd-html5-backend";
|
|
5
|
-
import $g00cZ$
|
|
6
|
-
import $g00cZ$
|
|
5
|
+
import {DndProvider as $g00cZ$DndProvider, useDrag as $g00cZ$useDrag, useDrop as $g00cZ$useDrop, useDragLayer as $g00cZ$useDragLayer} from "react-dnd";
|
|
6
|
+
import {createStore as $g00cZ$createStore, combineReducers as $g00cZ$combineReducers} from "redux";
|
|
7
7
|
import {FixedSizeList as $g00cZ$FixedSizeList} from "react-window";
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function $1e5818ce7991d06d$var$createNode(model, level, parent, children, isOpen, isDraggable, isDroppable) {
|
|
14
|
-
return {
|
|
15
|
-
id: model.id,
|
|
16
|
-
level: level,
|
|
17
|
-
parent: parent,
|
|
18
|
-
children: children,
|
|
19
|
-
isOpen: isOpen,
|
|
20
|
-
isDraggable: isDraggable,
|
|
21
|
-
isDroppable: isDroppable,
|
|
22
|
-
model: model,
|
|
23
|
-
rowIndex: null
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function $1e5818ce7991d06d$var$access(obj, accessor) {
|
|
27
|
-
if (typeof accessor === "boolean") return accessor;
|
|
28
|
-
if (typeof accessor === "string") return obj[accessor];
|
|
29
|
-
return accessor(obj);
|
|
30
|
-
}
|
|
31
|
-
function $1e5818ce7991d06d$export$9c537176392280a0(model1, hideRoot = false, getChildren = "children", isOpen = "isOpen", disableDrag = false, disableDrop = false, openByDefault = true) {
|
|
32
|
-
function visitSelfAndChildren(model, level, parent) {
|
|
33
|
-
const open = $1e5818ce7991d06d$var$access(model, isOpen);
|
|
34
|
-
const draggable = !$1e5818ce7991d06d$var$access(model, disableDrag);
|
|
35
|
-
const droppable = !$1e5818ce7991d06d$var$access(model, disableDrop);
|
|
36
|
-
const node = $1e5818ce7991d06d$var$createNode(model, level, parent, null, open === undefined ? openByDefault : open, draggable, droppable);
|
|
37
|
-
const children = $1e5818ce7991d06d$var$access(model, getChildren);
|
|
38
|
-
if (children) node.children = children.map((child)=>visitSelfAndChildren(child, level + 1, node)
|
|
39
|
-
);
|
|
40
|
-
return node;
|
|
41
|
-
}
|
|
42
|
-
return visitSelfAndChildren(model1, hideRoot ? -1 : 0, null);
|
|
9
|
+
function $parcel$export(e, n, v, s) {
|
|
10
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
43
11
|
}
|
|
44
12
|
|
|
45
13
|
|
|
46
14
|
|
|
47
15
|
|
|
48
16
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
17
|
+
|
|
18
|
+
const $89e93131aae74bd9$export$feef243b04ff4151 = (0, $g00cZ$createContext)(null);
|
|
19
|
+
function $89e93131aae74bd9$export$367b0f2231a90ba0() {
|
|
20
|
+
const value = (0, $g00cZ$useContext)($89e93131aae74bd9$export$feef243b04ff4151);
|
|
52
21
|
if (value === null) throw new Error("No Tree Api Provided");
|
|
53
22
|
return value;
|
|
54
23
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.end = end;
|
|
61
|
-
if (this.start > this.end) throw new Error("Invalid range: start larger than end");
|
|
62
|
-
}
|
|
63
|
-
serialize() {
|
|
64
|
-
return [
|
|
65
|
-
this.start,
|
|
66
|
-
this.end
|
|
67
|
-
];
|
|
68
|
-
}
|
|
69
|
-
contains(n) {
|
|
70
|
-
return n >= this.start && n <= this.end;
|
|
71
|
-
}
|
|
72
|
-
overlaps(r) {
|
|
73
|
-
return this.contains(r.start - 1) || this.contains(r.end + 1);
|
|
74
|
-
}
|
|
75
|
-
combine(r) {
|
|
76
|
-
this.start = Math.min(r.start, this.start);
|
|
77
|
-
this.end = Math.max(r.end, this.end);
|
|
78
|
-
}
|
|
79
|
-
get size() {
|
|
80
|
-
return this.end - this.start + 1;
|
|
81
|
-
}
|
|
82
|
-
clone() {
|
|
83
|
-
return new $043ce40ea783107b$export$9a58ef0d7ad3278c(this.start, this.end);
|
|
84
|
-
}
|
|
85
|
-
map(fn) {
|
|
86
|
-
let returns = [];
|
|
87
|
-
for(let i = this.start; i <= this.end; i++)returns.push(fn(i));
|
|
88
|
-
return returns;
|
|
89
|
-
}
|
|
90
|
-
isEqual(other) {
|
|
91
|
-
return this.start === other.start && this.end === other.end;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
class $5ee99f971bd267fd$export$52baac22726c72bf {
|
|
97
|
-
static parse(data, items) {
|
|
98
|
-
if (data) return new $5ee99f971bd267fd$export$52baac22726c72bf(data.ranges, data.currentIndex, data.direction, items);
|
|
99
|
-
else return new $5ee99f971bd267fd$export$52baac22726c72bf();
|
|
100
|
-
}
|
|
101
|
-
constructor(ranges = [], currentIndex = ranges.length ? ranges.length - 1 : null, direction = "none", items = []){
|
|
102
|
-
this.ranges = [];
|
|
103
|
-
this.direction = "none";
|
|
104
|
-
ranges.forEach(([s, e])=>this.addRange(s, e)
|
|
105
|
-
);
|
|
106
|
-
this.currentIndex = currentIndex;
|
|
107
|
-
this.direction = direction;
|
|
108
|
-
this.items = items;
|
|
109
|
-
}
|
|
110
|
-
get current() {
|
|
111
|
-
if (this.currentIndex === null) return null;
|
|
112
|
-
const range = this.ranges[this.currentIndex];
|
|
113
|
-
if (!range) return null;
|
|
114
|
-
else return range;
|
|
115
|
-
}
|
|
116
|
-
select(n) {
|
|
117
|
-
if (n < 0 || n >= this.items.length) return;
|
|
118
|
-
this.clear();
|
|
119
|
-
this.currentIndex = this.addRange(n, n);
|
|
120
|
-
}
|
|
121
|
-
multiSelect(n) {
|
|
122
|
-
if (n < 0 || n >= this.items.length) return;
|
|
123
|
-
if (this.contains(n)) return;
|
|
124
|
-
this.currentIndex = this.addRange(n, n);
|
|
125
|
-
this.compact(n);
|
|
126
|
-
}
|
|
127
|
-
deselect(n) {
|
|
128
|
-
if (n < 0 || n >= this.items.length) return;
|
|
129
|
-
const r1 = this.ranges.find((r)=>r.contains(n)
|
|
130
|
-
);
|
|
131
|
-
if (!r1) return;
|
|
132
|
-
else if (r1.size === 1) this.removeRange(r1);
|
|
133
|
-
else if (r1.start === n) r1.start++;
|
|
134
|
-
else if (r1.end === n) r1.end--;
|
|
135
|
-
else {
|
|
136
|
-
this.removeRange(r1);
|
|
137
|
-
this.addRange(r1.start, n - 1);
|
|
138
|
-
this.currentIndex = this.addRange(n + 1, r1.end);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
getSelectedItems() {
|
|
142
|
-
return this.ranges.flatMap((range)=>range.map((index)=>this.items[index]
|
|
143
|
-
)
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
extend(n) {
|
|
147
|
-
if (n < 0 || n >= this.items.length) return;
|
|
148
|
-
if (this.isEmpty()) this.select(n);
|
|
149
|
-
else {
|
|
150
|
-
const anchor = this.getAnchor();
|
|
151
|
-
if (anchor !== null && this.current) {
|
|
152
|
-
const [start, end] = [
|
|
153
|
-
n,
|
|
154
|
-
anchor
|
|
155
|
-
].sort((a, b)=>a - b
|
|
156
|
-
);
|
|
157
|
-
this.current.start = start;
|
|
158
|
-
this.current.end = end;
|
|
159
|
-
this.compact(n);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
contains(n) {
|
|
164
|
-
if (n === null) return false;
|
|
165
|
-
return this.ranges.some((r)=>r.contains(n)
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
getRanges() {
|
|
169
|
-
return this.ranges.map((r)=>r.serialize()
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
clear() {
|
|
173
|
-
this.ranges = [];
|
|
174
|
-
this.currentIndex = null;
|
|
175
|
-
this.direction = "none";
|
|
176
|
-
}
|
|
177
|
-
serialize() {
|
|
178
|
-
return {
|
|
179
|
-
ranges: this.getRanges(),
|
|
180
|
-
currentIndex: this.currentIndex,
|
|
181
|
-
direction: this.direction
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
isEqual(other) {
|
|
185
|
-
if (other.ranges.length !== this.ranges.length) return false;
|
|
186
|
-
for(let i = 0; i < this.ranges.length; ++i){
|
|
187
|
-
if (!this.ranges[i].isEqual(other.ranges[i])) return false;
|
|
188
|
-
}
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
addRange(start, end) {
|
|
192
|
-
const r2 = new $043ce40ea783107b$export$9a58ef0d7ad3278c(start, end);
|
|
193
|
-
// Keep ranges sorted by start
|
|
194
|
-
const index = this.ranges.findIndex((r)=>r.start >= start
|
|
195
|
-
);
|
|
196
|
-
if (index === -1) this.ranges.push(r2);
|
|
197
|
-
else this.ranges.splice(index, 0, r2);
|
|
198
|
-
return index === -1 ? this.ranges.length - 1 : index;
|
|
199
|
-
}
|
|
200
|
-
removeRange(r) {
|
|
201
|
-
const index = this.ranges.indexOf(r);
|
|
202
|
-
this.ranges.splice(index, 1);
|
|
203
|
-
if (this.isEmpty()) this.currentIndex = null;
|
|
204
|
-
else if (index === this.currentIndex) this.currentIndex = this.ranges.length - 1;
|
|
205
|
-
}
|
|
206
|
-
isEmpty() {
|
|
207
|
-
return this.ranges.length === 0;
|
|
208
|
-
}
|
|
209
|
-
getAnchor() {
|
|
210
|
-
if (!this.current) return null;
|
|
211
|
-
return this.direction === "backward" ? this.current.end : this.current.start;
|
|
212
|
-
}
|
|
213
|
-
getFocus() {
|
|
214
|
-
if (!this.current) return -1;
|
|
215
|
-
return this.direction === "backward" ? this.current.start : this.current.end;
|
|
216
|
-
}
|
|
217
|
-
compact(focus) {
|
|
218
|
-
const removals = [];
|
|
219
|
-
const current = this.current;
|
|
220
|
-
for (let r3 of this.ranges){
|
|
221
|
-
if (!this.current || r3 === this.current) continue;
|
|
222
|
-
if (this.current.overlaps(r3)) {
|
|
223
|
-
this.current.combine(r3);
|
|
224
|
-
removals.push(r3);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
removals.forEach((r)=>this.removeRange(r)
|
|
228
|
-
);
|
|
229
|
-
if (current) this.currentIndex = this.ranges.indexOf(current);
|
|
230
|
-
if (!this.current) return;
|
|
231
|
-
if (this.current.start < focus) this.direction = "forward";
|
|
232
|
-
else if (this.current.end > focus) this.direction = "backward";
|
|
233
|
-
else this.direction = "none";
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const $b26f0eafd5701d7d$export$f6196a6c6bb539b4 = ()=>({
|
|
239
|
-
visibleIds: [],
|
|
240
|
-
cursor: {
|
|
241
|
-
type: "none"
|
|
242
|
-
},
|
|
243
|
-
editingId: null,
|
|
244
|
-
selection: {
|
|
245
|
-
data: null,
|
|
246
|
-
ids: []
|
|
247
|
-
}
|
|
248
|
-
})
|
|
249
|
-
;
|
|
250
|
-
const $b26f0eafd5701d7d$export$e324594224ef24da = {
|
|
251
|
-
setCursorLocation: (cursor)=>({
|
|
252
|
-
type: "SET_CURSOR_LOCATION",
|
|
253
|
-
cursor: cursor
|
|
254
|
-
})
|
|
255
|
-
,
|
|
256
|
-
setVisibleIds: (ids, idMap // id to index
|
|
257
|
-
)=>({
|
|
258
|
-
type: "SET_VISIBLE_IDS",
|
|
259
|
-
ids: ids,
|
|
260
|
-
idMap: idMap
|
|
261
|
-
})
|
|
262
|
-
,
|
|
263
|
-
select: (index, meta, shift)=>({
|
|
264
|
-
type: "SELECT",
|
|
265
|
-
index: index,
|
|
266
|
-
meta: meta,
|
|
267
|
-
shift: shift
|
|
268
|
-
})
|
|
269
|
-
,
|
|
270
|
-
selectId: (id)=>({
|
|
271
|
-
type: "SELECT_ID",
|
|
272
|
-
id: id
|
|
273
|
-
})
|
|
274
|
-
,
|
|
275
|
-
edit: (id)=>({
|
|
276
|
-
type: "EDIT",
|
|
277
|
-
id: id
|
|
278
|
-
})
|
|
279
|
-
,
|
|
280
|
-
stepUp: (shift, ids)=>({
|
|
281
|
-
type: "STEP_UP",
|
|
282
|
-
shift: shift
|
|
283
|
-
})
|
|
284
|
-
,
|
|
285
|
-
stepDown: (shift, ids)=>({
|
|
286
|
-
type: "STEP_DOWN",
|
|
287
|
-
shift: shift
|
|
288
|
-
})
|
|
289
|
-
};
|
|
290
|
-
function $b26f0eafd5701d7d$export$1650419e431d3ba3(state, action) {
|
|
291
|
-
switch(action.type){
|
|
292
|
-
case "EDIT":
|
|
293
|
-
return {
|
|
294
|
-
...state,
|
|
295
|
-
editingId: action.id
|
|
296
|
-
};
|
|
297
|
-
case "SET_CURSOR_LOCATION":
|
|
298
|
-
if ($b26f0eafd5701d7d$var$equal(state.cursor, action.cursor)) return state;
|
|
299
|
-
else return {
|
|
300
|
-
...state,
|
|
301
|
-
cursor: action.cursor
|
|
302
|
-
};
|
|
303
|
-
case "SELECT":
|
|
304
|
-
var s = $5ee99f971bd267fd$export$52baac22726c72bf.parse(state.selection.data, state.visibleIds);
|
|
305
|
-
if (action.index === null) s.clear();
|
|
306
|
-
else if (action.meta) {
|
|
307
|
-
if (s.contains(action.index)) s.deselect(action.index);
|
|
308
|
-
else s.multiSelect(action.index);
|
|
309
|
-
} else if (action.shift) s.extend(action.index);
|
|
310
|
-
else s.select(action.index);
|
|
311
|
-
return {
|
|
312
|
-
...state,
|
|
313
|
-
selection: {
|
|
314
|
-
data: s.serialize(),
|
|
315
|
-
ids: s.getSelectedItems()
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
case "SELECT_ID":
|
|
319
|
-
return {
|
|
320
|
-
...state,
|
|
321
|
-
selection: {
|
|
322
|
-
...state.selection,
|
|
323
|
-
ids: [
|
|
324
|
-
action.id
|
|
325
|
-
]
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
case "STEP_UP":
|
|
329
|
-
var s3 = $5ee99f971bd267fd$export$52baac22726c72bf.parse(state.selection.data, state.visibleIds);
|
|
330
|
-
var f = s3.getFocus();
|
|
331
|
-
if (action.shift) s3.extend(f - 1);
|
|
332
|
-
else s3.select(f - 1);
|
|
333
|
-
return {
|
|
334
|
-
...state,
|
|
335
|
-
selection: {
|
|
336
|
-
data: s3.serialize(),
|
|
337
|
-
ids: s3.getSelectedItems()
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
case "STEP_DOWN":
|
|
341
|
-
var s6 = $5ee99f971bd267fd$export$52baac22726c72bf.parse(state.selection.data, state.visibleIds);
|
|
342
|
-
var f2 = s6.getFocus();
|
|
343
|
-
if (action.shift) s6.extend(f2 + 1);
|
|
344
|
-
else s6.select(f2 + 1);
|
|
345
|
-
return {
|
|
346
|
-
...state,
|
|
347
|
-
selection: {
|
|
348
|
-
data: s6.serialize(),
|
|
349
|
-
ids: s6.getSelectedItems()
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
case "SET_VISIBLE_IDS":
|
|
353
|
-
// The visible ids changed
|
|
354
|
-
var ids = state.selection.ids;
|
|
355
|
-
// Start with a blank selection
|
|
356
|
-
var s2 = new $5ee99f971bd267fd$export$52baac22726c72bf([], null, "none", state.visibleIds);
|
|
357
|
-
// Add each of the old selected ids to this new selection
|
|
358
|
-
for (let id of ids)if (id in action.idMap) s2.multiSelect(action.idMap[id]);
|
|
359
|
-
return {
|
|
360
|
-
...state,
|
|
361
|
-
visibleIds: action.ids,
|
|
362
|
-
selection: {
|
|
363
|
-
ids: ids,
|
|
364
|
-
data: s2.serialize()
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
default:
|
|
368
|
-
return state;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
function $b26f0eafd5701d7d$var$equal(a, b) {
|
|
372
|
-
if (a === null || b === null) return false;
|
|
373
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
24
|
+
const $89e93131aae74bd9$export$f6d467aa8b3786af = (0, $g00cZ$createContext)(null);
|
|
25
|
+
function $89e93131aae74bd9$export$fd23f19d5d8f3033() {
|
|
26
|
+
const value = (0, $g00cZ$useContext)($89e93131aae74bd9$export$f6d467aa8b3786af);
|
|
27
|
+
if (value === null) throw new Error("Provide a NodesContext");
|
|
28
|
+
return value;
|
|
374
29
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const el = ref.current;
|
|
381
|
-
const cb = (e)=>{
|
|
382
|
-
if (e.code === "ArrowDown") {
|
|
383
|
-
e.preventDefault();
|
|
384
|
-
api.selectDownwards(e.shiftKey);
|
|
385
|
-
} else if (e.code === "ArrowUp") {
|
|
386
|
-
e.preventDefault();
|
|
387
|
-
api.selectUpwards(e.shiftKey);
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
el?.addEventListener("keydown", cb);
|
|
391
|
-
return ()=>{
|
|
392
|
-
el?.removeEventListener("keydown", cb);
|
|
393
|
-
};
|
|
394
|
-
}, [
|
|
395
|
-
ref,
|
|
396
|
-
api
|
|
397
|
-
]);
|
|
30
|
+
const $89e93131aae74bd9$export$2d5c5ceac203fc1e = (0, $g00cZ$createContext)(null);
|
|
31
|
+
function $89e93131aae74bd9$export$4930f6bf413be70e() {
|
|
32
|
+
const value = (0, $g00cZ$useContext)($89e93131aae74bd9$export$2d5c5ceac203fc1e);
|
|
33
|
+
if (value === null) throw new Error("Provide a DnDContext");
|
|
34
|
+
return value;
|
|
398
35
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
function $4dcb7be69f759cab$export$79f9fa345a841d8b(root) {
|
|
403
|
-
const list = [];
|
|
404
|
-
let index = 0;
|
|
405
|
-
function collect(node) {
|
|
406
|
-
if (node.level >= 0) {
|
|
407
|
-
node.rowIndex = index++;
|
|
408
|
-
list.push(node);
|
|
409
|
-
}
|
|
410
|
-
if (node.isOpen) node.children?.forEach(collect);
|
|
411
|
-
}
|
|
412
|
-
collect(root);
|
|
413
|
-
return list;
|
|
36
|
+
const $89e93131aae74bd9$export$d0c71bc5e3e2d897 = (0, $g00cZ$createContext)(0);
|
|
37
|
+
function $89e93131aae74bd9$export$83a4f9dc3b36edb8() {
|
|
38
|
+
(0, $g00cZ$useContext)($89e93131aae74bd9$export$d0c71bc5e3e2d897);
|
|
414
39
|
}
|
|
415
40
|
|
|
416
41
|
|
|
417
|
-
|
|
418
|
-
|
|
42
|
+
var $bfece7c4aed4e9c4$exports = {};
|
|
43
|
+
|
|
44
|
+
$parcel$export($bfece7c4aed4e9c4$exports, "TreeApi", () => $bfece7c4aed4e9c4$export$e2da3477247342d1);
|
|
45
|
+
var $0e6083160f4b36ed$exports = {};
|
|
46
|
+
|
|
47
|
+
$parcel$export($0e6083160f4b36ed$exports, "bound", () => $0e6083160f4b36ed$export$adf7c0fe6059d774);
|
|
48
|
+
$parcel$export($0e6083160f4b36ed$exports, "isItem", () => $0e6083160f4b36ed$export$5318634f2ee07019);
|
|
49
|
+
$parcel$export($0e6083160f4b36ed$exports, "isClosed", () => $0e6083160f4b36ed$export$4210f5ea57fbae57);
|
|
50
|
+
$parcel$export($0e6083160f4b36ed$exports, "isDecendent", () => $0e6083160f4b36ed$export$1e38f72c6c546f70);
|
|
51
|
+
$parcel$export($0e6083160f4b36ed$exports, "indexOf", () => $0e6083160f4b36ed$export$305f7d4e9d4624f2);
|
|
52
|
+
$parcel$export($0e6083160f4b36ed$exports, "noop", () => $0e6083160f4b36ed$export$8793edee2d425525);
|
|
53
|
+
$parcel$export($0e6083160f4b36ed$exports, "dfs", () => $0e6083160f4b36ed$export$51b654aff22fc5a6);
|
|
54
|
+
$parcel$export($0e6083160f4b36ed$exports, "focusNextElement", () => $0e6083160f4b36ed$export$3b0237e8566c8d65);
|
|
55
|
+
$parcel$export($0e6083160f4b36ed$exports, "focusPrevElement", () => $0e6083160f4b36ed$export$33b47db07a82b2fb);
|
|
56
|
+
$parcel$export($0e6083160f4b36ed$exports, "access", () => $0e6083160f4b36ed$export$9bb0e144ba4929ca);
|
|
57
|
+
$parcel$export($0e6083160f4b36ed$exports, "identifyNull", () => $0e6083160f4b36ed$export$611823266272db76);
|
|
58
|
+
$parcel$export($0e6083160f4b36ed$exports, "identify", () => $0e6083160f4b36ed$export$65e5b62a4c490288);
|
|
59
|
+
$parcel$export($0e6083160f4b36ed$exports, "mergeRefs", () => $0e6083160f4b36ed$export$c9058316764c140e);
|
|
60
|
+
$parcel$export($0e6083160f4b36ed$exports, "safeRun", () => $0e6083160f4b36ed$export$c6d63370cef03886);
|
|
61
|
+
$parcel$export($0e6083160f4b36ed$exports, "waitFor", () => $0e6083160f4b36ed$export$9bbfceb27f687c1b);
|
|
419
62
|
function $0e6083160f4b36ed$export$adf7c0fe6059d774(n, min, max) {
|
|
420
63
|
return Math.max(Math.min(n, max), min);
|
|
421
64
|
}
|
|
422
|
-
const $0e6083160f4b36ed$export$769c5e872f5f8638 = (node)=>!!node.children
|
|
423
|
-
;
|
|
424
65
|
function $0e6083160f4b36ed$export$5318634f2ee07019(node) {
|
|
425
|
-
return node &&
|
|
66
|
+
return node && node.isLeaf;
|
|
426
67
|
}
|
|
427
68
|
function $0e6083160f4b36ed$export$4210f5ea57fbae57(node) {
|
|
428
|
-
return node &&
|
|
69
|
+
return node && node.isInternal && !node.isOpen;
|
|
429
70
|
}
|
|
430
71
|
const $0e6083160f4b36ed$export$1e38f72c6c546f70 = (a, b)=>{
|
|
431
72
|
let n = a;
|
|
@@ -436,289 +77,648 @@ const $0e6083160f4b36ed$export$1e38f72c6c546f70 = (a, b)=>{
|
|
|
436
77
|
return false;
|
|
437
78
|
};
|
|
438
79
|
const $0e6083160f4b36ed$export$305f7d4e9d4624f2 = (node)=>{
|
|
439
|
-
// This should probably not throw an error, but instead return null
|
|
440
80
|
if (!node.parent) throw Error("Node does not have a parent");
|
|
441
|
-
return node.parent.children.findIndex((c)=>c.id === node.id
|
|
442
|
-
);
|
|
81
|
+
return node.parent.children.findIndex((c)=>c.id === node.id);
|
|
443
82
|
};
|
|
444
|
-
function $0e6083160f4b36ed$export$8793edee2d425525() {
|
|
83
|
+
function $0e6083160f4b36ed$export$8793edee2d425525() {}
|
|
84
|
+
function $0e6083160f4b36ed$export$51b654aff22fc5a6(node, id) {
|
|
85
|
+
if (!node) return null;
|
|
86
|
+
if (node.id === id) return node;
|
|
87
|
+
if (node.children) for (let child of node.children){
|
|
88
|
+
const result = $0e6083160f4b36ed$export$51b654aff22fc5a6(child, id);
|
|
89
|
+
if (result) return result;
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
function $0e6083160f4b36ed$export$3b0237e8566c8d65(target) {
|
|
94
|
+
const elements = $0e6083160f4b36ed$var$getFocusable(target);
|
|
95
|
+
let next;
|
|
96
|
+
for(let i = 0; i < elements.length; ++i){
|
|
97
|
+
const item = elements[i];
|
|
98
|
+
if (item === target) {
|
|
99
|
+
next = $0e6083160f4b36ed$var$nextItem(elements, i);
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// @ts-ignore ??
|
|
104
|
+
next?.focus();
|
|
105
|
+
}
|
|
106
|
+
function $0e6083160f4b36ed$export$33b47db07a82b2fb(target) {
|
|
107
|
+
const elements = $0e6083160f4b36ed$var$getFocusable(target);
|
|
108
|
+
let next;
|
|
109
|
+
for(let i = 0; i < elements.length; ++i){
|
|
110
|
+
const item = elements[i];
|
|
111
|
+
if (item === target) {
|
|
112
|
+
next = $0e6083160f4b36ed$var$prevItem(elements, i);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// @ts-ignore
|
|
117
|
+
next?.focus();
|
|
118
|
+
}
|
|
119
|
+
function $0e6083160f4b36ed$var$nextItem(list, index) {
|
|
120
|
+
if (index + 1 < list.length) return list[index + 1];
|
|
121
|
+
else return list[0];
|
|
122
|
+
}
|
|
123
|
+
function $0e6083160f4b36ed$var$prevItem(list, index) {
|
|
124
|
+
if (index - 1 >= 0) return list[index - 1];
|
|
125
|
+
else return list[list.length - 1];
|
|
126
|
+
}
|
|
127
|
+
function $0e6083160f4b36ed$var$getFocusable(target) {
|
|
128
|
+
return Array.from(document.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), details:not([disabled]), summary:not(:disabled)')).filter((e)=>e === target || !target.contains(e));
|
|
129
|
+
}
|
|
130
|
+
function $0e6083160f4b36ed$export$9bb0e144ba4929ca(obj, accessor) {
|
|
131
|
+
if (typeof accessor === "boolean") return accessor;
|
|
132
|
+
if (typeof accessor === "string") return obj[accessor];
|
|
133
|
+
return accessor(obj);
|
|
134
|
+
}
|
|
135
|
+
function $0e6083160f4b36ed$export$611823266272db76(obj) {
|
|
136
|
+
if (obj === null) return null;
|
|
137
|
+
else return $0e6083160f4b36ed$export$65e5b62a4c490288(obj);
|
|
138
|
+
}
|
|
139
|
+
function $0e6083160f4b36ed$export$65e5b62a4c490288(obj) {
|
|
140
|
+
return typeof obj === "string" ? obj : obj.id;
|
|
141
|
+
}
|
|
142
|
+
function $0e6083160f4b36ed$export$c9058316764c140e(...refs) {
|
|
143
|
+
return (instance)=>{
|
|
144
|
+
refs.forEach((ref)=>{
|
|
145
|
+
if (typeof ref === "function") ref(instance);
|
|
146
|
+
else if (ref != null) ref.current = instance;
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function $0e6083160f4b36ed$export$c6d63370cef03886(fn, ...args) {
|
|
151
|
+
if (fn) return fn(...args);
|
|
152
|
+
}
|
|
153
|
+
function $0e6083160f4b36ed$export$9bbfceb27f687c1b(fn) {
|
|
154
|
+
return new Promise((resolve, reject)=>{
|
|
155
|
+
let tries = 0;
|
|
156
|
+
function check() {
|
|
157
|
+
tries += 1;
|
|
158
|
+
if (tries === 100) reject();
|
|
159
|
+
if (fn()) resolve();
|
|
160
|
+
else setTimeout(check, 10);
|
|
161
|
+
}
|
|
162
|
+
check();
|
|
163
|
+
});
|
|
445
164
|
}
|
|
446
165
|
|
|
447
166
|
|
|
448
167
|
|
|
449
168
|
|
|
450
|
-
|
|
451
|
-
const $1b40c8f40669603d$var$placeholderStyle = {
|
|
169
|
+
const $fb4c15d8425379bd$var$placeholderStyle = {
|
|
452
170
|
display: "flex",
|
|
453
|
-
alignItems: "center"
|
|
171
|
+
alignItems: "center",
|
|
172
|
+
zIndex: 1
|
|
454
173
|
};
|
|
455
|
-
const $
|
|
174
|
+
const $fb4c15d8425379bd$var$lineStyle = {
|
|
456
175
|
flex: 1,
|
|
457
176
|
height: "2px",
|
|
458
177
|
background: "#4B91E2",
|
|
459
178
|
borderRadius: "1px"
|
|
460
179
|
};
|
|
461
|
-
const $
|
|
180
|
+
const $fb4c15d8425379bd$var$circleStyle = {
|
|
462
181
|
width: "4px",
|
|
463
182
|
height: "4px",
|
|
464
183
|
boxShadow: "0 0 0 3px #4B91E2",
|
|
465
184
|
borderRadius: "50%"
|
|
466
185
|
};
|
|
467
|
-
|
|
186
|
+
const $fb4c15d8425379bd$export$6cb3c16721363d11 = /*#__PURE__*/ (0, $g00cZ$react).memo(function DefaultCursor({ top: top , left: left , indent: indent }) {
|
|
468
187
|
const style = {
|
|
469
188
|
position: "absolute",
|
|
470
189
|
pointerEvents: "none",
|
|
471
190
|
top: top - 2 + "px",
|
|
472
|
-
left:
|
|
191
|
+
left: left + "px",
|
|
473
192
|
right: indent + "px"
|
|
474
193
|
};
|
|
475
|
-
return
|
|
194
|
+
return /*#__PURE__*/ (0, $g00cZ$jsxs)("div", {
|
|
476
195
|
style: {
|
|
477
|
-
...$
|
|
196
|
+
...$fb4c15d8425379bd$var$placeholderStyle,
|
|
478
197
|
...style
|
|
479
198
|
},
|
|
480
199
|
children: [
|
|
481
|
-
/*#__PURE__*/ $g00cZ$jsx("div", {
|
|
200
|
+
/*#__PURE__*/ (0, $g00cZ$jsx)("div", {
|
|
482
201
|
style: {
|
|
483
|
-
...$
|
|
202
|
+
...$fb4c15d8425379bd$var$circleStyle
|
|
484
203
|
}
|
|
485
204
|
}),
|
|
486
|
-
/*#__PURE__*/ $g00cZ$jsx("div", {
|
|
205
|
+
/*#__PURE__*/ (0, $g00cZ$jsx)("div", {
|
|
487
206
|
style: {
|
|
488
|
-
...$
|
|
207
|
+
...$fb4c15d8425379bd$var$lineStyle
|
|
489
208
|
}
|
|
490
209
|
})
|
|
491
210
|
]
|
|
492
|
-
})
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
function $164e874d21fcd87e$export$f9c541e71856c524({ node: node , attrs: attrs , innerRef: innerRef , children: children }) {
|
|
218
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)("div", {
|
|
219
|
+
...attrs,
|
|
220
|
+
ref: innerRef,
|
|
221
|
+
onFocus: (e)=>e.stopPropagation(),
|
|
222
|
+
onClick: node.handleClick,
|
|
223
|
+
children: children
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
function $c4edd692d5290432$export$909e23cbfbbd3351(props) {
|
|
231
|
+
return /*#__PURE__*/ (0, $g00cZ$jsxs)("div", {
|
|
232
|
+
ref: props.dragHandle,
|
|
233
|
+
style: props.style,
|
|
234
|
+
children: [
|
|
235
|
+
/*#__PURE__*/ (0, $g00cZ$jsx)("span", {
|
|
236
|
+
onClick: (e)=>{
|
|
237
|
+
e.stopPropagation();
|
|
238
|
+
props.node.toggle();
|
|
239
|
+
},
|
|
240
|
+
children: props.node.isLeaf ? "\uD83C\uDF33" : props.node.isOpen ? "\uD83D\uDDC1" : "\uD83D\uDDC0"
|
|
241
|
+
}),
|
|
242
|
+
" ",
|
|
243
|
+
props.node.isEditing ? /*#__PURE__*/ (0, $g00cZ$jsx)($c4edd692d5290432$var$Edit, {
|
|
244
|
+
...props
|
|
245
|
+
}) : /*#__PURE__*/ (0, $g00cZ$jsx)($c4edd692d5290432$var$Show, {
|
|
246
|
+
...props
|
|
247
|
+
})
|
|
248
|
+
]
|
|
249
|
+
});
|
|
493
250
|
}
|
|
494
|
-
function $
|
|
495
|
-
return
|
|
496
|
-
|
|
497
|
-
|
|
251
|
+
function $c4edd692d5290432$var$Show(props) {
|
|
252
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)((0, $g00cZ$Fragment), {
|
|
253
|
+
children: /*#__PURE__*/ (0, $g00cZ$jsx)("span", {
|
|
254
|
+
children: props.node.data.name
|
|
255
|
+
})
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function $c4edd692d5290432$var$Edit({ node: node }) {
|
|
259
|
+
const input = (0, $g00cZ$useRef)();
|
|
260
|
+
(0, $g00cZ$useEffect)(()=>{
|
|
261
|
+
input.current?.focus();
|
|
262
|
+
input.current?.select();
|
|
263
|
+
}, []);
|
|
264
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)("input", {
|
|
265
|
+
ref: input,
|
|
266
|
+
// @ts-ignore
|
|
267
|
+
defaultValue: node.data.name,
|
|
268
|
+
onBlur: ()=>node.reset(),
|
|
269
|
+
onKeyDown: (e)=>{
|
|
270
|
+
if (e.key === "Escape") node.reset();
|
|
271
|
+
if (e.key === "Enter") node.submit(input.current?.value || "");
|
|
272
|
+
}
|
|
273
|
+
});
|
|
498
274
|
}
|
|
499
275
|
|
|
500
276
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
277
|
+
function $21783d2b0251be67$export$e1a8e267487c59d1(id) {
|
|
278
|
+
return {
|
|
279
|
+
type: "EDIT",
|
|
280
|
+
id: id
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function $21783d2b0251be67$export$1650419e431d3ba3(state = {
|
|
284
|
+
id: null
|
|
285
|
+
}, action) {
|
|
286
|
+
if (action.type === "EDIT") return {
|
|
287
|
+
...state,
|
|
288
|
+
id: action.id
|
|
289
|
+
};
|
|
290
|
+
else return state;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
function $c27b8e9863235052$export$d7ddd398f22d79ef(id) {
|
|
295
|
+
return {
|
|
296
|
+
type: "FOCUS",
|
|
297
|
+
id: id
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function $c27b8e9863235052$export$6b6c976e46a06288() {
|
|
301
|
+
return {
|
|
302
|
+
type: "TREE_BLUR"
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
function $c27b8e9863235052$export$1650419e431d3ba3(state = {
|
|
306
|
+
id: null,
|
|
307
|
+
treeFocused: false
|
|
308
|
+
}, action) {
|
|
309
|
+
if (action.type === "FOCUS") return {
|
|
310
|
+
...state,
|
|
311
|
+
id: action.id,
|
|
312
|
+
treeFocused: true
|
|
313
|
+
};
|
|
314
|
+
else if (action.type === "TREE_BLUR") return {
|
|
315
|
+
...state,
|
|
316
|
+
treeFocused: false
|
|
317
|
+
};
|
|
318
|
+
else return state;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
var $096e74084443e9a3$exports = {};
|
|
323
|
+
|
|
324
|
+
$parcel$export($096e74084443e9a3$exports, "NodeApi", () => $096e74084443e9a3$export$d4b903da0f522dc8);
|
|
325
|
+
|
|
326
|
+
class $096e74084443e9a3$export$d4b903da0f522dc8 {
|
|
327
|
+
constructor(params){
|
|
328
|
+
this.tree = params.tree;
|
|
329
|
+
this.id = params.id;
|
|
330
|
+
this.data = params.data;
|
|
331
|
+
this.level = params.level;
|
|
332
|
+
this.children = params.children;
|
|
333
|
+
this.parent = params.parent;
|
|
334
|
+
this.isDraggable = params.isDraggable;
|
|
335
|
+
this.isDroppable = params.isDroppable;
|
|
336
|
+
this.rowIndex = params.rowIndex;
|
|
542
337
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
this.dispatch($b26f0eafd5701d7d$export$e324594224ef24da.edit(null));
|
|
546
|
-
this.resolveEdit(sid, {
|
|
547
|
-
cancelled: true
|
|
548
|
-
});
|
|
338
|
+
get isRoot() {
|
|
339
|
+
return this.id === (0, $81080a351c006222$export$ec71a3379b43ae5c);
|
|
549
340
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
if (resolve) resolve(value);
|
|
553
|
-
this.edits.delete(id);
|
|
341
|
+
get isLeaf() {
|
|
342
|
+
return !Array.isArray(this.children);
|
|
554
343
|
}
|
|
555
|
-
|
|
556
|
-
this.
|
|
344
|
+
get isInternal() {
|
|
345
|
+
return !this.isLeaf;
|
|
557
346
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
this.select(index, meta, shift);
|
|
347
|
+
get isOpen() {
|
|
348
|
+
return this.isLeaf ? false : this.tree.isOpen(this.id);
|
|
561
349
|
}
|
|
562
|
-
|
|
563
|
-
this.
|
|
350
|
+
get isEditing() {
|
|
351
|
+
return this.tree.editingId === this.id;
|
|
564
352
|
}
|
|
565
|
-
|
|
566
|
-
this.
|
|
353
|
+
get isSelected() {
|
|
354
|
+
return this.tree.isSelected(this.id);
|
|
567
355
|
}
|
|
568
|
-
|
|
569
|
-
this.
|
|
570
|
-
type: "none"
|
|
571
|
-
}));
|
|
356
|
+
get isSelectedStart() {
|
|
357
|
+
return this.isSelected && !this.prev?.isSelected;
|
|
572
358
|
}
|
|
573
|
-
|
|
574
|
-
this.
|
|
359
|
+
get isSelectedEnd() {
|
|
360
|
+
return this.isSelected && !this.next?.isSelected;
|
|
575
361
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
const index1 = this.idToIndex[id];
|
|
579
|
-
if (index1) this.list.current?.scrollToItem(index1);
|
|
580
|
-
else {
|
|
581
|
-
this.openParents(id);
|
|
582
|
-
$g00cZ$reactdom.flushSync(()=>{
|
|
583
|
-
const index = this.idToIndex[id];
|
|
584
|
-
if (index) this.list.current?.scrollToItem(index);
|
|
585
|
-
});
|
|
586
|
-
}
|
|
362
|
+
get isFocused() {
|
|
363
|
+
return this.tree.isFocused(this.id);
|
|
587
364
|
}
|
|
588
|
-
|
|
589
|
-
this.
|
|
365
|
+
get isDragging() {
|
|
366
|
+
return this.tree.isDragging(this.id);
|
|
590
367
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
let parent = node?.parent;
|
|
594
|
-
while(parent){
|
|
595
|
-
this.open(parent.id);
|
|
596
|
-
parent = parent.parent;
|
|
597
|
-
}
|
|
368
|
+
get willReceiveDrop() {
|
|
369
|
+
return this.tree.willReceiveDrop(this.id);
|
|
598
370
|
}
|
|
599
|
-
get
|
|
600
|
-
return
|
|
371
|
+
get state() {
|
|
372
|
+
return {
|
|
373
|
+
isEditing: this.isEditing,
|
|
374
|
+
isDragging: this.isDragging,
|
|
375
|
+
isSelected: this.isSelected,
|
|
376
|
+
isSelectedStart: this.isSelectedStart,
|
|
377
|
+
isSelectedEnd: this.isSelectedEnd,
|
|
378
|
+
isFocused: this.isFocused,
|
|
379
|
+
isOpen: this.isOpen,
|
|
380
|
+
willReceiveDrop: this.willReceiveDrop
|
|
381
|
+
};
|
|
601
382
|
}
|
|
602
|
-
get
|
|
603
|
-
return
|
|
383
|
+
get childIndex() {
|
|
384
|
+
if (this.parent && this.parent.children) return this.parent.children.findIndex((child)=>child.id === this.id);
|
|
385
|
+
else return -1;
|
|
604
386
|
}
|
|
605
|
-
get
|
|
606
|
-
|
|
387
|
+
get next() {
|
|
388
|
+
if (this.rowIndex === null) return null;
|
|
389
|
+
return this.tree.at(this.rowIndex + 1);
|
|
607
390
|
}
|
|
608
|
-
get
|
|
609
|
-
|
|
391
|
+
get prev() {
|
|
392
|
+
if (this.rowIndex === null) return null;
|
|
393
|
+
return this.tree.at(this.rowIndex - 1);
|
|
610
394
|
}
|
|
611
|
-
get
|
|
612
|
-
|
|
395
|
+
get nextSibling() {
|
|
396
|
+
const i = this.childIndex;
|
|
397
|
+
return this.parent?.children[i + 1] ?? null;
|
|
613
398
|
}
|
|
614
|
-
|
|
615
|
-
|
|
399
|
+
select() {
|
|
400
|
+
this.tree.select(this);
|
|
616
401
|
}
|
|
617
|
-
|
|
618
|
-
|
|
402
|
+
deselect() {
|
|
403
|
+
this.tree.deselect(this);
|
|
619
404
|
}
|
|
620
|
-
|
|
621
|
-
|
|
405
|
+
selectMulti() {
|
|
406
|
+
this.tree.selectMulti(this);
|
|
622
407
|
}
|
|
623
|
-
|
|
624
|
-
|
|
408
|
+
selectContiguous() {
|
|
409
|
+
this.tree.selectContiguous(this);
|
|
625
410
|
}
|
|
626
|
-
|
|
627
|
-
|
|
411
|
+
activate() {
|
|
412
|
+
this.tree.activate(this);
|
|
628
413
|
}
|
|
629
|
-
|
|
630
|
-
|
|
414
|
+
focus() {
|
|
415
|
+
this.tree.focus(this);
|
|
631
416
|
}
|
|
632
|
-
|
|
633
|
-
|
|
417
|
+
toggle() {
|
|
418
|
+
this.tree.toggle(this);
|
|
634
419
|
}
|
|
635
|
-
|
|
636
|
-
|
|
420
|
+
open() {
|
|
421
|
+
this.tree.open(this);
|
|
637
422
|
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
switch(cursor.type){
|
|
641
|
-
case "highlight":
|
|
642
|
-
return cursor.id;
|
|
643
|
-
default:
|
|
644
|
-
return null;
|
|
645
|
-
}
|
|
423
|
+
openParents() {
|
|
424
|
+
this.tree.openParents(this);
|
|
646
425
|
}
|
|
647
|
-
|
|
648
|
-
|
|
426
|
+
close() {
|
|
427
|
+
this.tree.close(this);
|
|
649
428
|
}
|
|
650
|
-
|
|
651
|
-
|
|
429
|
+
submit(value) {
|
|
430
|
+
this.tree.submit(this, value);
|
|
652
431
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
return selection.contains(index);
|
|
432
|
+
reset() {
|
|
433
|
+
this.tree.reset();
|
|
656
434
|
}
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
435
|
+
clone() {
|
|
436
|
+
return new $096e74084443e9a3$export$d4b903da0f522dc8({
|
|
437
|
+
...this
|
|
438
|
+
});
|
|
660
439
|
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
)
|
|
664
|
-
);
|
|
665
|
-
const $40fcfa3e17312481$var$createIndex = $g00cZ$memoizeone((nodes)=>{
|
|
666
|
-
return nodes.reduce((map, node, index)=>{
|
|
667
|
-
map[node.id] = index;
|
|
668
|
-
return map;
|
|
669
|
-
}, {
|
|
670
|
-
});
|
|
671
|
-
});
|
|
672
|
-
const $40fcfa3e17312481$var$createList = $g00cZ$memoizeone($4dcb7be69f759cab$export$79f9fa345a841d8b);
|
|
673
|
-
function $40fcfa3e17312481$var$dfs(node, id) {
|
|
674
|
-
if (!node) return null;
|
|
675
|
-
if (node.id === id) return node;
|
|
676
|
-
if (node.children) for (let child of node.children){
|
|
677
|
-
const result = $40fcfa3e17312481$var$dfs(child, id);
|
|
678
|
-
if (result) return result;
|
|
440
|
+
edit() {
|
|
441
|
+
return this.tree.edit(this);
|
|
679
442
|
}
|
|
680
|
-
|
|
443
|
+
handleClick = (e)=>{
|
|
444
|
+
if (e.metaKey) this.isSelected ? this.deselect() : this.selectMulti();
|
|
445
|
+
else if (e.shiftKey) this.selectContiguous();
|
|
446
|
+
else {
|
|
447
|
+
this.select();
|
|
448
|
+
this.activate();
|
|
449
|
+
}
|
|
450
|
+
};
|
|
681
451
|
}
|
|
682
452
|
|
|
683
453
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
children:
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
454
|
+
const $81080a351c006222$export$ec71a3379b43ae5c = "__REACT_ARBORIST_INTERNAL_ROOT__";
|
|
455
|
+
function $81080a351c006222$export$882461b6382ed46c(tree) {
|
|
456
|
+
function visitSelfAndChildren(data, level, parent) {
|
|
457
|
+
const id = tree.accessId(data);
|
|
458
|
+
const node = new (0, $096e74084443e9a3$export$d4b903da0f522dc8)({
|
|
459
|
+
tree: tree,
|
|
460
|
+
data: data,
|
|
461
|
+
level: level,
|
|
462
|
+
parent: parent,
|
|
463
|
+
id: id,
|
|
464
|
+
children: null,
|
|
465
|
+
isDraggable: tree.isDraggable(data),
|
|
466
|
+
isDroppable: tree.isDroppable(data),
|
|
467
|
+
rowIndex: null
|
|
468
|
+
});
|
|
469
|
+
const children = tree.accessChildren(data);
|
|
470
|
+
if (children) node.children = children.map((child)=>visitSelfAndChildren(child, level + 1, node));
|
|
471
|
+
return node;
|
|
472
|
+
}
|
|
473
|
+
const root = new (0, $096e74084443e9a3$export$d4b903da0f522dc8)({
|
|
474
|
+
tree: tree,
|
|
475
|
+
id: $81080a351c006222$export$ec71a3379b43ae5c,
|
|
476
|
+
// @ts-ignore
|
|
477
|
+
data: {
|
|
478
|
+
id: $81080a351c006222$export$ec71a3379b43ae5c
|
|
479
|
+
},
|
|
480
|
+
level: -1,
|
|
481
|
+
parent: null,
|
|
482
|
+
children: null,
|
|
483
|
+
isDraggable: true,
|
|
484
|
+
isDroppable: true,
|
|
485
|
+
rowIndex: null
|
|
486
|
+
});
|
|
487
|
+
const data = tree.props.data ?? [];
|
|
488
|
+
root.children = data.map((child)=>{
|
|
489
|
+
return visitSelfAndChildren(child, 0, root);
|
|
490
|
+
});
|
|
491
|
+
return root;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
const $3c0bad2888bcd4bc$export$e324594224ef24da = {
|
|
496
|
+
open (id, filtered) {
|
|
497
|
+
return {
|
|
498
|
+
type: "VISIBILITY_OPEN",
|
|
499
|
+
id: id,
|
|
500
|
+
filtered: filtered
|
|
501
|
+
};
|
|
502
|
+
},
|
|
503
|
+
close (id, filtered) {
|
|
504
|
+
return {
|
|
505
|
+
type: "VISIBILITY_CLOSE",
|
|
506
|
+
id: id,
|
|
507
|
+
filtered: filtered
|
|
508
|
+
};
|
|
509
|
+
},
|
|
510
|
+
toggle (id, filtered) {
|
|
511
|
+
return {
|
|
512
|
+
type: "VISIBILITY_TOGGLE",
|
|
513
|
+
id: id,
|
|
514
|
+
filtered: filtered
|
|
515
|
+
};
|
|
516
|
+
},
|
|
517
|
+
clear (filtered) {
|
|
518
|
+
return {
|
|
519
|
+
type: "VISIBILITY_CLEAR",
|
|
520
|
+
filtered: filtered
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
/* Reducer */ function $3c0bad2888bcd4bc$var$openMapReducer(state = {}, action) {
|
|
525
|
+
if (action.type === "VISIBILITY_OPEN") return {
|
|
526
|
+
...state,
|
|
527
|
+
[action.id]: true
|
|
528
|
+
};
|
|
529
|
+
else if (action.type === "VISIBILITY_CLOSE") return {
|
|
530
|
+
...state,
|
|
531
|
+
[action.id]: false
|
|
532
|
+
};
|
|
533
|
+
else if (action.type === "VISIBILITY_TOGGLE") {
|
|
534
|
+
const prev = state[action.id];
|
|
535
|
+
return {
|
|
536
|
+
...state,
|
|
537
|
+
[action.id]: !prev
|
|
538
|
+
};
|
|
539
|
+
} else if (action.type === "VISIBILITY_CLEAR") return {};
|
|
540
|
+
else return state;
|
|
541
|
+
}
|
|
542
|
+
function $3c0bad2888bcd4bc$export$1650419e431d3ba3(state = {
|
|
543
|
+
filtered: {},
|
|
544
|
+
unfiltered: {}
|
|
545
|
+
}, action) {
|
|
546
|
+
if (!action.type.startsWith("VISIBILITY")) return state;
|
|
547
|
+
if (action.filtered) return {
|
|
548
|
+
...state,
|
|
549
|
+
filtered: $3c0bad2888bcd4bc$var$openMapReducer(state.filtered, action)
|
|
550
|
+
};
|
|
551
|
+
else return {
|
|
552
|
+
...state,
|
|
553
|
+
unfiltered: $3c0bad2888bcd4bc$var$openMapReducer(state.unfiltered, action)
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
const $6ad32e02250c922e$export$d4c72bab9d6cc13a = (props)=>({
|
|
560
|
+
nodes: {
|
|
561
|
+
// Changes together
|
|
562
|
+
open: {
|
|
563
|
+
filtered: {},
|
|
564
|
+
unfiltered: props?.initialOpenState ?? {}
|
|
565
|
+
},
|
|
566
|
+
focus: {
|
|
567
|
+
id: null,
|
|
568
|
+
treeFocused: false
|
|
569
|
+
},
|
|
570
|
+
edit: {
|
|
571
|
+
id: null
|
|
572
|
+
},
|
|
573
|
+
drag: {
|
|
574
|
+
id: null,
|
|
575
|
+
idWillReceiveDrop: null
|
|
576
|
+
},
|
|
577
|
+
selection: {
|
|
578
|
+
ids: new Set(),
|
|
579
|
+
anchor: null,
|
|
580
|
+
mostRecent: null
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
dnd: {
|
|
584
|
+
cursor: {
|
|
585
|
+
type: "none"
|
|
586
|
+
},
|
|
587
|
+
dragId: null
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
const $37bc167debff36d2$export$e324594224ef24da = {
|
|
593
|
+
clear: ()=>({
|
|
594
|
+
type: "SELECTION_CLEAR"
|
|
595
|
+
}),
|
|
596
|
+
only: (id)=>({
|
|
597
|
+
type: "SELECTION_ONLY",
|
|
598
|
+
id: (0, $0e6083160f4b36ed$export$65e5b62a4c490288)(id)
|
|
599
|
+
}),
|
|
600
|
+
add: (id)=>({
|
|
601
|
+
type: "SELECTION_ADD",
|
|
602
|
+
ids: (Array.isArray(id) ? id : [
|
|
603
|
+
id
|
|
604
|
+
]).map((0, $0e6083160f4b36ed$export$65e5b62a4c490288))
|
|
605
|
+
}),
|
|
606
|
+
remove: (id)=>({
|
|
607
|
+
type: "SELECTION_REMOVE",
|
|
608
|
+
ids: (Array.isArray(id) ? id : [
|
|
609
|
+
id
|
|
610
|
+
]).map((0, $0e6083160f4b36ed$export$65e5b62a4c490288))
|
|
611
|
+
}),
|
|
612
|
+
set: (ids)=>({
|
|
613
|
+
type: "SELECTION_SET",
|
|
614
|
+
ids: ids
|
|
615
|
+
}),
|
|
616
|
+
mostRecent: (id)=>({
|
|
617
|
+
type: "SELECTION_MOST_RECENT",
|
|
618
|
+
id: id === null ? null : (0, $0e6083160f4b36ed$export$65e5b62a4c490288)(id)
|
|
619
|
+
}),
|
|
620
|
+
anchor: (id)=>({
|
|
621
|
+
type: "SELECTION_ANCHOR",
|
|
622
|
+
id: id === null ? null : (0, $0e6083160f4b36ed$export$65e5b62a4c490288)(id)
|
|
623
|
+
})
|
|
624
|
+
};
|
|
625
|
+
function $37bc167debff36d2$export$1650419e431d3ba3(state = (0, $6ad32e02250c922e$export$d4c72bab9d6cc13a)()["nodes"]["selection"], action) {
|
|
626
|
+
const ids = state.ids;
|
|
627
|
+
switch(action.type){
|
|
628
|
+
case "SELECTION_CLEAR":
|
|
629
|
+
return {
|
|
630
|
+
...state,
|
|
631
|
+
ids: new Set()
|
|
632
|
+
};
|
|
633
|
+
case "SELECTION_ONLY":
|
|
634
|
+
return {
|
|
635
|
+
...state,
|
|
636
|
+
ids: new Set([
|
|
637
|
+
action.id
|
|
638
|
+
])
|
|
639
|
+
};
|
|
640
|
+
case "SELECTION_ADD":
|
|
641
|
+
if (action.ids.length === 0) return state;
|
|
642
|
+
action.ids.forEach((id)=>ids.add(id));
|
|
643
|
+
return {
|
|
644
|
+
...state,
|
|
645
|
+
ids: new Set(ids)
|
|
646
|
+
};
|
|
647
|
+
case "SELECTION_REMOVE":
|
|
648
|
+
if (action.ids.length === 0) return state;
|
|
649
|
+
action.ids.forEach((id)=>ids.delete(id));
|
|
650
|
+
return {
|
|
651
|
+
...state,
|
|
652
|
+
ids: new Set(ids)
|
|
653
|
+
};
|
|
654
|
+
case "SELECTION_SET":
|
|
655
|
+
return {
|
|
656
|
+
...state,
|
|
657
|
+
ids: new Set(action.ids)
|
|
658
|
+
};
|
|
659
|
+
case "SELECTION_MOST_RECENT":
|
|
660
|
+
return {
|
|
661
|
+
...state,
|
|
662
|
+
mostRecent: action.id
|
|
663
|
+
};
|
|
664
|
+
case "SELECTION_ANCHOR":
|
|
665
|
+
return {
|
|
666
|
+
...state,
|
|
667
|
+
anchor: action.id
|
|
668
|
+
};
|
|
669
|
+
default:
|
|
670
|
+
return state;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
const $59f144a8dd651e5e$export$e324594224ef24da = {
|
|
677
|
+
cursor (cursor) {
|
|
678
|
+
return {
|
|
679
|
+
type: "DND_CURSOR",
|
|
680
|
+
cursor: cursor
|
|
681
|
+
};
|
|
682
|
+
},
|
|
683
|
+
dragStart (id) {
|
|
684
|
+
return {
|
|
685
|
+
type: "DND_DRAG_START",
|
|
686
|
+
id: id
|
|
687
|
+
};
|
|
688
|
+
},
|
|
689
|
+
dragEnd () {
|
|
690
|
+
return {
|
|
691
|
+
type: "DND_DRAG_END"
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
function $59f144a8dd651e5e$export$1650419e431d3ba3(state = (0, $6ad32e02250c922e$export$d4c72bab9d6cc13a)()["dnd"], action) {
|
|
696
|
+
switch(action.type){
|
|
697
|
+
case "DND_CURSOR":
|
|
698
|
+
return {
|
|
699
|
+
...state,
|
|
700
|
+
cursor: action.cursor
|
|
701
|
+
};
|
|
702
|
+
case "DND_DRAG_START":
|
|
703
|
+
return {
|
|
704
|
+
...state,
|
|
705
|
+
dragId: action.id
|
|
706
|
+
};
|
|
707
|
+
case "DND_DRAG_END":
|
|
708
|
+
return {
|
|
709
|
+
...state,
|
|
710
|
+
dragId: null
|
|
711
|
+
};
|
|
712
|
+
default:
|
|
713
|
+
return state;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
716
|
|
|
717
717
|
|
|
718
718
|
|
|
719
719
|
|
|
720
720
|
|
|
721
|
-
const $
|
|
721
|
+
const $77d34d95e44d2f58$var$layerStyles = {
|
|
722
722
|
position: "fixed",
|
|
723
723
|
pointerEvents: "none",
|
|
724
724
|
zIndex: 100,
|
|
@@ -727,7 +727,7 @@ const $6d8109ab8cbcd5e7$var$layerStyles = {
|
|
|
727
727
|
width: "100%",
|
|
728
728
|
height: "100%"
|
|
729
729
|
};
|
|
730
|
-
const $
|
|
730
|
+
const $77d34d95e44d2f58$var$getStyle = (offset)=>{
|
|
731
731
|
if (!offset) return {
|
|
732
732
|
display: "none"
|
|
733
733
|
};
|
|
@@ -736,7 +736,7 @@ const $6d8109ab8cbcd5e7$var$getStyle = (offset)=>{
|
|
|
736
736
|
transform: `translate(${x}px, ${y}px)`
|
|
737
737
|
};
|
|
738
738
|
};
|
|
739
|
-
const $
|
|
739
|
+
const $77d34d95e44d2f58$var$getCountStyle = (offset)=>{
|
|
740
740
|
if (!offset) return {
|
|
741
741
|
display: "none"
|
|
742
742
|
};
|
|
@@ -745,96 +745,195 @@ const $6d8109ab8cbcd5e7$var$getCountStyle = (offset)=>{
|
|
|
745
745
|
transform: `translate(${x + 10}px, ${y + 10}px)`
|
|
746
746
|
};
|
|
747
747
|
};
|
|
748
|
-
function $
|
|
749
|
-
|
|
750
|
-
offset: m.getSourceClientOffset(),
|
|
751
|
-
mouse: m.getClientOffset(),
|
|
752
|
-
item: m.getItem(),
|
|
753
|
-
isDragging: m.isDragging()
|
|
754
|
-
})
|
|
755
|
-
);
|
|
756
|
-
return(/*#__PURE__*/ $g00cZ$jsxs($6d8109ab8cbcd5e7$var$Overlay, {
|
|
748
|
+
function $77d34d95e44d2f58$export$84e211ad8431a387({ offset: offset , mouse: mouse , id: id , dragIds: dragIds , isDragging: isDragging }) {
|
|
749
|
+
return /*#__PURE__*/ (0, $g00cZ$jsxs)($77d34d95e44d2f58$var$Overlay, {
|
|
757
750
|
isDragging: isDragging,
|
|
758
751
|
children: [
|
|
759
|
-
/*#__PURE__*/ $g00cZ$jsx($
|
|
752
|
+
/*#__PURE__*/ (0, $g00cZ$jsx)($77d34d95e44d2f58$var$Position, {
|
|
760
753
|
offset: offset,
|
|
761
|
-
children: /*#__PURE__*/ $g00cZ$jsx($
|
|
762
|
-
|
|
754
|
+
children: /*#__PURE__*/ (0, $g00cZ$jsx)($77d34d95e44d2f58$var$PreviewNode, {
|
|
755
|
+
id: id,
|
|
756
|
+
dragIds: dragIds
|
|
763
757
|
})
|
|
764
758
|
}),
|
|
765
|
-
/*#__PURE__*/ $g00cZ$jsx($
|
|
759
|
+
/*#__PURE__*/ (0, $g00cZ$jsx)($77d34d95e44d2f58$var$Count, {
|
|
766
760
|
mouse: mouse,
|
|
767
|
-
|
|
761
|
+
count: dragIds.length
|
|
768
762
|
})
|
|
769
763
|
]
|
|
770
|
-
})
|
|
764
|
+
});
|
|
771
765
|
}
|
|
772
|
-
const $
|
|
766
|
+
const $77d34d95e44d2f58$var$Overlay = /*#__PURE__*/ (0, $g00cZ$memo)(function Overlay(props) {
|
|
773
767
|
if (!props.isDragging) return null;
|
|
774
|
-
return
|
|
775
|
-
style: $
|
|
768
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)("div", {
|
|
769
|
+
style: $77d34d95e44d2f58$var$layerStyles,
|
|
776
770
|
children: props.children
|
|
777
|
-
})
|
|
771
|
+
});
|
|
778
772
|
});
|
|
779
|
-
function $
|
|
780
|
-
return
|
|
773
|
+
function $77d34d95e44d2f58$var$Position(props) {
|
|
774
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)("div", {
|
|
781
775
|
className: "row preview",
|
|
782
|
-
style: $
|
|
776
|
+
style: $77d34d95e44d2f58$var$getStyle(props.offset),
|
|
783
777
|
children: props.children
|
|
784
|
-
})
|
|
778
|
+
});
|
|
785
779
|
}
|
|
786
|
-
function $
|
|
787
|
-
const {
|
|
788
|
-
if (
|
|
780
|
+
function $77d34d95e44d2f58$var$Count(props) {
|
|
781
|
+
const { count: count , mouse: mouse } = props;
|
|
782
|
+
if (count > 1) return /*#__PURE__*/ (0, $g00cZ$jsx)("div", {
|
|
789
783
|
className: "selected-count",
|
|
790
|
-
style: $
|
|
791
|
-
children:
|
|
792
|
-
})
|
|
784
|
+
style: $77d34d95e44d2f58$var$getCountStyle(mouse),
|
|
785
|
+
children: count
|
|
786
|
+
});
|
|
793
787
|
else return null;
|
|
794
788
|
}
|
|
795
|
-
const $
|
|
796
|
-
const tree = $
|
|
797
|
-
|
|
798
|
-
const node = tree.getNode(props.item.id);
|
|
789
|
+
const $77d34d95e44d2f58$var$PreviewNode = /*#__PURE__*/ (0, $g00cZ$memo)(function PreviewNode(props) {
|
|
790
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)();
|
|
791
|
+
const node = tree.get(props.id);
|
|
799
792
|
if (!node) return null;
|
|
800
|
-
return
|
|
793
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)(tree.renderNode, {
|
|
801
794
|
preview: true,
|
|
802
|
-
|
|
795
|
+
node: node,
|
|
796
|
+
style: {
|
|
797
|
+
paddingLeft: node.level * tree.indent,
|
|
798
|
+
opacity: 0.2,
|
|
799
|
+
background: "transparent"
|
|
803
800
|
},
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
801
|
+
tree: tree
|
|
802
|
+
});
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
function $f608be224a71d6f5$export$ef961593063b03e8() {
|
|
816
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)();
|
|
817
|
+
const state = (0, $89e93131aae74bd9$export$4930f6bf413be70e)();
|
|
818
|
+
const cursor = state.cursor;
|
|
819
|
+
if (!cursor || cursor.type !== "line") return null;
|
|
820
|
+
const indent = tree.indent;
|
|
821
|
+
const top = tree.rowHeight * cursor.index + ((tree.props.padding ?? tree.props.paddingTop) ?? 0);
|
|
822
|
+
const left = indent * cursor.level;
|
|
823
|
+
const Cursor = tree.renderCursor;
|
|
824
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)(Cursor, {
|
|
825
|
+
top: top,
|
|
826
|
+
left: left,
|
|
827
|
+
indent: indent
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
const $05f64c7ebcbad8b5$export$70c2b8898b86d3ad = /*#__PURE__*/ (0, $g00cZ$forwardRef)(function Outer(props, ref) {
|
|
833
|
+
const { children: children , ...rest } = props;
|
|
834
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)();
|
|
835
|
+
return /*#__PURE__*/ (0, $g00cZ$jsxs)("div", {
|
|
836
|
+
// @ts-ignore
|
|
837
|
+
ref: ref,
|
|
838
|
+
...rest,
|
|
839
|
+
onClick: (e)=>{
|
|
840
|
+
if (e.currentTarget === e.target) tree.deselectAll();
|
|
811
841
|
},
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
842
|
+
children: [
|
|
843
|
+
/*#__PURE__*/ (0, $g00cZ$jsx)($05f64c7ebcbad8b5$var$DropContainer, {}),
|
|
844
|
+
children
|
|
845
|
+
]
|
|
846
|
+
});
|
|
847
|
+
});
|
|
848
|
+
const $05f64c7ebcbad8b5$var$DropContainer = ()=>{
|
|
849
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)();
|
|
850
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)("div", {
|
|
851
|
+
style: {
|
|
852
|
+
height: tree.visibleNodes.length * tree.rowHeight,
|
|
853
|
+
width: "100%",
|
|
854
|
+
position: "absolute",
|
|
855
|
+
left: "0",
|
|
856
|
+
right: "0"
|
|
821
857
|
},
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
858
|
+
onClick: (e)=>{
|
|
859
|
+
console.log(e.currentTarget, e.target);
|
|
860
|
+
},
|
|
861
|
+
children: /*#__PURE__*/ (0, $g00cZ$jsx)((0, $f608be224a71d6f5$export$ef961593063b03e8), {})
|
|
862
|
+
});
|
|
863
|
+
};
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
const $da9a6b47b6fff922$export$a9af0da3ae60cd00 = /*#__PURE__*/ (0, $g00cZ$forwardRef)(function InnerElement({ style: style , ...rest }, ref) {
|
|
871
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)();
|
|
872
|
+
const paddingTop = (tree.props.padding ?? tree.props.paddingTop) ?? 0;
|
|
873
|
+
const paddingBottom = (tree.props.padding ?? tree.props.paddingBottom) ?? 0;
|
|
874
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)("div", {
|
|
875
|
+
ref: ref,
|
|
876
|
+
style: {
|
|
877
|
+
...style,
|
|
878
|
+
height: `${parseFloat(style.height) + paddingTop + paddingBottom}px`
|
|
879
|
+
},
|
|
880
|
+
...rest
|
|
881
|
+
});
|
|
882
|
+
});
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
function $907e707a330ef23a$export$715c0d031ede7907(node) {
|
|
896
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)();
|
|
897
|
+
const ids = tree.selectedIds;
|
|
898
|
+
const [_, ref, preview] = (0, $g00cZ$useDrag)(()=>({
|
|
899
|
+
canDrag: ()=>node.isDraggable,
|
|
900
|
+
type: "NODE",
|
|
901
|
+
item: ()=>({
|
|
902
|
+
id: node.id,
|
|
903
|
+
dragIds: tree.isSelected(node.id) ? Array.from(ids) : [
|
|
904
|
+
node.id
|
|
905
|
+
]
|
|
906
|
+
}),
|
|
907
|
+
start: ()=>{
|
|
908
|
+
tree.dispatch((0, $59f144a8dd651e5e$export$e324594224ef24da).dragStart(node.id));
|
|
832
909
|
},
|
|
833
|
-
|
|
910
|
+
end: (item, monitor)=>{
|
|
911
|
+
tree.dispatch((0, $59f144a8dd651e5e$export$e324594224ef24da).dragEnd());
|
|
912
|
+
tree.hideCursor();
|
|
913
|
+
const drop = monitor.getDropResult();
|
|
914
|
+
// If they held down meta, we need to create a copy
|
|
915
|
+
// if (drop.dropEffect === "copy")
|
|
916
|
+
if (drop && drop.parentId) {
|
|
917
|
+
(0, $0e6083160f4b36ed$export$c6d63370cef03886)(tree.props.onMove, {
|
|
918
|
+
dragIds: item.dragIds,
|
|
919
|
+
parentId: drop.parentId === (0, $81080a351c006222$export$ec71a3379b43ae5c) ? null : drop.parentId,
|
|
920
|
+
index: drop.index
|
|
921
|
+
});
|
|
922
|
+
tree.open(drop.parentId);
|
|
923
|
+
}
|
|
834
924
|
}
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
|
|
925
|
+
}), [
|
|
926
|
+
ids,
|
|
927
|
+
node
|
|
928
|
+
]);
|
|
929
|
+
(0, $g00cZ$useEffect)(()=>{
|
|
930
|
+
preview((0, $g00cZ$getEmptyImage)());
|
|
931
|
+
}, [
|
|
932
|
+
preview
|
|
933
|
+
]);
|
|
934
|
+
return ref;
|
|
935
|
+
}
|
|
936
|
+
|
|
838
937
|
|
|
839
938
|
|
|
840
939
|
|
|
@@ -867,7 +966,7 @@ function $2db980bfed6822da$var$getNodesAroundCursor(node, prev, next, hover) {
|
|
|
867
966
|
prev,
|
|
868
967
|
null
|
|
869
968
|
];
|
|
870
|
-
if (
|
|
969
|
+
if (node.isInternal) {
|
|
871
970
|
if (hover.atTop) return [
|
|
872
971
|
prev,
|
|
873
972
|
node
|
|
@@ -904,12 +1003,12 @@ function $2db980bfed6822da$var$getDropLevel(hovering, aboveCursor, belowCursor,
|
|
|
904
1003
|
max = aboveCursor.level;
|
|
905
1004
|
min = belowCursor.level;
|
|
906
1005
|
}
|
|
907
|
-
return $0e6083160f4b36ed$export$adf7c0fe6059d774(hoverLevel, min, max);
|
|
1006
|
+
return (0, $0e6083160f4b36ed$export$adf7c0fe6059d774)(hoverLevel, min, max);
|
|
908
1007
|
}
|
|
909
1008
|
function $2db980bfed6822da$var$canDrop(above, below) {
|
|
910
1009
|
if (!above) return true;
|
|
911
1010
|
let n = above;
|
|
912
|
-
if ($0e6083160f4b36ed$export$4210f5ea57fbae57(above) && above !== below) n = above.parent;
|
|
1011
|
+
if ((0, $0e6083160f4b36ed$export$4210f5ea57fbae57)(above) && above !== below) n = above.parent;
|
|
913
1012
|
while(n){
|
|
914
1013
|
if (!n.isDroppable) return false;
|
|
915
1014
|
n = n.parent;
|
|
@@ -944,7 +1043,7 @@ function $2db980bfed6822da$var$walkUpFrom(node, level) {
|
|
|
944
1043
|
let drop = node;
|
|
945
1044
|
while(drop.parent && drop.level > level)drop = drop.parent;
|
|
946
1045
|
const parentId = drop.parent?.id || null;
|
|
947
|
-
const index = $0e6083160f4b36ed$export$305f7d4e9d4624f2(drop) + 1;
|
|
1046
|
+
const index = (0, $0e6083160f4b36ed$export$305f7d4e9d4624f2)(drop) + 1;
|
|
948
1047
|
return {
|
|
949
1048
|
parentId: parentId,
|
|
950
1049
|
index: index
|
|
@@ -958,7 +1057,7 @@ function $2db980bfed6822da$export$f502ca02ebb85a1c(args) {
|
|
|
958
1057
|
drop: null,
|
|
959
1058
|
cursor: $2db980bfed6822da$var$noCursor()
|
|
960
1059
|
};
|
|
961
|
-
/* Hovering over the middle of a folder */ if (node &&
|
|
1060
|
+
/* Hovering over the middle of a folder */ if (node && node.isInternal && hover.inMiddle) return {
|
|
962
1061
|
drop: $2db980bfed6822da$var$dropAt(node.id, 0),
|
|
963
1062
|
cursor: $2db980bfed6822da$var$highlightCursor(node.id)
|
|
964
1063
|
};
|
|
@@ -966,7 +1065,7 @@ function $2db980bfed6822da$export$f502ca02ebb85a1c(args) {
|
|
|
966
1065
|
drop: $2db980bfed6822da$var$dropAt(below?.parent?.id, 0),
|
|
967
1066
|
cursor: $2db980bfed6822da$var$lineCursor(0, 0)
|
|
968
1067
|
};
|
|
969
|
-
/* The above node is an item or a closed folder */ if ($0e6083160f4b36ed$export$5318634f2ee07019(above) || $0e6083160f4b36ed$export$4210f5ea57fbae57(above)) {
|
|
1068
|
+
/* The above node is an item or a closed folder */ if ((0, $0e6083160f4b36ed$export$5318634f2ee07019)(above) || (0, $0e6083160f4b36ed$export$4210f5ea57fbae57)(above)) {
|
|
970
1069
|
const level = $2db980bfed6822da$var$getDropLevel(hover, above, below, args.indent);
|
|
971
1070
|
return {
|
|
972
1071
|
drop: $2db980bfed6822da$var$walkUpFrom(above, level),
|
|
@@ -980,377 +1079,1234 @@ function $2db980bfed6822da$export$f502ca02ebb85a1c(args) {
|
|
|
980
1079
|
}
|
|
981
1080
|
|
|
982
1081
|
|
|
983
|
-
function $
|
|
984
|
-
const tree = $
|
|
985
|
-
|
|
986
|
-
const [, drop1] = $g00cZ$useDrop(()=>({
|
|
1082
|
+
function $d38aa53467160173$export$57afafec4637d997(el, node) {
|
|
1083
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)();
|
|
1084
|
+
const [_, dropRef] = (0, $g00cZ$useDrop)(()=>({
|
|
987
1085
|
accept: "NODE",
|
|
988
|
-
|
|
989
|
-
if (
|
|
990
|
-
shallow: true
|
|
991
|
-
})) return;
|
|
1086
|
+
canDrop: (item, m)=>{
|
|
1087
|
+
if (node.tree.isFiltered) return false;
|
|
992
1088
|
const offset = m.getClientOffset();
|
|
993
|
-
if (!
|
|
994
|
-
const {
|
|
995
|
-
element:
|
|
1089
|
+
if (!el.current || !offset) return false;
|
|
1090
|
+
const { drop: drop } = (0, $2db980bfed6822da$export$f502ca02ebb85a1c)({
|
|
1091
|
+
element: el.current,
|
|
996
1092
|
offset: offset,
|
|
997
1093
|
indent: tree.indent,
|
|
998
|
-
node:
|
|
999
|
-
prevNode:
|
|
1000
|
-
nextNode:
|
|
1094
|
+
node: node,
|
|
1095
|
+
prevNode: node.prev,
|
|
1096
|
+
nextNode: node.next
|
|
1001
1097
|
});
|
|
1002
|
-
if (
|
|
1098
|
+
if (!drop) return false;
|
|
1099
|
+
const dropParent = tree.get(drop.parentId) ?? tree.root;
|
|
1100
|
+
for (let id of item.dragIds){
|
|
1101
|
+
const drag = tree.get(id);
|
|
1102
|
+
if (!drag) return false;
|
|
1103
|
+
if (!dropParent) return false;
|
|
1104
|
+
if (drag.isInternal && (0, $0e6083160f4b36ed$export$1e38f72c6c546f70)(dropParent, drag)) return false;
|
|
1105
|
+
}
|
|
1106
|
+
return true;
|
|
1003
1107
|
},
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1108
|
+
hover: (item, m)=>{
|
|
1109
|
+
if (m.canDrop()) {
|
|
1110
|
+
const offset = m.getClientOffset();
|
|
1111
|
+
if (!el.current || !offset) return;
|
|
1112
|
+
const { cursor: cursor } = (0, $2db980bfed6822da$export$f502ca02ebb85a1c)({
|
|
1113
|
+
element: el.current,
|
|
1114
|
+
offset: offset,
|
|
1115
|
+
indent: tree.indent,
|
|
1116
|
+
node: node,
|
|
1117
|
+
prevNode: node.prev,
|
|
1118
|
+
nextNode: node.next
|
|
1119
|
+
});
|
|
1120
|
+
if (cursor) tree.showCursor(cursor);
|
|
1121
|
+
} else tree.hideCursor();
|
|
1008
1122
|
},
|
|
1009
1123
|
drop: (item, m)=>{
|
|
1010
|
-
if (m.didDrop()) return;
|
|
1011
1124
|
const offset = m.getClientOffset();
|
|
1012
|
-
if (!
|
|
1013
|
-
const { drop: drop } = $2db980bfed6822da$export$f502ca02ebb85a1c({
|
|
1014
|
-
element:
|
|
1125
|
+
if (!el.current || !offset) return;
|
|
1126
|
+
const { drop: drop } = (0, $2db980bfed6822da$export$f502ca02ebb85a1c)({
|
|
1127
|
+
element: el.current,
|
|
1015
1128
|
offset: offset,
|
|
1016
1129
|
indent: tree.indent,
|
|
1017
|
-
node:
|
|
1018
|
-
prevNode:
|
|
1019
|
-
nextNode:
|
|
1130
|
+
node: node,
|
|
1131
|
+
prevNode: node.prev,
|
|
1132
|
+
nextNode: node.next
|
|
1020
1133
|
});
|
|
1021
1134
|
return drop;
|
|
1022
1135
|
}
|
|
1023
|
-
})
|
|
1024
|
-
|
|
1025
|
-
|
|
1136
|
+
}), [
|
|
1137
|
+
node,
|
|
1138
|
+
el.current,
|
|
1139
|
+
tree.props
|
|
1026
1140
|
]);
|
|
1027
|
-
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
function $5d6a5680e6f62734$export$a6ee728c3c6ef11d(props) {
|
|
1032
|
-
$e739455e59c6aed3$export$5a6c424b1725f44f();
|
|
1033
|
-
return props.children;
|
|
1141
|
+
return dropRef;
|
|
1034
1142
|
}
|
|
1035
1143
|
|
|
1036
1144
|
|
|
1037
1145
|
|
|
1038
1146
|
|
|
1147
|
+
function $48ab254e4b4b72da$export$d75ab90b05ebbfaa(index) {
|
|
1148
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)();
|
|
1149
|
+
const original = tree.at(index);
|
|
1150
|
+
if (!original) throw new Error(`Could not find node for index: ${index}`);
|
|
1151
|
+
return (0, $g00cZ$useMemo)(()=>{
|
|
1152
|
+
const fresh = original.clone();
|
|
1153
|
+
tree.visibleNodes[index] = fresh; // sneaky
|
|
1154
|
+
return fresh;
|
|
1155
|
+
// Return a fresh instance if the state values change
|
|
1156
|
+
}, [
|
|
1157
|
+
...Object.values(original.state),
|
|
1158
|
+
original
|
|
1159
|
+
]);
|
|
1160
|
+
}
|
|
1039
1161
|
|
|
1040
1162
|
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1163
|
+
const $8c3aed0a01f84486$export$a9754b3c8daa5172 = /*#__PURE__*/ (0, $g00cZ$react).memo(function RowContainer({ index: index , style: style }) {
|
|
1164
|
+
/* When will the <Row> will re-render.
|
|
1165
|
+
*
|
|
1166
|
+
* The row component is memo'd so it will only render
|
|
1167
|
+
* when a new instance of the NodeApi class is passed
|
|
1168
|
+
* to it.
|
|
1169
|
+
*
|
|
1170
|
+
* The TreeApi instance is stable. It does not
|
|
1171
|
+
* change when the internal state changes.
|
|
1172
|
+
*
|
|
1173
|
+
* The TreeApi has all the references to the nodes.
|
|
1174
|
+
* We need to clone the nodes when their state
|
|
1175
|
+
* changes. The node class contains no state itself,
|
|
1176
|
+
* It always checks the tree for state. The tree's
|
|
1177
|
+
* state will always be up to date.
|
|
1178
|
+
*/ (0, $89e93131aae74bd9$export$83a4f9dc3b36edb8)(); // Re-render when tree props or visability changes
|
|
1179
|
+
const _ = (0, $89e93131aae74bd9$export$fd23f19d5d8f3033)(); // So that we re-render appropriately
|
|
1180
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)(); // Tree already has the fresh state
|
|
1181
|
+
const node = (0, $48ab254e4b4b72da$export$d75ab90b05ebbfaa)(index);
|
|
1182
|
+
const el = (0, $g00cZ$useRef)(null);
|
|
1183
|
+
const dragRef = (0, $907e707a330ef23a$export$715c0d031ede7907)(node);
|
|
1184
|
+
const dropRef = (0, $d38aa53467160173$export$57afafec4637d997)(el, node);
|
|
1185
|
+
const innerRef = (0, $g00cZ$useCallback)((n)=>{
|
|
1186
|
+
el.current = n;
|
|
1187
|
+
dropRef(n);
|
|
1188
|
+
}, [
|
|
1189
|
+
dropRef
|
|
1190
|
+
]);
|
|
1191
|
+
const indent = tree.indent * node.level;
|
|
1192
|
+
const nodeStyle = (0, $g00cZ$useMemo)(()=>({
|
|
1193
|
+
paddingLeft: indent
|
|
1194
|
+
}), [
|
|
1195
|
+
indent
|
|
1196
|
+
]);
|
|
1197
|
+
const rowStyle = (0, $g00cZ$useMemo)(()=>({
|
|
1198
|
+
...style,
|
|
1199
|
+
top: parseFloat(style.top) + ((tree.props.padding ?? tree.props.paddingTop) ?? 0)
|
|
1200
|
+
}), [
|
|
1201
|
+
style,
|
|
1202
|
+
tree.props.padding,
|
|
1203
|
+
tree.props.paddingTop
|
|
1204
|
+
]);
|
|
1205
|
+
const rowAttrs = {
|
|
1206
|
+
role: "treeitem",
|
|
1207
|
+
"aria-level": node.level,
|
|
1208
|
+
"aria-selected": node.isSelected,
|
|
1209
|
+
style: rowStyle,
|
|
1210
|
+
tabIndex: -1
|
|
1211
|
+
};
|
|
1212
|
+
(0, $g00cZ$useEffect)(()=>{
|
|
1213
|
+
if (!node.isEditing && node.isFocused) el.current?.focus();
|
|
1214
|
+
}, [
|
|
1215
|
+
node.isEditing,
|
|
1216
|
+
node.isFocused,
|
|
1217
|
+
el.current
|
|
1218
|
+
]);
|
|
1219
|
+
const Node = tree.renderNode;
|
|
1220
|
+
const Row = tree.renderRow;
|
|
1221
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)(Row, {
|
|
1222
|
+
node: node,
|
|
1223
|
+
innerRef: innerRef,
|
|
1224
|
+
attrs: rowAttrs,
|
|
1225
|
+
children: /*#__PURE__*/ (0, $g00cZ$jsx)(Node, {
|
|
1226
|
+
node: node,
|
|
1227
|
+
tree: tree,
|
|
1228
|
+
style: nodeStyle,
|
|
1229
|
+
dragHandle: dragRef
|
|
1230
|
+
})
|
|
1231
|
+
});
|
|
1232
|
+
});
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
let $065a164934293bf2$var$focusSearchTerm = "";
|
|
1236
|
+
let $065a164934293bf2$var$timeoutId = null;
|
|
1237
|
+
function $065a164934293bf2$export$ff4858a4110d9246() {
|
|
1238
|
+
(0, $89e93131aae74bd9$export$83a4f9dc3b36edb8)();
|
|
1239
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)();
|
|
1240
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)("div", {
|
|
1241
|
+
style: {
|
|
1242
|
+
height: tree.height,
|
|
1243
|
+
width: tree.width,
|
|
1244
|
+
minHeight: 0,
|
|
1245
|
+
minWidth: 0
|
|
1246
|
+
},
|
|
1247
|
+
onContextMenu: tree.props.onContextMenu,
|
|
1248
|
+
onClick: tree.props.onClick,
|
|
1249
|
+
tabIndex: 0,
|
|
1250
|
+
onFocus: (e)=>{
|
|
1251
|
+
if (!e.currentTarget.contains(e.relatedTarget)) tree.onFocus();
|
|
1252
|
+
},
|
|
1253
|
+
onBlur: (e)=>{
|
|
1254
|
+
if (!e.currentTarget.contains(e.relatedTarget)) tree.onBlur();
|
|
1255
|
+
},
|
|
1256
|
+
onKeyDown: (e)=>{
|
|
1257
|
+
if (tree.isEditing) return;
|
|
1258
|
+
if (e.key === "Backspace") {
|
|
1259
|
+
if (!tree.props.onDelete) return;
|
|
1260
|
+
const ids = Array.from(tree.selectedIds);
|
|
1261
|
+
if (ids.length > 1) {
|
|
1262
|
+
let nextFocus = tree.mostRecentNode;
|
|
1263
|
+
while(nextFocus && nextFocus.isSelected)nextFocus = nextFocus.nextSibling;
|
|
1264
|
+
if (!nextFocus) nextFocus = tree.lastNode;
|
|
1265
|
+
tree.focus(nextFocus, {
|
|
1266
|
+
scroll: false
|
|
1267
|
+
});
|
|
1268
|
+
tree.delete(Array.from(ids));
|
|
1269
|
+
} else {
|
|
1270
|
+
const node = tree.focusedNode;
|
|
1271
|
+
if (node) {
|
|
1272
|
+
const sib = node.nextSibling;
|
|
1273
|
+
const parent = node.parent;
|
|
1274
|
+
tree.focus(sib || parent, {
|
|
1275
|
+
scroll: false
|
|
1276
|
+
});
|
|
1277
|
+
tree.delete(node);
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
if (e.key === "Tab" && !e.shiftKey) {
|
|
1283
|
+
e.preventDefault();
|
|
1284
|
+
(0, $0e6083160f4b36ed$export$3b0237e8566c8d65)(e.currentTarget);
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
if (e.key === "Tab" && e.shiftKey) {
|
|
1288
|
+
e.preventDefault();
|
|
1289
|
+
(0, $0e6083160f4b36ed$export$33b47db07a82b2fb)(e.currentTarget);
|
|
1290
|
+
return;
|
|
1291
|
+
}
|
|
1292
|
+
if (e.key === "ArrowDown" && !e.shiftKey && !e.metaKey) {
|
|
1293
|
+
e.preventDefault();
|
|
1294
|
+
const next = tree.nextNode;
|
|
1295
|
+
tree.focus(next);
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
if (e.key === "ArrowDown" && e.shiftKey) {
|
|
1299
|
+
e.preventDefault();
|
|
1300
|
+
const next1 = tree.nextNode;
|
|
1301
|
+
if (!next1) return;
|
|
1302
|
+
const current = tree.focusedNode;
|
|
1303
|
+
if (!current) tree.focus(tree.firstNode);
|
|
1304
|
+
else if (current.isSelected) tree.selectContiguous(next1);
|
|
1305
|
+
else tree.selectMulti(next1);
|
|
1306
|
+
return;
|
|
1307
|
+
}
|
|
1308
|
+
if (e.key === "ArrowUp" && !e.shiftKey) {
|
|
1309
|
+
e.preventDefault();
|
|
1310
|
+
tree.focus(tree.prevNode);
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
if (e.key === "ArrowUp" && e.shiftKey) {
|
|
1314
|
+
e.preventDefault();
|
|
1315
|
+
const prev = tree.prevNode;
|
|
1316
|
+
const current1 = tree.focusedNode;
|
|
1317
|
+
if (!prev) return;
|
|
1318
|
+
if (!current1) tree.focus(tree.lastNode); // ?
|
|
1319
|
+
else if (current1.isSelected) tree.selectContiguous(prev);
|
|
1320
|
+
else tree.selectMulti(prev);
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1323
|
+
if (e.key === "ArrowRight") {
|
|
1324
|
+
const node1 = tree.focusedNode;
|
|
1325
|
+
if (!node1) return;
|
|
1326
|
+
if (node1.isInternal && node1.isOpen) tree.focus(tree.nextNode);
|
|
1327
|
+
else if (node1.isInternal) tree.open(node1.id);
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
if (e.key === "ArrowLeft") {
|
|
1331
|
+
const node2 = tree.focusedNode;
|
|
1332
|
+
if (!node2 || node2.isRoot) return;
|
|
1333
|
+
if (node2.isInternal && node2.isOpen) tree.close(node2.id);
|
|
1334
|
+
else if (!node2.parent?.isRoot) tree.focus(node2.parent);
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
if (e.key === "a" && e.metaKey) {
|
|
1338
|
+
e.preventDefault();
|
|
1339
|
+
tree.selectAll();
|
|
1340
|
+
return;
|
|
1341
|
+
}
|
|
1342
|
+
if (e.key === "a" && !e.metaKey) {
|
|
1343
|
+
if (!tree.props.onCreate) return;
|
|
1344
|
+
tree.createLeaf();
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
if (e.key === "A" && !e.metaKey) {
|
|
1348
|
+
if (!tree.props.onCreate) return;
|
|
1349
|
+
tree.createInternal();
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
if (e.key === "Home") {
|
|
1353
|
+
// add shift keys
|
|
1354
|
+
e.preventDefault();
|
|
1355
|
+
tree.focus(tree.firstNode);
|
|
1356
|
+
return;
|
|
1357
|
+
}
|
|
1358
|
+
if (e.key === "End") {
|
|
1359
|
+
// add shift keys
|
|
1360
|
+
e.preventDefault();
|
|
1361
|
+
tree.focus(tree.lastNode);
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1364
|
+
if (e.key === "Enter") {
|
|
1365
|
+
if (!tree.props.onRename) return;
|
|
1366
|
+
setTimeout(()=>{
|
|
1367
|
+
if (tree.focusedNode) tree.edit(tree.focusedNode);
|
|
1368
|
+
});
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
if (e.key === " ") {
|
|
1372
|
+
e.preventDefault();
|
|
1373
|
+
const node3 = tree.focusedNode;
|
|
1374
|
+
if (!node3) return;
|
|
1375
|
+
if (node3.isLeaf) {
|
|
1376
|
+
node3.select();
|
|
1377
|
+
node3.activate();
|
|
1378
|
+
} else node3.toggle();
|
|
1379
|
+
return;
|
|
1380
|
+
}
|
|
1381
|
+
if (e.key === "*") {
|
|
1382
|
+
const node4 = tree.focusedNode;
|
|
1383
|
+
if (!node4) return;
|
|
1384
|
+
tree.openSiblings(node4);
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1387
|
+
if (e.key === "ArrowDown" && e.metaKey) {
|
|
1388
|
+
e.preventDefault();
|
|
1389
|
+
tree.select(tree.focusedNode);
|
|
1390
|
+
tree.activate(tree.focusedNode);
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1393
|
+
if (e.key === "PageUp") {
|
|
1394
|
+
e.preventDefault();
|
|
1395
|
+
tree.pageUp();
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1398
|
+
if (e.key === "PageDown") {
|
|
1399
|
+
e.preventDefault();
|
|
1400
|
+
tree.pageDown();
|
|
1401
|
+
}
|
|
1402
|
+
// If they type a sequence of characters
|
|
1403
|
+
// collect them. Reset them after a timeout.
|
|
1404
|
+
// Use it to search the tree for a node, then focus it.
|
|
1405
|
+
// Clean this up a bit later
|
|
1406
|
+
clearTimeout($065a164934293bf2$var$timeoutId);
|
|
1407
|
+
$065a164934293bf2$var$focusSearchTerm += e.key;
|
|
1408
|
+
$065a164934293bf2$var$timeoutId = setTimeout(()=>{
|
|
1409
|
+
$065a164934293bf2$var$focusSearchTerm = "";
|
|
1410
|
+
}, 600);
|
|
1411
|
+
const node5 = tree.visibleNodes.find((n)=>{
|
|
1412
|
+
// @ts-ignore
|
|
1413
|
+
const name = n.data.name;
|
|
1414
|
+
if (typeof name === "string") return name.toLowerCase().startsWith($065a164934293bf2$var$focusSearchTerm);
|
|
1415
|
+
else return false;
|
|
1416
|
+
});
|
|
1417
|
+
if (node5) tree.focus(node5.id);
|
|
1418
|
+
},
|
|
1419
|
+
children: /*#__PURE__*/ (0, $g00cZ$jsx)((0, $g00cZ$FixedSizeList), {
|
|
1420
|
+
className: tree.props.className,
|
|
1421
|
+
outerRef: tree.listEl,
|
|
1422
|
+
itemCount: tree.visibleNodes.length,
|
|
1423
|
+
height: tree.height,
|
|
1424
|
+
width: tree.width,
|
|
1425
|
+
itemSize: tree.rowHeight,
|
|
1426
|
+
itemKey: (index)=>tree.visibleNodes[index]?.id || index,
|
|
1427
|
+
outerElementType: (0, $05f64c7ebcbad8b5$export$70c2b8898b86d3ad),
|
|
1428
|
+
innerElementType: (0, $da9a6b47b6fff922$export$a9af0da3ae60cd00),
|
|
1429
|
+
onScroll: tree.props.onScroll,
|
|
1430
|
+
onItemsRendered: tree.onItemsRendered.bind(tree),
|
|
1431
|
+
ref: tree.list,
|
|
1432
|
+
children: (0, $8c3aed0a01f84486$export$a9754b3c8daa5172)
|
|
1433
|
+
})
|
|
1055
1434
|
});
|
|
1056
1435
|
}
|
|
1057
1436
|
|
|
1058
1437
|
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1438
|
+
function $749bc746798c29ad$export$5897d8d7c7a3d871(tree) {
|
|
1439
|
+
if (tree.isFiltered) return $749bc746798c29ad$var$flattenAndFilterTree(tree.root, tree.isMatch.bind(tree));
|
|
1440
|
+
else return $749bc746798c29ad$var$flattenTree(tree.root);
|
|
1441
|
+
}
|
|
1442
|
+
function $749bc746798c29ad$var$flattenTree(root) {
|
|
1443
|
+
const list = [];
|
|
1444
|
+
function collect(node) {
|
|
1445
|
+
if (node.level >= 0) list.push(node);
|
|
1446
|
+
if (node.isOpen) node.children?.forEach(collect);
|
|
1447
|
+
}
|
|
1448
|
+
collect(root);
|
|
1449
|
+
list.forEach($749bc746798c29ad$var$assignRowIndex);
|
|
1450
|
+
return list;
|
|
1451
|
+
}
|
|
1452
|
+
function $749bc746798c29ad$var$flattenAndFilterTree(root, isMatch) {
|
|
1453
|
+
function collect(node) {
|
|
1454
|
+
let result = [];
|
|
1455
|
+
const yes = !node.isRoot && isMatch(node);
|
|
1456
|
+
if (node.children) for (let child of node.children)result = result.concat(collect(child));
|
|
1457
|
+
if (result.length) {
|
|
1458
|
+
if (!node.isRoot) result.unshift(node);
|
|
1459
|
+
return result;
|
|
1460
|
+
}
|
|
1461
|
+
if (yes) return [
|
|
1462
|
+
node
|
|
1463
|
+
];
|
|
1464
|
+
else return [];
|
|
1465
|
+
}
|
|
1466
|
+
const list = collect(root).filter((n)=>n.parent?.isOpen);
|
|
1467
|
+
list.forEach($749bc746798c29ad$var$assignRowIndex);
|
|
1468
|
+
return list;
|
|
1469
|
+
}
|
|
1470
|
+
function $749bc746798c29ad$var$assignRowIndex(node, index) {
|
|
1471
|
+
node.rowIndex = index;
|
|
1472
|
+
}
|
|
1085
1473
|
|
|
1086
1474
|
|
|
1475
|
+
const $659b2f68e1468ad0$export$c6d108d7c8095f19 = (nodes)=>{
|
|
1476
|
+
return nodes.reduce((map, node, index)=>{
|
|
1477
|
+
map[node.id] = index;
|
|
1478
|
+
return map;
|
|
1479
|
+
}, {});
|
|
1480
|
+
};
|
|
1087
1481
|
|
|
1088
1482
|
|
|
1483
|
+
const { safeRun: $bfece7c4aed4e9c4$var$safeRun , identify: $bfece7c4aed4e9c4$var$identify , identifyNull: $bfece7c4aed4e9c4$var$identifyNull } = $0e6083160f4b36ed$exports;
|
|
1484
|
+
class $bfece7c4aed4e9c4$export$e2da3477247342d1 {
|
|
1485
|
+
constructor(store, props, list, listEl){
|
|
1486
|
+
this.store = store;
|
|
1487
|
+
this.props = props;
|
|
1488
|
+
this.list = list;
|
|
1489
|
+
this.listEl = listEl;
|
|
1490
|
+
this.visibleStartIndex = 0;
|
|
1491
|
+
this.visibleStopIndex = 0;
|
|
1492
|
+
/* Changes here must also be made in update() */ this.root = (0, $81080a351c006222$export$882461b6382ed46c)(this);
|
|
1493
|
+
this.visibleNodes = (0, $749bc746798c29ad$export$5897d8d7c7a3d871)(this);
|
|
1494
|
+
this.idToIndex = (0, $659b2f68e1468ad0$export$c6d108d7c8095f19)(this.visibleNodes);
|
|
1495
|
+
}
|
|
1496
|
+
/* Changes here must also be made in constructor() */ update(props) {
|
|
1497
|
+
this.props = props;
|
|
1498
|
+
this.root = (0, $81080a351c006222$export$882461b6382ed46c)(this);
|
|
1499
|
+
this.visibleNodes = (0, $749bc746798c29ad$export$5897d8d7c7a3d871)(this);
|
|
1500
|
+
this.idToIndex = (0, $659b2f68e1468ad0$export$c6d108d7c8095f19)(this.visibleNodes);
|
|
1501
|
+
}
|
|
1502
|
+
/* Store helpers */ dispatch(action) {
|
|
1503
|
+
return this.store.dispatch(action);
|
|
1504
|
+
}
|
|
1505
|
+
get state() {
|
|
1506
|
+
return this.store.getState();
|
|
1507
|
+
}
|
|
1508
|
+
get openState() {
|
|
1509
|
+
return this.state.nodes.open.unfiltered;
|
|
1510
|
+
}
|
|
1511
|
+
/* Tree Props */ get width() {
|
|
1512
|
+
return this.props.width || 300;
|
|
1513
|
+
}
|
|
1514
|
+
get height() {
|
|
1515
|
+
return this.props.height || 500;
|
|
1516
|
+
}
|
|
1517
|
+
get indent() {
|
|
1518
|
+
return this.props.indent || 24;
|
|
1519
|
+
}
|
|
1520
|
+
get rowHeight() {
|
|
1521
|
+
return this.props.rowHeight || 24;
|
|
1522
|
+
}
|
|
1523
|
+
get searchTerm() {
|
|
1524
|
+
return (this.props.searchTerm || "").trim();
|
|
1525
|
+
}
|
|
1526
|
+
get matchFn() {
|
|
1527
|
+
const match = this.props.searchMatch ?? ((node, term)=>{
|
|
1528
|
+
const string = JSON.stringify(Object.values(node.data));
|
|
1529
|
+
return string.toLocaleLowerCase().includes(term.toLocaleLowerCase());
|
|
1530
|
+
});
|
|
1531
|
+
return (node)=>match(node, this.searchTerm);
|
|
1532
|
+
}
|
|
1533
|
+
accessChildren(data) {
|
|
1534
|
+
const get = this.props.childrenAccessor || "children";
|
|
1535
|
+
return $0e6083160f4b36ed$exports.access(data, get) ?? null;
|
|
1536
|
+
}
|
|
1537
|
+
accessId(data) {
|
|
1538
|
+
const get = this.props.idAccessor || "id";
|
|
1539
|
+
const id = $0e6083160f4b36ed$exports.access(data, get);
|
|
1540
|
+
if (!id) throw new Error("Data must contain an 'id' property or props.idAccessor must return a string");
|
|
1541
|
+
return id;
|
|
1542
|
+
}
|
|
1543
|
+
/* Node Access */ get firstNode() {
|
|
1544
|
+
return this.visibleNodes[0] ?? null;
|
|
1545
|
+
}
|
|
1546
|
+
get lastNode() {
|
|
1547
|
+
return this.visibleNodes[this.visibleNodes.length - 1] ?? null;
|
|
1548
|
+
}
|
|
1549
|
+
get focusedNode() {
|
|
1550
|
+
return this.get(this.state.nodes.focus.id) ?? null;
|
|
1551
|
+
}
|
|
1552
|
+
get mostRecentNode() {
|
|
1553
|
+
return this.get(this.state.nodes.selection.mostRecent) ?? null;
|
|
1554
|
+
}
|
|
1555
|
+
get nextNode() {
|
|
1556
|
+
const index = this.indexOf(this.focusedNode);
|
|
1557
|
+
if (index === null) return null;
|
|
1558
|
+
else return this.at(index + 1);
|
|
1559
|
+
}
|
|
1560
|
+
get prevNode() {
|
|
1561
|
+
const index = this.indexOf(this.focusedNode);
|
|
1562
|
+
if (index === null) return null;
|
|
1563
|
+
else return this.at(index - 1);
|
|
1564
|
+
}
|
|
1565
|
+
get(id) {
|
|
1566
|
+
if (!id) return null;
|
|
1567
|
+
if (id in this.idToIndex) return this.visibleNodes[this.idToIndex[id]] || null;
|
|
1568
|
+
else return null;
|
|
1569
|
+
}
|
|
1570
|
+
at(index) {
|
|
1571
|
+
return this.visibleNodes[index] || null;
|
|
1572
|
+
}
|
|
1573
|
+
nodesBetween(startId, endId) {
|
|
1574
|
+
if (startId === null || endId === null) return [];
|
|
1575
|
+
const index1 = this.indexOf(startId) ?? 0;
|
|
1576
|
+
const index2 = this.indexOf(endId);
|
|
1577
|
+
if (index2 === null) return [];
|
|
1578
|
+
const start = Math.min(index1, index2);
|
|
1579
|
+
const end = Math.max(index1, index2);
|
|
1580
|
+
return this.visibleNodes.slice(start, end + 1);
|
|
1581
|
+
}
|
|
1582
|
+
indexOf(id) {
|
|
1583
|
+
const key = $0e6083160f4b36ed$exports.identifyNull(id);
|
|
1584
|
+
if (!key) return null;
|
|
1585
|
+
return this.idToIndex[key];
|
|
1586
|
+
}
|
|
1587
|
+
/* Data Operations */ get editingId() {
|
|
1588
|
+
return this.state.nodes.edit.id;
|
|
1589
|
+
}
|
|
1590
|
+
createInternal() {
|
|
1591
|
+
return this.create("internal");
|
|
1592
|
+
}
|
|
1593
|
+
createLeaf() {
|
|
1594
|
+
return this.create("leaf");
|
|
1595
|
+
}
|
|
1596
|
+
async create(type) {
|
|
1597
|
+
let index;
|
|
1598
|
+
let parentId;
|
|
1599
|
+
const focus = this.focusedNode;
|
|
1600
|
+
if (focus && focus.parent) {
|
|
1601
|
+
if (focus.isInternal && focus.isOpen) {
|
|
1602
|
+
parentId = focus.id;
|
|
1603
|
+
index = 0;
|
|
1604
|
+
} else {
|
|
1605
|
+
index = focus.childIndex + 1;
|
|
1606
|
+
parentId = focus.parent.isRoot ? null : focus.parent.id;
|
|
1607
|
+
}
|
|
1608
|
+
} else {
|
|
1609
|
+
index = this.root?.children?.length || -1;
|
|
1610
|
+
parentId = null;
|
|
1611
|
+
}
|
|
1612
|
+
const data = await $bfece7c4aed4e9c4$var$safeRun(this.props.onCreate, {
|
|
1613
|
+
parentId: parentId,
|
|
1614
|
+
index: index,
|
|
1615
|
+
type: type
|
|
1616
|
+
});
|
|
1617
|
+
if (data) {
|
|
1618
|
+
this.focus(data);
|
|
1619
|
+
setTimeout(()=>{
|
|
1620
|
+
this.edit(data).then(()=>{
|
|
1621
|
+
this.select(data);
|
|
1622
|
+
this.activate(data);
|
|
1623
|
+
});
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
async delete(node) {
|
|
1628
|
+
if (!node) return;
|
|
1629
|
+
const nodes = Array.isArray(node) ? node : [
|
|
1630
|
+
node
|
|
1631
|
+
];
|
|
1632
|
+
const ids = nodes.map($bfece7c4aed4e9c4$var$identify);
|
|
1633
|
+
await $bfece7c4aed4e9c4$var$safeRun(this.props.onDelete, {
|
|
1634
|
+
ids: ids
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
edit(node) {
|
|
1638
|
+
const id = $bfece7c4aed4e9c4$var$identify(node);
|
|
1639
|
+
this.resolveEdit({
|
|
1640
|
+
cancelled: true
|
|
1641
|
+
});
|
|
1642
|
+
this.scrollTo(id);
|
|
1643
|
+
this.dispatch((0, $21783d2b0251be67$export$e1a8e267487c59d1)(id));
|
|
1644
|
+
return new Promise((resolve)=>{
|
|
1645
|
+
$bfece7c4aed4e9c4$export$e2da3477247342d1.editPromise = resolve;
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
async submit(node, value) {
|
|
1649
|
+
if (!node) return;
|
|
1650
|
+
const id = $bfece7c4aed4e9c4$var$identify(node);
|
|
1651
|
+
await $bfece7c4aed4e9c4$var$safeRun(this.props.onRename, {
|
|
1652
|
+
id: id,
|
|
1653
|
+
name: value
|
|
1654
|
+
});
|
|
1655
|
+
this.dispatch((0, $21783d2b0251be67$export$e1a8e267487c59d1)(null));
|
|
1656
|
+
this.resolveEdit({
|
|
1657
|
+
cancelled: false,
|
|
1658
|
+
value: value
|
|
1659
|
+
});
|
|
1660
|
+
setTimeout(()=>this.onFocus()); // Return focus to element;
|
|
1661
|
+
}
|
|
1662
|
+
reset() {
|
|
1663
|
+
this.dispatch((0, $21783d2b0251be67$export$e1a8e267487c59d1)(null));
|
|
1664
|
+
this.resolveEdit({
|
|
1665
|
+
cancelled: true
|
|
1666
|
+
});
|
|
1667
|
+
setTimeout(()=>this.onFocus()); // Return focus to element;
|
|
1668
|
+
}
|
|
1669
|
+
activate(id) {
|
|
1670
|
+
const node = this.get($bfece7c4aed4e9c4$var$identifyNull(id));
|
|
1671
|
+
if (!node) return;
|
|
1672
|
+
$bfece7c4aed4e9c4$var$safeRun(this.props.onActivate, node);
|
|
1673
|
+
}
|
|
1674
|
+
resolveEdit(value) {
|
|
1675
|
+
const resolve = $bfece7c4aed4e9c4$export$e2da3477247342d1.editPromise;
|
|
1676
|
+
if (resolve) resolve(value);
|
|
1677
|
+
$bfece7c4aed4e9c4$export$e2da3477247342d1.editPromise = null;
|
|
1678
|
+
}
|
|
1679
|
+
/* Focus and Selection */ get selectedIds() {
|
|
1680
|
+
return this.state.nodes.selection.ids;
|
|
1681
|
+
}
|
|
1682
|
+
get selectedNodes() {
|
|
1683
|
+
let nodes = [];
|
|
1684
|
+
for (let id of Array.from(this.selectedIds)){
|
|
1685
|
+
const node = this.get(id);
|
|
1686
|
+
if (node) nodes.push(node);
|
|
1687
|
+
}
|
|
1688
|
+
return nodes;
|
|
1689
|
+
}
|
|
1690
|
+
focus(node, opts = {}) {
|
|
1691
|
+
if (!node) return;
|
|
1692
|
+
/* Focus is responsible for scrolling, while selection is
|
|
1693
|
+
* responsible for focus. If selectionFollowsFocus, then
|
|
1694
|
+
* just select it. */ if (this.props.selectionFollowsFocus) this.select(node);
|
|
1695
|
+
else {
|
|
1696
|
+
this.dispatch((0, $c27b8e9863235052$export$d7ddd398f22d79ef)($bfece7c4aed4e9c4$var$identify(node)));
|
|
1697
|
+
if (opts.scroll !== false) this.scrollTo(node);
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
pageUp() {
|
|
1701
|
+
const start = this.visibleStartIndex;
|
|
1702
|
+
const stop = this.visibleStopIndex;
|
|
1703
|
+
const page = stop - start;
|
|
1704
|
+
let index = this.focusedNode?.rowIndex ?? 0;
|
|
1705
|
+
if (index > start) index = start;
|
|
1706
|
+
else index = Math.max(start - page, 0);
|
|
1707
|
+
this.focus(this.at(index));
|
|
1708
|
+
}
|
|
1709
|
+
pageDown() {
|
|
1710
|
+
const start = this.visibleStartIndex;
|
|
1711
|
+
const stop = this.visibleStopIndex;
|
|
1712
|
+
const page = stop - start;
|
|
1713
|
+
let index = this.focusedNode?.rowIndex ?? 0;
|
|
1714
|
+
if (index < stop) index = stop;
|
|
1715
|
+
else index = Math.min(index + page, this.visibleNodes.length - 1);
|
|
1716
|
+
this.focus(this.at(index));
|
|
1717
|
+
}
|
|
1718
|
+
select(node, opts = {}) {
|
|
1719
|
+
if (!node) return;
|
|
1720
|
+
const id = $bfece7c4aed4e9c4$var$identify(node);
|
|
1721
|
+
this.dispatch((0, $c27b8e9863235052$export$d7ddd398f22d79ef)(id));
|
|
1722
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).only(id));
|
|
1723
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).anchor(id));
|
|
1724
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).mostRecent(id));
|
|
1725
|
+
this.scrollTo(id, opts.align);
|
|
1726
|
+
$bfece7c4aed4e9c4$var$safeRun(this.props.onSelect, this.selectedNodes);
|
|
1727
|
+
}
|
|
1728
|
+
deselect(node) {
|
|
1729
|
+
if (!node) return;
|
|
1730
|
+
const id = $bfece7c4aed4e9c4$var$identify(node);
|
|
1731
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).remove(id));
|
|
1732
|
+
}
|
|
1733
|
+
selectMulti(identity) {
|
|
1734
|
+
const node = this.get($bfece7c4aed4e9c4$var$identifyNull(identity));
|
|
1735
|
+
if (!node) return;
|
|
1736
|
+
this.dispatch((0, $c27b8e9863235052$export$d7ddd398f22d79ef)(node.id));
|
|
1737
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).add(node.id));
|
|
1738
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).anchor(node.id));
|
|
1739
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).mostRecent(node.id));
|
|
1740
|
+
this.scrollTo(node);
|
|
1741
|
+
$bfece7c4aed4e9c4$var$safeRun(this.props.onSelect, this.selectedNodes);
|
|
1742
|
+
}
|
|
1743
|
+
selectContiguous(identity) {
|
|
1744
|
+
if (!identity) return;
|
|
1745
|
+
const id = $bfece7c4aed4e9c4$var$identify(identity);
|
|
1746
|
+
const { anchor: anchor , mostRecent: mostRecent } = this.state.nodes.selection;
|
|
1747
|
+
this.dispatch((0, $c27b8e9863235052$export$d7ddd398f22d79ef)(id));
|
|
1748
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).remove(this.nodesBetween(anchor, mostRecent)));
|
|
1749
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).add(this.nodesBetween(anchor, $bfece7c4aed4e9c4$var$identifyNull(id))));
|
|
1750
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).mostRecent(id));
|
|
1751
|
+
this.scrollTo(id);
|
|
1752
|
+
$bfece7c4aed4e9c4$var$safeRun(this.props.onSelect, this.selectedNodes);
|
|
1753
|
+
}
|
|
1754
|
+
deselectAll() {
|
|
1755
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).clear());
|
|
1756
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).anchor(null));
|
|
1757
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).mostRecent(null));
|
|
1758
|
+
$bfece7c4aed4e9c4$var$safeRun(this.props.onSelect, this.selectedNodes);
|
|
1759
|
+
}
|
|
1760
|
+
selectAll() {
|
|
1761
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).set(new Set(Object.keys(this.idToIndex))));
|
|
1762
|
+
this.dispatch((0, $c27b8e9863235052$export$d7ddd398f22d79ef)(this.lastNode?.id));
|
|
1763
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).anchor(this.firstNode));
|
|
1764
|
+
this.dispatch((0, $37bc167debff36d2$export$e324594224ef24da).mostRecent(this.lastNode));
|
|
1765
|
+
$bfece7c4aed4e9c4$var$safeRun(this.props.onSelect, this.selectedNodes);
|
|
1766
|
+
}
|
|
1767
|
+
/* Drag and Drop */ get cursorParentId() {
|
|
1768
|
+
const { cursor: cursor } = this.state.dnd;
|
|
1769
|
+
switch(cursor.type){
|
|
1770
|
+
case "highlight":
|
|
1771
|
+
return cursor.id;
|
|
1772
|
+
default:
|
|
1773
|
+
return null;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
get cursorOverFolder() {
|
|
1777
|
+
return this.state.dnd.cursor.type === "highlight";
|
|
1778
|
+
}
|
|
1779
|
+
hideCursor() {
|
|
1780
|
+
this.dispatch((0, $59f144a8dd651e5e$export$e324594224ef24da).cursor({
|
|
1781
|
+
type: "none"
|
|
1782
|
+
}));
|
|
1783
|
+
}
|
|
1784
|
+
showCursor(cursor) {
|
|
1785
|
+
this.dispatch((0, $59f144a8dd651e5e$export$e324594224ef24da).cursor(cursor));
|
|
1786
|
+
}
|
|
1787
|
+
/* Visibility */ open(identity) {
|
|
1788
|
+
const id = $bfece7c4aed4e9c4$var$identifyNull(identity);
|
|
1789
|
+
if (!id) return;
|
|
1790
|
+
this.dispatch((0, $3c0bad2888bcd4bc$export$e324594224ef24da).open(id, this.isFiltered));
|
|
1791
|
+
}
|
|
1792
|
+
close(identity) {
|
|
1793
|
+
const id = $bfece7c4aed4e9c4$var$identifyNull(identity);
|
|
1794
|
+
if (!id) return;
|
|
1795
|
+
this.dispatch((0, $3c0bad2888bcd4bc$export$e324594224ef24da).close(id, this.isFiltered));
|
|
1796
|
+
}
|
|
1797
|
+
toggle(identity) {
|
|
1798
|
+
const id = $bfece7c4aed4e9c4$var$identifyNull(identity);
|
|
1799
|
+
if (!id) return;
|
|
1800
|
+
return this.isOpen(id) ? this.close(id) : this.open(id);
|
|
1801
|
+
}
|
|
1802
|
+
openParents(identity) {
|
|
1803
|
+
const id = $bfece7c4aed4e9c4$var$identifyNull(identity);
|
|
1804
|
+
if (!id) return;
|
|
1805
|
+
const node = $0e6083160f4b36ed$exports.dfs(this.root, id);
|
|
1806
|
+
let parent = node?.parent;
|
|
1807
|
+
while(parent){
|
|
1808
|
+
this.open(parent.id);
|
|
1809
|
+
parent = parent.parent;
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
openSiblings(node) {
|
|
1813
|
+
const parent = node.parent;
|
|
1814
|
+
if (!parent) this.toggle(node.id);
|
|
1815
|
+
else if (parent.children) {
|
|
1816
|
+
const isOpen = node.isOpen;
|
|
1817
|
+
for (let sibling of parent.children)if (sibling.isInternal) isOpen ? this.close(sibling.id) : this.open(sibling.id);
|
|
1818
|
+
this.scrollTo(this.focusedNode);
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
/* Scrolling */ scrollTo(identity, align = "smart") {
|
|
1822
|
+
if (!identity) return;
|
|
1823
|
+
const id = $bfece7c4aed4e9c4$var$identify(identity);
|
|
1824
|
+
this.openParents(id);
|
|
1825
|
+
return $0e6083160f4b36ed$exports.waitFor(()=>id in this.idToIndex).then(()=>{
|
|
1826
|
+
const index = this.idToIndex[id];
|
|
1827
|
+
if (index === undefined) return;
|
|
1828
|
+
this.list.current?.scrollToItem(index, align);
|
|
1829
|
+
}).catch(()=>{
|
|
1830
|
+
console.log(`Id: ${id} never appeared in the list.`);
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1833
|
+
/* State Checks */ get isEditing() {
|
|
1834
|
+
return this.state.nodes.edit.id !== null;
|
|
1835
|
+
}
|
|
1836
|
+
get isFiltered() {
|
|
1837
|
+
return !!this.props.searchTerm?.trim();
|
|
1838
|
+
}
|
|
1839
|
+
get hasFocus() {
|
|
1840
|
+
return this.state.nodes.focus.treeFocused;
|
|
1841
|
+
}
|
|
1842
|
+
isSelected(id) {
|
|
1843
|
+
if (!id) return false;
|
|
1844
|
+
return this.state.nodes.selection.ids.has(id);
|
|
1845
|
+
}
|
|
1846
|
+
isOpen(id) {
|
|
1847
|
+
if (!id) return false;
|
|
1848
|
+
if (id === (0, $81080a351c006222$export$ec71a3379b43ae5c)) return true;
|
|
1849
|
+
const def = this.props.openByDefault ?? true;
|
|
1850
|
+
if (this.isFiltered) return this.state.nodes.open.filtered[id] ?? true; // Filtered folders are always opened by default
|
|
1851
|
+
else return this.state.nodes.open.unfiltered[id] ?? def;
|
|
1852
|
+
}
|
|
1853
|
+
isDraggable(data) {
|
|
1854
|
+
const check = this.props.disableDrag || (()=>false);
|
|
1855
|
+
return !$0e6083160f4b36ed$exports.access(data, check) ?? true;
|
|
1856
|
+
}
|
|
1857
|
+
isDroppable(data) {
|
|
1858
|
+
const check = this.props.disableDrop || (()=>false);
|
|
1859
|
+
return !$0e6083160f4b36ed$exports.access(data, check) ?? true;
|
|
1860
|
+
}
|
|
1861
|
+
isDragging(node) {
|
|
1862
|
+
const id = $bfece7c4aed4e9c4$var$identifyNull(node);
|
|
1863
|
+
if (!id) return false;
|
|
1864
|
+
return this.state.nodes.drag.id === id;
|
|
1865
|
+
}
|
|
1866
|
+
isFocused(id) {
|
|
1867
|
+
return this.hasFocus && this.state.nodes.focus.id === id;
|
|
1868
|
+
}
|
|
1869
|
+
isMatch(node) {
|
|
1870
|
+
return this.matchFn(node);
|
|
1871
|
+
}
|
|
1872
|
+
willReceiveDrop(node) {
|
|
1873
|
+
const id = $bfece7c4aed4e9c4$var$identifyNull(node);
|
|
1874
|
+
if (!id) return false;
|
|
1875
|
+
return id === this.state.nodes.drag.idWillReceiveDrop;
|
|
1876
|
+
}
|
|
1877
|
+
/* Tree Event Handlers */ onFocus() {
|
|
1878
|
+
const node = this.focusedNode || this.firstNode;
|
|
1879
|
+
if (node) this.dispatch((0, $c27b8e9863235052$export$d7ddd398f22d79ef)(node.id));
|
|
1880
|
+
}
|
|
1881
|
+
onBlur() {
|
|
1882
|
+
this.dispatch((0, $c27b8e9863235052$export$6b6c976e46a06288)());
|
|
1883
|
+
}
|
|
1884
|
+
onItemsRendered(args) {
|
|
1885
|
+
this.visibleStartIndex = args.visibleStartIndex;
|
|
1886
|
+
this.visibleStopIndex = args.visibleStopIndex;
|
|
1887
|
+
}
|
|
1888
|
+
/* Get Renderers */ get renderContainer() {
|
|
1889
|
+
return this.props.renderContainer || (0, $065a164934293bf2$export$ff4858a4110d9246);
|
|
1890
|
+
}
|
|
1891
|
+
get renderRow() {
|
|
1892
|
+
return this.props.renderRow || (0, $164e874d21fcd87e$export$f9c541e71856c524);
|
|
1893
|
+
}
|
|
1894
|
+
get renderNode() {
|
|
1895
|
+
return this.props.children || (0, $c4edd692d5290432$export$909e23cbfbbd3351);
|
|
1896
|
+
}
|
|
1897
|
+
get renderDragPreview() {
|
|
1898
|
+
return this.props.renderDragPreview || (0, $77d34d95e44d2f58$export$84e211ad8431a387);
|
|
1899
|
+
}
|
|
1900
|
+
get renderCursor() {
|
|
1901
|
+
return this.props.renderCursor || (0, $fb4c15d8425379bd$export$6cb3c16721363d11);
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1089
1904
|
|
|
1090
1905
|
|
|
1091
1906
|
|
|
1092
1907
|
|
|
1093
1908
|
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1909
|
+
|
|
1910
|
+
|
|
1911
|
+
|
|
1912
|
+
|
|
1913
|
+
function $5c35ee13c124a8cc$export$1650419e431d3ba3(state = {
|
|
1914
|
+
id: null,
|
|
1915
|
+
idWillReceiveDrop: null
|
|
1916
|
+
}, action) {
|
|
1917
|
+
switch(action.type){
|
|
1918
|
+
case "DND_DRAG_START":
|
|
1919
|
+
return {
|
|
1920
|
+
...state,
|
|
1921
|
+
id: action.id
|
|
1922
|
+
};
|
|
1923
|
+
case "DND_DRAG_END":
|
|
1924
|
+
return {
|
|
1925
|
+
...state,
|
|
1926
|
+
id: null
|
|
1927
|
+
};
|
|
1928
|
+
case "DND_CURSOR":
|
|
1929
|
+
const c = action.cursor;
|
|
1930
|
+
if (c.type === "highlight" && c.id !== state.idWillReceiveDrop) return {
|
|
1931
|
+
...state,
|
|
1932
|
+
idWillReceiveDrop: c.id
|
|
1933
|
+
};
|
|
1934
|
+
else if (c.type !== "highlight" && state.idWillReceiveDrop !== null) return {
|
|
1935
|
+
...state,
|
|
1936
|
+
idWillReceiveDrop: null
|
|
1937
|
+
};
|
|
1938
|
+
else return state;
|
|
1939
|
+
default:
|
|
1940
|
+
return state;
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
|
|
1945
|
+
const $a18760514dcf279e$export$a8a69c316169e623 = (0, $g00cZ$combineReducers)({
|
|
1946
|
+
nodes: (0, $g00cZ$combineReducers)({
|
|
1947
|
+
focus: $c27b8e9863235052$export$1650419e431d3ba3,
|
|
1948
|
+
edit: $21783d2b0251be67$export$1650419e431d3ba3,
|
|
1949
|
+
open: $3c0bad2888bcd4bc$export$1650419e431d3ba3,
|
|
1950
|
+
selection: $37bc167debff36d2$export$1650419e431d3ba3,
|
|
1951
|
+
drag: $5c35ee13c124a8cc$export$1650419e431d3ba3
|
|
1952
|
+
}),
|
|
1953
|
+
dnd: $59f144a8dd651e5e$export$1650419e431d3ba3
|
|
1954
|
+
});
|
|
1955
|
+
|
|
1956
|
+
|
|
1957
|
+
|
|
1958
|
+
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
const $dac24389e46ba09d$var$SERVER_STATE = (0, $6ad32e02250c922e$export$d4c72bab9d6cc13a)();
|
|
1962
|
+
function $dac24389e46ba09d$export$c49dab5eb1b4ce0c({ treeProps: treeProps , imperativeHandle: imperativeHandle , children: children }) {
|
|
1963
|
+
const list = (0, $g00cZ$useRef)(null);
|
|
1964
|
+
const listEl = (0, $g00cZ$useRef)(null);
|
|
1965
|
+
const store = (0, $g00cZ$useRef)((0, $g00cZ$createStore)((0, $a18760514dcf279e$export$a8a69c316169e623), (0, $6ad32e02250c922e$export$d4c72bab9d6cc13a)(treeProps)));
|
|
1966
|
+
const state = (0, $g00cZ$useSyncExternalStore)(store.current.subscribe, store.current.getState, ()=>$dac24389e46ba09d$var$SERVER_STATE);
|
|
1967
|
+
/* The tree api object is stable. */ const api = (0, $g00cZ$useMemo)(()=>{
|
|
1968
|
+
return new (0, $bfece7c4aed4e9c4$export$e2da3477247342d1)(store.current, treeProps, list, listEl);
|
|
1969
|
+
}, []);
|
|
1970
|
+
/* Make sure the tree instance stays in sync */ const updateCount = (0, $g00cZ$useRef)(0);
|
|
1971
|
+
(0, $g00cZ$useMemo)(()=>{
|
|
1972
|
+
updateCount.current += 1;
|
|
1973
|
+
api.update(treeProps);
|
|
1974
|
+
}, [
|
|
1975
|
+
...Object.values(treeProps),
|
|
1976
|
+
state.nodes.open
|
|
1124
1977
|
]);
|
|
1125
|
-
$g00cZ$
|
|
1126
|
-
|
|
1978
|
+
/* Expose the tree api */ (0, $g00cZ$useImperativeHandle)(imperativeHandle, ()=>api);
|
|
1979
|
+
/* Change selection based on props */ (0, $g00cZ$useEffect)(()=>{
|
|
1980
|
+
if (api.props.selection) api.select(api.props.selection);
|
|
1981
|
+
else api.deselectAll();
|
|
1127
1982
|
}, [
|
|
1128
|
-
|
|
1983
|
+
api.props.selection
|
|
1129
1984
|
]);
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1985
|
+
/* Clear visability for filtered nodes */ (0, $g00cZ$useEffect)(()=>{
|
|
1986
|
+
if (!api.props.searchTerm) store.current.dispatch((0, $3c0bad2888bcd4bc$export$e324594224ef24da).clear(true));
|
|
1987
|
+
}, [
|
|
1988
|
+
api.props.searchTerm
|
|
1989
|
+
]);
|
|
1990
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)((0, $89e93131aae74bd9$export$feef243b04ff4151).Provider, {
|
|
1991
|
+
value: api,
|
|
1992
|
+
children: /*#__PURE__*/ (0, $g00cZ$jsx)((0, $89e93131aae74bd9$export$d0c71bc5e3e2d897).Provider, {
|
|
1993
|
+
value: updateCount.current,
|
|
1994
|
+
children: /*#__PURE__*/ (0, $g00cZ$jsx)((0, $89e93131aae74bd9$export$f6d467aa8b3786af).Provider, {
|
|
1995
|
+
value: state.nodes,
|
|
1996
|
+
children: /*#__PURE__*/ (0, $g00cZ$jsx)((0, $89e93131aae74bd9$export$2d5c5ceac203fc1e).Provider, {
|
|
1997
|
+
value: state.dnd,
|
|
1998
|
+
children: /*#__PURE__*/ (0, $g00cZ$jsx)((0, $g00cZ$DndProvider), {
|
|
1999
|
+
backend: (0, $g00cZ$HTML5Backend),
|
|
2000
|
+
options: {
|
|
2001
|
+
rootElement: api.props.dndRootElement || undefined
|
|
2002
|
+
},
|
|
2003
|
+
children: children
|
|
2004
|
+
})
|
|
2005
|
+
})
|
|
2006
|
+
})
|
|
2007
|
+
})
|
|
2008
|
+
});
|
|
1136
2009
|
}
|
|
1137
2010
|
|
|
1138
2011
|
|
|
1139
2012
|
|
|
1140
2013
|
|
|
1141
2014
|
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
2015
|
+
function $e739455e59c6aed3$export$5a6c424b1725f44f() {
|
|
2016
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)();
|
|
2017
|
+
// In case we drop an item at the bottom of the list
|
|
2018
|
+
const [, drop] = (0, $g00cZ$useDrop)(()=>({
|
|
1146
2019
|
accept: "NODE",
|
|
1147
|
-
canDrop: (item)=>{
|
|
1148
|
-
for (let id of item.dragIds){
|
|
1149
|
-
const drag = tree.getNode(id);
|
|
1150
|
-
if (!drag) return false;
|
|
1151
|
-
if ($0e6083160f4b36ed$export$769c5e872f5f8638(drag) && $0e6083160f4b36ed$export$1e38f72c6c546f70(node, drag)) return false;
|
|
1152
|
-
}
|
|
1153
|
-
return true;
|
|
1154
|
-
},
|
|
1155
2020
|
hover: (item, m)=>{
|
|
1156
|
-
if (m.
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
}
|
|
2021
|
+
if (!m.isOver({
|
|
2022
|
+
shallow: true
|
|
2023
|
+
})) return;
|
|
2024
|
+
const offset = m.getClientOffset();
|
|
2025
|
+
if (!tree.listEl.current || !offset) return;
|
|
2026
|
+
const { cursor: cursor } = (0, $2db980bfed6822da$export$f502ca02ebb85a1c)({
|
|
2027
|
+
element: tree.listEl.current,
|
|
2028
|
+
offset: offset,
|
|
2029
|
+
indent: tree.indent,
|
|
2030
|
+
node: null,
|
|
2031
|
+
prevNode: tree.visibleNodes[tree.visibleNodes.length - 1],
|
|
2032
|
+
nextNode: null
|
|
2033
|
+
});
|
|
2034
|
+
if (cursor) tree.showCursor(cursor);
|
|
2035
|
+
},
|
|
2036
|
+
canDrop: (item, m)=>{
|
|
2037
|
+
return m.isOver({
|
|
2038
|
+
shallow: true
|
|
2039
|
+
});
|
|
1169
2040
|
},
|
|
1170
2041
|
drop: (item, m)=>{
|
|
2042
|
+
if (m.didDrop()) return;
|
|
1171
2043
|
const offset = m.getClientOffset();
|
|
1172
|
-
if (!
|
|
1173
|
-
const { drop: drop } = $2db980bfed6822da$export$f502ca02ebb85a1c({
|
|
1174
|
-
element:
|
|
2044
|
+
if (!tree.listEl.current || !offset) return;
|
|
2045
|
+
const { drop: drop } = (0, $2db980bfed6822da$export$f502ca02ebb85a1c)({
|
|
2046
|
+
element: tree.listEl.current,
|
|
1175
2047
|
offset: offset,
|
|
1176
2048
|
indent: tree.indent,
|
|
1177
|
-
node:
|
|
1178
|
-
prevNode:
|
|
1179
|
-
nextNode:
|
|
2049
|
+
node: null,
|
|
2050
|
+
prevNode: tree.visibleNodes[tree.visibleNodes.length - 1],
|
|
2051
|
+
nextNode: null
|
|
1180
2052
|
});
|
|
1181
2053
|
return drop;
|
|
1182
2054
|
}
|
|
1183
|
-
})
|
|
1184
|
-
, [
|
|
1185
|
-
node,
|
|
1186
|
-
prev,
|
|
1187
|
-
el,
|
|
2055
|
+
}), [
|
|
1188
2056
|
tree
|
|
1189
2057
|
]);
|
|
2058
|
+
drop(tree.listEl);
|
|
1190
2059
|
}
|
|
1191
2060
|
|
|
1192
2061
|
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
const
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
2062
|
+
function $5d6a5680e6f62734$export$a6ee728c3c6ef11d(props) {
|
|
2063
|
+
(0, $e739455e59c6aed3$export$5a6c424b1725f44f)();
|
|
2064
|
+
return props.children;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
|
|
2068
|
+
|
|
2069
|
+
|
|
2070
|
+
|
|
2071
|
+
|
|
2072
|
+
function $f13a06e5444f84b6$export$cdf2ef3f6364d85() {
|
|
2073
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)();
|
|
2074
|
+
const Container = tree.props.renderContainer || (0, $065a164934293bf2$export$ff4858a4110d9246);
|
|
2075
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)((0, $g00cZ$Fragment), {
|
|
2076
|
+
children: /*#__PURE__*/ (0, $g00cZ$jsx)(Container, {})
|
|
2077
|
+
});
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
|
|
2081
|
+
|
|
2082
|
+
|
|
2083
|
+
|
|
2084
|
+
|
|
2085
|
+
function $8f8be4c9bb5ab52a$export$3e21b60650ec7e55() {
|
|
2086
|
+
const tree = (0, $89e93131aae74bd9$export$367b0f2231a90ba0)();
|
|
2087
|
+
const { offset: offset , mouse: mouse , item: item , isDragging: isDragging } = (0, $g00cZ$useDragLayer)((m)=>{
|
|
1213
2088
|
return {
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
isSelected: isSelected,
|
|
1219
|
-
isHoveringOverChild: isHoveringOverChild,
|
|
1220
|
-
isOpen: isOpen,
|
|
1221
|
-
isOverFolder: isOverFolder
|
|
2089
|
+
offset: m.getSourceClientOffset(),
|
|
2090
|
+
mouse: m.getClientOffset(),
|
|
2091
|
+
item: m.getItem(),
|
|
2092
|
+
isDragging: m.isDragging()
|
|
1222
2093
|
};
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
isDragging
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
2094
|
+
});
|
|
2095
|
+
const DragPreview = tree.props.renderDragPreview || (0, $77d34d95e44d2f58$export$84e211ad8431a387);
|
|
2096
|
+
return /*#__PURE__*/ (0, $g00cZ$jsx)(DragPreview, {
|
|
2097
|
+
offset: offset,
|
|
2098
|
+
mouse: mouse,
|
|
2099
|
+
id: item?.id || null,
|
|
2100
|
+
dragIds: item?.dragIds || [],
|
|
2101
|
+
isDragging: isDragging
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
|
|
2106
|
+
var $0a3913338341addb$exports = {};
|
|
2107
|
+
|
|
2108
|
+
$parcel$export($0a3913338341addb$exports, "useSimpleTree", () => $0a3913338341addb$export$dcd27aa2043b2724);
|
|
2109
|
+
|
|
2110
|
+
var $65f74606ca594063$exports = {};
|
|
2111
|
+
|
|
2112
|
+
$parcel$export($65f74606ca594063$exports, "SimpleTree", () => $65f74606ca594063$export$e32206264f456dce);
|
|
2113
|
+
class $65f74606ca594063$export$e32206264f456dce {
|
|
2114
|
+
constructor(data){
|
|
2115
|
+
this.root = $65f74606ca594063$var$createRoot(data);
|
|
2116
|
+
}
|
|
2117
|
+
get data() {
|
|
2118
|
+
return this.root.children?.map((node)=>node.data) ?? [];
|
|
2119
|
+
}
|
|
2120
|
+
create(args) {
|
|
2121
|
+
const parent = args.parentId ? this.find(args.parentId) : this.root;
|
|
2122
|
+
if (!parent) return null;
|
|
2123
|
+
parent.addChild(args.data, args.index);
|
|
2124
|
+
}
|
|
2125
|
+
move(args) {
|
|
2126
|
+
const src = this.find(args.id);
|
|
2127
|
+
const parent = args.parentId ? this.find(args.parentId) : this.root;
|
|
2128
|
+
if (!src || !parent) return;
|
|
2129
|
+
parent.addChild(src.data, args.index);
|
|
2130
|
+
src.drop();
|
|
2131
|
+
}
|
|
2132
|
+
update(args) {
|
|
2133
|
+
const node = this.find(args.id);
|
|
2134
|
+
if (node) node.update(args.changes);
|
|
2135
|
+
}
|
|
2136
|
+
drop(args) {
|
|
2137
|
+
const node = this.find(args.id);
|
|
2138
|
+
if (node) node.drop();
|
|
2139
|
+
}
|
|
2140
|
+
find(id, node = this.root) {
|
|
2141
|
+
if (!node) return null;
|
|
2142
|
+
if (node.id === id) return node;
|
|
2143
|
+
if (node.children) {
|
|
2144
|
+
for (let child of node.children){
|
|
2145
|
+
const found = this.find(id, child);
|
|
2146
|
+
if (found) return found;
|
|
1246
2147
|
}
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
2148
|
+
return null;
|
|
2149
|
+
}
|
|
2150
|
+
return null;
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
function $65f74606ca594063$var$createRoot(data) {
|
|
2154
|
+
const root = new $65f74606ca594063$var$SimpleNode({
|
|
2155
|
+
id: "ROOT"
|
|
2156
|
+
}, null);
|
|
2157
|
+
root.children = data.map((d)=>$65f74606ca594063$var$createNode(d, root));
|
|
2158
|
+
return root;
|
|
2159
|
+
}
|
|
2160
|
+
function $65f74606ca594063$var$createNode(data, parent) {
|
|
2161
|
+
const node = new $65f74606ca594063$var$SimpleNode(data, parent);
|
|
2162
|
+
if (data.children) node.children = data.children.map((d)=>$65f74606ca594063$var$createNode(d, node));
|
|
2163
|
+
return node;
|
|
2164
|
+
}
|
|
2165
|
+
class $65f74606ca594063$var$SimpleNode {
|
|
2166
|
+
constructor(data, parent){
|
|
2167
|
+
this.data = data;
|
|
2168
|
+
this.parent = parent;
|
|
2169
|
+
this.id = data.id;
|
|
2170
|
+
}
|
|
2171
|
+
hasParent() {
|
|
2172
|
+
return !!this.parent;
|
|
2173
|
+
}
|
|
2174
|
+
get childIndex() {
|
|
2175
|
+
return this.hasParent() ? this.parent.children.indexOf(this) : -1;
|
|
2176
|
+
}
|
|
2177
|
+
addChild(data, index) {
|
|
2178
|
+
const node = $65f74606ca594063$var$createNode(data, this);
|
|
2179
|
+
this.children = this.children ?? [];
|
|
2180
|
+
this.children.splice(index, 0, node);
|
|
2181
|
+
this.data.children = this.data.children ?? [];
|
|
2182
|
+
this.data.children.splice(index, 0, data);
|
|
2183
|
+
}
|
|
2184
|
+
removeChild(index) {
|
|
2185
|
+
this.children?.splice(index, 1);
|
|
2186
|
+
this.data.children?.splice(index, 1);
|
|
2187
|
+
}
|
|
2188
|
+
update(changes) {
|
|
2189
|
+
if (this.hasParent()) {
|
|
2190
|
+
const i = this.childIndex;
|
|
2191
|
+
this.parent.addChild({
|
|
2192
|
+
...this.data,
|
|
2193
|
+
...changes
|
|
2194
|
+
}, i);
|
|
2195
|
+
this.drop();
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
drop() {
|
|
2199
|
+
if (this.hasParent()) this.parent.removeChild(this.childIndex);
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
|
|
2204
|
+
let $0a3913338341addb$var$nextId = 0;
|
|
2205
|
+
function $0a3913338341addb$export$dcd27aa2043b2724(initialData) {
|
|
2206
|
+
const [data, setData] = (0, $g00cZ$useState)(initialData);
|
|
2207
|
+
const tree = (0, $g00cZ$useMemo)(()=>new (0, $65f74606ca594063$export$e32206264f456dce)(data), [
|
|
2208
|
+
data
|
|
1251
2209
|
]);
|
|
1252
|
-
const
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
2210
|
+
const onMove = (args)=>{
|
|
2211
|
+
for (const id of args.dragIds)tree.move({
|
|
2212
|
+
id: id,
|
|
2213
|
+
parentId: args.parentId,
|
|
2214
|
+
index: args.index
|
|
2215
|
+
});
|
|
2216
|
+
setData(tree.data);
|
|
2217
|
+
};
|
|
2218
|
+
const onRename = ({ name: name , id: id })=>{
|
|
2219
|
+
tree.update({
|
|
2220
|
+
id: id,
|
|
2221
|
+
changes: {
|
|
2222
|
+
name: name
|
|
2223
|
+
}
|
|
2224
|
+
});
|
|
2225
|
+
setData(tree.data);
|
|
2226
|
+
};
|
|
2227
|
+
const onCreate = ({ parentId: parentId , index: index , type: type })=>{
|
|
2228
|
+
const data = {
|
|
2229
|
+
id: `simple-tree-id-${$0a3913338341addb$var$nextId++}`,
|
|
2230
|
+
name: ""
|
|
1271
2231
|
};
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
2232
|
+
if (type === "internal") data.children = [];
|
|
2233
|
+
tree.create({
|
|
2234
|
+
parentId: parentId,
|
|
2235
|
+
index: index,
|
|
2236
|
+
data: data
|
|
2237
|
+
});
|
|
2238
|
+
setData(tree.data);
|
|
2239
|
+
return data;
|
|
2240
|
+
};
|
|
2241
|
+
const onDelete = (args)=>{
|
|
2242
|
+
args.ids.forEach((id)=>tree.drop({
|
|
2243
|
+
id: id
|
|
2244
|
+
}));
|
|
2245
|
+
setData(tree.data);
|
|
2246
|
+
};
|
|
2247
|
+
const controller = {
|
|
2248
|
+
onMove: onMove,
|
|
2249
|
+
onRename: onRename,
|
|
2250
|
+
onCreate: onCreate,
|
|
2251
|
+
onDelete: onDelete
|
|
2252
|
+
};
|
|
2253
|
+
return [
|
|
2254
|
+
data,
|
|
2255
|
+
controller
|
|
2256
|
+
];
|
|
2257
|
+
}
|
|
1291
2258
|
|
|
1292
2259
|
|
|
1293
|
-
function $
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
ref: tree.list,
|
|
1312
|
-
children: $2c0a5a237609003e$export$b59bdbef9ce70de2
|
|
1313
|
-
})
|
|
1314
|
-
}));
|
|
2260
|
+
function $c881d1adb735dfd0$export$d227906824a13416(props) {
|
|
2261
|
+
if (props.initialData && props.data) throw new Error(`React Arborist Tree => Provide either a data or initialData prop, but not both.`);
|
|
2262
|
+
if (props.initialData && (props.onCreate || props.onDelete || props.onMove || props.onRename)) throw new Error(`React Arborist Tree => You passed the initialData prop along with a data handler.
|
|
2263
|
+
Use the data prop if you want to provide your own handlers.`);
|
|
2264
|
+
if (props.initialData) {
|
|
2265
|
+
/**
|
|
2266
|
+
* Let's break the rules of hooks here. If the initialData prop
|
|
2267
|
+
* is provided, we will assume it will not change for the life of
|
|
2268
|
+
* the component.
|
|
2269
|
+
*
|
|
2270
|
+
* We will provide the real data and the handlers to update it.
|
|
2271
|
+
* */ const [data, controller] = (0, $0a3913338341addb$export$dcd27aa2043b2724)(props.initialData);
|
|
2272
|
+
return {
|
|
2273
|
+
...props,
|
|
2274
|
+
...controller,
|
|
2275
|
+
data: data
|
|
2276
|
+
};
|
|
2277
|
+
} else return props;
|
|
1315
2278
|
}
|
|
1316
2279
|
|
|
1317
2280
|
|
|
1318
|
-
const $2ba43033bb8eb39d$export$7fbedc92909ed28e = /*#__PURE__*/ $g00cZ$forwardRef(function
|
|
1319
|
-
const
|
|
1320
|
-
,
|
|
1321
|
-
|
|
1322
|
-
props.hideRoot,
|
|
1323
|
-
props.getChildren,
|
|
1324
|
-
props.isOpen,
|
|
1325
|
-
props.disableDrag,
|
|
1326
|
-
props.disableDrop,
|
|
1327
|
-
props.openByDefault,
|
|
1328
|
-
]);
|
|
1329
|
-
return(/*#__PURE__*/ $g00cZ$jsx($3a48b0a92affa3e3$export$6a399b2f7f12632c, {
|
|
1330
|
-
treeProps: props,
|
|
2281
|
+
const $2ba43033bb8eb39d$export$7fbedc92909ed28e = /*#__PURE__*/ (0, $g00cZ$forwardRef)(function Tree(props, ref) {
|
|
2282
|
+
const treeProps = (0, $c881d1adb735dfd0$export$d227906824a13416)(props);
|
|
2283
|
+
return /*#__PURE__*/ (0, $g00cZ$jsxs)((0, $dac24389e46ba09d$export$c49dab5eb1b4ce0c), {
|
|
2284
|
+
treeProps: treeProps,
|
|
1331
2285
|
imperativeHandle: ref,
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
/*#__PURE__*/ $g00cZ$jsx($5d6a5680e6f62734$export$a6ee728c3c6ef11d, {
|
|
1340
|
-
children: /*#__PURE__*/ $g00cZ$jsx($334f7345c929ac88$export$54c2e3dc7acea9f5, {
|
|
1341
|
-
className: props.className
|
|
1342
|
-
})
|
|
1343
|
-
}),
|
|
1344
|
-
/*#__PURE__*/ $g00cZ$jsx($6d8109ab8cbcd5e7$export$133773870222880f, {
|
|
1345
|
-
})
|
|
1346
|
-
]
|
|
1347
|
-
})
|
|
1348
|
-
}));
|
|
2286
|
+
children: [
|
|
2287
|
+
/*#__PURE__*/ (0, $g00cZ$jsx)((0, $5d6a5680e6f62734$export$a6ee728c3c6ef11d), {
|
|
2288
|
+
children: /*#__PURE__*/ (0, $g00cZ$jsx)((0, $f13a06e5444f84b6$export$cdf2ef3f6364d85), {})
|
|
2289
|
+
}),
|
|
2290
|
+
/*#__PURE__*/ (0, $g00cZ$jsx)((0, $8f8be4c9bb5ab52a$export$3e21b60650ec7e55), {})
|
|
2291
|
+
]
|
|
2292
|
+
});
|
|
1349
2293
|
});
|
|
1350
2294
|
|
|
1351
2295
|
|
|
2296
|
+
var $8c5b0bb55f55c0d2$exports = {};
|
|
2297
|
+
|
|
2298
|
+
|
|
2299
|
+
var $309635e603b9cc16$exports = {};
|
|
2300
|
+
|
|
2301
|
+
|
|
2302
|
+
var $c9ea992a6d07f0b8$exports = {};
|
|
2303
|
+
|
|
2304
|
+
|
|
2305
|
+
|
|
2306
|
+
|
|
2307
|
+
|
|
1352
2308
|
|
|
1353
2309
|
|
|
1354
2310
|
|
|
1355
|
-
export {$2ba43033bb8eb39d$export$7fbedc92909ed28e as Tree, $
|
|
2311
|
+
export {$2ba43033bb8eb39d$export$7fbedc92909ed28e as Tree, $096e74084443e9a3$export$d4b903da0f522dc8 as NodeApi, $bfece7c4aed4e9c4$export$e2da3477247342d1 as TreeApi, $65f74606ca594063$export$e32206264f456dce as SimpleTree, $0a3913338341addb$export$dcd27aa2043b2724 as useSimpleTree};
|
|
1356
2312
|
//# sourceMappingURL=module.js.map
|