dlsjs 0.1.23 → 0.1.24
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/dlsjs.cjs.js +7 -7
- package/dist/dlsjs.cjs.js.map +1 -1
- package/dist/dlsjs.esm.js +34 -15
- package/dist/dlsjs.esm.js.map +1 -1
- package/dist/dlsjs.umd.js +7 -7
- package/dist/dlsjs.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/core/ES/Tree.js +112 -30
package/dist/dlsjs.esm.js
CHANGED
|
@@ -4259,21 +4259,22 @@ function isType(e, D) {
|
|
|
4259
4259
|
return k.includes(!0);
|
|
4260
4260
|
}
|
|
4261
4261
|
function list2Tree(e, D = {}) {
|
|
4262
|
-
let O = {
|
|
4262
|
+
let { id: O, children: k, parentId: A, useConcat: j } = _objectSpread2({
|
|
4263
4263
|
id: "id",
|
|
4264
4264
|
children: "children",
|
|
4265
4265
|
parentId: "parentId",
|
|
4266
4266
|
useConcat: !1
|
|
4267
|
-
};
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4267
|
+
}, D), M = /* @__PURE__ */ new Map(), N = [];
|
|
4268
|
+
for (let D of e) {
|
|
4269
|
+
let e = D[O];
|
|
4270
|
+
D[k] || (D[k] = []), M.set(e, D);
|
|
4271
|
+
}
|
|
4272
|
+
for (let D of e) {
|
|
4273
|
+
let e = D[A], O = M.get(e);
|
|
4274
|
+
O ? j && Array.isArray(O[k]) ? O[k] = O[k].concat(D) : O[k].push(D) : N.push(D);
|
|
4275
|
+
}
|
|
4276
|
+
for (let D of e) Array.isArray(D[k]) && D[k].length === 0 && delete D[k];
|
|
4277
|
+
return N;
|
|
4277
4278
|
}
|
|
4278
4279
|
function setParentIds4List(e) {
|
|
4279
4280
|
e.forEach((D) => {
|
|
@@ -4334,6 +4335,9 @@ function forkProp(e, D, O) {
|
|
|
4334
4335
|
return e != null && e.hasOwnProperty && e.hasOwnProperty(O) ? e[O] : e != null && e.hasOwnProperty && e.hasOwnProperty(D) || e[D] ? forkProp(e[D], D, O) : null;
|
|
4335
4336
|
}
|
|
4336
4337
|
function dim2Tree(e, D, O) {
|
|
4338
|
+
return list2Tree(dim2List(e, D, O));
|
|
4339
|
+
}
|
|
4340
|
+
function dim2List(e, D, O) {
|
|
4337
4341
|
let k = [];
|
|
4338
4342
|
if (D.length) for (let e of D) {
|
|
4339
4343
|
if (!e) continue;
|
|
@@ -4350,7 +4354,7 @@ function dim2Tree(e, D, O) {
|
|
|
4350
4354
|
for (let e = 0; e <= O; e++) j.id += D[k[e].propFieldName], O > 0 && e > 0 && (j.parentId += D[k[e - 1].propFieldName]);
|
|
4351
4355
|
O == 0 && (j.parentId = "-1"), j.label = D[k[O].textFieldName], j.value = D[k[O].propFieldName], A.push(j);
|
|
4352
4356
|
}
|
|
4353
|
-
return
|
|
4357
|
+
return uniqBy_default((e) => e.id, A);
|
|
4354
4358
|
}
|
|
4355
4359
|
function treeFilter(e, D) {
|
|
4356
4360
|
let O = tree2List(e);
|
|
@@ -4368,8 +4372,23 @@ function tree2List(e, D = []) {
|
|
|
4368
4372
|
return D;
|
|
4369
4373
|
}
|
|
4370
4374
|
function treeCutLevel(e, D) {
|
|
4371
|
-
|
|
4372
|
-
|
|
4375
|
+
if (D <= 0) return [];
|
|
4376
|
+
if (D === 1) return e.map((e) => {
|
|
4377
|
+
let D = _objectSpread2({}, e);
|
|
4378
|
+
return delete D.children, D;
|
|
4379
|
+
});
|
|
4380
|
+
let O = [...e], k = [];
|
|
4381
|
+
for (let e = 2; e <= D; e++) {
|
|
4382
|
+
let A = [];
|
|
4383
|
+
for (let j of O) if (j.children && j.children.length > 0) if (e === D) {
|
|
4384
|
+
let e = j.children.map((e) => {
|
|
4385
|
+
let D = _objectSpread2({}, e);
|
|
4386
|
+
return delete D.children, D;
|
|
4387
|
+
});
|
|
4388
|
+
k.push(...e);
|
|
4389
|
+
} else A.push(...j.children);
|
|
4390
|
+
if (O = A, O.length === 0) break;
|
|
4391
|
+
}
|
|
4373
4392
|
return k;
|
|
4374
4393
|
}
|
|
4375
4394
|
var ReservedFunction = {
|
|
@@ -5066,6 +5085,6 @@ const DLS_CONFIG = {
|
|
|
5066
5085
|
TREE_PARENT_ID: "parentId",
|
|
5067
5086
|
TREE_CHILDREN: "children"
|
|
5068
5087
|
};
|
|
5069
|
-
export { Chain_default as Chain, DLS_CONFIG, Poll, RW, checkMust, checkShould, chooseFile, chooseJsonObj, combine, combineArr, copyText, createMyTrans, createSM, debounceAsync, deepAssign, deepAssignArr, deepConvert, deepDiff, deepMerge, dim2Tree, dlsjsTrans, downloadBlob, downloadByUrl, downloadText, exitFullscreen, file2Json, findLeaf, forkProp, getTextWidth, isFullscreenActive, isMobileDevice, isRangeIn, isType, json2Blob, lazyChange, list2Tree, localGet, localRemove, localSet, matchRules, movePanel, moveRelate, queryDefinitionByRef, requestFile, requestFullscreen, requestJSON, runTemplateString, sessionGet, sessionRemove, sessionSet, setDefinitionByRef, setParentIds4List, shallowAssign, shallowAssignArr, shallowRW, throttleAsync, toBase64, toggleFullscreen, tree2List, treeCutLevel, treeDel, treeFilter, treeFind, treeFindParent, treeForEach, treeMap, waitMS, waitValue };
|
|
5088
|
+
export { Chain_default as Chain, DLS_CONFIG, Poll, RW, checkMust, checkShould, chooseFile, chooseJsonObj, combine, combineArr, copyText, createMyTrans, createSM, debounceAsync, deepAssign, deepAssignArr, deepConvert, deepDiff, deepMerge, dim2List, dim2Tree, dlsjsTrans, downloadBlob, downloadByUrl, downloadText, exitFullscreen, file2Json, findLeaf, forkProp, getTextWidth, isFullscreenActive, isMobileDevice, isRangeIn, isType, json2Blob, lazyChange, list2Tree, localGet, localRemove, localSet, matchRules, movePanel, moveRelate, queryDefinitionByRef, requestFile, requestFullscreen, requestJSON, runTemplateString, sessionGet, sessionRemove, sessionSet, setDefinitionByRef, setParentIds4List, shallowAssign, shallowAssignArr, shallowRW, throttleAsync, toBase64, toggleFullscreen, tree2List, treeCutLevel, treeDel, treeFilter, treeFind, treeFindParent, treeForEach, treeMap, waitMS, waitValue };
|
|
5070
5089
|
|
|
5071
5090
|
//# sourceMappingURL=dlsjs.esm.js.map
|