@asup/tree-of-nodes 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/main.css +41 -0
- package/dist/cjs/main.css.map +1 -0
- package/dist/cjs/main.js +642 -1667
- package/dist/cjs/main.js.map +1 -0
- package/dist/main.css +41 -0
- package/dist/main.css.map +1 -0
- package/dist/main.js +501 -1657
- package/dist/main.js.map +1 -0
- package/dist/tree-of-nodes.d.ts +32 -40
- package/dist/tree-of-nodes.d.ts.map +1 -0
- package/package.json +7 -11
- package/dist/__mocks__/mockNodes.d.ts +0 -4
- package/dist/__mocks__/styleMock.d.ts +0 -2
- package/dist/__tests__/ContextMenu.d.ts +0 -1
- package/dist/__tests__/ContextMenu.test.d.ts +0 -1
- package/dist/__tests__/TreeNode.test.d.ts +0 -1
- package/dist/__tests__/TreeOfNodes.test.d.ts +0 -1
- package/dist/__tests__/WordEntry.test.d.ts +0 -1
- package/dist/cjs/__mocks__/mockNodes.d.ts +0 -4
- package/dist/cjs/__mocks__/styleMock.d.ts +0 -2
- package/dist/cjs/__tests__/ContextMenu.d.ts +0 -1
- package/dist/cjs/__tests__/ContextMenu.test.d.ts +0 -1
- package/dist/cjs/__tests__/TreeNode.test.d.ts +0 -1
- package/dist/cjs/__tests__/TreeOfNodes.test.d.ts +0 -1
- package/dist/cjs/__tests__/WordEntry.test.d.ts +0 -1
- package/dist/cjs/components/ContextMenu.d.ts +0 -4
- package/dist/cjs/components/ContextMenuProvider.d.ts +0 -28
- package/dist/cjs/components/TreeNode.d.ts +0 -13
- package/dist/cjs/components/TreeOfNodes.d.ts +0 -20
- package/dist/cjs/components/TreeOfNodesContext.d.ts +0 -28
- package/dist/cjs/components/WordEntry.d.ts +0 -12
- package/dist/cjs/components/index.d.ts +0 -8
- package/dist/cjs/main.d.ts +0 -1
- package/dist/cjs/style.css +0 -1
- package/dist/components/ContextMenu.d.ts +0 -4
- package/dist/components/ContextMenuProvider.d.ts +0 -28
- package/dist/components/TreeNode.d.ts +0 -13
- package/dist/components/TreeOfNodes.d.ts +0 -20
- package/dist/components/TreeOfNodesContext.d.ts +0 -28
- package/dist/components/WordEntry.d.ts +0 -12
- package/dist/components/index.d.ts +0 -8
- package/dist/main.d.ts +0 -1
- package/dist/style.css +0 -1
package/dist/cjs/main.js
CHANGED
|
@@ -1,1727 +1,702 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
});
|
|
1
|
+
require("./main.css");
|
|
2
|
+
var $gTuX4$reactjsxruntime = require("react/jsx-runtime");
|
|
3
|
+
var $gTuX4$react = require("react");
|
|
4
|
+
var $gTuX4$swchelperslib_sliced_to_arrayjs = require("@swc/helpers/lib/_sliced_to_array.js");
|
|
5
|
+
var $gTuX4$swchelperslib_async_to_generatorjs = require("@swc/helpers/lib/_async_to_generator.js");
|
|
6
|
+
var $gTuX4$swchelperslib_ts_generatorjs = require("@swc/helpers/lib/_ts_generator.js");
|
|
7
|
+
var $gTuX4$reactbootstrap = require("react-bootstrap");
|
|
8
|
+
var $gTuX4$reactbootstrapicons = require("react-bootstrap-icons");
|
|
9
|
+
var $gTuX4$swchelperslib_object_spreadjs = require("@swc/helpers/lib/_object_spread.js");
|
|
10
|
+
var $gTuX4$swchelperslib_to_consumable_arrayjs = require("@swc/helpers/lib/_to_consumable_array.js");
|
|
11
|
+
|
|
12
|
+
function $parcel$exportWildcard(dest, source) {
|
|
13
|
+
Object.keys(source).forEach(function(key) {
|
|
14
|
+
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
15
|
+
return;
|
|
18
16
|
}
|
|
19
|
-
n.default = e;
|
|
20
|
-
return Object.freeze(n);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
24
|
-
|
|
25
|
-
const ContextMenu = React.forwardRef(({ entries, visible, xPos, yPos }, ref) => {
|
|
26
|
-
ContextMenu.displayName = 'ContextMenu';
|
|
27
|
-
return (jsxRuntime.jsx("div", { ref: ref, className: `context-menu ${visible ? 'visible' : ''}`, style: {
|
|
28
|
-
top: `${yPos}px`,
|
|
29
|
-
left: `${xPos}px`,
|
|
30
|
-
}, children: entries.map((e, i) => (jsxRuntime.jsx("div", { className: 'context-menu-item', onClick: () => {
|
|
31
|
-
e.action && e.action();
|
|
32
|
-
}, children: e.label ?? '' }, i))) }));
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const MenuContext = React.createContext({});
|
|
36
|
-
const ContextMenuProvider = ({ children }) => {
|
|
37
|
-
// Menu resources
|
|
38
|
-
const divRef = React.useRef(null);
|
|
39
|
-
const menuRef = React.useRef(null);
|
|
40
|
-
const [menuXPos, setMenuXPos] = React.useState(0);
|
|
41
|
-
const [menuYPos, setMenuYPos] = React.useState(0);
|
|
42
|
-
const [menuVisible, setMenuVisible] = React.useState(false);
|
|
43
|
-
const [menuItems, setMenuItems] = React.useState([]);
|
|
44
|
-
// Update menu items
|
|
45
|
-
const updateMenu = React.useCallback((ret) => {
|
|
46
|
-
if (!divRef.current)
|
|
47
|
-
return;
|
|
48
|
-
if (ret.visible !== undefined)
|
|
49
|
-
setMenuVisible(ret.visible);
|
|
50
|
-
if (ret.x !== undefined)
|
|
51
|
-
setMenuXPos(ret.x - window.scrollX - divRef.current.getBoundingClientRect().x);
|
|
52
|
-
if (ret.y !== undefined)
|
|
53
|
-
setMenuYPos(ret.y - window.scrollX - divRef.current.getBoundingClientRect().y);
|
|
54
|
-
if (ret.menuItems !== undefined)
|
|
55
|
-
setMenuItems(ret.menuItems);
|
|
56
|
-
}, []);
|
|
57
|
-
// Handle click off the menu
|
|
58
|
-
const handleClick = React.useCallback((e) => {
|
|
59
|
-
if (menuRef.current &&
|
|
60
|
-
((e.target instanceof Element && !menuRef.current?.contains(e.target)) ||
|
|
61
|
-
!(e.target instanceof Element))) {
|
|
62
|
-
setMenuVisible(false);
|
|
63
|
-
}
|
|
64
|
-
}, []);
|
|
65
|
-
// Update the document click handler
|
|
66
|
-
React.useEffect(() => {
|
|
67
|
-
if (menuVisible)
|
|
68
|
-
document.addEventListener('mousedown', handleClick);
|
|
69
|
-
else
|
|
70
|
-
document.removeEventListener('mousedown', handleClick);
|
|
71
|
-
return () => {
|
|
72
|
-
document.removeEventListener('mousedown', handleClick);
|
|
73
|
-
};
|
|
74
|
-
}, [handleClick, menuVisible]);
|
|
75
|
-
return (jsxRuntime.jsx(MenuContext.Provider, { value: {
|
|
76
|
-
visible: menuVisible,
|
|
77
|
-
x: menuXPos,
|
|
78
|
-
y: menuYPos,
|
|
79
|
-
set: updateMenu,
|
|
80
|
-
}, children: jsxRuntime.jsxs("div", { className: 'menu-context-provider', style: { position: 'relative' }, ref: divRef, children: [children, jsxRuntime.jsx(ContextMenu, { ref: menuRef, entries: menuItems, visible: menuVisible, xPos: menuXPos, yPos: menuYPos })] }) }));
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
var classnames = {exports: {}};
|
|
84
|
-
|
|
85
|
-
/*!
|
|
86
|
-
Copyright (c) 2018 Jed Watson.
|
|
87
|
-
Licensed under the MIT License (MIT), see
|
|
88
|
-
http://jedwatson.github.io/classnames
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
|
-
(function (module) {
|
|
92
|
-
/* global define */
|
|
93
|
-
|
|
94
|
-
(function () {
|
|
95
|
-
|
|
96
|
-
var hasOwn = {}.hasOwnProperty;
|
|
97
|
-
|
|
98
|
-
function classNames() {
|
|
99
|
-
var classes = [];
|
|
100
|
-
|
|
101
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
102
|
-
var arg = arguments[i];
|
|
103
|
-
if (!arg) continue;
|
|
104
|
-
|
|
105
|
-
var argType = typeof arg;
|
|
106
|
-
|
|
107
|
-
if (argType === 'string' || argType === 'number') {
|
|
108
|
-
classes.push(arg);
|
|
109
|
-
} else if (Array.isArray(arg)) {
|
|
110
|
-
if (arg.length) {
|
|
111
|
-
var inner = classNames.apply(null, arg);
|
|
112
|
-
if (inner) {
|
|
113
|
-
classes.push(inner);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
} else if (argType === 'object') {
|
|
117
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
118
|
-
classes.push(arg.toString());
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
for (var key in arg) {
|
|
123
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
124
|
-
classes.push(key);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return classes.join(' ');
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (module.exports) {
|
|
134
|
-
classNames.default = classNames;
|
|
135
|
-
module.exports = classNames;
|
|
136
|
-
} else {
|
|
137
|
-
window.classNames = classNames;
|
|
138
|
-
}
|
|
139
|
-
}());
|
|
140
|
-
} (classnames));
|
|
141
|
-
|
|
142
|
-
var classNames = classnames.exports;
|
|
143
|
-
|
|
144
|
-
const DEFAULT_BREAKPOINTS = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
|
|
145
|
-
const DEFAULT_MIN_BREAKPOINT = 'xs';
|
|
146
|
-
const ThemeContext = /*#__PURE__*/React__namespace.createContext({
|
|
147
|
-
prefixes: {},
|
|
148
|
-
breakpoints: DEFAULT_BREAKPOINTS,
|
|
149
|
-
minBreakpoint: DEFAULT_MIN_BREAKPOINT
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
function useBootstrapPrefix(prefix, defaultPrefix) {
|
|
153
|
-
const {
|
|
154
|
-
prefixes
|
|
155
|
-
} = React.useContext(ThemeContext);
|
|
156
|
-
return prefix || prefixes[defaultPrefix] || defaultPrefix;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
var propTypes = {exports: {}};
|
|
160
|
-
|
|
161
|
-
var reactIs = {exports: {}};
|
|
162
|
-
|
|
163
|
-
var reactIs_production_min = {};
|
|
164
|
-
|
|
165
|
-
/** @license React v16.13.1
|
|
166
|
-
* react-is.production.min.js
|
|
167
|
-
*
|
|
168
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
169
|
-
*
|
|
170
|
-
* This source code is licensed under the MIT license found in the
|
|
171
|
-
* LICENSE file in the root directory of this source tree.
|
|
172
|
-
*/
|
|
173
|
-
|
|
174
|
-
var hasRequiredReactIs_production_min;
|
|
175
|
-
|
|
176
|
-
function requireReactIs_production_min () {
|
|
177
|
-
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
178
|
-
hasRequiredReactIs_production_min = 1;
|
|
179
|
-
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
180
|
-
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
181
|
-
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
|
|
182
|
-
reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
|
|
183
|
-
reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
|
|
184
|
-
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
|
|
185
|
-
return reactIs_production_min;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
var reactIs_development = {};
|
|
189
|
-
|
|
190
|
-
/** @license React v16.13.1
|
|
191
|
-
* react-is.development.js
|
|
192
|
-
*
|
|
193
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
194
|
-
*
|
|
195
|
-
* This source code is licensed under the MIT license found in the
|
|
196
|
-
* LICENSE file in the root directory of this source tree.
|
|
197
|
-
*/
|
|
198
|
-
|
|
199
|
-
var hasRequiredReactIs_development;
|
|
200
|
-
|
|
201
|
-
function requireReactIs_development () {
|
|
202
|
-
if (hasRequiredReactIs_development) return reactIs_development;
|
|
203
|
-
hasRequiredReactIs_development = 1;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
if (process.env.NODE_ENV !== "production") {
|
|
208
|
-
(function() {
|
|
209
|
-
|
|
210
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
211
|
-
// nor polyfill, then a plain number is used for performance.
|
|
212
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
213
|
-
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
214
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
215
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
216
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
217
|
-
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
218
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
219
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
220
|
-
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
221
|
-
|
|
222
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
223
|
-
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
224
|
-
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
225
|
-
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
226
|
-
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
227
|
-
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
228
|
-
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
229
|
-
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
230
|
-
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
231
|
-
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
232
|
-
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
233
|
-
|
|
234
|
-
function isValidElementType(type) {
|
|
235
|
-
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
236
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
237
|
-
}
|
|
238
17
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
switch (type) {
|
|
248
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
249
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
250
|
-
case REACT_FRAGMENT_TYPE:
|
|
251
|
-
case REACT_PROFILER_TYPE:
|
|
252
|
-
case REACT_STRICT_MODE_TYPE:
|
|
253
|
-
case REACT_SUSPENSE_TYPE:
|
|
254
|
-
return type;
|
|
255
|
-
|
|
256
|
-
default:
|
|
257
|
-
var $$typeofType = type && type.$$typeof;
|
|
258
|
-
|
|
259
|
-
switch ($$typeofType) {
|
|
260
|
-
case REACT_CONTEXT_TYPE:
|
|
261
|
-
case REACT_FORWARD_REF_TYPE:
|
|
262
|
-
case REACT_LAZY_TYPE:
|
|
263
|
-
case REACT_MEMO_TYPE:
|
|
264
|
-
case REACT_PROVIDER_TYPE:
|
|
265
|
-
return $$typeofType;
|
|
266
|
-
|
|
267
|
-
default:
|
|
268
|
-
return $$typeof;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
case REACT_PORTAL_TYPE:
|
|
274
|
-
return $$typeof;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return undefined;
|
|
279
|
-
} // AsyncMode is deprecated along with isAsyncMode
|
|
280
|
-
|
|
281
|
-
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
282
|
-
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
283
|
-
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
284
|
-
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
285
|
-
var Element = REACT_ELEMENT_TYPE;
|
|
286
|
-
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
287
|
-
var Fragment = REACT_FRAGMENT_TYPE;
|
|
288
|
-
var Lazy = REACT_LAZY_TYPE;
|
|
289
|
-
var Memo = REACT_MEMO_TYPE;
|
|
290
|
-
var Portal = REACT_PORTAL_TYPE;
|
|
291
|
-
var Profiler = REACT_PROFILER_TYPE;
|
|
292
|
-
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
293
|
-
var Suspense = REACT_SUSPENSE_TYPE;
|
|
294
|
-
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
295
|
-
|
|
296
|
-
function isAsyncMode(object) {
|
|
297
|
-
{
|
|
298
|
-
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
299
|
-
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
300
|
-
|
|
301
|
-
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
306
|
-
}
|
|
307
|
-
function isConcurrentMode(object) {
|
|
308
|
-
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
309
|
-
}
|
|
310
|
-
function isContextConsumer(object) {
|
|
311
|
-
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
312
|
-
}
|
|
313
|
-
function isContextProvider(object) {
|
|
314
|
-
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
315
|
-
}
|
|
316
|
-
function isElement(object) {
|
|
317
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
318
|
-
}
|
|
319
|
-
function isForwardRef(object) {
|
|
320
|
-
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
321
|
-
}
|
|
322
|
-
function isFragment(object) {
|
|
323
|
-
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
324
|
-
}
|
|
325
|
-
function isLazy(object) {
|
|
326
|
-
return typeOf(object) === REACT_LAZY_TYPE;
|
|
327
|
-
}
|
|
328
|
-
function isMemo(object) {
|
|
329
|
-
return typeOf(object) === REACT_MEMO_TYPE;
|
|
330
|
-
}
|
|
331
|
-
function isPortal(object) {
|
|
332
|
-
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
333
|
-
}
|
|
334
|
-
function isProfiler(object) {
|
|
335
|
-
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
336
|
-
}
|
|
337
|
-
function isStrictMode(object) {
|
|
338
|
-
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
339
|
-
}
|
|
340
|
-
function isSuspense(object) {
|
|
341
|
-
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
reactIs_development.AsyncMode = AsyncMode;
|
|
345
|
-
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
346
|
-
reactIs_development.ContextConsumer = ContextConsumer;
|
|
347
|
-
reactIs_development.ContextProvider = ContextProvider;
|
|
348
|
-
reactIs_development.Element = Element;
|
|
349
|
-
reactIs_development.ForwardRef = ForwardRef;
|
|
350
|
-
reactIs_development.Fragment = Fragment;
|
|
351
|
-
reactIs_development.Lazy = Lazy;
|
|
352
|
-
reactIs_development.Memo = Memo;
|
|
353
|
-
reactIs_development.Portal = Portal;
|
|
354
|
-
reactIs_development.Profiler = Profiler;
|
|
355
|
-
reactIs_development.StrictMode = StrictMode;
|
|
356
|
-
reactIs_development.Suspense = Suspense;
|
|
357
|
-
reactIs_development.isAsyncMode = isAsyncMode;
|
|
358
|
-
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
359
|
-
reactIs_development.isContextConsumer = isContextConsumer;
|
|
360
|
-
reactIs_development.isContextProvider = isContextProvider;
|
|
361
|
-
reactIs_development.isElement = isElement;
|
|
362
|
-
reactIs_development.isForwardRef = isForwardRef;
|
|
363
|
-
reactIs_development.isFragment = isFragment;
|
|
364
|
-
reactIs_development.isLazy = isLazy;
|
|
365
|
-
reactIs_development.isMemo = isMemo;
|
|
366
|
-
reactIs_development.isPortal = isPortal;
|
|
367
|
-
reactIs_development.isProfiler = isProfiler;
|
|
368
|
-
reactIs_development.isStrictMode = isStrictMode;
|
|
369
|
-
reactIs_development.isSuspense = isSuspense;
|
|
370
|
-
reactIs_development.isValidElementType = isValidElementType;
|
|
371
|
-
reactIs_development.typeOf = typeOf;
|
|
372
|
-
})();
|
|
373
|
-
}
|
|
374
|
-
return reactIs_development;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
var hasRequiredReactIs;
|
|
378
|
-
|
|
379
|
-
function requireReactIs () {
|
|
380
|
-
if (hasRequiredReactIs) return reactIs.exports;
|
|
381
|
-
hasRequiredReactIs = 1;
|
|
382
|
-
(function (module) {
|
|
383
|
-
|
|
384
|
-
if (process.env.NODE_ENV === 'production') {
|
|
385
|
-
module.exports = requireReactIs_production_min();
|
|
386
|
-
} else {
|
|
387
|
-
module.exports = requireReactIs_development();
|
|
388
|
-
}
|
|
389
|
-
} (reactIs));
|
|
390
|
-
return reactIs.exports;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/*
|
|
394
|
-
object-assign
|
|
395
|
-
(c) Sindre Sorhus
|
|
396
|
-
@license MIT
|
|
397
|
-
*/
|
|
398
|
-
|
|
399
|
-
var objectAssign;
|
|
400
|
-
var hasRequiredObjectAssign;
|
|
401
|
-
|
|
402
|
-
function requireObjectAssign () {
|
|
403
|
-
if (hasRequiredObjectAssign) return objectAssign;
|
|
404
|
-
hasRequiredObjectAssign = 1;
|
|
405
|
-
/* eslint-disable no-unused-vars */
|
|
406
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
407
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
408
|
-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
409
|
-
|
|
410
|
-
function toObject(val) {
|
|
411
|
-
if (val === null || val === undefined) {
|
|
412
|
-
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
return Object(val);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
function shouldUseNative() {
|
|
419
|
-
try {
|
|
420
|
-
if (!Object.assign) {
|
|
421
|
-
return false;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// Detect buggy property enumeration order in older V8 versions.
|
|
425
|
-
|
|
426
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
427
|
-
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
428
|
-
test1[5] = 'de';
|
|
429
|
-
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
430
|
-
return false;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
434
|
-
var test2 = {};
|
|
435
|
-
for (var i = 0; i < 10; i++) {
|
|
436
|
-
test2['_' + String.fromCharCode(i)] = i;
|
|
437
|
-
}
|
|
438
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
439
|
-
return test2[n];
|
|
440
|
-
});
|
|
441
|
-
if (order2.join('') !== '0123456789') {
|
|
442
|
-
return false;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
446
|
-
var test3 = {};
|
|
447
|
-
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
448
|
-
test3[letter] = letter;
|
|
449
|
-
});
|
|
450
|
-
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
451
|
-
'abcdefghijklmnopqrst') {
|
|
452
|
-
return false;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
return true;
|
|
456
|
-
} catch (err) {
|
|
457
|
-
// We don't expect any of the above to throw, but better to be safe.
|
|
458
|
-
return false;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
463
|
-
var from;
|
|
464
|
-
var to = toObject(target);
|
|
465
|
-
var symbols;
|
|
466
|
-
|
|
467
|
-
for (var s = 1; s < arguments.length; s++) {
|
|
468
|
-
from = Object(arguments[s]);
|
|
469
|
-
|
|
470
|
-
for (var key in from) {
|
|
471
|
-
if (hasOwnProperty.call(from, key)) {
|
|
472
|
-
to[key] = from[key];
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
if (getOwnPropertySymbols) {
|
|
477
|
-
symbols = getOwnPropertySymbols(from);
|
|
478
|
-
for (var i = 0; i < symbols.length; i++) {
|
|
479
|
-
if (propIsEnumerable.call(from, symbols[i])) {
|
|
480
|
-
to[symbols[i]] = from[symbols[i]];
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}
|
|
18
|
+
Object.defineProperty(dest, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return source[key];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
485
25
|
|
|
486
|
-
|
|
487
|
-
};
|
|
488
|
-
return objectAssign;
|
|
26
|
+
return dest;
|
|
489
27
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
493
|
-
*
|
|
494
|
-
* This source code is licensed under the MIT license found in the
|
|
495
|
-
* LICENSE file in the root directory of this source tree.
|
|
496
|
-
*/
|
|
497
|
-
|
|
498
|
-
var ReactPropTypesSecret_1;
|
|
499
|
-
var hasRequiredReactPropTypesSecret;
|
|
500
|
-
|
|
501
|
-
function requireReactPropTypesSecret () {
|
|
502
|
-
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
503
|
-
hasRequiredReactPropTypesSecret = 1;
|
|
504
|
-
|
|
505
|
-
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
506
|
-
|
|
507
|
-
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
508
|
-
return ReactPropTypesSecret_1;
|
|
28
|
+
function $parcel$export(e, n, v, s) {
|
|
29
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
509
30
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
var hasRequiredHas;
|
|
513
|
-
|
|
514
|
-
function requireHas () {
|
|
515
|
-
if (hasRequiredHas) return has;
|
|
516
|
-
hasRequiredHas = 1;
|
|
517
|
-
has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
518
|
-
return has;
|
|
31
|
+
function $parcel$interopDefault(a) {
|
|
32
|
+
return a && a.__esModule ? a.default : a;
|
|
519
33
|
}
|
|
34
|
+
var $a68bd8a6c0fd98c2$exports = {};
|
|
35
|
+
|
|
36
|
+
$parcel$export($a68bd8a6c0fd98c2$exports, "ContextMenu", function () { return $5150b66b01c99189$export$8dc6765e8be191c7; });
|
|
37
|
+
$parcel$export($a68bd8a6c0fd98c2$exports, "ContextMenuProvider", function () { return $bad272ba85e71af5$export$434a17f82a8154e4; });
|
|
38
|
+
$parcel$export($a68bd8a6c0fd98c2$exports, "TreeNode", function () { return $a56aac35d4408806$export$2eba8ec3a333fdbb; });
|
|
39
|
+
$parcel$export($a68bd8a6c0fd98c2$exports, "TreeOfNodes", function () { return $9becaaec3a803ae7$export$5580fff3e08a8be5; });
|
|
40
|
+
$parcel$export($a68bd8a6c0fd98c2$exports, "WordEntry", function () { return $176d21a51def1fce$export$14f190ac910bde69; });
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
var $5150b66b01c99189$export$8dc6765e8be191c7 = /*#__PURE__*/ (0, ($parcel$interopDefault($gTuX4$react))).forwardRef(function(param, ref) {
|
|
45
|
+
var entries = param.entries, visible = param.visible, xPos = param.xPos, yPos = param.yPos;
|
|
46
|
+
$5150b66b01c99189$export$8dc6765e8be191c7.displayName = "ContextMenu";
|
|
47
|
+
var _e_label;
|
|
48
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
49
|
+
ref: ref,
|
|
50
|
+
className: "context-menu ".concat(visible ? "visible" : ""),
|
|
51
|
+
style: {
|
|
52
|
+
top: "".concat(yPos, "px"),
|
|
53
|
+
left: "".concat(xPos, "px")
|
|
54
|
+
},
|
|
55
|
+
children: entries.map(function(e, i) {
|
|
56
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
57
|
+
className: "context-menu-item",
|
|
58
|
+
onClick: function() {
|
|
59
|
+
e.action && e.action();
|
|
60
|
+
},
|
|
61
|
+
children: (_e_label = e.label) !== null && _e_label !== void 0 ? _e_label : ""
|
|
62
|
+
}, i);
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
});
|
|
520
66
|
|
|
521
|
-
/**
|
|
522
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
523
|
-
*
|
|
524
|
-
* This source code is licensed under the MIT license found in the
|
|
525
|
-
* LICENSE file in the root directory of this source tree.
|
|
526
|
-
*/
|
|
527
|
-
|
|
528
|
-
var checkPropTypes_1;
|
|
529
|
-
var hasRequiredCheckPropTypes;
|
|
530
|
-
|
|
531
|
-
function requireCheckPropTypes () {
|
|
532
|
-
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
|
|
533
|
-
hasRequiredCheckPropTypes = 1;
|
|
534
|
-
|
|
535
|
-
var printWarning = function() {};
|
|
536
|
-
|
|
537
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
538
|
-
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
539
|
-
var loggedTypeFailures = {};
|
|
540
|
-
var has = requireHas();
|
|
541
|
-
|
|
542
|
-
printWarning = function(text) {
|
|
543
|
-
var message = 'Warning: ' + text;
|
|
544
|
-
if (typeof console !== 'undefined') {
|
|
545
|
-
console.error(message);
|
|
546
|
-
}
|
|
547
|
-
try {
|
|
548
|
-
// --- Welcome to debugging React ---
|
|
549
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
550
|
-
// to find the callsite that caused this warning to fire.
|
|
551
|
-
throw new Error(message);
|
|
552
|
-
} catch (x) { /**/ }
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
/**
|
|
557
|
-
* Assert that the values match with the type specs.
|
|
558
|
-
* Error messages are memorized and will only be shown once.
|
|
559
|
-
*
|
|
560
|
-
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
561
|
-
* @param {object} values Runtime values that need to be type-checked
|
|
562
|
-
* @param {string} location e.g. "prop", "context", "child context"
|
|
563
|
-
* @param {string} componentName Name of the component for error messages.
|
|
564
|
-
* @param {?Function} getStack Returns the component stack.
|
|
565
|
-
* @private
|
|
566
|
-
*/
|
|
567
|
-
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
568
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
569
|
-
for (var typeSpecName in typeSpecs) {
|
|
570
|
-
if (has(typeSpecs, typeSpecName)) {
|
|
571
|
-
var error;
|
|
572
|
-
// Prop type validation may throw. In case they do, we don't want to
|
|
573
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
574
|
-
// After these have been cleaned up, we'll let them throw.
|
|
575
|
-
try {
|
|
576
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
577
|
-
// behavior as without this statement except with a better message.
|
|
578
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
579
|
-
var err = Error(
|
|
580
|
-
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
581
|
-
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
582
|
-
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
583
|
-
);
|
|
584
|
-
err.name = 'Invariant Violation';
|
|
585
|
-
throw err;
|
|
586
|
-
}
|
|
587
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
588
|
-
} catch (ex) {
|
|
589
|
-
error = ex;
|
|
590
|
-
}
|
|
591
|
-
if (error && !(error instanceof Error)) {
|
|
592
|
-
printWarning(
|
|
593
|
-
(componentName || 'React class') + ': type specification of ' +
|
|
594
|
-
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
595
|
-
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
596
|
-
'You may have forgotten to pass an argument to the type checker ' +
|
|
597
|
-
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
598
|
-
'shape all require an argument).'
|
|
599
|
-
);
|
|
600
|
-
}
|
|
601
|
-
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
602
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
603
|
-
// same error.
|
|
604
|
-
loggedTypeFailures[error.message] = true;
|
|
605
|
-
|
|
606
|
-
var stack = getStack ? getStack() : '';
|
|
607
|
-
|
|
608
|
-
printWarning(
|
|
609
|
-
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
610
|
-
);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
/**
|
|
618
|
-
* Resets warning cache when testing.
|
|
619
|
-
*
|
|
620
|
-
* @private
|
|
621
|
-
*/
|
|
622
|
-
checkPropTypes.resetWarningCache = function() {
|
|
623
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
624
|
-
loggedTypeFailures = {};
|
|
625
|
-
}
|
|
626
|
-
};
|
|
627
|
-
|
|
628
|
-
checkPropTypes_1 = checkPropTypes;
|
|
629
|
-
return checkPropTypes_1;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
634
|
-
*
|
|
635
|
-
* This source code is licensed under the MIT license found in the
|
|
636
|
-
* LICENSE file in the root directory of this source tree.
|
|
637
|
-
*/
|
|
638
|
-
|
|
639
|
-
var factoryWithTypeCheckers;
|
|
640
|
-
var hasRequiredFactoryWithTypeCheckers;
|
|
641
|
-
|
|
642
|
-
function requireFactoryWithTypeCheckers () {
|
|
643
|
-
if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
|
|
644
|
-
hasRequiredFactoryWithTypeCheckers = 1;
|
|
645
|
-
|
|
646
|
-
var ReactIs = requireReactIs();
|
|
647
|
-
var assign = requireObjectAssign();
|
|
648
|
-
|
|
649
|
-
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
650
|
-
var has = requireHas();
|
|
651
|
-
var checkPropTypes = requireCheckPropTypes();
|
|
652
|
-
|
|
653
|
-
var printWarning = function() {};
|
|
654
|
-
|
|
655
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
656
|
-
printWarning = function(text) {
|
|
657
|
-
var message = 'Warning: ' + text;
|
|
658
|
-
if (typeof console !== 'undefined') {
|
|
659
|
-
console.error(message);
|
|
660
|
-
}
|
|
661
|
-
try {
|
|
662
|
-
// --- Welcome to debugging React ---
|
|
663
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
664
|
-
// to find the callsite that caused this warning to fire.
|
|
665
|
-
throw new Error(message);
|
|
666
|
-
} catch (x) {}
|
|
667
|
-
};
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
function emptyFunctionThatReturnsNull() {
|
|
671
|
-
return null;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
675
|
-
/* global Symbol */
|
|
676
|
-
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
677
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
678
|
-
|
|
679
|
-
/**
|
|
680
|
-
* Returns the iterator method function contained on the iterable object.
|
|
681
|
-
*
|
|
682
|
-
* Be sure to invoke the function with the iterable as context:
|
|
683
|
-
*
|
|
684
|
-
* var iteratorFn = getIteratorFn(myIterable);
|
|
685
|
-
* if (iteratorFn) {
|
|
686
|
-
* var iterator = iteratorFn.call(myIterable);
|
|
687
|
-
* ...
|
|
688
|
-
* }
|
|
689
|
-
*
|
|
690
|
-
* @param {?object} maybeIterable
|
|
691
|
-
* @return {?function}
|
|
692
|
-
*/
|
|
693
|
-
function getIteratorFn(maybeIterable) {
|
|
694
|
-
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
695
|
-
if (typeof iteratorFn === 'function') {
|
|
696
|
-
return iteratorFn;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
* Collection of methods that allow declaration and validation of props that are
|
|
702
|
-
* supplied to React components. Example usage:
|
|
703
|
-
*
|
|
704
|
-
* var Props = require('ReactPropTypes');
|
|
705
|
-
* var MyArticle = React.createClass({
|
|
706
|
-
* propTypes: {
|
|
707
|
-
* // An optional string prop named "description".
|
|
708
|
-
* description: Props.string,
|
|
709
|
-
*
|
|
710
|
-
* // A required enum prop named "category".
|
|
711
|
-
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
712
|
-
*
|
|
713
|
-
* // A prop named "dialog" that requires an instance of Dialog.
|
|
714
|
-
* dialog: Props.instanceOf(Dialog).isRequired
|
|
715
|
-
* },
|
|
716
|
-
* render: function() { ... }
|
|
717
|
-
* });
|
|
718
|
-
*
|
|
719
|
-
* A more formal specification of how these methods are used:
|
|
720
|
-
*
|
|
721
|
-
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
722
|
-
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
723
|
-
*
|
|
724
|
-
* Each and every declaration produces a function with the same signature. This
|
|
725
|
-
* allows the creation of custom validation functions. For example:
|
|
726
|
-
*
|
|
727
|
-
* var MyLink = React.createClass({
|
|
728
|
-
* propTypes: {
|
|
729
|
-
* // An optional string or URI prop named "href".
|
|
730
|
-
* href: function(props, propName, componentName) {
|
|
731
|
-
* var propValue = props[propName];
|
|
732
|
-
* if (propValue != null && typeof propValue !== 'string' &&
|
|
733
|
-
* !(propValue instanceof URI)) {
|
|
734
|
-
* return new Error(
|
|
735
|
-
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
736
|
-
* componentName
|
|
737
|
-
* );
|
|
738
|
-
* }
|
|
739
|
-
* }
|
|
740
|
-
* },
|
|
741
|
-
* render: function() {...}
|
|
742
|
-
* });
|
|
743
|
-
*
|
|
744
|
-
* @internal
|
|
745
|
-
*/
|
|
746
|
-
|
|
747
|
-
var ANONYMOUS = '<<anonymous>>';
|
|
748
|
-
|
|
749
|
-
// Important!
|
|
750
|
-
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
751
|
-
var ReactPropTypes = {
|
|
752
|
-
array: createPrimitiveTypeChecker('array'),
|
|
753
|
-
bigint: createPrimitiveTypeChecker('bigint'),
|
|
754
|
-
bool: createPrimitiveTypeChecker('boolean'),
|
|
755
|
-
func: createPrimitiveTypeChecker('function'),
|
|
756
|
-
number: createPrimitiveTypeChecker('number'),
|
|
757
|
-
object: createPrimitiveTypeChecker('object'),
|
|
758
|
-
string: createPrimitiveTypeChecker('string'),
|
|
759
|
-
symbol: createPrimitiveTypeChecker('symbol'),
|
|
760
|
-
|
|
761
|
-
any: createAnyTypeChecker(),
|
|
762
|
-
arrayOf: createArrayOfTypeChecker,
|
|
763
|
-
element: createElementTypeChecker(),
|
|
764
|
-
elementType: createElementTypeTypeChecker(),
|
|
765
|
-
instanceOf: createInstanceTypeChecker,
|
|
766
|
-
node: createNodeChecker(),
|
|
767
|
-
objectOf: createObjectOfTypeChecker,
|
|
768
|
-
oneOf: createEnumTypeChecker,
|
|
769
|
-
oneOfType: createUnionTypeChecker,
|
|
770
|
-
shape: createShapeTypeChecker,
|
|
771
|
-
exact: createStrictShapeTypeChecker,
|
|
772
|
-
};
|
|
773
|
-
|
|
774
|
-
/**
|
|
775
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
776
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
777
|
-
*/
|
|
778
|
-
/*eslint-disable no-self-compare*/
|
|
779
|
-
function is(x, y) {
|
|
780
|
-
// SameValue algorithm
|
|
781
|
-
if (x === y) {
|
|
782
|
-
// Steps 1-5, 7-10
|
|
783
|
-
// Steps 6.b-6.e: +0 != -0
|
|
784
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
785
|
-
} else {
|
|
786
|
-
// Step 6.a: NaN == NaN
|
|
787
|
-
return x !== x && y !== y;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
/*eslint-enable no-self-compare*/
|
|
791
|
-
|
|
792
|
-
/**
|
|
793
|
-
* We use an Error-like object for backward compatibility as people may call
|
|
794
|
-
* PropTypes directly and inspect their output. However, we don't use real
|
|
795
|
-
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
796
|
-
* is prohibitively expensive if they are created too often, such as what
|
|
797
|
-
* happens in oneOfType() for any type before the one that matched.
|
|
798
|
-
*/
|
|
799
|
-
function PropTypeError(message, data) {
|
|
800
|
-
this.message = message;
|
|
801
|
-
this.data = data && typeof data === 'object' ? data: {};
|
|
802
|
-
this.stack = '';
|
|
803
|
-
}
|
|
804
|
-
// Make `instanceof Error` still work for returned errors.
|
|
805
|
-
PropTypeError.prototype = Error.prototype;
|
|
806
|
-
|
|
807
|
-
function createChainableTypeChecker(validate) {
|
|
808
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
809
|
-
var manualPropTypeCallCache = {};
|
|
810
|
-
var manualPropTypeWarningCount = 0;
|
|
811
|
-
}
|
|
812
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
813
|
-
componentName = componentName || ANONYMOUS;
|
|
814
|
-
propFullName = propFullName || propName;
|
|
815
|
-
|
|
816
|
-
if (secret !== ReactPropTypesSecret) {
|
|
817
|
-
if (throwOnDirectAccess) {
|
|
818
|
-
// New behavior only for users of `prop-types` package
|
|
819
|
-
var err = new Error(
|
|
820
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
821
|
-
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
822
|
-
'Read more at http://fb.me/use-check-prop-types'
|
|
823
|
-
);
|
|
824
|
-
err.name = 'Invariant Violation';
|
|
825
|
-
throw err;
|
|
826
|
-
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
827
|
-
// Old behavior for people using React.PropTypes
|
|
828
|
-
var cacheKey = componentName + ':' + propName;
|
|
829
|
-
if (
|
|
830
|
-
!manualPropTypeCallCache[cacheKey] &&
|
|
831
|
-
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
832
|
-
manualPropTypeWarningCount < 3
|
|
833
|
-
) {
|
|
834
|
-
printWarning(
|
|
835
|
-
'You are manually calling a React.PropTypes validation ' +
|
|
836
|
-
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
837
|
-
'and will throw in the standalone `prop-types` package. ' +
|
|
838
|
-
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
839
|
-
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
840
|
-
);
|
|
841
|
-
manualPropTypeCallCache[cacheKey] = true;
|
|
842
|
-
manualPropTypeWarningCount++;
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
if (props[propName] == null) {
|
|
847
|
-
if (isRequired) {
|
|
848
|
-
if (props[propName] === null) {
|
|
849
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
850
|
-
}
|
|
851
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
852
|
-
}
|
|
853
|
-
return null;
|
|
854
|
-
} else {
|
|
855
|
-
return validate(props, propName, componentName, location, propFullName);
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
var chainedCheckType = checkType.bind(null, false);
|
|
860
|
-
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
861
|
-
|
|
862
|
-
return chainedCheckType;
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
function createPrimitiveTypeChecker(expectedType) {
|
|
866
|
-
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
867
|
-
var propValue = props[propName];
|
|
868
|
-
var propType = getPropType(propValue);
|
|
869
|
-
if (propType !== expectedType) {
|
|
870
|
-
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
871
|
-
// check, but we can offer a more precise error message here rather than
|
|
872
|
-
// 'of type `object`'.
|
|
873
|
-
var preciseType = getPreciseType(propValue);
|
|
874
|
-
|
|
875
|
-
return new PropTypeError(
|
|
876
|
-
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
877
|
-
{expectedType: expectedType}
|
|
878
|
-
);
|
|
879
|
-
}
|
|
880
|
-
return null;
|
|
881
|
-
}
|
|
882
|
-
return createChainableTypeChecker(validate);
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
function createAnyTypeChecker() {
|
|
886
|
-
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
function createArrayOfTypeChecker(typeChecker) {
|
|
890
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
891
|
-
if (typeof typeChecker !== 'function') {
|
|
892
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
893
|
-
}
|
|
894
|
-
var propValue = props[propName];
|
|
895
|
-
if (!Array.isArray(propValue)) {
|
|
896
|
-
var propType = getPropType(propValue);
|
|
897
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
898
|
-
}
|
|
899
|
-
for (var i = 0; i < propValue.length; i++) {
|
|
900
|
-
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
|
901
|
-
if (error instanceof Error) {
|
|
902
|
-
return error;
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
return null;
|
|
906
|
-
}
|
|
907
|
-
return createChainableTypeChecker(validate);
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
function createElementTypeChecker() {
|
|
911
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
912
|
-
var propValue = props[propName];
|
|
913
|
-
if (!isValidElement(propValue)) {
|
|
914
|
-
var propType = getPropType(propValue);
|
|
915
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
916
|
-
}
|
|
917
|
-
return null;
|
|
918
|
-
}
|
|
919
|
-
return createChainableTypeChecker(validate);
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
function createElementTypeTypeChecker() {
|
|
923
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
924
|
-
var propValue = props[propName];
|
|
925
|
-
if (!ReactIs.isValidElementType(propValue)) {
|
|
926
|
-
var propType = getPropType(propValue);
|
|
927
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
928
|
-
}
|
|
929
|
-
return null;
|
|
930
|
-
}
|
|
931
|
-
return createChainableTypeChecker(validate);
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
function createInstanceTypeChecker(expectedClass) {
|
|
935
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
936
|
-
if (!(props[propName] instanceof expectedClass)) {
|
|
937
|
-
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
938
|
-
var actualClassName = getClassName(props[propName]);
|
|
939
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
940
|
-
}
|
|
941
|
-
return null;
|
|
942
|
-
}
|
|
943
|
-
return createChainableTypeChecker(validate);
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
function createEnumTypeChecker(expectedValues) {
|
|
947
|
-
if (!Array.isArray(expectedValues)) {
|
|
948
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
949
|
-
if (arguments.length > 1) {
|
|
950
|
-
printWarning(
|
|
951
|
-
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
952
|
-
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
953
|
-
);
|
|
954
|
-
} else {
|
|
955
|
-
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
return emptyFunctionThatReturnsNull;
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
962
|
-
var propValue = props[propName];
|
|
963
|
-
for (var i = 0; i < expectedValues.length; i++) {
|
|
964
|
-
if (is(propValue, expectedValues[i])) {
|
|
965
|
-
return null;
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
970
|
-
var type = getPreciseType(value);
|
|
971
|
-
if (type === 'symbol') {
|
|
972
|
-
return String(value);
|
|
973
|
-
}
|
|
974
|
-
return value;
|
|
975
|
-
});
|
|
976
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
977
|
-
}
|
|
978
|
-
return createChainableTypeChecker(validate);
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
function createObjectOfTypeChecker(typeChecker) {
|
|
982
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
983
|
-
if (typeof typeChecker !== 'function') {
|
|
984
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
985
|
-
}
|
|
986
|
-
var propValue = props[propName];
|
|
987
|
-
var propType = getPropType(propValue);
|
|
988
|
-
if (propType !== 'object') {
|
|
989
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
990
|
-
}
|
|
991
|
-
for (var key in propValue) {
|
|
992
|
-
if (has(propValue, key)) {
|
|
993
|
-
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
994
|
-
if (error instanceof Error) {
|
|
995
|
-
return error;
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
return null;
|
|
1000
|
-
}
|
|
1001
|
-
return createChainableTypeChecker(validate);
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
1005
|
-
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
1006
|
-
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
1007
|
-
return emptyFunctionThatReturnsNull;
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1011
|
-
var checker = arrayOfTypeCheckers[i];
|
|
1012
|
-
if (typeof checker !== 'function') {
|
|
1013
|
-
printWarning(
|
|
1014
|
-
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
1015
|
-
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
1016
|
-
);
|
|
1017
|
-
return emptyFunctionThatReturnsNull;
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1022
|
-
var expectedTypes = [];
|
|
1023
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1024
|
-
var checker = arrayOfTypeCheckers[i];
|
|
1025
|
-
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
1026
|
-
if (checkerResult == null) {
|
|
1027
|
-
return null;
|
|
1028
|
-
}
|
|
1029
|
-
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
1030
|
-
expectedTypes.push(checkerResult.data.expectedType);
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
1034
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
1035
|
-
}
|
|
1036
|
-
return createChainableTypeChecker(validate);
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
function createNodeChecker() {
|
|
1040
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1041
|
-
if (!isNode(props[propName])) {
|
|
1042
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
1043
|
-
}
|
|
1044
|
-
return null;
|
|
1045
|
-
}
|
|
1046
|
-
return createChainableTypeChecker(validate);
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
1050
|
-
return new PropTypeError(
|
|
1051
|
-
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
1052
|
-
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
1053
|
-
);
|
|
1054
|
-
}
|
|
1055
67
|
|
|
1056
|
-
function createShapeTypeChecker(shapeTypes) {
|
|
1057
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1058
|
-
var propValue = props[propName];
|
|
1059
|
-
var propType = getPropType(propValue);
|
|
1060
|
-
if (propType !== 'object') {
|
|
1061
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1062
|
-
}
|
|
1063
|
-
for (var key in shapeTypes) {
|
|
1064
|
-
var checker = shapeTypes[key];
|
|
1065
|
-
if (typeof checker !== 'function') {
|
|
1066
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1067
|
-
}
|
|
1068
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1069
|
-
if (error) {
|
|
1070
|
-
return error;
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
return null;
|
|
1074
|
-
}
|
|
1075
|
-
return createChainableTypeChecker(validate);
|
|
1076
|
-
}
|
|
1077
68
|
|
|
1078
|
-
function createStrictShapeTypeChecker(shapeTypes) {
|
|
1079
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1080
|
-
var propValue = props[propName];
|
|
1081
|
-
var propType = getPropType(propValue);
|
|
1082
|
-
if (propType !== 'object') {
|
|
1083
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1084
|
-
}
|
|
1085
|
-
// We need to check all keys in case some are required but missing from props.
|
|
1086
|
-
var allKeys = assign({}, props[propName], shapeTypes);
|
|
1087
|
-
for (var key in allKeys) {
|
|
1088
|
-
var checker = shapeTypes[key];
|
|
1089
|
-
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
1090
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1091
|
-
}
|
|
1092
|
-
if (!checker) {
|
|
1093
|
-
return new PropTypeError(
|
|
1094
|
-
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
1095
|
-
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
1096
|
-
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
1097
|
-
);
|
|
1098
|
-
}
|
|
1099
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1100
|
-
if (error) {
|
|
1101
|
-
return error;
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
return null;
|
|
1105
|
-
}
|
|
1106
69
|
|
|
1107
|
-
return createChainableTypeChecker(validate);
|
|
1108
|
-
}
|
|
1109
70
|
|
|
1110
|
-
function isNode(propValue) {
|
|
1111
|
-
switch (typeof propValue) {
|
|
1112
|
-
case 'number':
|
|
1113
|
-
case 'string':
|
|
1114
|
-
case 'undefined':
|
|
1115
|
-
return true;
|
|
1116
|
-
case 'boolean':
|
|
1117
|
-
return !propValue;
|
|
1118
|
-
case 'object':
|
|
1119
|
-
if (Array.isArray(propValue)) {
|
|
1120
|
-
return propValue.every(isNode);
|
|
1121
|
-
}
|
|
1122
|
-
if (propValue === null || isValidElement(propValue)) {
|
|
1123
|
-
return true;
|
|
1124
|
-
}
|
|
1125
71
|
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
72
|
+
var $bad272ba85e71af5$export$c7e742effb1c51e2 = /*#__PURE__*/ (0, ($parcel$interopDefault($gTuX4$react))).createContext({});
|
|
73
|
+
var $bad272ba85e71af5$export$434a17f82a8154e4 = function(param) {
|
|
74
|
+
var children = param.children;
|
|
75
|
+
// Menu resources
|
|
76
|
+
var divRef = (0, $gTuX4$react.useRef)(null);
|
|
77
|
+
var menuRef = (0, $gTuX4$react.useRef)(null);
|
|
78
|
+
var _useState = (0, ($parcel$interopDefault($gTuX4$swchelperslib_sliced_to_arrayjs)))((0, $gTuX4$react.useState)(0), 2), menuXPos = _useState[0], setMenuXPos = _useState[1];
|
|
79
|
+
var _useState1 = (0, ($parcel$interopDefault($gTuX4$swchelperslib_sliced_to_arrayjs)))((0, $gTuX4$react.useState)(0), 2), menuYPos = _useState1[0], setMenuYPos = _useState1[1];
|
|
80
|
+
var _useState2 = (0, ($parcel$interopDefault($gTuX4$swchelperslib_sliced_to_arrayjs)))((0, $gTuX4$react.useState)(false), 2), menuVisible = _useState2[0], setMenuVisible = _useState2[1];
|
|
81
|
+
var _useState3 = (0, ($parcel$interopDefault($gTuX4$swchelperslib_sliced_to_arrayjs)))((0, $gTuX4$react.useState)([]), 2), menuItems = _useState3[0], setMenuItems = _useState3[1];
|
|
82
|
+
// Update menu items
|
|
83
|
+
var updateMenu = (0, $gTuX4$react.useCallback)(function(ret) {
|
|
84
|
+
if (divRef.current) {
|
|
85
|
+
if (ret.visible !== undefined) setMenuVisible(ret.visible);
|
|
86
|
+
if (ret.x) setMenuXPos(ret.x - window.scrollX - divRef.current.getBoundingClientRect().x);
|
|
87
|
+
if (ret.y) setMenuYPos(ret.y - window.scrollX - divRef.current.getBoundingClientRect().y);
|
|
88
|
+
if (ret.menuItems !== undefined) setMenuItems(ret.menuItems);
|
|
89
|
+
}
|
|
90
|
+
}, []);
|
|
91
|
+
// Handle click off the menu
|
|
92
|
+
var handleClick = (0, $gTuX4$react.useCallback)(function(e) {
|
|
93
|
+
var _menuRef_current;
|
|
94
|
+
if (menuRef.current && (e.target instanceof Element && !((_menuRef_current = menuRef.current) === null || _menuRef_current === void 0 ? void 0 : _menuRef_current.contains(e.target)) || !(e.target instanceof Element))) setMenuVisible(false);
|
|
95
|
+
}, []);
|
|
96
|
+
// Update the document click handler
|
|
97
|
+
(0, $gTuX4$react.useEffect)(function() {
|
|
98
|
+
if (menuVisible) document.addEventListener("mousedown", handleClick);
|
|
99
|
+
else document.removeEventListener("mousedown", handleClick);
|
|
100
|
+
return function() {
|
|
101
|
+
document.removeEventListener("mousedown", handleClick);
|
|
102
|
+
};
|
|
103
|
+
}, [
|
|
104
|
+
handleClick,
|
|
105
|
+
menuVisible
|
|
106
|
+
]);
|
|
107
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)($bad272ba85e71af5$export$c7e742effb1c51e2.Provider, {
|
|
108
|
+
value: {
|
|
109
|
+
visible: menuVisible,
|
|
110
|
+
x: menuXPos,
|
|
111
|
+
y: menuYPos,
|
|
112
|
+
set: updateMenu
|
|
113
|
+
},
|
|
114
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("div", {
|
|
115
|
+
className: "menu-context-provider",
|
|
116
|
+
style: {
|
|
117
|
+
position: "relative"
|
|
118
|
+
},
|
|
119
|
+
ref: divRef,
|
|
120
|
+
children: [
|
|
121
|
+
children,
|
|
122
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $5150b66b01c99189$export$8dc6765e8be191c7), {
|
|
123
|
+
ref: menuRef,
|
|
124
|
+
entries: menuItems,
|
|
125
|
+
visible: menuVisible,
|
|
126
|
+
xPos: menuXPos,
|
|
127
|
+
yPos: menuYPos
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
};
|
|
1150
133
|
|
|
1151
|
-
return true;
|
|
1152
|
-
default:
|
|
1153
|
-
return false;
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
134
|
|
|
1157
|
-
function isSymbol(propType, propValue) {
|
|
1158
|
-
// Native Symbol.
|
|
1159
|
-
if (propType === 'symbol') {
|
|
1160
|
-
return true;
|
|
1161
|
-
}
|
|
1162
135
|
|
|
1163
|
-
// falsy value can't be a Symbol
|
|
1164
|
-
if (!propValue) {
|
|
1165
|
-
return false;
|
|
1166
|
-
}
|
|
1167
136
|
|
|
1168
|
-
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1169
|
-
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1170
|
-
return true;
|
|
1171
|
-
}
|
|
1172
137
|
|
|
1173
|
-
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
1174
|
-
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
1175
|
-
return true;
|
|
1176
|
-
}
|
|
1177
138
|
|
|
1178
|
-
return false;
|
|
1179
|
-
}
|
|
1180
139
|
|
|
1181
|
-
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1182
|
-
function getPropType(propValue) {
|
|
1183
|
-
var propType = typeof propValue;
|
|
1184
|
-
if (Array.isArray(propValue)) {
|
|
1185
|
-
return 'array';
|
|
1186
|
-
}
|
|
1187
|
-
if (propValue instanceof RegExp) {
|
|
1188
|
-
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1189
|
-
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1190
|
-
// passes PropTypes.object.
|
|
1191
|
-
return 'object';
|
|
1192
|
-
}
|
|
1193
|
-
if (isSymbol(propType, propValue)) {
|
|
1194
|
-
return 'symbol';
|
|
1195
|
-
}
|
|
1196
|
-
return propType;
|
|
1197
|
-
}
|
|
1198
140
|
|
|
1199
|
-
// This handles more types than `getPropType`. Only used for error messages.
|
|
1200
|
-
// See `createPrimitiveTypeChecker`.
|
|
1201
|
-
function getPreciseType(propValue) {
|
|
1202
|
-
if (typeof propValue === 'undefined' || propValue === null) {
|
|
1203
|
-
return '' + propValue;
|
|
1204
|
-
}
|
|
1205
|
-
var propType = getPropType(propValue);
|
|
1206
|
-
if (propType === 'object') {
|
|
1207
|
-
if (propValue instanceof Date) {
|
|
1208
|
-
return 'date';
|
|
1209
|
-
} else if (propValue instanceof RegExp) {
|
|
1210
|
-
return 'regexp';
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
return propType;
|
|
1214
|
-
}
|
|
1215
141
|
|
|
1216
|
-
// Returns a string that is postfixed to a warning about an invalid type.
|
|
1217
|
-
// For example, "undefined" or "of type array"
|
|
1218
|
-
function getPostfixForTypeWarning(value) {
|
|
1219
|
-
var type = getPreciseType(value);
|
|
1220
|
-
switch (type) {
|
|
1221
|
-
case 'array':
|
|
1222
|
-
case 'object':
|
|
1223
|
-
return 'an ' + type;
|
|
1224
|
-
case 'boolean':
|
|
1225
|
-
case 'date':
|
|
1226
|
-
case 'regexp':
|
|
1227
|
-
return 'a ' + type;
|
|
1228
|
-
default:
|
|
1229
|
-
return type;
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
142
|
|
|
1233
|
-
// Returns class name of the object, if any.
|
|
1234
|
-
function getClassName(propValue) {
|
|
1235
|
-
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1236
|
-
return ANONYMOUS;
|
|
1237
|
-
}
|
|
1238
|
-
return propValue.constructor.name;
|
|
1239
|
-
}
|
|
1240
143
|
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
144
|
+
var $ff9cca1fe8f6b24e$export$29ec378200e05207 = (0, $gTuX4$react.createContext)({
|
|
145
|
+
id: "tree-of-nodes",
|
|
146
|
+
nodeList: []
|
|
147
|
+
});
|
|
1244
148
|
|
|
1245
|
-
return ReactPropTypes;
|
|
1246
|
-
};
|
|
1247
|
-
return factoryWithTypeCheckers;
|
|
1248
|
-
}
|
|
1249
149
|
|
|
1250
|
-
/**
|
|
1251
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1252
|
-
*
|
|
1253
|
-
* This source code is licensed under the MIT license found in the
|
|
1254
|
-
* LICENSE file in the root directory of this source tree.
|
|
1255
|
-
*/
|
|
1256
150
|
|
|
1257
|
-
var factoryWithThrowingShims;
|
|
1258
|
-
var hasRequiredFactoryWithThrowingShims;
|
|
1259
151
|
|
|
1260
|
-
function requireFactoryWithThrowingShims () {
|
|
1261
|
-
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
1262
|
-
hasRequiredFactoryWithThrowingShims = 1;
|
|
1263
152
|
|
|
1264
|
-
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
1265
153
|
|
|
1266
|
-
function emptyFunction() {}
|
|
1267
|
-
function emptyFunctionWithReset() {}
|
|
1268
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1269
154
|
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
155
|
+
var $176d21a51def1fce$export$14f190ac910bde69 = /*#__PURE__*/ (0, ($parcel$interopDefault($gTuX4$react))).forwardRef(function(param, ref) {
|
|
156
|
+
var id = param.id, value = param.value, editing = param.editing, saving = param.saving, setValue = param.setValue, sendEscape = param.sendEscape, style = param.style;
|
|
157
|
+
$176d21a51def1fce$export$14f190ac910bde69.displayName = "WordEntry";
|
|
158
|
+
var currentStyle = (0, $gTuX4$react.useMemo)(function() {
|
|
159
|
+
return (0, ($parcel$interopDefault($gTuX4$swchelperslib_object_spreadjs)))({
|
|
160
|
+
display: "inline-block",
|
|
161
|
+
padding: "1px",
|
|
162
|
+
paddingLeft: "3px",
|
|
163
|
+
paddingRight: "3px",
|
|
164
|
+
border: "1px",
|
|
165
|
+
borderRadius: "3px"
|
|
166
|
+
}, style);
|
|
167
|
+
}, [
|
|
168
|
+
style
|
|
169
|
+
]);
|
|
170
|
+
var _useState = (0, ($parcel$interopDefault($gTuX4$swchelperslib_sliced_to_arrayjs)))((0, $gTuX4$react.useState)(value !== null && value !== void 0 ? value : ""), 2), currentValue = _useState[0], setCurrentValue = _useState[1];
|
|
171
|
+
(0, $gTuX4$react.useEffect)(function() {
|
|
172
|
+
setCurrentValue(value !== null && value !== void 0 ? value : "");
|
|
173
|
+
}, [
|
|
174
|
+
value
|
|
175
|
+
]);
|
|
176
|
+
var returnData = (0, $gTuX4$react.useCallback)(function() {
|
|
177
|
+
setValue && setValue(currentValue);
|
|
178
|
+
}, [
|
|
179
|
+
currentValue,
|
|
180
|
+
setValue
|
|
181
|
+
]);
|
|
182
|
+
var keyPress = (0, $gTuX4$react.useCallback)(function(e) {
|
|
183
|
+
if (e.code === "Escape") {
|
|
184
|
+
setCurrentValue(value !== null && value !== void 0 ? value : "");
|
|
185
|
+
sendEscape && sendEscape();
|
|
186
|
+
} else if (e.code === "Enter") returnData();
|
|
187
|
+
}, [
|
|
188
|
+
returnData,
|
|
189
|
+
sendEscape,
|
|
190
|
+
value
|
|
191
|
+
]);
|
|
192
|
+
// Simple if not editing
|
|
193
|
+
if (!editing) return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("span", {
|
|
194
|
+
style: currentStyle,
|
|
195
|
+
id: String(id),
|
|
196
|
+
children: value
|
|
197
|
+
});
|
|
198
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("div", {
|
|
199
|
+
style: currentStyle,
|
|
200
|
+
id: "".concat(id, "-holder"),
|
|
201
|
+
children: [
|
|
202
|
+
saving && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrap.Spinner), {
|
|
203
|
+
id: "".concat(id, "-spinner"),
|
|
204
|
+
size: "sm",
|
|
205
|
+
animation: "border"
|
|
206
|
+
}),
|
|
207
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("input", {
|
|
208
|
+
id: String(id),
|
|
209
|
+
ref: ref,
|
|
210
|
+
type: "text",
|
|
211
|
+
style: {
|
|
212
|
+
lineHeight: "0.75rem",
|
|
213
|
+
border: "1px dotted black",
|
|
214
|
+
width: "auto",
|
|
215
|
+
minWidth: "0"
|
|
216
|
+
},
|
|
217
|
+
value: currentValue,
|
|
218
|
+
disabled: saving,
|
|
219
|
+
onChange: function(e) {
|
|
220
|
+
return setCurrentValue(e.currentTarget.value);
|
|
221
|
+
},
|
|
222
|
+
onBlur: returnData,
|
|
223
|
+
onKeyDownCapture: keyPress
|
|
224
|
+
})
|
|
225
|
+
]
|
|
226
|
+
});
|
|
227
|
+
});
|
|
1297
228
|
|
|
1298
|
-
any: shim,
|
|
1299
|
-
arrayOf: getShim,
|
|
1300
|
-
element: shim,
|
|
1301
|
-
elementType: shim,
|
|
1302
|
-
instanceOf: getShim,
|
|
1303
|
-
node: shim,
|
|
1304
|
-
objectOf: getShim,
|
|
1305
|
-
oneOf: getShim,
|
|
1306
|
-
oneOfType: getShim,
|
|
1307
|
-
shape: getShim,
|
|
1308
|
-
exact: getShim,
|
|
1309
229
|
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
230
|
+
var $a56aac35d4408806$export$2eba8ec3a333fdbb = function(param) {
|
|
231
|
+
var id = param.id, canRemove = param.canRemove, canRename = param.canRename, canAddChildren = param.canAddChildren, canRemoveChildren = param.canRemoveChildren, canRenameChildren = param.canRenameChildren;
|
|
232
|
+
// Contexts
|
|
233
|
+
var treeContext = (0, $gTuX4$react.useContext)((0, $ff9cca1fe8f6b24e$export$29ec378200e05207));
|
|
234
|
+
var menuContext = (0, $gTuX4$react.useContext)((0, $bad272ba85e71af5$export$c7e742effb1c51e2));
|
|
235
|
+
// Node information
|
|
236
|
+
var thisNode = (0, $gTuX4$react.useMemo)(function() {
|
|
237
|
+
return treeContext.nodeList.find(function(n) {
|
|
238
|
+
return n.id === id;
|
|
239
|
+
});
|
|
240
|
+
}, [
|
|
241
|
+
id,
|
|
242
|
+
treeContext.nodeList
|
|
243
|
+
]);
|
|
244
|
+
var childNodes = (0, $gTuX4$react.useMemo)(function() {
|
|
245
|
+
return treeContext.nodeList.filter(function(n) {
|
|
246
|
+
return n.parentId === id;
|
|
247
|
+
});
|
|
248
|
+
}, [
|
|
249
|
+
id,
|
|
250
|
+
treeContext.nodeList
|
|
251
|
+
]);
|
|
252
|
+
// State
|
|
253
|
+
var loading = (0, $gTuX4$react.useMemo)(function() {
|
|
254
|
+
return treeContext.nodeList.findIndex(function(n) {
|
|
255
|
+
return n.id === id;
|
|
256
|
+
}) === -1;
|
|
257
|
+
}, [
|
|
258
|
+
id,
|
|
259
|
+
treeContext.nodeList
|
|
260
|
+
]);
|
|
261
|
+
var _useState = (0, ($parcel$interopDefault($gTuX4$swchelperslib_sliced_to_arrayjs)))((0, $gTuX4$react.useState)(false), 2), error = _useState[0], setError = _useState[1];
|
|
262
|
+
var _useState1 = (0, ($parcel$interopDefault($gTuX4$swchelperslib_sliced_to_arrayjs)))((0, $gTuX4$react.useState)(null), 2), errorText = _useState1[0], setErrotText = _useState1[1];
|
|
263
|
+
var expanded = (0, $gTuX4$react.useMemo)(function() {
|
|
264
|
+
var _treeContext_expandedNodes;
|
|
265
|
+
var _treeContext_expandedNodes_findIndex;
|
|
266
|
+
return ((_treeContext_expandedNodes_findIndex = (_treeContext_expandedNodes = treeContext.expandedNodes) === null || _treeContext_expandedNodes === void 0 ? void 0 : _treeContext_expandedNodes.findIndex(function(e) {
|
|
267
|
+
return e === id;
|
|
268
|
+
})) !== null && _treeContext_expandedNodes_findIndex !== void 0 ? _treeContext_expandedNodes_findIndex : -1) > -1;
|
|
269
|
+
}, [
|
|
270
|
+
id,
|
|
271
|
+
treeContext.expandedNodes
|
|
272
|
+
]);
|
|
273
|
+
// // Apply selected borer
|
|
274
|
+
var currentBorder = (0, $gTuX4$react.useMemo)(function() {
|
|
275
|
+
return id === treeContext.selectedId ? "1px solid black" : "";
|
|
276
|
+
}, [
|
|
277
|
+
id,
|
|
278
|
+
treeContext.selectedId
|
|
279
|
+
]);
|
|
280
|
+
// New node parameters
|
|
281
|
+
var newNameRef = (0, $gTuX4$react.useRef)(null);
|
|
282
|
+
var _useState2 = (0, ($parcel$interopDefault($gTuX4$swchelperslib_sliced_to_arrayjs)))((0, $gTuX4$react.useState)(false), 2), showNewNode = _useState2[0], setShowNewNode = _useState2[1];
|
|
283
|
+
var _useState3 = (0, ($parcel$interopDefault($gTuX4$swchelperslib_sliced_to_arrayjs)))((0, $gTuX4$react.useState)(false), 2), savingNewNode = _useState3[0], setSavingNewNode = _useState3[1];
|
|
284
|
+
// Rename parameters
|
|
285
|
+
var currentNameRef = (0, $gTuX4$react.useRef)(null);
|
|
286
|
+
var _useState4 = (0, ($parcel$interopDefault($gTuX4$swchelperslib_sliced_to_arrayjs)))((0, $gTuX4$react.useState)(false), 2), renaming = _useState4[0], setRenaming = _useState4[1];
|
|
287
|
+
var _useState5 = (0, ($parcel$interopDefault($gTuX4$swchelperslib_sliced_to_arrayjs)))((0, $gTuX4$react.useState)(false), 2), updatingNode = _useState5[0], setUpdatingNode = _useState5[1];
|
|
288
|
+
// Context functions
|
|
289
|
+
var handleReturn = (0, $gTuX4$react.useCallback)(function(ret) {
|
|
290
|
+
if (!ret.success) {
|
|
291
|
+
setError(true);
|
|
292
|
+
var _ret_ErrorText;
|
|
293
|
+
setErrotText((_ret_ErrorText = ret.ErrorText) !== null && _ret_ErrorText !== void 0 ? _ret_ErrorText : "An unknown error has occured");
|
|
294
|
+
} else {
|
|
295
|
+
setError(false);
|
|
296
|
+
setErrotText(null);
|
|
297
|
+
}
|
|
298
|
+
}, []);
|
|
299
|
+
var confirmNewNode = (0, $gTuX4$react.useCallback)(function() {
|
|
300
|
+
var _ref = (0, ($parcel$interopDefault($gTuX4$swchelperslib_async_to_generatorjs)))(function(label) {
|
|
301
|
+
return (0, ($parcel$interopDefault($gTuX4$swchelperslib_ts_generatorjs)))(this, function(_state) {
|
|
302
|
+
switch(_state.label){
|
|
303
|
+
case 0:
|
|
304
|
+
setSavingNewNode(true);
|
|
305
|
+
if (!treeContext.onAddChild) return [
|
|
306
|
+
3,
|
|
307
|
+
2
|
|
308
|
+
];
|
|
309
|
+
return [
|
|
310
|
+
4,
|
|
311
|
+
treeContext.onAddChild(id, label)
|
|
312
|
+
];
|
|
313
|
+
case 1:
|
|
314
|
+
handleReturn.apply(void 0, [
|
|
315
|
+
_state.sent()
|
|
316
|
+
]);
|
|
317
|
+
_state.label = 2;
|
|
318
|
+
case 2:
|
|
319
|
+
setSavingNewNode(false);
|
|
320
|
+
setShowNewNode(false);
|
|
321
|
+
return [
|
|
322
|
+
2
|
|
323
|
+
];
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
return function(label) {
|
|
328
|
+
return _ref.apply(this, arguments);
|
|
329
|
+
};
|
|
330
|
+
}(), [
|
|
331
|
+
handleReturn,
|
|
332
|
+
id,
|
|
333
|
+
treeContext
|
|
334
|
+
]);
|
|
335
|
+
var renameNode = (0, $gTuX4$react.useCallback)(function() {
|
|
336
|
+
var _ref = (0, ($parcel$interopDefault($gTuX4$swchelperslib_async_to_generatorjs)))(function(newLabel) {
|
|
337
|
+
return (0, ($parcel$interopDefault($gTuX4$swchelperslib_ts_generatorjs)))(this, function(_state) {
|
|
338
|
+
switch(_state.label){
|
|
339
|
+
case 0:
|
|
340
|
+
setRenaming(false);
|
|
341
|
+
setUpdatingNode(true);
|
|
342
|
+
if (!treeContext.onRename) return [
|
|
343
|
+
3,
|
|
344
|
+
2
|
|
345
|
+
];
|
|
346
|
+
return [
|
|
347
|
+
4,
|
|
348
|
+
treeContext.onRename(id, newLabel)
|
|
349
|
+
];
|
|
350
|
+
case 1:
|
|
351
|
+
handleReturn.apply(void 0, [
|
|
352
|
+
_state.sent()
|
|
353
|
+
]);
|
|
354
|
+
_state.label = 2;
|
|
355
|
+
case 2:
|
|
356
|
+
setUpdatingNode(false);
|
|
357
|
+
return [
|
|
358
|
+
2
|
|
359
|
+
];
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
return function(newLabel) {
|
|
364
|
+
return _ref.apply(this, arguments);
|
|
365
|
+
};
|
|
366
|
+
}(), [
|
|
367
|
+
handleReturn,
|
|
368
|
+
id,
|
|
369
|
+
treeContext
|
|
370
|
+
]);
|
|
371
|
+
var deleteThis = (0, $gTuX4$react.useCallback)(/*#__PURE__*/ (0, ($parcel$interopDefault($gTuX4$swchelperslib_async_to_generatorjs)))(function() {
|
|
372
|
+
return (0, ($parcel$interopDefault($gTuX4$swchelperslib_ts_generatorjs)))(this, function(_state) {
|
|
373
|
+
switch(_state.label){
|
|
374
|
+
case 0:
|
|
375
|
+
setUpdatingNode(true);
|
|
376
|
+
if (!treeContext.onRemove) return [
|
|
377
|
+
3,
|
|
378
|
+
2
|
|
379
|
+
];
|
|
380
|
+
return [
|
|
381
|
+
4,
|
|
382
|
+
treeContext.onRemove(id)
|
|
383
|
+
];
|
|
384
|
+
case 1:
|
|
385
|
+
handleReturn.apply(void 0, [
|
|
386
|
+
_state.sent()
|
|
387
|
+
]);
|
|
388
|
+
_state.label = 2;
|
|
389
|
+
case 2:
|
|
390
|
+
setUpdatingNode(false);
|
|
391
|
+
return [
|
|
392
|
+
2
|
|
393
|
+
];
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
}), [
|
|
397
|
+
handleReturn,
|
|
398
|
+
id,
|
|
399
|
+
treeContext
|
|
400
|
+
]);
|
|
401
|
+
// Context actions
|
|
402
|
+
var addChild = (0, $gTuX4$react.useCallback)(function() {
|
|
403
|
+
if (menuContext.set) {
|
|
404
|
+
menuContext.set({
|
|
405
|
+
visible: false
|
|
406
|
+
});
|
|
407
|
+
setShowNewNode(true);
|
|
408
|
+
treeContext.handleExpandClick && treeContext.handleExpandClick(id, true);
|
|
409
|
+
}
|
|
410
|
+
}, [
|
|
411
|
+
id,
|
|
412
|
+
menuContext,
|
|
413
|
+
treeContext
|
|
414
|
+
]);
|
|
415
|
+
(0, $gTuX4$react.useEffect)(function() {
|
|
416
|
+
if (showNewNode === true && newNameRef.current) newNameRef.current.focus();
|
|
417
|
+
}, [
|
|
418
|
+
showNewNode
|
|
419
|
+
]);
|
|
420
|
+
var renameThis = (0, $gTuX4$react.useCallback)(function() {
|
|
421
|
+
if (menuContext.set) {
|
|
422
|
+
menuContext.set({
|
|
423
|
+
visible: false
|
|
424
|
+
});
|
|
425
|
+
setRenaming(true);
|
|
426
|
+
}
|
|
427
|
+
}, [
|
|
428
|
+
menuContext
|
|
429
|
+
]);
|
|
430
|
+
(0, $gTuX4$react.useEffect)(function() {
|
|
431
|
+
if (renaming === true && currentNameRef.current) currentNameRef.current.focus();
|
|
432
|
+
}, [
|
|
433
|
+
renaming
|
|
434
|
+
]);
|
|
435
|
+
var removeThis = (0, $gTuX4$react.useCallback)(function() {
|
|
436
|
+
if (menuContext.set) {
|
|
437
|
+
menuContext.set({
|
|
438
|
+
visible: false
|
|
439
|
+
});
|
|
440
|
+
deleteThis();
|
|
441
|
+
}
|
|
442
|
+
}, [
|
|
443
|
+
menuContext,
|
|
444
|
+
deleteThis
|
|
445
|
+
]);
|
|
446
|
+
// Context menu
|
|
447
|
+
var showMenu = (0, $gTuX4$react.useCallback)(function(e) {
|
|
448
|
+
e.preventDefault();
|
|
449
|
+
e.stopPropagation();
|
|
450
|
+
var menuItems = [];
|
|
451
|
+
if (canAddChildren) menuItems.push({
|
|
452
|
+
label: "Add",
|
|
453
|
+
action: addChild
|
|
454
|
+
});
|
|
455
|
+
if (canRename) menuItems.push({
|
|
456
|
+
label: "Rename",
|
|
457
|
+
action: renameThis
|
|
458
|
+
});
|
|
459
|
+
if (canRemove && (childNodes === undefined || childNodes.length === 0)) menuItems.push({
|
|
460
|
+
label: "Delete",
|
|
461
|
+
action: removeThis
|
|
462
|
+
});
|
|
463
|
+
if (typeof menuContext.set === "function") menuContext.set({
|
|
464
|
+
visible: true,
|
|
465
|
+
y: e.pageY,
|
|
466
|
+
x: e.pageX,
|
|
467
|
+
menuItems: menuItems
|
|
468
|
+
});
|
|
469
|
+
}, [
|
|
470
|
+
addChild,
|
|
471
|
+
canAddChildren,
|
|
472
|
+
canRemove,
|
|
473
|
+
canRename,
|
|
474
|
+
childNodes,
|
|
475
|
+
menuContext,
|
|
476
|
+
removeThis,
|
|
477
|
+
renameThis
|
|
478
|
+
]);
|
|
479
|
+
// Return node
|
|
480
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("div", {
|
|
481
|
+
id: "".concat(treeContext.id, "-treenode-").concat(id),
|
|
482
|
+
className: "treenode",
|
|
483
|
+
onClickCapture: function() {
|
|
484
|
+
return treeContext.handleSelect && treeContext.handleSelect(id);
|
|
485
|
+
},
|
|
486
|
+
onContextMenuCapture: function() {
|
|
487
|
+
return treeContext.handleSelect && treeContext.handleSelect(id);
|
|
488
|
+
},
|
|
489
|
+
onFocusCapture: function() {
|
|
490
|
+
return treeContext.handleSelect && treeContext.handleSelect(id);
|
|
491
|
+
},
|
|
492
|
+
children: [
|
|
493
|
+
error ? /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)((0, $gTuX4$reactjsxruntime.Fragment), {
|
|
494
|
+
children: [
|
|
495
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrapicons.ExclamationCircleFill), {
|
|
496
|
+
color: "var(--bs-danger)"
|
|
497
|
+
}),
|
|
498
|
+
" ",
|
|
499
|
+
errorText && errorText !== "" ? errorText : "An unknown error has occured"
|
|
500
|
+
]
|
|
501
|
+
}) : loading ? /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)((0, $gTuX4$reactjsxruntime.Fragment), {
|
|
502
|
+
children: [
|
|
503
|
+
/*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrap.Spinner), {
|
|
504
|
+
size: "sm",
|
|
505
|
+
animation: "border"
|
|
506
|
+
}),
|
|
507
|
+
" ",
|
|
508
|
+
"Loading..."
|
|
509
|
+
]
|
|
510
|
+
}) : /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsxs)("span", {
|
|
511
|
+
onContextMenu: showMenu,
|
|
512
|
+
children: [
|
|
513
|
+
childNodes !== undefined && childNodes.length > 0 ? !expanded ? /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrapicons.CaretRightFill), {
|
|
514
|
+
role: "button",
|
|
515
|
+
"aria-expanded": false,
|
|
516
|
+
id: "".concat(treeContext.id, "-treenode-caret-").concat(id),
|
|
517
|
+
onClick: function() {
|
|
518
|
+
return treeContext.handleExpandClick && treeContext.handleExpandClick(id);
|
|
519
|
+
}
|
|
520
|
+
}) : /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrapicons.CaretDownFill), {
|
|
521
|
+
role: "button",
|
|
522
|
+
"aria-expanded": true,
|
|
523
|
+
id: "".concat(treeContext.id, "-treenode-caret-").concat(id),
|
|
524
|
+
onClick: function() {
|
|
525
|
+
return treeContext.handleExpandClick && treeContext.handleExpandClick(id);
|
|
526
|
+
}
|
|
527
|
+
}) : /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $gTuX4$reactbootstrapicons.CaretRight), {
|
|
528
|
+
role: "button",
|
|
529
|
+
"aria-expanded": false,
|
|
530
|
+
"aria-disabled": true
|
|
531
|
+
}),
|
|
532
|
+
thisNode && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $176d21a51def1fce$export$14f190ac910bde69), {
|
|
533
|
+
id: "".concat(treeContext.id, "-treenode-entry-").concat(id),
|
|
534
|
+
ref: currentNameRef,
|
|
535
|
+
value: thisNode.label,
|
|
536
|
+
editing: renaming,
|
|
537
|
+
saving: updatingNode,
|
|
538
|
+
setValue: function(ret) {
|
|
539
|
+
return renameNode(ret);
|
|
540
|
+
},
|
|
541
|
+
sendEscape: function() {
|
|
542
|
+
return setRenaming(false);
|
|
543
|
+
},
|
|
544
|
+
style: {
|
|
545
|
+
border: currentBorder,
|
|
546
|
+
margin: currentBorder === "" ? "1px" : "",
|
|
547
|
+
backgroundColor: currentBorder === "" ? "" : "lightgrey"
|
|
548
|
+
}
|
|
549
|
+
})
|
|
550
|
+
]
|
|
551
|
+
}),
|
|
552
|
+
childNodes !== undefined && childNodes.map(function(h, i) {
|
|
553
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("span", {
|
|
554
|
+
id: "".concat(treeContext.id, "-treenode-child-").concat(h.id),
|
|
555
|
+
style: {
|
|
556
|
+
marginLeft: "16px",
|
|
557
|
+
display: "block",
|
|
558
|
+
maxHeight: expanded ? "99999px" : "0px",
|
|
559
|
+
height: expanded ? "auto" : "0px",
|
|
560
|
+
overflowY: "hidden",
|
|
561
|
+
visibility: expanded ? "inherit" : "hidden",
|
|
562
|
+
opacity: expanded ? 1 : 0,
|
|
563
|
+
transition: "visibility .3s, opacity .3s ease-in-out, max-height 0.3s ease-in-out"
|
|
564
|
+
},
|
|
565
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)($a56aac35d4408806$export$2eba8ec3a333fdbb, {
|
|
566
|
+
id: h.id,
|
|
567
|
+
canRemove: canRemoveChildren,
|
|
568
|
+
canRename: canRenameChildren,
|
|
569
|
+
canAddChildren: canAddChildren,
|
|
570
|
+
canRemoveChildren: canRemoveChildren,
|
|
571
|
+
canRenameChildren: canRenameChildren
|
|
572
|
+
})
|
|
573
|
+
}, h.id);
|
|
574
|
+
}),
|
|
575
|
+
showNewNode && /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)("div", {
|
|
576
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $176d21a51def1fce$export$14f190ac910bde69), {
|
|
577
|
+
style: {
|
|
578
|
+
marginLeft: "14px"
|
|
579
|
+
},
|
|
580
|
+
id: "treenode-new-".concat(id),
|
|
581
|
+
ref: newNameRef,
|
|
582
|
+
editing: true,
|
|
583
|
+
setValue: function(ret) {
|
|
584
|
+
confirmNewNode(ret);
|
|
585
|
+
},
|
|
586
|
+
saving: savingNewNode,
|
|
587
|
+
sendEscape: function() {
|
|
588
|
+
setShowNewNode(false);
|
|
589
|
+
}
|
|
590
|
+
})
|
|
591
|
+
})
|
|
592
|
+
]
|
|
593
|
+
});
|
|
594
|
+
};
|
|
1313
595
|
|
|
1314
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1315
596
|
|
|
1316
|
-
return ReactPropTypes;
|
|
1317
|
-
};
|
|
1318
|
-
return factoryWithThrowingShims;
|
|
1319
|
-
}
|
|
1320
597
|
|
|
1321
|
-
/**
|
|
1322
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1323
|
-
*
|
|
1324
|
-
* This source code is licensed under the MIT license found in the
|
|
1325
|
-
* LICENSE file in the root directory of this source tree.
|
|
1326
|
-
*/
|
|
1327
598
|
|
|
1328
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1329
|
-
var ReactIs = requireReactIs();
|
|
1330
599
|
|
|
1331
|
-
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
1332
|
-
// http://fb.me/prop-types-in-prod
|
|
1333
|
-
var throwOnDirectAccess = true;
|
|
1334
|
-
propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
1335
|
-
} else {
|
|
1336
|
-
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
1337
|
-
// http://fb.me/prop-types-in-prod
|
|
1338
|
-
propTypes.exports = requireFactoryWithThrowingShims()();
|
|
1339
|
-
}
|
|
1340
600
|
|
|
1341
|
-
const Spinner = /*#__PURE__*/React__namespace.forwardRef(({
|
|
1342
|
-
bsPrefix,
|
|
1343
|
-
variant,
|
|
1344
|
-
animation = 'border',
|
|
1345
|
-
size,
|
|
1346
|
-
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
|
|
1347
|
-
as: Component = 'div',
|
|
1348
|
-
className,
|
|
1349
|
-
...props
|
|
1350
|
-
}, ref) => {
|
|
1351
|
-
bsPrefix = useBootstrapPrefix(bsPrefix, 'spinner');
|
|
1352
|
-
const bsSpinnerPrefix = `${bsPrefix}-${animation}`;
|
|
1353
|
-
return /*#__PURE__*/jsxRuntime.jsx(Component, {
|
|
1354
|
-
ref: ref,
|
|
1355
|
-
...props,
|
|
1356
|
-
className: classNames(className, bsSpinnerPrefix, size && `${bsSpinnerPrefix}-${size}`, variant && `text-${variant}`)
|
|
1357
|
-
});
|
|
1358
|
-
});
|
|
1359
|
-
Spinner.displayName = 'Spinner';
|
|
1360
|
-
var Spinner$1 = Spinner;
|
|
1361
601
|
|
|
1362
|
-
var _excluded$3 = ["color", "size", "title"];
|
|
1363
602
|
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
fill: color
|
|
1382
|
-
}, rest), title ? /*#__PURE__*/React.createElement("title", null, title) : null, /*#__PURE__*/React.createElement("path", {
|
|
1383
|
-
d: "M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"
|
|
1384
|
-
}));
|
|
1385
|
-
});
|
|
1386
|
-
CaretDownFill.propTypes = {
|
|
1387
|
-
color: propTypes.exports.string,
|
|
1388
|
-
size: propTypes.exports.oneOfType([propTypes.exports.string, propTypes.exports.number]),
|
|
1389
|
-
title: propTypes.exports.string
|
|
1390
|
-
};
|
|
1391
|
-
CaretDownFill.defaultProps = {
|
|
1392
|
-
color: 'currentColor',
|
|
1393
|
-
size: '1em',
|
|
1394
|
-
title: null
|
|
603
|
+
var $a983ffa23085f8d6$export$85488b7eb1e4976f = function(id, included, hierarchyNodes) {
|
|
604
|
+
// Get current node
|
|
605
|
+
var current = hierarchyNodes.find(function(h) {
|
|
606
|
+
return h.id === id;
|
|
607
|
+
});
|
|
608
|
+
if (current === undefined) return [];
|
|
609
|
+
// Set return as children, current node or parent's return
|
|
610
|
+
var ret = current.parentId === undefined || current.parentId === null || hierarchyNodes.findIndex(function(h) {
|
|
611
|
+
return h.id === (current === null || current === void 0 ? void 0 : current.parentId);
|
|
612
|
+
}) === -1 ? (0, ($parcel$interopDefault($gTuX4$swchelperslib_to_consumable_arrayjs)))(included).concat([
|
|
613
|
+
current
|
|
614
|
+
]) : $a983ffa23085f8d6$export$85488b7eb1e4976f(current.parentId, (0, ($parcel$interopDefault($gTuX4$swchelperslib_to_consumable_arrayjs)))(included.filter(function(c) {
|
|
615
|
+
return c.id !== current.parentId && c.id !== current.id;
|
|
616
|
+
})).concat([
|
|
617
|
+
current
|
|
618
|
+
]), hierarchyNodes);
|
|
619
|
+
return ret;
|
|
1395
620
|
};
|
|
1396
|
-
var CaretDownFill$1 = CaretDownFill;
|
|
1397
|
-
|
|
1398
|
-
var _excluded$2 = ["color", "size", "title"];
|
|
1399
621
|
|
|
1400
|
-
function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
1401
622
|
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
return /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
1412
|
-
ref: ref,
|
|
1413
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1414
|
-
viewBox: "0 0 16 16",
|
|
1415
|
-
width: size,
|
|
1416
|
-
height: size,
|
|
1417
|
-
fill: color
|
|
1418
|
-
}, rest), title ? /*#__PURE__*/React.createElement("title", null, title) : null, /*#__PURE__*/React.createElement("path", {
|
|
1419
|
-
d: "m12.14 8.753-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z"
|
|
1420
|
-
}));
|
|
1421
|
-
});
|
|
1422
|
-
CaretRightFill.propTypes = {
|
|
1423
|
-
color: propTypes.exports.string,
|
|
1424
|
-
size: propTypes.exports.oneOfType([propTypes.exports.string, propTypes.exports.number]),
|
|
1425
|
-
title: propTypes.exports.string
|
|
623
|
+
var $f31429c9cc6d3bce$export$40c47a7ac5f85aba = function(nodeList, selectedId, expandedNodes) {
|
|
624
|
+
var k = (0, ($parcel$interopDefault($gTuX4$swchelperslib_to_consumable_arrayjs)))(expandedNodes).concat((0, ($parcel$interopDefault($gTuX4$swchelperslib_to_consumable_arrayjs)))((0, $a983ffa23085f8d6$export$85488b7eb1e4976f)(selectedId, [], nodeList).map(function(n) {
|
|
625
|
+
return n.id;
|
|
626
|
+
}).filter(function(k) {
|
|
627
|
+
return !expandedNodes.includes(k);
|
|
628
|
+
}))).sort(function(a, b) {
|
|
629
|
+
return "".concat(a).localeCompare("".concat(b));
|
|
630
|
+
});
|
|
631
|
+
return k;
|
|
1426
632
|
};
|
|
1427
|
-
CaretRightFill.defaultProps = {
|
|
1428
|
-
color: 'currentColor',
|
|
1429
|
-
size: '1em',
|
|
1430
|
-
title: null
|
|
1431
|
-
};
|
|
1432
|
-
var CaretRightFill$1 = CaretRightFill;
|
|
1433
633
|
|
|
1434
|
-
var _excluded$1 = ["color", "size", "title"];
|
|
1435
634
|
|
|
1436
|
-
function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
1437
635
|
|
|
1438
|
-
function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$1(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
1439
636
|
|
|
1440
|
-
function _objectWithoutPropertiesLoose$1(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
1441
|
-
var CaretRight = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1442
|
-
var color = _ref.color,
|
|
1443
|
-
size = _ref.size,
|
|
1444
|
-
title = _ref.title,
|
|
1445
|
-
rest = _objectWithoutProperties$1(_ref, _excluded$1);
|
|
1446
637
|
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
638
|
+
var $9becaaec3a803ae7$export$5580fff3e08a8be5 = function(param) {
|
|
639
|
+
var id = param.id, nodeList = param.nodeList, roots = param.roots, _param_canRemoveRoot = param.// canAddRoot = false,
|
|
640
|
+
canRemoveRoot, canRemoveRoot = _param_canRemoveRoot === void 0 ? false : _param_canRemoveRoot, _param_canRenameRoot = param.canRenameRoot, canRenameRoot = _param_canRenameRoot === void 0 ? false : _param_canRenameRoot, _param_canAddChildren = param.canAddChildren, canAddChildren = _param_canAddChildren === void 0 ? false : _param_canAddChildren, _param_canRemoveChildren = param.canRemoveChildren, canRemoveChildren = _param_canRemoveChildren === void 0 ? false : _param_canRemoveChildren, _param_canRenameChildren = param.canRenameChildren, canRenameChildren = _param_canRenameChildren === void 0 ? false : _param_canRenameChildren, selectedId = param.selectedId, _param_handleSelect = param.handleSelect, handleSelect = _param_handleSelect === void 0 ? function() {
|
|
641
|
+
return;
|
|
642
|
+
} : _param_handleSelect, onAdd = param.onAdd, onRename = param.onRename, onRemove = param.onRemove;
|
|
643
|
+
var _useState = (0, ($parcel$interopDefault($gTuX4$swchelperslib_sliced_to_arrayjs)))((0, $gTuX4$react.useState)([]), 2), expandedNodes = _useState[0], setExpandedNodes = _useState[1];
|
|
644
|
+
(0, $gTuX4$react.useEffect)(function() {
|
|
645
|
+
selectedId !== undefined && setExpandedNodes((0, $f31429c9cc6d3bce$export$40c47a7ac5f85aba)(nodeList, selectedId, expandedNodes));
|
|
646
|
+
}, []);
|
|
647
|
+
// Change expansion and update context
|
|
648
|
+
var changeExpand = (0, $gTuX4$react.useCallback)(function(eKey, force) {
|
|
649
|
+
var newExpandedNodes = (0, ($parcel$interopDefault($gTuX4$swchelperslib_to_consumable_arrayjs)))(expandedNodes);
|
|
650
|
+
var ix = newExpandedNodes.findIndex(function(nKey) {
|
|
651
|
+
return nKey === eKey;
|
|
652
|
+
});
|
|
653
|
+
if (ix === -1 && force === undefined || force === true) newExpandedNodes.push(eKey);
|
|
654
|
+
else newExpandedNodes.splice(ix, 1);
|
|
655
|
+
setExpandedNodes(newExpandedNodes);
|
|
656
|
+
}, [
|
|
657
|
+
expandedNodes
|
|
658
|
+
]);
|
|
659
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $bad272ba85e71af5$export$434a17f82a8154e4), {
|
|
660
|
+
children: /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $ff9cca1fe8f6b24e$export$29ec378200e05207).Provider, {
|
|
661
|
+
value: {
|
|
662
|
+
id: id,
|
|
663
|
+
nodeList: nodeList,
|
|
664
|
+
selectedId: selectedId,
|
|
665
|
+
handleSelect: handleSelect,
|
|
666
|
+
expandedNodes: expandedNodes,
|
|
667
|
+
handleExpandClick: function(r, f) {
|
|
668
|
+
return changeExpand(r, f);
|
|
669
|
+
},
|
|
670
|
+
onAddChild: onAdd,
|
|
671
|
+
onRename: onRename,
|
|
672
|
+
onRemove: onRemove
|
|
673
|
+
},
|
|
674
|
+
children: roots.map(function(r) {
|
|
675
|
+
return /*#__PURE__*/ (0, $gTuX4$reactjsxruntime.jsx)((0, $a56aac35d4408806$export$2eba8ec3a333fdbb), {
|
|
676
|
+
id: r,
|
|
677
|
+
canRemove: canRemoveRoot,
|
|
678
|
+
canAddChildren: canAddChildren,
|
|
679
|
+
canRename: canRenameRoot,
|
|
680
|
+
canRemoveChildren: canRemoveChildren,
|
|
681
|
+
canRenameChildren: canRenameChildren
|
|
682
|
+
}, r);
|
|
683
|
+
})
|
|
684
|
+
})
|
|
685
|
+
});
|
|
1467
686
|
};
|
|
1468
|
-
var CaretRight$1 = CaretRight;
|
|
1469
687
|
|
|
1470
|
-
var _excluded = ["color", "size", "title"];
|
|
1471
688
|
|
|
1472
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1473
689
|
|
|
1474
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
1475
690
|
|
|
1476
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
1477
|
-
var ExclamationCircleFill = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1478
|
-
var color = _ref.color,
|
|
1479
|
-
size = _ref.size,
|
|
1480
|
-
title = _ref.title,
|
|
1481
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
1482
691
|
|
|
1483
|
-
|
|
1484
|
-
ref: ref,
|
|
1485
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1486
|
-
viewBox: "0 0 16 16",
|
|
1487
|
-
width: size,
|
|
1488
|
-
height: size,
|
|
1489
|
-
fill: color
|
|
1490
|
-
}, rest), title ? /*#__PURE__*/React.createElement("title", null, title) : null, /*#__PURE__*/React.createElement("path", {
|
|
1491
|
-
d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"
|
|
1492
|
-
}));
|
|
1493
|
-
});
|
|
1494
|
-
ExclamationCircleFill.propTypes = {
|
|
1495
|
-
color: propTypes.exports.string,
|
|
1496
|
-
size: propTypes.exports.oneOfType([propTypes.exports.string, propTypes.exports.number]),
|
|
1497
|
-
title: propTypes.exports.string
|
|
1498
|
-
};
|
|
1499
|
-
ExclamationCircleFill.defaultProps = {
|
|
1500
|
-
color: 'currentColor',
|
|
1501
|
-
size: '1em',
|
|
1502
|
-
title: null
|
|
1503
|
-
};
|
|
1504
|
-
var ExclamationCircleFill$1 = ExclamationCircleFill;
|
|
692
|
+
var $f8937e88ee74204e$exports = {};
|
|
1505
693
|
|
|
1506
|
-
|
|
1507
|
-
id: 'tree-of-nodes',
|
|
1508
|
-
nodeList: [],
|
|
1509
|
-
});
|
|
694
|
+
$parcel$export($f8937e88ee74204e$exports, "getParents", function () { return $a983ffa23085f8d6$export$85488b7eb1e4976f; });
|
|
1510
695
|
|
|
1511
|
-
const WordEntry = React.forwardRef(({ id, value, editing, saving, setValue, sendEscape, style }, ref) => {
|
|
1512
|
-
WordEntry.displayName = 'WordEntry';
|
|
1513
|
-
const currentStyle = React.useMemo(() => {
|
|
1514
|
-
return {
|
|
1515
|
-
display: 'inline-block',
|
|
1516
|
-
padding: '1px',
|
|
1517
|
-
paddingLeft: '3px',
|
|
1518
|
-
paddingRight: '3px',
|
|
1519
|
-
border: '1px',
|
|
1520
|
-
borderRadius: '3px',
|
|
1521
|
-
...style,
|
|
1522
|
-
};
|
|
1523
|
-
}, [style]);
|
|
1524
|
-
const [currentValue, setCurrentValue] = React.useState(value ?? '');
|
|
1525
|
-
React.useEffect(() => {
|
|
1526
|
-
setCurrentValue(value ?? '');
|
|
1527
|
-
}, [value]);
|
|
1528
|
-
const returnData = React.useCallback(() => {
|
|
1529
|
-
setValue && setValue(currentValue);
|
|
1530
|
-
}, [currentValue, setValue]);
|
|
1531
|
-
const keyPress = React.useCallback((e) => {
|
|
1532
|
-
if (e.code === 'Escape') {
|
|
1533
|
-
setCurrentValue(value ?? '');
|
|
1534
|
-
sendEscape && sendEscape();
|
|
1535
|
-
}
|
|
1536
|
-
else if (e.code === 'Enter') {
|
|
1537
|
-
returnData();
|
|
1538
|
-
}
|
|
1539
|
-
}, [returnData, sendEscape, value]);
|
|
1540
|
-
// Simple if not editing
|
|
1541
|
-
if (!editing) {
|
|
1542
|
-
return (jsxRuntime.jsx("span", { style: currentStyle, id: String(id), children: value }));
|
|
1543
|
-
}
|
|
1544
|
-
return (jsxRuntime.jsxs("div", { style: currentStyle, id: `${id}-holder`, children: [saving && (jsxRuntime.jsx(Spinner$1, { id: `${id}-spinner`, size: 'sm', animation: 'border' })), jsxRuntime.jsx("input", { id: String(id), ref: ref, type: 'text', style: {
|
|
1545
|
-
lineHeight: '0.75rem',
|
|
1546
|
-
border: '1px dotted black',
|
|
1547
|
-
width: 'auto',
|
|
1548
|
-
minWidth: '0',
|
|
1549
|
-
}, value: currentValue, disabled: saving, onChange: (e) => setCurrentValue(e.currentTarget.value), onBlur: returnData, onKeyDownCapture: keyPress })] }));
|
|
1550
|
-
});
|
|
1551
696
|
|
|
1552
|
-
const TreeNode = ({ id, canRemove, canRename, canAddChildren, canRemoveChildren, canRenameChildren, }) => {
|
|
1553
|
-
// Contexts
|
|
1554
|
-
const treeContext = React.useContext(TreeOfNodesContext);
|
|
1555
|
-
const menuContext = React.useContext(MenuContext);
|
|
1556
|
-
// Node information
|
|
1557
|
-
const thisNode = React.useMemo(() => treeContext.nodeList.find((n) => n.id === id), [id, treeContext.nodeList]);
|
|
1558
|
-
const childNodes = React.useMemo(() => treeContext.nodeList.filter((n) => n.parentId === id), [id, treeContext.nodeList]);
|
|
1559
|
-
// State
|
|
1560
|
-
const loading = React.useMemo(() => treeContext.nodeList.findIndex((n) => n.id === id) === -1, [id, treeContext.nodeList]);
|
|
1561
|
-
const [error, setError] = React.useState(false);
|
|
1562
|
-
const [errorText, setErrotText] = React.useState(null);
|
|
1563
|
-
const expanded = React.useMemo(() => {
|
|
1564
|
-
return (treeContext.expandedNodes?.findIndex((e) => e === id) ?? -1) > -1;
|
|
1565
|
-
}, [id, treeContext.expandedNodes]);
|
|
1566
|
-
// // Apply selected borer
|
|
1567
|
-
const currentBorder = React.useMemo(() => {
|
|
1568
|
-
return id === treeContext.selectedId ? '1px solid black' : '';
|
|
1569
|
-
}, [id, treeContext.selectedId]);
|
|
1570
|
-
// New node parameters
|
|
1571
|
-
const newNameRef = React.useRef(null);
|
|
1572
|
-
const [showNewNode, setShowNewNode] = React.useState(false);
|
|
1573
|
-
const [savingNewNode, setSavingNewNode] = React.useState(false);
|
|
1574
|
-
// Rename parameters
|
|
1575
|
-
const currentNameRef = React.useRef(null);
|
|
1576
|
-
const [renaming, setRenaming] = React.useState(false);
|
|
1577
|
-
const [updatingNode, setUpdatingNode] = React.useState(false);
|
|
1578
|
-
// Context functions
|
|
1579
|
-
const handleReturn = React.useCallback((ret) => {
|
|
1580
|
-
if (!ret.success) {
|
|
1581
|
-
setError(true);
|
|
1582
|
-
setErrotText(ret.ErrorText ?? 'An unknown error has occured');
|
|
1583
|
-
}
|
|
1584
|
-
else {
|
|
1585
|
-
setError(false);
|
|
1586
|
-
setErrotText(null);
|
|
1587
|
-
}
|
|
1588
|
-
}, []);
|
|
1589
|
-
const confirmNewNode = React.useCallback(async (label) => {
|
|
1590
|
-
setSavingNewNode(true);
|
|
1591
|
-
if (treeContext.onAddChild) {
|
|
1592
|
-
handleReturn(await treeContext.onAddChild(id, label));
|
|
1593
|
-
}
|
|
1594
|
-
setSavingNewNode(false);
|
|
1595
|
-
setShowNewNode(false);
|
|
1596
|
-
}, [handleReturn, id, treeContext]);
|
|
1597
|
-
const renameNode = React.useCallback(async (newLabel) => {
|
|
1598
|
-
setRenaming(false);
|
|
1599
|
-
setUpdatingNode(true);
|
|
1600
|
-
if (treeContext.onRename) {
|
|
1601
|
-
handleReturn(await treeContext.onRename(id, newLabel));
|
|
1602
|
-
}
|
|
1603
|
-
setUpdatingNode(false);
|
|
1604
|
-
}, [handleReturn, id, treeContext]);
|
|
1605
|
-
const deleteThis = React.useCallback(async () => {
|
|
1606
|
-
setUpdatingNode(true);
|
|
1607
|
-
if (treeContext.onRemove) {
|
|
1608
|
-
handleReturn(await treeContext.onRemove(id));
|
|
1609
|
-
}
|
|
1610
|
-
setUpdatingNode(false);
|
|
1611
|
-
}, [handleReturn, id, treeContext]);
|
|
1612
|
-
// Context actions
|
|
1613
|
-
const addChild = React.useCallback(() => {
|
|
1614
|
-
if (menuContext.set) {
|
|
1615
|
-
menuContext.set({ visible: false });
|
|
1616
|
-
setShowNewNode(true);
|
|
1617
|
-
treeContext.handleExpandClick && treeContext.handleExpandClick(id, true);
|
|
1618
|
-
}
|
|
1619
|
-
}, [id, menuContext, treeContext]);
|
|
1620
|
-
React.useEffect(() => {
|
|
1621
|
-
if (showNewNode === true && newNameRef.current)
|
|
1622
|
-
newNameRef.current.focus();
|
|
1623
|
-
}, [showNewNode]);
|
|
1624
|
-
const renameThis = React.useCallback(() => {
|
|
1625
|
-
if (menuContext.set) {
|
|
1626
|
-
menuContext.set({ visible: false });
|
|
1627
|
-
setRenaming(true);
|
|
1628
|
-
}
|
|
1629
|
-
}, [menuContext]);
|
|
1630
|
-
React.useEffect(() => {
|
|
1631
|
-
if (renaming === true && currentNameRef.current)
|
|
1632
|
-
currentNameRef.current.focus();
|
|
1633
|
-
}, [renaming]);
|
|
1634
|
-
const removeThis = React.useCallback(() => {
|
|
1635
|
-
if (menuContext.set) {
|
|
1636
|
-
menuContext.set({ visible: false });
|
|
1637
|
-
deleteThis();
|
|
1638
|
-
}
|
|
1639
|
-
}, [menuContext, deleteThis]);
|
|
1640
|
-
// Context menu
|
|
1641
|
-
const showMenu = React.useCallback((e) => {
|
|
1642
|
-
e.preventDefault();
|
|
1643
|
-
e.stopPropagation();
|
|
1644
|
-
const menuItems = [];
|
|
1645
|
-
if (canAddChildren) {
|
|
1646
|
-
menuItems.push({ label: 'Add', action: addChild });
|
|
1647
|
-
}
|
|
1648
|
-
if (canRename) {
|
|
1649
|
-
menuItems.push({ label: 'Rename', action: renameThis });
|
|
1650
|
-
}
|
|
1651
|
-
if (canRemove && (childNodes === undefined || childNodes.length === 0)) {
|
|
1652
|
-
menuItems.push({ label: 'Delete', action: removeThis });
|
|
1653
|
-
}
|
|
1654
|
-
if (typeof menuContext.set === 'function') {
|
|
1655
|
-
menuContext.set({
|
|
1656
|
-
visible: true,
|
|
1657
|
-
y: e.pageY,
|
|
1658
|
-
x: e.pageX,
|
|
1659
|
-
menuItems: menuItems,
|
|
1660
|
-
});
|
|
1661
|
-
}
|
|
1662
|
-
}, [
|
|
1663
|
-
addChild,
|
|
1664
|
-
canAddChildren,
|
|
1665
|
-
canRemove,
|
|
1666
|
-
canRename,
|
|
1667
|
-
childNodes,
|
|
1668
|
-
menuContext,
|
|
1669
|
-
removeThis,
|
|
1670
|
-
renameThis,
|
|
1671
|
-
]);
|
|
1672
|
-
// Return node
|
|
1673
|
-
return (jsxRuntime.jsxs("div", { id: `${treeContext.id}-treenode-${id}`, className: 'treenode', onClickCapture: () => treeContext.handleSelect && treeContext.handleSelect(id), onContextMenuCapture: () => treeContext.handleSelect && treeContext.handleSelect(id), onFocusCapture: () => treeContext.handleSelect && treeContext.handleSelect(id), children: [error ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ExclamationCircleFill$1, { color: 'var(--bs-danger)' }), ' ', errorText && errorText !== '' ? errorText : 'An unknown error has occured'] })) : loading ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Spinner$1, { size: 'sm', animation: 'border' }), ' ', "Loading..."] })) : (jsxRuntime.jsxs("span", { onContextMenu: showMenu, children: [childNodes !== undefined && childNodes.length > 0 ? (!expanded ? (jsxRuntime.jsx(CaretRightFill$1, { role: 'button', "aria-expanded": false, id: `${treeContext.id}-treenode-caret-${id}`, onClick: () => treeContext.handleExpandClick && treeContext.handleExpandClick(id) })) : (jsxRuntime.jsx(CaretDownFill$1, { role: 'button', "aria-expanded": true, id: `${treeContext.id}-treenode-caret-${id}`, onClick: () => treeContext.handleExpandClick && treeContext.handleExpandClick(id) }))) : (jsxRuntime.jsx(CaretRight$1, { role: 'button', "aria-expanded": false, "aria-disabled": true })), thisNode && (jsxRuntime.jsx(WordEntry, { id: `${treeContext.id}-treenode-entry-${id}`, ref: currentNameRef, value: thisNode.label, editing: renaming, saving: updatingNode, setValue: (ret) => renameNode(ret), sendEscape: () => setRenaming(false), style: {
|
|
1674
|
-
border: currentBorder,
|
|
1675
|
-
margin: currentBorder === '' ? '1px' : '',
|
|
1676
|
-
backgroundColor: currentBorder === '' ? '' : 'lightgrey',
|
|
1677
|
-
} }))] })), childNodes !== undefined &&
|
|
1678
|
-
childNodes.map((h, i) => (jsxRuntime.jsx("span", { id: `${treeContext.id}-treenode-child-${h.id}`, style: {
|
|
1679
|
-
marginLeft: '16px',
|
|
1680
|
-
display: 'block',
|
|
1681
|
-
maxHeight: expanded ? '99999px' : '0px',
|
|
1682
|
-
height: expanded ? 'auto' : '0px',
|
|
1683
|
-
overflowY: 'hidden',
|
|
1684
|
-
visibility: expanded ? 'inherit' : 'hidden',
|
|
1685
|
-
opacity: expanded ? 1 : 0,
|
|
1686
|
-
transition: 'visibility .3s, opacity .3s ease-in-out, max-height 0.3s ease-in-out',
|
|
1687
|
-
}, children: jsxRuntime.jsx(TreeNode, { id: h.id, canRemove: canRemoveChildren, canRename: canRenameChildren, canAddChildren: canAddChildren, canRemoveChildren: canRemoveChildren, canRenameChildren: canRenameChildren }) }, h.id))), showNewNode && (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(WordEntry, { style: { marginLeft: '14px' }, id: `treenode-new-${id}`, ref: newNameRef, editing: true, setValue: (ret) => {
|
|
1688
|
-
confirmNewNode(ret);
|
|
1689
|
-
}, saving: savingNewNode, sendEscape: () => {
|
|
1690
|
-
setShowNewNode(false);
|
|
1691
|
-
} }) }))] }));
|
|
1692
|
-
};
|
|
1693
697
|
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
return;
|
|
1698
|
-
}, onAdd, onRename, onRemove, }) => {
|
|
1699
|
-
const [expandedNodes, setExpandedNodes] = React.useState([]);
|
|
1700
|
-
// Change expansion and update context
|
|
1701
|
-
const changeExpand = React.useCallback((eKey, force) => {
|
|
1702
|
-
const newExpandedNodes = [...expandedNodes];
|
|
1703
|
-
const ix = newExpandedNodes.findIndex((nKey) => nKey === eKey);
|
|
1704
|
-
if ((ix === -1 && force === undefined) || force === true)
|
|
1705
|
-
newExpandedNodes.push(eKey);
|
|
1706
|
-
else
|
|
1707
|
-
newExpandedNodes.splice(ix, 1);
|
|
1708
|
-
setExpandedNodes(newExpandedNodes);
|
|
1709
|
-
}, [expandedNodes]);
|
|
1710
|
-
return (jsxRuntime.jsx(ContextMenuProvider, { children: jsxRuntime.jsx(TreeOfNodesContext.Provider, { value: {
|
|
1711
|
-
id: id,
|
|
1712
|
-
nodeList,
|
|
1713
|
-
selectedId,
|
|
1714
|
-
handleSelect,
|
|
1715
|
-
expandedNodes,
|
|
1716
|
-
handleExpandClick: (r, f) => changeExpand(r, f),
|
|
1717
|
-
onAddChild: onAdd,
|
|
1718
|
-
onRename,
|
|
1719
|
-
onRemove,
|
|
1720
|
-
}, children: roots.map((r) => (jsxRuntime.jsx(TreeNode, { id: r, canRemove: canRemoveRoot, canAddChildren: canAddChildren, canRename: canRenameRoot, canRemoveChildren: canRemoveChildren, canRenameChildren: canRenameChildren }, r))) }) }));
|
|
1721
|
-
};
|
|
698
|
+
$parcel$exportWildcard(module.exports, $a68bd8a6c0fd98c2$exports);
|
|
699
|
+
$parcel$exportWildcard(module.exports, $f8937e88ee74204e$exports);
|
|
700
|
+
|
|
1722
701
|
|
|
1723
|
-
|
|
1724
|
-
exports.ContextMenuProvider = ContextMenuProvider;
|
|
1725
|
-
exports.TreeNode = TreeNode;
|
|
1726
|
-
exports.TreeOfNodes = TreeOfNodes;
|
|
1727
|
-
exports.WordEntry = WordEntry;
|
|
702
|
+
//# sourceMappingURL=main.js.map
|