@asup/tree-of-nodes 2.0.6 → 3.0.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 +73 -141
- 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 +74 -138
- package/dist/main.js.map +1 -1
- package/dist/tree-of-nodes.d.ts +21 -19
- package/dist/tree-of-nodes.d.ts.map +1 -1
- package/package.json +32 -20
package/dist/cjs/main.css
CHANGED
|
@@ -34,12 +34,17 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.ton-label-span {
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
font-family: inherit;
|
|
39
|
+
font-size: inherit;
|
|
40
|
+
font-weight: inherit;
|
|
37
41
|
text-overflow: ellipsis;
|
|
38
42
|
white-space: nowrap;
|
|
39
|
-
border: 1px;
|
|
43
|
+
border: 1px solid #0000;
|
|
40
44
|
border-radius: 3px;
|
|
41
45
|
width: 100%;
|
|
42
46
|
padding: 1px 3px;
|
|
47
|
+
line-height: 24px;
|
|
43
48
|
display: inline-block;
|
|
44
49
|
overflow: hidden;
|
|
45
50
|
}
|
|
@@ -49,12 +54,23 @@
|
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
.ton-rename {
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
font-family: inherit;
|
|
59
|
+
font-size: inherit;
|
|
60
|
+
font-weight: inherit;
|
|
52
61
|
border: 1px dotted #000;
|
|
62
|
+
border-radius: 3px;
|
|
53
63
|
width: 100%;
|
|
54
64
|
min-width: 0;
|
|
65
|
+
padding: 1px 3px;
|
|
55
66
|
line-height: 24px;
|
|
56
67
|
}
|
|
57
68
|
|
|
69
|
+
.ton-rename:focus {
|
|
70
|
+
box-shadow: none;
|
|
71
|
+
outline: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
58
74
|
.ton-child {
|
|
59
75
|
opacity: 1;
|
|
60
76
|
transition: opacity var(--ton-long-transition-time) linear;
|
package/dist/cjs/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/cjs/main.js
CHANGED
|
@@ -26,10 +26,6 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
26
26
|
function $parcel$export(e, n, v, s) {
|
|
27
27
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
function $parcel$interopDefault(a) {
|
|
31
|
-
return a && a.__esModule ? a.default : a;
|
|
32
|
-
}
|
|
33
29
|
var $a68bd8a6c0fd98c2$exports = {};
|
|
34
30
|
|
|
35
31
|
$parcel$export($a68bd8a6c0fd98c2$exports, "TreeNode", function () { return $a56aac35d4408806$export$2eba8ec3a333fdbb; });
|
|
@@ -74,29 +70,19 @@ const $ff9cca1fe8f6b24e$export$29ec378200e05207 = (0, $gTuX4$react.createContext
|
|
|
74
70
|
|
|
75
71
|
|
|
76
72
|
|
|
77
|
-
const $176d21a51def1fce$export$14f190ac910bde69 = /*#__PURE__*/ (0,
|
|
73
|
+
const $176d21a51def1fce$export$14f190ac910bde69 = /*#__PURE__*/ (0, $gTuX4$react.forwardRef)(({ id: id, className: className, value: value, editing: editing, saving: saving, setValue: setValue, sendEscape: sendEscape, style: style, spellCheck: spellCheck = "true" }, ref)=>{
|
|
78
74
|
const [currentValue, setCurrentValue] = (0, $gTuX4$react.useState)(value !== null && value !== void 0 ? value : "");
|
|
79
75
|
(0, $gTuX4$react.useEffect)(()=>{
|
|
80
76
|
setCurrentValue(value !== null && value !== void 0 ? value : "");
|
|
81
77
|
}, [
|
|
82
78
|
value
|
|
83
79
|
]);
|
|
84
|
-
const
|
|
85
|
-
setValue === null || setValue === void 0 ? void 0 : setValue(currentValue);
|
|
86
|
-
}, [
|
|
87
|
-
currentValue,
|
|
88
|
-
setValue
|
|
89
|
-
]);
|
|
90
|
-
const keyPress = (0, $gTuX4$react.useCallback)((e)=>{
|
|
80
|
+
const keyPress = (e)=>{
|
|
91
81
|
if (e.code === "Escape") {
|
|
92
82
|
setCurrentValue(value !== null && value !== void 0 ? value : "");
|
|
93
83
|
sendEscape === null || sendEscape === void 0 ? void 0 : sendEscape();
|
|
94
|
-
} else if (e.code === "Enter")
|
|
95
|
-
}
|
|
96
|
-
returnData,
|
|
97
|
-
sendEscape,
|
|
98
|
-
value
|
|
99
|
-
]);
|
|
84
|
+
} else if (e.code === "Enter") setValue === null || setValue === void 0 ? void 0 : setValue(currentValue);
|
|
85
|
+
};
|
|
100
86
|
// Add window onMouseDown event to stop events when editing
|
|
101
87
|
(0, $gTuX4$react.useEffect)(()=>{
|
|
102
88
|
const handleMouseDown = (e)=>{
|
|
@@ -104,7 +90,7 @@ const $176d21a51def1fce$export$14f190ac910bde69 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
104
90
|
if (editing && target.id !== `${id}` && target.id !== `${id}-holder` && target.id !== `${id}-spinner` && target.className !== "ton-rename") {
|
|
105
91
|
e.preventDefault();
|
|
106
92
|
e.stopPropagation();
|
|
107
|
-
|
|
93
|
+
setValue === null || setValue === void 0 ? void 0 : setValue(currentValue);
|
|
108
94
|
}
|
|
109
95
|
};
|
|
110
96
|
window.addEventListener("mousedown", handleMouseDown);
|
|
@@ -112,9 +98,10 @@ const $176d21a51def1fce$export$14f190ac910bde69 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
112
98
|
window.removeEventListener("mousedown", handleMouseDown);
|
|
113
99
|
};
|
|
114
100
|
}, [
|
|
101
|
+
currentValue,
|
|
115
102
|
editing,
|
|
116
103
|
id,
|
|
117
|
-
|
|
104
|
+
setValue
|
|
118
105
|
]);
|
|
119
106
|
return !editing ? /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("span", {
|
|
120
107
|
className: "ton-label-span",
|
|
@@ -139,11 +126,14 @@ const $176d21a51def1fce$export$14f190ac910bde69 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
139
126
|
id: String(id),
|
|
140
127
|
ref: ref,
|
|
141
128
|
type: "text",
|
|
142
|
-
className:
|
|
129
|
+
className: [
|
|
130
|
+
"ton-rename",
|
|
131
|
+
className
|
|
132
|
+
].filter(Boolean).join(" "),
|
|
143
133
|
value: currentValue,
|
|
144
134
|
disabled: saving,
|
|
145
135
|
onChange: (e)=>setCurrentValue(e.currentTarget.value),
|
|
146
|
-
onBlur:
|
|
136
|
+
onBlur: (e)=>setValue === null || setValue === void 0 ? void 0 : setValue(e.currentTarget.value),
|
|
147
137
|
onKeyDownCapture: keyPress
|
|
148
138
|
})
|
|
149
139
|
]
|
|
@@ -156,39 +146,15 @@ const $a56aac35d4408806$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
156
146
|
// Contexts
|
|
157
147
|
const treeContext = (0, $gTuX4$react.useContext)((0, $ff9cca1fe8f6b24e$export$29ec378200e05207));
|
|
158
148
|
// Node information
|
|
159
|
-
const thisNode =
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
]);
|
|
163
|
-
const childNodes = (0, $gTuX4$react.useMemo)(()=>treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList.filter((n)=>n.parentId === id), [
|
|
164
|
-
id,
|
|
165
|
-
treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList
|
|
166
|
-
]);
|
|
167
|
-
const descendents = (0, $gTuX4$react.useMemo)(()=>{
|
|
168
|
-
var _treeContext_nodeList;
|
|
169
|
-
return (0, $a19ef65643ae39e0$export$bd923365b402cb04)(id, (_treeContext_nodeList = treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList) !== null && _treeContext_nodeList !== void 0 ? _treeContext_nodeList : []);
|
|
170
|
-
}, [
|
|
171
|
-
id,
|
|
172
|
-
treeContext
|
|
173
|
-
]);
|
|
149
|
+
const thisNode = treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList.find((n)=>n.id === id);
|
|
150
|
+
const childNodes = treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList.filter((n)=>n.parentId === id);
|
|
151
|
+
var _treeContext_nodeList;
|
|
152
|
+
const descendents = (0, $a19ef65643ae39e0$export$bd923365b402cb04)(id, (_treeContext_nodeList = treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList) !== null && _treeContext_nodeList !== void 0 ? _treeContext_nodeList : []);
|
|
174
153
|
// State
|
|
175
154
|
const [error, setError] = (0, $gTuX4$react.useState)(false);
|
|
176
155
|
const [errorText, setErrorText] = (0, $gTuX4$react.useState)("");
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
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;
|
|
180
|
-
}, [
|
|
181
|
-
id,
|
|
182
|
-
treeContext === null || treeContext === void 0 ? void 0 : treeContext.expandedNodes
|
|
183
|
-
]);
|
|
184
|
-
// Ensures that child nodes are drawn before they are expanded
|
|
185
|
-
const [hasRenderedClosed, setHasRenderedClosed] = (0, $gTuX4$react.useState)(childNodes !== undefined && childNodes.length > 0);
|
|
186
|
-
(0, $gTuX4$react.useEffect)(()=>{
|
|
187
|
-
if (childNodes && childNodes.length > 0 && !hasRenderedClosed) setHasRenderedClosed(true);
|
|
188
|
-
}, [
|
|
189
|
-
childNodes,
|
|
190
|
-
hasRenderedClosed
|
|
191
|
-
]);
|
|
156
|
+
var _treeContext_expandedNodes_findIndex;
|
|
157
|
+
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;
|
|
192
158
|
// Checkbox
|
|
193
159
|
const checkRef = (0, $gTuX4$react.useRef)(null);
|
|
194
160
|
(0, $gTuX4$react.useEffect)(()=>{
|
|
@@ -210,13 +176,8 @@ const $a56aac35d4408806$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
210
176
|
treeContext === null || treeContext === void 0 ? void 0 : treeContext.selected
|
|
211
177
|
]);
|
|
212
178
|
// Apply selected border
|
|
213
|
-
const currentBorder = (0
|
|
214
|
-
|
|
215
|
-
}, [
|
|
216
|
-
id,
|
|
217
|
-
treeContext === null || treeContext === void 0 ? void 0 : treeContext.selected
|
|
218
|
-
]);
|
|
219
|
-
const nodeColour = (0, $gTuX4$react.useMemo)(()=>{
|
|
179
|
+
const currentBorder = (treeContext === null || treeContext === void 0 ? void 0 : treeContext.selected.includes(id)) ? "1px solid black" : "";
|
|
180
|
+
const nodeColour = (()=>{
|
|
220
181
|
if (treeContext && treeContext.selected) {
|
|
221
182
|
const anc = (0, $580f9b3e262282c9$export$c6fd3ab3f44300d0)(treeContext.selected, [], treeContext === null || treeContext === void 0 ? void 0 : treeContext.nodeList).map((n)=>n.id);
|
|
222
183
|
if ([
|
|
@@ -225,10 +186,7 @@ const $a56aac35d4408806$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
225
186
|
].includes(id)) return treeContext.nodeHighlight;
|
|
226
187
|
}
|
|
227
188
|
return;
|
|
228
|
-
}
|
|
229
|
-
id,
|
|
230
|
-
treeContext
|
|
231
|
-
]);
|
|
189
|
+
})();
|
|
232
190
|
// New node parameters
|
|
233
191
|
const newNameRef = (0, $gTuX4$react.useRef)(null);
|
|
234
192
|
const [showNewNode, setShowNewNode] = (0, $gTuX4$react.useState)(false);
|
|
@@ -238,7 +196,7 @@ const $a56aac35d4408806$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
238
196
|
const [renaming, setRenaming] = (0, $gTuX4$react.useState)(false);
|
|
239
197
|
const [updatingNode, setUpdatingNode] = (0, $gTuX4$react.useState)(false);
|
|
240
198
|
// Context functions
|
|
241
|
-
const handleReturn = (
|
|
199
|
+
const handleReturn = (ret)=>{
|
|
242
200
|
if (!ret.success) {
|
|
243
201
|
setError(true);
|
|
244
202
|
var _ret_ErrorText;
|
|
@@ -247,86 +205,57 @@ const $a56aac35d4408806$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
247
205
|
setError(false);
|
|
248
206
|
setErrorText("");
|
|
249
207
|
}
|
|
250
|
-
}
|
|
251
|
-
const confirmNewNode =
|
|
208
|
+
};
|
|
209
|
+
const confirmNewNode = async (label)=>{
|
|
252
210
|
setSavingNewNode(true);
|
|
253
211
|
if (treeContext === null || treeContext === void 0 ? void 0 : treeContext.onAddChild) handleReturn(await treeContext.onAddChild(id, label));
|
|
254
212
|
setSavingNewNode(false);
|
|
255
213
|
setShowNewNode(false);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
id,
|
|
259
|
-
treeContext
|
|
260
|
-
]);
|
|
261
|
-
const renameNode = (0, $gTuX4$react.useCallback)(async (newLabel)=>{
|
|
214
|
+
};
|
|
215
|
+
const renameNode = async (newLabel)=>{
|
|
262
216
|
setRenaming(false);
|
|
263
217
|
if (treeContext === null || treeContext === void 0 ? void 0 : treeContext.onRename) {
|
|
264
218
|
setUpdatingNode(true);
|
|
265
219
|
handleReturn(await treeContext.onRename(id, newLabel));
|
|
266
220
|
setUpdatingNode(false);
|
|
267
221
|
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
id,
|
|
271
|
-
treeContext
|
|
272
|
-
]);
|
|
273
|
-
const deleteThis = (0, $gTuX4$react.useCallback)(async ()=>{
|
|
222
|
+
};
|
|
223
|
+
const deleteThis = async ()=>{
|
|
274
224
|
if (treeContext === null || treeContext === void 0 ? void 0 : treeContext.onRemove) {
|
|
275
225
|
setUpdatingNode(true);
|
|
276
226
|
handleReturn(await treeContext.onRemove(id));
|
|
277
227
|
setUpdatingNode(false);
|
|
278
228
|
}
|
|
279
|
-
}
|
|
280
|
-
handleReturn,
|
|
281
|
-
id,
|
|
282
|
-
treeContext
|
|
283
|
-
]);
|
|
229
|
+
};
|
|
284
230
|
// Context actions
|
|
285
|
-
const addChild = (
|
|
231
|
+
const addChild = ()=>{
|
|
286
232
|
var _treeContext_handleExpandClick;
|
|
287
233
|
setShowNewNode(true);
|
|
288
234
|
treeContext === null || treeContext === void 0 ? void 0 : (_treeContext_handleExpandClick = treeContext.handleExpandClick) === null || _treeContext_handleExpandClick === void 0 ? void 0 : _treeContext_handleExpandClick.call(treeContext, id, true);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
treeContext
|
|
292
|
-
]);
|
|
293
|
-
(0, $gTuX4$react.useEffect)(()=>{
|
|
294
|
-
if (showNewNode === true && newNameRef.current) newNameRef.current.focus();
|
|
295
|
-
}, [
|
|
296
|
-
showNewNode
|
|
297
|
-
]);
|
|
298
|
-
const renameThis = (0, $gTuX4$react.useCallback)(()=>{
|
|
235
|
+
};
|
|
236
|
+
const renameThis = ()=>{
|
|
299
237
|
var _treeContext_handleSelect;
|
|
300
238
|
setRenaming(true);
|
|
301
239
|
treeContext === null || treeContext === void 0 ? void 0 : (_treeContext_handleSelect = treeContext.handleSelect) === null || _treeContext_handleSelect === void 0 ? void 0 : _treeContext_handleSelect.call(treeContext, id);
|
|
302
|
-
}
|
|
303
|
-
id,
|
|
304
|
-
treeContext
|
|
305
|
-
]);
|
|
240
|
+
};
|
|
306
241
|
// Context menu
|
|
307
|
-
const menuItems =
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
242
|
+
const menuItems = [];
|
|
243
|
+
if (canAddChildren) menuItems.push({
|
|
244
|
+
label: "Add",
|
|
245
|
+
action: addChild
|
|
246
|
+
});
|
|
247
|
+
if (canRename) menuItems.push({
|
|
248
|
+
label: "Rename",
|
|
249
|
+
action: renameThis
|
|
250
|
+
});
|
|
251
|
+
if (canRemove && (childNodes === undefined || childNodes.length === 0)) menuItems.push({
|
|
252
|
+
label: "Delete",
|
|
253
|
+
action: deleteThis
|
|
254
|
+
});
|
|
255
|
+
(0, $gTuX4$react.useEffect)(()=>{
|
|
256
|
+
if (showNewNode === true && newNameRef.current) newNameRef.current.focus();
|
|
322
257
|
}, [
|
|
323
|
-
|
|
324
|
-
canAddChildren,
|
|
325
|
-
canRemove,
|
|
326
|
-
canRename,
|
|
327
|
-
childNodes,
|
|
328
|
-
deleteThis,
|
|
329
|
-
renameThis
|
|
258
|
+
showNewNode
|
|
330
259
|
]);
|
|
331
260
|
// Return node
|
|
332
261
|
return !treeContext ? null : /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)((0, $gTuX4$reactjsxruntime.Fragment), {
|
|
@@ -414,6 +343,7 @@ const $a56aac35d4408806$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
414
343
|
},
|
|
415
344
|
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $176d21a51def1fce$export$14f190ac910bde69), {
|
|
416
345
|
id: `${treeContext.id}-treenode-entry-${id}`,
|
|
346
|
+
className: currentBorder ? "selected" : "",
|
|
417
347
|
ref: currentNameRef,
|
|
418
348
|
value: thisNode.label,
|
|
419
349
|
editing: renaming,
|
|
@@ -433,7 +363,7 @@ const $a56aac35d4408806$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
433
363
|
})
|
|
434
364
|
}),
|
|
435
365
|
childNodes && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
436
|
-
className: `ton-collapsible-wrapper ${expanded &&
|
|
366
|
+
className: `ton-collapsible-wrapper ${expanded && childNodes.length > 0 ? "" : "collapsed"}`,
|
|
437
367
|
children: childNodes.length > 0 && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
438
368
|
className: "ton-collapsible",
|
|
439
369
|
children: childNodes.map((h)=>/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("span", {
|
|
@@ -481,26 +411,28 @@ const $f31429c9cc6d3bce$export$40c47a7ac5f85aba = (nodeList, selected, expandedN
|
|
|
481
411
|
|
|
482
412
|
|
|
483
413
|
|
|
484
|
-
const $9becaaec3a803ae7$export$5580fff3e08a8be5 = ({
|
|
414
|
+
const $9becaaec3a803ae7$export$5580fff3e08a8be5 = ({ alwaysShowSelected: alwaysShowSelected = "first", canAddChildren: canAddChildren = false, canRemoveChildren: canRemoveChildren = false, canRemoveRoot: canRemoveRoot = false, canRenameChildren: canRenameChildren = false, canRenameRoot: canRenameRoot = false, handleSelect: handleSelect, id: id, 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)" })=>{
|
|
415
|
+
const [firstRender, setFirstRender] = (0, $gTuX4$react.useState)(alwaysShowSelected === "first");
|
|
485
416
|
const [expandedNodes, setExpandedNodes] = (0, $gTuX4$react.useState)([]);
|
|
486
|
-
const selectedArray = (0, $gTuX4$react.useMemo)(()=>Array.isArray(selected) ? selected : [
|
|
487
|
-
selected
|
|
488
|
-
], [
|
|
489
|
-
selected
|
|
490
|
-
]);
|
|
491
417
|
(0, $gTuX4$react.useEffect)(()=>{
|
|
492
|
-
|
|
418
|
+
const selectedArray = Array.isArray(selected) ? selected : [
|
|
419
|
+
selected
|
|
420
|
+
];
|
|
421
|
+
if ((alwaysShowSelected === "always" || firstRender) && selectedArray.length > 0) {
|
|
493
422
|
// Check all nodes are showing that should be
|
|
494
423
|
const shouldExpand = (0, $f31429c9cc6d3bce$export$40c47a7ac5f85aba)(nodeList, selectedArray, expandedNodes);
|
|
495
424
|
if (shouldExpand.filter((n)=>!expandedNodes.includes(n)).length > 0) setExpandedNodes(shouldExpand);
|
|
425
|
+
setFirstRender(false);
|
|
496
426
|
}
|
|
497
427
|
}, [
|
|
428
|
+
alwaysShowSelected,
|
|
429
|
+
firstRender,
|
|
498
430
|
expandedNodes,
|
|
499
431
|
nodeList,
|
|
500
|
-
|
|
432
|
+
selected
|
|
501
433
|
]);
|
|
502
434
|
// Change expansion and update contexts
|
|
503
|
-
const changeExpand = (
|
|
435
|
+
const changeExpand = (eKey, force)=>{
|
|
504
436
|
const newExpandedNodes = [
|
|
505
437
|
...expandedNodes
|
|
506
438
|
];
|
|
@@ -508,27 +440,27 @@ const $9becaaec3a803ae7$export$5580fff3e08a8be5 = ({ id: id, nodeList: nodeList,
|
|
|
508
440
|
if (ix === -1 && force === undefined || force === true) newExpandedNodes.push(eKey);
|
|
509
441
|
else newExpandedNodes.splice(ix, 1);
|
|
510
442
|
setExpandedNodes(newExpandedNodes);
|
|
511
|
-
}
|
|
512
|
-
expandedNodes
|
|
513
|
-
]);
|
|
443
|
+
};
|
|
514
444
|
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
515
445
|
id: id,
|
|
516
446
|
className: "tree-of-nodes",
|
|
517
447
|
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $ff9cca1fe8f6b24e$export$29ec378200e05207).Provider, {
|
|
518
448
|
value: {
|
|
519
449
|
id: id,
|
|
520
|
-
nodeList: nodeList,
|
|
521
|
-
selected: selectedArray,
|
|
522
|
-
showCheckBox: showCheckBox,
|
|
523
|
-
handleSelect: handleSelect,
|
|
524
450
|
expandedNodes: expandedNodes,
|
|
525
451
|
handleExpandClick: (r, f)=>changeExpand(r, f),
|
|
452
|
+
handleSelect: handleSelect,
|
|
453
|
+
nodeHighlight: nodeHighlight,
|
|
454
|
+
nodeList: nodeList,
|
|
526
455
|
onAddChild: onAdd,
|
|
527
|
-
onRename: onRename,
|
|
528
456
|
onRemove: onRemove,
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
457
|
+
onRename: onRename,
|
|
458
|
+
selected: Array.isArray(selected) ? selected : [
|
|
459
|
+
selected
|
|
460
|
+
],
|
|
461
|
+
showCheckBox: showCheckBox,
|
|
462
|
+
spellCheck: spellCheck,
|
|
463
|
+
textHighlight: textHighlight
|
|
532
464
|
},
|
|
533
465
|
children: roots.map((r)=>/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $a56aac35d4408806$export$2eba8ec3a333fdbb), {
|
|
534
466
|
id: r,
|
package/dist/cjs/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,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3C,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,gCAAC;QACC,IAAI;QACJ,WAAU;kBAEV,cAAA,gCAAC,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,gCAAC,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;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AuB,YAAY,WAAU,KAAM,cAAc,MAAM,GAAG,GAAG;YAChF,6CAA6C;YAC7C,MAAM,eAAe,CAAA,GAAA,yCAAiB,EAAE,UAAU,eAAe;YACjE,IAAI,aAAa,MAAM,CAAC,CAAC,IAAM,CAAC,cAAc,QAAQ,CAAC,IAAI,MAAM,GAAG,GAClE,iBAAiB;YAEnB,eAAe;QACjB;IACF,GAAG;QAAC;QAAoB;QAAa;QAAe;QAAU;KAAS;IAEvE,uCAAuC;IACvC,MAAM,eAAe,CAAC,MAAW;QAC/B,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;IAEA,qBACE,gCAAC;QACC,IAAI;QACJ,WAAU;kBAEV,cAAA,gCAAC,CAAA,GAAA,yCAAiB,EAAE,QAAQ;YAC1B,OAAO;gBACL,IAAI;+BACJ;gBACA,mBAAmB,CAAC,GAAG,IAAM,aAAa,GAAG;8BAC7C;+BACA;0BACA;gBACA,YAAY;0BACZ;0BACA;gBACA,UAAU,MAAM,OAAO,CAAC,YAAY,WAAW;oBAAC;iBAAS;8BACzD;4BACA;+BACA;YACF;sBAEC,MAAM,GAAG,CAAC,CAAC,kBACV,gCAAC,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 { 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 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 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[]>([]);\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.Provider\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.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"}
|
package/dist/main.css
CHANGED
|
@@ -34,12 +34,17 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.ton-label-span {
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
font-family: inherit;
|
|
39
|
+
font-size: inherit;
|
|
40
|
+
font-weight: inherit;
|
|
37
41
|
text-overflow: ellipsis;
|
|
38
42
|
white-space: nowrap;
|
|
39
|
-
border: 1px;
|
|
43
|
+
border: 1px solid #0000;
|
|
40
44
|
border-radius: 3px;
|
|
41
45
|
width: 100%;
|
|
42
46
|
padding: 1px 3px;
|
|
47
|
+
line-height: 24px;
|
|
43
48
|
display: inline-block;
|
|
44
49
|
overflow: hidden;
|
|
45
50
|
}
|
|
@@ -49,12 +54,23 @@
|
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
.ton-rename {
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
font-family: inherit;
|
|
59
|
+
font-size: inherit;
|
|
60
|
+
font-weight: inherit;
|
|
52
61
|
border: 1px dotted #000;
|
|
62
|
+
border-radius: 3px;
|
|
53
63
|
width: 100%;
|
|
54
64
|
min-width: 0;
|
|
65
|
+
padding: 1px 3px;
|
|
55
66
|
line-height: 24px;
|
|
56
67
|
}
|
|
57
68
|
|
|
69
|
+
.ton-rename:focus {
|
|
70
|
+
box-shadow: none;
|
|
71
|
+
outline: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
58
74
|
.ton-child {
|
|
59
75
|
opacity: 1;
|
|
60
76
|
transition: opacity var(--ton-long-transition-time) linear;
|
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"}
|