@sheinx/hooks 3.6.1-beta.1 → 3.6.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- interface Position {
1
+ export interface Position {
2
2
  top: number;
3
3
  left: number;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"check-position.d.ts","sourceRoot":"","sources":["check-position.ts"],"names":[],"mappings":"AAEA,UAAU,QAAQ;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,8BAA8B;IAEtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,uBAAuB,eACtB,MAAM,SAAS,CAAC,WAAW,CAAC,YAC/B,8BAA8B,KACtC,QAAQ,GAAG,IAyEb,CAAC"}
1
+ {"version":3,"file":"check-position.d.ts","sourceRoot":"","sources":["check-position.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,8BAA8B;IAEtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,uBAAuB,eACtB,MAAM,SAAS,CAAC,WAAW,CAAC,YAC/B,8BAA8B,KACtC,QAAQ,GAAG,IAyEb,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AASnD,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,U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W,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;;;CAyT3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -69,7 +69,8 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
69
69
  width: 0
70
70
  },
71
71
  popUpHeight: 0,
72
- popUpWidth: 0
72
+ popUpWidth: 0,
73
+ prevParentPosition: null
73
74
  }),
74
75
  context = _React$useRef.current;
75
76
  var parentElNewPosition = (0, _checkPosition.useCheckElementPosition)(parentElRef, {
@@ -269,7 +270,8 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
269
270
  style: hideStyle
270
271
  };
271
272
  var rect = context.parentRect;
272
- if (!show && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
273
+ var needCheck = !show || !(0, _shallowEqual.default)(context.prevParentPosition, parentElNewPosition);
274
+ if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
273
275
  var _scrollElRef$current2;
274
276
  var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
275
277
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom || rect.right < visibleRect.left || rect.left > visibleRect.right) {
@@ -351,6 +353,9 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
351
353
  setStyle(newStyle);
352
354
  setArrayStyle(newArrayStyle || {});
353
355
  }
356
+
357
+ // 当父元素的滚动容器滚动时,判断是否需要更新弹出层位置,包括是否隐藏弹出层(通过hideStyle隐藏,不是show状态)
358
+ context.prevParentPosition = parentElNewPosition;
354
359
  });
355
360
  (0, _react.useEffect)(updateStyle, [show, position, absolute, updateKey, fixedWidth, parentElNewPosition]);
356
361
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-filter.d.ts","sourceRoot":"","sources":["use-table-filter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,mBAAmB,CAAC,IAAI,GAAG,GAAG,CAC7C,SAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtE,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;CACnC;AACD,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;CAC5C;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5D,QAAA,MAAM,cAAc;;;;gCA6BH,YAAY,SAAS,GAAG;CAoDxC,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"use-table-filter.d.ts","sourceRoot":"","sources":["use-table-filter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,mBAAmB,CAAC,IAAI,GAAG,GAAG,CAC7C,SAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtE,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;CACnC;AACD,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;CAC5C;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5D,QAAA,MAAM,cAAc;;;;gCA6BH,YAAY,SAAS,GAAG;CAyDxC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -73,18 +73,21 @@ var useTableFilter = function useTableFilter(props) {
73
73
 
74
74
  // 根据columns生成filterInfo
75
75
  (0, _react.useEffect)(function () {
76
- var _props$columns;
77
- var _filterInfo = props === null || props === void 0 || (_props$columns = props.columns) === null || _props$columns === void 0 ? void 0 : _props$columns.reduce(function (acc, column, index) {
78
- var _column$filter;
79
- if (!column.filter) return acc;
80
- var columnKey = typeof column.render === 'string' ? column.render : String(index);
81
- acc.set(columnKey, {
82
- value: undefined,
83
- onFilter: (_column$filter = column.filter) === null || _column$filter === void 0 ? void 0 : _column$filter.onFilter
84
- });
85
- return acc;
86
- }, new Map());
87
- if (_filterInfo) setFilterInfo(_filterInfo);
76
+ setFilterInfo(function (prev) {
77
+ var _props$columns;
78
+ var _filterInfo = props === null || props === void 0 || (_props$columns = props.columns) === null || _props$columns === void 0 ? void 0 : _props$columns.reduce(function (acc, column, index) {
79
+ var _prev$get2, _column$filter;
80
+ if (!column.filter) return acc;
81
+ var columnKey = typeof column.render === 'string' ? column.render : String(index);
82
+ var prevValue = (_prev$get2 = prev.get(columnKey)) === null || _prev$get2 === void 0 ? void 0 : _prev$get2.value;
83
+ acc.set(columnKey, {
84
+ value: prevValue,
85
+ onFilter: (_column$filter = column.filter) === null || _column$filter === void 0 ? void 0 : _column$filter.onFilter
86
+ });
87
+ return acc;
88
+ }, new Map());
89
+ return _filterInfo || new Map();
90
+ });
88
91
  }, [props.columns]);
89
92
  return {
90
93
  filterInfo: filterInfo,
@@ -1,4 +1,4 @@
1
- interface Position {
1
+ export interface Position {
2
2
  top: number;
3
3
  left: number;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"check-position.d.ts","sourceRoot":"","sources":["check-position.ts"],"names":[],"mappings":"AAEA,UAAU,QAAQ;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,8BAA8B;IAEtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,uBAAuB,eACtB,MAAM,SAAS,CAAC,WAAW,CAAC,YAC/B,8BAA8B,KACtC,QAAQ,GAAG,IAyEb,CAAC"}
1
+ {"version":3,"file":"check-position.d.ts","sourceRoot":"","sources":["check-position.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM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AEF,eAAe,gBAAgB,CAAC"}
@@ -60,7 +60,8 @@ export var usePositionStyle = function usePositionStyle(config) {
60
60
  width: 0
61
61
  },
62
62
  popUpHeight: 0,
63
- popUpWidth: 0
63
+ popUpWidth: 0,
64
+ prevParentPosition: null
64
65
  }),
65
66
  context = _React$useRef.current;
66
67
  var parentElNewPosition = useCheckElementPosition(parentElRef, {
@@ -260,7 +261,8 @@ export var usePositionStyle = function usePositionStyle(config) {
260
261
  style: hideStyle
261
262
  };
262
263
  var rect = context.parentRect;
263
- if (!show && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
264
+ var needCheck = !show || !shallowEqual(context.prevParentPosition, parentElNewPosition);
265
+ if (needCheck && scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
264
266
  var _scrollElRef$current2;
265
267
  var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
266
268
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom || rect.right < visibleRect.left || rect.left > visibleRect.right) {
@@ -342,6 +344,9 @@ export var usePositionStyle = function usePositionStyle(config) {
342
344
  setStyle(newStyle);
343
345
  setArrayStyle(newArrayStyle || {});
344
346
  }
347
+
348
+ // 当父元素的滚动容器滚动时,判断是否需要更新弹出层位置,包括是否隐藏弹出层(通过hideStyle隐藏,不是show状态)
349
+ context.prevParentPosition = parentElNewPosition;
345
350
  });
346
351
  useEffect(updateStyle, [show, position, absolute, updateKey, fixedWidth, parentElNewPosition]);
347
352
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-filter.d.ts","sourceRoot":"","sources":["use-table-filter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE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CAAC;CAC5C;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5D,QAAA,MAAM,cAAc;;;;gCA6BH,YAAY,SAAS,GAAG;CAyDxC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -66,18 +66,21 @@ var useTableFilter = function useTableFilter(props) {
66
66
 
67
67
  // 根据columns生成filterInfo
68
68
  useEffect(function () {
69
- var _props$columns;
70
- var _filterInfo = props === null || props === void 0 || (_props$columns = props.columns) === null || _props$columns === void 0 ? void 0 : _props$columns.reduce(function (acc, column, index) {
71
- var _column$filter;
72
- if (!column.filter) return acc;
73
- var columnKey = typeof column.render === 'string' ? column.render : String(index);
74
- acc.set(columnKey, {
75
- value: undefined,
76
- onFilter: (_column$filter = column.filter) === null || _column$filter === void 0 ? void 0 : _column$filter.onFilter
77
- });
78
- return acc;
79
- }, new Map());
80
- if (_filterInfo) setFilterInfo(_filterInfo);
69
+ setFilterInfo(function (prev) {
70
+ var _props$columns;
71
+ var _filterInfo = props === null || props === void 0 || (_props$columns = props.columns) === null || _props$columns === void 0 ? void 0 : _props$columns.reduce(function (acc, column, index) {
72
+ var _prev$get2, _column$filter;
73
+ if (!column.filter) return acc;
74
+ var columnKey = typeof column.render === 'string' ? column.render : String(index);
75
+ var prevValue = (_prev$get2 = prev.get(columnKey)) === null || _prev$get2 === void 0 ? void 0 : _prev$get2.value;
76
+ acc.set(columnKey, {
77
+ value: prevValue,
78
+ onFilter: (_column$filter = column.filter) === null || _column$filter === void 0 ? void 0 : _column$filter.onFilter
79
+ });
80
+ return acc;
81
+ }, new Map());
82
+ return _filterInfo || new Map();
83
+ });
81
84
  }, [props.columns]);
82
85
  return {
83
86
  filterInfo: filterInfo,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.6.1-beta.1",
3
+ "version": "3.6.1-beta.3",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",