util-helpers 4.20.0 → 4.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/util-helpers.js +53 -150
- package/dist/util-helpers.js.map +1 -1
- package/dist/util-helpers.min.js +1 -1
- package/dist/util-helpers.min.js.map +1 -1
- package/esm/VERSION.js +1 -1
- package/esm/ajax.js +4 -2
- package/esm/calculateCursorPosition.js +2 -2
- package/esm/download.js +3 -2
- package/esm/filterTree.js +3 -3
- package/esm/findTreeNode.js +3 -3
- package/esm/findTreeNodes.js +3 -3
- package/esm/findTreeSelect.js +3 -3
- package/esm/index.js +1 -1
- package/esm/listToTree.js +2 -2
- package/esm/loadImage.js +4 -3
- package/esm/loadImageWithBlob.js +4 -3
- package/esm/loadScript.js +2 -1
- package/esm/transformFieldNames.js +5 -4
- package/esm/treeToList.js +3 -3
- package/esm/utils/native.js +5 -0
- package/lib/VERSION.js +1 -1
- package/lib/ajax.js +4 -2
- package/lib/calculateCursorPosition.js +1 -1
- package/lib/download.js +3 -2
- package/lib/filterTree.js +2 -2
- package/lib/findTreeNode.js +2 -2
- package/lib/findTreeNodes.js +2 -2
- package/lib/findTreeSelect.js +2 -2
- package/lib/index.js +1 -1
- package/lib/listToTree.js +1 -1
- package/lib/loadImage.js +4 -3
- package/lib/loadImageWithBlob.js +4 -3
- package/lib/loadScript.js +2 -1
- package/lib/transformFieldNames.js +4 -3
- package/lib/treeToList.js +2 -2
- package/lib/utils/native.js +5 -0
- package/package.json +12 -12
- package/types/filterTree.d.ts +4 -3
- package/types/findTreeNode.d.ts +4 -4
- package/types/findTreeNodes.d.ts +4 -4
- package/types/findTreeSelect.d.ts +3 -3
- package/types/listToTree.d.ts +2 -2
- package/types/treeToList.d.ts +2 -2
- package/types/utils/native.d.ts +6 -0
package/dist/util-helpers.js
CHANGED
|
@@ -8,134 +8,25 @@
|
|
|
8
8
|
return Array.isArray(value);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
var freeGlobalThis = typeof globalThis === 'object' && globalThis && globalThis.Object === Object && globalThis;
|
|
12
|
-
var freeGlobal = typeof global === 'object' && global && global.Object === Object && global;
|
|
13
|
-
var freeSelf = typeof self === 'object' && self && self.Object === Object && self;
|
|
14
|
-
var root = freeGlobalThis || freeGlobal || freeSelf || Function('return this')() || {};
|
|
15
11
|
var objectProto = Object.prototype;
|
|
16
12
|
var objectToString = objectProto.toString;
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var symbolProto = Symbol ? Symbol.prototype : undefined;
|
|
21
|
-
symbolProto ? symbolProto.valueOf : undefined;
|
|
22
|
-
symbolProto ? symbolProto.toString : undefined;
|
|
23
|
-
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
13
|
+
var symbolExisted = typeof Symbol !== 'undefined';
|
|
14
|
+
var symbolProto = symbolExisted ? Symbol.prototype : undefined;
|
|
15
|
+
var numberIsFinite = Number.isFinite;
|
|
24
16
|
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
25
17
|
var MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991;
|
|
26
|
-
var blobExisted = typeof Blob !== 'undefined';
|
|
27
|
-
function toSource(func) {
|
|
28
|
-
if (func !== null) {
|
|
29
|
-
try {
|
|
30
|
-
return functionToString.call(func);
|
|
31
|
-
}
|
|
32
|
-
catch (e) {
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
return func + '';
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return '';
|
|
41
|
-
}
|
|
42
|
-
function wrapTags(tags) {
|
|
43
|
-
return tags.map(function (item) { return '[object ' + item + ']'; });
|
|
44
|
-
}
|
|
45
18
|
var numberTag = '[object Number]';
|
|
46
19
|
var stringTag = '[object String]';
|
|
47
20
|
var symbolTag = '[object Symbol]';
|
|
48
|
-
var argumentsTag = '[object Arguments]';
|
|
49
|
-
wrapTags(['Float32Array', 'Float64Array', 'Int8Array', 'Int16Array', 'Int32Array', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'BigInt64Array', 'BigUint64Array']);
|
|
50
|
-
wrapTags(['Function', 'AsyncFunction', 'GeneratorFunction', 'Proxy']);
|
|
51
21
|
var blobTag = '[object Blob]';
|
|
52
|
-
var fileTag = '[object Blob]';
|
|
53
|
-
var objectTag = '[object Object]';
|
|
54
|
-
var dataViewTag = '[object DataView]';
|
|
55
|
-
var mapTag = '[object Map]';
|
|
56
|
-
var promiseTag = '[object Promise]';
|
|
57
|
-
var setTag = '[object Set]';
|
|
58
|
-
var weakMapTag = '[object WeakMap]';
|
|
59
|
-
var dataViewExisted = typeof DataView !== 'undefined';
|
|
60
|
-
var mapExisted = typeof Map !== 'undefined';
|
|
61
|
-
var promiseExisted = typeof Promise !== 'undefined';
|
|
62
|
-
var setExisted = typeof Set !== 'undefined';
|
|
63
|
-
var weakMapExisted = typeof WeakMap !== 'undefined';
|
|
64
|
-
var initSource = function (existed, str) { return (existed ? str : ''); };
|
|
65
|
-
var dataViewCtorString = initSource(dataViewExisted, toSource(DataView));
|
|
66
|
-
var mapCtorString = initSource(mapExisted, toSource(Map));
|
|
67
|
-
var promiseCtorString = initSource(promiseExisted, toSource(Promise));
|
|
68
|
-
var setCtorString = initSource(setExisted, toSource(Set));
|
|
69
|
-
var weakMapCtorString = initSource(weakMapExisted, toSource(WeakMap));
|
|
70
22
|
|
|
71
23
|
function isObject(value) {
|
|
72
24
|
var type = typeof value;
|
|
73
25
|
return value != null && (type === 'object' || type === 'function');
|
|
74
26
|
}
|
|
75
27
|
|
|
76
|
-
function getRawTag(value) {
|
|
77
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag);
|
|
78
|
-
var tag = value[symToStringTag];
|
|
79
|
-
var unmasked = false;
|
|
80
|
-
try {
|
|
81
|
-
value[symToStringTag] = undefined;
|
|
82
|
-
unmasked = true;
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
}
|
|
86
|
-
var result = objectToString.call(value);
|
|
87
|
-
if (unmasked) {
|
|
88
|
-
if (isOwn) {
|
|
89
|
-
value[symToStringTag] = tag;
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
delete value[symToStringTag];
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return result;
|
|
96
|
-
}
|
|
97
|
-
function _getTag(value) {
|
|
98
|
-
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString.call(value);
|
|
99
|
-
}
|
|
100
|
-
var getTag = _getTag;
|
|
101
|
-
if ((dataViewExisted && objectToString.call(new DataView(new ArrayBuffer(1))) !== dataViewTag) ||
|
|
102
|
-
(mapExisted && objectToString.call(new Map()) !== mapTag) ||
|
|
103
|
-
(promiseExisted && objectToString.call(Promise.resolve()) !== promiseTag) ||
|
|
104
|
-
(setExisted && objectToString.call(new Set()) !== setTag) ||
|
|
105
|
-
(weakMapExisted && objectToString.call(new WeakMap()) !== weakMapTag)) {
|
|
106
|
-
getTag = function (value) {
|
|
107
|
-
var result = _getTag(value);
|
|
108
|
-
var Ctor = result === objectTag ? value.constructor : undefined;
|
|
109
|
-
var ctorString = Ctor ? toSource(Ctor) : '';
|
|
110
|
-
if (ctorString) {
|
|
111
|
-
switch (ctorString) {
|
|
112
|
-
case dataViewCtorString:
|
|
113
|
-
return dataViewTag;
|
|
114
|
-
case mapCtorString:
|
|
115
|
-
return mapTag;
|
|
116
|
-
case promiseCtorString:
|
|
117
|
-
return promiseTag;
|
|
118
|
-
case setCtorString:
|
|
119
|
-
return setTag;
|
|
120
|
-
case weakMapCtorString:
|
|
121
|
-
return weakMapTag;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return result;
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
var getTag$1 = getTag;
|
|
128
|
-
|
|
129
|
-
function checkType(value, tag) {
|
|
130
|
-
return getTag$1(value) === tag;
|
|
131
|
-
}
|
|
132
|
-
function checkTypes(value, tags) {
|
|
133
|
-
var tag = getTag$1(value);
|
|
134
|
-
return tags.some(function (item) { return tag === item; });
|
|
135
|
-
}
|
|
136
|
-
|
|
137
28
|
function isSymbol(value) {
|
|
138
|
-
return typeof value === 'symbol' ||
|
|
29
|
+
return typeof value === 'symbol' || objectToString.call(value) === symbolTag;
|
|
139
30
|
}
|
|
140
31
|
|
|
141
32
|
var reIsBinary = /^0b[01]+$/i;
|
|
@@ -172,9 +63,7 @@
|
|
|
172
63
|
return remainder ? result - remainder : result;
|
|
173
64
|
}
|
|
174
65
|
|
|
175
|
-
|
|
176
|
-
var numberIsFinite = Number.isFinite;
|
|
177
|
-
|
|
66
|
+
var symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
178
67
|
function baseToString(value) {
|
|
179
68
|
if (typeof value === 'string') {
|
|
180
69
|
return value;
|
|
@@ -183,7 +72,7 @@
|
|
|
183
72
|
return "".concat(value.map(baseToString));
|
|
184
73
|
}
|
|
185
74
|
if (isSymbol(value)) {
|
|
186
|
-
return
|
|
75
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
187
76
|
}
|
|
188
77
|
var result = '' + value;
|
|
189
78
|
return result == '0' && 1 / value === -Infinity ? '-0' : result;
|
|
@@ -192,20 +81,30 @@
|
|
|
192
81
|
return value == null ? '' : baseToString(value);
|
|
193
82
|
}
|
|
194
83
|
|
|
84
|
+
var freeGlobalThis = typeof globalThis === 'object' && globalThis && globalThis.Object === Object && globalThis;
|
|
85
|
+
var freeGlobal = typeof global === 'object' && global && global.Object === Object && global;
|
|
86
|
+
var freeSelf = typeof self === 'object' && self && self.Object === Object && self;
|
|
87
|
+
var root = freeGlobalThis || freeGlobal || freeSelf || Function('return this')() || {};
|
|
88
|
+
var root$1 = root;
|
|
89
|
+
|
|
90
|
+
var blobExisted = typeof Blob !== 'undefined';
|
|
195
91
|
function isBlob(value) {
|
|
196
|
-
|
|
92
|
+
if (blobExisted && value instanceof Blob) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return objectToString.call(value) === blobTag;
|
|
197
96
|
}
|
|
198
97
|
|
|
199
98
|
function isFinite$1(value) {
|
|
200
|
-
return numberIsFinite ? numberIsFinite(value) : typeof value === 'number' && root.isFinite(value);
|
|
99
|
+
return numberIsFinite ? numberIsFinite(value) : typeof value === 'number' && root$1.isFinite(value);
|
|
201
100
|
}
|
|
202
101
|
|
|
203
102
|
function isNumber(value) {
|
|
204
|
-
return typeof value === 'number' ||
|
|
103
|
+
return typeof value === 'number' || objectToString.call(value) === numberTag;
|
|
205
104
|
}
|
|
206
105
|
|
|
207
106
|
function isNaN$1(value) {
|
|
208
|
-
return isNumber(value) && root.isNaN(value);
|
|
107
|
+
return isNumber(value) && root$1.isNaN(value);
|
|
209
108
|
}
|
|
210
109
|
|
|
211
110
|
function isPromiseLike$1(value) {
|
|
@@ -213,7 +112,7 @@
|
|
|
213
112
|
}
|
|
214
113
|
|
|
215
114
|
function isString(value) {
|
|
216
|
-
return typeof value === 'string' ||
|
|
115
|
+
return typeof value === 'string' || objectToString.call(value) === stringTag;
|
|
217
116
|
}
|
|
218
117
|
|
|
219
118
|
function decimalAdjust(type, value, precision) {
|
|
@@ -1385,6 +1284,10 @@
|
|
|
1385
1284
|
return divide(product, gcd.apply(void 0, __spreadArray([], __read(args), false)));
|
|
1386
1285
|
}
|
|
1387
1286
|
|
|
1287
|
+
var objectKeys = Object.keys;
|
|
1288
|
+
var createObjectURL = URL.createObjectURL;
|
|
1289
|
+
var revokeObjectURL = URL.revokeObjectURL;
|
|
1290
|
+
|
|
1388
1291
|
function ajax(url, options) {
|
|
1389
1292
|
var _a = options || {}, _b = _a.method, method = _b === void 0 ? 'get' : _b, _c = _a.data, data = _c === void 0 ? null : _c, timeout = _a.timeout, headers = _a.headers, _d = _a.withCredentials, withCredentials = _d === void 0 ? false : _d, _e = _a.async, async = _e === void 0 ? true : _e, _f = _a.user, user = _f === void 0 ? null : _f, _g = _a.password, password = _g === void 0 ? null : _g, responseType = _a.responseType, onReadyStateChange = _a.onReadyStateChange, onLoadStart = _a.onLoadStart, onProgress = _a.onProgress, onAbort = _a.onAbort, onTimeout = _a.onTimeout, onError = _a.onError, onLoad = _a.onLoad, onLoadEnd = _a.onLoadEnd;
|
|
1390
1293
|
return new Promise(function (resolve, reject) {
|
|
@@ -1401,7 +1304,7 @@
|
|
|
1401
1304
|
xhr.responseType = responseType;
|
|
1402
1305
|
}
|
|
1403
1306
|
if (typeof headers === 'object') {
|
|
1404
|
-
|
|
1307
|
+
objectKeys(headers).map(function (item) {
|
|
1405
1308
|
xhr.setRequestHeader(item, headers[item]);
|
|
1406
1309
|
});
|
|
1407
1310
|
}
|
|
@@ -1426,7 +1329,7 @@
|
|
|
1426
1329
|
load: wrapSuccess(onLoad),
|
|
1427
1330
|
loadend: onLoadEnd
|
|
1428
1331
|
};
|
|
1429
|
-
var eventKeys =
|
|
1332
|
+
var eventKeys = objectKeys(events);
|
|
1430
1333
|
eventKeys.map(function (item) {
|
|
1431
1334
|
var func = events[item];
|
|
1432
1335
|
if (func) {
|
|
@@ -1442,7 +1345,7 @@
|
|
|
1442
1345
|
var _a = options.placeholderChar, placeholderChar = _a === void 0 ? ' ' : _a, _b = options.maskReg, maskReg = _b === void 0 ? /\D/g : _b, type = options.type;
|
|
1443
1346
|
var realCtrlValue = toString(prevCtrlValue);
|
|
1444
1347
|
var realRawValue = toString(rawValue);
|
|
1445
|
-
var placeholderChars =
|
|
1348
|
+
var placeholderChars = isArray(placeholderChar) ? placeholderChar : [placeholderChar];
|
|
1446
1349
|
var editLength = realRawValue.length - realCtrlValue.length;
|
|
1447
1350
|
var isAddition = editLength > 0;
|
|
1448
1351
|
var pos = prevPos;
|
|
@@ -1499,10 +1402,10 @@
|
|
|
1499
1402
|
else {
|
|
1500
1403
|
getBlob(img)
|
|
1501
1404
|
.then(function (blob) {
|
|
1502
|
-
var url =
|
|
1405
|
+
var url = createObjectURL(blob);
|
|
1503
1406
|
var image = new Image();
|
|
1504
1407
|
image.onload = function () {
|
|
1505
|
-
|
|
1408
|
+
revokeObjectURL(url);
|
|
1506
1409
|
var result = { blob: blob, image: image };
|
|
1507
1410
|
if (useCache) {
|
|
1508
1411
|
cacheImage$2 = img;
|
|
@@ -1511,7 +1414,7 @@
|
|
|
1511
1414
|
resolve(result);
|
|
1512
1415
|
};
|
|
1513
1416
|
image.onerror = function (err) {
|
|
1514
|
-
|
|
1417
|
+
revokeObjectURL(url);
|
|
1515
1418
|
console.error("[loadImageWithBlob] The image load failed, '".concat(img, "'."));
|
|
1516
1419
|
reject(err);
|
|
1517
1420
|
};
|
|
@@ -1650,9 +1553,9 @@
|
|
|
1650
1553
|
navigator.msSaveBlob(payload, fileName || 'download');
|
|
1651
1554
|
}
|
|
1652
1555
|
else {
|
|
1653
|
-
url =
|
|
1556
|
+
url = createObjectURL(payload);
|
|
1654
1557
|
saver(url, fileName);
|
|
1655
|
-
|
|
1558
|
+
revokeObjectURL(url);
|
|
1656
1559
|
}
|
|
1657
1560
|
return [2, Promise.resolve()];
|
|
1658
1561
|
}
|
|
@@ -1708,14 +1611,14 @@
|
|
|
1708
1611
|
}
|
|
1709
1612
|
else {
|
|
1710
1613
|
var imgIsBlob_1 = isBlob(img);
|
|
1711
|
-
var url_1 = imgIsBlob_1 ?
|
|
1614
|
+
var url_1 = imgIsBlob_1 ? createObjectURL(img) : img;
|
|
1712
1615
|
var image_1 = new Image();
|
|
1713
1616
|
if (!imgIsBlob_1) {
|
|
1714
1617
|
image_1.crossOrigin = 'anonymous';
|
|
1715
1618
|
}
|
|
1716
1619
|
image_1.onload = function () {
|
|
1717
1620
|
if (imgIsBlob_1) {
|
|
1718
|
-
|
|
1621
|
+
revokeObjectURL(url_1);
|
|
1719
1622
|
}
|
|
1720
1623
|
if (useCache) {
|
|
1721
1624
|
cacheImage = img;
|
|
@@ -1725,7 +1628,7 @@
|
|
|
1725
1628
|
};
|
|
1726
1629
|
image_1.onerror = function (err) {
|
|
1727
1630
|
if (imgIsBlob_1) {
|
|
1728
|
-
|
|
1631
|
+
revokeObjectURL(url_1);
|
|
1729
1632
|
}
|
|
1730
1633
|
console.error("[loadImage] The image load failed, '".concat(img, "'."));
|
|
1731
1634
|
reject(err);
|
|
@@ -1748,7 +1651,7 @@
|
|
|
1748
1651
|
script[key] = props[key];
|
|
1749
1652
|
}
|
|
1750
1653
|
if (typeof attrs === 'object') {
|
|
1751
|
-
|
|
1654
|
+
objectKeys(attrs).forEach(function (key) {
|
|
1752
1655
|
script.setAttribute(key, attrs[key]);
|
|
1753
1656
|
});
|
|
1754
1657
|
}
|
|
@@ -1810,7 +1713,7 @@
|
|
|
1810
1713
|
|
|
1811
1714
|
function transformFieldNames(data, fieldNames, childrenField, nodeAssign) {
|
|
1812
1715
|
if (nodeAssign === void 0) { nodeAssign = 'spread'; }
|
|
1813
|
-
if (!
|
|
1716
|
+
if (!isArray(data)) {
|
|
1814
1717
|
return data;
|
|
1815
1718
|
}
|
|
1816
1719
|
if (data.length <= 0) {
|
|
@@ -1823,10 +1726,10 @@
|
|
|
1823
1726
|
}
|
|
1824
1727
|
var newItem = nodeAssign === 'spread' ? __assign({}, item) : item;
|
|
1825
1728
|
var delKeys = [];
|
|
1826
|
-
if (childrenField &&
|
|
1729
|
+
if (childrenField && isArray(newItem[childrenField]) && newItem[childrenField].length > 0) {
|
|
1827
1730
|
newItem[childrenField] = recusion(newItem[childrenField].slice());
|
|
1828
1731
|
}
|
|
1829
|
-
|
|
1732
|
+
objectKeys(fieldNames).forEach(function (newKey) {
|
|
1830
1733
|
var oldKey = fieldNames[newKey];
|
|
1831
1734
|
if (oldKey in newItem) {
|
|
1832
1735
|
newItem[newKey] = newItem[oldKey];
|
|
@@ -1865,7 +1768,7 @@
|
|
|
1865
1768
|
var _a = options.keyField, keyField = _a === void 0 ? 'id' : _a, _b = options.parentField, parentField = _b === void 0 ? 'pid' : _b, _c = options.childrenField, childrenField = _c === void 0 ? 'children' : _c, _d = options.emptyChildrenValue, emptyChildrenValue = _d === void 0 ? 'none' : _d, _e = options.nodeAssign, nodeAssign = _e === void 0 ? 'spread' : _e;
|
|
1866
1769
|
var tree = [];
|
|
1867
1770
|
var record = {};
|
|
1868
|
-
if (!
|
|
1771
|
+
if (!isArray(list)) {
|
|
1869
1772
|
return tree;
|
|
1870
1773
|
}
|
|
1871
1774
|
list.forEach(function (item) {
|
|
@@ -1900,7 +1803,7 @@
|
|
|
1900
1803
|
|
|
1901
1804
|
function treeToList(tree, childrenField) {
|
|
1902
1805
|
var list = [];
|
|
1903
|
-
if (!
|
|
1806
|
+
if (!isArray(tree)) {
|
|
1904
1807
|
return list;
|
|
1905
1808
|
}
|
|
1906
1809
|
function recusion(arr) {
|
|
@@ -1909,7 +1812,7 @@
|
|
|
1909
1812
|
var newItem = __assign({}, item);
|
|
1910
1813
|
list.push(newItem);
|
|
1911
1814
|
if (newItem[childrenField]) {
|
|
1912
|
-
if (
|
|
1815
|
+
if (isArray(newItem[childrenField]) && newItem[childrenField].length > 0) {
|
|
1913
1816
|
recusion(newItem[childrenField]);
|
|
1914
1817
|
}
|
|
1915
1818
|
delete newItem[childrenField];
|
|
@@ -1928,7 +1831,7 @@
|
|
|
1928
1831
|
if (childrenField === void 0) { childrenField = 'children'; }
|
|
1929
1832
|
if (nodeAssign === void 0) { nodeAssign = 'spread'; }
|
|
1930
1833
|
var result = [];
|
|
1931
|
-
if (!
|
|
1834
|
+
if (!isArray(tree)) {
|
|
1932
1835
|
return result;
|
|
1933
1836
|
}
|
|
1934
1837
|
tree.forEach(function (item) {
|
|
@@ -1939,7 +1842,7 @@
|
|
|
1939
1842
|
if (predicate(newItem)) {
|
|
1940
1843
|
if (isObject(newItem)) {
|
|
1941
1844
|
var childs = newItem[childrenField];
|
|
1942
|
-
if (
|
|
1845
|
+
if (isArray(childs) && childs.length > 0) {
|
|
1943
1846
|
newItem[childrenField] = filterTree(childs, predicate, childrenField, nodeAssign);
|
|
1944
1847
|
}
|
|
1945
1848
|
}
|
|
@@ -1954,7 +1857,7 @@
|
|
|
1954
1857
|
if (childrenField === void 0) { childrenField = 'children'; }
|
|
1955
1858
|
var stack = [];
|
|
1956
1859
|
var node;
|
|
1957
|
-
if (!
|
|
1860
|
+
if (!isArray(tree)) {
|
|
1958
1861
|
return node;
|
|
1959
1862
|
}
|
|
1960
1863
|
try {
|
|
@@ -1969,7 +1872,7 @@
|
|
|
1969
1872
|
}
|
|
1970
1873
|
if (isObject(temp)) {
|
|
1971
1874
|
var childs = temp[childrenField];
|
|
1972
|
-
if (
|
|
1875
|
+
if (isArray(childs) && childs.length > 0) {
|
|
1973
1876
|
childs.forEach(function (c) {
|
|
1974
1877
|
stack.push(c);
|
|
1975
1878
|
});
|
|
@@ -1996,7 +1899,7 @@
|
|
|
1996
1899
|
if (childrenField === void 0) { childrenField = 'children'; }
|
|
1997
1900
|
var stack = [];
|
|
1998
1901
|
var nodes = [];
|
|
1999
|
-
if (!
|
|
1902
|
+
if (!isArray(tree)) {
|
|
2000
1903
|
return nodes;
|
|
2001
1904
|
}
|
|
2002
1905
|
try {
|
|
@@ -2010,7 +1913,7 @@
|
|
|
2010
1913
|
}
|
|
2011
1914
|
if (isObject(temp)) {
|
|
2012
1915
|
var childs = temp[childrenField];
|
|
2013
|
-
if (
|
|
1916
|
+
if (isArray(childs) && childs.length > 0) {
|
|
2014
1917
|
childs.forEach(function (c) {
|
|
2015
1918
|
stack.push(c);
|
|
2016
1919
|
});
|
|
@@ -2032,7 +1935,7 @@
|
|
|
2032
1935
|
function internalFindTreeSelect(tree, predicate, childrenField, path) {
|
|
2033
1936
|
var e_1, _a;
|
|
2034
1937
|
if (path === void 0) { path = []; }
|
|
2035
|
-
if (!
|
|
1938
|
+
if (!isArray(tree)) {
|
|
2036
1939
|
return [];
|
|
2037
1940
|
}
|
|
2038
1941
|
try {
|
|
@@ -2044,7 +1947,7 @@
|
|
|
2044
1947
|
}
|
|
2045
1948
|
if (isObject(item)) {
|
|
2046
1949
|
var childs = item[childrenField];
|
|
2047
|
-
if (
|
|
1950
|
+
if (isArray(childs) && childs.length > 0) {
|
|
2048
1951
|
var findChildren = internalFindTreeSelect(childs, predicate, childrenField, path);
|
|
2049
1952
|
if (findChildren.length > 0) {
|
|
2050
1953
|
return findChildren;
|
|
@@ -2068,9 +1971,9 @@
|
|
|
2068
1971
|
return internalFindTreeSelect(tree, predicate, childrenField);
|
|
2069
1972
|
}
|
|
2070
1973
|
|
|
2071
|
-
var VERSION = "4.20.
|
|
1974
|
+
var VERSION = "4.20.2";
|
|
2072
1975
|
|
|
2073
|
-
var version = "4.20.
|
|
1976
|
+
var version = "4.20.2";
|
|
2074
1977
|
|
|
2075
1978
|
exports.VERSION = VERSION;
|
|
2076
1979
|
exports.ajax = ajax;
|