dlsjs 0.1.23 → 0.1.25
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 +36 -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 +118 -30
package/dist/dlsjs.esm.js
CHANGED
|
@@ -4259,21 +4259,24 @@ function isType(e, D) {
|
|
|
4259
4259
|
return k.includes(!0);
|
|
4260
4260
|
}
|
|
4261
4261
|
function list2Tree(e, D = {}) {
|
|
4262
|
-
let O = {
|
|
4262
|
+
let O = _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);
|
|
4268
|
+
if (e[0] && !e[0].hasOwnProperty("id")) return console.warn("数据非标准,未找到唯一标识字段,直接返回"), e;
|
|
4269
|
+
let { id: k, children: A, parentId: j, useConcat: M } = O, N = /* @__PURE__ */ new Map(), P = [];
|
|
4270
|
+
for (let D of e) {
|
|
4271
|
+
let e = D[k];
|
|
4272
|
+
D[A] || (D[A] = []), N.set(e, D);
|
|
4273
|
+
}
|
|
4274
|
+
for (let D of e) {
|
|
4275
|
+
let e = D[j], O = N.get(e);
|
|
4276
|
+
O ? M && Array.isArray(O[A]) ? O[A] = O[A].concat(D) : O[A].push(D) : P.push(D);
|
|
4277
|
+
}
|
|
4278
|
+
for (let D of e) Array.isArray(D[A]) && D[A].length === 0 && delete D[A];
|
|
4279
|
+
return P;
|
|
4277
4280
|
}
|
|
4278
4281
|
function setParentIds4List(e) {
|
|
4279
4282
|
e.forEach((D) => {
|
|
@@ -4334,6 +4337,9 @@ function forkProp(e, D, O) {
|
|
|
4334
4337
|
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
4338
|
}
|
|
4336
4339
|
function dim2Tree(e, D, O) {
|
|
4340
|
+
return list2Tree(dim2List(e, D, O));
|
|
4341
|
+
}
|
|
4342
|
+
function dim2List(e, D, O) {
|
|
4337
4343
|
let k = [];
|
|
4338
4344
|
if (D.length) for (let e of D) {
|
|
4339
4345
|
if (!e) continue;
|
|
@@ -4350,7 +4356,7 @@ function dim2Tree(e, D, O) {
|
|
|
4350
4356
|
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
4357
|
O == 0 && (j.parentId = "-1"), j.label = D[k[O].textFieldName], j.value = D[k[O].propFieldName], A.push(j);
|
|
4352
4358
|
}
|
|
4353
|
-
return
|
|
4359
|
+
return uniqBy_default((e) => e.id, A);
|
|
4354
4360
|
}
|
|
4355
4361
|
function treeFilter(e, D) {
|
|
4356
4362
|
let O = tree2List(e);
|
|
@@ -4368,8 +4374,23 @@ function tree2List(e, D = []) {
|
|
|
4368
4374
|
return D;
|
|
4369
4375
|
}
|
|
4370
4376
|
function treeCutLevel(e, D) {
|
|
4371
|
-
|
|
4372
|
-
|
|
4377
|
+
if (D <= 0) return [];
|
|
4378
|
+
if (D === 1) return e.map((e) => {
|
|
4379
|
+
let D = _objectSpread2({}, e);
|
|
4380
|
+
return delete D.children, D;
|
|
4381
|
+
});
|
|
4382
|
+
let O = [...e], k = [];
|
|
4383
|
+
for (let e = 2; e <= D; e++) {
|
|
4384
|
+
let A = [];
|
|
4385
|
+
for (let j of O) if (j.children && j.children.length > 0) if (e === D) {
|
|
4386
|
+
let e = j.children.map((e) => {
|
|
4387
|
+
let D = _objectSpread2({}, e);
|
|
4388
|
+
return delete D.children, D;
|
|
4389
|
+
});
|
|
4390
|
+
k.push(...e);
|
|
4391
|
+
} else A.push(...j.children);
|
|
4392
|
+
if (O = A, O.length === 0) break;
|
|
4393
|
+
}
|
|
4373
4394
|
return k;
|
|
4374
4395
|
}
|
|
4375
4396
|
var ReservedFunction = {
|
|
@@ -5066,6 +5087,6 @@ const DLS_CONFIG = {
|
|
|
5066
5087
|
TREE_PARENT_ID: "parentId",
|
|
5067
5088
|
TREE_CHILDREN: "children"
|
|
5068
5089
|
};
|
|
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 };
|
|
5090
|
+
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
5091
|
|
|
5071
5092
|
//# sourceMappingURL=dlsjs.esm.js.map
|