@pega/lists-react 9.0.0-build.6.8 → 9.0.0-build.7.0

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 (77) hide show
  1. package/lib/Core/Components/AggregateMenu.d.ts +1 -0
  2. package/lib/Core/Components/AggregateMenu.d.ts.map +1 -1
  3. package/lib/Core/Components/AggregateMenu.js +26 -16
  4. package/lib/Core/Components/AggregateMenu.js.map +1 -1
  5. package/lib/Core/Components/ContextMenu/ContextMenuContainer.d.ts.map +1 -1
  6. package/lib/Core/Components/ContextMenu/ContextMenuContainer.js +4 -2
  7. package/lib/Core/Components/ContextMenu/ContextMenuContainer.js.map +1 -1
  8. package/lib/Core/Components/GroupRenderer.d.ts +16 -0
  9. package/lib/Core/Components/GroupRenderer.d.ts.map +1 -1
  10. package/lib/Core/Components/GroupRenderer.js +112 -4
  11. package/lib/Core/Components/GroupRenderer.js.map +1 -1
  12. package/lib/Core/Components/Grouping/GroupingMenu.js +1 -1
  13. package/lib/Core/Components/Grouping/GroupingMenu.js.map +1 -1
  14. package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.js +1 -1
  15. package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.js.map +1 -1
  16. package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.js +1 -1
  17. package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.js.map +1 -1
  18. package/lib/Core/Components/Toolbar/hooks/useSort/Row.js +1 -1
  19. package/lib/Core/Components/Toolbar/hooks/useSort/Row.js.map +1 -1
  20. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.d.ts +97 -0
  21. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.d.ts.map +1 -0
  22. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.js +249 -0
  23. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.js.map +1 -0
  24. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.d.ts +22 -0
  25. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.d.ts.map +1 -0
  26. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.js +38 -0
  27. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.js.map +1 -0
  28. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.d.ts +22 -0
  29. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.d.ts.map +1 -0
  30. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.js +45 -0
  31. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.js.map +1 -0
  32. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.d.ts +49 -0
  33. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.d.ts.map +1 -0
  34. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.js +55 -0
  35. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.js.map +1 -0
  36. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.d.ts +21 -0
  37. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.d.ts.map +1 -0
  38. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.js +39 -0
  39. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.js.map +1 -0
  40. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.d.ts +38 -0
  41. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.d.ts.map +1 -0
  42. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.js +62 -0
  43. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.js.map +1 -0
  44. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.d.ts +112 -0
  45. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.d.ts.map +1 -0
  46. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.js +213 -0
  47. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.js.map +1 -0
  48. package/lib/Core/Components/Virtualise/utility.d.ts +1 -1
  49. package/lib/Core/Components/Virtualise/utility.d.ts.map +1 -1
  50. package/lib/Core/Components/Virtualise/utility.js +3 -2
  51. package/lib/Core/Components/Virtualise/utility.js.map +1 -1
  52. package/lib/Core/Hooks/useDragDrop.d.ts.map +1 -1
  53. package/lib/Core/Hooks/useDragDrop.js +2 -0
  54. package/lib/Core/Hooks/useDragDrop.js.map +1 -1
  55. package/lib/Core/Localization/defaultTranslations.d.ts +1 -0
  56. package/lib/Core/Localization/defaultTranslations.d.ts.map +1 -1
  57. package/lib/Core/Localization/defaultTranslations.js +2 -1
  58. package/lib/Core/Localization/defaultTranslations.js.map +1 -1
  59. package/lib/Core/Views/Table/Row.d.ts +3 -1
  60. package/lib/Core/Views/Table/Row.d.ts.map +1 -1
  61. package/lib/Core/Views/Table/Row.js +5 -3
  62. package/lib/Core/Views/Table/Row.js.map +1 -1
  63. package/lib/Core/Views/Table/StyledTableContainer.d.ts.map +1 -1
  64. package/lib/Core/Views/Table/StyledTableContainer.js +4 -0
  65. package/lib/Core/Views/Table/StyledTableContainer.js.map +1 -1
  66. package/lib/Core/Views/Table/VirtualizeWrapper.d.ts +3 -1
  67. package/lib/Core/Views/Table/VirtualizeWrapper.d.ts.map +1 -1
  68. package/lib/Core/Views/Table/VirtualizeWrapper.js +18 -2
  69. package/lib/Core/Views/Table/VirtualizeWrapper.js.map +1 -1
  70. package/lib/Core/Views/Table/index.d.ts.map +1 -1
  71. package/lib/Core/Views/Table/index.js +2 -2
  72. package/lib/Core/Views/Table/index.js.map +1 -1
  73. package/lib/Core/Views/Table/useCountChange.d.ts +10 -0
  74. package/lib/Core/Views/Table/useCountChange.d.ts.map +1 -0
  75. package/lib/Core/Views/Table/useCountChange.js +39 -0
  76. package/lib/Core/Views/Table/useCountChange.js.map +1 -0
  77. package/package.json +8 -8
@@ -0,0 +1,38 @@
1
+ import { useEffect } from 'react';
2
+ import { getDataIndex } from './utils';
3
+ /**
4
+ * Observes the height of child elements within a container and triggers a callback when any child's height changes.
5
+ *
6
+ * NOTE: Ensure that each child element has correct data attribute 'data-index'.
7
+ */
8
+ export default function useChildrenHeightResizeObserver({ childrenContainerRef, children, itemsHeight, defaultItemHeight, onItemsHeightUpdate }) {
9
+ useEffect(() => {
10
+ if (!childrenContainerRef.current)
11
+ return;
12
+ const items = childrenContainerRef.current.children;
13
+ if (!items?.length)
14
+ return;
15
+ const resizeObserver = new ResizeObserver((entries) => {
16
+ let anyChildHeightChanged = false;
17
+ for (const entry of entries) {
18
+ const itemDataIndex = getDataIndex(entry.target);
19
+ if (itemDataIndex !== null) {
20
+ const newHeight = entry.contentRect.height;
21
+ if (itemsHeight[itemDataIndex] !== newHeight) {
22
+ anyChildHeightChanged = true;
23
+ }
24
+ }
25
+ }
26
+ if (anyChildHeightChanged) {
27
+ onItemsHeightUpdate();
28
+ }
29
+ });
30
+ Array.from(items).forEach((item) => {
31
+ resizeObserver.observe(item);
32
+ });
33
+ return () => {
34
+ resizeObserver.disconnect();
35
+ };
36
+ }, [children, itemsHeight, defaultItemHeight]);
37
+ }
38
+ //# sourceMappingURL=useChildrenHeightResizeObserver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChildrenHeightResizeObserver.js","sourceRoot":"","sources":["../../../../../Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAgBvC;;;;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actNode, RefObject } from 'react';\n\nimport { getDataIndex } from './utils';\nimport type { ItemsHeight } from './VariableHeightVirtualizer';\n\ninterface ChildrenHeightResizeObserverProps {\n /** A ref to the container DOM element whose children will be observed. */\n childrenContainerRef: RefObject<HTMLElement>;\n /** The React children elements rendered inside the container. */\n children: ReactNode;\n /** Mapping of item indices and their actual height. */\n itemsHeight: ItemsHeight;\n /** The default height to use for items if not measured. */\n defaultItemHeight: number;\n /** Callback function invoked when any child's height changes. */\n onItemsHeightUpdate: () => void;\n}\n\n/**\n * Observes the height of child elements within a container and triggers a callback when any child's height changes.\n *\n * NOTE: Ensure that each child element has correct data attribute 'data-index'.\n */\nexport default function useChildrenHeightResizeObserver({\n childrenContainerRef,\n children,\n itemsHeight,\n defaultItemHeight,\n onItemsHeightUpdate\n}: ChildrenHeightResizeObserverProps): void {\n useEffect(() => {\n if (!childrenContainerRef.current) return;\n\n const items = childrenContainerRef.current.children;\n if (!items?.length) return;\n\n const resizeObserver = new ResizeObserver((entries: ResizeObserverEntry[]) => {\n let anyChildHeightChanged = false;\n\n for (const entry of entries) {\n const itemDataIndex = getDataIndex(entry.target);\n if (itemDataIndex !== null) {\n const newHeight = entry.contentRect.height;\n if (itemsHeight[itemDataIndex] !== newHeight) {\n anyChildHeightChanged = true;\n }\n }\n }\n\n if (anyChildHeightChanged) {\n onItemsHeightUpdate();\n }\n });\n\n Array.from(items).forEach((item: Element) => {\n resizeObserver.observe(item);\n });\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [children, itemsHeight, defaultItemHeight]);\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import type { RefObject, ReactNode } from 'react';
2
+ import type { ItemsHeight } from './VariableHeightVirtualizer';
3
+ interface LoaderPositioningProps {
4
+ /** Ref to the parent scrollable container element. */
5
+ parentContainerRef: RefObject<HTMLElement>;
6
+ /** Ref to the container holding the rendered items. */
7
+ itemContainerRef: RefObject<HTMLElement>;
8
+ /** Indicates if data is currently being fetched. */
9
+ isDataFetching: boolean;
10
+ /** The React children elements rendered inside the container. */
11
+ children: ReactNode;
12
+ /** Mapping of item indices and their actual height. */
13
+ itemsHeight: ItemsHeight;
14
+ /** The default height to use for items if not measured. */
15
+ defaultItemHeight: number;
16
+ }
17
+ /**
18
+ * Calculates the positioning of loading indicators.
19
+ */
20
+ export default function useLoaderPositioning({ parentContainerRef, itemContainerRef, isDataFetching, children, itemsHeight, defaultItemHeight }: LoaderPositioningProps): void;
21
+ export {};
22
+ //# sourceMappingURL=useLoaderPositioning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLoaderPositioning.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D,UAAU,sBAAsB;IAC9B,sDAAsD;IACtD,kBAAkB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,uDAAuD;IACvD,gBAAgB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACzC,oDAAoD;IACpD,cAAc,EAAE,OAAO,CAAC;IACxB,iEAAiE;IACjE,QAAQ,EAAE,SAAS,CAAC;IACpB,uDAAuD;IACvD,WAAW,EAAE,WAAW,CAAC;IACzB,2DAA2D;IAC3D,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,WAAW,EACX,iBAAiB,EAClB,EAAE,sBAAsB,QA2CxB"}
@@ -0,0 +1,45 @@
1
+ import { useEffect, useLayoutEffect, useState } from 'react';
2
+ import useThrottle from '../../../Hooks/useThrottle';
3
+ import { getDataIndex } from './utils';
4
+ /**
5
+ * Calculates the positioning of loading indicators.
6
+ */
7
+ export default function useLoaderPositioning({ parentContainerRef, itemContainerRef, isDataFetching, children, itemsHeight, defaultItemHeight }) {
8
+ const [scrollLeft, setScrollLeft] = useState(0);
9
+ useLayoutEffect(() => {
10
+ if (!isDataFetching || !itemContainerRef.current || !parentContainerRef.current)
11
+ return;
12
+ const containerEl = parentContainerRef.current;
13
+ const items = itemContainerRef.current.children;
14
+ if (!items?.length)
15
+ return;
16
+ const topLoaderHeight = 80;
17
+ const topOffset = itemContainerRef.current.offsetTop || 0;
18
+ const firstItemDataIndex = getDataIndex(items[0]);
19
+ if (firstItemDataIndex === null)
20
+ return;
21
+ let itemContainerBottomPosition = topOffset;
22
+ for (let i = 0; i < items.length; i += 1) {
23
+ itemContainerBottomPosition += itemsHeight[firstItemDataIndex + i] ?? defaultItemHeight;
24
+ }
25
+ containerEl.style.setProperty('--above-loader-top', `${topOffset - topLoaderHeight}px`);
26
+ containerEl.style.setProperty('--below-loader-top', `${itemContainerBottomPosition}px`);
27
+ }, [isDataFetching, children, itemsHeight, defaultItemHeight, getDataIndex]);
28
+ useThrottle(scrollLeft, () => {
29
+ const containerEl = parentContainerRef.current;
30
+ if (!containerEl)
31
+ return;
32
+ containerEl.style.setProperty('--loader-left', `${containerEl.scrollLeft}px`);
33
+ });
34
+ useEffect(() => {
35
+ const containerEl = parentContainerRef.current;
36
+ if (!containerEl)
37
+ return;
38
+ const scrollHandler = () => setScrollLeft(containerEl.scrollLeft);
39
+ containerEl.addEventListener('scroll', scrollHandler, { passive: true });
40
+ return () => {
41
+ containerEl.removeEventListener('scroll', scrollHandler);
42
+ };
43
+ }, [parentContainerRef]);
44
+ }
45
+ //# sourceMappingURL=useLoaderPositioning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLoaderPositioning.js","sourceRoot":"","sources":["../../../../../Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,E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AW,CAAC,oBAAoB,EAAE,GAAG,2BAA2B,IAAI,CAAC,CAAC;IAC1F,CAAC,EAAE,CAAC,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAC,CAAC;IAE7E,WAAW,CAAC,UAAU,EAAE,GAAG,EAAE;QAC3B,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,CAAC;QAC/C,IAAI,CAAC,WAAW;YAAE,OAAO;QAEzB,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,EAAE,GAAG,WAAW,CAAC,UAAU,IAAI,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,CAAC;QAC/C,IAAI,CAAC,WAAW;YAAE,OAAO;QAEzB,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAClE,WAAW,CAAC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAEzE,OAAO,GAAG,EAAE;YACV,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC3D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import { useEffect, useLayoutEffect, useState } from 'react';\nimport type { RefObject, ReactNode } from 'react';\n\nimport useThrottle from '../../../Hooks/useThrottle';\n\nimport { getDataIndex } from './utils';\nimport type { ItemsHeight } from './VariableHeightVirtualizer';\n\ninterface LoaderPositioningProps {\n /** Ref to the parent scrollable container element. */\n parentContainerRef: RefObject<HTMLElement>;\n /** Ref to the container holding the rendered items. */\n itemContainerRef: RefObject<HTMLElement>;\n /** Indicates if data is currently being fetched. */\n isDataFetching: boolean;\n /** The React children elements rendered inside the container. */\n children: ReactNode;\n /** Mapping of item indices and their actual height. */\n itemsHeight: ItemsHeight;\n /** The default height to use for items if not measured. */\n defaultItemHeight: number;\n}\n\n/**\n * Calculates the positioning of loading indicators.\n */\nexport default function useLoaderPositioning({\n parentContainerRef,\n itemContainerRef,\n isDataFetching,\n children,\n itemsHeight,\n defaultItemHeight\n}: LoaderPositioningProps) {\n const [scrollLeft, setScrollLeft] = useState(0);\n\n useLayoutEffect(() => {\n if (!isDataFetching || !itemContainerRef.current || !parentContainerRef.current) return;\n\n const containerEl = parentContainerRef.current;\n const items = itemContainerRef.current.children;\n if (!items?.length) return;\n\n const topLoaderHeight = 80;\n const topOffset = itemContainerRef.current.offsetTop || 0;\n\n const firstItemDataIndex = getDataIndex(items[0]);\n if (firstItemDataIndex === null) return;\n\n let itemContainerBottomPosition = topOffset;\n for (let i = 0; i < items.length; i += 1) {\n itemContainerBottomPosition += itemsHeight[firstItemDataIndex + i] ?? defaultItemHeight;\n }\n\n containerEl.style.setProperty('--above-loader-top', `${topOffset - topLoaderHeight}px`);\n containerEl.style.setProperty('--below-loader-top', `${itemContainerBottomPosition}px`);\n }, [isDataFetching, children, itemsHeight, defaultItemHeight, getDataIndex]);\n\n useThrottle(scrollLeft, () => {\n const containerEl = parentContainerRef.current;\n if (!containerEl) return;\n\n containerEl.style.setProperty('--loader-left', `${containerEl.scrollLeft}px`);\n });\n\n useEffect(() => {\n const containerEl = parentContainerRef.current;\n if (!containerEl) return;\n\n const scrollHandler = () => setScrollLeft(containerEl.scrollLeft);\n containerEl.addEventListener('scroll', scrollHandler, { passive: true });\n\n return () => {\n containerEl.removeEventListener('scroll', scrollHandler);\n };\n }, [parentContainerRef]);\n}\n"]}
@@ -0,0 +1,49 @@
1
+ import type { MutableRefObject, RefObject } from 'react';
2
+ import type { ItemsHeight, VariableHeightVirtualizerProps } from './VariableHeightVirtualizer';
3
+ interface PaginationParams {
4
+ /** Callback to fetch paginated data. */
5
+ apiCallback: VariableHeightVirtualizerProps['apiCallback'];
6
+ /** Unique identifier for the virtualizer instance. */
7
+ id: string;
8
+ /** Number of items to buffer before/after the visible range. */
9
+ buffer: number;
10
+ /** Maximum number of items to render at once. */
11
+ maxItemsToPaint: number;
12
+ /** Current start index of the visible items. */
13
+ startIndex: number;
14
+ /** Current end index of the visible items. */
15
+ endIndex: number;
16
+ /** Total number of items in the virtualized list. */
17
+ virtualizedCount: number;
18
+ /** Whether infinite scrolling mode is enabled. */
19
+ isInfiniteMode: boolean;
20
+ /** Mapping of item indices and their actual height. */
21
+ itemsHeight: ItemsHeight;
22
+ /** Default height for items if not measured. */
23
+ defaultItemHeight: number;
24
+ /** Ref to the parent scrollable container element. */
25
+ parentContainerRef: RefObject<HTMLElement>;
26
+ /** Ref to the container holding the rendered items. */
27
+ itemContainerRef: RefObject<HTMLElement>;
28
+ /** Setter for the start index. */
29
+ setStartIndex: (v: number) => void;
30
+ /** Setter for the end index. */
31
+ setEndIndex: (v: number) => void;
32
+ /** Ref to track the previous first item's data index. */
33
+ previousFirstItemDataIndexRef: MutableRefObject<number | null>;
34
+ }
35
+ /**
36
+ * Calculates the indices of items to render based on the current scroll position,
37
+ * buffer, and virtualization settings. It triggers data fetching via the provided `apiCallback`
38
+ * when pagination boundaries change or a force refresh is requested.
39
+ *
40
+ * @returns An object containing:
41
+ * - `triggerPagination`: Function to recalculate pagination indices and trigger data fetching.
42
+ * - `isForceRefreshedPagination`: Boolean indicating if the last pagination was force-refreshed.
43
+ */
44
+ export default function usePagination({ apiCallback, id, buffer, maxItemsToPaint, startIndex, endIndex, virtualizedCount, isInfiniteMode, itemsHeight, defaultItemHeight, parentContainerRef, itemContainerRef, setStartIndex, setEndIndex, previousFirstItemDataIndexRef }: PaginationParams): {
45
+ triggerPagination: (currentScrollTop: number, forceRefresh?: boolean) => void;
46
+ isForceRefreshedPagination: boolean;
47
+ };
48
+ export {};
49
+ //# sourceMappingURL=usePagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePagination.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAG/F,UAAU,gBAAgB;IACxB,wCAAwC;IACxC,WAAW,EAAE,8BAA8B,CAAC,aAAa,CAAC,CAAC;IAC3D,sDAAsD;IACtD,EAAE,EAAE,MAAM,CAAC;IACX,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,gBAAgB,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,cAAc,EAAE,OAAO,CAAC;IACxB,uDAAuD;IACvD,WAAW,EAAE,WAAW,CAAC;IACzB,gDAAgD;IAChD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sDAAsD;IACtD,kBAAkB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,uDAAuD;IACvD,gBAAgB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACzC,kCAAkC;IAClC,aAAa,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gCAAgC;IAChC,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,yDAAyD;IACzD,6BAA6B,EAAE,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAChE;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,WAAW,EACX,EAAE,EACF,MAAM,EACN,eAAe,EACf,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,6BAA6B,EAC9B,EAAE,gBAAgB;0CAII,MAAM,iBAAiB,OAAO;;EAgDpD"}
@@ -0,0 +1,55 @@
1
+ import { useCallback, useState } from 'react';
2
+ import { getDataIndex, getVirtualizedPaginationIndices } from './utils';
3
+ /**
4
+ * Calculates the indices of items to render based on the current scroll position,
5
+ * buffer, and virtualization settings. It triggers data fetching via the provided `apiCallback`
6
+ * when pagination boundaries change or a force refresh is requested.
7
+ *
8
+ * @returns An object containing:
9
+ * - `triggerPagination`: Function to recalculate pagination indices and trigger data fetching.
10
+ * - `isForceRefreshedPagination`: Boolean indicating if the last pagination was force-refreshed.
11
+ */
12
+ export default function usePagination({ apiCallback, id, buffer, maxItemsToPaint, startIndex, endIndex, virtualizedCount, isInfiniteMode, itemsHeight, defaultItemHeight, parentContainerRef, itemContainerRef, setStartIndex, setEndIndex, previousFirstItemDataIndexRef }) {
13
+ const [isForceRefreshedPagination, setIsForceRefreshedPagination] = useState(false);
14
+ const triggerPagination = useCallback((currentScrollTop, forceRefresh) => {
15
+ setIsForceRefreshedPagination(!!forceRefresh);
16
+ const { startIndex: newStartIndex, endIndex: newEndIndex } = getVirtualizedPaginationIndices({
17
+ scrollTop: currentScrollTop,
18
+ containerRef: parentContainerRef,
19
+ itemContainerRef,
20
+ totalItemCount: virtualizedCount,
21
+ itemsHeight,
22
+ defaultItemHeight,
23
+ buffer,
24
+ endIndexLimit: maxItemsToPaint,
25
+ isInfiniteMode
26
+ });
27
+ // Prevent redundant fetch
28
+ if (!forceRefresh && endIndex > 0 && newStartIndex >= startIndex && newEndIndex <= endIndex) {
29
+ return;
30
+ }
31
+ if (virtualizedCount === 0) {
32
+ previousFirstItemDataIndexRef.current = 0;
33
+ }
34
+ else if (itemContainerRef.current?.children[0]) {
35
+ const firstItemDataIndex = getDataIndex(itemContainerRef.current.children[0]);
36
+ previousFirstItemDataIndexRef.current = firstItemDataIndex ?? 0;
37
+ }
38
+ setStartIndex(newStartIndex);
39
+ setEndIndex(newEndIndex);
40
+ apiCallback({ startIndex: newStartIndex, endIndex: newEndIndex, id }, { takeLatestAction: true });
41
+ }, [
42
+ virtualizedCount,
43
+ isInfiniteMode,
44
+ buffer,
45
+ maxItemsToPaint,
46
+ startIndex,
47
+ endIndex,
48
+ apiCallback,
49
+ id,
50
+ itemsHeight,
51
+ defaultItemHeight
52
+ ]);
53
+ return { triggerPagination, isForceRefreshedPagination };
54
+ }
55
+ //# sourceMappingURL=usePagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePagination.js","sourceRoot":"","sources":["../../../../../Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI9C,OAAO,EAAE,YAAY,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAmCxE;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,WAAW,EACX,EAAE,EACF,MAAM,EACN,eAAe,EACf,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,6BAA6B,EACZ;IACjB,MAAM,CAAC,0BAA0B,EAAE,6BAA6B,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE7F,MAAM,iBAAiB,GAAG,WAAW,CACnC,CAAC,gBAAwB,EAAE,YAAsB,EAAE,EAAE;QACnD,6BAA6B,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;QAC9C,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,+BAA+B,CAAC;YAC3F,SAAS,EAAE,gBAAgB;YAC3B,YAAY,EAAE,kBAAkB;YAChC,gBAAgB;YAChB,cAAc,EAAE,gBAAgB;YAChC,WAAW;YACX,iBAAiB;YACjB,MAAM;YACN,aAAa,EAAE,eAAe;YAC9B,cAAc;SACf,CAAC,CAAC;QAEH,0BAA0B;QAC1B,IAAI,CAAC,YAAY,IAAI,QAAQ,GAAG,CAAC,IAAI,aAAa,IAAI,UAAU,IAAI,WAAW,IAAI,QAAQ,EAAE,CAAC;YAC5F,OAAO;QACT,CAAC;QAED,IAAI,gBAAgB,KAAK,CAAC,EAAE,CAAC;YAC3B,6BAA6B,CAAC,OAAO,GAAG,CAAC,CAAC;QAC5C,CAAC;aAAM,IAAI,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;YACjD,MAAM,kBAAkB,GAAG,YAAY,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9E,6BAA6B,CAAC,OAAO,GAAG,kBAAkB,IAAI,CAAC,CAAC;QAClE,CAAC;QAED,aAAa,CAAC,aAAa,CAAC,CAAC;QAC7B,WAAW,CAAC,WAAW,CAAC,CAAC;QACzB,WAAW,CACT,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,EACxD,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAC3B,CAAC;IACJ,CAAC,EACD;QACE,gBAAgB;QAChB,cAAc;QACd,MAAM;QACN,eAAe;QACf,UAAU;QACV,QAAQ;QACR,WAAW;QACX,EAAE;QACF,WAAW;QACX,iBAAiB;KAClB,CACF,CAAC;IAEF,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,CAAC;AAC3D,CAAC","sourcesContent":["import { useCallback, useState } from 'react';\nimport type { MutableRefObject, RefObject } from 'react';\n\nimport type { ItemsHeight, VariableHeightVirtualizerProps } from './VariableHeightVirtualizer';\nimport { getDataIndex, getVirtualizedPaginationIndices } from './utils';\n\ninterface PaginationParams {\n /** Callback to fetch paginated data. */\n apiCallback: VariableHeightVirtualizerProps['apiCallback'];\n /** Unique identifier for the virtualizer instance. */\n id: string;\n /** Number of items to buffer before/after the visible range. */\n buffer: number;\n /** Maximum number of items to render at once. */\n maxItemsToPaint: number;\n /** Current start index of the visible items. */\n startIndex: number;\n /** Current end index of the visible items. */\n endIndex: number;\n /** Total number of items in the virtualized list. */\n virtualizedCount: number;\n /** Whether infinite scrolling mode is enabled. */\n isInfiniteMode: boolean;\n /** Mapping of item indices and their actual height. */\n itemsHeight: ItemsHeight;\n /** Default height for items if not measured. */\n defaultItemHeight: number;\n /** Ref to the parent scrollable container element. */\n parentContainerRef: RefObject<HTMLElement>;\n /** Ref to the container holding the rendered items. */\n itemContainerRef: RefObject<HTMLElement>;\n /** Setter for the start index. */\n setStartIndex: (v: number) => void;\n /** Setter for the end index. */\n setEndIndex: (v: number) => void;\n /** Ref to track the previous first item's data index. */\n previousFirstItemDataIndexRef: MutableRefObject<number | null>;\n}\n\n/**\n * Calculates the indices of items to render based on the current scroll position,\n * buffer, and virtualization settings. It triggers data fetching via the provided `apiCallback`\n * when pagination boundaries change or a force refresh is requested.\n *\n * @returns An object containing:\n * - `triggerPagination`: Function to recalculate pagination indices and trigger data fetching.\n * - `isForceRefreshedPagination`: Boolean indicating if the last pagination was force-refreshed.\n */\nexport default function usePagination({\n apiCallback,\n id,\n buffer,\n maxItemsToPaint,\n startIndex,\n endIndex,\n virtualizedCount,\n isInfiniteMode,\n itemsHeight,\n defaultItemHeight,\n parentContainerRef,\n itemContainerRef,\n setStartIndex,\n setEndIndex,\n previousFirstItemDataIndexRef\n}: PaginationParams) {\n const [isForceRefreshedPagination, setIsForceRefreshedPagination] = useState<boolean>(false);\n\n const triggerPagination = useCallback(\n (currentScrollTop: number, forceRefresh?: boolean) => {\n setIsForceRefreshedPagination(!!forceRefresh);\n const { startIndex: newStartIndex, endIndex: newEndIndex } = getVirtualizedPaginationIndices({\n scrollTop: currentScrollTop,\n containerRef: parentContainerRef,\n itemContainerRef,\n totalItemCount: virtualizedCount,\n itemsHeight,\n defaultItemHeight,\n buffer,\n endIndexLimit: maxItemsToPaint,\n isInfiniteMode\n });\n\n // Prevent redundant fetch\n if (!forceRefresh && endIndex > 0 && newStartIndex >= startIndex && newEndIndex <= endIndex) {\n return;\n }\n\n if (virtualizedCount === 0) {\n previousFirstItemDataIndexRef.current = 0;\n } else if (itemContainerRef.current?.children[0]) {\n const firstItemDataIndex = getDataIndex(itemContainerRef.current.children[0]);\n previousFirstItemDataIndexRef.current = firstItemDataIndex ?? 0;\n }\n\n setStartIndex(newStartIndex);\n setEndIndex(newEndIndex);\n apiCallback(\n { startIndex: newStartIndex, endIndex: newEndIndex, id },\n { takeLatestAction: true }\n );\n },\n [\n virtualizedCount,\n isInfiniteMode,\n buffer,\n maxItemsToPaint,\n startIndex,\n endIndex,\n apiCallback,\n id,\n itemsHeight,\n defaultItemHeight\n ]\n );\n\n return { triggerPagination, isForceRefreshedPagination };\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import type { RefObject } from 'react';
2
+ interface ScrollProps {
3
+ /** Ref to the parent scrollable container element. */
4
+ parentContainerRef: RefObject<HTMLElement>;
5
+ /** Ref to the container holding the rendered elements. */
6
+ itemContainerRef: RefObject<HTMLElement>;
7
+ /**
8
+ * Callback invoked when the scroll position is near the top or bottom threshold.
9
+ * @param scrollTop - The current scrollTop value of the parent container.
10
+ */
11
+ onThresholdBreach: (scrollTop: number) => void;
12
+ /** Optional throttle delay for scroll events (default: 150ms). */
13
+ delay?: number;
14
+ }
15
+ /**
16
+ * Hook to monitor scroll events on a parent container and trigger a callback
17
+ * when the scroll position approaches the top or bottom threshold of the child elements.
18
+ */
19
+ export default function useScroll({ parentContainerRef, itemContainerRef, onThresholdBreach, delay }: ScrollProps): void;
20
+ export {};
21
+ //# sourceMappingURL=useScroll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScroll.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,UAAU,WAAW;IACnB,sDAAsD;IACtD,kBAAkB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,0DAA0D;IAC1D,gBAAgB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACzC;;;OAGG;IACH,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,KAAW,EACZ,EAAE,WAAW,QAyCb"}
@@ -0,0 +1,39 @@
1
+ import { useEffect, useState } from 'react';
2
+ import useThrottle from '../../../Hooks/useThrottle';
3
+ /**
4
+ * Hook to monitor scroll events on a parent container and trigger a callback
5
+ * when the scroll position approaches the top or bottom threshold of the child elements.
6
+ */
7
+ export default function useScroll({ parentContainerRef, itemContainerRef, onThresholdBreach, delay = 150 }) {
8
+ const [scrollPos, setScrollPos] = useState();
9
+ useThrottle(scrollPos, () => {
10
+ if (!parentContainerRef.current || !itemContainerRef.current)
11
+ return;
12
+ const children = Array.from(itemContainerRef.current.children);
13
+ if (!children.length)
14
+ return;
15
+ const topIndex = Math.floor(children.length * 0.1);
16
+ const bottomIndex = Math.floor(children.length * 0.9);
17
+ const topAnchorElement = children[topIndex];
18
+ const bottomAnchorElement = children[bottomIndex];
19
+ const topRect = topAnchorElement.getBoundingClientRect();
20
+ const bottomRect = bottomAnchorElement.getBoundingClientRect();
21
+ const parentRect = parentContainerRef.current.getBoundingClientRect();
22
+ const nearTop = topRect.bottom >= parentRect.top;
23
+ const nearBottom = bottomRect.top <= parentRect.bottom;
24
+ if (nearTop || nearBottom) {
25
+ onThresholdBreach(parentContainerRef.current.scrollTop);
26
+ }
27
+ }, delay);
28
+ useEffect(() => {
29
+ const scrollElement = parentContainerRef.current;
30
+ if (!scrollElement)
31
+ return;
32
+ const scrollHandler = () => setScrollPos(scrollElement.scrollTop);
33
+ scrollElement.addEventListener('scroll', scrollHandler, { passive: true });
34
+ return () => {
35
+ scrollElement.removeEventListener('scroll', scrollHandler);
36
+ };
37
+ }, [parentContainerRef]);
38
+ }
39
+ //# sourceMappingURL=useScroll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScroll.js","sourceRoot":"","sources":["../../../../../Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAgBrD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,GAAG,GAAG,EACC;IACZ,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAAsB,CAAC;IAEjE,WAAW,CACT,SAAS,EACT,GAAG,EAAE;QACH,IAAI,CAAC,kBAAkB,CAAC,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO;YAAE,OAAO;QAErE,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC/D,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO;QAE7B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;QACnD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;QAEtD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC5C,MAAM,mBAAmB,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;QAElD,MAAM,OAAO,GAAG,gBAAgB,CAAC,qBAAqB,EAAE,CAAC;QACzD,MAAM,UAAU,GAAG,mBAAmB,CAAC,qBAAqB,EAAE,CAAC;QAE/D,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;QACtE,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,IAAI,UAAU,CAAC,GAAG,CAAC;QACjD,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC;QAEvD,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;YAC1B,iBAAiB,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC,EACD,KAAK,CACN,CAAC;IACF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,aAAa,GAAG,kBAAkB,CAAC,OAAO,CAAC;QACjD,IAAI,CAAC,aAAa;YAAE,OAAO;QAE3B,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAClE,aAAa,CAAC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAE3E,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAC7D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\nimport type { RefObject } from 'react';\n\nimport useThrottle from '../../../Hooks/useThrottle';\n\ninterface ScrollProps {\n /** Ref to the parent scrollable container element. */\n parentContainerRef: RefObject<HTMLElement>;\n /** Ref to the container holding the rendered elements. */\n itemContainerRef: RefObject<HTMLElement>;\n /**\n * Callback invoked when the scroll position is near the top or bottom threshold.\n * @param scrollTop - The current scrollTop value of the parent container.\n */\n onThresholdBreach: (scrollTop: number) => void;\n /** Optional throttle delay for scroll events (default: 150ms). */\n delay?: number;\n}\n\n/**\n * Hook to monitor scroll events on a parent container and trigger a callback\n * when the scroll position approaches the top or bottom threshold of the child elements.\n */\nexport default function useScroll({\n parentContainerRef,\n itemContainerRef,\n onThresholdBreach,\n delay = 150\n}: ScrollProps) {\n const [scrollPos, setScrollPos] = useState<number | undefined>();\n\n useThrottle(\n scrollPos,\n () => {\n if (!parentContainerRef.current || !itemContainerRef.current) return;\n\n const children = Array.from(itemContainerRef.current.children);\n if (!children.length) return;\n\n const topIndex = Math.floor(children.length * 0.1);\n const bottomIndex = Math.floor(children.length * 0.9);\n\n const topAnchorElement = children[topIndex];\n const bottomAnchorElement = children[bottomIndex];\n\n const topRect = topAnchorElement.getBoundingClientRect();\n const bottomRect = bottomAnchorElement.getBoundingClientRect();\n\n const parentRect = parentContainerRef.current.getBoundingClientRect();\n const nearTop = topRect.bottom >= parentRect.top;\n const nearBottom = bottomRect.top <= parentRect.bottom;\n\n if (nearTop || nearBottom) {\n onThresholdBreach(parentContainerRef.current.scrollTop);\n }\n },\n delay\n );\n useEffect(() => {\n const scrollElement = parentContainerRef.current;\n if (!scrollElement) return;\n\n const scrollHandler = () => setScrollPos(scrollElement.scrollTop);\n scrollElement.addEventListener('scroll', scrollHandler, { passive: true });\n\n return () => {\n scrollElement.removeEventListener('scroll', scrollHandler);\n };\n }, [parentContainerRef]);\n}\n"]}
@@ -0,0 +1,38 @@
1
+ import { type ReactNode, type RefObject } from 'react';
2
+ import type { LoadedDataRange } from './VariableHeightVirtualizer';
3
+ interface VirtualizerItemCountParams {
4
+ /** The starting index requested by virtualizer. */
5
+ startIndex: number;
6
+ /** The ending index requested by virtualizer. */
7
+ endIndex: number;
8
+ /** The range of items currently loaded. */
9
+ loadedDataRange: LoadedDataRange;
10
+ /** Indicates if the data is currently being fetched. */
11
+ isDataFetching: boolean;
12
+ /** Ref to the container holding rendered items. */
13
+ itemContainerRef: RefObject<HTMLElement>;
14
+ /** The rendered children items as ReactNode. */
15
+ children: ReactNode;
16
+ /** The total number of items if known, or `null`/`undefined` for infinite mode. */
17
+ totalItemCount?: number | null;
18
+ /** Optional buffer to add to the count in infinite mode. */
19
+ buffer?: number;
20
+ /** Signal to reset the count in infinite mode. */
21
+ countResetSignal?: number;
22
+ }
23
+ /**
24
+ * Determines the count of virtualized items in a list and whether the list is in infinite scrolling mode or not.
25
+ *
26
+ * @returns An object containing:
27
+ * - `isInfiniteMode`: Whether the list is in infinite scrolling mode.
28
+ * - `virtualizedCount`: The current count of virtualized items.
29
+ *
30
+ * NOTE: In finite mode, the count is based on `totalItemCount`.
31
+ * NOTE: In infinite mode, the count is dynamically calculated based on loaded items and buffer.
32
+ */
33
+ export default function useVirtualizerItemCount(params: VirtualizerItemCountParams): {
34
+ isInfiniteMode: boolean;
35
+ virtualizedCount: number;
36
+ };
37
+ export {};
38
+ //# sourceMappingURL=useVirtualizerItemCount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVirtualizerItemCount.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE,UAAU,0BAA0B;IAClC,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,eAAe,EAAE,eAAe,CAAC;IACjC,wDAAwD;IACxD,cAAc,EAAE,OAAO,CAAC;IAExB,mDAAmD;IACnD,gBAAgB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACzC,gDAAgD;IAChD,QAAQ,EAAE,SAAS,CAAC;IAEpB,mFAAmF;IACnF,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,MAAM,EAAE,0BAA0B,GAAG;IACnF,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAwEA"}
@@ -0,0 +1,62 @@
1
+ import { useEffect, useLayoutEffect, useMemo, useState } from 'react';
2
+ import { getDataIndex } from './utils';
3
+ /**
4
+ * Determines the count of virtualized items in a list and whether the list is in infinite scrolling mode or not.
5
+ *
6
+ * @returns An object containing:
7
+ * - `isInfiniteMode`: Whether the list is in infinite scrolling mode.
8
+ * - `virtualizedCount`: The current count of virtualized items.
9
+ *
10
+ * NOTE: In finite mode, the count is based on `totalItemCount`.
11
+ * NOTE: In infinite mode, the count is dynamically calculated based on loaded items and buffer.
12
+ */
13
+ export default function useVirtualizerItemCount(params) {
14
+ const { startIndex, endIndex, loadedDataRange, isDataFetching, totalItemCount, buffer = 10, countResetSignal, itemContainerRef, children } = params;
15
+ const [virtualizedCount, setVirtualizedCount] = useState(totalItemCount || 0);
16
+ const isInfiniteMode = useMemo(() => totalItemCount === null || totalItemCount === undefined, [totalItemCount]);
17
+ useLayoutEffect(() => {
18
+ if (!isInfiniteMode) {
19
+ setVirtualizedCount(totalItemCount ?? 0);
20
+ }
21
+ }, [totalItemCount, isInfiniteMode]);
22
+ useLayoutEffect(() => {
23
+ if (isInfiniteMode) {
24
+ setVirtualizedCount(0);
25
+ }
26
+ }, [countResetSignal, isInfiniteMode]);
27
+ // Calculating count based on loaded items for infinite scrolling
28
+ useEffect(() => {
29
+ if (!isInfiniteMode || !endIndex || !loadedDataRange.endIndex || isDataFetching)
30
+ return;
31
+ const items = itemContainerRef.current?.children;
32
+ if (!items?.length) {
33
+ setVirtualizedCount(0);
34
+ return;
35
+ }
36
+ const lastItemDataIndex = getDataIndex(items[items.length - 1]) ?? -1;
37
+ const hasMoreResults = loadedDataRange.startIndex === startIndex &&
38
+ loadedDataRange.endIndex === endIndex &&
39
+ lastItemDataIndex === endIndex;
40
+ if (!hasMoreResults && Number.isInteger(lastItemDataIndex)) {
41
+ setVirtualizedCount(lastItemDataIndex + 1);
42
+ return;
43
+ }
44
+ const countWithBuffer = loadedDataRange.endIndex + 1 + buffer;
45
+ if (hasMoreResults && countWithBuffer > virtualizedCount) {
46
+ setVirtualizedCount(countWithBuffer);
47
+ }
48
+ }, [
49
+ isDataFetching,
50
+ children,
51
+ isInfiniteMode,
52
+ loadedDataRange,
53
+ virtualizedCount,
54
+ itemContainerRef,
55
+ endIndex
56
+ ]);
57
+ return {
58
+ isInfiniteMode,
59
+ virtualizedCount
60
+ };
61
+ }
62
+ //# sourceMappingURL=useVirtualizerItemCount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVirtualizerItemCount.js","sourceRoot":"","sources":["../../../../../Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,eAAe,EACf,OAAO,EACP,QAAQ,EAGT,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAyBvC;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,MAAkC;IAIhF,MAAM,EACJ,UAAU,EACV,QAAQ,EACR,eAAe,EACf,cAAc,EACd,cAAc,EACd,MAAM,GAAG,EAAE,EACX,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACT,GAAG,MAAM,CAAC;IAEX,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,cAAc,IAAI,CAAC,CAAC,CAAC;IAE9E,MAAM,cAAc,GAAG,OAAO,CAC5B,GAAG,EAAE,CAAC,c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AC9D,IAAI,cAAc,IAAI,eAAe,GAAG,gBAAgB,EAAE,CAAC;YACzD,mBAAmB,CAAC,eAAe,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,EAAE;QACD,cAAc;QACd,QAAQ;QACR,cAAc;QACd,eAAe;QACf,gBAAgB;QAChB,gBAAgB;QAChB,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO;QACL,cAAc;QACd,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["import {\n useEffect,\n useLayoutEffect,\n useMemo,\n useState,\n type ReactNode,\n type RefObject\n} from 'react';\n\nimport type { LoadedDataRange } from './VariableHeightVirtualizer';\nimport { getDataIndex } from './utils';\n\ninterface VirtualizerItemCountParams {\n /** The starting index requested by virtualizer. */\n startIndex: number;\n /** The ending index requested by virtualizer. */\n endIndex: number;\n /** The range of items currently loaded. */\n loadedDataRange: LoadedDataRange;\n /** Indicates if the data is currently being fetched. */\n isDataFetching: boolean;\n\n /** Ref to the container holding rendered items. */\n itemContainerRef: RefObject<HTMLElement>;\n /** The rendered children items as ReactNode. */\n children: ReactNode;\n\n /** The total number of items if known, or `null`/`undefined` for infinite mode. */\n totalItemCount?: number | null;\n /** Optional buffer to add to the count in infinite mode. */\n buffer?: number;\n /** Signal to reset the count in infinite mode. */\n countResetSignal?: number;\n}\n\n/**\n * Determines the count of virtualized items in a list and whether the list is in infinite scrolling mode or not.\n *\n * @returns An object containing:\n * - `isInfiniteMode`: Whether the list is in infinite scrolling mode.\n * - `virtualizedCount`: The current count of virtualized items.\n *\n * NOTE: In finite mode, the count is based on `totalItemCount`.\n * NOTE: In infinite mode, the count is dynamically calculated based on loaded items and buffer.\n */\nexport default function useVirtualizerItemCount(params: VirtualizerItemCountParams): {\n isInfiniteMode: boolean;\n virtualizedCount: number;\n} {\n const {\n startIndex,\n endIndex,\n loadedDataRange,\n isDataFetching,\n totalItemCount,\n buffer = 10,\n countResetSignal,\n itemContainerRef,\n children\n } = params;\n\n const [virtualizedCount, setVirtualizedCount] = useState(totalItemCount || 0);\n\n const isInfiniteMode = useMemo(\n () => totalItemCount === null || totalItemCount === undefined,\n [totalItemCount]\n );\n\n useLayoutEffect(() => {\n if (!isInfiniteMode) {\n setVirtualizedCount(totalItemCount ?? 0);\n }\n }, [totalItemCount, isInfiniteMode]);\n\n useLayoutEffect(() => {\n if (isInfiniteMode) {\n setVirtualizedCount(0);\n }\n }, [countResetSignal, isInfiniteMode]);\n\n // Calculating count based on loaded items for infinite scrolling\n useEffect(() => {\n if (!isInfiniteMode || !endIndex || !loadedDataRange.endIndex || isDataFetching) return;\n\n const items = itemContainerRef.current?.children;\n if (!items?.length) {\n setVirtualizedCount(0);\n return;\n }\n\n const lastItemDataIndex = getDataIndex(items[items.length - 1]) ?? -1;\n\n const hasMoreResults =\n loadedDataRange.startIndex === startIndex &&\n loadedDataRange.endIndex === endIndex &&\n lastItemDataIndex === endIndex;\n\n if (!hasMoreResults && Number.isInteger(lastItemDataIndex)) {\n setVirtualizedCount(lastItemDataIndex + 1);\n return;\n }\n\n const countWithBuffer = loadedDataRange.endIndex + 1 + buffer;\n if (hasMoreResults && countWithBuffer > virtualizedCount) {\n setVirtualizedCount(countWithBuffer);\n }\n }, [\n isDataFetching,\n children,\n isInfiniteMode,\n loadedDataRange,\n virtualizedCount,\n itemContainerRef,\n endIndex\n ]);\n\n return {\n isInfiniteMode,\n virtualizedCount\n };\n}\n"]}
@@ -0,0 +1,112 @@
1
+ import type { RefObject } from 'react';
2
+ import type { ItemsHeight } from './VariableHeightVirtualizer';
3
+ interface GetVirtualizedPaginationIndicesParams {
4
+ /** Current vertical scroll offset of the container. */
5
+ scrollTop: number;
6
+ /** Ref to the scrolling container element */
7
+ containerRef: RefObject<HTMLElement>;
8
+ /** Ref to the container holding the list items */
9
+ itemContainerRef: RefObject<HTMLElement>;
10
+ /** Total number of items. */
11
+ totalItemCount: number;
12
+ /** Mapping of item indices and their actual height. */
13
+ itemsHeight: ItemsHeight;
14
+ /** Default height for items if not measured. */
15
+ defaultItemHeight: number;
16
+ /** Number of extra items to render above and below the visible viewport for smooth scrolling. */
17
+ buffer: number;
18
+ /** Maximum allowed end index (exclusive). */
19
+ endIndexLimit: number;
20
+ /** If true, allows indices to exceed totalCount for infinite scrolling by including buffer. */
21
+ isInfiniteMode?: boolean;
22
+ }
23
+ /**
24
+ * Calculates the start and end indices for virtualized pagination in a variable-height list.
25
+ *
26
+ * @returns {{ startIndex: number, endIndex: number }} Object containing the calculated start and end indices for rendering (inclusive both indices).
27
+ */
28
+ export declare const getVirtualizedPaginationIndices: (param: GetVirtualizedPaginationIndicesParams) => {
29
+ startIndex: number;
30
+ endIndex: number;
31
+ };
32
+ /**
33
+ * Calculates the total buffer height for a list of items, using their individual heights if available,
34
+ * or a default height otherwise.
35
+ *
36
+ * @param totalItemCount - The total number of items in the list.
37
+ * @param itemsHeight - An object or array containing the heights of individual items, indexed by item position.
38
+ * @param defaultItemHeight - The default height to use for items whose height is not specified in `itemsHeight`.
39
+ * @returns The sum of all item heights, using the default height for any missing values.
40
+ */
41
+ export declare const calculateTotalBufferHeight: (totalItemCount: number, itemsHeight: ItemsHeight, defaultItemHeight: number) => number;
42
+ /**
43
+ * Returns a CSS-compatible max-height value based on the input.
44
+ *
45
+ * @param viewMaxHeight - The maximum height value, which can be a number (pixels), a string (CSS value), or `null`.
46
+ * @returns A string representing the CSS max-height value.
47
+ */
48
+ export declare const getMaxHeight: (viewMaxHeight: number | string | null) => string;
49
+ /**
50
+ * Calculates the vertical offset for a given item index in a list with variable item heights.
51
+ *
52
+ * @param index - The index of the item for which to calculate the offset.
53
+ * @param itemsHeight - Mapping of item indices and their actual height.
54
+ * @param defaultItemHeight - The default height to use for items not present in the cache.
55
+ * @returns The total offset (in pixels) from the top of the list to the specified index.
56
+ */
57
+ export declare const getOffsetForIndex: (index: number, itemsHeight: ItemsHeight, defaultItemHeight: number) => number;
58
+ /**
59
+ * Determines whether the viewable area of a virtualized list is not fully filled with rendered items.
60
+ *
61
+ * @param totalItemCount - The total number of items that should be rendered.
62
+ * @param itemContainer - The HTML element containing the rendered items.
63
+ * @param parentContainer - The parent HTML element that contains the items and possibly the header.
64
+ * @param renderHeader - Indicates whether a header is rendered at the top of the parent container.
65
+ * @returns `true` if the view is not filled with all items, `false` otherwise.
66
+ */
67
+ export declare const isViewNotFilled: (totalItemCount: number, itemContainer: HTMLElement, parentContainer: HTMLElement, renderHeader: boolean) => boolean;
68
+ /**
69
+ * Retrieves the numeric data index from the `data-index` attribute of a given Element.
70
+ *
71
+ * @param element - The Element from which to extract the data index.
72
+ * @returns The parsed integer value of the `data-index` attribute, or `null` if the attribute is not present.
73
+ */
74
+ export declare const getDataIndex: (element: Element) => number | null;
75
+ /**
76
+ * Calculates and returns an object containing the heights of items whose heights have changed
77
+ * compared to their previous values.
78
+ *
79
+ * @param itemContainer - The container HTMLElement whose child nodes represent items to measure.
80
+ * @param itemsHeight - An object mapping item indices to their measured heights.
81
+ * @param defaultItemHeight - The default height to use for items not present in `itemsHeight`.
82
+ * @returns An object mapping item indices to their new heights for items whose heights have changed.
83
+ */
84
+ export declare function getChangedItemsHeight(itemContainer: HTMLElement, itemsHeight: ItemsHeight, defaultItemHeight: number): ItemsHeight;
85
+ /**
86
+ * Calculates the cumulative change in item heights between two sets of item height data,
87
+ * for a range of items starting from `startIndex` up to (but not including) `previousFirstItemDataIndex`.
88
+ *
89
+ * This function compares the current heights (`itemsHeight`) with the previous heights (`previousItemsHeight`)
90
+ * for each item in the specified range, using `defaultItemHeight` as a fallback if a previous height is missing.
91
+ * The result is the sum of the differences in height for all items in the range.
92
+ *
93
+ * @param startIndex - The index at which to start calculating the cumulative height change.
94
+ * @param previousFirstItemDataIndex - The index up to which to calculate (exclusive). If `null` or less than or equal to 0, returns 0.
95
+ * @param itemsHeight - An object mapping item indices to their measured heights.
96
+ * @param previousItemsHeight - An object mapping item indices of previously rendered items to their heights.
97
+ * @param defaultItemHeight - The default height to use if a previous height is not available.
98
+ * @returns The cumulative change in item heights for the specified range, or 0 if the result is not finite.
99
+ */
100
+ export declare const calculateCumulativeItemSizeChange: (startIndex: number, previousFirstItemDataIndex: number | null, itemsHeight: ItemsHeight, previousItemsHeight: ItemsHeight, defaultItemHeight: number) => number;
101
+ /**
102
+ * Updates the position styles of child items within a container element to enable virtualized rendering.
103
+ * Sets the container's top offset and positions each child absolutely based on their calculated heights.
104
+ *
105
+ * @param itemContainer - The HTML element containing the list items to be positioned.
106
+ * @param itemsHeight - An object mapping item indices to their measured heights.
107
+ * @param defaultItemHeight - The default height to use for items without a specified height.
108
+ * @returns The total height of all items within the container, rounded down to the nearest integer.
109
+ */
110
+ export declare const updateItemPositionStyles: (itemContainer: HTMLElement, itemsHeight: ItemsHeight, defaultItemHeight: number) => number;
111
+ export {};
112
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Virtualise/VariableHeightVirtualizer/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D,UAAU,qCAAqC;IAC7C,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,YAAY,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACrC,kDAAkD;IAClD,gBAAgB,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAEzC,6BAA6B;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,WAAW,EAAE,WAAW,CAAC;IACzB,gDAAgD;IAChD,iBAAiB,EAAE,MAAM,CAAC;IAE1B,iGAAiG;IACjG,MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,+FAA+F;IAC/F,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;GAIG;A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