@asup/tree-of-nodes 2.0.6 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/main.css +17 -1
- package/dist/cjs/main.css.map +1 -1
- package/dist/cjs/main.js +75 -143
- package/dist/cjs/main.js.map +1 -1
- package/dist/main.css +17 -1
- package/dist/main.css.map +1 -1
- package/dist/main.js +76 -140
- package/dist/main.js.map +1 -1
- package/dist/tree-of-nodes.d.ts +22 -19
- package/dist/tree-of-nodes.d.ts.map +1 -1
- package/package.json +33 -22
package/dist/main.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;AAKA;;;;;;;;AAQA;;;;;AAKA;;;;AAIA;;;;;;;;;AASA;;;;AAIA
|
|
1
|
+
{"mappings":"AAAA;;;;;AAKA;;;;;;;;AAQA;;;;;AAKA;;;;AAIA;;;;;;;;;AASA;;;;AAIA;;;;;;;;;;;;;;;;AAgBA;;;;AAIA;;;;;;;;;;;;;AAaA;;;;;AAKA;;;;;;;AAOA;;;;;;;AAMA;;;;;;;AAQA;;;;;;;;;;;AAUA;;;;;;;AASA;;;;;;AAKA;;;;AAGA","sources":["src/components/TreeNode.css"],"sourcesContent":[":root {\n --ton-transition-time: 0.3s;\n --ton-long-transition-time: 0.6s;\n}\n\n.tree-of-nodes {\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: 100%;\n gap: 1px;\n}\n\n.ton-checkbox {\n margin-right: 3px;\n margin-top: 3px;\n}\n\n.ton-expander {\n margin: 0;\n}\n\n.ton-node {\n display: flex;\n align-items: center;\n cursor: pointer;\n width: 100%;\n max-width: 100%;\n height: 30px;\n}\n\n.ton-label {\n height: 26px;\n}\n\n.ton-label-span {\n border-radius: 3px;\n border: 1px solid transparent;\n box-sizing: border-box;\n display: inline-block;\n font-family: inherit;\n font-size: inherit;\n font-weight: inherit;\n line-height: 24px;\n overflow: hidden;\n padding: 1px 3px;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: 100%;\n}\n\n.ton-rename-holder {\n width: 100%;\n}\n\n.ton-rename {\n border-radius: 3px;\n border: 1px dotted black;\n box-sizing: border-box;\n font-family: inherit;\n font-size: inherit;\n font-weight: inherit;\n line-height: 24px;\n min-width: 0;\n padding: 1px 3px;\n width: 100%;\n}\n\n.ton-rename:focus {\n outline: none;\n box-shadow: none;\n}\n\n.ton-child {\n margin-left: 16px;\n display: block;\n opacity: 1;\n transition: opacity var(--ton-long-transition-time) linear;\n}\n\n.ton-collapsible-wrapper {\n display: flex;\n overflow: hidden;\n width: 100%;\n max-width: 100%;\n}\n.ton-collapsible-wrapper:after {\n content: \"\";\n height: 1px;\n transition:\n height var(--ton-transition-time) linear,\n max-height 0s var(--ton-transition-time) linear;\n max-height: 0px;\n}\n.ton-collapsible {\n display: flex;\n flex-direction: column;\n gap: 1px;\n transition: margin-bottom var(--ton-transition-time) cubic-bezier(0, 0, 0, 1);\n margin-top: 1px;\n margin-bottom: 1px;\n max-height: 10000px;\n width: 100%;\n}\n.ton-collapsible-wrapper.collapsed > .ton-collapsible {\n margin-bottom: -2000px;\n transition:\n margin-bottom var(--ton-transition-time) cubic-bezier(1, 0, 1, 1),\n visibility 0s var(--ton-transition-time),\n max-height 0s var(--ton-transition-time);\n visibility: hidden;\n max-height: 0;\n}\n.ton-collapsible-wrapper.collapsed:after {\n height: 0;\n transition: height var(--ton-transition-time) linear;\n max-height: 20px;\n}\n.ton-collapsible-wrapper.collapsed {\n visibility: hidden;\n}\n.ton-collapsible-wrapper.collapsed .ton-child {\n opacity: 0;\n transition: opacity var(--ton-long-transition-time) linear;\n}\n"],"names":[],"version":3,"file":"main.css.map"}
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
2
|
import {jsxs as $duWW8$jsxs, Fragment as $duWW8$Fragment, jsx as $duWW8$jsx} from "react/jsx-runtime";
|
|
3
3
|
import {ContextMenuHandler as $duWW8$ContextMenuHandler} from "@asup/context-menu";
|
|
4
|
-
import
|
|
4
|
+
import {useContext as $duWW8$useContext, useState as $duWW8$useState, useRef as $duWW8$useRef, useEffect as $duWW8$useEffect, createContext as $duWW8$createContext, forwardRef as $duWW8$forwardRef} from "react";
|
|
5
5
|
import {ExclamationCircleFill as $duWW8$ExclamationCircleFill, CaretRightFill as $duWW8$CaretRightFill, CaretDownFill as $duWW8$CaretDownFill, CaretRight as $duWW8$CaretRight} from "react-bootstrap-icons";
|
|
6
6
|
import {Spinner as $duWW8$Spinner} from "react-bootstrap";
|
|
7
7
|
|
|
@@ -53,29 +53,19 @@ const $886f402bccb0fd30$export$29ec378200e05207 = (0, $duWW8$createContext)(unde
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
const $84765747a8c6bfe2$export$14f190ac910bde69 = /*#__PURE__*/ (0, $duWW8$
|
|
56
|
+
const $84765747a8c6bfe2$export$14f190ac910bde69 = /*#__PURE__*/ (0, $duWW8$forwardRef)(({ id: id, className: className, value: value, editing: editing, saving: saving, setValue: setValue, sendEscape: sendEscape, style: style, spellCheck: spellCheck = "true" }, ref)=>{
|
|
57
57
|
const [currentValue, setCurrentValue] = (0, $duWW8$useState)(value !== null && value !== void 0 ? value : "");
|
|
58
58
|
(0, $duWW8$useEffect)(()=>{
|
|
59
59
|
setCurrentValue(value !== null && value !== void 0 ? value : "");
|
|
60
60
|
}, [
|
|
61
61
|
value
|
|
62
62
|
]);
|
|
63
|
-
const
|
|
64
|
-
setValue === null || setValue === void 0 ? void 0 : setValue(currentValue);
|
|
65
|
-
}, [
|
|
66
|
-
currentValue,
|
|
67
|
-
setValue
|
|
68
|
-
]);
|
|
69
|
-
const keyPress = (0, $duWW8$useCallback)((e)=>{
|
|
63
|
+
const keyPress = (e)=>{
|
|
70
64
|
if (e.code === "Escape") {
|
|
71
65
|
setCurrentValue(value !== null && value !== void 0 ? value : "");
|
|
72
66
|
sendEscape === null || sendEscape === void 0 ? void 0 : sendEscape();
|
|
73
|
-
} else if (e.code === "Enter")
|
|
74
|
-
}
|
|
75
|
-
returnData,
|
|
76
|
-
sendEscape,
|
|
77
|
-
value
|
|
78
|
-
]);
|
|
67
|
+
} else if (e.code === "Enter") setValue === null || setValue === void 0 ? void 0 : setValue(currentValue);
|
|
68
|
+
};
|
|
79
69
|
// Add window onMouseDown event to stop events when editing
|
|
80
70
|
(0, $duWW8$useEffect)(()=>{
|
|
81
71
|
const handleMouseDown = (e)=>{
|
|
@@ -83,7 +73,7 @@ const $84765747a8c6bfe2$export$14f190ac910bde69 = /*#__PURE__*/ (0, $duWW8$react
|
|
|
83
73
|
if (editing && target.id !== `${id}` && target.id !== `${id}-holder` && target.id !== `${id}-spinner` && target.className !== "ton-rename") {
|
|
84
74
|
e.preventDefault();
|
|
85
75
|
e.stopPropagation();
|
|
86
|
-
|
|
76
|
+
setValue === null || setValue === void 0 ? void 0 : setValue(currentValue);
|
|
87
77
|
}
|
|
88
78
|
};
|
|
89
79
|
window.addEventListener("mousedown", handleMouseDown);
|
|
@@ -91,9 +81,10 @@ const $84765747a8c6bfe2$export$14f190ac910bde69 = /*#__PURE__*/ (0, $duWW8$react
|
|
|
91
81
|
window.removeEventListener("mousedown", handleMouseDown);
|
|
92
82
|
};
|
|
93
83
|
}, [
|
|
84
|
+
currentValue,
|
|
94
85
|
editing,
|
|
95
86
|
id,
|
|
96
|
-
|
|
87
|
+
setValue
|
|
97
88
|
]);
|
|
98
89
|
return !editing ? /*#__PURE__*/ (0, $duWW8$jsx)("span", {
|
|
99
90
|
className: "ton-label-span",
|
|
@@ -118,11 +109,14 @@ const $84765747a8c6bfe2$export$14f190ac910bde69 = /*#__PURE__*/ (0, $duWW8$react
|
|
|
118
109
|
id: String(id),
|
|
119
110
|
ref: ref,
|
|
120
111
|
type: "text",
|
|
121
|
-
className:
|
|
112
|
+
className: [
|
|
113
|
+
"ton-rename",
|
|
114
|
+
className
|
|
115
|
+
].filter(Boolean).join(" "),
|
|
122
116
|
value: currentValue,
|
|
123
117
|
disabled: saving,
|
|
124
118
|
onChange: (e)=>setCurrentValue(e.currentTarget.value),
|
|
125
|
-
onBlur:
|
|
119
|
+
onBlur: (e)=>setValue === null || setValue === void 0 ? void 0 : setValue(e.currentTarget.value),
|
|
126
120
|
onKeyDownCapture: keyPress
|
|
127
121
|
})
|
|
128
122
|
]
|
|
@@ -135,39 +129,15 @@ const $47c36cf4281201f5$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
135
129
|
// Contexts
|
|
136
130
|
const treeContext = (0, $duWW8$useContext)((0, $886f402bccb0fd30$export$29ec378200e05207));
|
|
137
131
|
// Node information
|
|
138
|
-
const thisNode =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
]);
|
|
142
|
-
const childNodes = (0, $duWW8$useMemo)(()=>treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList.filter((n)=>n.parentId === id), [
|
|
143
|
-
id,
|
|
144
|
-
treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList
|
|
145
|
-
]);
|
|
146
|
-
const descendents = (0, $duWW8$useMemo)(()=>{
|
|
147
|
-
var _treeContext_nodeList;
|
|
148
|
-
return (0, $33abc00b1ca5c55c$export$bd923365b402cb04)(id, (_treeContext_nodeList = treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList) !== null && _treeContext_nodeList !== void 0 ? _treeContext_nodeList : []);
|
|
149
|
-
}, [
|
|
150
|
-
id,
|
|
151
|
-
treeContext
|
|
152
|
-
]);
|
|
132
|
+
const thisNode = treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList.find((n)=>n.id === id);
|
|
133
|
+
const childNodes = treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList.filter((n)=>n.parentId === id);
|
|
134
|
+
var _treeContext_nodeList;
|
|
135
|
+
const descendents = (0, $33abc00b1ca5c55c$export$bd923365b402cb04)(id, (_treeContext_nodeList = treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList) !== null && _treeContext_nodeList !== void 0 ? _treeContext_nodeList : []);
|
|
153
136
|
// State
|
|
154
137
|
const [error, setError] = (0, $duWW8$useState)(false);
|
|
155
138
|
const [errorText, setErrorText] = (0, $duWW8$useState)("");
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return ((_treeContext_expandedNodes_findIndex = treeContext === null || treeContext === void 0 ? void 0 : treeContext.expandedNodes.findIndex((e)=>e === id)) !== null && _treeContext_expandedNodes_findIndex !== void 0 ? _treeContext_expandedNodes_findIndex : -1) > -1;
|
|
159
|
-
}, [
|
|
160
|
-
id,
|
|
161
|
-
treeContext === null || treeContext === void 0 ? void 0 : treeContext.expandedNodes
|
|
162
|
-
]);
|
|
163
|
-
// Ensures that child nodes are drawn before they are expanded
|
|
164
|
-
const [hasRenderedClosed, setHasRenderedClosed] = (0, $duWW8$useState)(childNodes !== undefined && childNodes.length > 0);
|
|
165
|
-
(0, $duWW8$useEffect)(()=>{
|
|
166
|
-
if (childNodes && childNodes.length > 0 && !hasRenderedClosed) setHasRenderedClosed(true);
|
|
167
|
-
}, [
|
|
168
|
-
childNodes,
|
|
169
|
-
hasRenderedClosed
|
|
170
|
-
]);
|
|
139
|
+
var _treeContext_expandedNodes_findIndex;
|
|
140
|
+
const expanded = ((_treeContext_expandedNodes_findIndex = treeContext === null || treeContext === void 0 ? void 0 : treeContext.expandedNodes.findIndex((e)=>e === id)) !== null && _treeContext_expandedNodes_findIndex !== void 0 ? _treeContext_expandedNodes_findIndex : -1) > -1;
|
|
171
141
|
// Checkbox
|
|
172
142
|
const checkRef = (0, $duWW8$useRef)(null);
|
|
173
143
|
(0, $duWW8$useEffect)(()=>{
|
|
@@ -189,13 +159,8 @@ const $47c36cf4281201f5$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
189
159
|
treeContext === null || treeContext === void 0 ? void 0 : treeContext.selected
|
|
190
160
|
]);
|
|
191
161
|
// Apply selected border
|
|
192
|
-
const currentBorder = (0
|
|
193
|
-
|
|
194
|
-
}, [
|
|
195
|
-
id,
|
|
196
|
-
treeContext === null || treeContext === void 0 ? void 0 : treeContext.selected
|
|
197
|
-
]);
|
|
198
|
-
const nodeColour = (0, $duWW8$useMemo)(()=>{
|
|
162
|
+
const currentBorder = (treeContext === null || treeContext === void 0 ? void 0 : treeContext.selected.includes(id)) ? "1px solid black" : "";
|
|
163
|
+
const nodeColour = (()=>{
|
|
199
164
|
if (treeContext && treeContext.selected) {
|
|
200
165
|
const anc = (0, $6303f0814ed0ce8b$export$c6fd3ab3f44300d0)(treeContext.selected, [], treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList).map((n)=>n.id);
|
|
201
166
|
if ([
|
|
@@ -204,10 +169,7 @@ const $47c36cf4281201f5$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
204
169
|
].includes(id)) return treeContext.nodeHighlight;
|
|
205
170
|
}
|
|
206
171
|
return;
|
|
207
|
-
}
|
|
208
|
-
id,
|
|
209
|
-
treeContext
|
|
210
|
-
]);
|
|
172
|
+
})();
|
|
211
173
|
// New node parameters
|
|
212
174
|
const newNameRef = (0, $duWW8$useRef)(null);
|
|
213
175
|
const [showNewNode, setShowNewNode] = (0, $duWW8$useState)(false);
|
|
@@ -217,7 +179,7 @@ const $47c36cf4281201f5$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
217
179
|
const [renaming, setRenaming] = (0, $duWW8$useState)(false);
|
|
218
180
|
const [updatingNode, setUpdatingNode] = (0, $duWW8$useState)(false);
|
|
219
181
|
// Context functions
|
|
220
|
-
const handleReturn = (
|
|
182
|
+
const handleReturn = (ret)=>{
|
|
221
183
|
if (!ret.success) {
|
|
222
184
|
setError(true);
|
|
223
185
|
var _ret_ErrorText;
|
|
@@ -226,86 +188,57 @@ const $47c36cf4281201f5$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
226
188
|
setError(false);
|
|
227
189
|
setErrorText("");
|
|
228
190
|
}
|
|
229
|
-
}
|
|
230
|
-
const confirmNewNode =
|
|
191
|
+
};
|
|
192
|
+
const confirmNewNode = async (label)=>{
|
|
231
193
|
setSavingNewNode(true);
|
|
232
194
|
if (treeContext === null || treeContext === void 0 ? void 0 : treeContext.onAddChild) handleReturn(await treeContext.onAddChild(id, label));
|
|
233
195
|
setSavingNewNode(false);
|
|
234
196
|
setShowNewNode(false);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
id,
|
|
238
|
-
treeContext
|
|
239
|
-
]);
|
|
240
|
-
const renameNode = (0, $duWW8$useCallback)(async (newLabel)=>{
|
|
197
|
+
};
|
|
198
|
+
const renameNode = async (newLabel)=>{
|
|
241
199
|
setRenaming(false);
|
|
242
200
|
if (treeContext === null || treeContext === void 0 ? void 0 : treeContext.onRename) {
|
|
243
201
|
setUpdatingNode(true);
|
|
244
202
|
handleReturn(await treeContext.onRename(id, newLabel));
|
|
245
203
|
setUpdatingNode(false);
|
|
246
204
|
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
id,
|
|
250
|
-
treeContext
|
|
251
|
-
]);
|
|
252
|
-
const deleteThis = (0, $duWW8$useCallback)(async ()=>{
|
|
205
|
+
};
|
|
206
|
+
const deleteThis = async ()=>{
|
|
253
207
|
if (treeContext === null || treeContext === void 0 ? void 0 : treeContext.onRemove) {
|
|
254
208
|
setUpdatingNode(true);
|
|
255
209
|
handleReturn(await treeContext.onRemove(id));
|
|
256
210
|
setUpdatingNode(false);
|
|
257
211
|
}
|
|
258
|
-
}
|
|
259
|
-
handleReturn,
|
|
260
|
-
id,
|
|
261
|
-
treeContext
|
|
262
|
-
]);
|
|
212
|
+
};
|
|
263
213
|
// Context actions
|
|
264
|
-
const addChild = (
|
|
214
|
+
const addChild = ()=>{
|
|
265
215
|
var _treeContext_handleExpandClick;
|
|
266
216
|
setShowNewNode(true);
|
|
267
217
|
treeContext === null || treeContext === void 0 ? void 0 : (_treeContext_handleExpandClick = treeContext.handleExpandClick) === null || _treeContext_handleExpandClick === void 0 ? void 0 : _treeContext_handleExpandClick.call(treeContext, id, true);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
treeContext
|
|
271
|
-
]);
|
|
272
|
-
(0, $duWW8$useEffect)(()=>{
|
|
273
|
-
if (showNewNode === true && newNameRef.current) newNameRef.current.focus();
|
|
274
|
-
}, [
|
|
275
|
-
showNewNode
|
|
276
|
-
]);
|
|
277
|
-
const renameThis = (0, $duWW8$useCallback)(()=>{
|
|
218
|
+
};
|
|
219
|
+
const renameThis = ()=>{
|
|
278
220
|
var _treeContext_handleSelect;
|
|
279
221
|
setRenaming(true);
|
|
280
222
|
treeContext === null || treeContext === void 0 ? void 0 : (_treeContext_handleSelect = treeContext.handleSelect) === null || _treeContext_handleSelect === void 0 ? void 0 : _treeContext_handleSelect.call(treeContext, id);
|
|
281
|
-
}
|
|
282
|
-
id,
|
|
283
|
-
treeContext
|
|
284
|
-
]);
|
|
223
|
+
};
|
|
285
224
|
// Context menu
|
|
286
|
-
const menuItems =
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
225
|
+
const menuItems = [];
|
|
226
|
+
if (canAddChildren) menuItems.push({
|
|
227
|
+
label: "Add",
|
|
228
|
+
action: addChild
|
|
229
|
+
});
|
|
230
|
+
if (canRename) menuItems.push({
|
|
231
|
+
label: "Rename",
|
|
232
|
+
action: renameThis
|
|
233
|
+
});
|
|
234
|
+
if (canRemove && (childNodes === undefined || childNodes.length === 0)) menuItems.push({
|
|
235
|
+
label: "Delete",
|
|
236
|
+
action: deleteThis
|
|
237
|
+
});
|
|
238
|
+
(0, $duWW8$useEffect)(()=>{
|
|
239
|
+
if (showNewNode === true && newNameRef.current) newNameRef.current.focus();
|
|
301
240
|
}, [
|
|
302
|
-
|
|
303
|
-
canAddChildren,
|
|
304
|
-
canRemove,
|
|
305
|
-
canRename,
|
|
306
|
-
childNodes,
|
|
307
|
-
deleteThis,
|
|
308
|
-
renameThis
|
|
241
|
+
showNewNode
|
|
309
242
|
]);
|
|
310
243
|
// Return node
|
|
311
244
|
return !treeContext ? null : /*#__PURE__*/ (0, $duWW8$jsxs)((0, $duWW8$Fragment), {
|
|
@@ -393,6 +326,7 @@ const $47c36cf4281201f5$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
393
326
|
},
|
|
394
327
|
children: /*#__PURE__*/ (0, $duWW8$jsx)((0, $84765747a8c6bfe2$export$14f190ac910bde69), {
|
|
395
328
|
id: `${treeContext.id}-treenode-entry-${id}`,
|
|
329
|
+
className: currentBorder ? "selected" : "",
|
|
396
330
|
ref: currentNameRef,
|
|
397
331
|
value: thisNode.label,
|
|
398
332
|
editing: renaming,
|
|
@@ -412,7 +346,7 @@ const $47c36cf4281201f5$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
412
346
|
})
|
|
413
347
|
}),
|
|
414
348
|
childNodes && /*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
415
|
-
className: `ton-collapsible-wrapper ${expanded &&
|
|
349
|
+
className: `ton-collapsible-wrapper ${expanded && childNodes.length > 0 ? "" : "collapsed"}`,
|
|
416
350
|
children: childNodes.length > 0 && /*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
417
351
|
className: "ton-collapsible",
|
|
418
352
|
children: childNodes.map((h)=>/*#__PURE__*/ (0, $duWW8$jsx)("span", {
|
|
@@ -460,26 +394,28 @@ const $c7008d808d3e1c7a$export$40c47a7ac5f85aba = (nodeList, selected, expandedN
|
|
|
460
394
|
|
|
461
395
|
|
|
462
396
|
|
|
463
|
-
const $ba47aaf387735a90$export$5580fff3e08a8be5 = ({
|
|
464
|
-
const [
|
|
465
|
-
const
|
|
466
|
-
selected
|
|
467
|
-
], [
|
|
468
|
-
selected
|
|
469
|
-
]);
|
|
397
|
+
const $ba47aaf387735a90$export$5580fff3e08a8be5 = ({ alwaysShowSelected: alwaysShowSelected = "first", canAddChildren: canAddChildren = false, canRemoveChildren: canRemoveChildren = false, canRemoveRoot: canRemoveRoot = false, canRenameChildren: canRenameChildren = false, canRenameRoot: canRenameRoot = false, handleSelect: handleSelect, id: id, initiallyExpandedNodes: initiallyExpandedNodes = [], nodeHighlight: nodeHighlight = "red", nodeList: nodeList, onAdd: onAdd, onRemove: onRemove, onRename: onRename, roots: roots, selected: selected = [], showCheckBox: showCheckBox = false, spellCheck: spellCheck = "true", textHighlight: textHighlight = "rgba(255, 0, 0, 0.2)" })=>{
|
|
398
|
+
const [firstRender, setFirstRender] = (0, $duWW8$useState)(alwaysShowSelected === "first");
|
|
399
|
+
const [expandedNodes, setExpandedNodes] = (0, $duWW8$useState)(initiallyExpandedNodes);
|
|
470
400
|
(0, $duWW8$useEffect)(()=>{
|
|
471
|
-
|
|
401
|
+
const selectedArray = Array.isArray(selected) ? selected : [
|
|
402
|
+
selected
|
|
403
|
+
];
|
|
404
|
+
if ((alwaysShowSelected === "always" || firstRender) && selectedArray.length > 0) {
|
|
472
405
|
// Check all nodes are showing that should be
|
|
473
406
|
const shouldExpand = (0, $c7008d808d3e1c7a$export$40c47a7ac5f85aba)(nodeList, selectedArray, expandedNodes);
|
|
474
407
|
if (shouldExpand.filter((n)=>!expandedNodes.includes(n)).length > 0) setExpandedNodes(shouldExpand);
|
|
408
|
+
setFirstRender(false);
|
|
475
409
|
}
|
|
476
410
|
}, [
|
|
411
|
+
alwaysShowSelected,
|
|
412
|
+
firstRender,
|
|
477
413
|
expandedNodes,
|
|
478
414
|
nodeList,
|
|
479
|
-
|
|
415
|
+
selected
|
|
480
416
|
]);
|
|
481
417
|
// Change expansion and update contexts
|
|
482
|
-
const changeExpand = (
|
|
418
|
+
const changeExpand = (eKey, force)=>{
|
|
483
419
|
const newExpandedNodes = [
|
|
484
420
|
...expandedNodes
|
|
485
421
|
];
|
|
@@ -487,27 +423,27 @@ const $ba47aaf387735a90$export$5580fff3e08a8be5 = ({ id: id, nodeList: nodeList,
|
|
|
487
423
|
if (ix === -1 && force === undefined || force === true) newExpandedNodes.push(eKey);
|
|
488
424
|
else newExpandedNodes.splice(ix, 1);
|
|
489
425
|
setExpandedNodes(newExpandedNodes);
|
|
490
|
-
}
|
|
491
|
-
expandedNodes
|
|
492
|
-
]);
|
|
426
|
+
};
|
|
493
427
|
return /*#__PURE__*/ (0, $duWW8$jsx)("div", {
|
|
494
428
|
id: id,
|
|
495
429
|
className: "tree-of-nodes",
|
|
496
|
-
children: /*#__PURE__*/ (0, $duWW8$jsx)((0, $886f402bccb0fd30$export$29ec378200e05207)
|
|
430
|
+
children: /*#__PURE__*/ (0, $duWW8$jsx)((0, $886f402bccb0fd30$export$29ec378200e05207), {
|
|
497
431
|
value: {
|
|
498
432
|
id: id,
|
|
499
|
-
nodeList: nodeList,
|
|
500
|
-
selected: selectedArray,
|
|
501
|
-
showCheckBox: showCheckBox,
|
|
502
|
-
handleSelect: handleSelect,
|
|
503
433
|
expandedNodes: expandedNodes,
|
|
504
434
|
handleExpandClick: (r, f)=>changeExpand(r, f),
|
|
435
|
+
handleSelect: handleSelect,
|
|
436
|
+
nodeHighlight: nodeHighlight,
|
|
437
|
+
nodeList: nodeList,
|
|
505
438
|
onAddChild: onAdd,
|
|
506
|
-
onRename: onRename,
|
|
507
439
|
onRemove: onRemove,
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
440
|
+
onRename: onRename,
|
|
441
|
+
selected: Array.isArray(selected) ? selected : [
|
|
442
|
+
selected
|
|
443
|
+
],
|
|
444
|
+
showCheckBox: showCheckBox,
|
|
445
|
+
spellCheck: spellCheck,
|
|
446
|
+
textHighlight: textHighlight
|
|
511
447
|
},
|
|
512
448
|
children: roots.map((r)=>/*#__PURE__*/ (0, $duWW8$jsx)((0, $47c36cf4281201f5$export$2eba8ec3a333fdbb), {
|
|
513
449
|
id: r,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AAa,MAAM,CAAC,CAAC,IAAM,CAAC,cAAc,QAAQ,CAAC,IAAI,MAAM,GAAG,GAClE,iBAAiB;QAErB;IACF,GAAG;QAAC;QAAe;QAAU;KAAc;IAE3C,uCAAuC;IACvC,MAAM,eAAe,CAAA,GAAA,kBAAU,EAC7B,CAAC,MAAW;QACV,MAAM,mBAAmB;eAAI;SAAc;QAC3C,MAAM,KAAK,iBAAiB,SAAS,CAAC,CAAC,OAAS,SAAS;QACzD,IAAI,AAAC,OAAO,MAAM,UAAU,aAAc,UAAU,MAAM,iBAAiB,IAAI,CAAC;aAC3E,iBAAiB,MAAM,CAAC,IAAI;QACjC,iBAAiB;IACnB,GACA;QAAC;KAAc;IAGjB,qBACE,gBAAC;QACC,IAAI;QACJ,WAAU;kBAEV,cAAA,gBAAC,CAAA,GAAA,yCAAiB,EAAE,QAAQ;YAC1B,OAAO;gBACL,IAAI;0BACJ;gBACA,UAAU;8BACV;8BACA;+BACA;gBACA,mBAAmB,CAAC,GAAG,IAAM,aAAa,GAAG;gBAC7C,YAAY;0BACZ;0BACA;+BACA;+BACA;4BACA;YACF;sBAEC,MAAM,GAAG,CAAC,CAAC,kBACV,gBAAC,CAAA,GAAA,yCAAO;oBAEN,IAAI;oBACJ,WAAW;oBACX,gBAAgB;oBAChB,WAAW;oBACX,mBAAmB;oBACnB,mBAAmB;mBANd;;;AAYjB;AAEA,0CAAY,WAAW,GAAG;;;;;;;;;;;","sources":["src/main.ts","src/components/index.ts","src/components/TreeNode.tsx","src/functions/getAncestors.tsx","src/functions/getDescendentIds.ts","src/components/TreeOfNodesContext.ts","src/components/WordEntry.tsx","src/components/TreeOfNodes.tsx","src/functions/checkExpandedNodes.ts","src/functions/index.ts"],"sourcesContent":["export * from \"./components\";\nexport * from \"./functions\";\n","import { TreeNode } from \"./TreeNode\";\nimport { TreeOfNodes } from \"./TreeOfNodes\";\nimport { iNodeUpdate, TreeNodeBase, TreeNodeData } from \"./interface\";\nimport { WordEntry } from \"./WordEntry\";\n\nexport { TreeNode, TreeOfNodes, WordEntry };\nexport type { TreeNodeBase, TreeNodeData, iNodeUpdate };\n","import { ContextMenuHandler, MenuItem } from \"@asup/context-menu\";\nimport {\n Key,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n CaretDownFill,\n CaretRight,\n CaretRightFill,\n ExclamationCircleFill,\n} from \"react-bootstrap-icons\";\nimport { getAncestors } from \"../functions/getAncestors\";\nimport { getDescendentIds } from \"../functions/getDescendentIds\";\nimport \"./TreeNode.css\";\nimport { TreeOfNodesContext } from \"./TreeOfNodesContext\";\nimport { WordEntry } from \"./WordEntry\";\nimport { iNodeUpdate } from \"./interface\";\n\ninterface TreeNodeProps {\n id: Key;\n indentLevel?: number;\n canRemove?: boolean;\n canRename?: boolean;\n canAddChildren?: boolean;\n canRemoveChildren?: boolean;\n canRenameChildren?: boolean;\n refresh?: () => void;\n}\n\nexport const TreeNode = ({\n id,\n canRemove,\n canRename,\n canAddChildren,\n canRemoveChildren,\n canRenameChildren,\n}: TreeNodeProps): ReactNode => {\n // Contexts\n const treeContext = useContext(TreeOfNodesContext);\n\n // Node information\n const thisNode = useMemo(\n () => treeContext?.nodeList.find((n) => n.id === id),\n [id, treeContext?.nodeList],\n );\n const childNodes = useMemo(\n () => treeContext?.nodeList.filter((n) => n.parentId === id),\n [id, treeContext?.nodeList],\n );\n const descendents = useMemo(\n () => getDescendentIds(id, treeContext?.nodeList ?? []),\n [id, treeContext],\n );\n\n // State\n const [error, setError] = useState<boolean>(false);\n const [errorText, setErrorText] = useState<string>(\"\");\n const expanded = useMemo(() => {\n return (treeContext?.expandedNodes.findIndex((e) => e === id) ?? -1) > -1;\n }, [id, treeContext?.expandedNodes]);\n\n // Ensures that child nodes are drawn before they are expanded\n const [hasRenderedClosed, setHasRenderedClosed] = useState<boolean>(\n childNodes !== undefined && childNodes.length > 0,\n );\n useEffect(() => {\n if (childNodes && childNodes.length > 0 && !hasRenderedClosed) {\n setHasRenderedClosed(true);\n }\n }, [childNodes, hasRenderedClosed]);\n\n // Checkbox\n const checkRef = useRef<HTMLInputElement | null>(null);\n useEffect(() => {\n if (checkRef.current) {\n if (treeContext?.selected.includes(id)) {\n checkRef.current.checked = true;\n checkRef.current.indeterminate = false;\n } else if (descendents.some((d) => treeContext?.selected.includes(d))) {\n checkRef.current.checked = false;\n checkRef.current.indeterminate = true;\n } else {\n checkRef.current.checked = false;\n checkRef.current.indeterminate = false;\n }\n }\n }, [descendents, id, treeContext?.selected]);\n\n // Apply selected border\n const currentBorder = useMemo<string>(() => {\n return treeContext?.selected.includes(id) ? \"1px solid black\" : \"\";\n }, [id, treeContext?.selected]);\n const nodeColour = useMemo<string | undefined>(() => {\n if (treeContext && treeContext.selected) {\n const anc = getAncestors(treeContext.selected, [], treeContext?.nodeList).map((n) => n.id);\n if ([...anc, treeContext.selected].includes(id)) return treeContext.nodeHighlight;\n }\n return;\n }, [id, treeContext]);\n\n // New node parameters\n const newNameRef = useRef<HTMLInputElement | null>(null);\n const [showNewNode, setShowNewNode] = useState<boolean>(false);\n const [savingNewNode, setSavingNewNode] = useState<boolean>(false);\n\n // Rename parameters\n const currentNameRef = useRef<HTMLInputElement | null>(null);\n const [renaming, setRenaming] = useState<boolean>(false);\n const [updatingNode, setUpdatingNode] = useState<boolean>(false);\n\n // Context functions\n const handleReturn = useCallback((ret: iNodeUpdate) => {\n if (!ret.success) {\n setError(true);\n setErrorText(ret.ErrorText ?? \"An unknown error has occured\");\n } else {\n setError(false);\n setErrorText(\"\");\n }\n }, []);\n\n const confirmNewNode = useCallback(\n async (label: string) => {\n setSavingNewNode(true);\n if (treeContext?.onAddChild) {\n handleReturn(await treeContext.onAddChild(id, label));\n }\n setSavingNewNode(false);\n setShowNewNode(false);\n },\n [handleReturn, id, treeContext],\n );\n\n const renameNode = useCallback(\n async (newLabel: string) => {\n setRenaming(false);\n if (treeContext?.onRename) {\n setUpdatingNode(true);\n handleReturn(await treeContext.onRename(id, newLabel));\n setUpdatingNode(false);\n }\n },\n [handleReturn, id, treeContext],\n );\n\n const deleteThis = useCallback(async () => {\n if (treeContext?.onRemove) {\n setUpdatingNode(true);\n handleReturn(await treeContext.onRemove(id));\n setUpdatingNode(false);\n }\n }, [handleReturn, id, treeContext]);\n\n // Context actions\n const addChild = useCallback(() => {\n setShowNewNode(true);\n treeContext?.handleExpandClick?.(id, true);\n }, [id, treeContext]);\n useEffect(() => {\n if (showNewNode === true && newNameRef.current) newNameRef.current.focus();\n }, [showNewNode]);\n const renameThis = useCallback(() => {\n setRenaming(true);\n treeContext?.handleSelect?.(id);\n }, [id, treeContext]);\n\n // Context menu\n const menuItems = useMemo(() => {\n const menuItems: MenuItem[] = [];\n if (canAddChildren) {\n menuItems.push({ label: \"Add\", action: addChild });\n }\n if (canRename) {\n menuItems.push({ label: \"Rename\", action: renameThis });\n }\n if (canRemove && (childNodes === undefined || childNodes.length === 0)) {\n menuItems.push({ label: \"Delete\", action: deleteThis });\n }\n return menuItems;\n }, [addChild, canAddChildren, canRemove, canRename, childNodes, deleteThis, renameThis]);\n\n // Return node\n return !treeContext ? null : (\n <>\n <ContextMenuHandler\n menuItems={menuItems}\n style={{ display: \"inline-block\", width: \"100%\" }}\n >\n <div\n id={`${treeContext.id}-treenode-${id}`}\n className=\"treenode\"\n >\n {error ? (\n <>\n <ExclamationCircleFill color=\"var(--bs-danger)\" /> {errorText}\n </>\n ) : (\n <div className=\"ton-node\">\n {treeContext.showCheckBox && (\n <input\n ref={checkRef}\n type=\"checkbox\"\n role=\"checkbox\"\n className=\"ton-checkbox\"\n id={`${treeContext.id}-treenode-checkbox-${id}`}\n onClick={() => treeContext.handleSelect?.(descendents)}\n />\n )}\n {childNodes && childNodes.length > 0 ? (\n !expanded ? (\n <CaretRightFill\n id={`${treeContext.id}-treenode-caret-${id}`}\n style={{ width: \"16px\", height: \"16px\" }}\n className=\"ton-expander\"\n role=\"button\"\n color={nodeColour}\n aria-expanded={false}\n aria-label=\"Expander\"\n onClick={() => treeContext.handleExpandClick(id)}\n />\n ) : (\n <CaretDownFill\n id={`${treeContext.id}-treenode-caret-${id}`}\n className=\"ton-expander\"\n role=\"button\"\n aria-expanded={true}\n aria-label=\"Expander\"\n color={nodeColour}\n onClick={() => treeContext.handleExpandClick(id)}\n />\n )\n ) : (\n <CaretRight\n id={`${treeContext.id}-treenode-caret-${id}`}\n className=\"ton-expander\"\n role=\"button\"\n color={nodeColour}\n aria-expanded={false}\n aria-label=\"Disabled expander\"\n onClick={() => treeContext.handleSelect?.(id)}\n />\n )}\n {thisNode && (\n <div\n className=\"ton-label\"\n style={{ width: `calc(100% - ${treeContext.showCheckBox ? \"32px\" : \"16px\"})` }}\n onContextMenuCapture={() => treeContext.handleSelect?.(id)}\n onClickCapture={() => {\n if (!treeContext.expandedNodes.includes(id)) treeContext.handleExpandClick(id);\n treeContext.handleSelect?.(id);\n }}\n onFocusCapture={() => treeContext.handleSelect?.(id)}\n >\n <WordEntry\n id={`${treeContext.id}-treenode-entry-${id}`}\n ref={currentNameRef}\n value={thisNode.label}\n editing={renaming}\n saving={updatingNode}\n setValue={(ret) => renameNode(ret)}\n sendEscape={() => setRenaming(false)}\n style={{\n border: currentBorder,\n margin: currentBorder === \"\" ? \"1px\" : \"\",\n backgroundColor: currentBorder === \"\" ? \"\" : treeContext.textHighlight,\n }}\n spellCheck={treeContext.spellCheck}\n />\n </div>\n )}\n </div>\n )}\n </div>\n </ContextMenuHandler>\n {childNodes && (\n <div\n className={`ton-collapsible-wrapper ${expanded && hasRenderedClosed && childNodes.length > 0 ? \"\" : \"collapsed\"}`}\n >\n {childNodes.length > 0 && (\n <div className=\"ton-collapsible\">\n {childNodes.map((h) => (\n <span\n key={h.id}\n id={`${treeContext.id}-treenode-child-${h.id}`}\n className=\"ton-child\"\n >\n <TreeNode\n id={h.id}\n canRemove={canRemoveChildren}\n canRename={canRenameChildren}\n canAddChildren={canAddChildren}\n canRemoveChildren={canRemoveChildren}\n canRenameChildren={canRenameChildren}\n />\n </span>\n ))}\n </div>\n )}\n </div>\n )}\n {showNewNode && (\n <WordEntry\n style={{ marginLeft: \"14px\" }}\n id={`treenode-new-${id}`}\n ref={newNameRef}\n editing={true}\n setValue={(ret) => confirmNewNode(ret)}\n saving={savingNewNode}\n sendEscape={() => setShowNewNode(false)}\n spellCheck={treeContext.spellCheck}\n />\n )}\n </>\n );\n};\n\nTreeNode.displayName = \"TreeNode\";\n","import { Key } from \"react\";\nimport { TreeNodeBase } from \"../components/interface\";\n\nexport const getAncestors = (\n id: Key | Key[],\n included: TreeNodeBase[],\n hierarchyNodes: TreeNodeBase[],\n): TreeNodeBase[] => {\n const processIds = Array.isArray(id) ? id : [id];\n\n const current = processIds\n .map((i) => hierarchyNodes.find((h) => h.id === i))\n .filter((h) => h !== undefined) as TreeNodeBase[];\n if (current.length === 0) return included;\n\n const parents = (\n current\n .map((h) => h.parentId)\n .map((pid) => hierarchyNodes.find((h) => pid === h.id)) as TreeNodeBase[]\n ).filter((p) => p !== undefined) as TreeNodeBase[];\n if (parents.length === 0) return included;\n else\n return getAncestors(\n parents.map((p) => p.id),\n [...included, ...parents.filter((p) => !included.includes(p))],\n hierarchyNodes,\n );\n};\n","import { Key } from \"react\";\nimport { TreeNodeBase } from \"../components/interface\";\n\nexport const getDescendentIds = (id: Key | Key[], hierarchyNodes: TreeNodeBase[]): Key[] => {\n const processIds = Array.isArray(id) ? id : [id];\n const newChildren = hierarchyNodes\n .filter(\n (h) =>\n h.parentId !== undefined && processIds.includes(h.parentId) && !processIds.includes(h.id),\n )\n .map((h) => h.id);\n return newChildren.length === 0\n ? processIds\n : getDescendentIds([...processIds, ...newChildren], hierarchyNodes);\n};\n","import { createContext, Key } from \"react\";\nimport { iNodeUpdate, TreeNodeData } from \"./interface\";\n\nexport interface TreeOfNodesContextProps<T> {\n id: string;\n nodeList: TreeNodeData<T>[];\n selected: Key[];\n showCheckBox: boolean;\n handleSelect?: (ret: Key | Key[]) => void;\n expandedNodes: Key[];\n handleExpandClick: (ret: Key, force?: boolean) => void;\n onAddChild?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;\n onRename?: (id: Key, newName: string) => Promise<iNodeUpdate>;\n onRemove?: (id: Key) => Promise<iNodeUpdate>;\n nodeHighlight: string;\n textHighlight: string;\n spellCheck?: \"true\" | \"false\";\n}\n\nexport const TreeOfNodesContext = createContext<TreeOfNodesContextProps<unknown> | undefined>(\n undefined,\n);\n","import React, { Key, useCallback, useEffect, useState } from \"react\";\nimport { Spinner } from \"react-bootstrap\";\n\ninterface WordEntryProps {\n id: Key;\n value?: string;\n editing?: boolean;\n saving?: boolean;\n setValue?: (ret: string) => void;\n sendEscape?: () => void;\n style?: React.CSSProperties;\n spellCheck?: \"true\" | \"false\";\n}\n\nexport const WordEntry = React.forwardRef<HTMLInputElement, WordEntryProps>(\n (\n { id, value, editing, saving, setValue, sendEscape, style, spellCheck = \"true\" },\n ref,\n ): JSX.Element => {\n const [currentValue, setCurrentValue] = useState<string>(value ?? \"\");\n useEffect(() => {\n setCurrentValue(value ?? \"\");\n }, [value]);\n\n const returnData = useCallback(() => {\n setValue?.(currentValue);\n }, [currentValue, setValue]);\n\n const keyPress = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.code === \"Escape\") {\n setCurrentValue(value ?? \"\");\n sendEscape?.();\n } else if (e.code === \"Enter\") {\n returnData();\n }\n },\n [returnData, sendEscape, value],\n );\n\n // Add window onMouseDown event to stop events when editing\n useEffect(() => {\n const handleMouseDown = (e: MouseEvent) => {\n const target = e.target as HTMLElement;\n if (\n editing &&\n target.id !== `${id}` &&\n target.id !== `${id}-holder` &&\n target.id !== `${id}-spinner` &&\n target.className !== \"ton-rename\"\n ) {\n e.preventDefault();\n e.stopPropagation();\n returnData();\n }\n };\n window.addEventListener(\"mousedown\", handleMouseDown);\n return () => {\n window.removeEventListener(\"mousedown\", handleMouseDown);\n };\n }, [editing, id, returnData]);\n\n return !editing ? (\n <span\n className=\"ton-label-span\"\n style={style}\n id={`${id}`}\n >\n {value ? value : <> </>}\n </span>\n ) : (\n <div\n style={style}\n id={`${id}-holder`}\n className=\"ton-rename-holder\"\n >\n {saving && (\n <Spinner\n id={`${id}-spinner`}\n size=\"sm\"\n animation=\"border\"\n />\n )}\n <input\n autoFocus\n spellCheck={spellCheck}\n id={String(id)}\n ref={ref}\n type=\"text\"\n className=\"ton-rename\"\n value={currentValue}\n disabled={saving}\n onChange={(e) => setCurrentValue(e.currentTarget.value)}\n onBlur={returnData}\n onKeyDownCapture={keyPress}\n />\n </div>\n );\n },\n);\n\nWordEntry.displayName = \"WordEntry\";\n","import { Key, useCallback, useEffect, useMemo, useState } from \"react\";\nimport { checkExpandedNodes } from \"../functions/checkExpandedNodes\";\nimport { iNodeUpdate, TreeNodeData } from \"./interface\";\nimport { TreeNode } from \"./TreeNode\";\nimport { TreeOfNodesContext } from \"./TreeOfNodesContext\";\n\ninterface TreeOfNodesProps<T> {\n id: string;\n nodeList: TreeNodeData<T>[];\n roots: Key[];\n showCheckBox?: boolean;\n selected?: Key | Key[];\n handleSelect?: (ret: Key | Key[]) => void;\n onAdd?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;\n onRename?: (childId: Key, newName: string) => Promise<iNodeUpdate>;\n onRemove?: (childId: Key) => Promise<iNodeUpdate>;\n canRemoveRoot?: boolean;\n canRenameRoot?: boolean;\n canAddChildren?: boolean;\n canRemoveChildren?: boolean;\n canRenameChildren?: boolean;\n nodeHighlight?: string;\n textHighlight?: string;\n spellCheck?: \"true\" | \"false\";\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint\nexport const TreeOfNodes = <T extends unknown>({\n id,\n nodeList,\n roots,\n selected = [],\n showCheckBox = false,\n handleSelect,\n onAdd,\n onRename,\n onRemove,\n canRemoveRoot = false,\n canRenameRoot = false,\n canAddChildren = false,\n canRemoveChildren = false,\n canRenameChildren = false,\n nodeHighlight = \"red\",\n textHighlight = \"rgba(255, 0, 0, 0.2)\",\n spellCheck = \"true\",\n}: TreeOfNodesProps<T>) => {\n const [expandedNodes, setExpandedNodes] = useState<Key[]>([]);\n const selectedArray = useMemo(\n () => (Array.isArray(selected) ? selected : [selected]),\n [selected],\n );\n useEffect(() => {\n if (selectedArray.length > 0) {\n // Check all nodes are showing that should be\n const shouldExpand = checkExpandedNodes(nodeList, selectedArray, expandedNodes);\n if (shouldExpand.filter((n) => !expandedNodes.includes(n)).length > 0) {\n setExpandedNodes(shouldExpand);\n }\n }\n }, [expandedNodes, nodeList, selectedArray]);\n\n // Change expansion and update contexts\n const changeExpand = useCallback(\n (eKey: Key, force?: boolean) => {\n const newExpandedNodes = [...expandedNodes];\n const ix = newExpandedNodes.findIndex((nKey) => nKey === eKey);\n if ((ix === -1 && force === undefined) || force === true) newExpandedNodes.push(eKey);\n else newExpandedNodes.splice(ix, 1);\n setExpandedNodes(newExpandedNodes);\n },\n [expandedNodes],\n );\n\n return (\n <div\n id={id}\n className=\"tree-of-nodes\"\n >\n <TreeOfNodesContext.Provider\n value={{\n id: id,\n nodeList,\n selected: selectedArray,\n showCheckBox,\n handleSelect,\n expandedNodes,\n handleExpandClick: (r, f) => changeExpand(r, f),\n onAddChild: onAdd,\n onRename,\n onRemove,\n nodeHighlight,\n textHighlight,\n spellCheck,\n }}\n >\n {roots.map((r) => (\n <TreeNode\n key={r}\n id={r}\n canRemove={canRemoveRoot}\n canAddChildren={canAddChildren}\n canRename={canRenameRoot}\n canRemoveChildren={canRemoveChildren}\n canRenameChildren={canRenameChildren}\n />\n ))}\n </TreeOfNodesContext.Provider>\n </div>\n );\n};\n\nTreeOfNodes.displayName = \"TreeOfNodes\";\n","import { TreeNodeBase } from \"components\";\nimport { Key } from \"react\";\nimport { getAncestors } from \"./getAncestors\";\n\nexport const checkExpandedNodes = (\n nodeList: TreeNodeBase[],\n selected: Key | Key[],\n expandedNodes: Key[],\n): Key[] => {\n return [\n ...expandedNodes,\n ...getAncestors(selected, [], nodeList)\n .map((n) => n.id)\n .filter((k) => !expandedNodes.includes(k)),\n ].sort((a, b) => `${a}`.localeCompare(`${b}`));\n};\n","import { getAncestors } from \"./getAncestors\";\n\nexport { getAncestors as getParents };\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;AGGO,MAAM,4CAAe,CAC1B,IACA,UACA;IAEA,MAAM,aAAa,MAAM,OAAO,CAAC,MAAM,KAAK;QAAC;KAAG;IAEhD,MAAM,UAAU,WACb,GAAG,CAAC,CAAC,IAAM,eAAe,IAAI,CAAC,CAAC,IAAM,EAAE,EAAE,KAAK,IAC/C,MAAM,CAAC,CAAC,IAAM,MAAM;IACvB,IAAI,QAAQ,MAAM,KAAK,GAAG,OAAO;IAEjC,MAAM,UAAU,AACd,QACG,GAAG,CAAC,CAAC,IAAM,EAAE,QAAQ,EACrB,GAAG,CAAC,CAAC,MAAQ,eAAe,IAAI,CAAC,CAAC,IAAM,QAAQ,EAAE,EAAE,GACvD,MAAM,CAAC,CAAC,IAAM,MAAM;IACtB,IAAI,QAAQ,MAAM,KAAK,GAAG,OAAO;SAE/B,OAAO,0CACL,QAAQ,GAAG,CAAC,CAAC,IAAM,EAAE,EAAE,GACvB;WAAI;WAAa,QAAQ,MAAM,CAAC,CAAC,IAAM,CAAC,SAAS,QAAQ,CAAC;KAAI,EAC9D;AAEN;;;ACxBO,MAAM,4CAAmB,CAAC,IAAiB;IAChD,MAAM,aAAa,MAAM,OAAO,CAAC,MAAM,KAAK;QAAC;KAAG;IAChD,MAAM,cAAc,eACjB,MAAM,CACL,CAAC,IACC,EAAE,QAAQ,KAAK,aAAa,WAAW,QAAQ,CAAC,EAAE,QAAQ,KAAK,CAAC,WAAW,QAAQ,CAAC,EAAE,EAAE,GAE3F,GAAG,CAAC,CAAC,IAAM,EAAE,EAAE;IAClB,OAAO,YAAY,MAAM,KAAK,IAC1B,aACA,0CAAiB;WAAI;WAAe;KAAY,EAAE;AACxD;;;;;ACKO,MAAM,4CAAqB,CAAA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AW,GAAG;;;;;;;;;;;","sources":["src/main.ts","src/components/index.ts","src/components/TreeNode.tsx","src/functions/getAncestors.tsx","src/functions/getDescendentIds.ts","src/components/TreeOfNodesContext.ts","src/components/WordEntry.tsx","src/components/TreeOfNodes.tsx","src/functions/checkExpandedNodes.ts","src/functions/index.ts"],"sourcesContent":["export * from \"./components\";\nexport * from \"./functions\";\n","import { INodeUpdate, TreeNodeBase, TreeNodeData } from \"./interface\";\nimport { TreeNode } from \"./TreeNode\";\nimport { TreeOfNodes } from \"./TreeOfNodes\";\nimport { WordEntry } from \"./WordEntry\";\n\nexport { TreeNode, TreeOfNodes, WordEntry };\nexport type { INodeUpdate, TreeNodeBase, TreeNodeData };\n","import { ContextMenuHandler, IMenuItem } from \"@asup/context-menu\";\nimport { Key, ReactNode, useContext, useEffect, useRef, useState } from \"react\";\nimport {\n CaretDownFill,\n CaretRight,\n CaretRightFill,\n ExclamationCircleFill,\n} from \"react-bootstrap-icons\";\nimport { getAncestors } from \"../functions/getAncestors\";\nimport { getDescendentIds } from \"../functions/getDescendentIds\";\nimport \"./TreeNode.css\";\nimport { TreeOfNodesContext } from \"./TreeOfNodesContext\";\nimport { WordEntry } from \"./WordEntry\";\nimport { INodeUpdate } from \"./interface\";\n\ninterface TreeNodeProps {\n id: Key;\n indentLevel?: number;\n canRemove?: boolean;\n canRename?: boolean;\n canAddChildren?: boolean;\n canRemoveChildren?: boolean;\n canRenameChildren?: boolean;\n refresh?: () => void;\n}\n\nexport const TreeNode = ({\n id,\n canRemove,\n canRename,\n canAddChildren,\n canRemoveChildren,\n canRenameChildren,\n}: TreeNodeProps): ReactNode => {\n // Contexts\n const treeContext = useContext(TreeOfNodesContext);\n\n // Node information\n const thisNode = treeContext?.nodeList.find((n) => n.id === id);\n const childNodes = treeContext?.nodeList.filter((n) => n.parentId === id);\n const descendents = getDescendentIds(id, treeContext?.nodeList ?? []);\n\n // State\n const [error, setError] = useState<boolean>(false);\n const [errorText, setErrorText] = useState<string>(\"\");\n const expanded = (treeContext?.expandedNodes.findIndex((e) => e === id) ?? -1) > -1;\n\n // Checkbox\n const checkRef = useRef<HTMLInputElement | null>(null);\n useEffect(() => {\n if (checkRef.current) {\n if (treeContext?.selected.includes(id)) {\n checkRef.current.checked = true;\n checkRef.current.indeterminate = false;\n } else if (descendents.some((d) => treeContext?.selected.includes(d))) {\n checkRef.current.checked = false;\n checkRef.current.indeterminate = true;\n } else {\n checkRef.current.checked = false;\n checkRef.current.indeterminate = false;\n }\n }\n }, [descendents, id, treeContext?.selected]);\n\n // Apply selected border\n const currentBorder: string = treeContext?.selected.includes(id) ? \"1px solid black\" : \"\";\n const nodeColour: string | undefined = (() => {\n if (treeContext && treeContext.selected) {\n const anc = getAncestors(treeContext.selected, [], treeContext?.nodeList).map((n) => n.id);\n if ([...anc, treeContext.selected].includes(id)) return treeContext.nodeHighlight;\n }\n return;\n })();\n\n // New node parameters\n const newNameRef = useRef<HTMLInputElement | null>(null);\n const [showNewNode, setShowNewNode] = useState<boolean>(false);\n const [savingNewNode, setSavingNewNode] = useState<boolean>(false);\n\n // Rename parameters\n const currentNameRef = useRef<HTMLInputElement | null>(null);\n const [renaming, setRenaming] = useState<boolean>(false);\n const [updatingNode, setUpdatingNode] = useState<boolean>(false);\n\n // Context functions\n const handleReturn = (ret: INodeUpdate) => {\n if (!ret.success) {\n setError(true);\n setErrorText(ret.ErrorText ?? \"An unknown error has occured\");\n } else {\n setError(false);\n setErrorText(\"\");\n }\n };\n\n const confirmNewNode = async (label: string) => {\n setSavingNewNode(true);\n if (treeContext?.onAddChild) {\n handleReturn(await treeContext.onAddChild(id, label));\n }\n setSavingNewNode(false);\n setShowNewNode(false);\n };\n\n const renameNode = async (newLabel: string) => {\n setRenaming(false);\n if (treeContext?.onRename) {\n setUpdatingNode(true);\n handleReturn(await treeContext.onRename(id, newLabel));\n setUpdatingNode(false);\n }\n };\n\n const deleteThis = async () => {\n if (treeContext?.onRemove) {\n setUpdatingNode(true);\n handleReturn(await treeContext.onRemove(id));\n setUpdatingNode(false);\n }\n };\n\n // Context actions\n const addChild = () => {\n setShowNewNode(true);\n treeContext?.handleExpandClick?.(id, true);\n };\n const renameThis = () => {\n setRenaming(true);\n treeContext?.handleSelect?.(id);\n };\n\n // Context menu\n const menuItems: IMenuItem[] = [];\n if (canAddChildren) {\n menuItems.push({ label: \"Add\", action: addChild });\n }\n if (canRename) {\n menuItems.push({ label: \"Rename\", action: renameThis });\n }\n if (canRemove && (childNodes === undefined || childNodes.length === 0)) {\n menuItems.push({ label: \"Delete\", action: deleteThis });\n }\n\n useEffect(() => {\n if (showNewNode === true && newNameRef.current) newNameRef.current.focus();\n }, [showNewNode]);\n\n // Return node\n return !treeContext ? null : (\n <>\n <ContextMenuHandler\n menuItems={menuItems}\n style={{ display: \"inline-block\", width: \"100%\" }}\n >\n <div\n id={`${treeContext.id}-treenode-${id}`}\n className=\"treenode\"\n >\n {error ? (\n <>\n <ExclamationCircleFill color=\"var(--bs-danger)\" /> {errorText}\n </>\n ) : (\n <div className=\"ton-node\">\n {treeContext.showCheckBox && (\n <input\n ref={checkRef}\n type=\"checkbox\"\n role=\"checkbox\"\n className=\"ton-checkbox\"\n id={`${treeContext.id}-treenode-checkbox-${id}`}\n onClick={() => treeContext.handleSelect?.(descendents)}\n />\n )}\n {childNodes && childNodes.length > 0 ? (\n !expanded ? (\n <CaretRightFill\n id={`${treeContext.id}-treenode-caret-${id}`}\n style={{ width: \"16px\", height: \"16px\" }}\n className=\"ton-expander\"\n role=\"button\"\n color={nodeColour}\n aria-expanded={false}\n aria-label=\"Expander\"\n onClick={() => treeContext.handleExpandClick(id)}\n />\n ) : (\n <CaretDownFill\n id={`${treeContext.id}-treenode-caret-${id}`}\n className=\"ton-expander\"\n role=\"button\"\n aria-expanded={true}\n aria-label=\"Expander\"\n color={nodeColour}\n onClick={() => treeContext.handleExpandClick(id)}\n />\n )\n ) : (\n <CaretRight\n id={`${treeContext.id}-treenode-caret-${id}`}\n className=\"ton-expander\"\n role=\"button\"\n color={nodeColour}\n aria-expanded={false}\n aria-label=\"Disabled expander\"\n onClick={() => treeContext.handleSelect?.(id)}\n />\n )}\n {thisNode && (\n <div\n className=\"ton-label\"\n style={{ width: `calc(100% - ${treeContext.showCheckBox ? \"32px\" : \"16px\"})` }}\n onContextMenuCapture={() => treeContext.handleSelect?.(id)}\n onClickCapture={() => {\n if (!treeContext.expandedNodes.includes(id)) treeContext.handleExpandClick(id);\n treeContext.handleSelect?.(id);\n }}\n onFocusCapture={() => treeContext.handleSelect?.(id)}\n >\n <WordEntry\n id={`${treeContext.id}-treenode-entry-${id}`}\n className={currentBorder ? \"selected\" : \"\"}\n ref={currentNameRef}\n value={thisNode.label}\n editing={renaming}\n saving={updatingNode}\n setValue={(ret) => renameNode(ret)}\n sendEscape={() => setRenaming(false)}\n style={{\n border: currentBorder,\n margin: currentBorder === \"\" ? \"1px\" : \"\",\n backgroundColor: currentBorder === \"\" ? \"\" : treeContext.textHighlight,\n }}\n spellCheck={treeContext.spellCheck}\n />\n </div>\n )}\n </div>\n )}\n </div>\n </ContextMenuHandler>\n {childNodes && (\n <div\n className={`ton-collapsible-wrapper ${expanded && childNodes.length > 0 ? \"\" : \"collapsed\"}`}\n >\n {childNodes.length > 0 && (\n <div className=\"ton-collapsible\">\n {childNodes.map((h) => (\n <span\n key={h.id}\n id={`${treeContext.id}-treenode-child-${h.id}`}\n className=\"ton-child\"\n >\n <TreeNode\n id={h.id}\n canRemove={canRemoveChildren}\n canRename={canRenameChildren}\n canAddChildren={canAddChildren}\n canRemoveChildren={canRemoveChildren}\n canRenameChildren={canRenameChildren}\n />\n </span>\n ))}\n </div>\n )}\n </div>\n )}\n {showNewNode && (\n <WordEntry\n style={{ marginLeft: \"14px\" }}\n id={`treenode-new-${id}`}\n ref={newNameRef}\n editing={true}\n setValue={(ret) => confirmNewNode(ret)}\n saving={savingNewNode}\n sendEscape={() => setShowNewNode(false)}\n spellCheck={treeContext.spellCheck}\n />\n )}\n </>\n );\n};\n\nTreeNode.displayName = \"TreeNode\";\n","import { Key } from \"react\";\nimport { TreeNodeBase } from \"../components/interface\";\n\nexport const getAncestors = (\n id: Key | Key[],\n included: TreeNodeBase[],\n hierarchyNodes: TreeNodeBase[],\n): TreeNodeBase[] => {\n const processIds = Array.isArray(id) ? id : [id];\n\n const current = processIds\n .map((i) => hierarchyNodes.find((h) => h.id === i))\n .filter((h) => h !== undefined) as TreeNodeBase[];\n if (current.length === 0) return included;\n\n const parents = (\n current\n .map((h) => h.parentId)\n .map((pid) => hierarchyNodes.find((h) => pid === h.id)) as TreeNodeBase[]\n ).filter((p) => p !== undefined) as TreeNodeBase[];\n if (parents.length === 0) return included;\n else\n return getAncestors(\n parents.map((p) => p.id),\n [...included, ...parents.filter((p) => !included.includes(p))],\n hierarchyNodes,\n );\n};\n","import { Key } from \"react\";\nimport { TreeNodeBase } from \"../components/interface\";\n\nexport const getDescendentIds = (id: Key | Key[], hierarchyNodes: TreeNodeBase[]): Key[] => {\n const processIds = Array.isArray(id) ? id : [id];\n const newChildren = hierarchyNodes\n .filter(\n (h) =>\n h.parentId !== undefined && processIds.includes(h.parentId) && !processIds.includes(h.id),\n )\n .map((h) => h.id);\n return newChildren.length === 0\n ? processIds\n : getDescendentIds([...processIds, ...newChildren], hierarchyNodes);\n};\n","import { createContext, Key } from \"react\";\nimport { INodeUpdate, TreeNodeData } from \"./interface\";\n\nexport interface TreeOfNodesContextProps<T> {\n id: string;\n nodeList: TreeNodeData<T>[];\n selected: Key[];\n showCheckBox: boolean;\n handleSelect?: (ret: Key | Key[]) => void;\n expandedNodes: Key[];\n handleExpandClick: (ret: Key, force?: boolean) => void;\n onAddChild?: (parentId: Key, newName: string) => Promise<INodeUpdate>;\n onRename?: (id: Key, newName: string) => Promise<INodeUpdate>;\n onRemove?: (id: Key) => Promise<INodeUpdate>;\n nodeHighlight: string;\n textHighlight: string;\n spellCheck?: \"true\" | \"false\";\n}\n\nexport const TreeOfNodesContext = createContext<TreeOfNodesContextProps<unknown> | undefined>(\n undefined,\n);\n","import { CSSProperties, forwardRef, JSX, Key, KeyboardEvent, useEffect, useState } from \"react\";\nimport { Spinner } from \"react-bootstrap\";\n\ninterface WordEntryProps {\n id: Key;\n className?: string;\n editing?: boolean;\n saving?: boolean;\n sendEscape?: () => void;\n setValue?: (ret: string) => void;\n spellCheck?: \"true\" | \"false\";\n style?: CSSProperties;\n value?: string;\n}\n\nexport const WordEntry = forwardRef<HTMLInputElement, WordEntryProps>(\n (\n { id, className, value, editing, saving, setValue, sendEscape, style, spellCheck = \"true\" },\n ref,\n ): JSX.Element => {\n const [currentValue, setCurrentValue] = useState<string>(value ?? \"\");\n useEffect(() => {\n setCurrentValue(value ?? \"\");\n }, [value]);\n\n const keyPress = (e: KeyboardEvent) => {\n if (e.code === \"Escape\") {\n setCurrentValue(value ?? \"\");\n sendEscape?.();\n } else if (e.code === \"Enter\") {\n setValue?.(currentValue);\n }\n };\n\n // Add window onMouseDown event to stop events when editing\n useEffect(() => {\n const handleMouseDown = (e: MouseEvent) => {\n const target = e.target as HTMLElement;\n if (\n editing &&\n target.id !== `${id}` &&\n target.id !== `${id}-holder` &&\n target.id !== `${id}-spinner` &&\n target.className !== \"ton-rename\"\n ) {\n e.preventDefault();\n e.stopPropagation();\n setValue?.(currentValue);\n }\n };\n window.addEventListener(\"mousedown\", handleMouseDown);\n return () => {\n window.removeEventListener(\"mousedown\", handleMouseDown);\n };\n }, [currentValue, editing, id, setValue]);\n\n return !editing ? (\n <span\n className=\"ton-label-span\"\n style={style}\n id={`${id}`}\n >\n {value ? value : <> </>}\n </span>\n ) : (\n <div\n style={style}\n id={`${id}-holder`}\n className=\"ton-rename-holder\"\n >\n {saving && (\n <Spinner\n id={`${id}-spinner`}\n size=\"sm\"\n animation=\"border\"\n />\n )}\n <input\n autoFocus\n spellCheck={spellCheck}\n id={String(id)}\n ref={ref}\n type=\"text\"\n className={[\"ton-rename\", className].filter(Boolean).join(\" \")}\n value={currentValue}\n disabled={saving}\n onChange={(e) => setCurrentValue(e.currentTarget.value)}\n onBlur={(e) => setValue?.(e.currentTarget.value)}\n onKeyDownCapture={keyPress}\n />\n </div>\n );\n },\n);\n\nWordEntry.displayName = \"WordEntry\";\n","import { Key, useEffect, useState } from \"react\";\nimport { checkExpandedNodes } from \"../functions/checkExpandedNodes\";\nimport { INodeUpdate, TreeNodeData } from \"./interface\";\nimport { TreeNode } from \"./TreeNode\";\nimport { TreeOfNodesContext } from \"./TreeOfNodesContext\";\n\nexport interface TreeOfNodesProps<T> {\n alwaysShowSelected?: \"always\" | \"first\";\n canAddChildren?: boolean;\n canRemoveChildren?: boolean;\n canRemoveRoot?: boolean;\n canRenameChildren?: boolean;\n canRenameRoot?: boolean;\n handleSelect?: (ret: Key | Key[]) => void;\n id: string;\n initiallyExpandedNodes?: Key[];\n nodeHighlight?: string;\n nodeList: TreeNodeData<T>[];\n onAdd?: (parentId: Key, newName: string) => Promise<INodeUpdate>;\n onRemove?: (childId: Key) => Promise<INodeUpdate>;\n onRename?: (childId: Key, newName: string) => Promise<INodeUpdate>;\n roots: Key[];\n selected?: Key | Key[];\n showCheckBox?: boolean;\n spellCheck?: \"true\" | \"false\";\n textHighlight?: string;\n}\n\nexport const TreeOfNodes = <T,>({\n alwaysShowSelected = \"first\",\n canAddChildren = false,\n canRemoveChildren = false,\n canRemoveRoot = false,\n canRenameChildren = false,\n canRenameRoot = false,\n handleSelect,\n id,\n initiallyExpandedNodes = [],\n nodeHighlight = \"red\",\n nodeList,\n onAdd,\n onRemove,\n onRename,\n roots,\n selected = [],\n showCheckBox = false,\n spellCheck = \"true\",\n textHighlight = \"rgba(255, 0, 0, 0.2)\",\n}: TreeOfNodesProps<T>) => {\n const [firstRender, setFirstRender] = useState<boolean>(alwaysShowSelected === \"first\");\n const [expandedNodes, setExpandedNodes] = useState<Key[]>(initiallyExpandedNodes);\n useEffect(() => {\n const selectedArray = Array.isArray(selected) ? selected : [selected];\n if ((alwaysShowSelected === \"always\" || firstRender) && selectedArray.length > 0) {\n // Check all nodes are showing that should be\n const shouldExpand = checkExpandedNodes(nodeList, selectedArray, expandedNodes);\n if (shouldExpand.filter((n) => !expandedNodes.includes(n)).length > 0) {\n setExpandedNodes(shouldExpand);\n }\n setFirstRender(false);\n }\n }, [alwaysShowSelected, firstRender, expandedNodes, nodeList, selected]);\n\n // Change expansion and update contexts\n const changeExpand = (eKey: Key, force?: boolean) => {\n const newExpandedNodes = [...expandedNodes];\n const ix = newExpandedNodes.findIndex((nKey) => nKey === eKey);\n if ((ix === -1 && force === undefined) || force === true) newExpandedNodes.push(eKey);\n else newExpandedNodes.splice(ix, 1);\n setExpandedNodes(newExpandedNodes);\n };\n\n return (\n <div\n id={id}\n className=\"tree-of-nodes\"\n >\n <TreeOfNodesContext\n value={{\n id: id,\n expandedNodes,\n handleExpandClick: (r, f) => changeExpand(r, f),\n handleSelect,\n nodeHighlight,\n nodeList,\n onAddChild: onAdd,\n onRemove,\n onRename,\n selected: Array.isArray(selected) ? selected : [selected],\n showCheckBox,\n spellCheck,\n textHighlight,\n }}\n >\n {roots.map((r) => (\n <TreeNode\n key={r}\n id={r}\n canRemove={canRemoveRoot}\n canAddChildren={canAddChildren}\n canRename={canRenameRoot}\n canRemoveChildren={canRemoveChildren}\n canRenameChildren={canRenameChildren}\n />\n ))}\n </TreeOfNodesContext>\n </div>\n );\n};\n\nTreeOfNodes.displayName = \"TreeOfNodes\";\n","import { TreeNodeBase } from \"components\";\nimport { Key } from \"react\";\nimport { getAncestors } from \"./getAncestors\";\n\nexport const checkExpandedNodes = (\n nodeList: TreeNodeBase[],\n selected: Key | Key[],\n expandedNodes: Key[],\n): Key[] => {\n return [\n ...expandedNodes,\n ...getAncestors(selected, [], nodeList)\n .map((n) => n.id)\n .filter((k) => !expandedNodes.includes(k)),\n ].sort((a, b) => `${a}`.localeCompare(`${b}`));\n};\n","import { getAncestors } from \"./getAncestors\";\n\nexport { getAncestors as getParents };\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/tree-of-nodes.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Key, CSSProperties, RefAttributes, ForwardRefExoticComponent, ReactNode } from "react";
|
|
2
2
|
import { JSX } from "react/jsx-runtime";
|
|
3
|
-
export interface
|
|
3
|
+
export interface INodeUpdate {
|
|
4
4
|
success: boolean;
|
|
5
5
|
ErrorText?: string;
|
|
6
6
|
}
|
|
@@ -15,15 +15,16 @@ export interface TreeNodeData<T> extends TreeNodeBase {
|
|
|
15
15
|
declare const getAncestors: (id: Key | Key[], included: TreeNodeBase[], hierarchyNodes: TreeNodeBase[]) => TreeNodeBase[];
|
|
16
16
|
interface WordEntryProps {
|
|
17
17
|
id: Key;
|
|
18
|
-
|
|
18
|
+
className?: string;
|
|
19
19
|
editing?: boolean;
|
|
20
20
|
saving?: boolean;
|
|
21
|
-
setValue?: (ret: string) => void;
|
|
22
21
|
sendEscape?: () => void;
|
|
23
|
-
|
|
22
|
+
setValue?: (ret: string) => void;
|
|
24
23
|
spellCheck?: "true" | "false";
|
|
24
|
+
style?: CSSProperties;
|
|
25
|
+
value?: string;
|
|
25
26
|
}
|
|
26
|
-
export const WordEntry:
|
|
27
|
+
export const WordEntry: ForwardRefExoticComponent<WordEntryProps & RefAttributes<HTMLInputElement>>;
|
|
27
28
|
interface TreeNodeProps {
|
|
28
29
|
id: Key;
|
|
29
30
|
indentLevel?: number;
|
|
@@ -39,26 +40,28 @@ export const TreeNode: {
|
|
|
39
40
|
displayName: string;
|
|
40
41
|
};
|
|
41
42
|
interface TreeOfNodesProps<T> {
|
|
42
|
-
|
|
43
|
-
nodeList: TreeNodeData<T>[];
|
|
44
|
-
roots: Key[];
|
|
45
|
-
showCheckBox?: boolean;
|
|
46
|
-
selected?: Key | Key[];
|
|
47
|
-
handleSelect?: (ret: Key | Key[]) => void;
|
|
48
|
-
onAdd?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
49
|
-
onRename?: (childId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
50
|
-
onRemove?: (childId: Key) => Promise<iNodeUpdate>;
|
|
51
|
-
canRemoveRoot?: boolean;
|
|
52
|
-
canRenameRoot?: boolean;
|
|
43
|
+
alwaysShowSelected?: "always" | "first";
|
|
53
44
|
canAddChildren?: boolean;
|
|
54
45
|
canRemoveChildren?: boolean;
|
|
46
|
+
canRemoveRoot?: boolean;
|
|
55
47
|
canRenameChildren?: boolean;
|
|
48
|
+
canRenameRoot?: boolean;
|
|
49
|
+
handleSelect?: (ret: Key | Key[]) => void;
|
|
50
|
+
id: string;
|
|
51
|
+
initiallyExpandedNodes?: Key[];
|
|
56
52
|
nodeHighlight?: string;
|
|
57
|
-
|
|
53
|
+
nodeList: TreeNodeData<T>[];
|
|
54
|
+
onAdd?: (parentId: Key, newName: string) => Promise<INodeUpdate>;
|
|
55
|
+
onRemove?: (childId: Key) => Promise<INodeUpdate>;
|
|
56
|
+
onRename?: (childId: Key, newName: string) => Promise<INodeUpdate>;
|
|
57
|
+
roots: Key[];
|
|
58
|
+
selected?: Key | Key[];
|
|
59
|
+
showCheckBox?: boolean;
|
|
58
60
|
spellCheck?: "true" | "false";
|
|
61
|
+
textHighlight?: string;
|
|
59
62
|
}
|
|
60
63
|
export const TreeOfNodes: {
|
|
61
|
-
<T
|
|
64
|
+
<T>({ alwaysShowSelected, canAddChildren, canRemoveChildren, canRemoveRoot, canRenameChildren, canRenameRoot, handleSelect, id, initiallyExpandedNodes, nodeHighlight, nodeList, onAdd, onRemove, onRename, roots, selected, showCheckBox, spellCheck, textHighlight, }: TreeOfNodesProps<T>): JSX.Element;
|
|
62
65
|
displayName: string;
|
|
63
66
|
};
|
|
64
67
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAEA;IACE,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;IACE,EAAE,EAAE,GAAG,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;I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Aa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,OAAO,MAAM;KAAe,CAAC,uQAoB1B,iBAAiB,CAAC,CAAC;;CA4DrB,CAAC","sources":["src/src/components/interface.ts","src/src/functions/getAncestors.tsx","src/src/functions/getDescendentIds.ts","src/src/components/TreeOfNodesContext.ts","src/src/components/WordEntry.tsx","src/src/components/TreeNode.tsx","src/src/functions/checkExpandedNodes.ts","src/src/components/TreeOfNodes.tsx","src/src/components/index.ts","src/src/functions/index.ts","src/src/main.ts","src/main.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,"export * from \"./components\";\nexport * from \"./functions\";\n"],"names":[],"version":3,"file":"tree-of-nodes.d.ts.map"}
|