@sheinx/hooks 3.8.0-beta.17 → 3.8.0-beta.19

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 (29) hide show
  1. package/cjs/common/use-position-style/index.d.ts.map +1 -1
  2. package/cjs/common/use-position-style/index.js +10 -7
  3. package/cjs/components/use-datepicker/use-time.d.ts.map +1 -1
  4. package/cjs/components/use-datepicker/use-time.js +4 -2
  5. package/cjs/components/use-datepicker/use-time.type.d.ts +3 -1
  6. package/cjs/components/use-datepicker/use-time.type.d.ts.map +1 -1
  7. package/cjs/components/use-form/use-form.d.ts.map +1 -1
  8. package/cjs/components/use-form/use-form.js +1 -1
  9. package/cjs/components/use-popup/use-popup.js +4 -4
  10. package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
  11. package/cjs/components/use-tree/use-tree.js +3 -3
  12. package/cjs/utils/dom/document.d.ts +4 -0
  13. package/cjs/utils/dom/document.d.ts.map +1 -1
  14. package/cjs/utils/dom/document.js +19 -2
  15. package/esm/common/use-position-style/index.d.ts.map +1 -1
  16. package/esm/common/use-position-style/index.js +11 -8
  17. package/esm/components/use-datepicker/use-time.d.ts.map +1 -1
  18. package/esm/components/use-datepicker/use-time.js +4 -2
  19. package/esm/components/use-datepicker/use-time.type.d.ts +3 -1
  20. package/esm/components/use-datepicker/use-time.type.d.ts.map +1 -1
  21. package/esm/components/use-form/use-form.d.ts.map +1 -1
  22. package/esm/components/use-form/use-form.js +1 -1
  23. package/esm/components/use-popup/use-popup.js +4 -4
  24. package/esm/components/use-tree/use-tree.d.ts.map +1 -1
  25. package/esm/components/use-tree/use-tree.js +3 -3
  26. package/esm/utils/dom/document.d.ts +4 -0
  27. package/esm/utils/dom/document.d.ts.map +1 -1
  28. package/esm/utils/dom/document.js +18 -1
  29. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA+C,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,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;AAsBD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB;;CA+S3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -268,17 +268,18 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
268
268
  };
269
269
  };
270
270
  var getAbsoluteStyle = function getAbsoluteStyle(position) {
271
- var _scrollElRef$current, _scrollElRef$current2, _scrollElRef$current3;
271
+ var _scrollElRef$current;
272
272
  if (!parentElRef.current) return {
273
273
  style: hideStyle
274
274
  };
275
275
  var rect = context.parentRect;
276
276
  var needCheck = !show || !(0, _shallowEqual.default)(context.prevParentPosition, parentElNewPosition);
277
- var scrollTop = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.scrollTop) || 0;
278
- var scrollLeft = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.scrollLeft) || 0;
279
- if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current3 = scrollElRef.current) !== null && _scrollElRef$current3 !== void 0 && _scrollElRef$current3.contains(parentElRef.current)) {
280
- var _scrollElRef$current4;
281
- var visibleRect = ((_scrollElRef$current4 = scrollElRef.current) === null || _scrollElRef$current4 === void 0 ? void 0 : _scrollElRef$current4.getBoundingClientRect()) || {};
277
+ var _getScrollPosition = (0, _utils.getScrollPosition)(scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current),
278
+ scrollTop = _getScrollPosition.scrollTop,
279
+ scrollLeft = _getScrollPosition.scrollLeft;
280
+ if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
281
+ var _scrollElRef$current2;
282
+ var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
282
283
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom + scrollTop || rect.right < visibleRect.left || rect.left > visibleRect.right + scrollLeft) {
283
284
  return {
284
285
  style: hideStyle
@@ -352,7 +353,9 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
352
353
  }
353
354
 
354
355
  // 当父元素的滚动容器滚动时,判断是否需要更新弹出层位置,包括是否隐藏弹出层(通过hideStyle隐藏,不是show状态)
355
- context.prevParentPosition = parentElNewPosition;
356
+ if (show) {
357
+ context.prevParentPosition = parentElNewPosition;
358
+ }
356
359
  });
357
360
  (0, _react.useEffect)(updateStyle, [show, position, absolute, updateKey, fixedWidth, parentElNewPosition, popupElSize]);
358
361
  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,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAGhB,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OA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S;;oCAdrB,MAAM,EAAE;sCA/RxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;qCAkWvB,MAAM,WAAW,gBAAgB;gCAhDzB,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;kCArJpD,MAAM,0BAAyB,qBAAqB;;;;;;oBA2EjD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,WAAW,CAAC,EAAE,OAAO,CAAA;SAAE;0BArPnB,MAAM;gCAoUD,OAAO,aAAoB,MAAM,IAAI;;yBAf3C,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCA/RxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;iCAkWvB,MAAM,WAAW,gBAAgB;4BAhDzB,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;8BArJpD,MAAM,0BAAyB,qBAAqB;;CA0b9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -236,7 +236,7 @@ var useForm = function useForm(props) {
236
236
  var _props$onChange;
237
237
  var newValue = typeof change === 'function' ? (0, _immer.produce)(context.value, change) : change;
238
238
  context.value = newValue;
239
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, (0, _utils.deepClone)(context.value));
239
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newValue);
240
240
  });
241
241
  var scrollToField = (0, _usePersistFn.default)(function (name) {
242
242
  var _document;
@@ -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":"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;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,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AC,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;AAsBD,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'];
@@ -259,17 +259,18 @@ export var usePositionStyle = function usePositionStyle(config) {
259
259
  };
260
260
  };
261
261
  var getAbsoluteStyle = function getAbsoluteStyle(position) {
262
- var _scrollElRef$current, _scrollElRef$current2, _scrollElRef$current3;
262
+ var _scrollElRef$current;
263
263
  if (!parentElRef.current) return {
264
264
  style: hideStyle
265
265
  };
266
266
  var rect = context.parentRect;
267
267
  var needCheck = !show || !shallowEqual(context.prevParentPosition, parentElNewPosition);
268
- var scrollTop = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.scrollTop) || 0;
269
- var scrollLeft = (scrollElRef === null || scrollElRef === void 0 || (_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.scrollLeft) || 0;
270
- if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current3 = scrollElRef.current) !== null && _scrollElRef$current3 !== void 0 && _scrollElRef$current3.contains(parentElRef.current)) {
271
- var _scrollElRef$current4;
272
- var visibleRect = ((_scrollElRef$current4 = scrollElRef.current) === null || _scrollElRef$current4 === void 0 ? void 0 : _scrollElRef$current4.getBoundingClientRect()) || {};
268
+ var _getScrollPosition = getScrollPosition(scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current),
269
+ scrollTop = _getScrollPosition.scrollTop,
270
+ scrollLeft = _getScrollPosition.scrollLeft;
271
+ if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
272
+ var _scrollElRef$current2;
273
+ var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
273
274
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom + scrollTop || rect.right < visibleRect.left || rect.left > visibleRect.right + scrollLeft) {
274
275
  return {
275
276
  style: hideStyle
@@ -343,7 +344,9 @@ export var usePositionStyle = function usePositionStyle(config) {
343
344
  }
344
345
 
345
346
  // 当父元素的滚动容器滚动时,判断是否需要更新弹出层位置,包括是否隐藏弹出层(通过hideStyle隐藏,不是show状态)
346
- context.prevParentPosition = parentElNewPosition;
347
+ if (show) {
348
+ context.prevParentPosition = parentElNewPosition;
349
+ }
347
350
  });
348
351
  useEffect(updateStyle, [show, position, absolute, updateKey, fixedWidth, parentElNewPosition, popupElSize]);
349
352
  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":"","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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E,OAAO,CAAC;YAAC,WAAW,CAAC,EAAE,OAAO,CAAA;SAAE;0BArPnB,MAAM;gCAoUD,OAAO,aAAoB,MAAM,IAAI;;yBAf3C,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCA/RxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;iCAkWvB,MAAM,WAAW,gBAAgB;4BAhDzB,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;8BArJpD,MAAM,0BAAyB,qBAAqB;;CA0b9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -227,7 +227,7 @@ var useForm = function useForm(props) {
227
227
  var _props$onChange;
228
228
  var newValue = typeof change === 'function' ? produce(context.value, change) : change;
229
229
  context.value = newValue;
230
- (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, deepClone(context.value));
230
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newValue);
231
231
  });
232
232
  var scrollToField = usePersistFn(function (name) {
233
233
  var _document;
@@ -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.8.0-beta.17",
3
+ "version": "3.8.0-beta.19",
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": {