@sheinx/hooks 3.7.10-beta.4 → 3.7.10-fix.1
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-input-able/use-Input-able.d.ts.map +1 -1
- package/cjs/common/use-input-able/use-Input-able.js +6 -7
- package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree.js +3 -1
- package/esm/common/use-input-able/use-Input-able.d.ts.map +1 -1
- package/esm/common/use-input-able/use-Input-able.js +7 -8
- package/esm/components/use-tree/use-tree.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree.js +3 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-Input-able.d.ts","sourceRoot":"","sources":["use-Input-able.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"use-Input-able.d.ts","sourceRoot":"","sources":["use-Input-able.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;;;;EA0E3F"}
|
|
@@ -46,19 +46,18 @@ function useInputAble(props) {
|
|
|
46
46
|
var render = (0, _useRender.useRender)(syncValue);
|
|
47
47
|
var shouldUseState = delay || !control;
|
|
48
48
|
var value = shouldUseState ? stateValue : valuePo;
|
|
49
|
-
(0, _react.
|
|
50
|
-
if (context.timer) {
|
|
51
|
-
clearTimeout(context.timer);
|
|
52
|
-
context.timer = null;
|
|
53
|
-
}
|
|
49
|
+
(0, _react.useLayoutEffect)(function () {
|
|
54
50
|
if (delay && control && props.value !== stateValue) {
|
|
55
51
|
changeStateValue(props.value);
|
|
52
|
+
} else if (context.timer) {
|
|
53
|
+
clearTimeout(context.timer);
|
|
54
|
+
context.timer = null;
|
|
56
55
|
}
|
|
57
56
|
}, [props.value, delay, control]);
|
|
58
57
|
var forceDelayChange = (0, _usePersistFn.default)(function () {
|
|
59
|
-
if (context.
|
|
58
|
+
if (context.delayChange) context.delayChange();
|
|
59
|
+
if (context.timer) {
|
|
60
60
|
clearTimeout(context.timer);
|
|
61
|
-
context.delayChange();
|
|
62
61
|
context.timer = null;
|
|
63
62
|
context.delayChange = null;
|
|
64
63
|
}
|
|
@@ -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
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-Input-able.d.ts","sourceRoot":"","sources":["use-Input-able.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"use-Input-able.d.ts","sourceRoot":"","sources":["use-Input-able.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;;;;EA0E3F"}
|
|
@@ -4,7 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import {
|
|
7
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
8
8
|
import { isFunc } from "../../utils/is";
|
|
9
9
|
import { shallowEqual } from "../../utils/shallow-equal";
|
|
10
10
|
import usePersistFn from "../use-persist-fn";
|
|
@@ -39,19 +39,18 @@ export default function useInputAble(props) {
|
|
|
39
39
|
var render = useRender(syncValue);
|
|
40
40
|
var shouldUseState = delay || !control;
|
|
41
41
|
var value = shouldUseState ? stateValue : valuePo;
|
|
42
|
-
|
|
43
|
-
if (context.timer) {
|
|
44
|
-
clearTimeout(context.timer);
|
|
45
|
-
context.timer = null;
|
|
46
|
-
}
|
|
42
|
+
useLayoutEffect(function () {
|
|
47
43
|
if (delay && control && props.value !== stateValue) {
|
|
48
44
|
changeStateValue(props.value);
|
|
45
|
+
} else if (context.timer) {
|
|
46
|
+
clearTimeout(context.timer);
|
|
47
|
+
context.timer = null;
|
|
49
48
|
}
|
|
50
49
|
}, [props.value, delay, control]);
|
|
51
50
|
var forceDelayChange = usePersistFn(function () {
|
|
52
|
-
if (context.
|
|
51
|
+
if (context.delayChange) context.delayChange();
|
|
52
|
+
if (context.timer) {
|
|
53
53
|
clearTimeout(context.timer);
|
|
54
|
-
context.delayChange();
|
|
55
54
|
context.timer = null;
|
|
56
55
|
context.delayChange = null;
|
|
57
56
|
}
|
|
@@ -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
|
});
|