@sheinx/hooks 3.1.6 → 3.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAsBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAsJ8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCA6CD,OAAO;;6BALb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;;;;;;oBAmDnD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCA6CD,OAAO;;yBALb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;;CAwT7F,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAuBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAsJ8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCA6CD,OAAO;;6BALb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;;;;;;oBAmDnD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCA6CD,OAAO;;yBALb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;;CAwT7F,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -401,7 +401,7 @@ var useForm = function useForm(props) {
401
401
  React.useEffect(function () {
402
402
  context.removeLock = false;
403
403
  if (props.value === context.lastValue) return;
404
- context.value = props.value || emptyObj;
404
+ context.value = (0, _utils.deepClone)(props.value) || emptyObj;
405
405
  if (initValidate && !context.resetTime) {
406
406
  var keys = Object.keys(context.validateMap).filter(function (key) {
407
407
  var oldValue = (0, _utils.deepGet)(context.lastValue || emptyObj, key);
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAcrE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA8CX,MAAM,UAAU,MAAM;;;;;;;;CA2N5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAcrE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA8CX,MAAM,UAAU,MAAM;;;;;;;;CA8N5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -50,7 +50,7 @@ var useTableLayout = function useTableLayout(props) {
50
50
  clientWidth: 0
51
51
  }),
52
52
  context = _useRef.current;
53
- var _React$useState = _react.default.useState(false),
53
+ var _React$useState = _react.default.useState(undefined),
54
54
  _React$useState2 = _slicedToArray(_React$useState, 2),
55
55
  isScrollX = _React$useState2[0],
56
56
  setIsScrollX = _React$useState2[1];
@@ -58,7 +58,7 @@ var useTableLayout = function useTableLayout(props) {
58
58
  _React$useState4 = _slicedToArray(_React$useState3, 2),
59
59
  deltaXSum = _React$useState4[0],
60
60
  setDeltaXSum = _React$useState4[1];
61
- var _React$useState5 = _react.default.useState(false),
61
+ var _React$useState5 = _react.default.useState(undefined),
62
62
  _React$useState6 = _slicedToArray(_React$useState5, 2),
63
63
  isScrollY = _React$useState6[0],
64
64
  setIsScrollY = _React$useState6[1];
@@ -318,7 +318,8 @@ var useTableLayout = function useTableLayout(props) {
318
318
  syncScrollWidth();
319
319
  if (scrollRef.current) {
320
320
  cancelFunc = (0, _element.addResizeObserver)(scrollRef.current, handleResize, {
321
- direction: true
321
+ direction: true,
322
+ timer: 10
322
323
  });
323
324
  }
324
325
  return function () {
@@ -338,8 +339,8 @@ var useTableLayout = function useTableLayout(props) {
338
339
  }
339
340
  }, [colgroup]);
340
341
  return {
341
- isScrollX: isScrollX,
342
- isScrollY: isScrollY,
342
+ isScrollX: !!isScrollX,
343
+ isScrollY: !!isScrollY,
343
344
  floatLeft: floatLeft,
344
345
  floatRight: floatRight,
345
346
  scrollBarWidth: scrollBarWidth,
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAsBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAsJ8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCA6CD,OAAO;;6BALb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;;;;;;oBAmDnD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCA6CD,OAAO;;yBALb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;;CAwT7F,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAuBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAsJ8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCA6CD,OAAO;;6BALb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;;;;;;oBAmDnD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCA6CD,OAAO;;yBALb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;;CAwT7F,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -14,7 +14,7 @@ import usePersistFn from "../../common/use-persist-fn";
14
14
  import { getDataAttributeName } from "../../utils/attribute";
15
15
  var globalKey = '__global__&&@@';
16
16
  import { current, produce } from "../../utils/immer";
17
- import { deepGet, deepRemove, deepSet, docScroll, extractEventHandlers, isArray, isObject, shallowEqual, wrapFormError } from "../../utils";
17
+ import { deepGet, deepRemove, deepSet, docScroll, extractEventHandlers, isArray, isObject, shallowEqual, wrapFormError, deepClone } from "../../utils";
18
18
  var emptyObj = {};
19
19
  var useForm = function useForm(props) {
20
20
  var _props$defaultValue = props.defaultValue,
@@ -392,7 +392,7 @@ var useForm = function useForm(props) {
392
392
  React.useEffect(function () {
393
393
  context.removeLock = false;
394
394
  if (props.value === context.lastValue) return;
395
- context.value = props.value || emptyObj;
395
+ context.value = deepClone(props.value) || emptyObj;
396
396
  if (initValidate && !context.resetTime) {
397
397
  var keys = Object.keys(context.validateMap).filter(function (key) {
398
398
  var oldValue = deepGet(context.lastValue || emptyObj, key);
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["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AAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA8CX,MAAM,UAAU,MAAM;;;;;;;;CA8N5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -41,7 +41,7 @@ var useTableLayout = function useTableLayout(props) {
41
41
  clientWidth: 0
42
42
  }),
43
43
  context = _useRef.current;
44
- var _React$useState = React.useState(false),
44
+ var _React$useState = React.useState(undefined),
45
45
  _React$useState2 = _slicedToArray(_React$useState, 2),
46
46
  isScrollX = _React$useState2[0],
47
47
  setIsScrollX = _React$useState2[1];
@@ -49,7 +49,7 @@ var useTableLayout = function useTableLayout(props) {
49
49
  _React$useState4 = _slicedToArray(_React$useState3, 2),
50
50
  deltaXSum = _React$useState4[0],
51
51
  setDeltaXSum = _React$useState4[1];
52
- var _React$useState5 = React.useState(false),
52
+ var _React$useState5 = React.useState(undefined),
53
53
  _React$useState6 = _slicedToArray(_React$useState5, 2),
54
54
  isScrollY = _React$useState6[0],
55
55
  setIsScrollY = _React$useState6[1];
@@ -309,7 +309,8 @@ var useTableLayout = function useTableLayout(props) {
309
309
  syncScrollWidth();
310
310
  if (scrollRef.current) {
311
311
  cancelFunc = addResizeObserver(scrollRef.current, handleResize, {
312
- direction: true
312
+ direction: true,
313
+ timer: 10
313
314
  });
314
315
  }
315
316
  return function () {
@@ -329,8 +330,8 @@ var useTableLayout = function useTableLayout(props) {
329
330
  }
330
331
  }, [colgroup]);
331
332
  return {
332
- isScrollX: isScrollX,
333
- isScrollY: isScrollY,
333
+ isScrollX: !!isScrollX,
334
+ isScrollY: !!isScrollY,
334
335
  floatLeft: floatLeft,
335
336
  floatRight: floatRight,
336
337
  scrollBarWidth: scrollBarWidth,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.1.6",
3
+ "version": "3.1.7",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",