@asup/tree-of-nodes 2.0.3 → 2.0.5
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 +36 -2
- package/dist/cjs/main.css.map +1 -1
- package/dist/cjs/main.js +171 -152
- package/dist/cjs/main.js.map +1 -1
- package/dist/main.css +36 -2
- package/dist/main.css.map +1 -1
- package/dist/main.js +172 -153
- package/dist/main.js.map +1 -1
- package/dist/tree-of-nodes.d.ts +4 -3
- package/dist/tree-of-nodes.d.ts.map +1 -1
- package/package.json +23 -16
package/dist/cjs/main.css
CHANGED
|
@@ -4,7 +4,39 @@
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
.ton-expander {
|
|
7
|
-
margin
|
|
7
|
+
margin: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ton-node {
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
align-items: center;
|
|
13
|
+
width: 100%;
|
|
14
|
+
max-width: 100%;
|
|
15
|
+
height: 34px;
|
|
16
|
+
display: flex;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ton-label {
|
|
20
|
+
height: 34px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ton-label-span {
|
|
24
|
+
text-overflow: ellipsis;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
width: 100%;
|
|
27
|
+
display: inline-block;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ton-rename-holder {
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ton-rename {
|
|
36
|
+
border: 1px dotted #000;
|
|
37
|
+
width: 100%;
|
|
38
|
+
min-width: 0;
|
|
39
|
+
line-height: .75rem;
|
|
8
40
|
}
|
|
9
41
|
|
|
10
42
|
.ton-child {
|
|
@@ -15,6 +47,8 @@
|
|
|
15
47
|
}
|
|
16
48
|
|
|
17
49
|
.ton-collapsible-wrapper {
|
|
50
|
+
width: 100%;
|
|
51
|
+
max-width: 100%;
|
|
18
52
|
display: flex;
|
|
19
53
|
overflow: hidden;
|
|
20
54
|
}
|
|
@@ -27,6 +61,7 @@
|
|
|
27
61
|
}
|
|
28
62
|
|
|
29
63
|
.ton-collapsible {
|
|
64
|
+
width: 100%;
|
|
30
65
|
max-height: 10000px;
|
|
31
66
|
margin-bottom: 0;
|
|
32
67
|
transition: margin-bottom .3s cubic-bezier(0, 0, 0, 1);
|
|
@@ -53,5 +88,4 @@
|
|
|
53
88
|
opacity: 0;
|
|
54
89
|
transition: opacity .6s linear;
|
|
55
90
|
}
|
|
56
|
-
|
|
57
91
|
/*# sourceMappingURL=main.css.map */
|
package/dist/cjs/main.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;AAKA;;;;AAIA;;;;;;;AAOA
|
|
1
|
+
{"mappings":"AAAA;;;;;AAKA;;;;AAIA;;;;;;;;;AASA;;;;AAIA;;;;;;;;AAQA;;;;AAIA;;;;;;;AAOA;;;;;;;AAOA;;;;;;;AAMA;;;;;;;AAQA;;;;;;;AAMA;;;;;;;AASA;;;;;;AAKA;;;;AAGA","sources":["src/components/TreeNode.css"],"sourcesContent":[".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: 34px;\n}\n\n.ton-label {\n height: 34px;\n}\n\n.ton-label-span {\n display: inline-block;\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ton-rename-holder {\n width: 100%;\n}\n\n.ton-rename {\n line-height: 0.75rem;\n border: 1px dotted black;\n width: 100%;\n min-width: 0;\n}\n\n.ton-child {\n margin-left: 16px;\n display: block;\n opacity: 1;\n transition: opacity 0.6s 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: 20px;\n transition:\n height 0.3s linear,\n max-height 0s 0.3s linear;\n max-height: 0px;\n}\n.ton-collapsible {\n transition: margin-bottom 0.3s cubic-bezier(0, 0, 0, 1);\n margin-bottom: 0;\n max-height: 10000px;\n width: 100%;\n}\n.ton-collapsible-wrapper.collapsed > .ton-collapsible {\n margin-bottom: -2000px;\n transition:\n margin-bottom 0.3s cubic-bezier(1, 0, 1, 1),\n visibility 0s 0.3s,\n max-height 0s 0.3s;\n visibility: hidden;\n max-height: 0;\n}\n.ton-collapsible-wrapper.collapsed:after {\n height: 0;\n transition: height 0.3s 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 0.6s linear;\n}\n"],"names":[],"version":3,"file":"main.css.map"}
|
package/dist/cjs/main.js
CHANGED
|
@@ -3,6 +3,7 @@ var $gTuX4$reactjsxruntime = require("react/jsx-runtime");
|
|
|
3
3
|
var $gTuX4$asupcontextmenu = require("@asup/context-menu");
|
|
4
4
|
var $gTuX4$react = require("react");
|
|
5
5
|
var $gTuX4$reactbootstrapicons = require("react-bootstrap-icons");
|
|
6
|
+
var $gTuX4$swchelperscjs_object_spreadcjs = require("@swc/helpers/cjs/_object_spread.cjs");
|
|
6
7
|
var $gTuX4$reactbootstrap = require("react-bootstrap");
|
|
7
8
|
|
|
8
9
|
|
|
@@ -74,18 +75,18 @@ const $ff9cca1fe8f6b24e$export$29ec378200e05207 = (0, $gTuX4$react.createContext
|
|
|
74
75
|
|
|
75
76
|
|
|
76
77
|
|
|
78
|
+
|
|
77
79
|
const $176d21a51def1fce$export$14f190ac910bde69 = /*#__PURE__*/ (0, ($parcel$interopDefault($gTuX4$react))).forwardRef(({ id: id, value: value, editing: editing, saving: saving, setValue: setValue, sendEscape: sendEscape, style: style, spellCheck: spellCheck = "true" }, ref)=>{
|
|
78
80
|
$176d21a51def1fce$export$14f190ac910bde69.displayName = "WordEntry";
|
|
79
81
|
const currentStyle = (0, $gTuX4$react.useMemo)(()=>{
|
|
80
|
-
return {
|
|
82
|
+
return (0, $gTuX4$swchelperscjs_object_spreadcjs._)({
|
|
81
83
|
display: "inline-block",
|
|
82
84
|
padding: "1px",
|
|
83
85
|
paddingLeft: "3px",
|
|
84
86
|
paddingRight: "3px",
|
|
85
87
|
border: "1px",
|
|
86
|
-
borderRadius: "3px"
|
|
87
|
-
|
|
88
|
-
};
|
|
88
|
+
borderRadius: "3px"
|
|
89
|
+
}, style);
|
|
89
90
|
}, [
|
|
90
91
|
style
|
|
91
92
|
]);
|
|
@@ -96,7 +97,7 @@ const $176d21a51def1fce$export$14f190ac910bde69 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
96
97
|
value
|
|
97
98
|
]);
|
|
98
99
|
const returnData = (0, $gTuX4$react.useCallback)(()=>{
|
|
99
|
-
setValue
|
|
100
|
+
setValue === null || setValue === void 0 ? void 0 : setValue(currentValue);
|
|
100
101
|
}, [
|
|
101
102
|
currentValue,
|
|
102
103
|
setValue
|
|
@@ -104,7 +105,7 @@ const $176d21a51def1fce$export$14f190ac910bde69 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
104
105
|
const keyPress = (0, $gTuX4$react.useCallback)((e)=>{
|
|
105
106
|
if (e.code === "Escape") {
|
|
106
107
|
setCurrentValue(value !== null && value !== void 0 ? value : "");
|
|
107
|
-
sendEscape
|
|
108
|
+
sendEscape === null || sendEscape === void 0 ? void 0 : sendEscape();
|
|
108
109
|
} else if (e.code === "Enter") returnData();
|
|
109
110
|
}, [
|
|
110
111
|
returnData,
|
|
@@ -113,6 +114,7 @@ const $176d21a51def1fce$export$14f190ac910bde69 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
113
114
|
]);
|
|
114
115
|
// Simple if not editing
|
|
115
116
|
if (!editing) return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("span", {
|
|
117
|
+
className: "ton-label-span",
|
|
116
118
|
style: currentStyle,
|
|
117
119
|
id: `${id}`,
|
|
118
120
|
children: value ? value : /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactjsxruntime.Fragment), {
|
|
@@ -122,6 +124,7 @@ const $176d21a51def1fce$export$14f190ac910bde69 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
122
124
|
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("div", {
|
|
123
125
|
style: currentStyle,
|
|
124
126
|
id: `${id}-holder`,
|
|
127
|
+
className: "ton-rename-holder",
|
|
125
128
|
children: [
|
|
126
129
|
saving && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrap.Spinner), {
|
|
127
130
|
id: `${id}-spinner`,
|
|
@@ -134,12 +137,7 @@ const $176d21a51def1fce$export$14f190ac910bde69 = /*#__PURE__*/ (0, ($parcel$int
|
|
|
134
137
|
id: String(id),
|
|
135
138
|
ref: ref,
|
|
136
139
|
type: "text",
|
|
137
|
-
|
|
138
|
-
lineHeight: "0.75rem",
|
|
139
|
-
border: "1px dotted black",
|
|
140
|
-
width: "auto",
|
|
141
|
-
minWidth: "0"
|
|
142
|
-
},
|
|
140
|
+
className: "ton-rename",
|
|
143
141
|
value: currentValue,
|
|
144
142
|
disabled: saving,
|
|
145
143
|
onChange: (e)=>setCurrentValue(e.currentTarget.value),
|
|
@@ -274,8 +272,9 @@ const $a56aac35d4408806$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
274
272
|
]);
|
|
275
273
|
// Context actions
|
|
276
274
|
const addChild = (0, $gTuX4$react.useCallback)(()=>{
|
|
275
|
+
var _treeContext_handleExpandClick;
|
|
277
276
|
setShowNewNode(true);
|
|
278
|
-
treeContext
|
|
277
|
+
treeContext === null || treeContext === void 0 ? void 0 : (_treeContext_handleExpandClick = treeContext.handleExpandClick) === null || _treeContext_handleExpandClick === void 0 ? void 0 : _treeContext_handleExpandClick.call(treeContext, id, true);
|
|
279
278
|
}, [
|
|
280
279
|
id,
|
|
281
280
|
treeContext
|
|
@@ -286,8 +285,9 @@ const $a56aac35d4408806$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
286
285
|
showNewNode
|
|
287
286
|
]);
|
|
288
287
|
const renameThis = (0, $gTuX4$react.useCallback)(()=>{
|
|
288
|
+
var _treeContext_handleSelect;
|
|
289
289
|
setRenaming(true);
|
|
290
|
-
treeContext
|
|
290
|
+
treeContext === null || treeContext === void 0 ? void 0 : (_treeContext_handleSelect = treeContext.handleSelect) === null || _treeContext_handleSelect === void 0 ? void 0 : _treeContext_handleSelect.call(treeContext, id);
|
|
291
291
|
}, [
|
|
292
292
|
id,
|
|
293
293
|
treeContext
|
|
@@ -318,124 +318,139 @@ const $a56aac35d4408806$export$2eba8ec3a333fdbb = ({ id: id, canRemove: canRemov
|
|
|
318
318
|
renameThis
|
|
319
319
|
]);
|
|
320
320
|
// Return node
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
onClick: ()=>treeContext.handleExpandClick(id)
|
|
357
|
-
}) : /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrapicons.CaretDownFill), {
|
|
358
|
-
id: `${treeContext.id}-treenode-caret-${id}`,
|
|
359
|
-
className: "ton-expander",
|
|
360
|
-
role: "button",
|
|
361
|
-
"aria-expanded": true,
|
|
362
|
-
"aria-label": "Expander",
|
|
363
|
-
color: nodeColour,
|
|
364
|
-
onClick: ()=>{
|
|
365
|
-
treeContext.handleExpandClick(id);
|
|
366
|
-
}
|
|
367
|
-
}) : /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrapicons.CaretRight), {
|
|
368
|
-
id: `${treeContext.id}-treenode-caret-${id}`,
|
|
369
|
-
className: "ton-expander",
|
|
370
|
-
role: "button",
|
|
371
|
-
color: nodeColour,
|
|
372
|
-
"aria-expanded": false,
|
|
373
|
-
"aria-label": "Disabled expander",
|
|
374
|
-
onClick: ()=>treeContext.handleSelect && treeContext.handleSelect(id)
|
|
375
|
-
}),
|
|
376
|
-
thisNode && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
377
|
-
style: {
|
|
378
|
-
display: "inline-block"
|
|
379
|
-
},
|
|
380
|
-
onContextMenuCapture: ()=>treeContext.handleSelect && treeContext.handleSelect(id),
|
|
381
|
-
onClickCapture: ()=>treeContext.handleSelect && treeContext.handleSelect(id),
|
|
382
|
-
onFocusCapture: ()=>treeContext.handleSelect && treeContext.handleSelect(id),
|
|
383
|
-
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $176d21a51def1fce$export$14f190ac910bde69), {
|
|
384
|
-
id: `${treeContext.id}-treenode-entry-${id}`,
|
|
385
|
-
ref: currentNameRef,
|
|
386
|
-
value: thisNode.label,
|
|
387
|
-
editing: renaming,
|
|
388
|
-
saving: updatingNode,
|
|
389
|
-
setValue: (ret)=>renameNode(ret),
|
|
390
|
-
sendEscape: ()=>setRenaming(false),
|
|
321
|
+
return !treeContext ? null : /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)((0, $gTuX4$reactjsxruntime.Fragment), {
|
|
322
|
+
children: [
|
|
323
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$asupcontextmenu.ContextMenuHandler), {
|
|
324
|
+
menuItems: menuItems,
|
|
325
|
+
style: {
|
|
326
|
+
display: "inline-block",
|
|
327
|
+
width: "100%"
|
|
328
|
+
},
|
|
329
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
330
|
+
id: `${treeContext.id}-treenode-${id}`,
|
|
331
|
+
className: "treenode",
|
|
332
|
+
children: error ? /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)((0, $gTuX4$reactjsxruntime.Fragment), {
|
|
333
|
+
children: [
|
|
334
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrapicons.ExclamationCircleFill), {
|
|
335
|
+
color: "var(--bs-danger)"
|
|
336
|
+
}),
|
|
337
|
+
" ",
|
|
338
|
+
errorText
|
|
339
|
+
]
|
|
340
|
+
}) : /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("div", {
|
|
341
|
+
className: "ton-node",
|
|
342
|
+
children: [
|
|
343
|
+
treeContext.showCheckBox && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("input", {
|
|
344
|
+
ref: checkRef,
|
|
345
|
+
type: "checkbox",
|
|
346
|
+
role: "checkbox",
|
|
347
|
+
className: "ton-checkbox",
|
|
348
|
+
id: `${treeContext.id}-treenode-checkbox-${id}`,
|
|
349
|
+
onClick: ()=>{
|
|
350
|
+
var _treeContext_handleSelect;
|
|
351
|
+
return treeContext === null || treeContext === void 0 ? void 0 : (_treeContext_handleSelect = treeContext.handleSelect) === null || _treeContext_handleSelect === void 0 ? void 0 : _treeContext_handleSelect.call(treeContext, descendents);
|
|
352
|
+
}
|
|
353
|
+
}),
|
|
354
|
+
childNodes !== undefined && childNodes.length > 0 ? !expanded ? /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrapicons.CaretRightFill), {
|
|
355
|
+
id: `${treeContext.id}-treenode-caret-${id}`,
|
|
391
356
|
style: {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
backgroundColor: currentBorder === "" ? "" : treeContext.textHighlight
|
|
357
|
+
width: "16px",
|
|
358
|
+
height: "16px"
|
|
395
359
|
},
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
360
|
+
className: "ton-expander",
|
|
361
|
+
role: "button",
|
|
362
|
+
color: nodeColour,
|
|
363
|
+
"aria-expanded": false,
|
|
364
|
+
"aria-label": "Expander",
|
|
365
|
+
onClick: ()=>treeContext.handleExpandClick(id)
|
|
366
|
+
}) : /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrapicons.CaretDownFill), {
|
|
367
|
+
id: `${treeContext.id}-treenode-caret-${id}`,
|
|
368
|
+
className: "ton-expander",
|
|
369
|
+
role: "button",
|
|
370
|
+
"aria-expanded": true,
|
|
371
|
+
"aria-label": "Expander",
|
|
372
|
+
color: nodeColour,
|
|
373
|
+
onClick: ()=>treeContext.handleExpandClick(id)
|
|
374
|
+
}) : /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrapicons.CaretRight), {
|
|
375
|
+
id: `${treeContext.id}-treenode-caret-${id}`,
|
|
376
|
+
className: "ton-expander",
|
|
377
|
+
role: "button",
|
|
378
|
+
color: nodeColour,
|
|
379
|
+
"aria-expanded": false,
|
|
380
|
+
"aria-label": "Disabled expander",
|
|
381
|
+
onClick: ()=>{
|
|
382
|
+
var _treeContext_handleSelect;
|
|
383
|
+
return (_treeContext_handleSelect = treeContext.handleSelect) === null || _treeContext_handleSelect === void 0 ? void 0 : _treeContext_handleSelect.call(treeContext, id);
|
|
384
|
+
}
|
|
385
|
+
}),
|
|
386
|
+
thisNode && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
387
|
+
className: "ton-label",
|
|
388
|
+
style: {
|
|
389
|
+
width: `calc(100% - ${treeContext.showCheckBox ? "32px" : "16px"})`
|
|
390
|
+
},
|
|
391
|
+
onContextMenuCapture: ()=>{
|
|
392
|
+
var _treeContext_handleSelect;
|
|
393
|
+
return (_treeContext_handleSelect = treeContext.handleSelect) === null || _treeContext_handleSelect === void 0 ? void 0 : _treeContext_handleSelect.call(treeContext, id);
|
|
394
|
+
},
|
|
395
|
+
onClickCapture: ()=>{
|
|
396
|
+
var _treeContext_handleSelect;
|
|
397
|
+
return (_treeContext_handleSelect = treeContext.handleSelect) === null || _treeContext_handleSelect === void 0 ? void 0 : _treeContext_handleSelect.call(treeContext, id);
|
|
398
|
+
},
|
|
399
|
+
onFocusCapture: ()=>{
|
|
400
|
+
var _treeContext_handleSelect;
|
|
401
|
+
return (_treeContext_handleSelect = treeContext.handleSelect) === null || _treeContext_handleSelect === void 0 ? void 0 : _treeContext_handleSelect.call(treeContext, id);
|
|
402
|
+
},
|
|
403
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $176d21a51def1fce$export$14f190ac910bde69), {
|
|
404
|
+
id: `${treeContext.id}-treenode-entry-${id}`,
|
|
405
|
+
ref: currentNameRef,
|
|
406
|
+
value: thisNode.label,
|
|
407
|
+
editing: renaming,
|
|
408
|
+
saving: updatingNode,
|
|
409
|
+
setValue: (ret)=>renameNode(ret),
|
|
410
|
+
sendEscape: ()=>setRenaming(false),
|
|
411
|
+
style: {
|
|
412
|
+
border: currentBorder,
|
|
413
|
+
margin: currentBorder === "" ? "1px" : "",
|
|
414
|
+
backgroundColor: currentBorder === "" ? "" : treeContext.textHighlight
|
|
415
|
+
},
|
|
416
|
+
spellCheck: treeContext.spellCheck
|
|
415
417
|
})
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
}),
|
|
419
|
-
showNewNode && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
420
|
-
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $176d21a51def1fce$export$14f190ac910bde69), {
|
|
421
|
-
style: {
|
|
422
|
-
marginLeft: "14px"
|
|
423
|
-
},
|
|
424
|
-
id: `treenode-new-${id}`,
|
|
425
|
-
ref: newNameRef,
|
|
426
|
-
editing: true,
|
|
427
|
-
setValue: (ret)=>{
|
|
428
|
-
confirmNewNode(ret);
|
|
429
|
-
},
|
|
430
|
-
saving: savingNewNode,
|
|
431
|
-
sendEscape: ()=>{
|
|
432
|
-
setShowNewNode(false);
|
|
433
|
-
},
|
|
434
|
-
spellCheck: treeContext.spellCheck
|
|
418
|
+
})
|
|
419
|
+
]
|
|
435
420
|
})
|
|
436
421
|
})
|
|
437
|
-
|
|
438
|
-
|
|
422
|
+
}),
|
|
423
|
+
showNewNode && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $176d21a51def1fce$export$14f190ac910bde69), {
|
|
424
|
+
style: {
|
|
425
|
+
marginLeft: "14px"
|
|
426
|
+
},
|
|
427
|
+
id: `treenode-new-${id}`,
|
|
428
|
+
ref: newNameRef,
|
|
429
|
+
editing: true,
|
|
430
|
+
setValue: (ret)=>confirmNewNode(ret),
|
|
431
|
+
saving: savingNewNode,
|
|
432
|
+
sendEscape: ()=>setShowNewNode(false),
|
|
433
|
+
spellCheck: treeContext.spellCheck
|
|
434
|
+
}),
|
|
435
|
+
childNodes !== undefined && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
436
|
+
className: `ton-collapsible-wrapper ${expanded ? "" : "collapsed"}`,
|
|
437
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
438
|
+
className: "ton-collapsible",
|
|
439
|
+
children: childNodes.map((h)=>/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("span", {
|
|
440
|
+
id: `${treeContext.id}-treenode-child-${h.id}`,
|
|
441
|
+
className: "ton-child",
|
|
442
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)($a56aac35d4408806$export$2eba8ec3a333fdbb, {
|
|
443
|
+
id: h.id,
|
|
444
|
+
canRemove: canRemoveChildren,
|
|
445
|
+
canRename: canRenameChildren,
|
|
446
|
+
canAddChildren: canAddChildren,
|
|
447
|
+
canRemoveChildren: canRemoveChildren,
|
|
448
|
+
canRenameChildren: canRenameChildren
|
|
449
|
+
})
|
|
450
|
+
}, h.id))
|
|
451
|
+
})
|
|
452
|
+
})
|
|
453
|
+
]
|
|
439
454
|
});
|
|
440
455
|
};
|
|
441
456
|
$a56aac35d4408806$export$2eba8ec3a333fdbb.displayName = "TreeNode";
|
|
@@ -465,7 +480,7 @@ const $9becaaec3a803ae7$export$5580fff3e08a8be5 = ({ id: id, nodeList: nodeList,
|
|
|
465
480
|
if (selectedArray.length > 0) {
|
|
466
481
|
// Check all nodes are showing that should be
|
|
467
482
|
const shouldExpand = (0, $f31429c9cc6d3bce$export$40c47a7ac5f85aba)(nodeList, selectedArray, expandedNodes);
|
|
468
|
-
shouldExpand.filter((n)=>!expandedNodes.includes(n)).length > 0
|
|
483
|
+
if (shouldExpand.filter((n)=>!expandedNodes.includes(n)).length > 0) setExpandedNodes(shouldExpand);
|
|
469
484
|
}
|
|
470
485
|
}, [
|
|
471
486
|
expandedNodes,
|
|
@@ -484,30 +499,34 @@ const $9becaaec3a803ae7$export$5580fff3e08a8be5 = ({ id: id, nodeList: nodeList,
|
|
|
484
499
|
}, [
|
|
485
500
|
expandedNodes
|
|
486
501
|
]);
|
|
487
|
-
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)(
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
502
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
503
|
+
id: id,
|
|
504
|
+
className: "tree-of-nodes",
|
|
505
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $ff9cca1fe8f6b24e$export$29ec378200e05207).Provider, {
|
|
506
|
+
value: {
|
|
507
|
+
id: id,
|
|
508
|
+
nodeList: nodeList,
|
|
509
|
+
selected: selectedArray,
|
|
510
|
+
showCheckBox: showCheckBox,
|
|
511
|
+
handleSelect: handleSelect,
|
|
512
|
+
expandedNodes: expandedNodes,
|
|
513
|
+
handleExpandClick: (r, f)=>changeExpand(r, f),
|
|
514
|
+
onAddChild: onAdd,
|
|
515
|
+
onRename: onRename,
|
|
516
|
+
onRemove: onRemove,
|
|
517
|
+
nodeHighlight: nodeHighlight,
|
|
518
|
+
textHighlight: textHighlight,
|
|
519
|
+
spellCheck: spellCheck
|
|
520
|
+
},
|
|
521
|
+
children: roots.map((r)=>/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $a56aac35d4408806$export$2eba8ec3a333fdbb), {
|
|
522
|
+
id: r,
|
|
523
|
+
canRemove: canRemoveRoot,
|
|
524
|
+
canAddChildren: canAddChildren,
|
|
525
|
+
canRename: canRenameRoot,
|
|
526
|
+
canRemoveChildren: canRemoveChildren,
|
|
527
|
+
canRenameChildren: canRenameChildren
|
|
528
|
+
}, r))
|
|
529
|
+
})
|
|
511
530
|
});
|
|
512
531
|
};
|
|
513
532
|
$9becaaec3a803ae7$export$5580fff3e08a8be5.displayName = "TreeOfNodes";
|