funda-ui 4.5.666 → 4.5.671
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ColorPicker/index.js +3 -1
- package/Date/index.js +14 -1
- package/DragDropList/index.css +188 -0
- package/DragDropList/index.d.ts +44 -0
- package/DragDropList/index.js +1587 -0
- package/Input/index.d.ts +2 -0
- package/Input/index.js +14 -1
- package/LICENSE +21 -0
- package/MultipleSelect/index.css +237 -144
- package/MultipleSelect/index.d.ts +24 -10
- package/MultipleSelect/index.js +2240 -1225
- package/README.md +3 -1
- package/RangeSlider/index.js +14 -1
- package/Textarea/index.d.ts +2 -0
- package/Textarea/index.js +14 -1
- package/Tree/index.d.ts +1 -0
- package/Tree/index.js +29 -0
- package/Utils/useBoundedDrag.d.ts +125 -0
- package/Utils/useBoundedDrag.js +380 -0
- package/Utils/useDragDropPosition.d.ts +169 -0
- package/Utils/useDragDropPosition.js +456 -0
- package/Utils/useIsMobile.d.ts +2 -0
- package/Utils/useIsMobile.js +168 -0
- package/all.d.ts +1 -0
- package/all.js +1 -1
- package/lib/cjs/ColorPicker/index.js +3 -1
- package/lib/cjs/Date/index.js +14 -1
- package/lib/cjs/DragDropList/index.d.ts +44 -0
- package/lib/cjs/DragDropList/index.js +1587 -0
- package/lib/cjs/Input/index.d.ts +2 -0
- package/lib/cjs/Input/index.js +14 -1
- package/lib/cjs/MultipleSelect/index.d.ts +24 -10
- package/lib/cjs/MultipleSelect/index.js +2240 -1225
- package/lib/cjs/RangeSlider/index.js +14 -1
- package/lib/cjs/Textarea/index.d.ts +2 -0
- package/lib/cjs/Textarea/index.js +14 -1
- package/lib/cjs/Tree/index.d.ts +1 -0
- package/lib/cjs/Tree/index.js +29 -0
- package/lib/cjs/Utils/useBoundedDrag.d.ts +125 -0
- package/lib/cjs/Utils/useBoundedDrag.js +380 -0
- package/lib/cjs/Utils/useDragDropPosition.d.ts +169 -0
- package/lib/cjs/Utils/useDragDropPosition.js +456 -0
- package/lib/cjs/Utils/useIsMobile.d.ts +2 -0
- package/lib/cjs/Utils/useIsMobile.js +168 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -1
- package/lib/css/DragDropList/index.css +188 -0
- package/lib/css/MultipleSelect/index.css +237 -144
- package/lib/esm/ColorPicker/index.tsx +53 -49
- package/lib/esm/DragDropList/index.scss +245 -0
- package/lib/esm/DragDropList/index.tsx +494 -0
- package/lib/esm/Input/index.tsx +17 -3
- package/lib/esm/MultipleSelect/index.scss +288 -183
- package/lib/esm/MultipleSelect/index.tsx +305 -166
- package/lib/esm/MultipleSelect/utils/func.ts +21 -1
- package/lib/esm/Tabs/Tabs.tsx +1 -1
- package/lib/esm/Textarea/index.tsx +18 -1
- package/lib/esm/Tree/TreeList.tsx +32 -0
- package/lib/esm/Tree/index.tsx +3 -0
- package/lib/esm/Utils/hooks/useBoundedDrag.tsx +301 -0
- package/lib/esm/Utils/hooks/useDragDropPosition.tsx +420 -0
- package/lib/esm/Utils/hooks/useIsMobile.tsx +56 -0
- package/lib/esm/index.js +1 -0
- package/package.json +1 -1
- package/lib/esm/MultipleSelect/ItemList.tsx +0 -323
|
@@ -11,6 +11,1814 @@
|
|
|
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] : ' ';
|
|
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
|
+
var _useBoundedDrag = function useBoundedDrag() {
|
|
918
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
919
|
+
var _options$dragMode = options.dragMode,
|
|
920
|
+
dragMode = _options$dragMode === void 0 ? 'handle' : _options$dragMode,
|
|
921
|
+
_options$boundarySele = options.boundarySelector,
|
|
922
|
+
boundarySelector = _options$boundarySele === void 0 ? '.custom-draggable-list' : _options$boundarySele,
|
|
923
|
+
_options$itemSelector = options.itemSelector,
|
|
924
|
+
itemSelector = _options$itemSelector === void 0 ? '.custom-draggable-list__item' : _options$itemSelector,
|
|
925
|
+
_options$dragHandleSe = options.dragHandleSelector,
|
|
926
|
+
dragHandleSelector = _options$dragHandleSe === void 0 ? '.custom-draggable-list__handle' : _options$dragHandleSe,
|
|
927
|
+
onDragStart = options.onDragStart,
|
|
928
|
+
onDragOver = options.onDragOver,
|
|
929
|
+
onDragEnd = options.onDragEnd;
|
|
930
|
+
var _useState = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
|
|
931
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
932
|
+
isDragging = _useState2[0],
|
|
933
|
+
setIsDragging = _useState2[1];
|
|
934
|
+
var dragItem = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
935
|
+
var dragOverItem = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
936
|
+
var dragNode = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
937
|
+
var touchOffset = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)({
|
|
938
|
+
x: 0,
|
|
939
|
+
y: 0
|
|
940
|
+
});
|
|
941
|
+
var currentHoverItem = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
942
|
+
var handleDragStart = function handleDragStart(e, position) {
|
|
943
|
+
var isTouch = ('touches' in e);
|
|
944
|
+
var target = e.target;
|
|
945
|
+
|
|
946
|
+
// For block mode or handle mode check
|
|
947
|
+
if (dragMode === 'handle') {
|
|
948
|
+
var handle = target.closest(dragHandleSelector);
|
|
949
|
+
if (!handle) {
|
|
950
|
+
if (!isTouch) e.preventDefault();
|
|
951
|
+
return false;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
// Find the draggable item
|
|
956
|
+
var listItem = target.closest(itemSelector);
|
|
957
|
+
if (!listItem) return;
|
|
958
|
+
|
|
959
|
+
// Check boundary
|
|
960
|
+
var boundary = listItem.closest(boundarySelector);
|
|
961
|
+
if (!boundary) return;
|
|
962
|
+
dragItem.current = position;
|
|
963
|
+
onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(position);
|
|
964
|
+
if (isTouch) {
|
|
965
|
+
e.preventDefault(); // Prevent scrolling
|
|
966
|
+
var touch = e.touches[0];
|
|
967
|
+
var rect = listItem.getBoundingClientRect();
|
|
968
|
+
var boundaryRect = boundary.getBoundingClientRect();
|
|
969
|
+
|
|
970
|
+
// Calculate offset relative to the boundary
|
|
971
|
+
touchOffset.current = {
|
|
972
|
+
x: touch.clientX - rect.left,
|
|
973
|
+
y: touch.clientY - rect.top
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
// Clone the item for dragging
|
|
977
|
+
dragNode.current = listItem.cloneNode(true);
|
|
978
|
+
dragNode.current.classList.add('dragging');
|
|
979
|
+
|
|
980
|
+
// Style the clone
|
|
981
|
+
Object.assign(dragNode.current.style, {
|
|
982
|
+
position: 'fixed',
|
|
983
|
+
width: "".concat(rect.width, "px"),
|
|
984
|
+
height: "".concat(rect.height, "px"),
|
|
985
|
+
left: "".concat(rect.left, "px"),
|
|
986
|
+
top: "".concat(rect.top, "px"),
|
|
987
|
+
zIndex: '1000',
|
|
988
|
+
pointerEvents: 'none',
|
|
989
|
+
transform: 'scale(1.05)',
|
|
990
|
+
transition: 'transform 0.1s',
|
|
991
|
+
opacity: '0.9'
|
|
992
|
+
});
|
|
993
|
+
document.body.appendChild(dragNode.current);
|
|
994
|
+
setIsDragging(true);
|
|
995
|
+
listItem.classList.add('dragging-placeholder');
|
|
996
|
+
} else {
|
|
997
|
+
// ... desktop drag logic remains the same ...
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
var handleDragOver = function handleDragOver(e) {
|
|
1001
|
+
e.preventDefault();
|
|
1002
|
+
var isTouch = ('touches' in e);
|
|
1003
|
+
if (!isTouch) {
|
|
1004
|
+
e.dataTransfer.dropEffect = 'move';
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
// Get the current pointer/touch position
|
|
1008
|
+
var point = isTouch ? e.touches[0] : {
|
|
1009
|
+
clientX: e.clientX,
|
|
1010
|
+
clientY: e.clientY
|
|
1011
|
+
};
|
|
1012
|
+
|
|
1013
|
+
// Update dragged element position for touch events
|
|
1014
|
+
if (isTouch && isDragging && dragNode.current) {
|
|
1015
|
+
dragNode.current.style.left = "".concat(point.clientX - touchOffset.current.x, "px");
|
|
1016
|
+
dragNode.current.style.top = "".concat(point.clientY - touchOffset.current.y, "px");
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
// Find the element below the pointer/touch
|
|
1020
|
+
var elemBelow = document.elementFromPoint(point.clientX, point.clientY);
|
|
1021
|
+
if (!elemBelow) return;
|
|
1022
|
+
|
|
1023
|
+
// Find the closest list item
|
|
1024
|
+
var listItem = elemBelow.closest(itemSelector);
|
|
1025
|
+
if (!listItem || listItem === currentHoverItem.current) return;
|
|
1026
|
+
|
|
1027
|
+
// Check boundary
|
|
1028
|
+
var boundary = listItem.closest(boundarySelector);
|
|
1029
|
+
if (!boundary) return;
|
|
1030
|
+
|
|
1031
|
+
// Update hover states
|
|
1032
|
+
if (currentHoverItem.current) {
|
|
1033
|
+
currentHoverItem.current.classList.remove('drag-over', 'drag-over-top', 'drag-over-bottom');
|
|
1034
|
+
}
|
|
1035
|
+
currentHoverItem.current = listItem;
|
|
1036
|
+
listItem.classList.add('drag-over');
|
|
1037
|
+
|
|
1038
|
+
// Calculate position in list
|
|
1039
|
+
var position = Array.from(listItem.parentNode.children).indexOf(listItem);
|
|
1040
|
+
dragOverItem.current = position;
|
|
1041
|
+
|
|
1042
|
+
// Determine drop position (top/bottom)
|
|
1043
|
+
var rect = listItem.getBoundingClientRect();
|
|
1044
|
+
var middleY = rect.top + rect.height / 2;
|
|
1045
|
+
if (point.clientY < middleY) {
|
|
1046
|
+
listItem.classList.add('drag-over-top');
|
|
1047
|
+
} else {
|
|
1048
|
+
listItem.classList.add('drag-over-bottom');
|
|
1049
|
+
}
|
|
1050
|
+
onDragOver === null || onDragOver === void 0 ? void 0 : onDragOver(dragItem.current, dragOverItem.current);
|
|
1051
|
+
};
|
|
1052
|
+
var handleDragEnd = function handleDragEnd(e) {
|
|
1053
|
+
var isTouch = ('touches' in e);
|
|
1054
|
+
if (isTouch && !isDragging) return;
|
|
1055
|
+
onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd(dragItem.current, dragOverItem.current);
|
|
1056
|
+
|
|
1057
|
+
// Cleanup
|
|
1058
|
+
if (dragNode.current) {
|
|
1059
|
+
dragNode.current.remove();
|
|
1060
|
+
dragNode.current = null;
|
|
1061
|
+
}
|
|
1062
|
+
document.querySelectorAll(itemSelector).forEach(function (item) {
|
|
1063
|
+
item.style.opacity = '1';
|
|
1064
|
+
item.classList.remove('dragging', 'dragging-placeholder', 'drag-over', 'drag-over-top', 'drag-over-bottom');
|
|
1065
|
+
});
|
|
1066
|
+
setIsDragging(false);
|
|
1067
|
+
currentHoverItem.current = null;
|
|
1068
|
+
dragItem.current = null;
|
|
1069
|
+
dragOverItem.current = null;
|
|
1070
|
+
};
|
|
1071
|
+
return {
|
|
1072
|
+
isDragging: isDragging,
|
|
1073
|
+
dragHandlers: {
|
|
1074
|
+
handleDragStart: handleDragStart,
|
|
1075
|
+
handleDragOver: handleDragOver,
|
|
1076
|
+
handleDragEnd: handleDragEnd
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
};
|
|
1080
|
+
/* harmony default export */
|
|
1081
|
+
var __WEBPACK_DEFAULT_EXPORT__ = _useBoundedDrag;
|
|
1082
|
+
})();
|
|
1083
|
+
|
|
1084
|
+
/******/
|
|
1085
|
+
return __webpack_exports__;
|
|
1086
|
+
/******/
|
|
1087
|
+
}()
|
|
1088
|
+
);
|
|
1089
|
+
});
|
|
1090
|
+
|
|
1091
|
+
/***/
|
|
1092
|
+
},
|
|
1093
|
+
|
|
1094
|
+
/***/787: /***/function _(module) {
|
|
1095
|
+
"use strict";
|
|
1096
|
+
|
|
1097
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
1098
|
+
|
|
1099
|
+
/***/
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
/******/
|
|
1103
|
+
};
|
|
1104
|
+
/************************************************************************/
|
|
1105
|
+
/******/ // The module cache
|
|
1106
|
+
/******/
|
|
1107
|
+
var __webpack_module_cache__ = {};
|
|
1108
|
+
/******/
|
|
1109
|
+
/******/ // The require function
|
|
1110
|
+
/******/
|
|
1111
|
+
function __nested_webpack_require_54634__(moduleId) {
|
|
1112
|
+
/******/ // Check if module is in cache
|
|
1113
|
+
/******/var cachedModule = __webpack_module_cache__[moduleId];
|
|
1114
|
+
/******/
|
|
1115
|
+
if (cachedModule !== undefined) {
|
|
1116
|
+
/******/return cachedModule.exports;
|
|
1117
|
+
/******/
|
|
1118
|
+
}
|
|
1119
|
+
/******/ // Create a new module (and put it into the cache)
|
|
1120
|
+
/******/
|
|
1121
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
1122
|
+
/******/id: moduleId,
|
|
1123
|
+
/******/loaded: false,
|
|
1124
|
+
/******/exports: {}
|
|
1125
|
+
/******/
|
|
1126
|
+
};
|
|
1127
|
+
/******/
|
|
1128
|
+
/******/ // Execute the module function
|
|
1129
|
+
/******/
|
|
1130
|
+
__webpack_modules__[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_54634__);
|
|
1131
|
+
/******/
|
|
1132
|
+
/******/ // Flag the module as loaded
|
|
1133
|
+
/******/
|
|
1134
|
+
module.loaded = true;
|
|
1135
|
+
/******/
|
|
1136
|
+
/******/ // Return the exports of the module
|
|
1137
|
+
/******/
|
|
1138
|
+
return module.exports;
|
|
1139
|
+
/******/
|
|
1140
|
+
}
|
|
1141
|
+
/******/
|
|
1142
|
+
/************************************************************************/
|
|
1143
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
1144
|
+
/******/
|
|
1145
|
+
(function () {
|
|
1146
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
1147
|
+
/******/__nested_webpack_require_54634__.n = function (module) {
|
|
1148
|
+
/******/var getter = module && module.__esModule ? /******/function () {
|
|
1149
|
+
return module['default'];
|
|
1150
|
+
} : /******/function () {
|
|
1151
|
+
return module;
|
|
1152
|
+
};
|
|
1153
|
+
/******/
|
|
1154
|
+
__nested_webpack_require_54634__.d(getter, {
|
|
1155
|
+
a: getter
|
|
1156
|
+
});
|
|
1157
|
+
/******/
|
|
1158
|
+
return getter;
|
|
1159
|
+
/******/
|
|
1160
|
+
};
|
|
1161
|
+
/******/
|
|
1162
|
+
})();
|
|
1163
|
+
/******/
|
|
1164
|
+
/******/ /* webpack/runtime/define property getters */
|
|
1165
|
+
/******/
|
|
1166
|
+
(function () {
|
|
1167
|
+
/******/ // define getter functions for harmony exports
|
|
1168
|
+
/******/__nested_webpack_require_54634__.d = function (exports, definition) {
|
|
1169
|
+
/******/for (var key in definition) {
|
|
1170
|
+
/******/if (__nested_webpack_require_54634__.o(definition, key) && !__nested_webpack_require_54634__.o(exports, key)) {
|
|
1171
|
+
/******/Object.defineProperty(exports, key, {
|
|
1172
|
+
enumerable: true,
|
|
1173
|
+
get: definition[key]
|
|
1174
|
+
});
|
|
1175
|
+
/******/
|
|
1176
|
+
}
|
|
1177
|
+
/******/
|
|
1178
|
+
}
|
|
1179
|
+
/******/
|
|
1180
|
+
};
|
|
1181
|
+
/******/
|
|
1182
|
+
})();
|
|
1183
|
+
/******/
|
|
1184
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
1185
|
+
/******/
|
|
1186
|
+
(function () {
|
|
1187
|
+
/******/__nested_webpack_require_54634__.o = function (obj, prop) {
|
|
1188
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
1189
|
+
};
|
|
1190
|
+
/******/
|
|
1191
|
+
})();
|
|
1192
|
+
/******/
|
|
1193
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
1194
|
+
/******/
|
|
1195
|
+
(function () {
|
|
1196
|
+
/******/ // define __esModule on exports
|
|
1197
|
+
/******/__nested_webpack_require_54634__.r = function (exports) {
|
|
1198
|
+
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
1199
|
+
/******/Object.defineProperty(exports, Symbol.toStringTag, {
|
|
1200
|
+
value: 'Module'
|
|
1201
|
+
});
|
|
1202
|
+
/******/
|
|
1203
|
+
}
|
|
1204
|
+
/******/
|
|
1205
|
+
Object.defineProperty(exports, '__esModule', {
|
|
1206
|
+
value: true
|
|
1207
|
+
});
|
|
1208
|
+
/******/
|
|
1209
|
+
};
|
|
1210
|
+
/******/
|
|
1211
|
+
})();
|
|
1212
|
+
/******/
|
|
1213
|
+
/******/ /* webpack/runtime/node module decorator */
|
|
1214
|
+
/******/
|
|
1215
|
+
(function () {
|
|
1216
|
+
/******/__nested_webpack_require_54634__.nmd = function (module) {
|
|
1217
|
+
/******/module.paths = [];
|
|
1218
|
+
/******/
|
|
1219
|
+
if (!module.children) module.children = [];
|
|
1220
|
+
/******/
|
|
1221
|
+
return module;
|
|
1222
|
+
/******/
|
|
1223
|
+
};
|
|
1224
|
+
/******/
|
|
1225
|
+
})();
|
|
1226
|
+
/******/
|
|
1227
|
+
/************************************************************************/
|
|
1228
|
+
var __webpack_exports__ = {};
|
|
1229
|
+
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
1230
|
+
(function () {
|
|
1231
|
+
"use strict";
|
|
1232
|
+
|
|
1233
|
+
__nested_webpack_require_54634__.r(__webpack_exports__);
|
|
1234
|
+
/* harmony export */
|
|
1235
|
+
__nested_webpack_require_54634__.d(__webpack_exports__, {
|
|
1236
|
+
/* harmony export */"default": function _default() {
|
|
1237
|
+
return __WEBPACK_DEFAULT_EXPORT__;
|
|
1238
|
+
}
|
|
1239
|
+
/* harmony export */
|
|
1240
|
+
});
|
|
1241
|
+
/* harmony import */
|
|
1242
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_54634__(787);
|
|
1243
|
+
/* harmony import */
|
|
1244
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_54634__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1245
|
+
/* harmony import */
|
|
1246
|
+
var funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_54634__(438);
|
|
1247
|
+
/* harmony import */
|
|
1248
|
+
var funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nested_webpack_require_54634__.n(funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1__);
|
|
1249
|
+
/* harmony import */
|
|
1250
|
+
var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_54634__(188);
|
|
1251
|
+
/* harmony import */
|
|
1252
|
+
var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nested_webpack_require_54634__.n(funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__);
|
|
1253
|
+
/* harmony import */
|
|
1254
|
+
var funda_utils_dist_cjs_useBoundedDrag__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_54634__(759);
|
|
1255
|
+
/* harmony import */
|
|
1256
|
+
var funda_utils_dist_cjs_useBoundedDrag__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nested_webpack_require_54634__.n(funda_utils_dist_cjs_useBoundedDrag__WEBPACK_IMPORTED_MODULE_3__);
|
|
1257
|
+
var _excluded = ["wrapperClassName", "prefix", "data", "draggable", "handleHide", "handleIcon", "handlePos", "dragMode", "editable", "itemStyle", "hierarchical", "indentation", "doubleIndent", "alternateCollapse", "arrow", "onUpdate"];
|
|
1258
|
+
function _extends() {
|
|
1259
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1260
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1261
|
+
var source = arguments[i];
|
|
1262
|
+
for (var key in source) {
|
|
1263
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1264
|
+
target[key] = source[key];
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
return target;
|
|
1269
|
+
};
|
|
1270
|
+
return _extends.apply(this, arguments);
|
|
1271
|
+
}
|
|
1272
|
+
function ownKeys(object, enumerableOnly) {
|
|
1273
|
+
var keys = Object.keys(object);
|
|
1274
|
+
if (Object.getOwnPropertySymbols) {
|
|
1275
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1276
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
1277
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1278
|
+
})), keys.push.apply(keys, symbols);
|
|
1279
|
+
}
|
|
1280
|
+
return keys;
|
|
1281
|
+
}
|
|
1282
|
+
function _objectSpread(target) {
|
|
1283
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1284
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
1285
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
1286
|
+
_defineProperty(target, key, source[key]);
|
|
1287
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
1288
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
return target;
|
|
1292
|
+
}
|
|
1293
|
+
function _defineProperty(obj, key, value) {
|
|
1294
|
+
key = _toPropertyKey(key);
|
|
1295
|
+
if (key in obj) {
|
|
1296
|
+
Object.defineProperty(obj, key, {
|
|
1297
|
+
value: value,
|
|
1298
|
+
enumerable: true,
|
|
1299
|
+
configurable: true,
|
|
1300
|
+
writable: true
|
|
1301
|
+
});
|
|
1302
|
+
} else {
|
|
1303
|
+
obj[key] = value;
|
|
1304
|
+
}
|
|
1305
|
+
return obj;
|
|
1306
|
+
}
|
|
1307
|
+
function _toPropertyKey(arg) {
|
|
1308
|
+
var key = _toPrimitive(arg, "string");
|
|
1309
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
1310
|
+
}
|
|
1311
|
+
function _toPrimitive(input, hint) {
|
|
1312
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
1313
|
+
var prim = input[Symbol.toPrimitive];
|
|
1314
|
+
if (prim !== undefined) {
|
|
1315
|
+
var res = prim.call(input, hint || "default");
|
|
1316
|
+
if (_typeof(res) !== "object") return res;
|
|
1317
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1318
|
+
}
|
|
1319
|
+
return (hint === "string" ? String : Number)(input);
|
|
1320
|
+
}
|
|
1321
|
+
function _toConsumableArray(arr) {
|
|
1322
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
1323
|
+
}
|
|
1324
|
+
function _nonIterableSpread() {
|
|
1325
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1326
|
+
}
|
|
1327
|
+
function _iterableToArray(iter) {
|
|
1328
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1329
|
+
}
|
|
1330
|
+
function _arrayWithoutHoles(arr) {
|
|
1331
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
1332
|
+
}
|
|
1333
|
+
function _typeof(obj) {
|
|
1334
|
+
"@babel/helpers - typeof";
|
|
1335
|
+
|
|
1336
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
1337
|
+
return typeof obj;
|
|
1338
|
+
} : function (obj) {
|
|
1339
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1340
|
+
}, _typeof(obj);
|
|
1341
|
+
}
|
|
1342
|
+
function _slicedToArray(arr, i) {
|
|
1343
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
1344
|
+
}
|
|
1345
|
+
function _nonIterableRest() {
|
|
1346
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1347
|
+
}
|
|
1348
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
1349
|
+
if (!o) return;
|
|
1350
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
1351
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1352
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1353
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
1354
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1355
|
+
}
|
|
1356
|
+
function _arrayLikeToArray(arr, len) {
|
|
1357
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1358
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1359
|
+
return arr2;
|
|
1360
|
+
}
|
|
1361
|
+
function _iterableToArrayLimit(arr, i) {
|
|
1362
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1363
|
+
if (null != _i) {
|
|
1364
|
+
var _s,
|
|
1365
|
+
_e,
|
|
1366
|
+
_x,
|
|
1367
|
+
_r,
|
|
1368
|
+
_arr = [],
|
|
1369
|
+
_n = !0,
|
|
1370
|
+
_d = !1;
|
|
1371
|
+
try {
|
|
1372
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
1373
|
+
if (Object(_i) !== _i) return;
|
|
1374
|
+
_n = !1;
|
|
1375
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
1376
|
+
} catch (err) {
|
|
1377
|
+
_d = !0, _e = err;
|
|
1378
|
+
} finally {
|
|
1379
|
+
try {
|
|
1380
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
1381
|
+
} finally {
|
|
1382
|
+
if (_d) throw _e;
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
return _arr;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
function _arrayWithHoles(arr) {
|
|
1389
|
+
if (Array.isArray(arr)) return arr;
|
|
1390
|
+
}
|
|
1391
|
+
function _objectWithoutProperties(source, excluded) {
|
|
1392
|
+
if (source == null) return {};
|
|
1393
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
1394
|
+
var key, i;
|
|
1395
|
+
if (Object.getOwnPropertySymbols) {
|
|
1396
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
1397
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
1398
|
+
key = sourceSymbolKeys[i];
|
|
1399
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
1400
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
1401
|
+
target[key] = source[key];
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
return target;
|
|
1405
|
+
}
|
|
1406
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
1407
|
+
if (source == null) return {};
|
|
1408
|
+
var target = {};
|
|
1409
|
+
var sourceKeys = Object.keys(source);
|
|
1410
|
+
var key, i;
|
|
1411
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
1412
|
+
key = sourceKeys[i];
|
|
1413
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
1414
|
+
target[key] = source[key];
|
|
1415
|
+
}
|
|
1416
|
+
return target;
|
|
1417
|
+
}
|
|
1418
|
+
var DragDropList = /*#__PURE__*/(0, react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function (props, externalRef) {
|
|
1419
|
+
var wrapperClassName = props.wrapperClassName,
|
|
1420
|
+
_props$prefix = props.prefix,
|
|
1421
|
+
prefix = _props$prefix === void 0 ? 'custom' : _props$prefix,
|
|
1422
|
+
data = props.data,
|
|
1423
|
+
_props$draggable = props.draggable,
|
|
1424
|
+
draggable = _props$draggable === void 0 ? true : _props$draggable,
|
|
1425
|
+
_props$handleHide = props.handleHide,
|
|
1426
|
+
handleHide = _props$handleHide === void 0 ? false : _props$handleHide,
|
|
1427
|
+
_props$handleIcon = props.handleIcon,
|
|
1428
|
+
handleIcon = _props$handleIcon === void 0 ? '☰' : _props$handleIcon,
|
|
1429
|
+
_props$handlePos = props.handlePos,
|
|
1430
|
+
handlePos = _props$handlePos === void 0 ? 'left' : _props$handlePos,
|
|
1431
|
+
_props$dragMode = props.dragMode,
|
|
1432
|
+
dragMode = _props$dragMode === void 0 ? 'handle' : _props$dragMode,
|
|
1433
|
+
_props$editable = props.editable,
|
|
1434
|
+
editable = _props$editable === void 0 ? false : _props$editable,
|
|
1435
|
+
itemStyle = props.itemStyle,
|
|
1436
|
+
_props$hierarchical = props.hierarchical,
|
|
1437
|
+
hierarchical = _props$hierarchical === void 0 ? true : _props$hierarchical,
|
|
1438
|
+
indentation = props.indentation,
|
|
1439
|
+
doubleIndent = props.doubleIndent,
|
|
1440
|
+
alternateCollapse = props.alternateCollapse,
|
|
1441
|
+
_props$arrow = props.arrow,
|
|
1442
|
+
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", {
|
|
1443
|
+
viewBox: "0 0 22 22",
|
|
1444
|
+
width: "8px"
|
|
1445
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
1446
|
+
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",
|
|
1447
|
+
transform: "matrix(.03541-.00013.00013.03541 2.98 3.02)",
|
|
1448
|
+
fill: "#a5a5a5"
|
|
1449
|
+
}))) : _props$arrow,
|
|
1450
|
+
onUpdate = props.onUpdate,
|
|
1451
|
+
attributes = _objectWithoutProperties(props, _excluded);
|
|
1452
|
+
var INDENT_PLACEHOLDER = doubleIndent ? " " : " ";
|
|
1453
|
+
var INDENT_LAST_PLACEHOLDER = "".concat(typeof indentation !== 'undefined' && indentation !== '' ? "".concat(indentation, " ") : '');
|
|
1454
|
+
var rootRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
1455
|
+
var _useState = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
1456
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1457
|
+
items = _useState2[0],
|
|
1458
|
+
setItems = _useState2[1];
|
|
1459
|
+
var _useState3 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),
|
|
1460
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1461
|
+
editingItem = _useState4[0],
|
|
1462
|
+
setEditingItem = _useState4[1];
|
|
1463
|
+
var dragHandle = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
1464
|
+
|
|
1465
|
+
// Edit
|
|
1466
|
+
var _useState5 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)({}),
|
|
1467
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
1468
|
+
editValue = _useState6[0],
|
|
1469
|
+
setEditValue = _useState6[1];
|
|
1470
|
+
|
|
1471
|
+
// Collapse/Expand
|
|
1472
|
+
var _useState7 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(new Set()),
|
|
1473
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
1474
|
+
collapsedItems = _useState8[0],
|
|
1475
|
+
setCollapsedItems = _useState8[1];
|
|
1476
|
+
|
|
1477
|
+
// Get editable field list
|
|
1478
|
+
var getEditableFields = function getEditableFields(item) {
|
|
1479
|
+
// Exclude fields that don't need to be edited
|
|
1480
|
+
var excludeFields = ['id', 'parentId', 'depth', 'children', 'disabled', 'appendControl', 'parentItem'];
|
|
1481
|
+
return Object.keys(item).filter(function (key) {
|
|
1482
|
+
return !excludeFields.includes(key);
|
|
1483
|
+
});
|
|
1484
|
+
};
|
|
1485
|
+
|
|
1486
|
+
// ================================================================
|
|
1487
|
+
// General
|
|
1488
|
+
// ================================================================
|
|
1489
|
+
var deepCloneWithReactNode = function deepCloneWithReactNode(obj) {
|
|
1490
|
+
if (obj === null || _typeof(obj) !== 'object') {
|
|
1491
|
+
return obj;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
// Handle array
|
|
1495
|
+
if (Array.isArray(obj)) {
|
|
1496
|
+
return obj.map(function (item) {
|
|
1497
|
+
return deepCloneWithReactNode(item);
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
// Handle object
|
|
1502
|
+
var clonedObj = {};
|
|
1503
|
+
for (var _key in obj) {
|
|
1504
|
+
if (_key === 'appendControl') {
|
|
1505
|
+
clonedObj[_key] = obj[_key];
|
|
1506
|
+
} else {
|
|
1507
|
+
clonedObj[_key] = deepCloneWithReactNode(obj[_key]);
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
return clonedObj;
|
|
1511
|
+
};
|
|
1512
|
+
var getItemWithChildrenIndices = function getItemWithChildrenIndices(items, startIndex) {
|
|
1513
|
+
var indices = [startIndex];
|
|
1514
|
+
var startItem = items[startIndex];
|
|
1515
|
+
var startDepth = startItem.depth || 0;
|
|
1516
|
+
|
|
1517
|
+
// Check if subsequent items are child items
|
|
1518
|
+
for (var i = startIndex + 1; i < items.length; i++) {
|
|
1519
|
+
var currentItem = items[i];
|
|
1520
|
+
var currentDepth = currentItem.depth || 0;
|
|
1521
|
+
if (currentDepth > startDepth) {
|
|
1522
|
+
indices.push(i);
|
|
1523
|
+
} else {
|
|
1524
|
+
break;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
return indices;
|
|
1528
|
+
};
|
|
1529
|
+
var getIndentStr = function getIndentStr(item) {
|
|
1530
|
+
// Add indent placeholder
|
|
1531
|
+
var indent = '';
|
|
1532
|
+
var depthData = item.depth;
|
|
1533
|
+
if (depthData) {
|
|
1534
|
+
Array(depthData).fill(0).forEach(function (k, i) {
|
|
1535
|
+
indent += INDENT_PLACEHOLDER;
|
|
1536
|
+
if (i === depthData - 1) {
|
|
1537
|
+
indent += INDENT_LAST_PLACEHOLDER;
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
return indent;
|
|
1542
|
+
};
|
|
1543
|
+
|
|
1544
|
+
// ================================================================
|
|
1545
|
+
// Collapse/Expand
|
|
1546
|
+
// ================================================================
|
|
1547
|
+
// Add collapse/expand handler function
|
|
1548
|
+
var handleCollapse = function handleCollapse(itemId, e) {
|
|
1549
|
+
e.preventDefault();
|
|
1550
|
+
e.stopPropagation();
|
|
1551
|
+
setCollapsedItems(function (prev) {
|
|
1552
|
+
var newCollapsed = new Set(prev);
|
|
1553
|
+
if (newCollapsed.has(itemId)) {
|
|
1554
|
+
newCollapsed["delete"](itemId);
|
|
1555
|
+
} else {
|
|
1556
|
+
newCollapsed.add(itemId);
|
|
1557
|
+
}
|
|
1558
|
+
return newCollapsed;
|
|
1559
|
+
});
|
|
1560
|
+
};
|
|
1561
|
+
|
|
1562
|
+
// Helper function to determine if an item should be displayed
|
|
1563
|
+
var shouldShowItem = function shouldShowItem(item) {
|
|
1564
|
+
if (!alternateCollapse) return true;
|
|
1565
|
+
var currentId = item.parentId;
|
|
1566
|
+
while (currentId) {
|
|
1567
|
+
if (collapsedItems.has(currentId)) {
|
|
1568
|
+
return false;
|
|
1569
|
+
}
|
|
1570
|
+
var parentItem = items.find(function (i) {
|
|
1571
|
+
return i.id === currentId;
|
|
1572
|
+
});
|
|
1573
|
+
currentId = parentItem === null || parentItem === void 0 ? void 0 : parentItem.parentId;
|
|
1574
|
+
}
|
|
1575
|
+
return true;
|
|
1576
|
+
};
|
|
1577
|
+
var hasChildren = function hasChildren(itemId) {
|
|
1578
|
+
return items.some(function (item) {
|
|
1579
|
+
return item.parentId === itemId;
|
|
1580
|
+
});
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1583
|
+
// ================================================================
|
|
1584
|
+
// Drag & Drop Handlers (Desktop & Touch)
|
|
1585
|
+
// ================================================================
|
|
1586
|
+
var _useBoundedDrag = funda_utils_dist_cjs_useBoundedDrag__WEBPACK_IMPORTED_MODULE_3___default()({
|
|
1587
|
+
dragMode: dragMode,
|
|
1588
|
+
boundarySelector: ".".concat(prefix, "-draggable-list"),
|
|
1589
|
+
itemSelector: ".".concat(prefix, "-draggable-list__item"),
|
|
1590
|
+
dragHandleSelector: ".".concat(prefix, "-draggable-list__handle"),
|
|
1591
|
+
onDragStart: function onDragStart(index) {
|
|
1592
|
+
// Additional drag start logic if needed
|
|
1593
|
+
},
|
|
1594
|
+
onDragOver: function onDragOver(dragIndex, dropIndex) {
|
|
1595
|
+
// Additional drag over logic if needed
|
|
1596
|
+
},
|
|
1597
|
+
onDragEnd: function onDragEnd(dragIndex, dropIndex) {
|
|
1598
|
+
if (dragIndex !== null && dropIndex !== null && dragIndex !== dropIndex) {
|
|
1599
|
+
var _newItems$dragIndex, _newItems$dragIndex2, _newItems$dropIndex;
|
|
1600
|
+
// Handle item movement
|
|
1601
|
+
var newItems = deepCloneWithReactNode(items);
|
|
1602
|
+
var itemsToMove = getItemWithChildrenIndices(newItems, dragIndex);
|
|
1603
|
+
var itemsBeingMoved = itemsToMove.map(function (index) {
|
|
1604
|
+
return newItems[index];
|
|
1605
|
+
});
|
|
1606
|
+
|
|
1607
|
+
// ... rest of your existing drag end logic ...
|
|
1608
|
+
|
|
1609
|
+
var _targetId = (_newItems$dragIndex = newItems[dragIndex]) === null || _newItems$dragIndex === void 0 ? void 0 : _newItems$dragIndex.id;
|
|
1610
|
+
|
|
1611
|
+
// Calculate depth difference
|
|
1612
|
+
var draggedDepth = ((_newItems$dragIndex2 = newItems[dragIndex]) === null || _newItems$dragIndex2 === void 0 ? void 0 : _newItems$dragIndex2.depth) || 0;
|
|
1613
|
+
var dropDepth = ((_newItems$dropIndex = newItems[dropIndex]) === null || _newItems$dropIndex === void 0 ? void 0 : _newItems$dropIndex.depth) || 0;
|
|
1614
|
+
var depthDiff = dropDepth - draggedDepth;
|
|
1615
|
+
|
|
1616
|
+
// Adjust depth for all moving items
|
|
1617
|
+
itemsBeingMoved.forEach(function (item) {
|
|
1618
|
+
if (item.depth !== undefined) {
|
|
1619
|
+
item.depth += depthDiff;
|
|
1620
|
+
}
|
|
1621
|
+
});
|
|
1622
|
+
|
|
1623
|
+
// Remove all items from their original location (from back to front to keep indexing correct)
|
|
1624
|
+
itemsToMove.reverse().forEach(function (index) {
|
|
1625
|
+
newItems.splice(index, 1);
|
|
1626
|
+
});
|
|
1627
|
+
|
|
1628
|
+
// Calculate new insert position
|
|
1629
|
+
var insertIndex = dropIndex;
|
|
1630
|
+
if (dropIndex > dragIndex) {
|
|
1631
|
+
insertIndex -= itemsToMove.length;
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
// Insert all items
|
|
1635
|
+
newItems.splice.apply(newItems, [insertIndex, 0].concat(_toConsumableArray(itemsBeingMoved)));
|
|
1636
|
+
|
|
1637
|
+
// Rebuild tree structure
|
|
1638
|
+
var tree = hierarchical ? (0, funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1__.convertTree)(newItems, '', 'id', 'parentId') : newItems;
|
|
1639
|
+
var updatedItems = hierarchical ? (0, funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1__.addTreeDepth)(tree) : tree;
|
|
1640
|
+
setItems(updatedItems);
|
|
1641
|
+
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(updatedItems, _targetId);
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
}),
|
|
1645
|
+
isDragging = _useBoundedDrag.isDragging,
|
|
1646
|
+
dragHandlers = _useBoundedDrag.dragHandlers;
|
|
1647
|
+
|
|
1648
|
+
// ================================================================
|
|
1649
|
+
// Editable
|
|
1650
|
+
// ================================================================
|
|
1651
|
+
|
|
1652
|
+
var handleDoubleClick = function handleDoubleClick(item) {
|
|
1653
|
+
if (!editable) return;
|
|
1654
|
+
setEditingItem(item.id);
|
|
1655
|
+
// Only editable fields are copied
|
|
1656
|
+
var editableFields = getEditableFields(item);
|
|
1657
|
+
var editableValues = editableFields.reduce(function (acc, field) {
|
|
1658
|
+
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, field, item[field]));
|
|
1659
|
+
}, {});
|
|
1660
|
+
setEditValue(editableValues);
|
|
1661
|
+
};
|
|
1662
|
+
var handleEditCancel = function handleEditCancel() {
|
|
1663
|
+
setEditingItem(null);
|
|
1664
|
+
setEditValue({});
|
|
1665
|
+
};
|
|
1666
|
+
var handleEditSave = function handleEditSave(itemId) {
|
|
1667
|
+
var newItems = items.map(function (item) {
|
|
1668
|
+
if (item.id === itemId) {
|
|
1669
|
+
return _objectSpread(_objectSpread({}, item), editValue);
|
|
1670
|
+
}
|
|
1671
|
+
return item;
|
|
1672
|
+
});
|
|
1673
|
+
setItems(newItems);
|
|
1674
|
+
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(newItems, itemId);
|
|
1675
|
+
setEditingItem(null);
|
|
1676
|
+
setEditValue({});
|
|
1677
|
+
};
|
|
1678
|
+
var handleInputChange = function handleInputChange(field, value) {
|
|
1679
|
+
setEditValue(function (prev) {
|
|
1680
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, field, value));
|
|
1681
|
+
});
|
|
1682
|
+
};
|
|
1683
|
+
var handleKeyDown = function handleKeyDown(e, itemId) {
|
|
1684
|
+
if (e.key === 'Enter') {
|
|
1685
|
+
handleEditSave(itemId);
|
|
1686
|
+
} else if (e.key === 'Escape') {
|
|
1687
|
+
handleEditCancel();
|
|
1688
|
+
}
|
|
1689
|
+
};
|
|
1690
|
+
var renderEditForm = function renderEditForm(item) {
|
|
1691
|
+
var editableFields = getEditableFields(item);
|
|
1692
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
1693
|
+
className: "".concat(prefix, "-draggable-list__edit-form")
|
|
1694
|
+
}, editableFields.map(function (field) {
|
|
1695
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
1696
|
+
key: field,
|
|
1697
|
+
className: "".concat(prefix, "-draggable-list__edit-field")
|
|
1698
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", null, field, ":"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
|
|
1699
|
+
type: "text",
|
|
1700
|
+
value: editValue[field] || '',
|
|
1701
|
+
onChange: function onChange(e) {
|
|
1702
|
+
return handleInputChange(field, e.target.value);
|
|
1703
|
+
},
|
|
1704
|
+
onKeyDown: function onKeyDown(e) {
|
|
1705
|
+
return handleKeyDown(e, item.id);
|
|
1706
|
+
},
|
|
1707
|
+
placeholder: field,
|
|
1708
|
+
autoFocus: field === editableFields[0]
|
|
1709
|
+
}));
|
|
1710
|
+
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
1711
|
+
className: "".concat(prefix, "-draggable-list__edit-buttons")
|
|
1712
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", {
|
|
1713
|
+
onClick: function onClick() {
|
|
1714
|
+
return handleEditSave(item.id);
|
|
1715
|
+
}
|
|
1716
|
+
}, "\u2713"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", {
|
|
1717
|
+
onClick: handleEditCancel
|
|
1718
|
+
}, "\u2715")));
|
|
1719
|
+
};
|
|
1720
|
+
(0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
1721
|
+
// data init
|
|
1722
|
+
//--------------
|
|
1723
|
+
if (typeof data !== 'undefined' && Array.isArray(data)) {
|
|
1724
|
+
var tree = hierarchical ? (0, funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1__.convertTree)(data, '', 'id', 'parentId') : data;
|
|
1725
|
+
var _ORGIN_DATA = hierarchical ? (0, funda_utils_dist_cjs_tree__WEBPACK_IMPORTED_MODULE_1__.addTreeDepth)(tree) : tree;
|
|
1726
|
+
setItems(_ORGIN_DATA);
|
|
1727
|
+
}
|
|
1728
|
+
}, [data]);
|
|
1729
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("ul", _extends({}, attributes, {
|
|
1730
|
+
ref: function ref(node) {
|
|
1731
|
+
rootRef.current = node;
|
|
1732
|
+
if (typeof externalRef === 'function') {
|
|
1733
|
+
externalRef(node);
|
|
1734
|
+
} else if (externalRef) {
|
|
1735
|
+
externalRef.current = node;
|
|
1736
|
+
}
|
|
1737
|
+
},
|
|
1738
|
+
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'), {
|
|
1739
|
+
'draggable': draggable,
|
|
1740
|
+
'icon-hide': handleHide,
|
|
1741
|
+
'alternate-collapse': alternateCollapse
|
|
1742
|
+
})
|
|
1743
|
+
}), items.map(function (item, index) {
|
|
1744
|
+
// If the item should be hidden, the rendering is skipped
|
|
1745
|
+
if (!shouldShowItem(item)) return null;
|
|
1746
|
+
|
|
1747
|
+
// collapse
|
|
1748
|
+
var hasChildItems = hasChildren(item.id);
|
|
1749
|
+
var isCollapsed = collapsedItems.has(item.id);
|
|
1750
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("li", {
|
|
1751
|
+
key: item.id,
|
|
1752
|
+
"data-index": index,
|
|
1753
|
+
"data-id": item.id,
|
|
1754
|
+
"data-parent-id": item.parentId,
|
|
1755
|
+
"data-value": item.value,
|
|
1756
|
+
"data-label": item.label,
|
|
1757
|
+
"data-listitemlabel": item.listItemLabel,
|
|
1758
|
+
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'), {
|
|
1759
|
+
'disabled': item.disabled,
|
|
1760
|
+
'draggable': draggable,
|
|
1761
|
+
'editing': editingItem === item.id,
|
|
1762
|
+
// collapse
|
|
1763
|
+
'has-children': hasChildItems,
|
|
1764
|
+
'collapsed': isCollapsed
|
|
1765
|
+
}),
|
|
1766
|
+
draggable: !draggable ? undefined : editingItem !== item.id && "true",
|
|
1767
|
+
onDragStart: !draggable ? undefined : function (e) {
|
|
1768
|
+
return dragHandlers.handleDragStart(e, index);
|
|
1769
|
+
},
|
|
1770
|
+
onDragOver: !draggable ? undefined : dragHandlers.handleDragOver,
|
|
1771
|
+
onDragEnd: !draggable ? undefined : dragHandlers.handleDragEnd,
|
|
1772
|
+
onTouchStart: !draggable ? undefined : function (e) {
|
|
1773
|
+
return dragHandlers.handleDragStart(e, index);
|
|
1774
|
+
},
|
|
1775
|
+
onTouchMove: !draggable ? undefined : dragHandlers.handleDragOver,
|
|
1776
|
+
onTouchEnd: !draggable ? undefined : dragHandlers.handleDragEnd,
|
|
1777
|
+
style: itemStyle,
|
|
1778
|
+
onDoubleClick: function onDoubleClick() {
|
|
1779
|
+
return handleDoubleClick(item);
|
|
1780
|
+
}
|
|
1781
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
1782
|
+
className: "".concat(prefix, "-draggable-list__itemcontent")
|
|
1783
|
+
}, draggable && !handleHide ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
1784
|
+
ref: dragHandle,
|
|
1785
|
+
className: "".concat(prefix, "-draggable-list__handle ").concat(handlePos !== null && handlePos !== void 0 ? handlePos : 'left'),
|
|
1786
|
+
draggable: dragMode === 'handle',
|
|
1787
|
+
dangerouslySetInnerHTML: {
|
|
1788
|
+
__html: "".concat(handleIcon)
|
|
1789
|
+
}
|
|
1790
|
+
}) : null, editingItem === item.id ? renderEditForm(item) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
1791
|
+
className: "".concat(prefix, "-draggable-list__itemcontent-inner")
|
|
1792
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
1793
|
+
className: "".concat(prefix, "-draggable-list__itemlabel")
|
|
1794
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
1795
|
+
dangerouslySetInnerHTML: {
|
|
1796
|
+
__html: "".concat(getIndentStr(item)).concat(typeof item.listItemLabel === 'undefined' ? item.label : item.listItemLabel)
|
|
1797
|
+
}
|
|
1798
|
+
}), alternateCollapse && hasChildItems && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
1799
|
+
className: "".concat(prefix, "-draggable-list__collapse-arrow"),
|
|
1800
|
+
onClick: function onClick(e) {
|
|
1801
|
+
return handleCollapse(item.id, e);
|
|
1802
|
+
}
|
|
1803
|
+
}, 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", {
|
|
1804
|
+
className: "".concat(prefix, "-draggable-list__itemext"),
|
|
1805
|
+
id: "".concat(prefix, "-draggable-list__itemext-").concat(item.value)
|
|
1806
|
+
}, item.appendControl)) : null)));
|
|
1807
|
+
}));
|
|
1808
|
+
});
|
|
1809
|
+
/* harmony default export */
|
|
1810
|
+
var __WEBPACK_DEFAULT_EXPORT__ = DragDropList;
|
|
1811
|
+
})();
|
|
1812
|
+
|
|
1813
|
+
/******/
|
|
1814
|
+
return __webpack_exports__;
|
|
1815
|
+
/******/
|
|
1816
|
+
}()
|
|
1817
|
+
);
|
|
1818
|
+
});
|
|
1819
|
+
|
|
1820
|
+
/***/ }),
|
|
1821
|
+
|
|
14
1822
|
/***/ 188:
|
|
15
1823
|
/***/ (function(module, exports, __webpack_require__) {
|
|
16
1824
|
|
|
@@ -358,369 +2166,16 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
358
2166
|
}).join('');
|
|
359
2167
|
}
|
|
360
2168
|
|
|
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;
|
|
2169
|
+
/**
|
|
2170
|
+
* Convert array value to string separated by curly braces
|
|
2171
|
+
* @param {String[]} arr such as: ['1','2','3']
|
|
2172
|
+
* @returns {String} such as: {1}{2}{3}
|
|
2173
|
+
*/
|
|
2174
|
+
function _convertArrToValByBraces(arr) {
|
|
2175
|
+
if (!Array.isArray(arr)) return '';
|
|
2176
|
+
return arr.map(function (v) {
|
|
2177
|
+
return v.toString().includes('{') && v.toString().includes('}') ? "".concat(v) : "{".concat(v, "}");
|
|
2178
|
+
}).join('');
|
|
724
2179
|
}
|
|
725
2180
|
|
|
726
2181
|
/******/
|
|
@@ -1147,460 +2602,106 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1147
2602
|
/******/Object.defineProperty(exports, Symbol.toStringTag, {
|
|
1148
2603
|
value: 'Module'
|
|
1149
2604
|
});
|
|
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
|
-
}
|
|
2605
|
+
/******/
|
|
1481
2606
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
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;
|
|
2607
|
+
/******/
|
|
2608
|
+
Object.defineProperty(exports, '__esModule', {
|
|
2609
|
+
value: true
|
|
1514
2610
|
});
|
|
2611
|
+
/******/
|
|
2612
|
+
};
|
|
2613
|
+
/******/
|
|
2614
|
+
})();
|
|
2615
|
+
/******/
|
|
2616
|
+
/************************************************************************/
|
|
2617
|
+
var __webpack_exports__ = {};
|
|
2618
|
+
__nested_webpack_require_993__.r(__webpack_exports__);
|
|
2619
|
+
/* harmony export */
|
|
2620
|
+
__nested_webpack_require_993__.d(__webpack_exports__, {
|
|
2621
|
+
/* harmony export */"deepClone": function deepClone() {
|
|
2622
|
+
return (/* binding */_deepClone
|
|
2623
|
+
);
|
|
2624
|
+
},
|
|
2625
|
+
/* harmony export */"flatData": function flatData() {
|
|
2626
|
+
return (/* binding */_flatData
|
|
2627
|
+
);
|
|
2628
|
+
},
|
|
2629
|
+
/* harmony export */"removeArrDuplicateItems": function removeArrDuplicateItems() {
|
|
2630
|
+
return (/* binding */_removeArrDuplicateItems
|
|
2631
|
+
);
|
|
1515
2632
|
}
|
|
1516
|
-
|
|
2633
|
+
/* harmony export */
|
|
2634
|
+
});
|
|
2635
|
+
function _typeof(obj) {
|
|
2636
|
+
"@babel/helpers - typeof";
|
|
1517
2637
|
|
|
2638
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
2639
|
+
return typeof obj;
|
|
2640
|
+
} : function (obj) {
|
|
2641
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2642
|
+
}, _typeof(obj);
|
|
2643
|
+
}
|
|
1518
2644
|
/**
|
|
1519
|
-
*
|
|
1520
|
-
* @param {Array}
|
|
1521
|
-
* @
|
|
2645
|
+
* Remove Duplicate objects from JSON Array
|
|
2646
|
+
* @param {Array} obj
|
|
2647
|
+
* @param {String} fieldName
|
|
1522
2648
|
*/
|
|
1523
|
-
function
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
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;
|
|
2649
|
+
function _removeArrDuplicateItems(obj, fieldName) {
|
|
2650
|
+
if (!Array.isArray(obj)) return [];
|
|
2651
|
+
var clean = obj.filter(function (item, index, self) {
|
|
2652
|
+
return index === self.findIndex(function (t) {
|
|
2653
|
+
return t[fieldName] === item[fieldName];
|
|
2654
|
+
});
|
|
1536
2655
|
});
|
|
1537
|
-
return
|
|
2656
|
+
return clean;
|
|
1538
2657
|
}
|
|
2658
|
+
;
|
|
1539
2659
|
|
|
1540
2660
|
/**
|
|
1541
|
-
*
|
|
1542
|
-
* @param {
|
|
1543
|
-
* @returns Number
|
|
2661
|
+
* Deep clone
|
|
2662
|
+
* @param {*} obj
|
|
1544
2663
|
*/
|
|
1545
|
-
function
|
|
1546
|
-
|
|
1547
|
-
return
|
|
1548
|
-
return
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
|
|
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));
|
|
2664
|
+
function _deepClone(obj) {
|
|
2665
|
+
if (Array.isArray(obj)) {
|
|
2666
|
+
return obj.map(function (item) {
|
|
2667
|
+
return _deepClone(item);
|
|
2668
|
+
});
|
|
2669
|
+
} else if (_typeof(obj) === 'object' && obj !== null) {
|
|
2670
|
+
var clone = {};
|
|
2671
|
+
for (var key in obj) {
|
|
2672
|
+
if (obj.hasOwnProperty(key)) {
|
|
2673
|
+
clone[key] = _deepClone(obj[key]);
|
|
2674
|
+
}
|
|
1576
2675
|
}
|
|
1577
|
-
return
|
|
1578
|
-
}
|
|
2676
|
+
return clone;
|
|
2677
|
+
} else {
|
|
2678
|
+
return obj;
|
|
2679
|
+
}
|
|
1579
2680
|
}
|
|
1580
2681
|
|
|
1581
2682
|
/**
|
|
1582
|
-
*
|
|
1583
|
-
* @param {
|
|
1584
|
-
* @
|
|
1585
|
-
* @param {?string} lastPlaceholder - Last String of placeholder
|
|
1586
|
-
* @param {?string} keyName - Key value of name.
|
|
1587
|
-
* @returns Array
|
|
2683
|
+
* Flat Data
|
|
2684
|
+
* @param {*} data
|
|
2685
|
+
* @returns
|
|
1588
2686
|
*/
|
|
1589
|
-
function
|
|
1590
|
-
var
|
|
1591
|
-
var
|
|
1592
|
-
|
|
1593
|
-
|
|
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
|
-
});
|
|
2687
|
+
function _flatData(data) {
|
|
2688
|
+
var result = [];
|
|
2689
|
+
var iterate = function iterate(obj) {
|
|
2690
|
+
if (!obj) {
|
|
2691
|
+
return;
|
|
1602
2692
|
}
|
|
1603
|
-
|
|
2693
|
+
obj.forEach(function (item) {
|
|
2694
|
+
result.push(item);
|
|
2695
|
+
if (item.children) {
|
|
2696
|
+
iterate(item.children);
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
// delete current item children
|
|
2700
|
+
delete item.children;
|
|
2701
|
+
});
|
|
2702
|
+
};
|
|
2703
|
+
iterate(data);
|
|
2704
|
+
return result;
|
|
1604
2705
|
}
|
|
1605
2706
|
|
|
1606
2707
|
/******/
|
|
@@ -1883,13 +2984,14 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1883
2984
|
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
|
1884
2985
|
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(787);
|
|
1885
2986
|
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
|
|
2987
|
+
// EXTERNAL MODULE: ../DragDropList/dist/cjs/index.js
|
|
2988
|
+
var cjs = __webpack_require__(954);
|
|
2989
|
+
var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
|
|
1886
2990
|
// EXTERNAL MODULE: ../Utils/dist/cjs/useComId.js
|
|
1887
2991
|
var useComId = __webpack_require__(85);
|
|
1888
2992
|
var useComId_default = /*#__PURE__*/__webpack_require__.n(useComId);
|
|
1889
2993
|
// EXTERNAL MODULE: ../Utils/dist/cjs/initDefaultOptions.js
|
|
1890
2994
|
var initDefaultOptions = __webpack_require__(186);
|
|
1891
|
-
// EXTERNAL MODULE: ../Utils/dist/cjs/tree.js
|
|
1892
|
-
var tree = __webpack_require__(438);
|
|
1893
2995
|
// EXTERNAL MODULE: ../Utils/dist/cjs/extract.js
|
|
1894
2996
|
var extract = __webpack_require__(135);
|
|
1895
2997
|
// EXTERNAL MODULE: ../Utils/dist/cjs/convert.js
|
|
@@ -1937,276 +3039,54 @@ function multiSelControlOptionExist(arr, val) {
|
|
|
1937
3039
|
function uniqueArr(arr) {
|
|
1938
3040
|
return arr.filter(function (item, index, self) {
|
|
1939
3041
|
return index === self.findIndex(function (t) {
|
|
1940
|
-
return t.
|
|
3042
|
+
return t.id == item.id;
|
|
1941
3043
|
});
|
|
1942
3044
|
});
|
|
1943
3045
|
}
|
|
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
3046
|
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
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;
|
|
3047
|
+
/**
|
|
3048
|
+
* Remove Duplicate objects from Options
|
|
3049
|
+
* @param {Array} arr
|
|
3050
|
+
* @returns
|
|
3051
|
+
*/
|
|
3052
|
+
function uniqueOpt(arr) {
|
|
3053
|
+
return arr.flat().filter(function (item, index, self) {
|
|
3054
|
+
return index === self.findIndex(function (t) {
|
|
3055
|
+
return t.id === item.id;
|
|
1994
3056
|
});
|
|
1995
|
-
};
|
|
1996
|
-
|
|
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);
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
2016
3059
|
|
|
2017
|
-
|
|
2018
|
-
|
|
3060
|
+
/**
|
|
3061
|
+
* Sort JSON arrays according to the order of the numeric arrays
|
|
3062
|
+
* @param {Array<Number>|Array<String>} orderArray
|
|
3063
|
+
* @param {Array<*>} arr
|
|
3064
|
+
* @param {String} field
|
|
3065
|
+
* @returns
|
|
3066
|
+
*/
|
|
3067
|
+
function sortedJsonArray(orderArray, arr) {
|
|
3068
|
+
var field = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'value';
|
|
3069
|
+
return orderArray.map(function (orderId) {
|
|
3070
|
+
return arr.find(function (item) {
|
|
3071
|
+
return item[field] === orderId;
|
|
2019
3072
|
});
|
|
2020
|
-
};
|
|
2021
|
-
|
|
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);
|
|
3073
|
+
});
|
|
3074
|
+
}
|
|
2195
3075
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
2196
|
-
var _excluded = ["contentRef", "wrapperClassName", "childClassName", "wrapperMinHeight", "wrapperMinWidth", "availableHeaderTitle", "selectedHeaderTitle", "selectedHeaderNote", "selectedResultReverse", "removeAllBtnLabel", "addAllBtnLabel", "iconAdd", "iconRemove", "unattachedSelect", "
|
|
3076
|
+
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
3077
|
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
3078
|
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
3079
|
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
|
|
2201
|
-
function
|
|
2202
|
-
function
|
|
2203
|
-
function
|
|
3080
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3081
|
+
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."); }
|
|
3082
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
3083
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
2204
3084
|
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
3085
|
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) ||
|
|
3086
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2207
3087
|
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
|
|
2209
|
-
function
|
|
3088
|
+
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); }
|
|
3089
|
+
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
3090
|
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
3091
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2212
3092
|
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 +3100,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
2220
3100
|
|
|
2221
3101
|
|
|
2222
3102
|
|
|
2223
|
-
|
|
2224
3103
|
var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, externalRef) {
|
|
2225
3104
|
var contentRef = props.contentRef,
|
|
2226
3105
|
wrapperClassName = props.wrapperClassName,
|
|
@@ -2237,20 +3116,36 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2237
3116
|
iconAdd = props.iconAdd,
|
|
2238
3117
|
iconRemove = props.iconRemove,
|
|
2239
3118
|
unattachedSelect = props.unattachedSelect,
|
|
2240
|
-
hierarchical = props.hierarchical,
|
|
2241
|
-
indentation = props.indentation,
|
|
2242
|
-
doubleIndent = props.doubleIndent,
|
|
2243
|
-
alternateCollapse = props.alternateCollapse,
|
|
2244
|
-
arrow = props.arrow,
|
|
2245
3119
|
options = props.options,
|
|
2246
3120
|
disabled = props.disabled,
|
|
2247
3121
|
required = props.required,
|
|
2248
|
-
appendControl = props.appendControl,
|
|
2249
3122
|
defaultValue = props.defaultValue,
|
|
2250
3123
|
value = props.value,
|
|
2251
3124
|
label = props.label,
|
|
2252
3125
|
name = props.name,
|
|
2253
3126
|
id = props.id,
|
|
3127
|
+
_props$draggable = props.draggable,
|
|
3128
|
+
draggable = _props$draggable === void 0 ? true : _props$draggable,
|
|
3129
|
+
_props$handleHide = props.handleHide,
|
|
3130
|
+
handleHide = _props$handleHide === void 0 ? false : _props$handleHide,
|
|
3131
|
+
_props$handleIcon = props.handleIcon,
|
|
3132
|
+
handleIcon = _props$handleIcon === void 0 ? '☰' : _props$handleIcon,
|
|
3133
|
+
_props$handlePos = props.handlePos,
|
|
3134
|
+
handlePos = _props$handlePos === void 0 ? 'left' : _props$handlePos,
|
|
3135
|
+
_props$dragMode = props.dragMode,
|
|
3136
|
+
dragMode = _props$dragMode === void 0 ? 'handle' : _props$dragMode,
|
|
3137
|
+
indentation = props.indentation,
|
|
3138
|
+
doubleIndent = props.doubleIndent,
|
|
3139
|
+
alternateCollapse = props.alternateCollapse,
|
|
3140
|
+
_props$arrow = props.arrow,
|
|
3141
|
+
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", {
|
|
3142
|
+
viewBox: "0 0 22 22",
|
|
3143
|
+
width: "8px"
|
|
3144
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3145
|
+
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",
|
|
3146
|
+
transform: "matrix(.03541-.00013.00013.03541 2.98 3.02)",
|
|
3147
|
+
fill: "#a5a5a5"
|
|
3148
|
+
}))) : _props$arrow,
|
|
2254
3149
|
extractValueByBrackets = props.extractValueByBrackets,
|
|
2255
3150
|
style = props.style,
|
|
2256
3151
|
data = props.data,
|
|
@@ -2263,18 +3158,15 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2263
3158
|
onRemoveAll = props.onRemoveAll,
|
|
2264
3159
|
onChange = props.onChange,
|
|
2265
3160
|
attributes = _objectWithoutProperties(props, _excluded);
|
|
2266
|
-
var
|
|
3161
|
+
var UNATTACHED_SELECT = typeof unattachedSelect === 'undefined' || unattachedSelect === false ? false : true;
|
|
2267
3162
|
var WRAPPER_MIN_H = typeof wrapperMinHeight === 'undefined' ? '' : wrapperMinHeight;
|
|
2268
3163
|
var WRAPPER_MIN_W = typeof wrapperMinWidth === 'undefined' ? '' : wrapperMinWidth;
|
|
2269
|
-
var INDENT_PLACEHOLDER = doubleIndent ? " " : " ";
|
|
2270
|
-
var INDENT_LAST_PLACEHOLDER = "".concat(typeof indentation !== 'undefined' && indentation !== '' ? "".concat(indentation, " ") : '');
|
|
2271
3164
|
var VALUE_BY_BRACKETS = typeof extractValueByBrackets === 'undefined' ? true : extractValueByBrackets;
|
|
2272
3165
|
var uniqueID = useComId_default()();
|
|
2273
3166
|
var idRes = id || uniqueID;
|
|
2274
3167
|
var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
2275
3168
|
var inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
2276
3169
|
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
3170
|
var optionsRes = options ? (0,initDefaultOptions.isJSON)(options) ? JSON.parse(options) : options : [];
|
|
2279
3171
|
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
|
|
2280
3172
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2285,45 +3177,122 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2285
3177
|
valSelected = _useState4[0],
|
|
2286
3178
|
setValSelected = _useState4[1];
|
|
2287
3179
|
|
|
3180
|
+
// temp default value
|
|
3181
|
+
var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(undefined),
|
|
3182
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
3183
|
+
tempDefaultValue = _useState6[0],
|
|
3184
|
+
setTempDefaultValue = _useState6[1];
|
|
3185
|
+
|
|
2288
3186
|
// return a array of options
|
|
2289
3187
|
var optionsDataInit = optionsRes;
|
|
2290
3188
|
|
|
2291
3189
|
//
|
|
2292
|
-
var
|
|
2293
|
-
|
|
2294
|
-
changedSearchVal =
|
|
2295
|
-
setChangedSearchVal =
|
|
3190
|
+
var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
|
|
3191
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
3192
|
+
changedSearchVal = _useState8[0],
|
|
3193
|
+
setChangedSearchVal = _useState8[1];
|
|
2296
3194
|
|
|
2297
3195
|
//
|
|
2298
|
-
var
|
|
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),
|
|
3196
|
+
var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(optionsDataInit),
|
|
2303
3197
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
2304
|
-
|
|
2305
|
-
|
|
3198
|
+
dataInit = _useState10[0],
|
|
3199
|
+
setDataInit = _useState10[1];
|
|
3200
|
+
var _useState11 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3201
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
3202
|
+
hasErr = _useState12[0],
|
|
3203
|
+
setHasErr = _useState12[1];
|
|
2306
3204
|
|
|
2307
3205
|
// exposes the following methods
|
|
2308
|
-
|
|
2309
3206
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(contentRef, function () {
|
|
2310
3207
|
return {
|
|
2311
3208
|
clear: function clear(cb) {
|
|
2312
|
-
|
|
3209
|
+
var _params = fetchFuncMethodParams || [];
|
|
3210
|
+
fetchData(_params.join(','), '');
|
|
2313
3211
|
cb === null || cb === void 0 ? void 0 : cb();
|
|
2314
3212
|
},
|
|
2315
|
-
/*
|
|
2316
|
-
set([{"label": "Option 1","listItemLabel":"Option 1 (No: 001)","value": "value-1","queryString": "option1"}], () => { console.log('callback') }])
|
|
2317
|
-
*/
|
|
2318
3213
|
set: function set(inputData, cb) {
|
|
2319
3214
|
if (!Array.isArray(inputData)) return;
|
|
2320
|
-
|
|
3215
|
+
var _params = fetchFuncMethodParams || [];
|
|
3216
|
+
fetchData(_params.join(','), inputData.map(function (v) {
|
|
2321
3217
|
return "[".concat(v.value, "]");
|
|
2322
|
-
}).join('')
|
|
3218
|
+
}).join(''));
|
|
2323
3219
|
cb === null || cb === void 0 ? void 0 : cb();
|
|
2324
3220
|
}
|
|
2325
3221
|
};
|
|
2326
|
-
}, [contentRef
|
|
3222
|
+
}, [contentRef]);
|
|
3223
|
+
var getExtControll = function getExtControll(index, id, value, extendedContent, defaultValue) {
|
|
3224
|
+
var forceItemSelected = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
|
|
3225
|
+
var itemSelected = false;
|
|
3226
|
+
if (typeof defaultValue !== 'undefined' && defaultValue !== '') {
|
|
3227
|
+
var _val = VALUE_BY_BRACKETS ? (0,extract.extractContentsOfBrackets)(defaultValue) : defaultValue.trim().replace(/^\,|\,$/g, '').split(',');
|
|
3228
|
+
if (Array.isArray(_val) && _val.includes(String(value))) {
|
|
3229
|
+
itemSelected = true;
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
if (typeof forceItemSelected !== 'undefined') itemSelected = forceItemSelected;
|
|
3233
|
+
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", {
|
|
3234
|
+
style: {
|
|
3235
|
+
paddingLeft: '1rem',
|
|
3236
|
+
width: '100%',
|
|
3237
|
+
display: 'flex',
|
|
3238
|
+
alignItems: 'center',
|
|
3239
|
+
justifyContent: 'end'
|
|
3240
|
+
}
|
|
3241
|
+
}, 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", {
|
|
3242
|
+
className: "m-select-v2__ext",
|
|
3243
|
+
id: "m-select-v2__ext-".concat(id).concat(itemSelected ? '-selected' : '')
|
|
3244
|
+
}, 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", {
|
|
3245
|
+
href: "#",
|
|
3246
|
+
onClick: function onClick(e) {
|
|
3247
|
+
e.preventDefault();
|
|
3248
|
+
e.stopPropagation();
|
|
3249
|
+
|
|
3250
|
+
// remove
|
|
3251
|
+
removeItem(id);
|
|
3252
|
+
}
|
|
3253
|
+
}, 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", {
|
|
3254
|
+
width: "15px",
|
|
3255
|
+
height: "15px",
|
|
3256
|
+
viewBox: "0 0 24 24",
|
|
3257
|
+
fill: "none"
|
|
3258
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3259
|
+
fillRule: "evenodd",
|
|
3260
|
+
clipRule: "evenodd",
|
|
3261
|
+
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",
|
|
3262
|
+
fill: "#000"
|
|
3263
|
+
}))))) : /*#__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", {
|
|
3264
|
+
href: "#",
|
|
3265
|
+
onClick: function onClick(e) {
|
|
3266
|
+
e.preventDefault();
|
|
3267
|
+
e.stopPropagation();
|
|
3268
|
+
|
|
3269
|
+
// add
|
|
3270
|
+
selectItem(id);
|
|
3271
|
+
}
|
|
3272
|
+
}, 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", {
|
|
3273
|
+
width: "15px",
|
|
3274
|
+
height: "15px",
|
|
3275
|
+
viewBox: "0 0 24 24",
|
|
3276
|
+
fill: "none"
|
|
3277
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
3278
|
+
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",
|
|
3279
|
+
fill: "#000"
|
|
3280
|
+
})))))));
|
|
3281
|
+
};
|
|
3282
|
+
var dragdropListDataInit = function dragdropListDataInit(data) {
|
|
3283
|
+
// Add appendControl to list
|
|
3284
|
+
data.forEach(function (item, index) {
|
|
3285
|
+
item.appendControl = getExtControll(index, item.id, item.value, item.extendedContent, tempDefaultValue);
|
|
3286
|
+
});
|
|
3287
|
+
return data;
|
|
3288
|
+
};
|
|
3289
|
+
var dragdropListDefaultDataInit = function dragdropListDefaultDataInit(data) {
|
|
3290
|
+
// Update appendControl to list
|
|
3291
|
+
data.forEach(function (item, index) {
|
|
3292
|
+
item.appendControl = getExtControll(index, item.id, item.value, item.extendedContent, tempDefaultValue, false);
|
|
3293
|
+
});
|
|
3294
|
+
return data;
|
|
3295
|
+
};
|
|
2327
3296
|
function fetchData(_x2, _x3) {
|
|
2328
3297
|
return _fetchData.apply(this, arguments);
|
|
2329
3298
|
}
|
|
@@ -2342,7 +3311,7 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2342
3311
|
break;
|
|
2343
3312
|
}
|
|
2344
3313
|
_context.next = 4;
|
|
2345
|
-
return fetchFuncAsync["".concat(fetchFuncMethod)].apply(fetchFuncAsync,
|
|
3314
|
+
return fetchFuncAsync["".concat(fetchFuncMethod)].apply(fetchFuncAsync, _toConsumableArray(params.split(',')));
|
|
2346
3315
|
case 4:
|
|
2347
3316
|
response = _context.sent;
|
|
2348
3317
|
_ORGIN_DATA = response.data; // reset data structure
|
|
@@ -2357,15 +3326,12 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2357
3326
|
_ORGIN_DATA = [];
|
|
2358
3327
|
}
|
|
2359
3328
|
|
|
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
3329
|
// remove Duplicate objects from JSON Array
|
|
2367
3330
|
_ORGIN_DATA = (0,object.removeArrDuplicateItems)(_ORGIN_DATA, 'value');
|
|
2368
3331
|
|
|
3332
|
+
// save temporary default value
|
|
3333
|
+
setTempDefaultValue(inputDefault);
|
|
3334
|
+
|
|
2369
3335
|
//
|
|
2370
3336
|
setDataInit(_ORGIN_DATA); // data must be initialized
|
|
2371
3337
|
|
|
@@ -2376,15 +3342,12 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2376
3342
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(_ORGIN_DATA);
|
|
2377
3343
|
return _context.abrupt("return", _ORGIN_DATA);
|
|
2378
3344
|
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
3345
|
// remove Duplicate objects from JSON Array
|
|
2386
3346
|
optionsDataInit = (0,object.removeArrDuplicateItems)(optionsDataInit, 'value');
|
|
2387
3347
|
|
|
3348
|
+
// save temporary default value
|
|
3349
|
+
setTempDefaultValue(inputDefault);
|
|
3350
|
+
|
|
2388
3351
|
//
|
|
2389
3352
|
setDataInit(optionsDataInit); // data must be initialized
|
|
2390
3353
|
|
|
@@ -2416,9 +3379,9 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2416
3379
|
setValSelected(_initVal);
|
|
2417
3380
|
|
|
2418
3381
|
// Initialize selected options
|
|
2419
|
-
if (
|
|
3382
|
+
if (UNATTACHED_SELECT) {
|
|
2420
3383
|
setValSelectedData(function (prevState) {
|
|
2421
|
-
var _data = [].concat(
|
|
3384
|
+
var _data = [].concat(_toConsumableArray(prevState), _toConsumableArray(options.filter(function (item) {
|
|
2422
3385
|
return multiSelControlOptionExist(_initVal, item.value);
|
|
2423
3386
|
})));
|
|
2424
3387
|
return uniqueArr(_data);
|
|
@@ -2428,110 +3391,148 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2428
3391
|
return multiSelControlOptionExist(_initVal, item.value);
|
|
2429
3392
|
}));
|
|
2430
3393
|
}
|
|
3394
|
+
|
|
3395
|
+
// Initialize default options
|
|
3396
|
+
setDataInit(options.filter(function (item) {
|
|
3397
|
+
return !multiSelControlOptionExist(_initVal, item.value);
|
|
3398
|
+
}));
|
|
2431
3399
|
} else {
|
|
2432
3400
|
setValSelected([]);
|
|
2433
3401
|
setValSelectedData([]);
|
|
2434
3402
|
}
|
|
2435
3403
|
}
|
|
2436
3404
|
}
|
|
2437
|
-
function selectItem(
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
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;
|
|
3405
|
+
function selectItem(curId) {
|
|
3406
|
+
// update default options
|
|
3407
|
+
setDataInit(function (prevState) {
|
|
3408
|
+
var newDefaultData = prevState.filter(function (item) {
|
|
3409
|
+
return item.id != curId;
|
|
2450
3410
|
});
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
3411
|
+
var targetData = prevState.find(function (v) {
|
|
3412
|
+
return v.id == curId;
|
|
3413
|
+
}); // !!!from old "dataInit"
|
|
3414
|
+
var _data = typeof targetData !== 'undefined' ? targetData : {};
|
|
3415
|
+
|
|
3416
|
+
// update selected data
|
|
3417
|
+
setValSelectedData(function (prevState2) {
|
|
3418
|
+
var newSelectedData = dragdropListDataInit([].concat(_toConsumableArray(prevState2), [_data]));
|
|
3419
|
+
|
|
3420
|
+
// update selected items
|
|
3421
|
+
setValSelected(function (prevState3) {
|
|
3422
|
+
var newValueData = newSelectedData.map(function (v) {
|
|
3423
|
+
return v.value;
|
|
3424
|
+
});
|
|
3425
|
+
var newValueStr = VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(newValueData) : newValueData.join(',');
|
|
3426
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(document.querySelector("[data-id=\"".concat(curId, "\"]")), newValueData, newValueStr, _data, 'add', newSelectedData);
|
|
2454
3427
|
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
3428
|
+
// update temporary default value
|
|
3429
|
+
setTempDefaultValue(newValueStr);
|
|
3430
|
+
return newValueData;
|
|
3431
|
+
});
|
|
3432
|
+
return uniqueArr(newSelectedData);
|
|
3433
|
+
});
|
|
3434
|
+
return uniqueArr(newDefaultData);
|
|
2458
3435
|
});
|
|
2459
|
-
|
|
3436
|
+
}
|
|
3437
|
+
function removeItem(curId) {
|
|
2460
3438
|
// update selected data
|
|
2461
3439
|
setValSelectedData(function (prevState) {
|
|
2462
|
-
var
|
|
2463
|
-
|
|
2464
|
-
return item.value == _val;
|
|
3440
|
+
var newSelectedData = prevState.filter(function (item) {
|
|
3441
|
+
return item.id != curId;
|
|
2465
3442
|
});
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
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;
|
|
3443
|
+
var targetData = prevState.find(function (v) {
|
|
3444
|
+
return v.id == curId;
|
|
3445
|
+
}); // !!!from old "valSelectedData"
|
|
3446
|
+
var _data = typeof targetData !== 'undefined' ? targetData : {};
|
|
3447
|
+
|
|
3448
|
+
// update default options
|
|
3449
|
+
setDataInit(function (prevState2) {
|
|
3450
|
+
var newDefaultData = dragdropListDefaultDataInit([].concat(_toConsumableArray(prevState2), [_data]));
|
|
3451
|
+
return uniqueArr(newDefaultData);
|
|
2482
3452
|
});
|
|
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
3453
|
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
3454
|
+
// update selected items
|
|
3455
|
+
setValSelected(function (prevState3) {
|
|
3456
|
+
var newValueData = newSelectedData.map(function (v) {
|
|
3457
|
+
return v.value;
|
|
3458
|
+
});
|
|
3459
|
+
var newValueStr = VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(newValueData) : newValueData.join(',');
|
|
3460
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(document.querySelector("[data-id=\"".concat(curId, "\"]")), newValueData, newValueStr, _data, 'remove', newSelectedData);
|
|
3461
|
+
|
|
3462
|
+
// update temporary default value
|
|
3463
|
+
setTempDefaultValue(newValueStr);
|
|
3464
|
+
return newValueData;
|
|
2500
3465
|
});
|
|
2501
|
-
|
|
2502
|
-
var _res = newData;
|
|
2503
|
-
return _res;
|
|
3466
|
+
return uniqueArr(newSelectedData);
|
|
2504
3467
|
});
|
|
2505
3468
|
}
|
|
2506
3469
|
function handleSelectAll(event) {
|
|
2507
3470
|
event.preventDefault();
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
3471
|
+
event.stopPropagation();
|
|
3472
|
+
|
|
3473
|
+
// update default options
|
|
3474
|
+
setDataInit(function (prevState) {
|
|
3475
|
+
var newDefaultData = [];
|
|
3476
|
+
|
|
3477
|
+
// filter the "disabled" option
|
|
3478
|
+
var disabledData = prevState.filter(function (v) {
|
|
3479
|
+
return v.disabled === true;
|
|
3480
|
+
}); // !!!from old "dataInit"
|
|
3481
|
+
var targetData = prevState.filter(function (v) {
|
|
3482
|
+
return typeof v.disabled === 'undefined' || v.disabled === false;
|
|
3483
|
+
}); // !!!from old "dataInit"
|
|
3484
|
+
|
|
3485
|
+
// update selected data
|
|
3486
|
+
setValSelectedData(function (prevState2) {
|
|
3487
|
+
var newSelectedData = dragdropListDataInit([].concat(_toConsumableArray(prevState2), _toConsumableArray(targetData)));
|
|
3488
|
+
|
|
3489
|
+
// update selected items
|
|
3490
|
+
setValSelected(function (prevState3) {
|
|
3491
|
+
var newValueData = newSelectedData.map(function (v) {
|
|
3492
|
+
return v.value;
|
|
3493
|
+
});
|
|
3494
|
+
var newValueStr = VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(newValueData) : newValueData.join(',');
|
|
3495
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null, newValueData, newValueStr, null, 'add-all', newSelectedData);
|
|
2515
3496
|
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
return
|
|
2523
|
-
})
|
|
3497
|
+
// update temporary default value
|
|
3498
|
+
setTempDefaultValue(newValueStr);
|
|
3499
|
+
return newValueData;
|
|
3500
|
+
});
|
|
3501
|
+
return uniqueArr(newSelectedData);
|
|
3502
|
+
});
|
|
3503
|
+
return uniqueArr([].concat(newDefaultData, _toConsumableArray(disabledData)));
|
|
3504
|
+
});
|
|
2524
3505
|
}
|
|
2525
3506
|
function handleRemoveAll(event) {
|
|
2526
3507
|
event.preventDefault();
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
3508
|
+
event.stopPropagation();
|
|
3509
|
+
|
|
3510
|
+
// update selected data
|
|
3511
|
+
setValSelectedData(function (prevState) {
|
|
3512
|
+
var newSelectedData = [];
|
|
3513
|
+
var targetData = prevState; // !!!from old "valSelectedData"
|
|
3514
|
+
|
|
3515
|
+
// update default options
|
|
3516
|
+
setDataInit(function (prevState2) {
|
|
3517
|
+
var newDefaultData = dragdropListDefaultDataInit([].concat(_toConsumableArray(prevState2), _toConsumableArray(targetData)));
|
|
3518
|
+
return uniqueArr(newDefaultData);
|
|
3519
|
+
});
|
|
3520
|
+
|
|
3521
|
+
// update selected items
|
|
3522
|
+
setValSelected(function (prevState3) {
|
|
3523
|
+
var newValueData = newSelectedData.map(function (v) {
|
|
3524
|
+
return v.value;
|
|
3525
|
+
});
|
|
3526
|
+
var newValueStr = VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(newValueData) : newValueData.join(',');
|
|
3527
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null, newValueData, newValueStr, null, 'remove-all', newSelectedData);
|
|
3528
|
+
onRemoveAll === null || onRemoveAll === void 0 ? void 0 : onRemoveAll(event, newValueData, newValueStr, newSelectedData);
|
|
2532
3529
|
|
|
2533
|
-
|
|
2534
|
-
|
|
3530
|
+
// update temporary default value
|
|
3531
|
+
setTempDefaultValue(newValueStr);
|
|
3532
|
+
return newValueData;
|
|
3533
|
+
});
|
|
3534
|
+
return uniqueArr(newSelectedData);
|
|
3535
|
+
});
|
|
2535
3536
|
}
|
|
2536
3537
|
function handleChangeSearch(event) {
|
|
2537
3538
|
var inputVal = event.target.value;
|
|
@@ -2574,14 +3575,14 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2574
3575
|
}
|
|
2575
3576
|
}, []);
|
|
2576
3577
|
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-
|
|
3578
|
+
className: (0,cls.combinedCls)('m-select-v2__wrapper', (0,cls.clsWrite)(wrapperClassName, 'mb-3')),
|
|
2578
3579
|
ref: rootRef,
|
|
2579
3580
|
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
|
|
3581
|
+
minWidth: WRAPPER_MIN_W === '' ? 'var(--m-select-v2-wrapper-min-w)' : WRAPPER_MIN_W,
|
|
3582
|
+
minHeight: WRAPPER_MIN_H === '' ? 'var(--m-select-v2-wrapper-min-h)' : WRAPPER_MIN_H
|
|
2582
3583
|
}
|
|
2583
3584
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
2584
|
-
className: "m-select-diving-line"
|
|
3585
|
+
className: "m-select-v2-diving-line"
|
|
2585
3586
|
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", _extends({
|
|
2586
3587
|
ref: function ref(node) {
|
|
2587
3588
|
inputRef.current = node;
|
|
@@ -2602,17 +3603,17 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2602
3603
|
},
|
|
2603
3604
|
required: required || null
|
|
2604
3605
|
}, attributes)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
2605
|
-
className: "m-select-inner"
|
|
3606
|
+
className: "m-select-v2-inner"
|
|
2606
3607
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
2607
|
-
className: "m-
|
|
3608
|
+
className: "m-select-v2__available__container"
|
|
2608
3609
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
2609
|
-
className: "m-
|
|
3610
|
+
className: "m-select-v2__m-select-v2__item-actions m-select-v2__header"
|
|
2610
3611
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
2611
|
-
className: "m-
|
|
3612
|
+
className: "m-select-v2__search__container"
|
|
2612
3613
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", {
|
|
2613
3614
|
type: "text",
|
|
2614
3615
|
value: changedSearchVal,
|
|
2615
|
-
className: "m-
|
|
3616
|
+
className: "m-select-v2__search",
|
|
2616
3617
|
onChange: handleChangeSearch
|
|
2617
3618
|
}), /*#__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
3619
|
width: "0.8em",
|
|
@@ -2623,61 +3624,75 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2623
3624
|
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
3625
|
fillRule: "evenodd"
|
|
2625
3626
|
})))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
2626
|
-
className: "m-
|
|
3627
|
+
className: "m-select-v2__title",
|
|
2627
3628
|
dangerouslySetInnerHTML: {
|
|
2628
3629
|
__html: "".concat(availableHeaderTitle || '')
|
|
2629
3630
|
}
|
|
2630
3631
|
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
2631
3632
|
href: "#",
|
|
2632
|
-
className: "m-
|
|
3633
|
+
className: "m-select-v2__btn--add-all",
|
|
2633
3634
|
onClick: handleSelectAll
|
|
2634
|
-
}, addAllBtnLabel || 'Add all')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
listContainerClassName: "m-select__available m-select__options-contentlist",
|
|
3635
|
+
}, addAllBtnLabel || 'Add all')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((cjs_default()), {
|
|
3636
|
+
data: dragdropListDefaultDataInit(dataInit),
|
|
3637
|
+
wrapperClassName: "",
|
|
2638
3638
|
ref: availableListRef,
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
3639
|
+
prefix: "m-select-v2",
|
|
3640
|
+
draggable: false,
|
|
3641
|
+
handleHide: handleHide,
|
|
3642
|
+
handleIcon: handleIcon,
|
|
3643
|
+
handlePos: handlePos,
|
|
3644
|
+
dragMode: dragMode,
|
|
3645
|
+
indentation: indentation,
|
|
3646
|
+
doubleIndent: doubleIndent,
|
|
2643
3647
|
alternateCollapse: alternateCollapse,
|
|
2644
|
-
|
|
2645
|
-
arrow: arrow,
|
|
2646
|
-
data: dataInit,
|
|
2647
|
-
childClassName: childClassName || 'm-select__options-contentlist-custom'
|
|
3648
|
+
arrow: arrow
|
|
2648
3649
|
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
2649
|
-
className: "m-
|
|
3650
|
+
className: "m-select-v2__selected__container"
|
|
2650
3651
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
2651
|
-
className: "m-
|
|
3652
|
+
className: "m-select-v2__m-select-v2__item-actions m-select-v2__header"
|
|
2652
3653
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
2653
|
-
className: "m-
|
|
3654
|
+
className: "m-select-v2__count",
|
|
2654
3655
|
dangerouslySetInnerHTML: {
|
|
2655
3656
|
__html: "".concat(typeof selectedHeaderNote !== 'undefined' ? selectedHeaderNote.replace('{items_num}', valSelectedData.length) : '')
|
|
2656
3657
|
}
|
|
2657
3658
|
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
2658
|
-
className: "m-
|
|
3659
|
+
className: "m-select-v2__title",
|
|
2659
3660
|
dangerouslySetInnerHTML: {
|
|
2660
3661
|
__html: "".concat(selectedHeaderTitle || '')
|
|
2661
3662
|
}
|
|
2662
3663
|
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
2663
3664
|
href: "#",
|
|
2664
|
-
className: "m-
|
|
3665
|
+
className: "m-select-v2__btn--remove-all",
|
|
2665
3666
|
onClick: handleRemoveAll
|
|
2666
|
-
}, removeAllBtnLabel || 'Remove all')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
3667
|
+
}, removeAllBtnLabel || 'Remove all')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((cjs_default()), {
|
|
3668
|
+
data: dragdropListDataInit(selectedResultReverse ? valSelectedData.reverse() : valSelectedData),
|
|
3669
|
+
onUpdate: function onUpdate(newData, curId) {
|
|
3670
|
+
setValSelectedData(newData);
|
|
3671
|
+
var newValueData = newData.map(function (v) {
|
|
3672
|
+
return v.value;
|
|
3673
|
+
});
|
|
3674
|
+
var newValueStr = VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(newValueData) : newValueData.join(',');
|
|
3675
|
+
var targetData = newData.find(function (v) {
|
|
3676
|
+
return v.id == curId;
|
|
3677
|
+
}); // !!!from old "dataInit"
|
|
3678
|
+
var _data = typeof targetData !== 'undefined' ? targetData : {};
|
|
3679
|
+
setValSelected(newData.map(function (v) {
|
|
3680
|
+
return v.value;
|
|
3681
|
+
}));
|
|
3682
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(document.querySelector("[data-id=\"".concat(curId, "\"]")), newValueData, newValueStr, _data, 'update', newData);
|
|
3683
|
+
},
|
|
3684
|
+
wrapperClassName: "",
|
|
3685
|
+
prefix: "m-select-v2",
|
|
3686
|
+
draggable: draggable,
|
|
3687
|
+
handleHide: handleHide,
|
|
3688
|
+
handleIcon: handleIcon,
|
|
3689
|
+
handlePos: handlePos,
|
|
3690
|
+
dragMode: dragMode,
|
|
3691
|
+
indentation: indentation,
|
|
3692
|
+
doubleIndent: doubleIndent,
|
|
3693
|
+
alternateCollapse: false,
|
|
2677
3694
|
arrow: arrow,
|
|
2678
|
-
|
|
2679
|
-
childClassName: (0,cls.clsWrite)(childClassName, 'm-select__options-contentlist--custom'),
|
|
2680
|
-
selected: true
|
|
3695
|
+
hierarchical: false
|
|
2681
3696
|
})))));
|
|
2682
3697
|
});
|
|
2683
3698
|
/* harmony default export */ const src = (MultipleSelect);
|