@sheinx/hooks 3.8.3-beta.7 → 3.8.3-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-input/use-input.d.ts +1 -1
- package/cjs/components/use-input/use-input.d.ts.map +1 -1
- package/cjs/components/use-input/use-input.js +2 -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-input/use-input.d.ts +1 -1
- package/esm/components/use-input/use-input.d.ts.map +1 -1
- package/esm/components/use-input/use-input.js +2 -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;;;;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
|
}
|
|
@@ -3,7 +3,7 @@ import { ObjectType } from '../../common/type';
|
|
|
3
3
|
declare const useInput: (params: BaseInputProps) => {
|
|
4
4
|
focused: boolean;
|
|
5
5
|
disabled: boolean | undefined;
|
|
6
|
-
showClear:
|
|
6
|
+
showClear: boolean | undefined;
|
|
7
7
|
getRootProps: <TOther extends ObjectType = ObjectType>(externalProps?: TOther) => UseInputRootSlotProps<TOther>;
|
|
8
8
|
getInputProps: <TOther_1 extends ObjectType = ObjectType>(externalProps?: TOther_1) => UseInputSlotProps<TOther_1>;
|
|
9
9
|
getClearProps: <TOther_2 extends ObjectType = ObjectType>(externalProps?: TOther_2) => UseInputClearProps<TOther_2>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-input.d.ts","sourceRoot":"","sources":["use-input.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-input.d.ts","sourceRoot":"","sources":["use-input.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAa5D,QAAA,MAAM,QAAQ,WAAY,cAAc;;;;;;;CA4IvC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _useForkRef = _interopRequireDefault(require("../../common/use-fork-ref"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _ = require("../..");
|
|
10
11
|
var _utils = require("../../utils");
|
|
11
12
|
var _excluded = ["inputRef", "rootRef", "value", "onChange", "onFocus", "onBlur", "clearable", "disabled", "autoSelect", "onClear", "onClick", "showClear", "onFocusedChange"];
|
|
12
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -154,7 +155,7 @@ var useInput = function useInput(params) {
|
|
|
154
155
|
onMouseDown: handleClear(externalEventHandlers)
|
|
155
156
|
});
|
|
156
157
|
};
|
|
157
|
-
var showClearValue = showClear !== undefined ? !!showClear : clearable && value;
|
|
158
|
+
var showClearValue = showClear !== undefined ? !!showClear : clearable && !_.util.isEmpty(value);
|
|
158
159
|
return {
|
|
159
160
|
focused: focused,
|
|
160
161
|
disabled: disabled,
|
|
@@ -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
|
}
|
|
@@ -3,7 +3,7 @@ import { ObjectType } from '../../common/type';
|
|
|
3
3
|
declare const useInput: (params: BaseInputProps) => {
|
|
4
4
|
focused: boolean;
|
|
5
5
|
disabled: boolean | undefined;
|
|
6
|
-
showClear:
|
|
6
|
+
showClear: boolean | undefined;
|
|
7
7
|
getRootProps: <TOther extends ObjectType = ObjectType>(externalProps?: TOther) => UseInputRootSlotProps<TOther>;
|
|
8
8
|
getInputProps: <TOther_1 extends ObjectType = ObjectType>(externalProps?: TOther_1) => UseInputSlotProps<TOther_1>;
|
|
9
9
|
getClearProps: <TOther_2 extends ObjectType = ObjectType>(externalProps?: TOther_2) => UseInputClearProps<TOther_2>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-input.d.ts","sourceRoot":"","sources":["use-input.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-input.d.ts","sourceRoot":"","sources":["use-input.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAa5D,QAAA,MAAM,QAAQ,WAAY,cAAc;;;;;;;CA4IvC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -15,6 +15,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
15
15
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
16
|
import useForkRef from "../../common/use-fork-ref";
|
|
17
17
|
import * as React from 'react';
|
|
18
|
+
import { util } from "../..";
|
|
18
19
|
import { extractEventHandlers } from "../../utils";
|
|
19
20
|
/*
|
|
20
21
|
数据:
|
|
@@ -145,7 +146,7 @@ var useInput = function useInput(params) {
|
|
|
145
146
|
onMouseDown: handleClear(externalEventHandlers)
|
|
146
147
|
});
|
|
147
148
|
};
|
|
148
|
-
var showClearValue = showClear !== undefined ? !!showClear : clearable && value;
|
|
149
|
+
var showClearValue = showClear !== undefined ? !!showClear : clearable && !util.isEmpty(value);
|
|
149
150
|
return {
|
|
150
151
|
focused: focused,
|
|
151
152
|
disabled: disabled,
|