@sheinx/hooks 3.8.9-beta.3 → 3.8.9-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.
|
@@ -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;;;;EA6E3F"}
|
|
@@ -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-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;;;;EA6E3F"}
|
|
@@ -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
|
}
|