@sheinx/hooks 3.6.0-beta.9 → 3.6.0-fix.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 (99) 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 +6 -7
  3. package/cjs/common/use-pagination-list/index.d.ts.map +1 -1
  4. package/cjs/common/use-pagination-list/index.js +6 -1
  5. package/cjs/common/use-position-style/index.d.ts.map +1 -1
  6. package/cjs/common/use-position-style/index.js +7 -3
  7. package/cjs/components/use-check/use-check.d.ts +1 -1
  8. package/cjs/components/use-check/use-check.d.ts.map +1 -1
  9. package/cjs/components/use-check/use-check.js +10 -3
  10. package/cjs/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
  11. package/cjs/components/use-datepicker/use-datepicker-format.js +4 -0
  12. package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts +1 -1
  13. package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
  14. package/cjs/components/use-form/Provider.d.ts +1 -2
  15. package/cjs/components/use-form/Provider.d.ts.map +1 -1
  16. package/cjs/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
  17. package/cjs/components/use-form/use-form-control/use-form-control.js +2 -3
  18. package/cjs/components/use-form/use-form.d.ts +1 -2
  19. package/cjs/components/use-form/use-form.d.ts.map +1 -1
  20. package/cjs/components/use-form/use-form.js +20 -11
  21. package/cjs/components/use-form/use-form.type.d.ts +5 -3
  22. package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
  23. package/cjs/components/use-input/use-input-format.d.ts +1 -1
  24. package/cjs/components/use-input/use-input-number.d.ts +1 -1
  25. package/cjs/components/use-input/use-input-number.d.ts.map +1 -1
  26. package/cjs/components/use-input/use-input-number.js +1 -0
  27. package/cjs/components/use-popup/use-popup.d.ts.map +1 -1
  28. package/cjs/components/use-popup/use-popup.js +5 -0
  29. package/cjs/components/use-table/index.d.ts +2 -1
  30. package/cjs/components/use-table/index.d.ts.map +1 -1
  31. package/cjs/components/use-table/index.js +7 -0
  32. package/cjs/components/use-table/use-table-filter.d.ts +19 -0
  33. package/cjs/components/use-table/use-table-filter.d.ts.map +1 -0
  34. package/cjs/components/use-table/use-table-filter.js +96 -0
  35. package/cjs/components/use-table/use-table.type.d.ts +93 -0
  36. package/cjs/components/use-table/use-table.type.d.ts.map +1 -1
  37. package/cjs/components/use-tabs/context.d.ts +1 -1
  38. package/cjs/components/use-tabs/context.d.ts.map +1 -1
  39. package/cjs/components/use-tabs/use-tabs.d.ts +1 -1
  40. package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
  41. package/cjs/components/use-tree/use-tree.js +58 -13
  42. package/cjs/components/use-tree/use-tree.type.d.ts +4 -0
  43. package/cjs/components/use-tree/use-tree.type.d.ts.map +1 -1
  44. package/cjs/components/use-treeselect/use-tiled.d.ts +1 -1
  45. package/cjs/utils/dom/element.d.ts +1 -1
  46. package/cjs/utils/dom/element.d.ts.map +1 -1
  47. package/cjs/utils/dom/element.js +5 -3
  48. package/cjs/utils/lazyload.d.ts.map +1 -1
  49. package/cjs/utils/lazyload.js +2 -2
  50. package/esm/common/use-input-able/use-Input-able.d.ts.map +1 -1
  51. package/esm/common/use-input-able/use-Input-able.js +7 -8
  52. package/esm/common/use-pagination-list/index.d.ts.map +1 -1
  53. package/esm/common/use-pagination-list/index.js +6 -1
  54. package/esm/common/use-position-style/index.d.ts.map +1 -1
  55. package/esm/common/use-position-style/index.js +7 -3
  56. package/esm/components/use-check/use-check.d.ts +1 -1
  57. package/esm/components/use-check/use-check.d.ts.map +1 -1
  58. package/esm/components/use-check/use-check.js +10 -3
  59. package/esm/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
  60. package/esm/components/use-datepicker/use-datepicker-format.js +4 -0
  61. package/esm/components/use-datepicker/use-datepicker-format.type.d.ts +1 -1
  62. package/esm/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
  63. package/esm/components/use-form/Provider.d.ts +1 -2
  64. package/esm/components/use-form/Provider.d.ts.map +1 -1
  65. package/esm/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
  66. package/esm/components/use-form/use-form-control/use-form-control.js +2 -3
  67. package/esm/components/use-form/use-form.d.ts +1 -2
  68. package/esm/components/use-form/use-form.d.ts.map +1 -1
  69. package/esm/components/use-form/use-form.js +20 -11
  70. package/esm/components/use-form/use-form.type.d.ts +5 -3
  71. package/esm/components/use-form/use-form.type.d.ts.map +1 -1
  72. package/esm/components/use-input/use-input-format.d.ts +1 -1
  73. package/esm/components/use-input/use-input-number.d.ts +1 -1
  74. package/esm/components/use-input/use-input-number.d.ts.map +1 -1
  75. package/esm/components/use-input/use-input-number.js +1 -0
  76. package/esm/components/use-popup/use-popup.d.ts.map +1 -1
  77. package/esm/components/use-popup/use-popup.js +5 -0
  78. package/esm/components/use-table/index.d.ts +2 -1
  79. package/esm/components/use-table/index.d.ts.map +1 -1
  80. package/esm/components/use-table/index.js +1 -0
  81. package/esm/components/use-table/use-table-filter.d.ts +19 -0
  82. package/esm/components/use-table/use-table-filter.d.ts.map +1 -0
  83. package/esm/components/use-table/use-table-filter.js +89 -0
  84. package/esm/components/use-table/use-table.type.d.ts +93 -0
  85. package/esm/components/use-table/use-table.type.d.ts.map +1 -1
  86. package/esm/components/use-tabs/context.d.ts +1 -1
  87. package/esm/components/use-tabs/context.d.ts.map +1 -1
  88. package/esm/components/use-tabs/use-tabs.d.ts +1 -1
  89. package/esm/components/use-tree/use-tree.d.ts.map +1 -1
  90. package/esm/components/use-tree/use-tree.js +58 -13
  91. package/esm/components/use-tree/use-tree.type.d.ts +4 -0
  92. package/esm/components/use-tree/use-tree.type.d.ts.map +1 -1
  93. package/esm/components/use-treeselect/use-tiled.d.ts +1 -1
  94. package/esm/utils/dom/element.d.ts +1 -1
  95. package/esm/utils/dom/element.d.ts.map +1 -1
  96. package/esm/utils/dom/element.js +4 -2
  97. package/esm/utils/lazyload.d.ts.map +1 -1
  98. package/esm/utils/lazyload.js +3 -3
  99. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { TabsProviderProps, TabsContextProps } from './context.type';
3
3
  export declare const TabsContext: React.Context<TabsContextProps<any>>;
4
- export declare const Provider: <TabData>(props: TabsProviderProps<TabData>) => JSX.Element;
4
+ export declare const Provider: <TabData>(props: TabsProviderProps<TabData>) => import("react/jsx-runtime").JSX.Element;
5
5
  export declare const useTabsContext: <TabData>() => TabsContextProps<TabData>;
6
6
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAErE,eAAO,MAAM,WAAW,sCAA8E,CAAC;AAEvG,eAAO,MAAM,QAAQ,6DAGpB,CAAC;AAEF,eAAO,MAAM,cAAc,0CAA8E,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAErE,eAAO,MAAM,WAAW,sCAA8E,CAAC;AAEvG,eAAO,MAAM,QAAQ,yFAGpB,CAAC;AAEF,eAAO,MAAM,cAAc,0CAA8E,CAAC"}
@@ -5,7 +5,7 @@ declare const useTabs: <TabData = any>(props: BaseTabsProps) => {
5
5
  onChange: (key: string | number) => void;
6
6
  tabs: TabData[];
7
7
  setTabs: import("react").Dispatch<import("react").SetStateAction<TabData[]>>;
8
- Provider: <TabData_1>(props: import("./context.type").TabsProviderProps<TabData_1>) => JSX.Element;
8
+ Provider: <TabData_1>(props: import("./context.type").TabsProviderProps<TabData_1>) => import("react/jsx-runtime").JSX.Element;
9
9
  };
10
10
  export default useTabs;
11
11
  //# sourceMappingURL=use-tabs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAGV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAmBjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;CA8nBZ,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,EAGV,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;;;;;CAurBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -26,7 +26,6 @@ function toArray(value) {
26
26
  if (!Array.isArray(value)) return [value];
27
27
  return value;
28
28
  }
29
- var global_tree_map = new Map();
30
29
  export var MODE = {
31
30
  /**
32
31
  * 返回全选数据,包含父节点和子节点
@@ -311,6 +310,34 @@ var useTree = function useTree(props) {
311
310
  }
312
311
  return ids;
313
312
  };
313
+ var initFlatData = function initFlatData(data, path) {
314
+ var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
315
+ var pid = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
316
+ var result = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
317
+ for (var i = 0; i < data.length; i++) {
318
+ var item = data[i];
319
+ var id = getKey(item, path[path.length - 1], i);
320
+ var node = {
321
+ id: id,
322
+ level: level,
323
+ data: item,
324
+ pid: pid
325
+ };
326
+ if (defaultExpandAll) {
327
+ result.push(node);
328
+ } else {
329
+ if (level === 1) {
330
+ result.push(node);
331
+ } else if (expanded && pid !== null && expanded.indexOf(pid) >= 0) {
332
+ result.push(node);
333
+ }
334
+ }
335
+ if (Array.isArray(item[childrenKey])) {
336
+ initFlatData(item[childrenKey], [].concat(_toConsumableArray(path), [id]), level + 1, id, result);
337
+ }
338
+ }
339
+ return result;
340
+ };
314
341
  var initValue = function initValue(ids_outer, forceCheck) {
315
342
  var ids = ids_outer;
316
343
  if (!context.data || !context.value) {
@@ -401,15 +428,6 @@ var useTree = function useTree(props) {
401
428
  return 2;
402
429
  };
403
430
  var setData = function setData(data) {
404
- // if(data && global_tree_map.get(data)){
405
- // context.cachedValue = global_tree_map.get(data)?.cachedValue || []
406
- // context.pathMap = global_tree_map.get(data)?.pathMap || new Map()
407
- // context.dataMap = global_tree_map.get(data)?.dataMap || new Map()
408
- // context.valueMap = global_tree_map.get(data)?.valueMap || new Map()
409
- // context.unmatchedValueMap = global_tree_map.get(data)?.unmatchedValueMap || new Map()
410
- // return
411
- // }
412
-
413
431
  var prevValue = context.value || [];
414
432
  context.cachedValue = [];
415
433
  context.pathMap = new Map();
@@ -430,8 +448,6 @@ var useTree = function useTree(props) {
430
448
  }
431
449
  initValue();
432
450
  setValue(prevValue);
433
-
434
- // global_tree_map.set(data, context)
435
451
  };
436
452
  var set = function set(id, checked, direction) {
437
453
  if (!isDisabled(id)) {
@@ -473,6 +489,28 @@ var useTree = function useTree(props) {
473
489
  }
474
490
  return current;
475
491
  };
492
+ var updateInnerCheckStatus = function updateInnerCheckStatus() {
493
+ var _context$value;
494
+ if (mode !== MODE.MODE_0) return;
495
+ (_context$value = context.value) === null || _context$value === void 0 || _context$value.forEach(function (id) {
496
+ var _ref3 = context.pathMap.get(id),
497
+ children = _ref3.children;
498
+ if (children.length) {
499
+ var noCheckedChildren = children.filter(function (cid) {
500
+ var _context$value2;
501
+ return !((_context$value2 = context.value) !== null && _context$value2 !== void 0 && _context$value2.includes(cid));
502
+ });
503
+ if (noCheckedChildren.length > 0) {
504
+ setTimeout(function () {
505
+ setValueMap(id, 2);
506
+ noCheckedChildren.forEach(function (cid) {
507
+ setValueMap(cid, 0);
508
+ });
509
+ }, 0);
510
+ }
511
+ }
512
+ });
513
+ };
476
514
  var appendChildrenExpanded = function appendChildrenExpanded(child, level, pid, insertData) {
477
515
  if (!child) return;
478
516
  child.forEach(function (item, i) {
@@ -558,7 +596,7 @@ var useTree = function useTree(props) {
558
596
  expanded: true
559
597
  }));
560
598
  });
561
- var _getExpandVirtualData = getExpandVirtualData(context.data, expanded, getKey, childrenKey),
599
+ var _getExpandVirtualData = getExpandVirtualData(props.tiledData || context.data, expanded, getKey, childrenKey),
562
600
  treeDataInfo = _getExpandVirtualData.treeDataInfo;
563
601
  if (!treeDataInfo) {
564
602
  return;
@@ -583,11 +621,18 @@ var useTree = function useTree(props) {
583
621
  if (props.datum) return;
584
622
  if (!dataUpdate) return;
585
623
  setData(data);
624
+ updateInnerCheckStatus();
586
625
  }, [data]);
587
626
  useEffect(function () {
588
627
  if (props.datum) return;
589
628
  setValue(value);
590
629
  }, [value]);
630
+ useEffect(function () {
631
+ if (!virtual) return;
632
+ if (!props.tiledData) return;
633
+ var tiledFlatData = initFlatData(props.tiledData, [], 1);
634
+ setDataFlat(tiledFlatData);
635
+ }, [props.tiledData]);
591
636
  useEffect(function () {
592
637
  setInited(true);
593
638
  }, []);
@@ -43,6 +43,10 @@ export interface BaseTreeProps<DataItem> {
43
43
  * @private 内部属性
44
44
  */
45
45
  isControlled: boolean;
46
+ /**
47
+ * @private 内部属性
48
+ */
49
+ tiledData?: DataItem[];
46
50
  active?: KeygenResult;
47
51
  /**
48
52
  * @en Selected key (controlled)
@@ -1 +1 @@
1
- {"version":3,"file":"use-tree.type.d.ts","sourceRoot":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AI,CAAC;IACzC,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC;IACpC,SAAS,EAAE,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnC,OAAO,EAAE,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACzC,OAAO,EAAE,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IACrC,QAAQ,EAAE,GAAG,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;IAC/C,iBAAiB,EAAE,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;CACnD"}
@@ -7,7 +7,7 @@ declare const useTiled: <DataItem>(props: UseTiledProps<DataItem>) => {
7
7
  } | {
8
8
  data: any;
9
9
  onFilter: (text: string, from?: string) => void;
10
- expandIcons: ((item: DataItem) => string | number | boolean | import("react").ReactFragment | JSX.Element | null | undefined)[];
10
+ expandIcons: ((item: DataItem) => string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined)[];
11
11
  };
12
12
  export default useTiled;
13
13
  //# sourceMappingURL=use-tiled.d.ts.map
@@ -13,7 +13,7 @@ export declare const addResizeObserver: (el: HTMLElement, handler: any, options?
13
13
  }) => () => void;
14
14
  export declare function getParent(el: HTMLElement | null | Element, target?: string | HTMLElement): Element | null;
15
15
  export declare function getClosestScrollContainer(element: HTMLElement | null): HTMLElement | null;
16
- export declare function getClosestFixedContainer(element: Element | HTMLElement | null): HTMLElement | null;
16
+ export declare function getClosestPositionedContainer(element: Element | HTMLElement | null, positions?: React.CSSProperties['position'][]): HTMLElement | null;
17
17
  export declare function cssSupport(attr: keyof CSSStyleDeclaration, value: string): boolean;
18
18
  export declare const parsePxToNumber: (str: string) => number;
19
19
  export declare const getFieldId: (name?: string, formName?: string) => string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,WAAW,UAAQ,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,KAAK,CAAC,SAAS,CASjB;AAGD,eAAO,MAAM,iBAAiB,OACxB,WAAW,WACN,GAAG;;;gBA4Cb,CAAC;AAEF,wBAAgB,SAAS,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,kBAmBxF;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CAmCzF;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,sBAqB7E;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,mBAAmB,EAAE,KAAK,EAAE,MAAM,WAYxE;AAED,eAAO,MAAM,eAAe,QAAS,MAAM,WAAwC,CAAC;AAEpF,eAAO,MAAM,UAAU,UAAW,MAAM,aAAa,MAAM,uBAG1D,CAAC"}
1
+ {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,WAAW,UAAQ,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,KAAK,CAAC,SAAS,CASjB;AAGD,eAAO,MAAM,iBAAiB,OACxB,WAAW,WACN,GAAG;;;gBA4Cb,CAAC;AAEF,wBAAgB,SAAS,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,kBAmBxF;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CAmCzF;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,EACrC,SAAS,GAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,EAA0B,sBAuBrE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,mBAAmB,EAAE,KAAK,EAAE,MAAM,WAYxE;AAED,eAAO,MAAM,eAAe,QAAS,MAAM,WAAwC,CAAC;AAEpF,eAAO,MAAM,UAAU,UAAW,MAAM,aAAa,MAAM,uBAG1D,CAAC"}
@@ -145,13 +145,15 @@ export function getClosestScrollContainer(element) {
145
145
  // 如果没有找到可滚动的祖先,返回 body 或 documentElement
146
146
  return document.scrollingElement || document.documentElement;
147
147
  }
148
- export function getClosestFixedContainer(element) {
148
+ export function getClosestPositionedContainer(element) {
149
+ var positions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['fixed', 'absolute'];
149
150
  if (!element) {
150
151
  return null;
151
152
  }
152
153
  var isFixable = function isFixable(el) {
153
154
  var style = window.getComputedStyle(el);
154
- return style.position === 'fixed';
155
+ var position = style.position;
156
+ return positions.includes(position);
155
157
  };
156
158
 
157
159
  // 遍历父元素
@@ -1 +1 @@
1
- {"version":3,"file":"lazyload.d.ts","sourceRoot":"","sources":["lazyload.ts"],"names":[],"mappings":"AAKA,KAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC;AAsBF,wBAAgB,QAAQ,SAgBvB;AAWD,wBAAgB,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,QAUvE;AAyBD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,iBA4BvC"}
1
+ {"version":3,"file":"lazyload.d.ts","sourceRoot":"","sources":["lazyload.ts"],"names":[],"mappings":"AAKA,KAAK,UAAU,GAAG;IAChB,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC,CAAC;AAsBF,wBAAgB,QAAQ,SAgBvB;AAWD,wBAAgB,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,QAUvE;AA0BD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,iBA4BvC"}
@@ -1,5 +1,5 @@
1
1
  import { generateUUID, docSize, devUseWarning } from "../utils";
2
- import { getClosestFixedContainer } from "./dom/element";
2
+ import { getClosestPositionedContainer } from "./dom/element";
3
3
  var throttle = 80;
4
4
  var components = {};
5
5
  var timeout = null;
@@ -11,7 +11,6 @@ var getRect = function getRect(el) {
11
11
  if (el) {
12
12
  devUseWarning.error("the ".concat(el, " is not a element"));
13
13
  }
14
- ;
15
14
  return {
16
15
  top: 0,
17
16
  bottom: winHeight
@@ -67,13 +66,14 @@ function getObserver(obj, id) {
67
66
  render = obj.render,
68
67
  offscreen = obj.offscreen,
69
68
  noRemove = obj.noRemove;
70
- var fixedContainer = getClosestFixedContainer(element);
69
+ var fixedContainer = getClosestPositionedContainer(element, ['fixed', 'absolute']);
71
70
  var observer = new IntersectionObserver(function (entries) {
72
71
  entries.forEach(function (en) {
73
72
  if (en.isIntersecting || en.intersectionRatio > 0) {
74
73
  render();
75
74
  if (!noRemove) removeStack(id);
76
75
  } else {
76
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
77
77
  offscreen && offscreen();
78
78
  }
79
79
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.6.0-beta.9",
3
+ "version": "3.6.0-fix.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",