@sheinx/hooks 3.8.0-beta.34 → 3.8.0-beta.36
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/cjs/common/use-filter/use-filter.d.ts.map +1 -1
- package/cjs/common/use-filter/use-filter.js +4 -1
- package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree.js +14 -12
- package/esm/common/use-filter/use-filter.d.ts.map +1 -1
- package/esm/common/use-filter/use-filter.js +4 -1
- package/esm/components/use-tree/use-tree.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree.js +14 -12
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-filter.d.ts","sourceRoot":"","sources":["use-filter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,QAAA,MAAM,SAAS;;;;;;;;;;kCAmBkD,OAAO;
|
1
|
+
{"version":3,"file":"use-filter.d.ts","sourceRoot":"","sources":["use-filter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,QAAA,MAAM,SAAS;;;;;;;;;;kCAmBkD,OAAO;sBAoB1C,MAAM;sBAKN,MAAM,SAAQ,MAAM;;;CAsGjD,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
@@ -58,7 +58,10 @@ var useFilter = function useFilter(props) {
|
|
58
58
|
return (0, _utils.getKey)(keygen, item) === key;
|
59
59
|
};
|
60
60
|
var handleClearCreatedData = function handleClearCreatedData() {
|
61
|
-
|
61
|
+
// why setTimeout: 避免回车时,新创建的数据走到了renderUnmatched逻辑中去
|
62
|
+
setTimeout(function () {
|
63
|
+
setCreatedData(undefined);
|
64
|
+
}, 0);
|
62
65
|
};
|
63
66
|
var handleCreate = function handleCreate(text) {
|
64
67
|
var createFn = typeof onCreate === 'boolean' ? function (t) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAIV,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;;;;;
|
1
|
+
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAIV,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;;;;;CAktBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -149,6 +149,8 @@ var useTree = function useTree(props) {
|
|
149
149
|
var _context$dataFlatStat2;
|
150
150
|
context.updateMap.set(id, update);
|
151
151
|
var isActive = activeProp === id;
|
152
|
+
// 立即调用update函数设置正确的active状态
|
153
|
+
if (isActive) update('active', isActive);
|
152
154
|
return {
|
153
155
|
active: isActive,
|
154
156
|
expanded: !!((_context$dataFlatStat2 = context.dataFlatStatusMap.get(id)) !== null && _context$dataFlatStat2 !== void 0 && _context$dataFlatStat2.expanded)
|
@@ -278,7 +280,7 @@ var useTree = function useTree(props) {
|
|
278
280
|
context.dataMap.set(id, item);
|
279
281
|
if (virtual) {
|
280
282
|
context.dataFlatStatusMap.set(id, {
|
281
|
-
active:
|
283
|
+
active: activeProp === id,
|
282
284
|
expanded: defaultExpandAll ? true : (expanded === null || expanded === void 0 ? void 0 : expanded.includes(id)) || false,
|
283
285
|
fetching: false
|
284
286
|
});
|
@@ -629,6 +631,17 @@ var useTree = function useTree(props) {
|
|
629
631
|
call('expanded', tempExpandMap.has(id));
|
630
632
|
});
|
631
633
|
});
|
634
|
+
(0, _react.useEffect)(function () {
|
635
|
+
if (props.datum) return;
|
636
|
+
if (!dataUpdate) return;
|
637
|
+
setData(data);
|
638
|
+
var nextExpanded = props.expanded || props.defaultExpanded || [];
|
639
|
+
if (!defaultExpandAll && !(0, _utils.shallowEqual)(nextExpanded, expanded)) {
|
640
|
+
onExpand(nextExpanded);
|
641
|
+
updateExpanded(nextExpanded, true);
|
642
|
+
}
|
643
|
+
updateInnerCheckStatus();
|
644
|
+
}, [props.data]);
|
632
645
|
(0, _react.useEffect)(function () {
|
633
646
|
if (defaultExpandAll) {
|
634
647
|
var nextExpanded = [];
|
@@ -641,17 +654,6 @@ var useTree = function useTree(props) {
|
|
641
654
|
updateExpanded(nextExpanded, true);
|
642
655
|
}
|
643
656
|
}, [context.dataMap, props.data]);
|
644
|
-
(0, _react.useEffect)(function () {
|
645
|
-
if (props.datum) return;
|
646
|
-
if (!dataUpdate) return;
|
647
|
-
setData(data);
|
648
|
-
var nextExpanded = props.expanded || props.defaultExpanded || [];
|
649
|
-
if (!defaultExpandAll && !(0, _utils.shallowEqual)(nextExpanded, expanded)) {
|
650
|
-
onExpand(nextExpanded);
|
651
|
-
updateExpanded(nextExpanded, true);
|
652
|
-
}
|
653
|
-
updateInnerCheckStatus();
|
654
|
-
}, [props.data]);
|
655
657
|
(0, _react.useEffect)(function () {
|
656
658
|
if (props.datum) return;
|
657
659
|
setValue(value);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-filter.d.ts","sourceRoot":"","sources":["use-filter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,QAAA,MAAM,SAAS;;;;;;;;;;kCAmBkD,OAAO;
|
1
|
+
{"version":3,"file":"use-filter.d.ts","sourceRoot":"","sources":["use-filter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,QAAA,MAAM,SAAS;;;;;;;;;;kCAmBkD,OAAO;sBAoB1C,MAAM;sBAKN,MAAM,SAAQ,MAAM;;;CAsGjD,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
@@ -52,7 +52,10 @@ var useFilter = function useFilter(props) {
|
|
52
52
|
return getKey(keygen, item) === key;
|
53
53
|
};
|
54
54
|
var handleClearCreatedData = function handleClearCreatedData() {
|
55
|
-
|
55
|
+
// why setTimeout: 避免回车时,新创建的数据走到了renderUnmatched逻辑中去
|
56
|
+
setTimeout(function () {
|
57
|
+
setCreatedData(undefined);
|
58
|
+
}, 0);
|
56
59
|
};
|
57
60
|
var handleCreate = function handleCreate(text) {
|
58
61
|
var createFn = typeof onCreate === 'boolean' ? function (t) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAIV,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;;;;;
|
1
|
+
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAIV,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;;;;;CAktBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -142,6 +142,8 @@ var useTree = function useTree(props) {
|
|
142
142
|
var _context$dataFlatStat2;
|
143
143
|
context.updateMap.set(id, update);
|
144
144
|
var isActive = activeProp === id;
|
145
|
+
// 立即调用update函数设置正确的active状态
|
146
|
+
if (isActive) update('active', isActive);
|
145
147
|
return {
|
146
148
|
active: isActive,
|
147
149
|
expanded: !!((_context$dataFlatStat2 = context.dataFlatStatusMap.get(id)) !== null && _context$dataFlatStat2 !== void 0 && _context$dataFlatStat2.expanded)
|
@@ -271,7 +273,7 @@ var useTree = function useTree(props) {
|
|
271
273
|
context.dataMap.set(id, item);
|
272
274
|
if (virtual) {
|
273
275
|
context.dataFlatStatusMap.set(id, {
|
274
|
-
active:
|
276
|
+
active: activeProp === id,
|
275
277
|
expanded: defaultExpandAll ? true : (expanded === null || expanded === void 0 ? void 0 : expanded.includes(id)) || false,
|
276
278
|
fetching: false
|
277
279
|
});
|
@@ -622,6 +624,17 @@ var useTree = function useTree(props) {
|
|
622
624
|
call('expanded', tempExpandMap.has(id));
|
623
625
|
});
|
624
626
|
});
|
627
|
+
useEffect(function () {
|
628
|
+
if (props.datum) return;
|
629
|
+
if (!dataUpdate) return;
|
630
|
+
setData(data);
|
631
|
+
var nextExpanded = props.expanded || props.defaultExpanded || [];
|
632
|
+
if (!defaultExpandAll && !shallowEqual(nextExpanded, expanded)) {
|
633
|
+
onExpand(nextExpanded);
|
634
|
+
updateExpanded(nextExpanded, true);
|
635
|
+
}
|
636
|
+
updateInnerCheckStatus();
|
637
|
+
}, [props.data]);
|
625
638
|
useEffect(function () {
|
626
639
|
if (defaultExpandAll) {
|
627
640
|
var nextExpanded = [];
|
@@ -634,17 +647,6 @@ var useTree = function useTree(props) {
|
|
634
647
|
updateExpanded(nextExpanded, true);
|
635
648
|
}
|
636
649
|
}, [context.dataMap, props.data]);
|
637
|
-
useEffect(function () {
|
638
|
-
if (props.datum) return;
|
639
|
-
if (!dataUpdate) return;
|
640
|
-
setData(data);
|
641
|
-
var nextExpanded = props.expanded || props.defaultExpanded || [];
|
642
|
-
if (!defaultExpandAll && !shallowEqual(nextExpanded, expanded)) {
|
643
|
-
onExpand(nextExpanded);
|
644
|
-
updateExpanded(nextExpanded, true);
|
645
|
-
}
|
646
|
-
updateInnerCheckStatus();
|
647
|
-
}, [props.data]);
|
648
650
|
useEffect(function () {
|
649
651
|
if (props.datum) return;
|
650
652
|
setValue(value);
|