@sheinx/hooks 3.6.0-beta.27 → 3.6.0-beta.29
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.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAGV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAGV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;CAurBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -33,7 +33,6 @@ function toArray(value) {
|
|
33
33
|
if (!Array.isArray(value)) return [value];
|
34
34
|
return value;
|
35
35
|
}
|
36
|
-
var global_tree_map = new Map();
|
37
36
|
var MODE = exports.MODE = {
|
38
37
|
/**
|
39
38
|
* 返回全选数据,包含父节点和子节点
|
@@ -436,15 +435,6 @@ var useTree = function useTree(props) {
|
|
436
435
|
return 2;
|
437
436
|
};
|
438
437
|
var setData = function setData(data) {
|
439
|
-
// if(data && global_tree_map.get(data)){
|
440
|
-
// context.cachedValue = global_tree_map.get(data)?.cachedValue || []
|
441
|
-
// context.pathMap = global_tree_map.get(data)?.pathMap || new Map()
|
442
|
-
// context.dataMap = global_tree_map.get(data)?.dataMap || new Map()
|
443
|
-
// context.valueMap = global_tree_map.get(data)?.valueMap || new Map()
|
444
|
-
// context.unmatchedValueMap = global_tree_map.get(data)?.unmatchedValueMap || new Map()
|
445
|
-
// return
|
446
|
-
// }
|
447
|
-
|
448
438
|
var prevValue = context.value || [];
|
449
439
|
context.cachedValue = [];
|
450
440
|
context.pathMap = new Map();
|
@@ -465,8 +455,6 @@ var useTree = function useTree(props) {
|
|
465
455
|
}
|
466
456
|
initValue();
|
467
457
|
setValue(prevValue);
|
468
|
-
|
469
|
-
// global_tree_map.set(data, context)
|
470
458
|
};
|
471
459
|
var set = function set(id, checked, direction) {
|
472
460
|
if (!isDisabled(id)) {
|
@@ -508,6 +496,28 @@ var useTree = function useTree(props) {
|
|
508
496
|
}
|
509
497
|
return current;
|
510
498
|
};
|
499
|
+
var updateInnerCheckStatus = function updateInnerCheckStatus() {
|
500
|
+
var _context$value;
|
501
|
+
if (mode !== MODE.MODE_0) return;
|
502
|
+
(_context$value = context.value) === null || _context$value === void 0 || _context$value.forEach(function (id) {
|
503
|
+
var _ref3 = context.pathMap.get(id),
|
504
|
+
children = _ref3.children;
|
505
|
+
if (children.length) {
|
506
|
+
var noCheckedChildren = children.filter(function (cid) {
|
507
|
+
var _context$value2;
|
508
|
+
return !((_context$value2 = context.value) !== null && _context$value2 !== void 0 && _context$value2.includes(cid));
|
509
|
+
});
|
510
|
+
if (noCheckedChildren.length > 0) {
|
511
|
+
setTimeout(function () {
|
512
|
+
setValueMap(id, 2);
|
513
|
+
noCheckedChildren.forEach(function (cid) {
|
514
|
+
setValueMap(cid, 0);
|
515
|
+
});
|
516
|
+
}, 0);
|
517
|
+
}
|
518
|
+
}
|
519
|
+
});
|
520
|
+
};
|
511
521
|
var appendChildrenExpanded = function appendChildrenExpanded(child, level, pid, insertData) {
|
512
522
|
if (!child) return;
|
513
523
|
child.forEach(function (item, i) {
|
@@ -618,6 +628,7 @@ var useTree = function useTree(props) {
|
|
618
628
|
if (props.datum) return;
|
619
629
|
if (!dataUpdate) return;
|
620
630
|
setData(data);
|
631
|
+
updateInnerCheckStatus();
|
621
632
|
}, [data]);
|
622
633
|
(0, _react.useEffect)(function () {
|
623
634
|
if (props.datum) return;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAGV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAGV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;CAurBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -26,7 +26,6 @@ function toArray(value) {
|
|
26
26
|
if (!Array.isArray(value)) return [value];
|
27
27
|
return value;
|
28
28
|
}
|
29
|
-
var global_tree_map = new Map();
|
30
29
|
export var MODE = {
|
31
30
|
/**
|
32
31
|
* 返回全选数据,包含父节点和子节点
|
@@ -429,15 +428,6 @@ var useTree = function useTree(props) {
|
|
429
428
|
return 2;
|
430
429
|
};
|
431
430
|
var setData = function setData(data) {
|
432
|
-
// if(data && global_tree_map.get(data)){
|
433
|
-
// context.cachedValue = global_tree_map.get(data)?.cachedValue || []
|
434
|
-
// context.pathMap = global_tree_map.get(data)?.pathMap || new Map()
|
435
|
-
// context.dataMap = global_tree_map.get(data)?.dataMap || new Map()
|
436
|
-
// context.valueMap = global_tree_map.get(data)?.valueMap || new Map()
|
437
|
-
// context.unmatchedValueMap = global_tree_map.get(data)?.unmatchedValueMap || new Map()
|
438
|
-
// return
|
439
|
-
// }
|
440
|
-
|
441
431
|
var prevValue = context.value || [];
|
442
432
|
context.cachedValue = [];
|
443
433
|
context.pathMap = new Map();
|
@@ -458,8 +448,6 @@ var useTree = function useTree(props) {
|
|
458
448
|
}
|
459
449
|
initValue();
|
460
450
|
setValue(prevValue);
|
461
|
-
|
462
|
-
// global_tree_map.set(data, context)
|
463
451
|
};
|
464
452
|
var set = function set(id, checked, direction) {
|
465
453
|
if (!isDisabled(id)) {
|
@@ -501,6 +489,28 @@ var useTree = function useTree(props) {
|
|
501
489
|
}
|
502
490
|
return current;
|
503
491
|
};
|
492
|
+
var updateInnerCheckStatus = function updateInnerCheckStatus() {
|
493
|
+
var _context$value;
|
494
|
+
if (mode !== MODE.MODE_0) return;
|
495
|
+
(_context$value = context.value) === null || _context$value === void 0 || _context$value.forEach(function (id) {
|
496
|
+
var _ref3 = context.pathMap.get(id),
|
497
|
+
children = _ref3.children;
|
498
|
+
if (children.length) {
|
499
|
+
var noCheckedChildren = children.filter(function (cid) {
|
500
|
+
var _context$value2;
|
501
|
+
return !((_context$value2 = context.value) !== null && _context$value2 !== void 0 && _context$value2.includes(cid));
|
502
|
+
});
|
503
|
+
if (noCheckedChildren.length > 0) {
|
504
|
+
setTimeout(function () {
|
505
|
+
setValueMap(id, 2);
|
506
|
+
noCheckedChildren.forEach(function (cid) {
|
507
|
+
setValueMap(cid, 0);
|
508
|
+
});
|
509
|
+
}, 0);
|
510
|
+
}
|
511
|
+
}
|
512
|
+
});
|
513
|
+
};
|
504
514
|
var appendChildrenExpanded = function appendChildrenExpanded(child, level, pid, insertData) {
|
505
515
|
if (!child) return;
|
506
516
|
child.forEach(function (item, i) {
|
@@ -611,6 +621,7 @@ var useTree = function useTree(props) {
|
|
611
621
|
if (props.datum) return;
|
612
622
|
if (!dataUpdate) return;
|
613
623
|
setData(data);
|
624
|
+
updateInnerCheckStatus();
|
614
625
|
}, [data]);
|
615
626
|
useEffect(function () {
|
616
627
|
if (props.datum) return;
|