@sheinx/hooks 3.7.7 → 3.7.8-alpha.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.
Files changed (41) hide show
  1. package/cjs/common/use-input-able/use-Input-able.d.ts.map +1 -1
  2. package/cjs/common/use-input-able/use-Input-able.js +22 -1
  3. package/cjs/common/use-input-able/use-Input-able.type.d.ts +1 -0
  4. package/cjs/common/use-input-able/use-Input-able.type.d.ts.map +1 -1
  5. package/cjs/common/use-position-style/index.d.ts.map +1 -1
  6. package/cjs/common/use-position-style/index.js +10 -7
  7. package/cjs/components/use-datepicker/use-time.d.ts.map +1 -1
  8. package/cjs/components/use-datepicker/use-time.js +4 -2
  9. package/cjs/components/use-datepicker/use-time.type.d.ts +3 -1
  10. package/cjs/components/use-datepicker/use-time.type.d.ts.map +1 -1
  11. package/cjs/components/use-form/use-form.d.ts.map +1 -1
  12. package/cjs/components/use-form/use-form.js +6 -8
  13. package/cjs/components/use-form/use-form.type.d.ts +1 -0
  14. package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
  15. package/cjs/components/use-popup/use-popup.js +4 -4
  16. package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
  17. package/cjs/components/use-tree/use-tree.js +3 -3
  18. package/cjs/utils/dom/document.d.ts +4 -0
  19. package/cjs/utils/dom/document.d.ts.map +1 -1
  20. package/cjs/utils/dom/document.js +19 -2
  21. package/esm/common/use-input-able/use-Input-able.d.ts.map +1 -1
  22. package/esm/common/use-input-able/use-Input-able.js +22 -1
  23. package/esm/common/use-input-able/use-Input-able.type.d.ts +1 -0
  24. package/esm/common/use-input-able/use-Input-able.type.d.ts.map +1 -1
  25. package/esm/common/use-position-style/index.d.ts.map +1 -1
  26. package/esm/common/use-position-style/index.js +11 -8
  27. package/esm/components/use-datepicker/use-time.d.ts.map +1 -1
  28. package/esm/components/use-datepicker/use-time.js +4 -2
  29. package/esm/components/use-datepicker/use-time.type.d.ts +3 -1
  30. package/esm/components/use-datepicker/use-time.type.d.ts.map +1 -1
  31. package/esm/components/use-form/use-form.d.ts.map +1 -1
  32. package/esm/components/use-form/use-form.js +6 -8
  33. package/esm/components/use-form/use-form.type.d.ts +1 -0
  34. package/esm/components/use-form/use-form.type.d.ts.map +1 -1
  35. package/esm/components/use-popup/use-popup.js +4 -4
  36. package/esm/components/use-tree/use-tree.d.ts.map +1 -1
  37. package/esm/components/use-tree/use-tree.js +3 -3
  38. package/esm/utils/dom/document.d.ts +4 -0
  39. package/esm/utils/dom/document.d.ts.map +1 -1
  40. package/esm/utils/dom/document.js +18 -1
  41. package/package.json +3 -3
@@ -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;;;;EA2E3F"}
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;;;;EAsG3F"}
@@ -32,6 +32,9 @@ function useInputAble(props) {
32
32
  var _useRef = (0, _react.useRef)({
33
33
  timer: null,
34
34
  delayChange: null
35
+ // pendingCount: 0,
36
+ // executedCount: 0,
37
+ // checkTimer: null,
35
38
  }),
36
39
  context = _useRef.current;
37
40
  var latest = (0, _useLatestObj.useLatestObj)({
@@ -56,12 +59,18 @@ function useInputAble(props) {
56
59
  }
57
60
  }, [props.value, delay, control]);
58
61
  var forceDelayChange = (0, _usePersistFn.default)(function () {
62
+ // if (context.checkTimer) {
63
+ // clearTimeout(context.checkTimer);
64
+ // context.checkTimer = null;
65
+ // }
59
66
  if (context.timer && context.delayChange) {
60
67
  clearTimeout(context.timer);
61
68
  context.delayChange();
62
69
  context.timer = null;
63
70
  context.delayChange = null;
64
71
  }
72
+ // context.pendingCount = 0;
73
+ // context.executedCount = 0;
65
74
  });
66
75
  var handleChange = (0, _usePersistFn.default)(function (v) {
67
76
  for (var _len = arguments.length, other = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -85,14 +94,26 @@ function useInputAble(props) {
85
94
  context.delayChange = function () {
86
95
  context.timer = null;
87
96
  context.delayChange = null;
97
+ // context.executedCount++;
88
98
  onChange.apply(void 0, [vv].concat(other));
89
99
  render();
90
100
  };
91
- if (!delay) {
101
+ if (!delay || props.forceSyncInputValue) {
92
102
  onChange.apply(void 0, [vv].concat(other));
93
103
  } else {
104
+ // const currentPendingCount = ++context.pendingCount;
94
105
  if (context.timer) clearTimeout(context.timer);
95
106
  context.timer = setTimeout(context.delayChange, delay);
107
+
108
+ // 设置检查定时器,在 delay 之后检查是否有丢失的 delayChange
109
+ // if (context.checkTimer) clearTimeout(context.checkTimer);
110
+ // context.checkTimer = setTimeout(() => {
111
+ // const missedCount = currentPendingCount - context.executedCount;
112
+ // if (missedCount > 0 && context.delayChange && valuePo !== vv) {
113
+ // context.delayChange();
114
+ // }
115
+ // context.checkTimer = null;
116
+ // }, delay + 50);
96
117
  }
97
118
  });
98
119
  return {
@@ -8,5 +8,6 @@ export interface InputAbleProps<T, V extends ChangeType<T>> {
8
8
  control: boolean;
9
9
  delay?: number;
10
10
  filterSameChange?: boolean;
11
+ forceSyncInputValue?: boolean;
11
12
  }
12
13
  //# sourceMappingURL=use-Input-able.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-Input-able.type.d.ts","sourceRoot":"","sources":["use-Input-able.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAChE,MAAM,WAAW,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC;IACxD,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IACrB,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;IAC5B,YAAY,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACnD,QAAQ,EAAE,CAAC,GAAG,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IAEjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"use-Input-able.type.d.ts","sourceRoot":"","sources":["use-Input-able.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAChE,MAAM,WAAW,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC;IACxD,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IACrB,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;IAC5B,YAAY,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACnD,QAAQ,EAAE,CAAC,GAAG,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IAEjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,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ts"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAUpE,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,UAAU,GACV,cAAc,GACd,WAAW,GACX,MAAM,GACN,OAAO,CAAC;AACZ,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,cAAc,GACd,UAAU,GACV,WAAW,GACX,KAAK,GACL,QAAQ,CAAC;AAYb,KAAK,YAAY,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,OAAO,CAAC;AACpE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IAEd,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAE1C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAEzC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,YAAY,EAAE,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3B;AAOD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB;;CA+S3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -255,17 +255,18 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
255
255
  };
256
256
  };
257
257
  var getAbsoluteStyle = function getAbsoluteStyle(position) {
258
- var _scrollElRef$current, _scrollElRef$current2, _scrollElRef$current3;
258
+ var _scrollElRef$current;
259
259
  if (!parentElRef.current) return {
260
260
  style: hideStyle
261
261
  };
262
262
  var rect = context.parentRect;
263
263
  var needCheck = !show || !(0, _shallowEqual.default)(context.prevParentPosition, parentElNewPosition);
264
- var scrollTop = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.scrollTop) || 0;
265
- var scrollLeft = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.scrollLeft) || 0;
266
- if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current3 = scrollElRef.current) !== null && _scrollElRef$current3 !== void 0 && _scrollElRef$current3.contains(parentElRef.current)) {
267
- var _scrollElRef$current4;
268
- var visibleRect = ((_scrollElRef$current4 = scrollElRef.current) === null || _scrollElRef$current4 === void 0 ? void 0 : _scrollElRef$current4.getBoundingClientRect()) || {};
264
+ var _getScrollPosition = (0, _utils.getScrollPosition)(scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current),
265
+ scrollTop = _getScrollPosition.scrollTop,
266
+ scrollLeft = _getScrollPosition.scrollLeft;
267
+ if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
268
+ var _scrollElRef$current2;
269
+ var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
269
270
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom + scrollTop || rect.right < visibleRect.left || rect.left > visibleRect.right + scrollLeft) {
270
271
  return {
271
272
  style: hideStyle
@@ -339,7 +340,9 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
339
340
  }
340
341
 
341
342
  // 当父元素的滚动容器滚动时,判断是否需要更新弹出层位置,包括是否隐藏弹出层(通过hideStyle隐藏,不是show状态)
342
- context.prevParentPosition = parentElNewPosition;
343
+ if (show) {
344
+ context.prevParentPosition = parentElNewPosition;
345
+ }
343
346
  });
344
347
  (0, _react.useEffect)(updateStyle, [show, position, absolute, updateKey, fixedWidth, parentElNewPosition, popupElSize]);
345
348
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"use-time.d.ts","sourceRoot":"","sources":["use-time.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;iBA4HU,MAAM;kBAAQ,IAAI;sBAAY,OAAO;;;;;6BAvBrD,IAAI;2BAjEN,IAAI,gBAAgB,MAAM;;CA6IrD,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-time.d.ts","sourceRoot":"","sources":["use-time.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;iBA+HU,MAAM;kBAAQ,IAAI;sBAAY,OAAO;;;;;6BAvBrD,IAAI;2BAlEN,IAAI,gBAAgB,MAAM;;CA8IrD,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -19,7 +19,9 @@ var useTime = function useTime(props) {
19
19
  _props$secondStep = props.secondStep,
20
20
  secondStep = _props$secondStep === void 0 ? 1 : _props$secondStep,
21
21
  staticMin = props.staticMin,
22
- staticMax = props.staticMax;
22
+ staticMax = props.staticMax,
23
+ position = props.position,
24
+ rangeDate = props.rangeDate;
23
25
  var min = _util.default.resetTimeByFormat(mi, format, options);
24
26
  var max = _util.default.resetTimeByFormat(ma, format, options);
25
27
  var current = props.value || _util.default.newDate(undefined, options);
@@ -45,7 +47,7 @@ var useTime = function useTime(props) {
45
47
  disabledTime = props.disabledTime;
46
48
  if (disabledTime) {
47
49
  var _time = _util.default.format(date, _util.default.TIME_FORMAT, options);
48
- if (typeof disabledTime === 'function') return disabledTime(_time);
50
+ if (typeof disabledTime === 'function') return disabledTime(_time, position, rangeDate === null || rangeDate === void 0 ? void 0 : rangeDate[0], rangeDate === null || rangeDate === void 0 ? void 0 : rangeDate[1]);
49
51
  return disabledTime === _time;
50
52
  }
51
53
  var isDis = disabled && typeof disabled === 'function' ? disabled(date) : false;
@@ -11,9 +11,11 @@ export interface UseTimeProps {
11
11
  staticMin?: Date;
12
12
  staticMax?: Date;
13
13
  disabled?: boolean | ((date: Date) => boolean);
14
- disabledTime?: string | ((time: string) => boolean);
14
+ disabledTime?: string | ((time: string, type?: 'start' | 'end', value0?: Date, value1?: Date) => boolean);
15
15
  minuteStep?: number;
16
16
  hourStep?: number;
17
17
  secondStep?: number;
18
+ position?: 'start' | 'end';
19
+ rangeDate?: Array<Date | undefined>;
18
20
  }
19
21
  //# sourceMappingURL=use-time.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-time.type.d.ts","sourceRoot":"","sources":["use-time.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
1
+ {"version":3,"file":"use-time.type.d.ts","sourceRoot":"","sources":["use-time.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,KAAK,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC1G,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;CACrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":"AAiCA,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,QAAQ,CAAC,EAAE,OAAO,CAAC;gBAAC,WAAW,CAAC,EAAE,OAAO,CAAA;aAAE;8BArPnB,MAAM;oCAgUD,OAAO,aAAoB,MAAM,IAAI;;6BAf3C,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCA3RxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;qCA8VvB,MAAM,WAAW,gBAAgB;gCAhDzB,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;kCAjJpD,MAAM,0BAAyB,qBAAqB;;;;;;oBA2EjD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,WAAW,CAAC,EAAE,OAAO,CAAA;SAAE;0BArPnB,MAAM;gCAgUD,OAAO,aAAoB,MAAM,IAAI;;yBAf3C,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCA3RxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;iCA8VvB,MAAM,WAAW,gBAAgB;4BAhDzB,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;8BAjJpD,MAAM,0BAAyB,qBAAqB;;CAub9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -49,7 +49,8 @@ var useForm = function useForm(props) {
49
49
  colon = props.colon,
50
50
  formName = props.name,
51
51
  scrollParent = props.scrollParent,
52
- isControl = props.isControl;
52
+ isControl = props.isControl,
53
+ forceSyncInputValue = props.forceSyncInputValue;
53
54
  var deepSetOptions = {
54
55
  removeUndefined: removeUndefined,
55
56
  forceSet: true
@@ -236,7 +237,7 @@ var useForm = function useForm(props) {
236
237
  var _props$onChange;
237
238
  var newValue = typeof change === 'function' ? (0, _immer.produce)(context.value, change) : change;
238
239
  context.value = newValue;
239
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, context.value);
240
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newValue);
240
241
  });
241
242
  var scrollToField = (0, _usePersistFn.default)(function (name) {
242
243
  var _document;
@@ -592,7 +593,8 @@ var useForm = function useForm(props) {
592
593
  disabled: disabled,
593
594
  size: size,
594
595
  formName: formName,
595
- colon: colon
596
+ colon: colon,
597
+ forceSyncInputValue: !!forceSyncInputValue
596
598
  };
597
599
  }, [labelWidth, labelAlign, labelVerticalAlign, keepErrorHeight, inline, disabled, size, formName, colon]);
598
600
  var updateValue = function updateValue() {
@@ -618,11 +620,6 @@ var useForm = function useForm(props) {
618
620
  // 默认值更新
619
621
  React.useEffect(function () {
620
622
  context.removeLock = false;
621
- // 内部 onChange 改的 value, 不需要更新
622
- if (props.value === context.value) {
623
- if (!isControl) update();
624
- return;
625
- }
626
623
  if (initValidate && !context.resetTime) {
627
624
  var keys = Object.keys(context.validateMap).filter(function (key) {
628
625
  var oldValue = (0, _utils.deepGet)(preValue || emptyObj, key);
@@ -632,6 +629,7 @@ var useForm = function useForm(props) {
632
629
  validateFields(keys).catch(function () {});
633
630
  }
634
631
  update();
632
+ if (!isControl) return;
635
633
  // 默认值上位时会提前触发外部的onChange, 导致外部的多次setFormValue不能合并后生效的问题(ReactDOM.render方式渲染)
636
634
  setTimeout(updateDefaultValue);
637
635
  context.resetTime = 0;
@@ -106,6 +106,7 @@ export interface FormCommonConfig extends FormLabelConfig {
106
106
  * @private
107
107
  */
108
108
  formName?: string;
109
+ forceSyncInputValue?: boolean;
109
110
  }
110
111
  export interface FormFunc<T = any> {
111
112
  setValue: (vals: {
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.type.d.ts","sourceRoot":"","sources":["use-form.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aA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AE,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,UAAU,CACzE,mBAAmB,EACnB,MAAM,CACP,CAAC"}
@@ -142,20 +142,20 @@ var usePopup = function usePopup(props) {
142
142
  }
143
143
  };
144
144
  var handleMouseEnter = (0, _usePersistFn.default)(function (e) {
145
- var _targetEvents$onMouse, _targetRef$current;
145
+ var _targetEvents$onMouse, _targetRef$current, _popupRef$current2;
146
146
  targetEvents === null || targetEvents === void 0 || (_targetEvents$onMouse = targetEvents.onMouseEnter) === null || _targetEvents$onMouse === void 0 || _targetEvents$onMouse.call(targetEvents, e);
147
147
  if (trigger !== 'hover') return;
148
148
  var isParentContainsCurrent = (_targetRef$current = targetRef.current) === null || _targetRef$current === void 0 ? void 0 : _targetRef$current.contains(e.target);
149
- if (isParentContainsCurrent) {
149
+ if (isParentContainsCurrent || popupRef !== null && popupRef !== void 0 && (_popupRef$current2 = popupRef.current) !== null && _popupRef$current2 !== void 0 && _popupRef$current2.contains(e.target)) {
150
150
  handleHoverToggle(true);
151
151
  }
152
152
  });
153
153
  var handleMouseLeave = (0, _usePersistFn.default)(function (e) {
154
- var _targetEvents$onMouse2, _popupRef$current2;
154
+ var _targetEvents$onMouse2, _popupRef$current3;
155
155
  targetEvents === null || targetEvents === void 0 || (_targetEvents$onMouse2 = targetEvents.onMouseLeave) === null || _targetEvents$onMouse2 === void 0 || _targetEvents$onMouse2.call(targetEvents, e);
156
156
  if (trigger !== 'hover') return;
157
157
  // @ts-ignore
158
- if (e.relatedTarget instanceof HTMLElement && (_popupRef$current2 = popupRef.current) !== null && _popupRef$current2 !== void 0 && _popupRef$current2.contains(e.relatedTarget)) {
158
+ if (e.relatedTarget instanceof HTMLElement && (_popupRef$current3 = popupRef.current) !== null && _popupRef$current3 !== void 0 && _popupRef$current3.contains(e.relatedTarget)) {
159
159
  return;
160
160
  }
161
161
  handleHoverToggle(false);
@@ -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;;;;;CAgtBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
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;;;;;CAitBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -502,9 +502,9 @@ var useTree = function useTree(props) {
502
502
  var _context$value;
503
503
  if (mode !== MODE.MODE_0) return;
504
504
  (_context$value = context.value) === null || _context$value === void 0 || _context$value.forEach(function (id) {
505
- var _ref3 = context.pathMap.get(id),
506
- children = _ref3.children;
507
- if (children.length) {
505
+ var node = context.pathMap.get(id);
506
+ var children = node === null || node === void 0 ? void 0 : node.children;
507
+ if (children && children.length) {
508
508
  var noCheckedChildren = children.filter(function (cid) {
509
509
  var _context$value2;
510
510
  return !((_context$value2 = context.value) !== null && _context$value2 !== void 0 && _context$value2.includes(cid));
@@ -1,2 +1,6 @@
1
1
  export declare const getCurrentCSSZoom: () => number;
2
+ export declare const getScrollPosition: (element?: HTMLElement | null) => {
3
+ scrollTop: number;
4
+ scrollLeft: number;
5
+ };
2
6
  //# sourceMappingURL=document.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,QAAO,MAqBpC,CAAA"}
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,QAAO,MAqBpC,CAAA;AA6BD,eAAO,MAAM,iBAAiB,aAAc,WAAW,GAAG,IAAI;;;CAc7D,CAAC"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getCurrentCSSZoom = void 0;
6
+ exports.getScrollPosition = exports.getCurrentCSSZoom = void 0;
7
7
  var cachedZoom = 0;
8
8
  var getCurrentCSSZoom = exports.getCurrentCSSZoom = function getCurrentCSSZoom() {
9
9
  if (cachedZoom) return cachedZoom;
@@ -46,4 +46,21 @@ var getCurrentCSSZoom = exports.getCurrentCSSZoom = function getCurrentCSSZoom()
46
46
  // width: rect.width * zoomRatio,
47
47
  // height: rect.height * zoomRatio,
48
48
  // }
49
- // }
49
+ // }
50
+
51
+ var getScrollPosition = exports.getScrollPosition = function getScrollPosition(element) {
52
+ if (!element) return {
53
+ scrollTop: 0,
54
+ scrollLeft: 0
55
+ };
56
+ if (element === document.documentElement || element === document.body) {
57
+ return {
58
+ scrollTop: document.documentElement.scrollTop || document.body.scrollTop,
59
+ scrollLeft: document.documentElement.scrollLeft || document.body.scrollLeft
60
+ };
61
+ }
62
+ return {
63
+ scrollTop: element.scrollTop,
64
+ scrollLeft: element.scrollLeft
65
+ };
66
+ };
@@ -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;;;;EA2E3F"}
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;;;;EAsG3F"}
@@ -25,6 +25,9 @@ export default function useInputAble(props) {
25
25
  var _useRef = useRef({
26
26
  timer: null,
27
27
  delayChange: null
28
+ // pendingCount: 0,
29
+ // executedCount: 0,
30
+ // checkTimer: null,
28
31
  }),
29
32
  context = _useRef.current;
30
33
  var latest = useLatestObj({
@@ -49,12 +52,18 @@ export default function useInputAble(props) {
49
52
  }
50
53
  }, [props.value, delay, control]);
51
54
  var forceDelayChange = usePersistFn(function () {
55
+ // if (context.checkTimer) {
56
+ // clearTimeout(context.checkTimer);
57
+ // context.checkTimer = null;
58
+ // }
52
59
  if (context.timer && context.delayChange) {
53
60
  clearTimeout(context.timer);
54
61
  context.delayChange();
55
62
  context.timer = null;
56
63
  context.delayChange = null;
57
64
  }
65
+ // context.pendingCount = 0;
66
+ // context.executedCount = 0;
58
67
  });
59
68
  var handleChange = usePersistFn(function (v) {
60
69
  for (var _len = arguments.length, other = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -78,14 +87,26 @@ export default function useInputAble(props) {
78
87
  context.delayChange = function () {
79
88
  context.timer = null;
80
89
  context.delayChange = null;
90
+ // context.executedCount++;
81
91
  onChange.apply(void 0, [vv].concat(other));
82
92
  render();
83
93
  };
84
- if (!delay) {
94
+ if (!delay || props.forceSyncInputValue) {
85
95
  onChange.apply(void 0, [vv].concat(other));
86
96
  } else {
97
+ // const currentPendingCount = ++context.pendingCount;
87
98
  if (context.timer) clearTimeout(context.timer);
88
99
  context.timer = setTimeout(context.delayChange, delay);
100
+
101
+ // 设置检查定时器,在 delay 之后检查是否有丢失的 delayChange
102
+ // if (context.checkTimer) clearTimeout(context.checkTimer);
103
+ // context.checkTimer = setTimeout(() => {
104
+ // const missedCount = currentPendingCount - context.executedCount;
105
+ // if (missedCount > 0 && context.delayChange && valuePo !== vv) {
106
+ // context.delayChange();
107
+ // }
108
+ // context.checkTimer = null;
109
+ // }, delay + 50);
89
110
  }
90
111
  });
91
112
  return {
@@ -8,5 +8,6 @@ export interface InputAbleProps<T, V extends ChangeType<T>> {
8
8
  control: boolean;
9
9
  delay?: number;
10
10
  filterSameChange?: boolean;
11
+ forceSyncInputValue?: boolean;
11
12
  }
12
13
  //# sourceMappingURL=use-Input-able.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-Input-able.type.d.ts","sourceRoot":"","sources":["use-Input-able.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAChE,MAAM,WAAW,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC;IACxD,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IACrB,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;IAC5B,YAAY,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACnD,QAAQ,EAAE,CAAC,GAAG,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IAEjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
1
+ {"version":3,"file":"use-Input-able.type.d.ts","sourceRoot":"","sources":["use-Input-able.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAChE,MAAM,WAAW,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC;IACxD,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IACrB,YAAY,EAAE,CAAC,GAAG,SAAS,CAAC;IAC5B,YAAY,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACnD,QAAQ,EAAE,CAAC,GAAG,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IAEjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAUpE,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,UAAU,GACV,cAAc,GACd,WAAW,GACX,MAAM,GACN,OAAO,CAAC;AACZ,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,cAAc,GACd,UAAU,GACV,WAAW,GACX,KAAK,GACL,QAAQ,CAAC;AAYb,KAAK,YAAY,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,OAAO,CAAC;AACpE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC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E1C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAEzC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,YAAY,EAAE,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3B;AAOD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB;;CA+S3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -12,7 +12,7 @@ import { useCheckElementBorderWidth } from "./check-border";
12
12
  import { useCheckElementSize } from "./check-element-size";
13
13
  import shallowEqual from "../../utils/shallow-equal";
14
14
  import usePersistFn from "../use-persist-fn";
15
- import { getCurrentCSSZoom } from "../../utils";
15
+ import { getCurrentCSSZoom, getScrollPosition } from "../../utils";
16
16
  import { docSize } from "../../utils";
17
17
  var horizontalPosition = ['left-bottom', 'left-top', 'right-bottom', 'right-top', 'left', 'right'];
18
18
  var verticalPosition = ['bottom-left', 'bottom-right', 'top-left', 'top-right', 'bottom', 'top'];
@@ -246,17 +246,18 @@ export var usePositionStyle = function usePositionStyle(config) {
246
246
  };
247
247
  };
248
248
  var getAbsoluteStyle = function getAbsoluteStyle(position) {
249
- var _scrollElRef$current, _scrollElRef$current2, _scrollElRef$current3;
249
+ var _scrollElRef$current;
250
250
  if (!parentElRef.current) return {
251
251
  style: hideStyle
252
252
  };
253
253
  var rect = context.parentRect;
254
254
  var needCheck = !show || !shallowEqual(context.prevParentPosition, parentElNewPosition);
255
- var scrollTop = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.scrollTop) || 0;
256
- var scrollLeft = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.scrollLeft) || 0;
257
- if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current3 = scrollElRef.current) !== null && _scrollElRef$current3 !== void 0 && _scrollElRef$current3.contains(parentElRef.current)) {
258
- var _scrollElRef$current4;
259
- var visibleRect = ((_scrollElRef$current4 = scrollElRef.current) === null || _scrollElRef$current4 === void 0 ? void 0 : _scrollElRef$current4.getBoundingClientRect()) || {};
255
+ var _getScrollPosition = getScrollPosition(scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current),
256
+ scrollTop = _getScrollPosition.scrollTop,
257
+ scrollLeft = _getScrollPosition.scrollLeft;
258
+ if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
259
+ var _scrollElRef$current2;
260
+ var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
260
261
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom + scrollTop || rect.right < visibleRect.left || rect.left > visibleRect.right + scrollLeft) {
261
262
  return {
262
263
  style: hideStyle
@@ -330,7 +331,9 @@ export var usePositionStyle = function usePositionStyle(config) {
330
331
  }
331
332
 
332
333
  // 当父元素的滚动容器滚动时,判断是否需要更新弹出层位置,包括是否隐藏弹出层(通过hideStyle隐藏,不是show状态)
333
- context.prevParentPosition = parentElNewPosition;
334
+ if (show) {
335
+ context.prevParentPosition = parentElNewPosition;
336
+ }
334
337
  });
335
338
  useEffect(updateStyle, [show, position, absolute, updateKey, fixedWidth, parentElNewPosition, popupElSize]);
336
339
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"use-time.d.ts","sourceRoot":"","sources":["use-time.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;iBA4HU,MAAM;kBAAQ,IAAI;sBAAY,OAAO;;;;;6BAvBrD,IAAI;2BAjEN,IAAI,gBAAgB,MAAM;;CA6IrD,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-time.d.ts","sourceRoot":"","sources":["use-time.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAK/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;iBA+HU,MAAM;kBAAQ,IAAI;sBAAY,OAAO;;;;;6BAvBrD,IAAI;2BAlEN,IAAI,gBAAgB,MAAM;;CA8IrD,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -12,7 +12,9 @@ var useTime = function useTime(props) {
12
12
  _props$secondStep = props.secondStep,
13
13
  secondStep = _props$secondStep === void 0 ? 1 : _props$secondStep,
14
14
  staticMin = props.staticMin,
15
- staticMax = props.staticMax;
15
+ staticMax = props.staticMax,
16
+ position = props.position,
17
+ rangeDate = props.rangeDate;
16
18
  var min = dateUtil.resetTimeByFormat(mi, format, options);
17
19
  var max = dateUtil.resetTimeByFormat(ma, format, options);
18
20
  var current = props.value || dateUtil.newDate(undefined, options);
@@ -38,7 +40,7 @@ var useTime = function useTime(props) {
38
40
  disabledTime = props.disabledTime;
39
41
  if (disabledTime) {
40
42
  var _time = dateUtil.format(date, dateUtil.TIME_FORMAT, options);
41
- if (typeof disabledTime === 'function') return disabledTime(_time);
43
+ if (typeof disabledTime === 'function') return disabledTime(_time, position, rangeDate === null || rangeDate === void 0 ? void 0 : rangeDate[0], rangeDate === null || rangeDate === void 0 ? void 0 : rangeDate[1]);
42
44
  return disabledTime === _time;
43
45
  }
44
46
  var isDis = disabled && typeof disabled === 'function' ? disabled(date) : false;
@@ -11,9 +11,11 @@ export interface UseTimeProps {
11
11
  staticMin?: Date;
12
12
  staticMax?: Date;
13
13
  disabled?: boolean | ((date: Date) => boolean);
14
- disabledTime?: string | ((time: string) => boolean);
14
+ disabledTime?: string | ((time: string, type?: 'start' | 'end', value0?: Date, value1?: Date) => boolean);
15
15
  minuteStep?: number;
16
16
  hourStep?: number;
17
17
  secondStep?: number;
18
+ position?: 'start' | 'end';
19
+ rangeDate?: Array<Date | undefined>;
18
20
  }
19
21
  //# sourceMappingURL=use-time.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-time.type.d.ts","sourceRoot":"","sources":["use-time.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
1
+ {"version":3,"file":"use-time.type.d.ts","sourceRoot":"","s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AAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;qCA8VvB,MAAM,WAAW,gBAAgB;gCAhDzB,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;kCAjJpD,MAAM,0BAAyB,qBAAqB;;;;;;oBA2EjD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,WAAW,CAAC,EAAE,OAAO,CAAA;SAAE;0BArPnB,MAAM;gCAgUD,OAAO,aAAoB,MAAM,IAAI;;yBAf3C,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCA3RxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;iCA8VvB,MAAM,WAAW,gBAAgB;4BAhDzB,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;8BAjJpD,MAAM,0BAAyB,qBAAqB;;CAub9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -40,7 +40,8 @@ var useForm = function useForm(props) {
40
40
  colon = props.colon,
41
41
  formName = props.name,
42
42
  scrollParent = props.scrollParent,
43
- isControl = props.isControl;
43
+ isControl = props.isControl,
44
+ forceSyncInputValue = props.forceSyncInputValue;
44
45
  var deepSetOptions = {
45
46
  removeUndefined: removeUndefined,
46
47
  forceSet: true
@@ -227,7 +228,7 @@ var useForm = function useForm(props) {
227
228
  var _props$onChange;
228
229
  var newValue = typeof change === 'function' ? produce(context.value, change) : change;
229
230
  context.value = newValue;
230
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, context.value);
231
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newValue);
231
232
  });
232
233
  var scrollToField = usePersistFn(function (name) {
233
234
  var _document;
@@ -583,7 +584,8 @@ var useForm = function useForm(props) {
583
584
  disabled: disabled,
584
585
  size: size,
585
586
  formName: formName,
586
- colon: colon
587
+ colon: colon,
588
+ forceSyncInputValue: !!forceSyncInputValue
587
589
  };
588
590
  }, [labelWidth, labelAlign, labelVerticalAlign, keepErrorHeight, inline, disabled, size, formName, colon]);
589
591
  var updateValue = function updateValue() {
@@ -609,11 +611,6 @@ var useForm = function useForm(props) {
609
611
  // 默认值更新
610
612
  React.useEffect(function () {
611
613
  context.removeLock = false;
612
- // 内部 onChange 改的 value, 不需要更新
613
- if (props.value === context.value) {
614
- if (!isControl) update();
615
- return;
616
- }
617
614
  if (initValidate && !context.resetTime) {
618
615
  var keys = Object.keys(context.validateMap).filter(function (key) {
619
616
  var oldValue = deepGet(preValue || emptyObj, key);
@@ -623,6 +620,7 @@ var useForm = function useForm(props) {
623
620
  validateFields(keys).catch(function () {});
624
621
  }
625
622
  update();
623
+ if (!isControl) return;
626
624
  // 默认值上位时会提前触发外部的onChange, 导致外部的多次setFormValue不能合并后生效的问题(ReactDOM.render方式渲染)
627
625
  setTimeout(updateDefaultValue);
628
626
  context.resetTime = 0;
@@ -106,6 +106,7 @@ export interface FormCommonConfig extends FormLabelConfig {
106
106
  * @private
107
107
  */
108
108
  formName?: string;
109
+ forceSyncInputValue?: boolean;
109
110
  }
110
111
  export interface FormFunc<T = any> {
111
112
  setValue: (vals: {
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.type.d.ts","sourceRoot":"","sources":["use-form.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/C,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC;IACV,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,EAAE,CAAC;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mBAAmB,EACnB,MAAM,CACP,CAAC"}
@@ -135,20 +135,20 @@ var usePopup = function usePopup(props) {
135
135
  }
136
136
  };
137
137
  var handleMouseEnter = usePersistFn(function (e) {
138
- var _targetEvents$onMouse, _targetRef$current;
138
+ var _targetEvents$onMouse, _targetRef$current, _popupRef$current2;
139
139
  targetEvents === null || targetEvents === void 0 || (_targetEvents$onMouse = targetEvents.onMouseEnter) === null || _targetEvents$onMouse === void 0 || _targetEvents$onMouse.call(targetEvents, e);
140
140
  if (trigger !== 'hover') return;
141
141
  var isParentContainsCurrent = (_targetRef$current = targetRef.current) === null || _targetRef$current === void 0 ? void 0 : _targetRef$current.contains(e.target);
142
- if (isParentContainsCurrent) {
142
+ if (isParentContainsCurrent || popupRef !== null && popupRef !== void 0 && (_popupRef$current2 = popupRef.current) !== null && _popupRef$current2 !== void 0 && _popupRef$current2.contains(e.target)) {
143
143
  handleHoverToggle(true);
144
144
  }
145
145
  });
146
146
  var handleMouseLeave = usePersistFn(function (e) {
147
- var _targetEvents$onMouse2, _popupRef$current2;
147
+ var _targetEvents$onMouse2, _popupRef$current3;
148
148
  targetEvents === null || targetEvents === void 0 || (_targetEvents$onMouse2 = targetEvents.onMouseLeave) === null || _targetEvents$onMouse2 === void 0 || _targetEvents$onMouse2.call(targetEvents, e);
149
149
  if (trigger !== 'hover') return;
150
150
  // @ts-ignore
151
- if (e.relatedTarget instanceof HTMLElement && (_popupRef$current2 = popupRef.current) !== null && _popupRef$current2 !== void 0 && _popupRef$current2.contains(e.relatedTarget)) {
151
+ if (e.relatedTarget instanceof HTMLElement && (_popupRef$current3 = popupRef.current) !== null && _popupRef$current3 !== void 0 && _popupRef$current3.contains(e.relatedTarget)) {
152
152
  return;
153
153
  }
154
154
  handleHoverToggle(false);
@@ -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;;;;;CAgtBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
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;;;;;CAitBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -495,9 +495,9 @@ var useTree = function useTree(props) {
495
495
  var _context$value;
496
496
  if (mode !== MODE.MODE_0) return;
497
497
  (_context$value = context.value) === null || _context$value === void 0 || _context$value.forEach(function (id) {
498
- var _ref3 = context.pathMap.get(id),
499
- children = _ref3.children;
500
- if (children.length) {
498
+ var node = context.pathMap.get(id);
499
+ var children = node === null || node === void 0 ? void 0 : node.children;
500
+ if (children && children.length) {
501
501
  var noCheckedChildren = children.filter(function (cid) {
502
502
  var _context$value2;
503
503
  return !((_context$value2 = context.value) !== null && _context$value2 !== void 0 && _context$value2.includes(cid));
@@ -1,2 +1,6 @@
1
1
  export declare const getCurrentCSSZoom: () => number;
2
+ export declare const getScrollPosition: (element?: HTMLElement | null) => {
3
+ scrollTop: number;
4
+ scrollLeft: number;
5
+ };
2
6
  //# sourceMappingURL=document.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,QAAO,MAqBpC,CAAA"}
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,QAAO,MAqBpC,CAAA;AA6BD,eAAO,MAAM,iBAAiB,aAAc,WAAW,GAAG,IAAI;;;CAc7D,CAAC"}
@@ -40,4 +40,21 @@ export var getCurrentCSSZoom = function getCurrentCSSZoom() {
40
40
  // width: rect.width * zoomRatio,
41
41
  // height: rect.height * zoomRatio,
42
42
  // }
43
- // }
43
+ // }
44
+
45
+ export var getScrollPosition = function getScrollPosition(element) {
46
+ if (!element) return {
47
+ scrollTop: 0,
48
+ scrollLeft: 0
49
+ };
50
+ if (element === document.documentElement || element === document.body) {
51
+ return {
52
+ scrollTop: document.documentElement.scrollTop || document.body.scrollTop,
53
+ scrollLeft: document.documentElement.scrollLeft || document.body.scrollLeft
54
+ };
55
+ }
56
+ return {
57
+ scrollTop: element.scrollTop,
58
+ scrollLeft: element.scrollLeft
59
+ };
60
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.7.7",
3
+ "version": "3.7.8-alpha.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -18,8 +18,8 @@
18
18
  "immer": "10.0.2"
19
19
  },
20
20
  "peerDependencies": {
21
- "react": ">=16.8",
22
- "react-dom": ">=16.8",
21
+ "react": ">=16.14.0",
22
+ "react-dom": ">=16.14.0",
23
23
  "core-js": ">=3"
24
24
  },
25
25
  "repository": {