funda-ui 4.5.680 → 4.5.682

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.
Files changed (35) hide show
  1. package/DragDropList/index.css +188 -0
  2. package/DragDropList/index.d.ts +43 -0
  3. package/DragDropList/index.js +1589 -0
  4. package/MultipleSelect/index.css +237 -144
  5. package/MultipleSelect/index.d.ts +23 -10
  6. package/MultipleSelect/index.js +2242 -1225
  7. package/README.md +3 -1
  8. package/Utils/useBoundedDrag.d.ts +127 -0
  9. package/Utils/useBoundedDrag.js +382 -0
  10. package/Utils/useDragDropPosition.d.ts +169 -0
  11. package/Utils/useDragDropPosition.js +456 -0
  12. package/all.d.ts +1 -0
  13. package/all.js +1 -0
  14. package/lib/cjs/DragDropList/index.d.ts +43 -0
  15. package/lib/cjs/DragDropList/index.js +1589 -0
  16. package/lib/cjs/MultipleSelect/index.d.ts +23 -10
  17. package/lib/cjs/MultipleSelect/index.js +2242 -1225
  18. package/lib/cjs/Utils/useBoundedDrag.d.ts +127 -0
  19. package/lib/cjs/Utils/useBoundedDrag.js +382 -0
  20. package/lib/cjs/Utils/useDragDropPosition.d.ts +169 -0
  21. package/lib/cjs/Utils/useDragDropPosition.js +456 -0
  22. package/lib/cjs/index.d.ts +1 -0
  23. package/lib/cjs/index.js +1 -0
  24. package/lib/css/DragDropList/index.css +188 -0
  25. package/lib/css/MultipleSelect/index.css +237 -144
  26. package/lib/esm/DragDropList/index.scss +245 -0
  27. package/lib/esm/DragDropList/index.tsx +493 -0
  28. package/lib/esm/MultipleSelect/index.scss +288 -183
  29. package/lib/esm/MultipleSelect/index.tsx +304 -166
  30. package/lib/esm/MultipleSelect/utils/func.ts +21 -1
  31. package/lib/esm/Utils/hooks/useBoundedDrag.tsx +303 -0
  32. package/lib/esm/Utils/hooks/useDragDropPosition.tsx +420 -0
  33. package/lib/esm/index.js +1 -0
  34. package/package.json +1 -1
  35. package/lib/esm/MultipleSelect/ItemList.tsx +0 -323
@@ -11,6 +11,1816 @@
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ var __webpack_modules__ = ({
13
13
 
14
+ /***/ 954:
15
+ /***/ (function(module, exports, __webpack_require__) {
16
+
17
+ /* module decorator */ module = __webpack_require__.nmd(module);
18
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof3(obj) { "@babel/helpers - typeof"; return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof3(obj); }
19
+ (function webpackUniversalModuleDefinition(root, factory) {
20
+ if (( false ? 0 : _typeof3(exports)) === 'object' && ( false ? 0 : _typeof3(module)) === 'object') module.exports = factory(__webpack_require__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
21
+ __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
22
+ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
23
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
24
+ })(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
25
+ return (/******/function () {
26
+ // webpackBootstrap
27
+ /******/
28
+ var __webpack_modules__ = {
29
+ /***/188: /***/function _(module, exports, __nested_webpack_require_1080__) {
30
+ /* module decorator */module = __nested_webpack_require_1080__.nmd(module);
31
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
32
+ function _typeof2(obj) {
33
+ "@babel/helpers - typeof";
34
+
35
+ return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
36
+ return typeof obj;
37
+ } : function (obj) {
38
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
39
+ }, _typeof2(obj);
40
+ }
41
+ (function webpackUniversalModuleDefinition(root, factory) {
42
+ if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
43
+ })(this, function () {
44
+ return (/******/function () {
45
+ // webpackBootstrap
46
+ /******/
47
+ "use strict";
48
+
49
+ /******/ // The require scope
50
+ /******/
51
+ var __nested_webpack_require_993__ = {};
52
+ /******/
53
+ /************************************************************************/
54
+ /******/ /* webpack/runtime/define property getters */
55
+ /******/
56
+ (function () {
57
+ /******/ // define getter functions for harmony exports
58
+ /******/__nested_webpack_require_993__.d = function (exports, definition) {
59
+ /******/for (var key in definition) {
60
+ /******/if (__nested_webpack_require_993__.o(definition, key) && !__nested_webpack_require_993__.o(exports, key)) {
61
+ /******/Object.defineProperty(exports, key, {
62
+ enumerable: true,
63
+ get: definition[key]
64
+ });
65
+ /******/
66
+ }
67
+ /******/
68
+ }
69
+ /******/
70
+ };
71
+ /******/
72
+ })();
73
+ /******/
74
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
75
+ /******/
76
+ (function () {
77
+ /******/__nested_webpack_require_993__.o = function (obj, prop) {
78
+ return Object.prototype.hasOwnProperty.call(obj, prop);
79
+ };
80
+ /******/
81
+ })();
82
+ /******/
83
+ /******/ /* webpack/runtime/make namespace object */
84
+ /******/
85
+ (function () {
86
+ /******/ // define __esModule on exports
87
+ /******/__nested_webpack_require_993__.r = function (exports) {
88
+ /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
89
+ /******/Object.defineProperty(exports, Symbol.toStringTag, {
90
+ value: 'Module'
91
+ });
92
+ /******/
93
+ }
94
+ /******/
95
+ Object.defineProperty(exports, '__esModule', {
96
+ value: true
97
+ });
98
+ /******/
99
+ };
100
+ /******/
101
+ })();
102
+ /******/
103
+ /************************************************************************/
104
+ var __webpack_exports__ = {};
105
+ __nested_webpack_require_993__.r(__webpack_exports__);
106
+ /* harmony export */
107
+ __nested_webpack_require_993__.d(__webpack_exports__, {
108
+ /* harmony export */"clsWrite": function clsWrite() {
109
+ return (/* binding */_clsWrite
110
+ );
111
+ },
112
+ /* harmony export */"combinedCls": function combinedCls() {
113
+ return (/* binding */_combinedCls
114
+ );
115
+ }
116
+ /* harmony export */
117
+ });
118
+
119
+ function _slicedToArray(arr, i) {
120
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
121
+ }
122
+ function _nonIterableRest() {
123
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
124
+ }
125
+ function _unsupportedIterableToArray(o, minLen) {
126
+ if (!o) return;
127
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
128
+ var n = Object.prototype.toString.call(o).slice(8, -1);
129
+ if (n === "Object" && o.constructor) n = o.constructor.name;
130
+ if (n === "Map" || n === "Set") return Array.from(o);
131
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
132
+ }
133
+ function _arrayLikeToArray(arr, len) {
134
+ if (len == null || len > arr.length) len = arr.length;
135
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
136
+ return arr2;
137
+ }
138
+ function _iterableToArrayLimit(arr, i) {
139
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
140
+ if (null != _i) {
141
+ var _s,
142
+ _e,
143
+ _x,
144
+ _r,
145
+ _arr = [],
146
+ _n = !0,
147
+ _d = !1;
148
+ try {
149
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
150
+ if (Object(_i) !== _i) return;
151
+ _n = !1;
152
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
153
+ } catch (err) {
154
+ _d = !0, _e = err;
155
+ } finally {
156
+ try {
157
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
158
+ } finally {
159
+ if (_d) throw _e;
160
+ }
161
+ }
162
+ return _arr;
163
+ }
164
+ }
165
+ function _arrayWithHoles(arr) {
166
+ if (Array.isArray(arr)) return arr;
167
+ }
168
+ function _typeof(obj) {
169
+ "@babel/helpers - typeof";
170
+
171
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
172
+ return typeof obj;
173
+ } : function (obj) {
174
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
175
+ }, _typeof(obj);
176
+ }
177
+ /**
178
+ * Output of class name
179
+ * @param {*} s - Any
180
+ * @param {String} defaultCls - Default string
181
+ * @param {?*} targetCls - Any
182
+ * @returns {*}
183
+ */
184
+ function _clsWrite(s, defaultCls) {
185
+ var targetCls = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
186
+ return s || s === '' ? typeof targetCls === 'undefined' ? s : targetCls : defaultCls;
187
+ }
188
+
189
+ /**
190
+ * Combined classnames
191
+ * @param {*} args
192
+ * @returns {String|undefined}
193
+ */
194
+ /* Usage:
195
+
196
+ console.log(combinedCls('a-1', 'a-2', 'a-3', {
197
+ 'p-1': null,
198
+ 'p-2': undefined,
199
+ 'p-3': true,
200
+ 'p-4': false,
201
+ 'p-5': 'kkk',
202
+ 'p-6': 0,
203
+ 'p-7': 1,
204
+ 'p-8': '',
205
+ undefined
206
+ })); // a-1 a-2 a-3 p-3 p-5 p-7
207
+ */
208
+ function _combinedCls() {
209
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
210
+ args[_key] = arguments[_key];
211
+ }
212
+ if (args) {
213
+ var classes = [];
214
+ for (var i = 0; i < args.length; i++) {
215
+ var className = args[i];
216
+ if (!className) {
217
+ continue;
218
+ }
219
+ var type = _typeof(className);
220
+ if (type === 'string' || type === 'number') {
221
+ classes.push(className);
222
+ } else if (type === 'object') {
223
+ var _classes = Array.isArray(className) ? className : Object.entries(className).map(function (_ref) {
224
+ var _ref2 = _slicedToArray(_ref, 2),
225
+ key = _ref2[0],
226
+ value = _ref2[1];
227
+ return value ? key : null;
228
+ });
229
+ classes = _classes.length ? classes.concat(_classes.filter(function (c) {
230
+ return !!c;
231
+ })) : classes;
232
+ }
233
+ }
234
+ return classes.join(' ').trim();
235
+ }
236
+ return undefined;
237
+ }
238
+
239
+ /******/
240
+ return __webpack_exports__;
241
+ /******/
242
+ }()
243
+ );
244
+ });
245
+
246
+ /***/
247
+ },
248
+
249
+ /***/438: /***/function _(module, exports, __nested_webpack_require_11464__) {
250
+ /* module decorator */module = __nested_webpack_require_11464__.nmd(module);
251
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
252
+ function _typeof2(obj) {
253
+ "@babel/helpers - typeof";
254
+
255
+ return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
256
+ return typeof obj;
257
+ } : function (obj) {
258
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
259
+ }, _typeof2(obj);
260
+ }
261
+ (function webpackUniversalModuleDefinition(root, factory) {
262
+ if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
263
+ })(this, function () {
264
+ return (/******/function () {
265
+ // webpackBootstrap
266
+ /******/
267
+ "use strict";
268
+
269
+ /******/ // The require scope
270
+ /******/
271
+ var __nested_webpack_require_993__ = {};
272
+ /******/
273
+ /************************************************************************/
274
+ /******/ /* webpack/runtime/define property getters */
275
+ /******/
276
+ (function () {
277
+ /******/ // define getter functions for harmony exports
278
+ /******/__nested_webpack_require_993__.d = function (exports, definition) {
279
+ /******/for (var key in definition) {
280
+ /******/if (__nested_webpack_require_993__.o(definition, key) && !__nested_webpack_require_993__.o(exports, key)) {
281
+ /******/Object.defineProperty(exports, key, {
282
+ enumerable: true,
283
+ get: definition[key]
284
+ });
285
+ /******/
286
+ }
287
+ /******/
288
+ }
289
+ /******/
290
+ };
291
+ /******/
292
+ })();
293
+ /******/
294
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
295
+ /******/
296
+ (function () {
297
+ /******/__nested_webpack_require_993__.o = function (obj, prop) {
298
+ return Object.prototype.hasOwnProperty.call(obj, prop);
299
+ };
300
+ /******/
301
+ })();
302
+ /******/
303
+ /******/ /* webpack/runtime/make namespace object */
304
+ /******/
305
+ (function () {
306
+ /******/ // define __esModule on exports
307
+ /******/__nested_webpack_require_993__.r = function (exports) {
308
+ /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
309
+ /******/Object.defineProperty(exports, Symbol.toStringTag, {
310
+ value: 'Module'
311
+ });
312
+ /******/
313
+ }
314
+ /******/
315
+ Object.defineProperty(exports, '__esModule', {
316
+ value: true
317
+ });
318
+ /******/
319
+ };
320
+ /******/
321
+ })();
322
+ /******/
323
+ /************************************************************************/
324
+ var __webpack_exports__ = {};
325
+ __nested_webpack_require_993__.r(__webpack_exports__);
326
+ /* harmony export */
327
+ __nested_webpack_require_993__.d(__webpack_exports__, {
328
+ /* harmony export */"addTreeDepth": function addTreeDepth() {
329
+ return (/* binding */_addTreeDepth
330
+ );
331
+ },
332
+ /* harmony export */"addTreeIndent": function addTreeIndent() {
333
+ return (/* binding */_addTreeIndent
334
+ );
335
+ },
336
+ /* harmony export */"convertTree": function convertTree() {
337
+ return (/* binding */_convertTree
338
+ );
339
+ },
340
+ /* harmony export */"flatTree": function flatTree() {
341
+ return (/* binding */_flatTree
342
+ );
343
+ },
344
+ /* harmony export */"getAllDepth": function getAllDepth() {
345
+ return (/* binding */_getAllDepth
346
+ );
347
+ }
348
+ /* harmony export */
349
+ });
350
+
351
+ function _typeof(obj) {
352
+ "@babel/helpers - typeof";
353
+
354
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
355
+ return typeof obj;
356
+ } : function (obj) {
357
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
358
+ }, _typeof(obj);
359
+ }
360
+ var _excluded = ["children"];
361
+ function _objectWithoutProperties(source, excluded) {
362
+ if (source == null) return {};
363
+ var target = _objectWithoutPropertiesLoose(source, excluded);
364
+ var key, i;
365
+ if (Object.getOwnPropertySymbols) {
366
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
367
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
368
+ key = sourceSymbolKeys[i];
369
+ if (excluded.indexOf(key) >= 0) continue;
370
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
371
+ target[key] = source[key];
372
+ }
373
+ }
374
+ return target;
375
+ }
376
+ function _objectWithoutPropertiesLoose(source, excluded) {
377
+ if (source == null) return {};
378
+ var target = {};
379
+ var sourceKeys = Object.keys(source);
380
+ var key, i;
381
+ for (i = 0; i < sourceKeys.length; i++) {
382
+ key = sourceKeys[i];
383
+ if (excluded.indexOf(key) >= 0) continue;
384
+ target[key] = source[key];
385
+ }
386
+ return target;
387
+ }
388
+ function ownKeys(object, enumerableOnly) {
389
+ var keys = Object.keys(object);
390
+ if (Object.getOwnPropertySymbols) {
391
+ var symbols = Object.getOwnPropertySymbols(object);
392
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
393
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
394
+ })), keys.push.apply(keys, symbols);
395
+ }
396
+ return keys;
397
+ }
398
+ function _objectSpread(target) {
399
+ for (var i = 1; i < arguments.length; i++) {
400
+ var source = null != arguments[i] ? arguments[i] : {};
401
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
402
+ _defineProperty(target, key, source[key]);
403
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
404
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
405
+ });
406
+ }
407
+ return target;
408
+ }
409
+ function _defineProperty(obj, key, value) {
410
+ key = _toPropertyKey(key);
411
+ if (key in obj) {
412
+ Object.defineProperty(obj, key, {
413
+ value: value,
414
+ enumerable: true,
415
+ configurable: true,
416
+ writable: true
417
+ });
418
+ } else {
419
+ obj[key] = value;
420
+ }
421
+ return obj;
422
+ }
423
+ function _toPropertyKey(arg) {
424
+ var key = _toPrimitive(arg, "string");
425
+ return _typeof(key) === "symbol" ? key : String(key);
426
+ }
427
+ function _toPrimitive(input, hint) {
428
+ if (_typeof(input) !== "object" || input === null) return input;
429
+ var prim = input[Symbol.toPrimitive];
430
+ if (prim !== undefined) {
431
+ var res = prim.call(input, hint || "default");
432
+ if (_typeof(res) !== "object") return res;
433
+ throw new TypeError("@@toPrimitive must return a primitive value.");
434
+ }
435
+ return (hint === "string" ? String : Number)(input);
436
+ }
437
+ function _toConsumableArray(arr) {
438
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
439
+ }
440
+ function _nonIterableSpread() {
441
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
442
+ }
443
+ function _unsupportedIterableToArray(o, minLen) {
444
+ if (!o) return;
445
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
446
+ var n = Object.prototype.toString.call(o).slice(8, -1);
447
+ if (n === "Object" && o.constructor) n = o.constructor.name;
448
+ if (n === "Map" || n === "Set") return Array.from(o);
449
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
450
+ }
451
+ function _iterableToArray(iter) {
452
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
453
+ }
454
+ function _arrayWithoutHoles(arr) {
455
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
456
+ }
457
+ function _arrayLikeToArray(arr, len) {
458
+ if (len == null || len > arr.length) len = arr.length;
459
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
460
+ return arr2;
461
+ }
462
+ function _objectDestructuringEmpty(obj) {
463
+ if (obj == null) throw new TypeError("Cannot destructure " + obj);
464
+ }
465
+ function _extends() {
466
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
467
+ for (var i = 1; i < arguments.length; i++) {
468
+ var source = arguments[i];
469
+ for (var key in source) {
470
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
471
+ target[key] = source[key];
472
+ }
473
+ }
474
+ }
475
+ return target;
476
+ };
477
+ return _extends.apply(this, arguments);
478
+ }
479
+ /**
480
+ * Convert Tree
481
+ * @param {Array} arr - Flat array
482
+ * @param {?string | ?number} parentId - Parent id
483
+ * @param {?string} keyId - Key value of id.
484
+ * @param {?string} keyParentId - Key value of parent id.
485
+ * @returns Array
486
+ */
487
+ function _convertTree(arr) {
488
+ var parentId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
489
+ var keyId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';
490
+ var keyParentId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'parent_id';
491
+ if (!parentId) {
492
+ // If there is no parent id (when recursing for the first time), all parents will be queried
493
+ return arr.filter(function (item) {
494
+ return !item[keyParentId];
495
+ }).map(function (item) {
496
+ // Query all child nodes by parent node ID
497
+ item.children = _convertTree(arr, item[keyId], keyId, keyParentId);
498
+ return item;
499
+ });
500
+ } else {
501
+ return arr.filter(function (item) {
502
+ return item[keyParentId] === parentId;
503
+ }).map(function (item) {
504
+ // Query all child nodes by parent node ID
505
+ item.children = _convertTree(arr, item[keyId], keyId, keyParentId);
506
+ return item;
507
+ });
508
+ }
509
+ }
510
+
511
+ /**
512
+ * Flat tree
513
+ * @param {Array} arr - Hierarchical array
514
+ * @returns Array
515
+ */
516
+ function _flatTree(arr) {
517
+ var flatData = function flatData(_ref) {
518
+ var rest = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
519
+ var _rest$children = rest.children,
520
+ children = _rest$children === void 0 ? [] : _rest$children;
521
+ return [_objectSpread({}, rest)].concat(_toConsumableArray(children.flatMap(flatData)));
522
+ };
523
+ var result = arr.flatMap(flatData);
524
+
525
+ //remove children from item
526
+ result = result.map(function (item) {
527
+ delete item.children;
528
+ return item;
529
+ });
530
+ return result;
531
+ }
532
+
533
+ /**
534
+ * Get all depth
535
+ * @param {Object} node
536
+ * @returns Number
537
+ */
538
+ function _getAllDepth(arr) {
539
+ var count = function count(children) {
540
+ return children.reduce(function (depth, child) {
541
+ return Math.max(depth, 1 + count(child.children)); // increment depth of children by 1, and compare it with accumulated depth of other children within the same element
542
+ }, 0); //default value 0 that's returned if there are no children
543
+ };
544
+
545
+ return count(arr);
546
+ }
547
+
548
+ /**
549
+ * Add depth to each item in the tree
550
+ * @param {Array} arr - Hierarchical array
551
+ * @param {?string} keyId - Key value of id.
552
+ * @param {?string} keyParentId - Key value of parent id.
553
+ * @param {?number} depth - Depth of the item.
554
+ * @returns Number
555
+ */
556
+ function _addTreeDepth(arr) {
557
+ var keyId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';
558
+ var parentItem = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
559
+ var depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
560
+ return arr.reduce(function (acc, el) {
561
+ var children = el.children,
562
+ otherProps = _objectWithoutProperties(el, _excluded);
563
+ acc.push(_objectSpread(_objectSpread({}, otherProps), {}, {
564
+ parentItem: parentItem,
565
+ depth: depth
566
+ }));
567
+ if (children) {
568
+ return acc.concat(_addTreeDepth(children, keyId, el[keyId], depth + 1));
569
+ }
570
+ return acc;
571
+ }, []);
572
+ }
573
+
574
+ /**
575
+ * Add indent placeholder
576
+ * @param {Array} arr - Flat array
577
+ * @param {?string} placeholder - String of placeholder
578
+ * @param {?string} lastPlaceholder - Last String of placeholder
579
+ * @param {?string} keyName - Key value of name.
580
+ * @returns Array
581
+ */
582
+ function _addTreeIndent(arr) {
583
+ var placeholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '&nbsp;&nbsp;&nbsp;&nbsp;';
584
+ var lastPlaceholder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
585
+ var keyName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'label';
586
+ arr.forEach(function (item) {
587
+ var indent = '';
588
+ if (item.depth) {
589
+ Array(item.depth).fill(0).forEach(function (k, i) {
590
+ indent += placeholder;
591
+ if (i === item.depth - 1) {
592
+ item[keyName] = indent + lastPlaceholder + item[keyName];
593
+ }
594
+ });
595
+ }
596
+ });
597
+ }
598
+
599
+ /******/
600
+ return __webpack_exports__;
601
+ /******/
602
+ }()
603
+ );
604
+ });
605
+
606
+ /***/
607
+ },
608
+
609
+ /***/759: /***/function _(module, exports, __nested_webpack_require_29526__) {
610
+ /* module decorator */module = __nested_webpack_require_29526__.nmd(module);
611
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
612
+ function _typeof(obj) {
613
+ "@babel/helpers - typeof";
614
+
615
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
616
+ return typeof obj;
617
+ } : function (obj) {
618
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
619
+ }, _typeof(obj);
620
+ }
621
+ (function webpackUniversalModuleDefinition(root, factory) {
622
+ if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_29526__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_29526__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
623
+ })(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
624
+ return (/******/function () {
625
+ // webpackBootstrap
626
+ /******/
627
+ "use strict";
628
+
629
+ /******/
630
+ var __webpack_modules__ = {
631
+ /***/787: /***/function _(module) {
632
+ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
633
+
634
+ /***/
635
+ }
636
+
637
+ /******/
638
+ };
639
+ /************************************************************************/
640
+ /******/ // The module cache
641
+ /******/
642
+ var __webpack_module_cache__ = {};
643
+ /******/
644
+ /******/ // The require function
645
+ /******/
646
+ function __nested_webpack_require_1465__(moduleId) {
647
+ /******/ // Check if module is in cache
648
+ /******/var cachedModule = __webpack_module_cache__[moduleId];
649
+ /******/
650
+ if (cachedModule !== undefined) {
651
+ /******/return cachedModule.exports;
652
+ /******/
653
+ }
654
+ /******/ // Create a new module (and put it into the cache)
655
+ /******/
656
+ var module = __webpack_module_cache__[moduleId] = {
657
+ /******/ // no module.id needed
658
+ /******/ // no module.loaded needed
659
+ /******/exports: {}
660
+ /******/
661
+ };
662
+ /******/
663
+ /******/ // Execute the module function
664
+ /******/
665
+ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_1465__);
666
+ /******/
667
+ /******/ // Return the exports of the module
668
+ /******/
669
+ return module.exports;
670
+ /******/
671
+ }
672
+ /******/
673
+ /************************************************************************/
674
+ /******/ /* webpack/runtime/compat get default export */
675
+ /******/
676
+ (function () {
677
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
678
+ /******/__nested_webpack_require_1465__.n = function (module) {
679
+ /******/var getter = module && module.__esModule ? /******/function () {
680
+ return module['default'];
681
+ } : /******/function () {
682
+ return module;
683
+ };
684
+ /******/
685
+ __nested_webpack_require_1465__.d(getter, {
686
+ a: getter
687
+ });
688
+ /******/
689
+ return getter;
690
+ /******/
691
+ };
692
+ /******/
693
+ })();
694
+ /******/
695
+ /******/ /* webpack/runtime/define property getters */
696
+ /******/
697
+ (function () {
698
+ /******/ // define getter functions for harmony exports
699
+ /******/__nested_webpack_require_1465__.d = function (exports, definition) {
700
+ /******/for (var key in definition) {
701
+ /******/if (__nested_webpack_require_1465__.o(definition, key) && !__nested_webpack_require_1465__.o(exports, key)) {
702
+ /******/Object.defineProperty(exports, key, {
703
+ enumerable: true,
704
+ get: definition[key]
705
+ });
706
+ /******/
707
+ }
708
+ /******/
709
+ }
710
+ /******/
711
+ };
712
+ /******/
713
+ })();
714
+ /******/
715
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
716
+ /******/
717
+ (function () {
718
+ /******/__nested_webpack_require_1465__.o = function (obj, prop) {
719
+ return Object.prototype.hasOwnProperty.call(obj, prop);
720
+ };
721
+ /******/
722
+ })();
723
+ /******/
724
+ /******/ /* webpack/runtime/make namespace object */
725
+ /******/
726
+ (function () {
727
+ /******/ // define __esModule on exports
728
+ /******/__nested_webpack_require_1465__.r = function (exports) {
729
+ /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
730
+ /******/Object.defineProperty(exports, Symbol.toStringTag, {
731
+ value: 'Module'
732
+ });
733
+ /******/
734
+ }
735
+ /******/
736
+ Object.defineProperty(exports, '__esModule', {
737
+ value: true
738
+ });
739
+ /******/
740
+ };
741
+ /******/
742
+ })();
743
+ /******/
744
+ /************************************************************************/
745
+ var __webpack_exports__ = {};
746
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
747
+ (function () {
748
+ __nested_webpack_require_1465__.r(__webpack_exports__);
749
+ /* harmony export */
750
+ __nested_webpack_require_1465__.d(__webpack_exports__, {
751
+ /* harmony export */"default": function _default() {
752
+ return __WEBPACK_DEFAULT_EXPORT__;
753
+ },
754
+ /* harmony export */"useBoundedDrag": function useBoundedDrag() {
755
+ return (/* binding */_useBoundedDrag
756
+ );
757
+ }
758
+ /* harmony export */
759
+ });
760
+ /* harmony import */
761
+ var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1465__(787);
762
+ /* harmony import */
763
+ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_1465__.n(react__WEBPACK_IMPORTED_MODULE_0__);
764
+ function _slicedToArray(arr, i) {
765
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
766
+ }
767
+ function _nonIterableRest() {
768
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
769
+ }
770
+ function _unsupportedIterableToArray(o, minLen) {
771
+ if (!o) return;
772
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
773
+ var n = Object.prototype.toString.call(o).slice(8, -1);
774
+ if (n === "Object" && o.constructor) n = o.constructor.name;
775
+ if (n === "Map" || n === "Set") return Array.from(o);
776
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
777
+ }
778
+ function _arrayLikeToArray(arr, len) {
779
+ if (len == null || len > arr.length) len = arr.length;
780
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
781
+ return arr2;
782
+ }
783
+ function _iterableToArrayLimit(arr, i) {
784
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
785
+ if (null != _i) {
786
+ var _s,
787
+ _e,
788
+ _x,
789
+ _r,
790
+ _arr = [],
791
+ _n = !0,
792
+ _d = !1;
793
+ try {
794
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
795
+ if (Object(_i) !== _i) return;
796
+ _n = !1;
797
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
798
+ } catch (err) {
799
+ _d = !0, _e = err;
800
+ } finally {
801
+ try {
802
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
803
+ } finally {
804
+ if (_d) throw _e;
805
+ }
806
+ }
807
+ return _arr;
808
+ }
809
+ }
810
+ function _arrayWithHoles(arr) {
811
+ if (Array.isArray(arr)) return arr;
812
+ }
813
+ /**
814
+ * Bounded Drag
815
+ *
816
+ * @usage:
817
+
818
+
819
+ const App = () => {
820
+ const [items, setItems] = useState<ListItem[]>([]);
821
+ // ... other states and refs
822
+
823
+ const deepCloneWithReactNode = (obj: any): any => {
824
+ if (obj === null || typeof obj !== 'object') {
825
+ return obj;
826
+ }
827
+
828
+ // Handle array
829
+ if (Array.isArray(obj)) {
830
+ return obj.map(item => deepCloneWithReactNode(item));
831
+ }
832
+
833
+ // Handle object
834
+ const clonedObj: any = {};
835
+ for (const key in obj) {
836
+ if (key === 'appendControl') {
837
+ clonedObj[key] = obj[key];
838
+ } else {
839
+ clonedObj[key] = deepCloneWithReactNode(obj[key]);
840
+ }
841
+ }
842
+ return clonedObj;
843
+ };
844
+
845
+
846
+ const getItemWithChildrenIndices = (items: ListItem[], startIndex: number): number[] => {
847
+ const indices = [startIndex];
848
+ const startItem = items[startIndex];
849
+ const startDepth = startItem.depth || 0;
850
+
851
+ // Check if subsequent items are child items
852
+ for (let i = startIndex + 1; i < items.length; i++) {
853
+ const currentItem = items[i];
854
+ const currentDepth = currentItem.depth || 0;
855
+ if (currentDepth > startDepth) {
856
+ indices.push(i);
857
+ } else {
858
+ break;
859
+ }
860
+ }
861
+
862
+ return indices;
863
+ };
864
+
865
+
866
+ const { isDragging, dragHandlers } = useBoundedDrag({
867
+ dragMode,
868
+ boundarySelector: '.custom-draggable-list',
869
+ itemSelector:'.custom-draggable-list__item',
870
+ dragHandleSelector: '.custom-draggable-list__handle',
871
+ onDragStart: (index: number) => {
872
+ // Additional drag start logic if needed
873
+ },
874
+ onDragOver: (dragIndex: number | null, dropIndex: number | null) => {
875
+ // Additional drag over logic if needed
876
+ },
877
+ onDragEnd: (dragIndex: number | null, dropIndex: number | null) => {
878
+ if (dragIndex !== null && dropIndex !== null && dragIndex !== dropIndex) {
879
+ // Handle item movement
880
+ const newItems = deepCloneWithReactNode(items);
881
+ const itemsToMove = getItemWithChildrenIndices(newItems, dragIndex);
882
+ const itemsBeingMoved = itemsToMove.map(index => newItems[index]);
883
+
884
+ // ... rest of your existing drag end logic ...
885
+
886
+ setItems(updatedItems);
887
+
888
+ }
889
+ }
890
+ });
891
+
892
+ // Update your JSX to use the new handlers
893
+ return (
894
+ <ul className="custom-draggable-list">
895
+ {items.map((item: any, index: number) => (
896
+ <li
897
+ // ... other props
898
+ draggable={!draggable ? undefined : editingItem !== item.id && "true"}
899
+ onDragStart={!draggable ? undefined : (e) => dragHandlers.handleDragStart(e, index)}
900
+ onDragOver={!draggable ? undefined : dragHandlers.handleDragOver}
901
+ onDragEnd={!draggable ? undefined : dragHandlers.handleDragEnd}
902
+ onTouchStart={!draggable ? undefined : (e) => dragHandlers.handleDragStart(e, index)}
903
+ onTouchMove={!draggable ? undefined : dragHandlers.handleDragOver}
904
+ onTouchEnd={!draggable ? undefined : dragHandlers.handleDragEnd}
905
+ >
906
+ <li className="custom-draggable-list__item">
907
+ <span className="custom-draggable-list__handle">☰</span>
908
+ <i>content {indec}<i>
909
+ </li>
910
+ </li>
911
+ ))}
912
+ </ul>
913
+ );
914
+ };
915
+
916
+
917
+ */
918
+
919
+ var _useBoundedDrag = function useBoundedDrag() {
920
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
921
+ var _options$dragMode = options.dragMode,
922
+ dragMode = _options$dragMode === void 0 ? 'handle' : _options$dragMode,
923
+ _options$boundarySele = options.boundarySelector,
924
+ boundarySelector = _options$boundarySele === void 0 ? '.custom-draggable-list' : _options$boundarySele,
925
+ _options$itemSelector = options.itemSelector,
926
+ itemSelector = _options$itemSelector === void 0 ? '.custom-draggable-list__item' : _options$itemSelector,
927
+ _options$dragHandleSe = options.dragHandleSelector,
928
+ dragHandleSelector = _options$dragHandleSe === void 0 ? '.custom-draggable-list__handle' : _options$dragHandleSe,
929
+ onDragStart = options.onDragStart,
930
+ onDragOver = options.onDragOver,
931
+ onDragEnd = options.onDragEnd;
932
+ var _useState = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
933
+ _useState2 = _slicedToArray(_useState, 2),
934
+ isDragging = _useState2[0],
935
+ setIsDragging = _useState2[1];
936
+ var dragItem = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
937
+ var dragOverItem = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
938
+ var dragNode = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
939
+ var touchOffset = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)({
940
+ x: 0,
941
+ y: 0
942
+ });
943
+ var currentHoverItem = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
944
+ var handleDragStart = function handleDragStart(e, position) {
945
+ var isTouch = ('touches' in e);
946
+ var target = e.target;
947
+
948
+ // For block mode or handle mode check
949
+ if (dragMode === 'handle') {
950
+ var handle = target.closest(dragHandleSelector);
951
+ if (!handle) {
952
+ if (!isTouch) e.preventDefault();
953
+ return false;
954
+ }
955
+ }
956
+
957
+ // Find the draggable item
958
+ var listItem = target.closest(itemSelector);
959
+ if (!listItem) return;
960
+
961
+ // Check boundary
962
+ var boundary = listItem.closest(boundarySelector);
963
+ if (!boundary) return;
964
+ dragItem.current = position;
965
+ onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(position);
966
+ if (isTouch) {
967
+ e.preventDefault(); // Prevent scrolling
968
+ var touch = e.touches[0];
969
+ var rect = listItem.getBoundingClientRect();
970
+ var boundaryRect = boundary.getBoundingClientRect();
971
+
972
+ // Calculate offset relative to the boundary
973
+ touchOffset.current = {
974
+ x: touch.clientX - rect.left,
975
+ y: touch.clientY - rect.top
976
+ };
977
+
978
+ // Clone the item for dragging
979
+ dragNode.current = listItem.cloneNode(true);
980
+ dragNode.current.classList.add('dragging');
981
+
982
+ // Style the clone
983
+ Object.assign(dragNode.current.style, {
984
+ position: 'fixed',
985
+ width: "".concat(rect.width, "px"),
986
+ height: "".concat(rect.height, "px"),
987
+ left: "".concat(rect.left, "px"),
988
+ top: "".concat(rect.top, "px"),
989
+ zIndex: '1000',
990
+ pointerEvents: 'none',
991
+ transform: 'scale(1.05)',
992
+ transition: 'transform 0.1s',
993
+ opacity: '0.9'
994
+ });
995
+ document.body.appendChild(dragNode.current);
996
+ setIsDragging(true);
997
+ listItem.classList.add('dragging-placeholder');
998
+ } else {
999
+ // ... desktop drag logic remains the same ...
1000
+ }
1001
+ };
1002
+ var handleDragOver = function handleDragOver(e) {
1003
+ e.preventDefault();
1004
+ var isTouch = ('touches' in e);
1005
+ if (!isTouch) {
1006
+ e.dataTransfer.dropEffect = 'move';
1007
+ }
1008
+
1009
+ // Get the current pointer/touch position
1010
+ var point = isTouch ? e.touches[0] : {
1011
+ clientX: e.clientX,
1012
+ clientY: e.clientY
1013
+ };
1014
+
1015
+ // Update dragged element position for touch events
1016
+ if (isTouch && isDragging && dragNode.current) {
1017
+ dragNode.current.style.left = "".concat(point.clientX - touchOffset.current.x, "px");
1018
+ dragNode.current.style.top = "".concat(point.clientY - touchOffset.current.y, "px");
1019
+ }
1020
+
1021
+ // Find the element below the pointer/touch
1022
+ var elemBelow = document.elementFromPoint(point.clientX, point.clientY);
1023
+ if (!elemBelow) return;
1024
+
1025
+ // Find the closest list item
1026
+ var listItem = elemBelow.closest(itemSelector);
1027
+ if (!listItem || listItem === currentHoverItem.current) return;
1028
+
1029
+ // Check boundary
1030
+ var boundary = listItem.closest(boundarySelector);
1031
+ if (!boundary) return;
1032
+
1033
+ // Update hover states
1034
+ if (currentHoverItem.current) {
1035
+ currentHoverItem.current.classList.remove('drag-over', 'drag-over-top', 'drag-over-bottom');
1036
+ }
1037
+ currentHoverItem.current = listItem;
1038
+ listItem.classList.add('drag-over');
1039
+
1040
+ // Calculate position in list
1041
+ var position = Array.from(listItem.parentNode.children).indexOf(listItem);
1042
+ dragOverItem.current = position;
1043
+
1044
+ // Determine drop position (top/bottom)
1045
+ var rect = listItem.getBoundingClientRect();
1046
+ var middleY = rect.top + rect.height / 2;
1047
+ if (point.clientY < middleY) {
1048
+ listItem.classList.add('drag-over-top');
1049
+ } else {
1050
+ listItem.classList.add('drag-over-bottom');
1051
+ }
1052
+ onDragOver === null || onDragOver === void 0 ? void 0 : onDragOver(dragItem.current, dragOverItem.current);
1053
+ };
1054
+ var handleDragEnd = function handleDragEnd(e) {
1055
+ var isTouch = ('touches' in e);
1056
+ if (isTouch && !isDragging) return;
1057
+ onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd(dragItem.current, dragOverItem.current);
1058
+
1059
+ // Cleanup
1060
+ if (dragNode.current) {
1061
+ dragNode.current.remove();
1062
+ dragNode.current = null;
1063
+ }
1064
+ document.querySelectorAll(itemSelector).forEach(function (item) {
1065
+ item.style.opacity = '1';
1066
+ item.classList.remove('dragging', 'dragging-placeholder', 'drag-over', 'drag-over-top', 'drag-over-bottom');
1067
+ });
1068
+ setIsDragging(false);
1069
+ currentHoverItem.current = null;
1070
+ dragItem.current = null;
1071
+ dragOverItem.current = null;
1072
+ };
1073
+ return {
1074
+ isDragging: isDragging,
1075
+ dragHandlers: {
1076
+ handleDragStart: handleDragStart,
1077
+ handleDragOver: handleDragOver,
1078
+ handleDragEnd: handleDragEnd
1079
+ }
1080
+ };
1081
+ };
1082
+ /* harmony default export */
1083
+ var __WEBPACK_DEFAULT_EXPORT__ = _useBoundedDrag;
1084
+ })();
1085
+
1086
+ /******/
1087
+ return __webpack_exports__;
1088
+ /******/
1089
+ }()
1090
+ );
1091
+ });
1092
+
1093
+ /***/
1094
+ },
1095
+
1096
+ /***/787: /***/function _(module) {
1097
+ "use strict";
1098
+
1099
+ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
1100
+
1101
+ /***/
1102
+ }
1103
+
1104
+ /******/
1105
+ };
1106
+ /************************************************************************/
1107
+ /******/ // The module cache
1108
+ /******/
1109
+ var __webpack_module_cache__ = {};
1110
+ /******/
1111
+ /******/ // The require function
1112
+ /******/
1113
+ function __nested_webpack_require_54674__(moduleId) {
1114
+ /******/ // Check if module is in cache
1115
+ /******/var cachedModule = __webpack_module_cache__[moduleId];
1116
+ /******/
1117
+ if (cachedModule !== undefined) {
1118
+ /******/return cachedModule.exports;
1119
+ /******/
1120
+ }
1121
+ /******/ // Create a new module (and put it into the cache)
1122
+ /******/
1123
+ var module = __webpack_module_cache__[moduleId] = {
1124
+ /******/id: moduleId,
1125
+ /******/loaded: false,
1126
+ /******/exports: {}
1127
+ /******/
1128
+ };
1129
+ /******/
1130
+ /******/ // Execute the module function
1131
+ /******/
1132
+ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_54674__);
1133
+ /******/
1134
+ /******/ // Flag the module as loaded
1135
+ /******/
1136
+ module.loaded = true;
1137
+ /******/
1138
+ /******/ // Return the exports of the module
1139
+ /******/
1140
+ return module.exports;
1141
+ /******/
1142
+ }
1143
+ /******/
1144
+ /************************************************************************/
1145
+ /******/ /* webpack/runtime/compat get default export */
1146
+ /******/
1147
+ (function () {
1148
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
1149
+ /******/__nested_webpack_require_54674__.n = function (module) {
1150
+ /******/var getter = module && module.__esModule ? /******/function () {
1151
+ return module['default'];
1152
+ } : /******/function () {
1153
+ return module;
1154
+ };
1155
+ /******/
1156
+ __nested_webpack_require_54674__.d(getter, {
1157
+ a: getter
1158
+ });
1159
+ /******/
1160
+ return getter;
1161
+ /******/
1162
+ };
1163
+ /******/
1164
+ })();
1165
+ /******/
1166
+ /******/ /* webpack/runtime/define property getters */
1167
+ /******/
1168
+ (function () {
1169
+ /******/ // define getter functions for harmony exports
1170
+ /******/__nested_webpack_require_54674__.d = function (exports, definition) {
1171
+ /******/for (var key in definition) {
1172
+ /******/if (__nested_webpack_require_54674__.o(definition, key) && !__nested_webpack_require_54674__.o(exports, key)) {
1173
+ /******/Object.defineProperty(exports, key, {
1174
+ enumerable: true,
1175
+ get: definition[key]
1176
+ });
1177
+ /******/
1178
+ }
1179
+ /******/
1180
+ }
1181
+ /******/
1182
+ };
1183
+ /******/
1184
+ })();
1185
+ /******/
1186
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
1187
+ /******/
1188
+ (function () {
1189
+ /******/__nested_webpack_require_54674__.o = function (obj, prop) {
1190
+ return Object.prototype.hasOwnProperty.call(obj, prop);
1191
+ };
1192
+ /******/
1193
+ })();
1194
+ /******/
1195
+ /******/ /* webpack/runtime/make namespace object */
1196
+ /******/
1197
+ (function () {
1198
+ /******/ // define __esModule on exports
1199
+ /******/__nested_webpack_require_54674__.r = function (exports) {
1200
+ /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1201
+ /******/Object.defineProperty(exports, Symbol.toStringTag, {
1202
+ value: 'Module'
1203
+ });
1204
+ /******/
1205
+ }
1206
+ /******/
1207
+ Object.defineProperty(exports, '__esModule', {
1208
+ value: true
1209
+ });
1210
+ /******/
1211
+ };
1212
+ /******/
1213
+ })();
1214
+ /******/
1215
+ /******/ /* webpack/runtime/node module decorator */
1216
+ /******/
1217
+ (function () {
1218
+ /******/__nested_webpack_require_54674__.nmd = function (module) {
1219
+ /******/module.paths = [];
1220
+ /******/
1221
+ if (!module.children) module.children = [];
1222
+ /******/
1223
+ return module;
1224
+ /******/
1225
+ };
1226
+ /******/
1227
+ })();
1228
+ /******/
1229
+ /************************************************************************/
1230
+ var __webpack_exports__ = {};
1231
+ // This entry need to be wrapped in an IIFE because it need to be in strict mode.
1232
+ (function () {
1233
+ "use strict";
1234
+
1235
+ __nested_webpack_require_54674__.r(__webpack_exports__);
1236
+ /* harmony export */
1237
+ __nested_webpack_require_54674__.d(__webpack_exports__, {
1238
+ /* harmony export */"default": function _default() {
1239
+ return __WEBPACK_DEFAULT_EXPORT__;
1240
+ }
1241
+ /* harmony export */
1242
+ });
1243
+ /* harmony import */
1244
+ var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_54674__(787);
1245
+ /* harmony import */
1246
+ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_54674__.n(react__WEBPACK_IMPORTED_MODULE_0__);
1247
+ /* harmony import */
1248
+ var funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_54674__(438);
1249
+ /* harmony import */
1250
+ var funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nested_webpack_require_54674__.n(funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1__);
1251
+ /* harmony import */
1252
+ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_54674__(188);
1253
+ /* harmony import */
1254
+ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nested_webpack_require_54674__.n(funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__);
1255
+ /* harmony import */
1256
+ var funda_utils_dist_cjs_useBoundedDrag__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_54674__(759);
1257
+ /* harmony import */
1258
+ var funda_utils_dist_cjs_useBoundedDrag__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nested_webpack_require_54674__.n(funda_utils_dist_cjs_useBoundedDrag__WEBPACK_IMPORTED_MODULE_3__);
1259
+ var _excluded = ["wrapperClassName", "prefix", "data", "draggable", "handleHide", "handleIcon", "handlePos", "dragMode", "editable", "itemStyle", "hierarchical", "indentation", "doubleIndent", "alternateCollapse", "arrow", "onUpdate"];
1260
+ function _extends() {
1261
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
1262
+ for (var i = 1; i < arguments.length; i++) {
1263
+ var source = arguments[i];
1264
+ for (var key in source) {
1265
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
1266
+ target[key] = source[key];
1267
+ }
1268
+ }
1269
+ }
1270
+ return target;
1271
+ };
1272
+ return _extends.apply(this, arguments);
1273
+ }
1274
+ function ownKeys(object, enumerableOnly) {
1275
+ var keys = Object.keys(object);
1276
+ if (Object.getOwnPropertySymbols) {
1277
+ var symbols = Object.getOwnPropertySymbols(object);
1278
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
1279
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1280
+ })), keys.push.apply(keys, symbols);
1281
+ }
1282
+ return keys;
1283
+ }
1284
+ function _objectSpread(target) {
1285
+ for (var i = 1; i < arguments.length; i++) {
1286
+ var source = null != arguments[i] ? arguments[i] : {};
1287
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
1288
+ _defineProperty(target, key, source[key]);
1289
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
1290
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1291
+ });
1292
+ }
1293
+ return target;
1294
+ }
1295
+ function _defineProperty(obj, key, value) {
1296
+ key = _toPropertyKey(key);
1297
+ if (key in obj) {
1298
+ Object.defineProperty(obj, key, {
1299
+ value: value,
1300
+ enumerable: true,
1301
+ configurable: true,
1302
+ writable: true
1303
+ });
1304
+ } else {
1305
+ obj[key] = value;
1306
+ }
1307
+ return obj;
1308
+ }
1309
+ function _toPropertyKey(arg) {
1310
+ var key = _toPrimitive(arg, "string");
1311
+ return _typeof(key) === "symbol" ? key : String(key);
1312
+ }
1313
+ function _toPrimitive(input, hint) {
1314
+ if (_typeof(input) !== "object" || input === null) return input;
1315
+ var prim = input[Symbol.toPrimitive];
1316
+ if (prim !== undefined) {
1317
+ var res = prim.call(input, hint || "default");
1318
+ if (_typeof(res) !== "object") return res;
1319
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1320
+ }
1321
+ return (hint === "string" ? String : Number)(input);
1322
+ }
1323
+ function _toConsumableArray(arr) {
1324
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
1325
+ }
1326
+ function _nonIterableSpread() {
1327
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1328
+ }
1329
+ function _iterableToArray(iter) {
1330
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1331
+ }
1332
+ function _arrayWithoutHoles(arr) {
1333
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
1334
+ }
1335
+ function _typeof(obj) {
1336
+ "@babel/helpers - typeof";
1337
+
1338
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1339
+ return typeof obj;
1340
+ } : function (obj) {
1341
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1342
+ }, _typeof(obj);
1343
+ }
1344
+ function _slicedToArray(arr, i) {
1345
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
1346
+ }
1347
+ function _nonIterableRest() {
1348
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1349
+ }
1350
+ function _unsupportedIterableToArray(o, minLen) {
1351
+ if (!o) return;
1352
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1353
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1354
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1355
+ if (n === "Map" || n === "Set") return Array.from(o);
1356
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1357
+ }
1358
+ function _arrayLikeToArray(arr, len) {
1359
+ if (len == null || len > arr.length) len = arr.length;
1360
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
1361
+ return arr2;
1362
+ }
1363
+ function _iterableToArrayLimit(arr, i) {
1364
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
1365
+ if (null != _i) {
1366
+ var _s,
1367
+ _e,
1368
+ _x,
1369
+ _r,
1370
+ _arr = [],
1371
+ _n = !0,
1372
+ _d = !1;
1373
+ try {
1374
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
1375
+ if (Object(_i) !== _i) return;
1376
+ _n = !1;
1377
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
1378
+ } catch (err) {
1379
+ _d = !0, _e = err;
1380
+ } finally {
1381
+ try {
1382
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
1383
+ } finally {
1384
+ if (_d) throw _e;
1385
+ }
1386
+ }
1387
+ return _arr;
1388
+ }
1389
+ }
1390
+ function _arrayWithHoles(arr) {
1391
+ if (Array.isArray(arr)) return arr;
1392
+ }
1393
+ function _objectWithoutProperties(source, excluded) {
1394
+ if (source == null) return {};
1395
+ var target = _objectWithoutPropertiesLoose(source, excluded);
1396
+ var key, i;
1397
+ if (Object.getOwnPropertySymbols) {
1398
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1399
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
1400
+ key = sourceSymbolKeys[i];
1401
+ if (excluded.indexOf(key) >= 0) continue;
1402
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1403
+ target[key] = source[key];
1404
+ }
1405
+ }
1406
+ return target;
1407
+ }
1408
+ function _objectWithoutPropertiesLoose(source, excluded) {
1409
+ if (source == null) return {};
1410
+ var target = {};
1411
+ var sourceKeys = Object.keys(source);
1412
+ var key, i;
1413
+ for (i = 0; i < sourceKeys.length; i++) {
1414
+ key = sourceKeys[i];
1415
+ if (excluded.indexOf(key) >= 0) continue;
1416
+ target[key] = source[key];
1417
+ }
1418
+ return target;
1419
+ }
1420
+ var DragDropList = /*#__PURE__*/(0, react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function (props, externalRef) {
1421
+ var wrapperClassName = props.wrapperClassName,
1422
+ _props$prefix = props.prefix,
1423
+ prefix = _props$prefix === void 0 ? 'custom' : _props$prefix,
1424
+ data = props.data,
1425
+ _props$draggable = props.draggable,
1426
+ draggable = _props$draggable === void 0 ? true : _props$draggable,
1427
+ _props$handleHide = props.handleHide,
1428
+ handleHide = _props$handleHide === void 0 ? false : _props$handleHide,
1429
+ _props$handleIcon = props.handleIcon,
1430
+ handleIcon = _props$handleIcon === void 0 ? '☰' : _props$handleIcon,
1431
+ _props$handlePos = props.handlePos,
1432
+ handlePos = _props$handlePos === void 0 ? 'left' : _props$handlePos,
1433
+ _props$dragMode = props.dragMode,
1434
+ dragMode = _props$dragMode === void 0 ? 'handle' : _props$dragMode,
1435
+ _props$editable = props.editable,
1436
+ editable = _props$editable === void 0 ? false : _props$editable,
1437
+ itemStyle = props.itemStyle,
1438
+ _props$hierarchical = props.hierarchical,
1439
+ hierarchical = _props$hierarchical === void 0 ? true : _props$hierarchical,
1440
+ indentation = props.indentation,
1441
+ doubleIndent = props.doubleIndent,
1442
+ alternateCollapse = props.alternateCollapse,
1443
+ _props$arrow = props.arrow,
1444
+ arrow = _props$arrow === void 0 ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", {
1445
+ viewBox: "0 0 22 22",
1446
+ width: "8px"
1447
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
1448
+ d: "m345.44 248.29l-194.29 194.28c-12.359 12.365-32.397 12.365-44.75 0-12.354-12.354-12.354-32.391 0-44.744l171.91-171.91-171.91-171.9c-12.354-12.359-12.354-32.394 0-44.748 12.354-12.359 32.391-12.359 44.75 0l194.29 194.28c6.177 6.18 9.262 14.271 9.262 22.366 0 8.099-3.091 16.196-9.267 22.373",
1449
+ transform: "matrix(.03541-.00013.00013.03541 2.98 3.02)",
1450
+ fill: "#a5a5a5"
1451
+ }))) : _props$arrow,
1452
+ onUpdate = props.onUpdate,
1453
+ attributes = _objectWithoutProperties(props, _excluded);
1454
+ var INDENT_PLACEHOLDER = doubleIndent ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" : "&nbsp;&nbsp;&nbsp;&nbsp;";
1455
+ var INDENT_LAST_PLACEHOLDER = "".concat(typeof indentation !== 'undefined' && indentation !== '' ? "".concat(indentation, "&nbsp;&nbsp;") : '');
1456
+ var rootRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
1457
+ var _useState = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
1458
+ _useState2 = _slicedToArray(_useState, 2),
1459
+ items = _useState2[0],
1460
+ setItems = _useState2[1];
1461
+ var _useState3 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),
1462
+ _useState4 = _slicedToArray(_useState3, 2),
1463
+ editingItem = _useState4[0],
1464
+ setEditingItem = _useState4[1];
1465
+ var dragHandle = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
1466
+
1467
+ // Edit
1468
+ var _useState5 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)({}),
1469
+ _useState6 = _slicedToArray(_useState5, 2),
1470
+ editValue = _useState6[0],
1471
+ setEditValue = _useState6[1];
1472
+
1473
+ // Collapse/Expand
1474
+ var _useState7 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(new Set()),
1475
+ _useState8 = _slicedToArray(_useState7, 2),
1476
+ collapsedItems = _useState8[0],
1477
+ setCollapsedItems = _useState8[1];
1478
+
1479
+ // Get editable field list
1480
+ var getEditableFields = function getEditableFields(item) {
1481
+ // Exclude fields that don't need to be edited
1482
+ var excludeFields = ['id', 'parentId', 'depth', 'children', 'disabled', 'appendControl', 'parentItem'];
1483
+ return Object.keys(item).filter(function (key) {
1484
+ return !excludeFields.includes(key);
1485
+ });
1486
+ };
1487
+
1488
+ // ================================================================
1489
+ // General
1490
+ // ================================================================
1491
+ var deepCloneWithReactNode = function deepCloneWithReactNode(obj) {
1492
+ if (obj === null || _typeof(obj) !== 'object') {
1493
+ return obj;
1494
+ }
1495
+
1496
+ // Handle array
1497
+ if (Array.isArray(obj)) {
1498
+ return obj.map(function (item) {
1499
+ return deepCloneWithReactNode(item);
1500
+ });
1501
+ }
1502
+
1503
+ // Handle object
1504
+ var clonedObj = {};
1505
+ for (var key in obj) {
1506
+ if (key === 'appendControl') {
1507
+ clonedObj[key] = obj[key];
1508
+ } else {
1509
+ clonedObj[key] = deepCloneWithReactNode(obj[key]);
1510
+ }
1511
+ }
1512
+ return clonedObj;
1513
+ };
1514
+ var getItemWithChildrenIndices = function getItemWithChildrenIndices(items, startIndex) {
1515
+ var indices = [startIndex];
1516
+ var startItem = items[startIndex];
1517
+ var startDepth = startItem.depth || 0;
1518
+
1519
+ // Check if subsequent items are child items
1520
+ for (var i = startIndex + 1; i < items.length; i++) {
1521
+ var currentItem = items[i];
1522
+ var currentDepth = currentItem.depth || 0;
1523
+ if (currentDepth > startDepth) {
1524
+ indices.push(i);
1525
+ } else {
1526
+ break;
1527
+ }
1528
+ }
1529
+ return indices;
1530
+ };
1531
+ var getIndentStr = function getIndentStr(item) {
1532
+ // Add indent placeholder
1533
+ var indent = '';
1534
+ var depthData = item.depth;
1535
+ if (depthData) {
1536
+ Array(depthData).fill(0).forEach(function (k, i) {
1537
+ indent += INDENT_PLACEHOLDER;
1538
+ if (i === depthData - 1) {
1539
+ indent += INDENT_LAST_PLACEHOLDER;
1540
+ }
1541
+ });
1542
+ }
1543
+ return indent;
1544
+ };
1545
+
1546
+ // ================================================================
1547
+ // Collapse/Expand
1548
+ // ================================================================
1549
+ // Add collapse/expand handler function
1550
+ var handleCollapse = function handleCollapse(itemId, e) {
1551
+ e.preventDefault();
1552
+ e.stopPropagation();
1553
+ setCollapsedItems(function (prev) {
1554
+ var newCollapsed = new Set(prev);
1555
+ if (newCollapsed.has(itemId)) {
1556
+ newCollapsed["delete"](itemId);
1557
+ } else {
1558
+ newCollapsed.add(itemId);
1559
+ }
1560
+ return newCollapsed;
1561
+ });
1562
+ };
1563
+
1564
+ // Helper function to determine if an item should be displayed
1565
+ var shouldShowItem = function shouldShowItem(item) {
1566
+ if (!alternateCollapse) return true;
1567
+ var currentId = item.parentId;
1568
+ while (currentId) {
1569
+ if (collapsedItems.has(currentId)) {
1570
+ return false;
1571
+ }
1572
+ var parentItem = items.find(function (i) {
1573
+ return i.id === currentId;
1574
+ });
1575
+ currentId = parentItem === null || parentItem === void 0 ? void 0 : parentItem.parentId;
1576
+ }
1577
+ return true;
1578
+ };
1579
+ var hasChildren = function hasChildren(itemId) {
1580
+ return items.some(function (item) {
1581
+ return item.parentId === itemId;
1582
+ });
1583
+ };
1584
+
1585
+ // ================================================================
1586
+ // Drag & Drop Handlers (Desktop & Touch)
1587
+ // ================================================================
1588
+ var _useBoundedDrag = funda_utils_dist_cjs_useBoundedDrag__WEBPACK_IMPORTED_MODULE_3___default()({
1589
+ dragMode: dragMode,
1590
+ boundarySelector: ".".concat(prefix, "-draggable-list"),
1591
+ itemSelector: ".".concat(prefix, "-draggable-list__item"),
1592
+ dragHandleSelector: ".".concat(prefix, "-draggable-list__handle"),
1593
+ onDragStart: function onDragStart(index) {
1594
+ // Additional drag start logic if needed
1595
+ },
1596
+ onDragOver: function onDragOver(dragIndex, dropIndex) {
1597
+ // Additional drag over logic if needed
1598
+ },
1599
+ onDragEnd: function onDragEnd(dragIndex, dropIndex) {
1600
+ if (dragIndex !== null && dropIndex !== null && dragIndex !== dropIndex) {
1601
+ var _newItems$dragIndex, _newItems$dragIndex2, _newItems$dropIndex;
1602
+ // Handle item movement
1603
+ var newItems = deepCloneWithReactNode(items);
1604
+ var itemsToMove = getItemWithChildrenIndices(newItems, dragIndex);
1605
+ var itemsBeingMoved = itemsToMove.map(function (index) {
1606
+ return newItems[index];
1607
+ });
1608
+
1609
+ // ... rest of your existing drag end logic ...
1610
+
1611
+ var _targetId = (_newItems$dragIndex = newItems[dragIndex]) === null || _newItems$dragIndex === void 0 ? void 0 : _newItems$dragIndex.id;
1612
+
1613
+ // Calculate depth difference
1614
+ var draggedDepth = ((_newItems$dragIndex2 = newItems[dragIndex]) === null || _newItems$dragIndex2 === void 0 ? void 0 : _newItems$dragIndex2.depth) || 0;
1615
+ var dropDepth = ((_newItems$dropIndex = newItems[dropIndex]) === null || _newItems$dropIndex === void 0 ? void 0 : _newItems$dropIndex.depth) || 0;
1616
+ var depthDiff = dropDepth - draggedDepth;
1617
+
1618
+ // Adjust depth for all moving items
1619
+ itemsBeingMoved.forEach(function (item) {
1620
+ if (item.depth !== undefined) {
1621
+ item.depth += depthDiff;
1622
+ }
1623
+ });
1624
+
1625
+ // Remove all items from their original location (from back to front to keep indexing correct)
1626
+ itemsToMove.reverse().forEach(function (index) {
1627
+ newItems.splice(index, 1);
1628
+ });
1629
+
1630
+ // Calculate new insert position
1631
+ var insertIndex = dropIndex;
1632
+ if (dropIndex > dragIndex) {
1633
+ insertIndex -= itemsToMove.length;
1634
+ }
1635
+
1636
+ // Insert all items
1637
+ newItems.splice.apply(newItems, [insertIndex, 0].concat(_toConsumableArray(itemsBeingMoved)));
1638
+
1639
+ // Rebuild tree structure
1640
+ var tree = hierarchical ? (0, funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1__.convertTree)(newItems, '', 'id', 'parentId') : newItems;
1641
+ var updatedItems = hierarchical ? (0, funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1__.addTreeDepth)(tree) : tree;
1642
+ setItems(updatedItems);
1643
+ onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(updatedItems, _targetId);
1644
+ }
1645
+ }
1646
+ }),
1647
+ isDragging = _useBoundedDrag.isDragging,
1648
+ dragHandlers = _useBoundedDrag.dragHandlers;
1649
+
1650
+ // ================================================================
1651
+ // Editable
1652
+ // ================================================================
1653
+
1654
+ var handleDoubleClick = function handleDoubleClick(item) {
1655
+ if (!editable) return;
1656
+ setEditingItem(item.id);
1657
+ // Only editable fields are copied
1658
+ var editableFields = getEditableFields(item);
1659
+ var editableValues = editableFields.reduce(function (acc, field) {
1660
+ return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, field, item[field]));
1661
+ }, {});
1662
+ setEditValue(editableValues);
1663
+ };
1664
+ var handleEditCancel = function handleEditCancel() {
1665
+ setEditingItem(null);
1666
+ setEditValue({});
1667
+ };
1668
+ var handleEditSave = function handleEditSave(itemId) {
1669
+ var newItems = items.map(function (item) {
1670
+ if (item.id === itemId) {
1671
+ return _objectSpread(_objectSpread({}, item), editValue);
1672
+ }
1673
+ return item;
1674
+ });
1675
+ setItems(newItems);
1676
+ onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newItems, itemId);
1677
+ setEditingItem(null);
1678
+ setEditValue({});
1679
+ };
1680
+ var handleInputChange = function handleInputChange(field, value) {
1681
+ setEditValue(function (prev) {
1682
+ return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, field, value));
1683
+ });
1684
+ };
1685
+ var handleKeyDown = function handleKeyDown(e, itemId) {
1686
+ if (e.key === 'Enter') {
1687
+ handleEditSave(itemId);
1688
+ } else if (e.key === 'Escape') {
1689
+ handleEditCancel();
1690
+ }
1691
+ };
1692
+ var renderEditForm = function renderEditForm(item) {
1693
+ var editableFields = getEditableFields(item);
1694
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1695
+ className: "".concat(prefix, "-draggable-list__edit-form")
1696
+ }, editableFields.map(function (field) {
1697
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1698
+ key: field,
1699
+ className: "".concat(prefix, "-draggable-list__edit-field")
1700
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", null, field, ":"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
1701
+ type: "text",
1702
+ value: editValue[field] || '',
1703
+ onChange: function onChange(e) {
1704
+ return handleInputChange(field, e.target.value);
1705
+ },
1706
+ onKeyDown: function onKeyDown(e) {
1707
+ return handleKeyDown(e, item.id);
1708
+ },
1709
+ placeholder: field,
1710
+ autoFocus: field === editableFields[0]
1711
+ }));
1712
+ }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1713
+ className: "".concat(prefix, "-draggable-list__edit-buttons")
1714
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", {
1715
+ onClick: function onClick() {
1716
+ return handleEditSave(item.id);
1717
+ }
1718
+ }, "\u2713"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", {
1719
+ onClick: handleEditCancel
1720
+ }, "\u2715")));
1721
+ };
1722
+ (0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
1723
+ // data init
1724
+ //--------------
1725
+ if (typeof data !== 'undefined' && Array.isArray(data)) {
1726
+ var tree = hierarchical ? (0, funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1__.convertTree)(data, '', 'id', 'parentId') : data;
1727
+ var _ORGIN_DATA = hierarchical ? (0, funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1__.addTreeDepth)(tree) : tree;
1728
+ setItems(_ORGIN_DATA);
1729
+ }
1730
+ }, [data]);
1731
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("ul", _extends({}, attributes, {
1732
+ ref: function ref(node) {
1733
+ rootRef.current = node;
1734
+ if (typeof externalRef === 'function') {
1735
+ externalRef(node);
1736
+ } else if (externalRef) {
1737
+ externalRef.current = node;
1738
+ }
1739
+ },
1740
+ className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)("".concat(prefix, "-draggable-list"), (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(wrapperClassName, 'mb-3'), (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(dragMode, 'handle'), "handle-pos-".concat(handlePos !== null && handlePos !== void 0 ? handlePos : 'left'), {
1741
+ 'draggable': draggable,
1742
+ 'icon-hide': handleHide,
1743
+ 'alternate-collapse': alternateCollapse
1744
+ })
1745
+ }), items.map(function (item, index) {
1746
+ // If the item should be hidden, the rendering is skipped
1747
+ if (!shouldShowItem(item)) return null;
1748
+
1749
+ // collapse
1750
+ var hasChildItems = hasChildren(item.id);
1751
+ var isCollapsed = collapsedItems.has(item.id);
1752
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("li", {
1753
+ key: item.id,
1754
+ "data-index": index,
1755
+ "data-id": item.id,
1756
+ "data-parent-id": item.parentId,
1757
+ "data-value": item.value,
1758
+ "data-label": item.label,
1759
+ "data-listitemlabel": item.listItemLabel,
1760
+ className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)("".concat(prefix, "-draggable-list__item"), (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(dragMode, 'handle'), {
1761
+ 'disabled': item.disabled,
1762
+ 'draggable': draggable,
1763
+ 'editing': editingItem === item.id,
1764
+ // collapse
1765
+ 'has-children': hasChildItems,
1766
+ 'collapsed': isCollapsed
1767
+ }),
1768
+ draggable: !draggable ? undefined : editingItem !== item.id && "true",
1769
+ onDragStart: !draggable ? undefined : function (e) {
1770
+ return dragHandlers.handleDragStart(e, index);
1771
+ },
1772
+ onDragOver: !draggable ? undefined : dragHandlers.handleDragOver,
1773
+ onDragEnd: !draggable ? undefined : dragHandlers.handleDragEnd,
1774
+ onTouchStart: !draggable ? undefined : function (e) {
1775
+ return dragHandlers.handleDragStart(e, index);
1776
+ },
1777
+ onTouchMove: !draggable ? undefined : dragHandlers.handleDragOver,
1778
+ onTouchEnd: !draggable ? undefined : dragHandlers.handleDragEnd,
1779
+ style: itemStyle,
1780
+ onDoubleClick: function onDoubleClick() {
1781
+ return handleDoubleClick(item);
1782
+ }
1783
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1784
+ className: "".concat(prefix, "-draggable-list__itemcontent")
1785
+ }, draggable && !handleHide ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
1786
+ ref: dragHandle,
1787
+ className: "".concat(prefix, "-draggable-list__handle ").concat(handlePos !== null && handlePos !== void 0 ? handlePos : 'left'),
1788
+ draggable: dragMode === 'handle',
1789
+ dangerouslySetInnerHTML: {
1790
+ __html: "".concat(handleIcon)
1791
+ }
1792
+ }) : null, editingItem === item.id ? renderEditForm(item) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1793
+ className: "".concat(prefix, "-draggable-list__itemcontent-inner")
1794
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1795
+ className: "".concat(prefix, "-draggable-list__itemlabel")
1796
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
1797
+ dangerouslySetInnerHTML: {
1798
+ __html: "".concat(getIndentStr(item)).concat(typeof item.listItemLabel === 'undefined' ? item.label : item.listItemLabel)
1799
+ }
1800
+ }), alternateCollapse && hasChildItems && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
1801
+ className: "".concat(prefix, "-draggable-list__collapse-arrow"),
1802
+ onClick: function onClick(e) {
1803
+ return handleCollapse(item.id, e);
1804
+ }
1805
+ }, arrow || (isCollapsed ? '▶' : '▼'))), item.appendControl ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1806
+ className: "".concat(prefix, "-draggable-list__itemext"),
1807
+ id: "".concat(prefix, "-draggable-list__itemext-").concat(item.value)
1808
+ }, item.appendControl)) : null)));
1809
+ }));
1810
+ });
1811
+ /* harmony default export */
1812
+ var __WEBPACK_DEFAULT_EXPORT__ = DragDropList;
1813
+ })();
1814
+
1815
+ /******/
1816
+ return __webpack_exports__;
1817
+ /******/
1818
+ }()
1819
+ );
1820
+ });
1821
+
1822
+ /***/ }),
1823
+
14
1824
  /***/ 188:
15
1825
  /***/ (function(module, exports, __webpack_require__) {
16
1826
 
@@ -358,369 +2168,16 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
358
2168
  }).join('');
359
2169
  }
360
2170
 
361
- /**
362
- * Convert array value to string separated by curly braces
363
- * @param {String[]} arr such as: ['1','2','3']
364
- * @returns {String} such as: {1}{2}{3}
365
- */
366
- function _convertArrToValByBraces(arr) {
367
- if (!Array.isArray(arr)) return '';
368
- return arr.map(function (v) {
369
- return v.toString().includes('{') && v.toString().includes('}') ? "".concat(v) : "{".concat(v, "}");
370
- }).join('');
371
- }
372
-
373
- /******/
374
- return __webpack_exports__;
375
- /******/
376
- }()
377
- );
378
- });
379
-
380
- /***/ }),
381
-
382
- /***/ 997:
383
- /***/ (function(module, exports, __webpack_require__) {
384
-
385
- /* module decorator */ module = __webpack_require__.nmd(module);
386
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
387
- (function webpackUniversalModuleDefinition(root, factory) {
388
- if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
389
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
390
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
391
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
392
- })(this, function () {
393
- return (/******/function () {
394
- // webpackBootstrap
395
- /******/
396
- "use strict";
397
-
398
- /******/ // The require scope
399
- /******/
400
- var __nested_webpack_require_987__ = {};
401
- /******/
402
- /************************************************************************/
403
- /******/ /* webpack/runtime/define property getters */
404
- /******/
405
- (function () {
406
- /******/ // define getter functions for harmony exports
407
- /******/__nested_webpack_require_987__.d = function (exports, definition) {
408
- /******/for (var key in definition) {
409
- /******/if (__nested_webpack_require_987__.o(definition, key) && !__nested_webpack_require_987__.o(exports, key)) {
410
- /******/Object.defineProperty(exports, key, {
411
- enumerable: true,
412
- get: definition[key]
413
- });
414
- /******/
415
- }
416
- /******/
417
- }
418
- /******/
419
- };
420
- /******/
421
- })();
422
- /******/
423
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
424
- /******/
425
- (function () {
426
- /******/__nested_webpack_require_987__.o = function (obj, prop) {
427
- return Object.prototype.hasOwnProperty.call(obj, prop);
428
- };
429
- /******/
430
- })();
431
- /******/
432
- /******/ /* webpack/runtime/make namespace object */
433
- /******/
434
- (function () {
435
- /******/ // define __esModule on exports
436
- /******/__nested_webpack_require_987__.r = function (exports) {
437
- /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
438
- /******/Object.defineProperty(exports, Symbol.toStringTag, {
439
- value: 'Module'
440
- });
441
- /******/
442
- }
443
- /******/
444
- Object.defineProperty(exports, '__esModule', {
445
- value: true
446
- });
447
- /******/
448
- };
449
- /******/
450
- })();
451
- /******/
452
- /************************************************************************/
453
- var __webpack_exports__ = {};
454
- __nested_webpack_require_987__.r(__webpack_exports__);
455
- /* harmony export */
456
- __nested_webpack_require_987__.d(__webpack_exports__, {
457
- /* harmony export */"getAllSiblings": function getAllSiblings() {
458
- return (/* binding */_getAllSiblings
459
- );
460
- },
461
- /* harmony export */"getChildren": function getChildren() {
462
- return (/* binding */_getChildren
463
- );
464
- },
465
- /* harmony export */"getDocument": function getDocument() {
466
- return (/* binding */_getDocument
467
- );
468
- },
469
- /* harmony export */"getNextSiblings": function getNextSiblings() {
470
- return (/* binding */_getNextSiblings
471
- );
472
- },
473
- /* harmony export */"getParents": function getParents() {
474
- return (/* binding */_getParents
475
- );
476
- },
477
- /* harmony export */"getPreviousSiblings": function getPreviousSiblings() {
478
- return (/* binding */_getPreviousSiblings
479
- );
480
- },
481
- /* harmony export */"isElement": function isElement() {
482
- return (/* binding */_isElement
483
- );
484
- },
485
- /* harmony export */"isHTMLElement": function isHTMLElement() {
486
- return (/* binding */_isHTMLElement
487
- );
488
- },
489
- /* harmony export */"isNode": function isNode() {
490
- return (/* binding */_isNode
491
- );
492
- },
493
- /* harmony export */"isRootElement": function isRootElement() {
494
- return (/* binding */_isRootElement
495
- );
496
- },
497
- /* harmony export */"isShadowRoot": function isShadowRoot() {
498
- return (/* binding */_isShadowRoot
499
- );
500
- },
501
- /* harmony export */"nodeContains": function nodeContains() {
502
- return (/* binding */_nodeContains
503
- );
504
- }
505
- /* harmony export */
506
- });
507
- function _createForOfIteratorHelper(o, allowArrayLike) {
508
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
509
- if (!it) {
510
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
511
- if (it) o = it;
512
- var i = 0;
513
- var F = function F() {};
514
- return {
515
- s: F,
516
- n: function n() {
517
- if (i >= o.length) return {
518
- done: true
519
- };
520
- return {
521
- done: false,
522
- value: o[i++]
523
- };
524
- },
525
- e: function e(_e) {
526
- throw _e;
527
- },
528
- f: F
529
- };
530
- }
531
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
532
- }
533
- var normalCompletion = true,
534
- didErr = false,
535
- err;
536
- return {
537
- s: function s() {
538
- it = it.call(o);
539
- },
540
- n: function n() {
541
- var step = it.next();
542
- normalCompletion = step.done;
543
- return step;
544
- },
545
- e: function e(_e2) {
546
- didErr = true;
547
- err = _e2;
548
- },
549
- f: function f() {
550
- try {
551
- if (!normalCompletion && it["return"] != null) it["return"]();
552
- } finally {
553
- if (didErr) throw err;
554
- }
555
- }
556
- };
557
- }
558
- function _toConsumableArray(arr) {
559
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
560
- }
561
- function _nonIterableSpread() {
562
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
563
- }
564
- function _unsupportedIterableToArray(o, minLen) {
565
- if (!o) return;
566
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
567
- var n = Object.prototype.toString.call(o).slice(8, -1);
568
- if (n === "Object" && o.constructor) n = o.constructor.name;
569
- if (n === "Map" || n === "Set") return Array.from(o);
570
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
571
- }
572
- function _iterableToArray(iter) {
573
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
574
- }
575
- function _arrayWithoutHoles(arr) {
576
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
577
- }
578
- function _arrayLikeToArray(arr, len) {
579
- if (len == null || len > arr.length) len = arr.length;
580
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
581
- return arr2;
582
- }
583
- /**
584
- * Dom Utilities
585
- * @param {HTMLElement} el - Element
586
- * @param {?String} filter - A filter string
587
- * @returns HtmlElementCollection
588
- */
589
- function matches(el, filter) {
590
- if (el && el.nodeType === 1) {
591
- if (filter) {
592
- return el.matches(filter);
593
- }
594
- return true;
595
- }
596
- return false;
597
- }
598
-
599
- // the next siblings
600
- function _getNextSiblings(el) {
601
- var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
602
- var sibs = [];
603
- while (el = el.nextSibling) {
604
- if (matches(el, filter)) {
605
- sibs.push(el);
606
- }
607
- }
608
- return sibs;
609
- }
610
-
611
- // previous siblings
612
- function _getPreviousSiblings(el) {
613
- var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
614
- var sibs = [];
615
- while (el = el.previousSibling) {
616
- if (matches(el, filter)) {
617
- sibs.push(el);
618
- }
619
- }
620
- return sibs;
621
- }
622
-
623
- // parent and get all the siblings
624
- function _getAllSiblings(el) {
625
- var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
626
- var sibs = [];
627
- el = el.parentNode.firstChild;
628
- while (el = el.nextSibling) {
629
- if (matches(el, filter)) {
630
- sibs.push(el);
631
- }
632
- }
633
- return sibs;
634
- }
635
-
636
- // all parent nodes
637
- function _getParents(el) {
638
- var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
639
- var parents = [];
640
- while (el = el.parentNode) {
641
- if (matches(el, filter)) {
642
- parents.push(el);
643
- }
644
- }
645
- return parents;
646
- }
647
-
648
- // all child nodes
649
- function _getChildren(el) {
650
- var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
651
- var all = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
652
- all.push.apply(all, _toConsumableArray(el.childNodes));
653
- var _iterator = _createForOfIteratorHelper(el.childNodes),
654
- _step;
655
- try {
656
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
657
- var child = _step.value;
658
- _getChildren(child, filter, all);
659
- }
660
- } catch (err) {
661
- _iterator.e(err);
662
- } finally {
663
- _iterator.f();
664
- }
665
- var res = all.filter(function (item) {
666
- return matches(item, filter);
667
- });
668
- return res;
669
- }
670
- function _isRootElement(element) {
671
- return element.matches('html,body');
672
- }
673
- function _getDocument(node) {
674
- if (typeof node === 'undefined') {
675
- return document;
676
- } else {
677
- return node.ownerDocument;
678
- }
679
- }
680
- function _isNode(value) {
681
- return value instanceof Node;
682
- }
683
- function _isElement(value) {
684
- return value instanceof Element;
685
- }
686
- function _isHTMLElement(value) {
687
- return value instanceof HTMLElement;
688
- }
689
- function _isShadowRoot(value) {
690
- // Browsers without `ShadowRoot` support.
691
- if (typeof ShadowRoot === 'undefined') {
692
- return false;
693
- }
694
- return value instanceof ShadowRoot;
695
- }
696
-
697
- /* console.log(nodeContains(document.body, document.getElementById('obj'))) */
698
- function _nodeContains(parent, child) {
699
- var _child$getRootNode;
700
- if (!parent || !child) {
701
- return false;
702
- }
703
- var rootNode = (_child$getRootNode = child.getRootNode) === null || _child$getRootNode === void 0 ? void 0 : _child$getRootNode.call(child);
704
-
705
- // First, attempt with faster native method
706
- if (parent.contains(child)) {
707
- return true;
708
- }
709
-
710
- // then fallback to custom implementation with Shadow DOM support
711
- if (rootNode && _isShadowRoot(rootNode)) {
712
- var next = child;
713
- while (next) {
714
- if (parent === next) {
715
- return true;
716
- }
717
- // @ts-ignore
718
- next = next.parentNode || next.host;
719
- }
720
- }
721
-
722
- // Give up, the result is false
723
- return false;
2171
+ /**
2172
+ * Convert array value to string separated by curly braces
2173
+ * @param {String[]} arr such as: ['1','2','3']
2174
+ * @returns {String} such as: {1}{2}{3}
2175
+ */
2176
+ function _convertArrToValByBraces(arr) {
2177
+ if (!Array.isArray(arr)) return '';
2178
+ return arr.map(function (v) {
2179
+ return v.toString().includes('{') && v.toString().includes('}') ? "".concat(v) : "{".concat(v, "}");
2180
+ }).join('');
724
2181
  }
725
2182
 
726
2183
  /******/
@@ -1147,460 +2604,106 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1147
2604
  /******/Object.defineProperty(exports, Symbol.toStringTag, {
1148
2605
  value: 'Module'
1149
2606
  });
1150
- /******/
1151
- }
1152
- /******/
1153
- Object.defineProperty(exports, '__esModule', {
1154
- value: true
1155
- });
1156
- /******/
1157
- };
1158
- /******/
1159
- })();
1160
- /******/
1161
- /************************************************************************/
1162
- var __webpack_exports__ = {};
1163
- __nested_webpack_require_993__.r(__webpack_exports__);
1164
- /* harmony export */
1165
- __nested_webpack_require_993__.d(__webpack_exports__, {
1166
- /* harmony export */"deepClone": function deepClone() {
1167
- return (/* binding */_deepClone
1168
- );
1169
- },
1170
- /* harmony export */"flatData": function flatData() {
1171
- return (/* binding */_flatData
1172
- );
1173
- },
1174
- /* harmony export */"removeArrDuplicateItems": function removeArrDuplicateItems() {
1175
- return (/* binding */_removeArrDuplicateItems
1176
- );
1177
- }
1178
- /* harmony export */
1179
- });
1180
- function _typeof(obj) {
1181
- "@babel/helpers - typeof";
1182
-
1183
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1184
- return typeof obj;
1185
- } : function (obj) {
1186
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1187
- }, _typeof(obj);
1188
- }
1189
- /**
1190
- * Remove Duplicate objects from JSON Array
1191
- * @param {Array} obj
1192
- * @param {String} fieldName
1193
- */
1194
- function _removeArrDuplicateItems(obj, fieldName) {
1195
- if (!Array.isArray(obj)) return [];
1196
- var clean = obj.filter(function (item, index, self) {
1197
- return index === self.findIndex(function (t) {
1198
- return t[fieldName] === item[fieldName];
1199
- });
1200
- });
1201
- return clean;
1202
- }
1203
- ;
1204
-
1205
- /**
1206
- * Deep clone
1207
- * @param {*} obj
1208
- */
1209
- function _deepClone(obj) {
1210
- if (Array.isArray(obj)) {
1211
- return obj.map(function (item) {
1212
- return _deepClone(item);
1213
- });
1214
- } else if (_typeof(obj) === 'object' && obj !== null) {
1215
- var clone = {};
1216
- for (var key in obj) {
1217
- if (obj.hasOwnProperty(key)) {
1218
- clone[key] = _deepClone(obj[key]);
1219
- }
1220
- }
1221
- return clone;
1222
- } else {
1223
- return obj;
1224
- }
1225
- }
1226
-
1227
- /**
1228
- * Flat Data
1229
- * @param {*} data
1230
- * @returns
1231
- */
1232
- function _flatData(data) {
1233
- var result = [];
1234
- var iterate = function iterate(obj) {
1235
- if (!obj) {
1236
- return;
1237
- }
1238
- obj.forEach(function (item) {
1239
- result.push(item);
1240
- if (item.children) {
1241
- iterate(item.children);
1242
- }
1243
-
1244
- // delete current item children
1245
- delete item.children;
1246
- });
1247
- };
1248
- iterate(data);
1249
- return result;
1250
- }
1251
-
1252
- /******/
1253
- return __webpack_exports__;
1254
- /******/
1255
- }()
1256
- );
1257
- });
1258
-
1259
- /***/ }),
1260
-
1261
- /***/ 438:
1262
- /***/ (function(module, exports, __webpack_require__) {
1263
-
1264
- /* module decorator */ module = __webpack_require__.nmd(module);
1265
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof2(obj); }
1266
- (function webpackUniversalModuleDefinition(root, factory) {
1267
- if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
1268
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
1269
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
1270
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
1271
- })(this, function () {
1272
- return (/******/function () {
1273
- // webpackBootstrap
1274
- /******/
1275
- "use strict";
1276
-
1277
- /******/ // The require scope
1278
- /******/
1279
- var __nested_webpack_require_993__ = {};
1280
- /******/
1281
- /************************************************************************/
1282
- /******/ /* webpack/runtime/define property getters */
1283
- /******/
1284
- (function () {
1285
- /******/ // define getter functions for harmony exports
1286
- /******/__nested_webpack_require_993__.d = function (exports, definition) {
1287
- /******/for (var key in definition) {
1288
- /******/if (__nested_webpack_require_993__.o(definition, key) && !__nested_webpack_require_993__.o(exports, key)) {
1289
- /******/Object.defineProperty(exports, key, {
1290
- enumerable: true,
1291
- get: definition[key]
1292
- });
1293
- /******/
1294
- }
1295
- /******/
1296
- }
1297
- /******/
1298
- };
1299
- /******/
1300
- })();
1301
- /******/
1302
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
1303
- /******/
1304
- (function () {
1305
- /******/__nested_webpack_require_993__.o = function (obj, prop) {
1306
- return Object.prototype.hasOwnProperty.call(obj, prop);
1307
- };
1308
- /******/
1309
- })();
1310
- /******/
1311
- /******/ /* webpack/runtime/make namespace object */
1312
- /******/
1313
- (function () {
1314
- /******/ // define __esModule on exports
1315
- /******/__nested_webpack_require_993__.r = function (exports) {
1316
- /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1317
- /******/Object.defineProperty(exports, Symbol.toStringTag, {
1318
- value: 'Module'
1319
- });
1320
- /******/
1321
- }
1322
- /******/
1323
- Object.defineProperty(exports, '__esModule', {
1324
- value: true
1325
- });
1326
- /******/
1327
- };
1328
- /******/
1329
- })();
1330
- /******/
1331
- /************************************************************************/
1332
- var __webpack_exports__ = {};
1333
- __nested_webpack_require_993__.r(__webpack_exports__);
1334
- /* harmony export */
1335
- __nested_webpack_require_993__.d(__webpack_exports__, {
1336
- /* harmony export */"addTreeDepth": function addTreeDepth() {
1337
- return (/* binding */_addTreeDepth
1338
- );
1339
- },
1340
- /* harmony export */"addTreeIndent": function addTreeIndent() {
1341
- return (/* binding */_addTreeIndent
1342
- );
1343
- },
1344
- /* harmony export */"convertTree": function convertTree() {
1345
- return (/* binding */_convertTree
1346
- );
1347
- },
1348
- /* harmony export */"flatTree": function flatTree() {
1349
- return (/* binding */_flatTree
1350
- );
1351
- },
1352
- /* harmony export */"getAllDepth": function getAllDepth() {
1353
- return (/* binding */_getAllDepth
1354
- );
1355
- }
1356
- /* harmony export */
1357
- });
1358
- function _typeof(obj) {
1359
- "@babel/helpers - typeof";
1360
-
1361
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1362
- return typeof obj;
1363
- } : function (obj) {
1364
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1365
- }, _typeof(obj);
1366
- }
1367
- var _excluded = ["children"];
1368
- function _objectWithoutProperties(source, excluded) {
1369
- if (source == null) return {};
1370
- var target = _objectWithoutPropertiesLoose(source, excluded);
1371
- var key, i;
1372
- if (Object.getOwnPropertySymbols) {
1373
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
1374
- for (i = 0; i < sourceSymbolKeys.length; i++) {
1375
- key = sourceSymbolKeys[i];
1376
- if (excluded.indexOf(key) >= 0) continue;
1377
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
1378
- target[key] = source[key];
1379
- }
1380
- }
1381
- return target;
1382
- }
1383
- function _objectWithoutPropertiesLoose(source, excluded) {
1384
- if (source == null) return {};
1385
- var target = {};
1386
- var sourceKeys = Object.keys(source);
1387
- var key, i;
1388
- for (i = 0; i < sourceKeys.length; i++) {
1389
- key = sourceKeys[i];
1390
- if (excluded.indexOf(key) >= 0) continue;
1391
- target[key] = source[key];
1392
- }
1393
- return target;
1394
- }
1395
- function ownKeys(object, enumerableOnly) {
1396
- var keys = Object.keys(object);
1397
- if (Object.getOwnPropertySymbols) {
1398
- var symbols = Object.getOwnPropertySymbols(object);
1399
- enumerableOnly && (symbols = symbols.filter(function (sym) {
1400
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1401
- })), keys.push.apply(keys, symbols);
1402
- }
1403
- return keys;
1404
- }
1405
- function _objectSpread(target) {
1406
- for (var i = 1; i < arguments.length; i++) {
1407
- var source = null != arguments[i] ? arguments[i] : {};
1408
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
1409
- _defineProperty(target, key, source[key]);
1410
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
1411
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1412
- });
1413
- }
1414
- return target;
1415
- }
1416
- function _defineProperty(obj, key, value) {
1417
- key = _toPropertyKey(key);
1418
- if (key in obj) {
1419
- Object.defineProperty(obj, key, {
1420
- value: value,
1421
- enumerable: true,
1422
- configurable: true,
1423
- writable: true
1424
- });
1425
- } else {
1426
- obj[key] = value;
1427
- }
1428
- return obj;
1429
- }
1430
- function _toPropertyKey(arg) {
1431
- var key = _toPrimitive(arg, "string");
1432
- return _typeof(key) === "symbol" ? key : String(key);
1433
- }
1434
- function _toPrimitive(input, hint) {
1435
- if (_typeof(input) !== "object" || input === null) return input;
1436
- var prim = input[Symbol.toPrimitive];
1437
- if (prim !== undefined) {
1438
- var res = prim.call(input, hint || "default");
1439
- if (_typeof(res) !== "object") return res;
1440
- throw new TypeError("@@toPrimitive must return a primitive value.");
1441
- }
1442
- return (hint === "string" ? String : Number)(input);
1443
- }
1444
- function _toConsumableArray(arr) {
1445
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
1446
- }
1447
- function _nonIterableSpread() {
1448
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1449
- }
1450
- function _unsupportedIterableToArray(o, minLen) {
1451
- if (!o) return;
1452
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1453
- var n = Object.prototype.toString.call(o).slice(8, -1);
1454
- if (n === "Object" && o.constructor) n = o.constructor.name;
1455
- if (n === "Map" || n === "Set") return Array.from(o);
1456
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1457
- }
1458
- function _iterableToArray(iter) {
1459
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1460
- }
1461
- function _arrayWithoutHoles(arr) {
1462
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
1463
- }
1464
- function _arrayLikeToArray(arr, len) {
1465
- if (len == null || len > arr.length) len = arr.length;
1466
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
1467
- return arr2;
1468
- }
1469
- function _objectDestructuringEmpty(obj) {
1470
- if (obj == null) throw new TypeError("Cannot destructure " + obj);
1471
- }
1472
- function _extends() {
1473
- _extends = Object.assign ? Object.assign.bind() : function (target) {
1474
- for (var i = 1; i < arguments.length; i++) {
1475
- var source = arguments[i];
1476
- for (var key in source) {
1477
- if (Object.prototype.hasOwnProperty.call(source, key)) {
1478
- target[key] = source[key];
1479
- }
1480
- }
2607
+ /******/
1481
2608
  }
1482
- return target;
1483
- };
1484
- return _extends.apply(this, arguments);
1485
- }
1486
- /**
1487
- * Convert Tree
1488
- * @param {Array} arr - Flat array
1489
- * @param {?string | ?number} parentId - Parent id
1490
- * @param {?string} keyId - Key value of id.
1491
- * @param {?string} keyParentId - Key value of parent id.
1492
- * @returns Array
1493
- */
1494
- function _convertTree(arr) {
1495
- var parentId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1496
- var keyId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';
1497
- var keyParentId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'parent_id';
1498
- if (!parentId) {
1499
- // If there is no parent id (when recursing for the first time), all parents will be queried
1500
- return arr.filter(function (item) {
1501
- return !item[keyParentId];
1502
- }).map(function (item) {
1503
- // Query all child nodes by parent node ID
1504
- item.children = _convertTree(arr, item[keyId], keyId, keyParentId);
1505
- return item;
1506
- });
1507
- } else {
1508
- return arr.filter(function (item) {
1509
- return item[keyParentId] === parentId;
1510
- }).map(function (item) {
1511
- // Query all child nodes by parent node ID
1512
- item.children = _convertTree(arr, item[keyId], keyId, keyParentId);
1513
- return item;
2609
+ /******/
2610
+ Object.defineProperty(exports, '__esModule', {
2611
+ value: true
1514
2612
  });
2613
+ /******/
2614
+ };
2615
+ /******/
2616
+ })();
2617
+ /******/
2618
+ /************************************************************************/
2619
+ var __webpack_exports__ = {};
2620
+ __nested_webpack_require_993__.r(__webpack_exports__);
2621
+ /* harmony export */
2622
+ __nested_webpack_require_993__.d(__webpack_exports__, {
2623
+ /* harmony export */"deepClone": function deepClone() {
2624
+ return (/* binding */_deepClone
2625
+ );
2626
+ },
2627
+ /* harmony export */"flatData": function flatData() {
2628
+ return (/* binding */_flatData
2629
+ );
2630
+ },
2631
+ /* harmony export */"removeArrDuplicateItems": function removeArrDuplicateItems() {
2632
+ return (/* binding */_removeArrDuplicateItems
2633
+ );
1515
2634
  }
1516
- }
2635
+ /* harmony export */
2636
+ });
2637
+ function _typeof(obj) {
2638
+ "@babel/helpers - typeof";
1517
2639
 
2640
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
2641
+ return typeof obj;
2642
+ } : function (obj) {
2643
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2644
+ }, _typeof(obj);
2645
+ }
1518
2646
  /**
1519
- * Flat tree
1520
- * @param {Array} arr - Hierarchical array
1521
- * @returns Array
2647
+ * Remove Duplicate objects from JSON Array
2648
+ * @param {Array} obj
2649
+ * @param {String} fieldName
1522
2650
  */
1523
- function _flatTree(arr) {
1524
- var flatData = function flatData(_ref) {
1525
- var rest = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
1526
- var _rest$children = rest.children,
1527
- children = _rest$children === void 0 ? [] : _rest$children;
1528
- return [_objectSpread({}, rest)].concat(_toConsumableArray(children.flatMap(flatData)));
1529
- };
1530
- var result = arr.flatMap(flatData);
1531
-
1532
- //remove children from item
1533
- result = result.map(function (item) {
1534
- delete item.children;
1535
- return item;
2651
+ function _removeArrDuplicateItems(obj, fieldName) {
2652
+ if (!Array.isArray(obj)) return [];
2653
+ var clean = obj.filter(function (item, index, self) {
2654
+ return index === self.findIndex(function (t) {
2655
+ return t[fieldName] === item[fieldName];
2656
+ });
1536
2657
  });
1537
- return result;
2658
+ return clean;
1538
2659
  }
2660
+ ;
1539
2661
 
1540
2662
  /**
1541
- * Get all depth
1542
- * @param {Object} node
1543
- * @returns Number
2663
+ * Deep clone
2664
+ * @param {*} obj
1544
2665
  */
1545
- function _getAllDepth(arr) {
1546
- var count = function count(children) {
1547
- return children.reduce(function (depth, child) {
1548
- return Math.max(depth, 1 + count(child.children)); // increment depth of children by 1, and compare it with accumulated depth of other children within the same element
1549
- }, 0); //default value 0 that's returned if there are no children
1550
- };
1551
-
1552
- return count(arr);
1553
- }
1554
-
1555
- /**
1556
- * Add depth to each item in the tree
1557
- * @param {Array} arr - Hierarchical array
1558
- * @param {?string} keyId - Key value of id.
1559
- * @param {?string} keyParentId - Key value of parent id.
1560
- * @param {?number} depth - Depth of the item.
1561
- * @returns Number
1562
- */
1563
- function _addTreeDepth(arr) {
1564
- var keyId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';
1565
- var parentItem = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
1566
- var depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1567
- return arr.reduce(function (acc, el) {
1568
- var children = el.children,
1569
- otherProps = _objectWithoutProperties(el, _excluded);
1570
- acc.push(_objectSpread(_objectSpread({}, otherProps), {}, {
1571
- parentItem: parentItem,
1572
- depth: depth
1573
- }));
1574
- if (children) {
1575
- return acc.concat(_addTreeDepth(children, keyId, el[keyId], depth + 1));
2666
+ function _deepClone(obj) {
2667
+ if (Array.isArray(obj)) {
2668
+ return obj.map(function (item) {
2669
+ return _deepClone(item);
2670
+ });
2671
+ } else if (_typeof(obj) === 'object' && obj !== null) {
2672
+ var clone = {};
2673
+ for (var key in obj) {
2674
+ if (obj.hasOwnProperty(key)) {
2675
+ clone[key] = _deepClone(obj[key]);
2676
+ }
1576
2677
  }
1577
- return acc;
1578
- }, []);
2678
+ return clone;
2679
+ } else {
2680
+ return obj;
2681
+ }
1579
2682
  }
1580
2683
 
1581
2684
  /**
1582
- * Add indent placeholder
1583
- * @param {Array} arr - Flat array
1584
- * @param {?string} placeholder - String of placeholder
1585
- * @param {?string} lastPlaceholder - Last String of placeholder
1586
- * @param {?string} keyName - Key value of name.
1587
- * @returns Array
2685
+ * Flat Data
2686
+ * @param {*} data
2687
+ * @returns
1588
2688
  */
1589
- function _addTreeIndent(arr) {
1590
- var placeholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '&nbsp;&nbsp;&nbsp;&nbsp;';
1591
- var lastPlaceholder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
1592
- var keyName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'label';
1593
- arr.forEach(function (item) {
1594
- var indent = '';
1595
- if (item.depth) {
1596
- Array(item.depth).fill(0).forEach(function (k, i) {
1597
- indent += placeholder;
1598
- if (i === item.depth - 1) {
1599
- item[keyName] = indent + lastPlaceholder + item[keyName];
1600
- }
1601
- });
2689
+ function _flatData(data) {
2690
+ var result = [];
2691
+ var iterate = function iterate(obj) {
2692
+ if (!obj) {
2693
+ return;
1602
2694
  }
1603
- });
2695
+ obj.forEach(function (item) {
2696
+ result.push(item);
2697
+ if (item.children) {
2698
+ iterate(item.children);
2699
+ }
2700
+
2701
+ // delete current item children
2702
+ delete item.children;
2703
+ });
2704
+ };
2705
+ iterate(data);
2706
+ return result;
1604
2707
  }
1605
2708
 
1606
2709
  /******/
@@ -1883,13 +2986,14 @@ __webpack_require__.d(__webpack_exports__, {
1883
2986
  // EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
1884
2987
  var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(787);
1885
2988
  var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
2989
+ // EXTERNAL MODULE: ../DragDropList/dist/cjs/index.js
2990
+ var cjs = __webpack_require__(954);
2991
+ var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
1886
2992
  // EXTERNAL MODULE: ../Utils/dist/cjs/useComId.js
1887
2993
  var useComId = __webpack_require__(85);
1888
2994
  var useComId_default = /*#__PURE__*/__webpack_require__.n(useComId);
1889
2995
  // EXTERNAL MODULE: ../Utils/dist/cjs/initDefaultOptions.js
1890
2996
  var initDefaultOptions = __webpack_require__(186);
1891
- // EXTERNAL MODULE: ../Utils/dist/cjs/tree.js
1892
- var tree = __webpack_require__(438);
1893
2997
  // EXTERNAL MODULE: ../Utils/dist/cjs/extract.js
1894
2998
  var extract = __webpack_require__(135);
1895
2999
  // EXTERNAL MODULE: ../Utils/dist/cjs/convert.js
@@ -1937,276 +3041,54 @@ function multiSelControlOptionExist(arr, val) {
1937
3041
  function uniqueArr(arr) {
1938
3042
  return arr.filter(function (item, index, self) {
1939
3043
  return index === self.findIndex(function (t) {
1940
- return t.value === item.value;
3044
+ return t.id == item.id;
1941
3045
  });
1942
3046
  });
1943
3047
  }
1944
- // EXTERNAL MODULE: ../Utils/dist/cjs/dom.js
1945
- var dom = __webpack_require__(997);
1946
- ;// CONCATENATED MODULE: ./src/ItemList.tsx
1947
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1948
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1949
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
1950
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1951
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1952
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
1953
-
1954
-
1955
3048
 
1956
-
1957
-
1958
- /* Recursively nested components to traverse nodes
1959
- -------------------------------------------------*/
1960
-
1961
- var ItemList = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, externalRef) {
1962
- var appendControl = props.appendControl,
1963
- root = props.root,
1964
- listContainerClassName = props.listContainerClassName,
1965
- valSelected = props.valSelected,
1966
- indentStr = props.indentStr,
1967
- iconAdd = props.iconAdd,
1968
- iconRemove = props.iconRemove,
1969
- selected = props.selected,
1970
- onSelect = props.onSelect,
1971
- alternateCollapse = props.alternateCollapse,
1972
- first = props.first,
1973
- arrow = props.arrow,
1974
- childClassName = props.childClassName,
1975
- data = props.data;
1976
- var listContainerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
1977
- var activeClass = function activeClass(el, mode) {
1978
- var classname = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'active';
1979
- if (mode === 'add') {
1980
- el.classList.add(classname);
1981
- } else {
1982
- el.classList.remove(classname);
1983
- }
1984
- };
1985
- var closeChild = function closeChild(hyperlink, ul) {
1986
- if (ul.length === 0) return;
1987
- activeClass(hyperlink, 'remove');
1988
- hyperlink.setAttribute('aria-expanded', 'false');
1989
- activeClass(hyperlink.parentNode, 'remove');
1990
-
1991
- //to close
1992
- [].slice.call(ul).forEach(function (element) {
1993
- element.style.maxHeight = 0;
3049
+ /**
3050
+ * Remove Duplicate objects from Options
3051
+ * @param {Array} arr
3052
+ * @returns
3053
+ */
3054
+ function uniqueOpt(arr) {
3055
+ return arr.flat().filter(function (item, index, self) {
3056
+ return index === self.findIndex(function (t) {
3057
+ return t.id === item.id;
1994
3058
  });
1995
- };
1996
- var openChild = function openChild(hyperlink, ul) {
1997
- if (ul.length === 0) return;
1998
- activeClass(hyperlink, 'add');
1999
- hyperlink.setAttribute('aria-expanded', 'true');
2000
- activeClass(hyperlink.parentNode, 'add');
2001
-
2002
- // init <ul> height
2003
- [].slice.call(ul).forEach(function (_curUl) {
2004
- var allHeight = [].slice.call(_curUl.querySelectorAll('li')).map(function (_curLi) {
2005
- return _curLi.scrollHeight;
2006
- });
2007
-
2008
- // Prevent missing height, causing the last element to be clipped
2009
- var maxHeight = Math.max.apply(Math, _toConsumableArray(allHeight));
2010
- allHeight.push(maxHeight * 3);
2011
-
2012
- //
2013
- var totalHeight = allHeight.reduce(function (accumulator, currentValue) {
2014
- return accumulator + currentValue;
2015
- }, 0);
3059
+ });
3060
+ }
2016
3061
 
2017
- // Prevent the use of iframe or other situations where the height is 0
2018
- _curUl.style.maxHeight = "".concat(totalHeight == 0 ? 999 : totalHeight, "px");
3062
+ /**
3063
+ * Sort JSON arrays according to the order of the numeric arrays
3064
+ * @param {Array<Number>|Array<String>} orderArray
3065
+ * @param {Array<*>} arr
3066
+ * @param {String} field
3067
+ * @returns
3068
+ */
3069
+ function sortedJsonArray(orderArray, arr) {
3070
+ var field = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'value';
3071
+ return orderArray.map(function (orderId) {
3072
+ return arr.find(function (item) {
3073
+ return item[field] === orderId;
2019
3074
  });
2020
- };
2021
- function handleClick(e) {
2022
- e.preventDefault();
2023
- e.stopPropagation();
2024
- var hyperlink = e.currentTarget.querySelector('div');
2025
- var subElement = (0,dom.getNextSiblings)(hyperlink, 'ul');
2026
-
2027
- // hide child if expandedLink doesn't exist, on the contrary
2028
- //=====================
2029
- if (hyperlink.getAttribute('aria-expanded') === 'false' || hyperlink.getAttribute('aria-expanded') === null) {
2030
- //Hide all other siblings of the selected <ul>
2031
- if (alternateCollapse) {
2032
- [].slice.call(listContainerRef.current.children).forEach(function (li) {
2033
- activeClass(li, 'remove');
2034
- var _li = li.firstChild;
2035
- activeClass(_li, 'remove');
2036
- _li.setAttribute('aria-expanded', false);
2037
- [].slice.call((0,dom.getNextSiblings)(_li, 'ul')).forEach(function (element) {
2038
- element.style.maxHeight = 0;
2039
- });
2040
- });
2041
- }
2042
-
2043
- //open current
2044
- openChild(hyperlink, subElement);
2045
- } else {
2046
- //close current
2047
- closeChild(hyperlink, subElement);
2048
- }
2049
- }
2050
- function arrowGenerator() {
2051
- return arrow ? arrow : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
2052
- viewBox: "0 0 22 22",
2053
- width: "8px"
2054
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
2055
- d: "m345.44 248.29l-194.29 194.28c-12.359 12.365-32.397 12.365-44.75 0-12.354-12.354-12.354-32.391 0-44.744l171.91-171.91-171.91-171.9c-12.354-12.359-12.354-32.394 0-44.748 12.354-12.359 32.391-12.359 44.75 0l194.29 194.28c6.177 6.18 9.262 14.271 9.262 22.366 0 8.099-3.091 16.196-9.267 22.373",
2056
- transform: "matrix(.03541-.00013.00013.03541 2.98 3.02)",
2057
- fill: "#a5a5a5"
2058
- }));
2059
- }
2060
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
2061
- if (root !== null && data.length > 0) {
2062
- // Activate current item
2063
- //=====================
2064
- var allItems = listContainerRef.current ? [].slice.call(root.querySelectorAll(".".concat(childClassName, " div"))).map(function (item) {
2065
- var _item$parentNode$clas;
2066
- return {
2067
- el: item,
2068
- actived: (_item$parentNode$clas = item.parentNode.classList) !== null && _item$parentNode$clas !== void 0 && _item$parentNode$clas.contains('active') ? true : false,
2069
- expandedLink: document.body.contains(item.parentNode.parentNode.previousSibling) ? item.parentNode.parentNode.previousSibling : false
2070
- };
2071
- }) : [];
2072
- allItems.forEach(function (hyperlink) {
2073
- // Expand the currently active item by default
2074
- if (hyperlink.actived) {
2075
- hyperlink.el.setAttribute('aria-expanded', 'true');
2076
- if (hyperlink.expandedLink) {
2077
- var expandedLink = hyperlink.expandedLink; // <a>
2078
- activeClass(expandedLink.parentNode, 'add');
2079
- expandedLink.setAttribute('aria-expanded', true);
2080
- }
2081
-
2082
- // init <ul> height
2083
- var ul = (0,dom.getNextSiblings)(hyperlink.el, 'ul');
2084
- [].slice.call(ul).forEach(function (_curUl) {
2085
- var allHeight = [].slice.call(_curUl.querySelectorAll('li')).map(function (_curLi) {
2086
- return _curLi.scrollHeight;
2087
- });
2088
-
2089
- // Prevent missing height, causing the last element to be clipped
2090
- var maxHeight = Math.max.apply(Math, _toConsumableArray(allHeight));
2091
- allHeight.push(maxHeight * 3);
2092
-
2093
- //
2094
- var totalHeight = allHeight.reduce(function (accumulator, currentValue) {
2095
- return accumulator + currentValue;
2096
- }, 0);
2097
-
2098
- // Prevent the use of iframe or other situations where the height is 0
2099
- _curUl.style.maxHeight = "".concat(totalHeight == 0 ? 999 : totalHeight, "px");
2100
- });
2101
- }
2102
- });
2103
- }
2104
- }, [data]);
2105
- if (data) {
2106
- return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", {
2107
- className: "".concat(listContainerClassName || '', " ").concat(childClassName),
2108
- style: !first ? {
2109
- maxHeight: '0px'
2110
- } : {},
2111
- ref: function ref(node) {
2112
- listContainerRef.current = node;
2113
- if (typeof externalRef === 'function') {
2114
- externalRef(node);
2115
- } else if (externalRef) {
2116
- externalRef.current = node;
2117
- }
2118
- }
2119
- }, data ? data.map(function (item, i) {
2120
- // callback from each option
2121
- if (typeof item.appendControlCallback === 'function') {
2122
- setTimeout(function () {
2123
- var _item$appendControlCa;
2124
- (_item$appendControlCa = item.appendControlCallback) === null || _item$appendControlCa === void 0 ? void 0 : _item$appendControlCa.call(item);
2125
- }, 0);
2126
- }
2127
- return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
2128
- key: selected ? 'item-selected' + i : 'item' + i,
2129
- className: selected ? 'selected' : (0,cls.combinedCls)({
2130
- 'disabled': item.disabled,
2131
- 'hide': multiSelControlOptionExist(valSelected, item.value)
2132
- }),
2133
- "data-index": i,
2134
- "data-value": "".concat(item.value),
2135
- "data-label": "".concat(item.label),
2136
- "data-list-item-label": "".concat(typeof item.listItemLabel === 'undefined' ? '' : item.listItemLabel),
2137
- "data-disabled": item.disabled || 'false',
2138
- "data-querystring": "".concat(typeof item.queryString === 'undefined' ? '' : item.queryString),
2139
- "data-itemdata": JSON.stringify(item),
2140
- onClick: selected ? function () {
2141
- return void 0;
2142
- } : handleClick
2143
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("strong", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
2144
- dangerouslySetInnerHTML: {
2145
- __html: selected ? typeof item.listItemLabel === 'undefined' ? formatIndentVal(item.label, indentStr) : formatIndentVal(item.listItemLabel, indentStr) : typeof item.listItemLabel === 'undefined' ? item.label : item.listItemLabel
2146
- }
2147
- }), item.children && item.children.length > 0 && !selected ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
2148
- className: "arrow"
2149
- }, arrowGenerator()) : ''), selected && appendControl ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
2150
- className: "m-select__ext",
2151
- id: "m-select__ext-".concat(item.value).concat(selected ? '-selected' : '')
2152
- }, appendControl)) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("i", {
2153
- onClick: function onClick(e) {
2154
- e.stopPropagation();
2155
- onSelect(e.target.closest('li'), undefined);
2156
- }
2157
- }, selected ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, iconRemove ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, iconRemove) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
2158
- width: "15px",
2159
- height: "15px",
2160
- viewBox: "0 0 24 24",
2161
- fill: "none"
2162
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
2163
- fillRule: "evenodd",
2164
- clipRule: "evenodd",
2165
- d: "M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10ZM8 11a1 1 0 1 0 0 2h8a1 1 0 1 0 0-2H8Z",
2166
- fill: "#000"
2167
- })))) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, iconAdd ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, iconAdd) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
2168
- width: "15px",
2169
- height: "15px",
2170
- viewBox: "0 0 24 24",
2171
- fill: "none"
2172
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
2173
- d: "M12 2C6.49 2 2 6.49 2 12C2 17.51 6.49 22 12 22C17.51 22 22 17.51 22 12C22 6.49 17.51 2 12 2ZM16 12.75H12.75V16C12.75 16.41 12.41 16.75 12 16.75C11.59 16.75 11.25 16.41 11.25 16V12.75H8C7.59 12.75 7.25 12.41 7.25 12C7.25 11.59 7.59 11.25 8 11.25H11.25V8C11.25 7.59 11.59 7.25 12 7.25C12.41 7.25 12.75 7.59 12.75 8V11.25H16C16.41 11.25 16.75 11.59 16.75 12C16.75 12.41 16.41 12.75 16 12.75Z",
2174
- fill: "#000"
2175
- })))))), item.children && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(ItemList, {
2176
- root: root,
2177
- listContainerClassName: listContainerClassName,
2178
- ref: externalRef,
2179
- indentStr: indentStr,
2180
- valSelected: valSelected,
2181
- iconAdd: iconAdd,
2182
- iconRemove: iconRemove,
2183
- onSelect: onSelect,
2184
- first: false,
2185
- arrow: arrow,
2186
- data: item.children,
2187
- childClassName: childClassName
2188
- }));
2189
- }) : null));
2190
- } else {
2191
- return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null);
2192
- }
2193
- });
2194
- /* harmony default export */ const src_ItemList = (ItemList);
3075
+ });
3076
+ }
2195
3077
  ;// CONCATENATED MODULE: ./src/index.tsx
2196
- var _excluded = ["contentRef", "wrapperClassName", "childClassName", "wrapperMinHeight", "wrapperMinWidth", "availableHeaderTitle", "selectedHeaderTitle", "selectedHeaderNote", "selectedResultReverse", "removeAllBtnLabel", "addAllBtnLabel", "iconAdd", "iconRemove", "unattachedSelect", "hierarchical", "indentation", "doubleIndent", "alternateCollapse", "arrow", "options", "disabled", "required", "appendControl", "defaultValue", "value", "label", "name", "id", "extractValueByBrackets", "style", "data", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onAddAll", "onRemoveAll", "onChange"];
3078
+ var _excluded = ["contentRef", "wrapperClassName", "childClassName", "wrapperMinHeight", "wrapperMinWidth", "availableHeaderTitle", "selectedHeaderTitle", "selectedHeaderNote", "selectedResultReverse", "removeAllBtnLabel", "addAllBtnLabel", "iconAdd", "iconRemove", "unattachedSelect", "options", "disabled", "required", "defaultValue", "value", "label", "name", "id", "draggable", "handleHide", "handleIcon", "handlePos", "dragMode", "indentation", "doubleIndent", "alternateCollapse", "arrow", "extractValueByBrackets", "style", "data", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onAddAll", "onRemoveAll", "onChange"];
2197
3079
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
2198
3080
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2199
3081
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2200
- function src_toConsumableArray(arr) { return src_arrayWithoutHoles(arr) || src_iterableToArray(arr) || src_unsupportedIterableToArray(arr) || src_nonIterableSpread(); }
2201
- function src_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2202
- function src_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
2203
- function src_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return src_arrayLikeToArray(arr); }
3082
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3083
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3084
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
3085
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
2204
3086
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2205
3087
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
2206
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || src_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3088
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2207
3089
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2208
- function src_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return src_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return src_arrayLikeToArray(o, minLen); }
2209
- function src_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
3090
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3091
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
2210
3092
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
2211
3093
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2212
3094
  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; }
@@ -2220,7 +3102,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
2220
3102
 
2221
3103
 
2222
3104
 
2223
-
2224
3105
  var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, externalRef) {
2225
3106
  var contentRef = props.contentRef,
2226
3107
  wrapperClassName = props.wrapperClassName,
@@ -2237,20 +3118,36 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
2237
3118
  iconAdd = props.iconAdd,
2238
3119
  iconRemove = props.iconRemove,
2239
3120
  unattachedSelect = props.unattachedSelect,
2240
- hierarchical = props.hierarchical,
2241
- indentation = props.indentation,
2242
- doubleIndent = props.doubleIndent,
2243
- alternateCollapse = props.alternateCollapse,
2244
- arrow = props.arrow,
2245
3121
  options = props.options,
2246
3122
  disabled = props.disabled,
2247
3123
  required = props.required,
2248
- appendControl = props.appendControl,
2249
3124
  defaultValue = props.defaultValue,
2250
3125
  value = props.value,
2251
3126
  label = props.label,
2252
3127
  name = props.name,
2253
3128
  id = props.id,
3129
+ _props$draggable = props.draggable,
3130
+ draggable = _props$draggable === void 0 ? true : _props$draggable,
3131
+ _props$handleHide = props.handleHide,
3132
+ handleHide = _props$handleHide === void 0 ? false : _props$handleHide,
3133
+ _props$handleIcon = props.handleIcon,
3134
+ handleIcon = _props$handleIcon === void 0 ? '☰' : _props$handleIcon,
3135
+ _props$handlePos = props.handlePos,
3136
+ handlePos = _props$handlePos === void 0 ? 'left' : _props$handlePos,
3137
+ _props$dragMode = props.dragMode,
3138
+ dragMode = _props$dragMode === void 0 ? 'handle' : _props$dragMode,
3139
+ indentation = props.indentation,
3140
+ doubleIndent = props.doubleIndent,
3141
+ alternateCollapse = props.alternateCollapse,
3142
+ _props$arrow = props.arrow,
3143
+ arrow = _props$arrow === void 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
3144
+ viewBox: "0 0 22 22",
3145
+ width: "8px"
3146
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
3147
+ d: "m345.44 248.29l-194.29 194.28c-12.359 12.365-32.397 12.365-44.75 0-12.354-12.354-12.354-32.391 0-44.744l171.91-171.91-171.91-171.9c-12.354-12.359-12.354-32.394 0-44.748 12.354-12.359 32.391-12.359 44.75 0l194.29 194.28c6.177 6.18 9.262 14.271 9.262 22.366 0 8.099-3.091 16.196-9.267 22.373",
3148
+ transform: "matrix(.03541-.00013.00013.03541 2.98 3.02)",
3149
+ fill: "#a5a5a5"
3150
+ }))) : _props$arrow,
2254
3151
  extractValueByBrackets = props.extractValueByBrackets,
2255
3152
  style = props.style,
2256
3153
  data = props.data,
@@ -2263,18 +3160,15 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
2263
3160
  onRemoveAll = props.onRemoveAll,
2264
3161
  onChange = props.onChange,
2265
3162
  attributes = _objectWithoutProperties(props, _excluded);
2266
- var UN_ATTACHED_SELECT = typeof unattachedSelect === 'undefined' || unattachedSelect === false ? false : true;
3163
+ var UNATTACHED_SELECT = typeof unattachedSelect === 'undefined' || unattachedSelect === false ? false : true;
2267
3164
  var WRAPPER_MIN_H = typeof wrapperMinHeight === 'undefined' ? '' : wrapperMinHeight;
2268
3165
  var WRAPPER_MIN_W = typeof wrapperMinWidth === 'undefined' ? '' : wrapperMinWidth;
2269
- var INDENT_PLACEHOLDER = doubleIndent ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" : "&nbsp;&nbsp;&nbsp;&nbsp;";
2270
- var INDENT_LAST_PLACEHOLDER = "".concat(typeof indentation !== 'undefined' && indentation !== '' ? "".concat(indentation, "&nbsp;&nbsp;") : '');
2271
3166
  var VALUE_BY_BRACKETS = typeof extractValueByBrackets === 'undefined' ? true : extractValueByBrackets;
2272
3167
  var uniqueID = useComId_default()();
2273
3168
  var idRes = id || uniqueID;
2274
3169
  var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
2275
3170
  var inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
2276
3171
  var availableListRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
2277
- var selectedListRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
2278
3172
  var optionsRes = options ? (0,initDefaultOptions.isJSON)(options) ? JSON.parse(options) : options : [];
2279
3173
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
2280
3174
  _useState2 = _slicedToArray(_useState, 2),
@@ -2285,45 +3179,122 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
2285
3179
  valSelected = _useState4[0],
2286
3180
  setValSelected = _useState4[1];
2287
3181
 
3182
+ // temp default value
3183
+ var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(undefined),
3184
+ _useState6 = _slicedToArray(_useState5, 2),
3185
+ tempDefaultValue = _useState6[0],
3186
+ setTempDefaultValue = _useState6[1];
3187
+
2288
3188
  // return a array of options
2289
3189
  var optionsDataInit = optionsRes;
2290
3190
 
2291
3191
  //
2292
- var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
2293
- _useState6 = _slicedToArray(_useState5, 2),
2294
- changedSearchVal = _useState6[0],
2295
- setChangedSearchVal = _useState6[1];
3192
+ var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
3193
+ _useState8 = _slicedToArray(_useState7, 2),
3194
+ changedSearchVal = _useState8[0],
3195
+ setChangedSearchVal = _useState8[1];
2296
3196
 
2297
3197
  //
2298
- var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(optionsDataInit),
2299
- _useState8 = _slicedToArray(_useState7, 2),
2300
- dataInit = _useState8[0],
2301
- setDataInit = _useState8[1];
2302
- var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
3198
+ var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(optionsDataInit),
2303
3199
  _useState10 = _slicedToArray(_useState9, 2),
2304
- hasErr = _useState10[0],
2305
- setHasErr = _useState10[1];
3200
+ dataInit = _useState10[0],
3201
+ setDataInit = _useState10[1];
3202
+ var _useState11 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
3203
+ _useState12 = _slicedToArray(_useState11, 2),
3204
+ hasErr = _useState12[0],
3205
+ setHasErr = _useState12[1];
2306
3206
 
2307
3207
  // exposes the following methods
2308
-
2309
3208
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(contentRef, function () {
2310
3209
  return {
2311
3210
  clear: function clear(cb) {
2312
- initDefaultValue('', dataInit);
3211
+ var _params = fetchFuncMethodParams || [];
3212
+ fetchData(_params.join(','), '');
2313
3213
  cb === null || cb === void 0 ? void 0 : cb();
2314
3214
  },
2315
- /*
2316
- set([{"label": "Option 1","listItemLabel":"Option 1 (No: 001)","value": "value-1","queryString": "option1"}], () => { console.log('callback') }])
2317
- */
2318
3215
  set: function set(inputData, cb) {
2319
3216
  if (!Array.isArray(inputData)) return;
2320
- initDefaultValue(inputData.map(function (v) {
3217
+ var _params = fetchFuncMethodParams || [];
3218
+ fetchData(_params.join(','), inputData.map(function (v) {
2321
3219
  return "[".concat(v.value, "]");
2322
- }).join(''), dataInit);
3220
+ }).join(''));
2323
3221
  cb === null || cb === void 0 ? void 0 : cb();
2324
3222
  }
2325
3223
  };
2326
- }, [contentRef, dataInit]);
3224
+ }, [contentRef]);
3225
+ var getExtControll = function getExtControll(index, id, value, extendedContent, defaultValue) {
3226
+ var forceItemSelected = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
3227
+ var itemSelected = false;
3228
+ if (typeof defaultValue !== 'undefined' && defaultValue !== '') {
3229
+ var _val = VALUE_BY_BRACKETS ? (0,extract.extractContentsOfBrackets)(defaultValue) : defaultValue.trim().replace(/^\,|\,$/g, '').split(',');
3230
+ if (Array.isArray(_val) && _val.includes(String(value))) {
3231
+ itemSelected = true;
3232
+ }
3233
+ }
3234
+ if (typeof forceItemSelected !== 'undefined') itemSelected = forceItemSelected;
3235
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3236
+ style: {
3237
+ paddingLeft: '1rem',
3238
+ width: '100%',
3239
+ display: 'flex',
3240
+ alignItems: 'center',
3241
+ justifyContent: 'end'
3242
+ }
3243
+ }, extendedContent ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
3244
+ className: "m-select-v2__ext",
3245
+ id: "m-select-v2__ext-".concat(id).concat(itemSelected ? '-selected' : '')
3246
+ }, extendedContent)) : null, itemSelected ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
3247
+ href: "#",
3248
+ onClick: function onClick(e) {
3249
+ e.preventDefault();
3250
+ e.stopPropagation();
3251
+
3252
+ // remove
3253
+ removeItem(id);
3254
+ }
3255
+ }, iconRemove ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, iconRemove) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
3256
+ width: "15px",
3257
+ height: "15px",
3258
+ viewBox: "0 0 24 24",
3259
+ fill: "none"
3260
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
3261
+ fillRule: "evenodd",
3262
+ clipRule: "evenodd",
3263
+ d: "M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10ZM8 11a1 1 0 1 0 0 2h8a1 1 0 1 0 0-2H8Z",
3264
+ fill: "#000"
3265
+ }))))) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
3266
+ href: "#",
3267
+ onClick: function onClick(e) {
3268
+ e.preventDefault();
3269
+ e.stopPropagation();
3270
+
3271
+ // add
3272
+ selectItem(id);
3273
+ }
3274
+ }, iconAdd ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, iconAdd) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
3275
+ width: "15px",
3276
+ height: "15px",
3277
+ viewBox: "0 0 24 24",
3278
+ fill: "none"
3279
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
3280
+ d: "M12 2C6.49 2 2 6.49 2 12C2 17.51 6.49 22 12 22C17.51 22 22 17.51 22 12C22 6.49 17.51 2 12 2ZM16 12.75H12.75V16C12.75 16.41 12.41 16.75 12 16.75C11.59 16.75 11.25 16.41 11.25 16V12.75H8C7.59 12.75 7.25 12.41 7.25 12C7.25 11.59 7.59 11.25 8 11.25H11.25V8C11.25 7.59 11.59 7.25 12 7.25C12.41 7.25 12.75 7.59 12.75 8V11.25H16C16.41 11.25 16.75 11.59 16.75 12C16.75 12.41 16.41 12.75 16 12.75Z",
3281
+ fill: "#000"
3282
+ })))))));
3283
+ };
3284
+ var dragdropListDataInit = function dragdropListDataInit(data) {
3285
+ // Add appendControl to list
3286
+ data.forEach(function (item, index) {
3287
+ item.appendControl = getExtControll(index, item.id, item.value, item.extendedContent, tempDefaultValue);
3288
+ });
3289
+ return data;
3290
+ };
3291
+ var dragdropListDefaultDataInit = function dragdropListDefaultDataInit(data) {
3292
+ // Update appendControl to list
3293
+ data.forEach(function (item, index) {
3294
+ item.appendControl = getExtControll(index, item.id, item.value, item.extendedContent, tempDefaultValue, false);
3295
+ });
3296
+ return data;
3297
+ };
2327
3298
  function fetchData(_x2, _x3) {
2328
3299
  return _fetchData.apply(this, arguments);
2329
3300
  }
@@ -2342,7 +3313,7 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
2342
3313
  break;
2343
3314
  }
2344
3315
  _context.next = 4;
2345
- return fetchFuncAsync["".concat(fetchFuncMethod)].apply(fetchFuncAsync, src_toConsumableArray(params.split(',')));
3316
+ return fetchFuncAsync["".concat(fetchFuncMethod)].apply(fetchFuncAsync, _toConsumableArray(params.split(',')));
2346
3317
  case 4:
2347
3318
  response = _context.sent;
2348
3319
  _ORGIN_DATA = response.data; // reset data structure
@@ -2357,15 +3328,12 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
2357
3328
  _ORGIN_DATA = [];
2358
3329
  }
2359
3330
 
2360
- // Set hierarchical categories ( with sub-categories )
2361
- if (hierarchical) {
2362
- _ORGIN_DATA = (0,tree.addTreeDepth)(_ORGIN_DATA);
2363
- (0,tree.addTreeIndent)(_ORGIN_DATA, INDENT_PLACEHOLDER, INDENT_LAST_PLACEHOLDER, 'label');
2364
- }
2365
-
2366
3331
  // remove Duplicate objects from JSON Array
2367
3332
  _ORGIN_DATA = (0,object.removeArrDuplicateItems)(_ORGIN_DATA, 'value');
2368
3333
 
3334
+ // save temporary default value
3335
+ setTempDefaultValue(inputDefault);
3336
+
2369
3337
  //
2370
3338
  setDataInit(_ORGIN_DATA); // data must be initialized
2371
3339
 
@@ -2376,15 +3344,12 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
2376
3344
  onFetch === null || onFetch === void 0 ? void 0 : onFetch(_ORGIN_DATA);
2377
3345
  return _context.abrupt("return", _ORGIN_DATA);
2378
3346
  case 16:
2379
- // Set hierarchical categories ( with sub-categories )
2380
- if (hierarchical) {
2381
- optionsDataInit = (0,tree.addTreeDepth)(optionsDataInit);
2382
- (0,tree.addTreeIndent)(optionsDataInit, INDENT_PLACEHOLDER, INDENT_LAST_PLACEHOLDER, 'label');
2383
- }
2384
-
2385
3347
  // remove Duplicate objects from JSON Array
2386
3348
  optionsDataInit = (0,object.removeArrDuplicateItems)(optionsDataInit, 'value');
2387
3349
 
3350
+ // save temporary default value
3351
+ setTempDefaultValue(inputDefault);
3352
+
2388
3353
  //
2389
3354
  setDataInit(optionsDataInit); // data must be initialized
2390
3355
 
@@ -2416,9 +3381,9 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
2416
3381
  setValSelected(_initVal);
2417
3382
 
2418
3383
  // Initialize selected options
2419
- if (UN_ATTACHED_SELECT) {
3384
+ if (UNATTACHED_SELECT) {
2420
3385
  setValSelectedData(function (prevState) {
2421
- var _data = [].concat(src_toConsumableArray(prevState), src_toConsumableArray(options.filter(function (item) {
3386
+ var _data = [].concat(_toConsumableArray(prevState), _toConsumableArray(options.filter(function (item) {
2422
3387
  return multiSelControlOptionExist(_initVal, item.value);
2423
3388
  })));
2424
3389
  return uniqueArr(_data);
@@ -2428,110 +3393,148 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
2428
3393
  return multiSelControlOptionExist(_initVal, item.value);
2429
3394
  }));
2430
3395
  }
3396
+
3397
+ // Initialize default options
3398
+ setDataInit(options.filter(function (item) {
3399
+ return !multiSelControlOptionExist(_initVal, item.value);
3400
+ }));
2431
3401
  } else {
2432
3402
  setValSelected([]);
2433
3403
  setValSelectedData([]);
2434
3404
  }
2435
3405
  }
2436
3406
  }
2437
- function selectItem(el) {
2438
- if (el === null) return;
2439
- var _li = el;
2440
- var _val = _li.dataset.value;
2441
- var _listItemLabel = _li.dataset.listItemLabel;
2442
- var _label = _listItemLabel === '' ? _li.dataset.label : _listItemLabel;
2443
- var _data = typeof _li.dataset.itemdata !== 'undefined' ? JSON.parse(_li.dataset.itemdata) : {};
2444
-
2445
- // set selected items
2446
- setValSelected(function (prevState) {
2447
- var newData = JSON.parse(JSON.stringify(prevState));
2448
- var index = newData.findIndex(function (item) {
2449
- return item == _val;
3407
+ function selectItem(curId) {
3408
+ // update default options
3409
+ setDataInit(function (prevState) {
3410
+ var newDefaultData = prevState.filter(function (item) {
3411
+ return item.id != curId;
2450
3412
  });
2451
- if (index !== -1) newData.splice(index, 1);
2452
- var _res = _val ? Array.from(new Set([].concat(src_toConsumableArray(newData), [_val]))) : newData;
2453
- onChange === null || onChange === void 0 ? void 0 : onChange(_li, _res, VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(_res) : _res.join(','), _data, 'add');
3413
+ var targetData = prevState.find(function (v) {
3414
+ return v.id == curId;
3415
+ }); // !!!from old "dataInit"
3416
+ var _data = typeof targetData !== 'undefined' ? targetData : {};
3417
+
3418
+ // update selected data
3419
+ setValSelectedData(function (prevState2) {
3420
+ var newSelectedData = dragdropListDataInit([].concat(_toConsumableArray(prevState2), [_data]));
3421
+
3422
+ // update selected items
3423
+ setValSelected(function (prevState3) {
3424
+ var newValueData = newSelectedData.map(function (v) {
3425
+ return v.value;
3426
+ });
3427
+ var newValueStr = VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(newValueData) : newValueData.join(',');
3428
+ onChange === null || onChange === void 0 ? void 0 : onChange(document.querySelector("[data-id=\"".concat(curId, "\"]")), newValueData, newValueStr, _data, 'add', newSelectedData);
2454
3429
 
2455
- // hide current item
2456
- _li.classList.add('hide');
2457
- return _res;
3430
+ // update temporary default value
3431
+ setTempDefaultValue(newValueStr);
3432
+ return newValueData;
3433
+ });
3434
+ return uniqueArr(newSelectedData);
3435
+ });
3436
+ return uniqueArr(newDefaultData);
2458
3437
  });
2459
-
3438
+ }
3439
+ function removeItem(curId) {
2460
3440
  // update selected data
2461
3441
  setValSelectedData(function (prevState) {
2462
- var newData = JSON.parse(JSON.stringify(prevState));
2463
- var index = newData.findIndex(function (item) {
2464
- return item.value == _val;
3442
+ var newSelectedData = prevState.filter(function (item) {
3443
+ return item.id != curId;
2465
3444
  });
2466
- if (index !== -1) newData.splice(index, 1);
2467
- var _res = _val ? Array.from(new Set([].concat(src_toConsumableArray(newData), [_data]))) : newData;
2468
- return _res;
2469
- });
2470
- }
2471
- function removeItem(el) {
2472
- if (el === null) return;
2473
- var _li = el;
2474
- var _val = _li.dataset.value;
2475
- var _data = typeof _li.dataset.itemdata !== 'undefined' ? JSON.parse(_li.dataset.itemdata) : {};
2476
-
2477
- // set selected items
2478
- setValSelected(function (prevState) {
2479
- var newData = JSON.parse(JSON.stringify(prevState));
2480
- var index = newData.findIndex(function (item) {
2481
- return item == _val;
3445
+ var targetData = prevState.find(function (v) {
3446
+ return v.id == curId;
3447
+ }); // !!!from old "valSelectedData"
3448
+ var _data = typeof targetData !== 'undefined' ? targetData : {};
3449
+
3450
+ // update default options
3451
+ setDataInit(function (prevState2) {
3452
+ var newDefaultData = dragdropListDefaultDataInit([].concat(_toConsumableArray(prevState2), [_data]));
3453
+ return uniqueArr(newDefaultData);
2482
3454
  });
2483
- if (index !== -1) newData.splice(index, 1);
2484
- var _res = newData;
2485
- onChange === null || onChange === void 0 ? void 0 : onChange(_li, _res, VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(_res) : _res.join(','), _data, 'remove');
2486
-
2487
- // show current item
2488
- if (availableListRef.current) {
2489
- var removedItem = availableListRef.current.querySelector("li[data-value=\"".concat(_val, "\"]"));
2490
- if (removedItem !== null) removedItem.classList.remove('hide');
2491
- }
2492
- return _res;
2493
- });
2494
3455
 
2495
- // update selected data
2496
- setValSelectedData(function (prevState) {
2497
- var newData = JSON.parse(JSON.stringify(prevState));
2498
- var index = newData.findIndex(function (item) {
2499
- return item.value == _val;
3456
+ // update selected items
3457
+ setValSelected(function (prevState3) {
3458
+ var newValueData = newSelectedData.map(function (v) {
3459
+ return v.value;
3460
+ });
3461
+ var newValueStr = VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(newValueData) : newValueData.join(',');
3462
+ onChange === null || onChange === void 0 ? void 0 : onChange(document.querySelector("[data-id=\"".concat(curId, "\"]")), newValueData, newValueStr, _data, 'remove', newSelectedData);
3463
+
3464
+ // update temporary default value
3465
+ setTempDefaultValue(newValueStr);
3466
+ return newValueData;
2500
3467
  });
2501
- if (index !== -1) newData.splice(index, 1);
2502
- var _res = newData;
2503
- return _res;
3468
+ return uniqueArr(newSelectedData);
2504
3469
  });
2505
3470
  }
2506
3471
  function handleSelectAll(event) {
2507
3472
  event.preventDefault();
2508
- if (availableListRef.current === null) return;
2509
- var items = [].slice.call(availableListRef.current.querySelectorAll('li[data-value]'));
2510
- items.forEach(function (item) {
2511
- if (!item.classList.contains('disabled')) {
2512
- selectItem(item);
2513
- }
2514
- });
3473
+ event.stopPropagation();
3474
+
3475
+ // update default options
3476
+ setDataInit(function (prevState) {
3477
+ var newDefaultData = [];
3478
+
3479
+ // filter the "disabled" option
3480
+ var disabledData = prevState.filter(function (v) {
3481
+ return v.disabled === true;
3482
+ }); // !!!from old "dataInit"
3483
+ var targetData = prevState.filter(function (v) {
3484
+ return typeof v.disabled === 'undefined' || v.disabled === false;
3485
+ }); // !!!from old "dataInit"
3486
+
3487
+ // update selected data
3488
+ setValSelectedData(function (prevState2) {
3489
+ var newSelectedData = dragdropListDataInit([].concat(_toConsumableArray(prevState2), _toConsumableArray(targetData)));
3490
+
3491
+ // update selected items
3492
+ setValSelected(function (prevState3) {
3493
+ var newValueData = newSelectedData.map(function (v) {
3494
+ return v.value;
3495
+ });
3496
+ var newValueStr = VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(newValueData) : newValueData.join(',');
3497
+ onChange === null || onChange === void 0 ? void 0 : onChange(null, newValueData, newValueStr, null, 'add-all', newSelectedData);
2515
3498
 
2516
- //
2517
- onAddAll === null || onAddAll === void 0 ? void 0 : onAddAll(event, dataInit.map(function (v) {
2518
- return "".concat(v.value);
2519
- }), VALUE_BY_BRACKETS ? dataInit.map(function (v) {
2520
- return "[".concat(v.value, "]");
2521
- }).join('') : dataInit.map(function (v) {
2522
- return v.value;
2523
- }).join(''));
3499
+ // update temporary default value
3500
+ setTempDefaultValue(newValueStr);
3501
+ return newValueData;
3502
+ });
3503
+ return uniqueArr(newSelectedData);
3504
+ });
3505
+ return uniqueArr([].concat(newDefaultData, _toConsumableArray(disabledData)));
3506
+ });
2524
3507
  }
2525
3508
  function handleRemoveAll(event) {
2526
3509
  event.preventDefault();
2527
- if (selectedListRef.current === null) return;
2528
- var items = [].slice.call(selectedListRef.current.querySelectorAll('li[data-value]'));
2529
- items.forEach(function (item) {
2530
- removeItem(item);
2531
- });
3510
+ event.stopPropagation();
3511
+
3512
+ // update selected data
3513
+ setValSelectedData(function (prevState) {
3514
+ var newSelectedData = [];
3515
+ var targetData = prevState; // !!!from old "valSelectedData"
3516
+
3517
+ // update default options
3518
+ setDataInit(function (prevState2) {
3519
+ var newDefaultData = dragdropListDefaultDataInit([].concat(_toConsumableArray(prevState2), _toConsumableArray(targetData)));
3520
+ return uniqueArr(newDefaultData);
3521
+ });
3522
+
3523
+ // update selected items
3524
+ setValSelected(function (prevState3) {
3525
+ var newValueData = newSelectedData.map(function (v) {
3526
+ return v.value;
3527
+ });
3528
+ var newValueStr = VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(newValueData) : newValueData.join(',');
3529
+ onChange === null || onChange === void 0 ? void 0 : onChange(null, newValueData, newValueStr, null, 'remove-all', newSelectedData);
3530
+ onRemoveAll === null || onRemoveAll === void 0 ? void 0 : onRemoveAll(event, newValueData, newValueStr, newSelectedData);
2532
3531
 
2533
- //
2534
- onRemoveAll === null || onRemoveAll === void 0 ? void 0 : onRemoveAll(event, [], '');
3532
+ // update temporary default value
3533
+ setTempDefaultValue(newValueStr);
3534
+ return newValueData;
3535
+ });
3536
+ return uniqueArr(newSelectedData);
3537
+ });
2535
3538
  }
2536
3539
  function handleChangeSearch(event) {
2537
3540
  var inputVal = event.target.value;
@@ -2574,14 +3577,14 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
2574
3577
  }
2575
3578
  }, []);
2576
3579
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
2577
- className: (0,cls.combinedCls)('m-select__wrapper', (0,cls.clsWrite)(wrapperClassName, 'mb-3')),
3580
+ className: (0,cls.combinedCls)('m-select-v2__wrapper', (0,cls.clsWrite)(wrapperClassName, 'mb-3')),
2578
3581
  ref: rootRef,
2579
3582
  style: {
2580
- minWidth: WRAPPER_MIN_W === '' ? 'var(--m-select-wrapper-min-w)' : WRAPPER_MIN_W,
2581
- minHeight: WRAPPER_MIN_H === '' ? 'var(--m-select-wrapper-min-h)' : WRAPPER_MIN_H
3583
+ minWidth: WRAPPER_MIN_W === '' ? 'var(--m-select-v2-wrapper-min-w)' : WRAPPER_MIN_W,
3584
+ minHeight: WRAPPER_MIN_H === '' ? 'var(--m-select-v2-wrapper-min-h)' : WRAPPER_MIN_H
2582
3585
  }
2583
3586
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
2584
- className: "m-select-diving-line"
3587
+ className: "m-select-v2-diving-line"
2585
3588
  }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", _extends({
2586
3589
  ref: function ref(node) {
2587
3590
  inputRef.current = node;
@@ -2602,17 +3605,17 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
2602
3605
  },
2603
3606
  required: required || null
2604
3607
  }, attributes)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
2605
- className: "m-select-inner"
3608
+ className: "m-select-v2-inner"
2606
3609
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
2607
- className: "m-select__available__container"
3610
+ className: "m-select-v2__available__container"
2608
3611
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
2609
- className: "m-select__m-select__item-actions m-select__header"
3612
+ className: "m-select-v2__m-select-v2__item-actions m-select-v2__header"
2610
3613
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
2611
- className: "m-select__search__container"
3614
+ className: "m-select-v2__search__container"
2612
3615
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", {
2613
3616
  type: "text",
2614
3617
  value: changedSearchVal,
2615
- className: "m-select__search",
3618
+ className: "m-select-v2__search",
2616
3619
  onChange: handleChangeSearch
2617
3620
  }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("i", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
2618
3621
  width: "0.8em",
@@ -2623,61 +3626,75 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
2623
3626
  d: "M12.027 9.92L16 13.95 14 16l-4.075-3.976A6.465 6.465 0 0 1 6.5 13C2.91 13 0 10.083 0 6.5 0 2.91 2.917 0 6.5 0 10.09 0 13 2.917 13 6.5a6.463 6.463 0 0 1-.973 3.42zM1.997 6.452c0 2.48 2.014 4.5 4.5 4.5 2.48 0 4.5-2.015 4.5-4.5 0-2.48-2.015-4.5-4.5-4.5-2.48 0-4.5 2.014-4.5 4.5z",
2624
3627
  fillRule: "evenodd"
2625
3628
  })))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
2626
- className: "m-select__title",
3629
+ className: "m-select-v2__title",
2627
3630
  dangerouslySetInnerHTML: {
2628
3631
  __html: "".concat(availableHeaderTitle || '')
2629
3632
  }
2630
3633
  }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
2631
3634
  href: "#",
2632
- className: "m-select__btn--add-all",
3635
+ className: "m-select-v2__btn--add-all",
2633
3636
  onClick: handleSelectAll
2634
- }, addAllBtnLabel || 'Add all')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(src_ItemList, {
2635
- appendControl: appendControl,
2636
- root: rootRef.current,
2637
- listContainerClassName: "m-select__available m-select__options-contentlist",
3637
+ }, addAllBtnLabel || 'Add all')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((cjs_default()), {
3638
+ data: dragdropListDefaultDataInit(dataInit),
3639
+ wrapperClassName: "",
2638
3640
  ref: availableListRef,
2639
- indentStr: INDENT_LAST_PLACEHOLDER,
2640
- valSelected: valSelected,
2641
- iconAdd: iconAdd,
2642
- onSelect: selectItem,
3641
+ prefix: "m-select-v2",
3642
+ draggable: false,
3643
+ handleHide: handleHide,
3644
+ handleIcon: handleIcon,
3645
+ handlePos: handlePos,
3646
+ dragMode: dragMode,
3647
+ indentation: indentation,
3648
+ doubleIndent: doubleIndent,
2643
3649
  alternateCollapse: alternateCollapse,
2644
- first: true,
2645
- arrow: arrow,
2646
- data: dataInit,
2647
- childClassName: childClassName || 'm-select__options-contentlist-custom'
3650
+ arrow: arrow
2648
3651
  })), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
2649
- className: "m-select__selected__container"
3652
+ className: "m-select-v2__selected__container"
2650
3653
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
2651
- className: "m-select__m-select__item-actions m-select__header"
3654
+ className: "m-select-v2__m-select-v2__item-actions m-select-v2__header"
2652
3655
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
2653
- className: "m-select__count",
3656
+ className: "m-select-v2__count",
2654
3657
  dangerouslySetInnerHTML: {
2655
3658
  __html: "".concat(typeof selectedHeaderNote !== 'undefined' ? selectedHeaderNote.replace('{items_num}', valSelectedData.length) : '')
2656
3659
  }
2657
3660
  }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
2658
- className: "m-select__title",
3661
+ className: "m-select-v2__title",
2659
3662
  dangerouslySetInnerHTML: {
2660
3663
  __html: "".concat(selectedHeaderTitle || '')
2661
3664
  }
2662
3665
  }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
2663
3666
  href: "#",
2664
- className: "m-select__btn--remove-all",
3667
+ className: "m-select-v2__btn--remove-all",
2665
3668
  onClick: handleRemoveAll
2666
- }, removeAllBtnLabel || 'Remove all')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(src_ItemList, {
2667
- appendControl: appendControl,
2668
- root: rootRef.current,
2669
- listContainerClassName: "m-select__selected m-select__options-contentlist--sortable m-select__options-contentlist",
2670
- ref: selectedListRef,
2671
- indentStr: INDENT_LAST_PLACEHOLDER,
2672
- valSelected: selectedResultReverse ? valSelected.reverse() : valSelected,
2673
- iconRemove: iconRemove,
2674
- onSelect: removeItem,
2675
- alternateCollapse: alternateCollapse,
2676
- first: true,
3669
+ }, removeAllBtnLabel || 'Remove all')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((cjs_default()), {
3670
+ data: dragdropListDataInit(selectedResultReverse ? valSelectedData.reverse() : valSelectedData),
3671
+ onUpdate: function onUpdate(newData, curId) {
3672
+ setValSelectedData(newData);
3673
+ var newValueData = newData.map(function (v) {
3674
+ return v.value;
3675
+ });
3676
+ var newValueStr = VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(newValueData) : newValueData.join(',');
3677
+ var targetData = newData.find(function (v) {
3678
+ return v.id == curId;
3679
+ }); // !!!from old "dataInit"
3680
+ var _data = typeof targetData !== 'undefined' ? targetData : {};
3681
+ setValSelected(newData.map(function (v) {
3682
+ return v.value;
3683
+ }));
3684
+ onChange === null || onChange === void 0 ? void 0 : onChange(document.querySelector("[data-id=\"".concat(curId, "\"]")), newValueData, newValueStr, _data, 'update', newData);
3685
+ },
3686
+ wrapperClassName: "",
3687
+ prefix: "m-select-v2",
3688
+ draggable: draggable,
3689
+ handleHide: handleHide,
3690
+ handleIcon: handleIcon,
3691
+ handlePos: handlePos,
3692
+ dragMode: dragMode,
3693
+ indentation: indentation,
3694
+ doubleIndent: doubleIndent,
3695
+ alternateCollapse: false,
2677
3696
  arrow: arrow,
2678
- data: selectedResultReverse ? valSelectedData.reverse() : valSelectedData,
2679
- childClassName: (0,cls.clsWrite)(childClassName, 'm-select__options-contentlist--custom'),
2680
- selected: true
3697
+ hierarchical: false
2681
3698
  })))));
2682
3699
  });
2683
3700
  /* harmony default export */ const src = (MultipleSelect);