@sheinx/hooks 3.5.0-beta.8 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAOnD,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;CAClB;AAOD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB;;;CA4S3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,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;CAClB;AAOD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB;;;CAyS3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -257,13 +257,14 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
257
257
  };
258
258
  };
259
259
  var getAbsoluteStyle = function getAbsoluteStyle(position) {
260
+ var _scrollElRef$current;
260
261
  if (!parentElRef.current) return {
261
262
  style: hideStyle
262
263
  };
263
264
  var rect = context.parentRect;
264
- if (scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current) {
265
- var _scrollElRef$current;
266
- var visibleRect = ((_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.getBoundingClientRect()) || {};
265
+ if (scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
266
+ var _scrollElRef$current2;
267
+ var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
267
268
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom || rect.right < visibleRect.left || rect.left > visibleRect.right) {
268
269
  return {
269
270
  style: hideStyle
@@ -273,15 +274,8 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
273
274
  var _getAbsolutePositionS = getAbsolutePositionStyle(rect, position),
274
275
  style = _getAbsolutePositionS.style,
275
276
  arrayStyle = _getAbsolutePositionS.arrayStyle;
276
-
277
- // TODO: 如果是版本大于chrome128,需要根据currentCSSZoom处理chrome的bug
278
- if (!(0, _utils.isChromeLowerThan)(128)) {
279
- // @ts-ignore currentCSSZoom
280
- var currentCSSZoom = document.body.currentCSSZoom;
281
- if (currentCSSZoom === 1 || !currentCSSZoom) return {
282
- style: style,
283
- arrayStyle: arrayStyle
284
- };
277
+ var currentCSSZoom = (0, _utils.getCurrentCSSZoom)();
278
+ if (currentCSSZoom && currentCSSZoom !== 1) {
285
279
  if (style.left && typeof style.left === 'number') {
286
280
  style.left = style.left * (1 / currentCSSZoom);
287
281
  }
@@ -101,13 +101,13 @@ export interface BaseImageProps {
101
101
  /**
102
102
  * @en The width of the image
103
103
  * @cn 图片宽度
104
- * @default '100%'
104
+ * @default 100%
105
105
  */
106
106
  width?: number | string;
107
107
  /**
108
108
  * @en The height of the image
109
109
  * @cn 图片高度
110
- * @default '100%'
110
+ * @default 100%
111
111
  */
112
112
  height?: number | string;
113
113
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-tree.d.ts","sourceRoot":"","sources":["use-table-tree.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAoCvD,MAAM,WAAW,iBACf,SAAQ,IAAI,CACV,kBAAkB,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EACvC,cAAc,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,QAAQ,CACvE;IACD,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,eAAO,MAAM,YAAY,UAAW,iBAAiB;;;;;;+BA6BR,GAAG,SAAS,MAAM;iCAjBhB,GAAG,SAAS,MAAM;;CA2ChE,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"use-table-tree.d.ts","sourceRoot":"","sources":["use-table-tree.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AA8CvD,MAAM,WAAW,iBACf,SAAQ,IAAI,CACV,kBAAkB,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EACvC,cAAc,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,QAAQ,CACvE;IACD,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,eAAO,MAAM,YAAY,UAAW,iBAAiB;;;;;;+BA6BR,GAAG,SAAS,MAAM;iCAjBhB,GAAG,SAAS,MAAM;;CAuDhE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -19,35 +19,47 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
19
19
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
20
20
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
21
21
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
22
- var getExpandData = function getExpandData(data, keys, keygen, treeColumnsName) {
22
+ var getExpandData = function getExpandData(_treeData, keys, keygen, treeColumnsName) {
23
23
  var expandKeys = keys;
24
24
  var expandSet = new Set(expandKeys);
25
- var expandLevel = new Map();
25
+ var unmatchExpandKeys = [];
26
+ var treeExpandLevel = new Map();
26
27
  if (expandSet.size === 0 || !treeColumnsName) {
27
- return [data, expandLevel];
28
+ return {
29
+ treeData: _treeData,
30
+ treeExpandLevel: treeExpandLevel,
31
+ unmatchExpandKeys: unmatchExpandKeys
32
+ };
28
33
  }
29
- var newData = _toConsumableArray(data || []);
34
+ var treeData = _toConsumableArray(_treeData || []);
30
35
  var _loop = function _loop() {
31
36
  if (expandSet.size === 0) return 1; // break
32
- var item = newData[i];
37
+ var item = treeData[i];
33
38
  var key = (0, _render.getKey)(keygen, item, i);
34
- var parentLevel = expandLevel.get(key) || 0;
39
+ var parentLevel = treeExpandLevel.get(key) || 0;
35
40
  var children = (0, _is.isObject)(item) && item[treeColumnsName];
36
- if (expandSet.has(key) && children) {
37
- children.forEach(function (child) {
38
- expandLevel.set((0, _render.getKey)(keygen, child), parentLevel + 1);
39
- });
40
- newData.splice.apply(newData, [i + 1, 0].concat(_toConsumableArray(children)));
41
- expandSet.delete(key);
41
+ if (expandSet.has(key)) {
42
+ if (children && children.length > 0) {
43
+ children.forEach(function (child) {
44
+ treeExpandLevel.set((0, _render.getKey)(keygen, child), parentLevel + 1);
45
+ });
46
+ treeData.splice.apply(treeData, [i + 1, 0].concat(_toConsumableArray(children)));
47
+ expandSet.delete(key);
48
+ } else {
49
+ unmatchExpandKeys.push(key);
50
+ }
42
51
  }
43
52
  };
44
- for (var i = 0; i < newData.length; i++) {
53
+ for (var i = 0; i < treeData.length; i++) {
45
54
  if (_loop()) break;
46
55
  }
47
- return [newData, expandLevel];
56
+ return {
57
+ treeData: treeData,
58
+ treeExpandLevel: treeExpandLevel,
59
+ unmatchExpandKeys: unmatchExpandKeys
60
+ };
48
61
  };
49
62
  var useTableTree = exports.useTableTree = function useTableTree(props) {
50
- var _props$data$filter;
51
63
  var _useState = (0, _react.useState)(props.defaultTreeExpandKeys || []),
52
64
  _useState2 = _slicedToArray(_useState, 2),
53
65
  expandKeysState = _useState2[0],
@@ -88,13 +100,27 @@ var useTableTree = exports.useTableTree = function useTableTree(props) {
88
100
  var _useMemo = (0, _react.useMemo)(function () {
89
101
  return getExpandData(props.data, expandKeys, props.keygen, props.treeColumnsName);
90
102
  }, [props.data, expandKeys, props.treeColumnsName]),
91
- _useMemo2 = _slicedToArray(_useMemo, 2),
92
- treeData = _useMemo2[0],
93
- treeExpandLevel = _useMemo2[1];
94
- var isEmptyTree = ((_props$data$filter = props.data.filter(function (item) {
95
- var _item;
96
- return (_item = item[props.treeColumnsName]) === null || _item === void 0 ? void 0 : _item.length;
97
- })) === null || _props$data$filter === void 0 ? void 0 : _props$data$filter.length) === 0;
103
+ treeData = _useMemo.treeData,
104
+ treeExpandLevel = _useMemo.treeExpandLevel,
105
+ unmatchExpandKeys = _useMemo.unmatchExpandKeys;
106
+ var isEmptyTree = (0, _react.useMemo)(function () {
107
+ var _props$data$filter;
108
+ return ((_props$data$filter = props.data.filter(function (item) {
109
+ var _item;
110
+ return (_item = item[props.treeColumnsName]) === null || _item === void 0 ? void 0 : _item.length;
111
+ })) === null || _props$data$filter === void 0 ? void 0 : _props$data$filter.length) === 0;
112
+ }, [props.data, props.treeColumnsName]);
113
+ (0, _react.useEffect)(function () {
114
+ if (!unmatchExpandKeys.length || !expandKeysState.length) {
115
+ return;
116
+ }
117
+
118
+ // 检查treeData中的每一项,对比expandKeysState,如果expandKeysState有但是children是空的,则需要修正expandKeysState
119
+ var newExpandKeys = expandKeysState.filter(function (key) {
120
+ return !unmatchExpandKeys.includes(key);
121
+ });
122
+ setExpandKeysState(newExpandKeys);
123
+ }, [unmatchExpandKeys, expandKeysState]);
98
124
  return {
99
125
  data: treeData,
100
126
  treeExpandLevel: treeExpandLevel,
@@ -0,0 +1,2 @@
1
+ export declare const getCurrentCSSZoom: () => number;
2
+ //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,QAAO,MAqBpC,CAAA"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getCurrentCSSZoom = void 0;
7
+ var cachedZoom = 0;
8
+ var getCurrentCSSZoom = exports.getCurrentCSSZoom = function getCurrentCSSZoom() {
9
+ if (cachedZoom) return cachedZoom;
10
+ if (typeof window === 'undefined' || typeof navigator === 'undefined' || !document.body) {
11
+ return 1;
12
+ }
13
+ var currentCSSZoom = Math.round(document.body.getBoundingClientRect().width) / document.body.clientWidth;
14
+ if (window.ResizeObserver) {
15
+ // 监听document.body的变化,更新缓存的zoom
16
+ var resizeObserver = new ResizeObserver(function () {
17
+ cachedZoom = Math.round(document.body.getBoundingClientRect().width) / document.body.clientWidth;
18
+ });
19
+ resizeObserver.observe(document.body);
20
+ }
21
+ cachedZoom = currentCSSZoom;
22
+ return currentCSSZoom;
23
+ };
24
+
25
+ // export const getZoomBoundingClientRect = (element: HTMLElement) => {
26
+ // const currentCSSZoom = getCurrentCSSZoom()
27
+ // if (currentCSSZoom === 1 || !currentCSSZoom) {
28
+ // return element.getBoundingClientRect()
29
+ // }
30
+ // const isNotZoom = currentCSSZoom === 1 || !currentCSSZoom
31
+
32
+ // if (isNotZoom) {
33
+ // return element.getBoundingClientRect()
34
+ // }
35
+
36
+ // const zoomRatio = 1 / currentCSSZoom
37
+ // const rect = element.getBoundingClientRect()
38
+
39
+ // return {
40
+ // x: rect.x * zoomRatio,
41
+ // y: rect.y * zoomRatio,
42
+ // top: rect.top * zoomRatio,
43
+ // right: rect.right * zoomRatio,
44
+ // bottom: rect.bottom * zoomRatio,
45
+ // left: rect.left * zoomRatio,
46
+ // width: rect.width * zoomRatio,
47
+ // height: rect.height * zoomRatio,
48
+ // }
49
+ // }
@@ -3,6 +3,7 @@ export { parsePxToNumber, addResizeObserver } from './element';
3
3
  export type { OldWheelEvent } from './normalize-wheel.type';
4
4
  export * from './ready';
5
5
  export * from './element';
6
+ export * from './document';
6
7
  export { default as ResponsiveObserve } from './responsiveObserve';
7
8
  export type { Breakpoint, ScreenMap } from './responsiveObserve.type';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC"}
@@ -64,5 +64,17 @@ Object.keys(_ready).forEach(function (key) {
64
64
  }
65
65
  });
66
66
  });
67
+ var _document = require("./document");
68
+ Object.keys(_document).forEach(function (key) {
69
+ if (key === "default" || key === "__esModule") return;
70
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
71
+ if (key in exports && exports[key] === _document[key]) return;
72
+ Object.defineProperty(exports, key, {
73
+ enumerable: true,
74
+ get: function get() {
75
+ return _document[key];
76
+ }
77
+ });
78
+ });
67
79
  var _responsiveObserve = _interopRequireDefault(require("./responsiveObserve"));
68
80
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/cjs/utils/is.d.ts CHANGED
@@ -24,6 +24,5 @@ export declare const isLink: (el: unknown) => el is React.ReactElement<any, stri
24
24
  export declare function isNamedComponent(type: any): type is React.ForwardRefExoticComponent<unknown>;
25
25
  export declare const isMacOS: () => boolean;
26
26
  export declare const isFirefox: () => boolean;
27
- export declare const isChromeLowerThan: (version: number) => boolean;
28
27
  export declare function isDomElement(element: any): element is HTMLElement;
29
28
  //# sourceMappingURL=is.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is.d.ts","sourceRoot":"","sources":["is.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,wBAAgB,SAAS,YAExB;AASD,eAAO,MAAM,OAAO,4BAAgB,CAAC;AACrC,eAAO,MAAM,QAAQ,QAAS,OAAO,sBACc,CAAC;AACpD,eAAO,MAAM,MAAM,QAAS,OAAO,gBAAqC,CAAC;AACzE,eAAO,MAAM,SAAS,QAAS,OAAO,mB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ED,eAAO,MAAM,OAAO,QAAO,OACqC,CAAC;AAEjE,eAAO,MAAM,SAAS,QAAO,OAG5B,CAAC;AAEF,wBAAgB,YAAY,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,IAAI,WAAW,CAQjE"}
package/cjs/utils/is.js CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isBoolean = exports.isArray = void 0;
7
7
  exports.isBrowser = isBrowser;
8
- exports.isDate = exports.isChromeLowerThan = exports.isBuffer = void 0;
8
+ exports.isDate = exports.isBuffer = void 0;
9
9
  exports.isDomElement = isDomElement;
10
10
  exports.isMergeable = exports.isMap = exports.isMacOS = exports.isLink = exports.isFunc = exports.isFirefox = exports.isError = exports.isEmpty = void 0;
11
11
  exports.isNamedComponent = isNamedComponent;
@@ -108,15 +108,6 @@ var isFirefox = exports.isFirefox = function isFirefox() {
108
108
  if (!isBrowser()) return false;
109
109
  return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
110
110
  };
111
- var isChromeLowerThan = exports.isChromeLowerThan = function isChromeLowerThan(version) {
112
- // 服务器端渲染时,不执行版本检查
113
- if (typeof window === 'undefined' || typeof navigator === 'undefined') {
114
- return false;
115
- }
116
- var ua = navigator.userAgent;
117
- var chrome = ua.match(/chrome\/(\d+)/i);
118
- return Boolean(chrome && chrome[1] && parseInt(chrome[1], 10) < version);
119
- };
120
111
  function isDomElement(element) {
121
112
  return (typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement)) === 'object' ? element instanceof HTMLElement // DOM2
122
113
  : element && _typeof(element) === 'object' && element !== null && element.nodeType === 1 && typeof element.nodeName === 'string';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAOnD,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,UAAU,GACV,cAAc,GACd,WAAW,GACX,MAAM,GACN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AAM,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;CAClB;AAOD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB;;;CAyS3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -10,7 +10,8 @@ import { getPositionStyle } from "./get-position-style";
10
10
  import { useCheckElementPosition } from "./check-position";
11
11
  import shallowEqual from "../../utils/shallow-equal";
12
12
  import usePersistFn from "../use-persist-fn";
13
- import { docSize, isChromeLowerThan } from "../../utils";
13
+ import { getCurrentCSSZoom } from "../../utils";
14
+ import { docSize } from "../../utils";
14
15
  var horizontalPosition = ['left-bottom', 'left-top', 'right-bottom', 'right-top', 'left', 'right'];
15
16
  var verticalPosition = ['bottom-left', 'bottom-right', 'top-left', 'top-right', 'bottom', 'top'];
16
17
  var hideStyle = {
@@ -247,13 +248,14 @@ export var usePositionStyle = function usePositionStyle(config) {
247
248
  };
248
249
  };
249
250
  var getAbsoluteStyle = function getAbsoluteStyle(position) {
251
+ var _scrollElRef$current;
250
252
  if (!parentElRef.current) return {
251
253
  style: hideStyle
252
254
  };
253
255
  var rect = context.parentRect;
254
- if (scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current) {
255
- var _scrollElRef$current;
256
- var visibleRect = ((_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.getBoundingClientRect()) || {};
256
+ if (scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current && (_scrollElRef$current = scrollElRef.current) !== null && _scrollElRef$current !== void 0 && _scrollElRef$current.contains(parentElRef.current)) {
257
+ var _scrollElRef$current2;
258
+ var visibleRect = ((_scrollElRef$current2 = scrollElRef.current) === null || _scrollElRef$current2 === void 0 ? void 0 : _scrollElRef$current2.getBoundingClientRect()) || {};
257
259
  if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom || rect.right < visibleRect.left || rect.left > visibleRect.right) {
258
260
  return {
259
261
  style: hideStyle
@@ -263,15 +265,8 @@ export var usePositionStyle = function usePositionStyle(config) {
263
265
  var _getAbsolutePositionS = getAbsolutePositionStyle(rect, position),
264
266
  style = _getAbsolutePositionS.style,
265
267
  arrayStyle = _getAbsolutePositionS.arrayStyle;
266
-
267
- // TODO: 如果是版本大于chrome128,需要根据currentCSSZoom处理chrome的bug
268
- if (!isChromeLowerThan(128)) {
269
- // @ts-ignore currentCSSZoom
270
- var currentCSSZoom = document.body.currentCSSZoom;
271
- if (currentCSSZoom === 1 || !currentCSSZoom) return {
272
- style: style,
273
- arrayStyle: arrayStyle
274
- };
268
+ var currentCSSZoom = getCurrentCSSZoom();
269
+ if (currentCSSZoom && currentCSSZoom !== 1) {
275
270
  if (style.left && typeof style.left === 'number') {
276
271
  style.left = style.left * (1 / currentCSSZoom);
277
272
  }
@@ -101,13 +101,13 @@ export interface BaseImageProps {
101
101
  /**
102
102
  * @en The width of the image
103
103
  * @cn 图片宽度
104
- * @default '100%'
104
+ * @default 100%
105
105
  */
106
106
  width?: number | string;
107
107
  /**
108
108
  * @en The height of the image
109
109
  * @cn 图片高度
110
- * @default '100%'
110
+ * @default 100%
111
111
  */
112
112
  height?: number | string;
113
113
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-tree.d.ts","sourceRoot":"","sources":["use-table-tree.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAoCvD,MAAM,WAAW,iBACf,SAAQ,IAAI,CACV,kBAAkB,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EACvC,cAAc,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,QAAQ,CACvE;IACD,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,eAAO,MAAM,YAAY,UAAW,iBAAiB;;;;;;+BA6BR,GAAG,SAAS,MAAM;iCAjBhB,GAAG,SAAS,MAAM;;CA2ChE,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"use-table-tree.d.ts","sourceRoot":"","sources":["use-table-tree.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AA8CvD,MAAM,WAAW,iBACf,SAAQ,IAAI,CACV,kBAAkB,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EACvC,cAAc,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,QAAQ,CACvE;IACD,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,eAAO,MAAM,YAAY,UAAW,iBAAiB;;;;;;+BA6BR,GAAG,SAAS,MAAM;iCAjBhB,GAAG,SAAS,MAAM;;CAuDhE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -13,35 +13,47 @@ import { usePersistFn } from "../../common/use-persist-fn";
13
13
  import { getKey } from "../../utils/render";
14
14
  import { isObject } from "../../utils/is";
15
15
  import { useLatestObj } from "../../common/use-latest-obj";
16
- var getExpandData = function getExpandData(data, keys, keygen, treeColumnsName) {
16
+ var getExpandData = function getExpandData(_treeData, keys, keygen, treeColumnsName) {
17
17
  var expandKeys = keys;
18
18
  var expandSet = new Set(expandKeys);
19
- var expandLevel = new Map();
19
+ var unmatchExpandKeys = [];
20
+ var treeExpandLevel = new Map();
20
21
  if (expandSet.size === 0 || !treeColumnsName) {
21
- return [data, expandLevel];
22
+ return {
23
+ treeData: _treeData,
24
+ treeExpandLevel: treeExpandLevel,
25
+ unmatchExpandKeys: unmatchExpandKeys
26
+ };
22
27
  }
23
- var newData = _toConsumableArray(data || []);
28
+ var treeData = _toConsumableArray(_treeData || []);
24
29
  var _loop = function _loop() {
25
30
  if (expandSet.size === 0) return 1; // break
26
- var item = newData[i];
31
+ var item = treeData[i];
27
32
  var key = getKey(keygen, item, i);
28
- var parentLevel = expandLevel.get(key) || 0;
33
+ var parentLevel = treeExpandLevel.get(key) || 0;
29
34
  var children = isObject(item) && item[treeColumnsName];
30
- if (expandSet.has(key) && children) {
31
- children.forEach(function (child) {
32
- expandLevel.set(getKey(keygen, child), parentLevel + 1);
33
- });
34
- newData.splice.apply(newData, [i + 1, 0].concat(_toConsumableArray(children)));
35
- expandSet.delete(key);
35
+ if (expandSet.has(key)) {
36
+ if (children && children.length > 0) {
37
+ children.forEach(function (child) {
38
+ treeExpandLevel.set(getKey(keygen, child), parentLevel + 1);
39
+ });
40
+ treeData.splice.apply(treeData, [i + 1, 0].concat(_toConsumableArray(children)));
41
+ expandSet.delete(key);
42
+ } else {
43
+ unmatchExpandKeys.push(key);
44
+ }
36
45
  }
37
46
  };
38
- for (var i = 0; i < newData.length; i++) {
47
+ for (var i = 0; i < treeData.length; i++) {
39
48
  if (_loop()) break;
40
49
  }
41
- return [newData, expandLevel];
50
+ return {
51
+ treeData: treeData,
52
+ treeExpandLevel: treeExpandLevel,
53
+ unmatchExpandKeys: unmatchExpandKeys
54
+ };
42
55
  };
43
56
  export var useTableTree = function useTableTree(props) {
44
- var _props$data$filter;
45
57
  var _useState = useState(props.defaultTreeExpandKeys || []),
46
58
  _useState2 = _slicedToArray(_useState, 2),
47
59
  expandKeysState = _useState2[0],
@@ -82,13 +94,27 @@ export var useTableTree = function useTableTree(props) {
82
94
  var _useMemo = useMemo(function () {
83
95
  return getExpandData(props.data, expandKeys, props.keygen, props.treeColumnsName);
84
96
  }, [props.data, expandKeys, props.treeColumnsName]),
85
- _useMemo2 = _slicedToArray(_useMemo, 2),
86
- treeData = _useMemo2[0],
87
- treeExpandLevel = _useMemo2[1];
88
- var isEmptyTree = ((_props$data$filter = props.data.filter(function (item) {
89
- var _item;
90
- return (_item = item[props.treeColumnsName]) === null || _item === void 0 ? void 0 : _item.length;
91
- })) === null || _props$data$filter === void 0 ? void 0 : _props$data$filter.length) === 0;
97
+ treeData = _useMemo.treeData,
98
+ treeExpandLevel = _useMemo.treeExpandLevel,
99
+ unmatchExpandKeys = _useMemo.unmatchExpandKeys;
100
+ var isEmptyTree = useMemo(function () {
101
+ var _props$data$filter;
102
+ return ((_props$data$filter = props.data.filter(function (item) {
103
+ var _item;
104
+ return (_item = item[props.treeColumnsName]) === null || _item === void 0 ? void 0 : _item.length;
105
+ })) === null || _props$data$filter === void 0 ? void 0 : _props$data$filter.length) === 0;
106
+ }, [props.data, props.treeColumnsName]);
107
+ useEffect(function () {
108
+ if (!unmatchExpandKeys.length || !expandKeysState.length) {
109
+ return;
110
+ }
111
+
112
+ // 检查treeData中的每一项,对比expandKeysState,如果expandKeysState有但是children是空的,则需要修正expandKeysState
113
+ var newExpandKeys = expandKeysState.filter(function (key) {
114
+ return !unmatchExpandKeys.includes(key);
115
+ });
116
+ setExpandKeysState(newExpandKeys);
117
+ }, [unmatchExpandKeys, expandKeysState]);
92
118
  return {
93
119
  data: treeData,
94
120
  treeExpandLevel: treeExpandLevel,
@@ -0,0 +1,2 @@
1
+ export declare const getCurrentCSSZoom: () => number;
2
+ //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["document.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,QAAO,MAqBpC,CAAA"}
@@ -0,0 +1,43 @@
1
+ var cachedZoom = 0;
2
+ export var getCurrentCSSZoom = function getCurrentCSSZoom() {
3
+ if (cachedZoom) return cachedZoom;
4
+ if (typeof window === 'undefined' || typeof navigator === 'undefined' || !document.body) {
5
+ return 1;
6
+ }
7
+ var currentCSSZoom = Math.round(document.body.getBoundingClientRect().width) / document.body.clientWidth;
8
+ if (window.ResizeObserver) {
9
+ // 监听document.body的变化,更新缓存的zoom
10
+ var resizeObserver = new ResizeObserver(function () {
11
+ cachedZoom = Math.round(document.body.getBoundingClientRect().width) / document.body.clientWidth;
12
+ });
13
+ resizeObserver.observe(document.body);
14
+ }
15
+ cachedZoom = currentCSSZoom;
16
+ return currentCSSZoom;
17
+ };
18
+
19
+ // export const getZoomBoundingClientRect = (element: HTMLElement) => {
20
+ // const currentCSSZoom = getCurrentCSSZoom()
21
+ // if (currentCSSZoom === 1 || !currentCSSZoom) {
22
+ // return element.getBoundingClientRect()
23
+ // }
24
+ // const isNotZoom = currentCSSZoom === 1 || !currentCSSZoom
25
+
26
+ // if (isNotZoom) {
27
+ // return element.getBoundingClientRect()
28
+ // }
29
+
30
+ // const zoomRatio = 1 / currentCSSZoom
31
+ // const rect = element.getBoundingClientRect()
32
+
33
+ // return {
34
+ // x: rect.x * zoomRatio,
35
+ // y: rect.y * zoomRatio,
36
+ // top: rect.top * zoomRatio,
37
+ // right: rect.right * zoomRatio,
38
+ // bottom: rect.bottom * zoomRatio,
39
+ // left: rect.left * zoomRatio,
40
+ // width: rect.width * zoomRatio,
41
+ // height: rect.height * zoomRatio,
42
+ // }
43
+ // }
@@ -3,6 +3,7 @@ export { parsePxToNumber, addResizeObserver } from './element';
3
3
  export type { OldWheelEvent } from './normalize-wheel.type';
4
4
  export * from './ready';
5
5
  export * from './element';
6
+ export * from './document';
6
7
  export { default as ResponsiveObserve } from './responsiveObserve';
7
8
  export type { Breakpoint, ScreenMap } from './responsiveObserve.type';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC"}
@@ -2,4 +2,5 @@ export { default, default as NormalizeWheel } from "./normalize-wheel";
2
2
  export { parsePxToNumber, addResizeObserver } from "./element";
3
3
  export * from "./ready";
4
4
  export * from "./element";
5
+ export * from "./document";
5
6
  export { default as ResponsiveObserve } from "./responsiveObserve";
package/esm/utils/is.d.ts CHANGED
@@ -24,6 +24,5 @@ export declare const isLink: (el: unknown) => el is React.ReactElement<any, stri
24
24
  export declare function isNamedComponent(type: any): type is React.ForwardRefExoticComponent<unknown>;
25
25
  export declare const isMacOS: () => boolean;
26
26
  export declare const isFirefox: () => boolean;
27
- export declare const isChromeLowerThan: (version: number) => boolean;
28
27
  export declare function isDomElement(element: any): element is HTMLElement;
29
28
  //# sourceMappingURL=is.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is.d.ts","sourceRoot":"","sources":["is.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,wBAAgB,SAAS,YAExB;AASD,eAAO,MAAM,OAAO,4BAAgB,CAAC;AACrC,eAAO,MAAM,QAAQ,QAAS,OAAO,sBACc,CAAC;AACpD,eAAO,MAAM,MAAM,QAAS,OAAO,gBAAqC,CAAC;AACzE,eAAO,MAAM,SAAS,QAAS,OAAO,mBAA2C,CAAC;AAClF,eAAO,MAAM,OAAO,QAAS,OAAO,KAAG,OAA+B,CAAC;AACvE,eAAO,MAAM,QAAQ,MAAO,OAAO,gBAAuC,CAAC;AAC3E,eAAO,MAAM,QAAQ,QAAS,OAAO,KAAG,OAAgC,CAAC;AACzE,eAAO,MAAM,QAAQ,MAAO,OAAO,gBAAuC,CAAC;AAC3E,eAAO,MAAM,WAAW,QAAS,GAAG,qBAAwC,CAAC;AAC7E,eAAO,MAAM,KAAK,QAjBsB,OAAO,mBAiBb,CAAC;AACnC,eAAO,MAAM,KAAK,QAlBsB,OAAO,mBAkBb,CAAC;AACnC,eAAO,MAAM,QAAQ,QAAS,OAAO,KAAG,OAUvC,CAAC;AACF,eAAO,MAAM,eAAe,QAAS,OAAO,yBAE3C,CAAC;AACF,eAAO,MAAM,WAAW,QAAS,OAAO,KAAG,OAS1C,CAAC;AAE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,MAAM,WAAW,QAAS,GAAG,qBAAwC,CAAC;AAC7E,eAAO,MAAM,KAAK,QAjBsB,OAAO,mBAiBb,CAAC;AACnC,eAAO,MAAM,KAAK,QAlBsB,OAAO,mBAkBb,CAAC;AACnC,eAAO,MAAM,QAAQ,QAAS,OAAO,KAAG,OAUvC,CAAC;AACF,eAAO,MAAM,eAAe,QAAS,OAAO,yBAE3C,CAAC;AACF,eAAO,MAAM,WAAW,QAAS,OAAO,KAAG,OAS1C,CAAC;AAEF,eAAO,MAAM,MAAM,MAAO,OAAO,kBAA2C,CAAC;AAE7E,eAAO,MAAM,SAAS,MAAO,OAAO,YACiC,CAAC;AAGtE,eAAO,MAAM,KAAK,MAAO,OAAO,KAAG,OAAkB,CAAC;AAEtD,eAAO,MAAM,OAAO,QAAS,OAAO,KAAG,OActC,CAAC;AAEF,eAAO,MAAM,MAAM,OAAQ,OAAO,6EASjC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,KAAK,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAE5F;AAED,eAAO,MAAM,OAAO,QAAO,OACqC,CAAC;AAEjE,eAAO,MAAM,SAAS,QAAO,OAG5B,CAAC;AAEF,wBAAgB,YAAY,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,IAAI,WAAW,CAQjE"}
package/esm/utils/is.js CHANGED
@@ -95,15 +95,6 @@ export var isFirefox = function isFirefox() {
95
95
  if (!isBrowser()) return false;
96
96
  return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
97
97
  };
98
- export var isChromeLowerThan = function isChromeLowerThan(version) {
99
- // 服务器端渲染时,不执行版本检查
100
- if (typeof window === 'undefined' || typeof navigator === 'undefined') {
101
- return false;
102
- }
103
- var ua = navigator.userAgent;
104
- var chrome = ua.match(/chrome\/(\d+)/i);
105
- return Boolean(chrome && chrome[1] && parseInt(chrome[1], 10) < version);
106
- };
107
98
  export function isDomElement(element) {
108
99
  return (typeof HTMLElement === "undefined" ? "undefined" : _typeof(HTMLElement)) === 'object' ? element instanceof HTMLElement // DOM2
109
100
  : element && _typeof(element) === 'object' && element !== null && element.nodeType === 1 && typeof element.nodeName === 'string';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.5.0-beta.8",
3
+ "version": "3.5.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",