@pega/lists-react 9.0.0-build.19.0 → 9.0.0-build.19.10

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 (124) hide show
  1. package/lib/Core/Components/DefaultComponents/EmptyContainer.d.ts +3 -1
  2. package/lib/Core/Components/DefaultComponents/EmptyContainer.d.ts.map +1 -1
  3. package/lib/Core/Components/DefaultComponents/EmptyContainer.js +11 -2
  4. package/lib/Core/Components/DefaultComponents/EmptyContainer.js.map +1 -1
  5. package/lib/Core/Components/DefaultComponents/index.d.ts +3 -1
  6. package/lib/Core/Components/DefaultComponents/index.d.ts.map +1 -1
  7. package/lib/Core/Components/Toolbar/AdvanceToolbar.d.ts.map +1 -1
  8. package/lib/Core/Components/Toolbar/AdvanceToolbar.js +3 -13
  9. package/lib/Core/Components/Toolbar/AdvanceToolbar.js.map +1 -1
  10. package/lib/Core/Components/Toolbar/FieldSelector.d.ts +1 -0
  11. package/lib/Core/Components/Toolbar/FieldSelector.d.ts.map +1 -1
  12. package/lib/Core/Components/Toolbar/FieldSelector.js +3 -2
  13. package/lib/Core/Components/Toolbar/FieldSelector.js.map +1 -1
  14. package/lib/Core/Components/Toolbar/Grouping.types.d.ts +0 -6
  15. package/lib/Core/Components/Toolbar/Grouping.types.d.ts.map +1 -1
  16. package/lib/Core/Components/Toolbar/Grouping.types.js.map +1 -1
  17. package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.d.ts +14 -18
  18. package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.d.ts.map +1 -1
  19. package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.js +14 -15
  20. package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.js.map +1 -1
  21. package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.d.ts +3 -2
  22. package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.d.ts.map +1 -1
  23. package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.js +4 -4
  24. package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.js.map +1 -1
  25. package/lib/Core/Components/Toolbar/hooks/useGroup/useGroup.d.ts.map +1 -1
  26. package/lib/Core/Components/Toolbar/hooks/useGroup/useGroup.js +6 -3
  27. package/lib/Core/Components/Toolbar/hooks/useGroup/useGroup.js.map +1 -1
  28. package/lib/Core/Components/Toolbar/hooks/useMore.d.ts.map +1 -1
  29. package/lib/Core/Components/Toolbar/hooks/useMore.js +32 -23
  30. package/lib/Core/Components/Toolbar/hooks/useMore.js.map +1 -1
  31. package/lib/Core/Components/Toolbar/hooks/useSort/Row.d.ts +4 -4
  32. package/lib/Core/Components/Toolbar/hooks/useSort/Row.d.ts.map +1 -1
  33. package/lib/Core/Components/Toolbar/hooks/useSort/Row.js +6 -6
  34. package/lib/Core/Components/Toolbar/hooks/useSort/Row.js.map +1 -1
  35. package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.d.ts +2 -1
  36. package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.d.ts.map +1 -1
  37. package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.js +8 -2
  38. package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.js.map +1 -1
  39. package/lib/Core/Components/Toolbar/hooks/useSort/useSort.d.ts.map +1 -1
  40. package/lib/Core/Components/Toolbar/hooks/useSort/useSort.js +2 -2
  41. package/lib/Core/Components/Toolbar/hooks/useSort/useSort.js.map +1 -1
  42. package/lib/Core/Components/Virtualise/Pagination.d.ts.map +1 -1
  43. package/lib/Core/Components/Virtualise/Pagination.js +2 -1
  44. package/lib/Core/Components/Virtualise/Pagination.js.map +1 -1
  45. package/lib/Core/Components/Virtualise/UseScroll.d.ts +4 -1
  46. package/lib/Core/Components/Virtualise/UseScroll.d.ts.map +1 -1
  47. package/lib/Core/Components/Virtualise/UseScroll.js +16 -3
  48. package/lib/Core/Components/Virtualise/UseScroll.js.map +1 -1
  49. package/lib/Core/Components/Virtualise/VirtualizeInfinite.js +13 -3
  50. package/lib/Core/Components/Virtualise/VirtualizeInfinite.js.map +1 -1
  51. package/lib/Core/Components/Virtualise/index.js +12 -3
  52. package/lib/Core/Components/Virtualise/index.js.map +1 -1
  53. package/lib/Core/Views/Gallery/Components/GalleryCard.d.ts +1 -1
  54. package/lib/Core/Views/Gallery/Components/GalleryCard.d.ts.map +1 -1
  55. package/lib/Core/Views/Gallery/Components/GalleryCard.js +8 -6
  56. package/lib/Core/Views/Gallery/Components/GalleryCard.js.map +1 -1
  57. package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.d.ts +8 -0
  58. package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.d.ts.map +1 -0
  59. package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.js +25 -0
  60. package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.js.map +1 -0
  61. package/lib/Core/Views/Gallery/Components/GalleryHeader.d.ts +1 -2
  62. package/lib/Core/Views/Gallery/Components/GalleryHeader.d.ts.map +1 -1
  63. package/lib/Core/Views/Gallery/Components/GalleryHeader.js +4 -8
  64. package/lib/Core/Views/Gallery/Components/GalleryHeader.js.map +1 -1
  65. package/lib/Core/Views/Gallery/Gallery.types.d.ts +0 -1
  66. package/lib/Core/Views/Gallery/Gallery.types.d.ts.map +1 -1
  67. package/lib/Core/Views/Gallery/Gallery.types.js.map +1 -1
  68. package/lib/Core/Views/Gallery/hooks/useRowActions.d.ts +9 -0
  69. package/lib/Core/Views/Gallery/hooks/useRowActions.d.ts.map +1 -0
  70. package/lib/Core/Views/Gallery/hooks/useRowActions.js +25 -0
  71. package/lib/Core/Views/Gallery/hooks/useRowActions.js.map +1 -0
  72. package/lib/Core/Views/Gallery/index.d.ts.map +1 -1
  73. package/lib/Core/Views/Gallery/index.js +10 -7
  74. package/lib/Core/Views/Gallery/index.js.map +1 -1
  75. package/lib/Core/Views/Gallery/utils.d.ts +15 -2
  76. package/lib/Core/Views/Gallery/utils.d.ts.map +1 -1
  77. package/lib/Core/Views/Gallery/utils.js +23 -5
  78. package/lib/Core/Views/Gallery/utils.js.map +1 -1
  79. package/lib/Core/Views/Map/index.d.ts.map +1 -1
  80. package/lib/Core/Views/Map/index.js +2 -2
  81. package/lib/Core/Views/Map/index.js.map +1 -1
  82. package/lib/Core/Views/Table/TableA11y.d.ts +10 -0
  83. package/lib/Core/Views/Table/TableA11y.d.ts.map +1 -1
  84. package/lib/Core/Views/Table/TableA11y.js +185 -0
  85. package/lib/Core/Views/Table/TableA11y.js.map +1 -1
  86. package/lib/Core/Views/Table/VirtualizeWrapper.d.ts.map +1 -1
  87. package/lib/Core/Views/Table/VirtualizeWrapper.js +12 -13
  88. package/lib/Core/Views/Table/VirtualizeWrapper.js.map +1 -1
  89. package/lib/Core/Views/Table/index.d.ts.map +1 -1
  90. package/lib/Core/Views/Table/index.js +5 -3
  91. package/lib/Core/Views/Table/index.js.map +1 -1
  92. package/lib/Core/Views/Timeline/Timeline.d.ts.map +1 -1
  93. package/lib/Core/Views/Timeline/Timeline.js +11 -11
  94. package/lib/Core/Views/Timeline/Timeline.js.map +1 -1
  95. package/lib/Core/Views/Timeline/Timeline.styles.d.ts +1 -1
  96. package/lib/Core/Views/Timeline/Timeline.styles.d.ts.map +1 -1
  97. package/lib/Core/Views/Timeline/Timeline.styles.js +7 -10
  98. package/lib/Core/Views/Timeline/Timeline.styles.js.map +1 -1
  99. package/lib/Core/Views/Timeline/Timeline.types.d.ts +7 -9
  100. package/lib/Core/Views/Timeline/Timeline.types.d.ts.map +1 -1
  101. package/lib/Core/Views/Timeline/Timeline.types.js.map +1 -1
  102. package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.d.ts +2 -2
  103. package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.d.ts.map +1 -1
  104. package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.js.map +1 -1
  105. package/lib/Core/Views/Timeline/index.d.ts.map +1 -1
  106. package/lib/Core/Views/Timeline/index.js +4 -4
  107. package/lib/Core/Views/Timeline/index.js.map +1 -1
  108. package/lib/Core/Views/Timeline/utils.d.ts +8 -10
  109. package/lib/Core/Views/Timeline/utils.d.ts.map +1 -1
  110. package/lib/Core/Views/Timeline/utils.js +136 -58
  111. package/lib/Core/Views/Timeline/utils.js.map +1 -1
  112. package/lib/Core/templateFeatureSupport.d.ts +17 -0
  113. package/lib/Core/templateFeatureSupport.d.ts.map +1 -0
  114. package/lib/Core/templateFeatureSupport.js +30 -0
  115. package/lib/Core/templateFeatureSupport.js.map +1 -0
  116. package/package.json +7 -7
  117. package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.d.ts +0 -7
  118. package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.d.ts.map +0 -1
  119. package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.js +0 -109
  120. package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.js.map +0 -1
  121. package/lib/Core/Views/Timeline/utility.d.ts +0 -8
  122. package/lib/Core/Views/Timeline/utility.d.ts.map +0 -1
  123. package/lib/Core/Views/Timeline/utility.js +0 -120
  124. package/lib/Core/Views/Timeline/utility.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/Pagination.js"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,YAAY,CAAC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEvD,SAAS,yBAAyB,CAAC,GAAG;IACpC,IAAI,CAAC,GAAG;QAAE,OAAO;IACjB,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CA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Ae,EACf,8BAA8B,EAC9B,YAAY,EACZ,EAAE,CAAC,gBAAgB,EACnB,SAAS,EACT,gBAAgB,CACjB,CAAC;AACJ,CAAC","sourcesContent":["const RowIndexAttribute = 'data-index';\nexport const StickyGroupHeader = 'sticky-group-header';\n\nfunction getKeyWithMaxValueFromMap(map) {\n if (!map) return;\n return [...map.entries()].reduce((a, b) => (b[1] > a[1] ? b : a))[0];\n}\n\n// Find nearest element to view.\n// It always find nearest element from top left of container.\nfunction getNearestElementTo(rContainer, targetBoundingBox) {\n const elements = Array.from(rContainer.childNodes);\n const itemCoords = [];\n const items = [];\n const overlappingGroupHeadersCountMap = new Map();\n\n elements.forEach(item => {\n const rect = item.getBoundingClientRect();\n const inHorizontalBoundaries =\n rect.right >= targetBoundingBox.left && rect.left <= targetBoundingBox.right;\n // considering only those items which are in view area.\n if (\n (rect.top >= targetBoundingBox.top &&\n rect.top <= targetBoundingBox.bottom &&\n inHorizontalBoundaries) ||\n (rect.bottom >= targetBoundingBox.top &&\n rect.bottom <= targetBoundingBox.bottom &&\n inHorizontalBoundaries)\n ) {\n itemCoords.push([rect.left, rect.bottom]);\n items.push(item);\n }\n });\n const distances = [];\n itemCoords.forEach((itemCoord, index) => {\n const distance = Math.hypot(\n itemCoord[0] - targetBoundingBox.left,\n itemCoord[1] - targetBoundingBox.top\n );\n const parsedDistance = parseInt(distance, 10);\n distances.push(parsedDistance);\n\n // Keeping track of group header distances to identify the overlap due to sticky position.\n // The distance with max count will represent the sub-group user is actually seeing.\n if (items[index]?.classList?.contains(StickyGroupHeader)) {\n overlappingGroupHeadersCountMap.set(\n parsedDistance,\n (overlappingGroupHeadersCountMap.get(parsedDistance) || 0) + 1\n );\n }\n });\n\n if (distances.length) {\n // BUG-740809 The closest item to view in case of sticky-group-header is first visible sticky-group-header\n const closestItemIndexFromTop = distances.lastIndexOf(Math.min(...distances));\n\n let closestItemFromTop = items[closestItemIndexFromTop];\n /**\n * BUG-81875: Considering sticky sub-group headers\n * When nested grouping is applied and groups have sticky position, the parent group will always be on the top and nested group headers will come after that.\n * Due to this, the nearest element will always be the parent group header even though user might have scrolled down some sub-group header.\n * Actual nearest element should be the sub-group visible to the user.\n */\n if (closestItemFromTop.classList?.contains(StickyGroupHeader)) {\n const topVisibleGroupKey = getKeyWithMaxValueFromMap(overlappingGroupHeadersCountMap);\n closestItemFromTop = items[distances.lastIndexOf(topVisibleGroupKey)];\n }\n const closestItemIndexFromBottom = distances.lastIndexOf(Math.max(...distances));\n\n if (targetBoundingBox.height === 0) {\n closestItemFromTop = elements[0];\n }\n return [closestItemFromTop, items[closestItemIndexFromBottom]];\n }\n return [];\n}\n\n// When element is present in view , find which direction has\n// enough count as we need to get record in another direction.\n// direction 1 - up, -1 - down\n// Nearest element is one which lies in view boundary.\n\nfunction getDirectionWhereCountIsEnough(nearestViewElement, currentRowIndex, targetBoundingBox) {\n let previousSiblingsCountAboveView = 0;\n let nextSiblingsCountBelowView = 0;\n let startElement = nearestViewElement;\n let dir = 1;\n if (currentRowIndex !== 0 && !startElement.previousElementSibling) dir = -1;\n else {\n while (startElement.previousElementSibling) {\n // BUG-740809 in case of overlapped sticky-group-header the previousElementSibling are at same 'top' location\n if (startElement.previousElementSibling.classList.contains(StickyGroupHeader)) {\n previousSiblingsCountAboveView += 1;\n } else {\n const itemCoords = startElement.previousElementSibling.getBoundingClientRect();\n if (itemCoords.bottom < targetBoundingBox.top) previousSiblingsCountAboveView += 1;\n }\n startElement = startElement.previousElementSibling;\n }\n if (nearestViewElement.classList.contains(StickyGroupHeader))\n previousSiblingsCountAboveView -= 1;\n if (parseInt(startElement.getAttribute(RowIndexAttribute), 10) === 0) dir = 1;\n else {\n startElement = nearestViewElement;\n while (startElement.nextElementSibling) {\n const itemCoords = startElement.nextElementSibling.getBoundingClientRect();\n if (itemCoords.top > targetBoundingBox.bottom) nextSiblingsCountBelowView += 1;\n startElement = startElement.nextElementSibling;\n }\n // iterate in either direction where count is more\n // until you find top element whose left match with nearest view element match.\n // and matched index will be either top or bottom buffer index.\n if (currentRowIndex !== 0 && nextSiblingsCountBelowView >= previousSiblingsCountAboveView)\n dir = -1;\n }\n }\n return dir;\n}\n\n// Get start and end index which view represent at any monument.\n// Add extra information as well to adjust virtualiser position.\n\nfunction getOptimalInfo(\n target,\n rowHeight,\n rContainer,\n bufferContainer,\n oldElementCount,\n heightComposingOldElementCount,\n totalRecords,\n bufferMultiplier,\n isRefresh,\n isInfiniteScroll\n) {\n let currentRowIndex = 0;\n let topRowIndex = 0;\n let topBufferIndex = 0;\n let existingItemBoundingBox;\n\n // Estimated buffer count based on view height and row container count.\n // Increase in buffer count can improve performance.\n // A safeguard value which will apply on initial load.\n const INITIAL_BUFFER = 10;\n const buffer = INITIAL_BUFFER * bufferMultiplier;\n let bottomBufferIndex = buffer * 5;\n const scrollDirectionBuffer = buffer * 2;\n const scrollOppositeDirectionBuffer = buffer;\n\n let rowsInView = heightComposingOldElementCount\n ? Math.floor((oldElementCount / heightComposingOldElementCount) * target.offsetHeight)\n : 0;\n rowsInView = Number.isNaN(rowsInView) ? 0 : rowsInView;\n\n if (totalRecords > 0) {\n const targetBoundingBox = target.getBoundingClientRect();\n const rowConBoundingBox = rContainer.getBoundingClientRect();\n\n // Check if any element exist in current view. Calculation will change the required index\n // As we have to fix the container to not show any flicker.\n const [nearestViewElementFromTop, nearestViewElementFromBottom] = getNearestElementTo(\n rContainer,\n targetBoundingBox\n );\n if (nearestViewElementFromTop) {\n currentRowIndex = parseInt(nearestViewElementFromTop.getAttribute(RowIndexAttribute), 10);\n existingItemBoundingBox = nearestViewElementFromTop.getBoundingClientRect();\n\n // check how long this nearest item is from top of view.\n // to estimate top row index ( What could be possible index on view top.)\n const spaceInMid = existingItemBoundingBox.top - targetBoundingBox.top;\n const elementsInMid = Math.floor(\n (oldElementCount / heightComposingOldElementCount) * spaceInMid\n );\n topRowIndex = elementsInMid < 0 ? currentRowIndex : currentRowIndex - elementsInMid;\n } else {\n currentRowIndex =\n Math.floor((target.scrollTop / heightComposingOldElementCount) * oldElementCount) || 0;\n topRowIndex = currentRowIndex;\n }\n\n // If element exist in current view, traverse dom elements\n // to find top buffer index or bottom buffer index\n // where left match to not change layout.\n if (existingItemBoundingBox) {\n let dir = 1;\n\n // We will consider direction 1 always in case of refresh as item count might have been changed.\n // change in item count is always from downside.\n if (!isRefresh)\n dir = getDirectionWhereCountIsEnough(\n nearestViewElementFromTop,\n currentRowIndex,\n targetBoundingBox\n );\n\n // We will iterate either upside or downside and pick that element\n // which we can select as either top buffer or botton buffer and don't\n // change layout as well and go for max iteration of buffer.\n let maxIteration = buffer;\n let startElement = dir === 1 ? nearestViewElementFromTop : nearestViewElementFromBottom;\n while (startElement && maxIteration > 0) {\n const e = dir === 1 ? startElement.previousElementSibling : startElement.nextElementSibling;\n if (\n e &&\n rowConBoundingBox.left ===\n e.getBoundingClientRect().left - parseInt(window.getComputedStyle(e).marginLeft, 10)\n ) {\n if (dir === 1) topBufferIndex = parseInt(e.getAttribute(RowIndexAttribute), 10);\n else bottomBufferIndex = parseInt(e.getAttribute(RowIndexAttribute), 10);\n }\n startElement = e;\n maxIteration -= 1;\n }\n\n if (dir === 1) bottomBufferIndex = currentRowIndex + rowsInView + scrollDirectionBuffer;\n else topBufferIndex = topRowIndex - scrollDirectionBuffer;\n } else {\n // if user jumps the scroll and there is no overlapping with the previous records\n topBufferIndex = currentRowIndex - scrollOppositeDirectionBuffer;\n bottomBufferIndex = currentRowIndex + rowsInView + scrollDirectionBuffer;\n }\n }\n\n // Safe edge check when indexes goes out of range.\n if (topBufferIndex < 0) topBufferIndex = 0;\n // As safari does elastic scroll, so currentRowIndex and topRowIndex can go negative , fallback these to zero.\n if (currentRowIndex < 0) currentRowIndex = 0;\n if (topRowIndex < 0) topRowIndex = 0;\n if (\n !isInfiniteScroll &&\n bottomBufferIndex > totalRecords &&\n totalRecords !== null &&\n totalRecords !== undefined\n )\n bottomBufferIndex = totalRecords - 1;\n\n // When we get start index 0 from scrolling then , on edge case we might get whitespace\n // As we always adjust row container top to show previous item in place.\n // To solve this, make sure top index is also 0 when start index is zero to avoid white space\n // otherwise we will make start index to 1 if it is zero.\n // if (topBufferIndex === 0 && topRowIndex !== 0) topBufferIndex = 1;\n\n // before pagination is in progress, put scroll node coords here\n // to track how much user scrolled while pagination is in progress.\n const bufferOldCords = bufferContainer.getBoundingClientRect();\n return {\n existingItemBoundingBox, // coordinates of current row index.\n currentRowIndex, // common visible item in view before and after paint (previous and next paint)\n topRowIndex, // What could be possible index on view top.\n bufferOldCords, // buffer coordinates while pagination.\n bufferNewCords: bufferOldCords, // buffer coordinates while pagination is in progress and user scroll.\n view: {\n startIndex: Math.floor(topBufferIndex),\n endIndex: Math.floor(bottomBufferIndex)\n }\n };\n}\n\nexport default function getPaginationInfo(\n target,\n totalRecords,\n vi,\n isRefresh = false,\n isInfiniteScroll = false\n) {\n const oldElementCount = vi.itemCount === undefined ? 0 : vi.itemCount;\n const heightComposingOldElementCount =\n vi.rowContainerHeight === undefined ? 0 : vi.rowContainerHeight;\n return getOptimalInfo(\n target,\n vi.itemHeight,\n vi.rContainer,\n vi.bContainer,\n oldElementCount,\n heightComposingOldElementCount,\n totalRecords,\n vi.bufferMultiplier,\n isRefresh,\n isInfiniteScroll\n );\n}\n"]}
1
+ {"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/Pagination.js"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,YAAY,CAAC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEvD,SAAS,yBAAyB,CAAC,GAAG;IACpC,IAAI,CAAC,GAAG;QAAE,OAAO;IACjB,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,C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kB,CAAC;IAClE,OAAO,cAAc,CACnB,MAAM,EACN,EAAE,CAAC,UAAU,EACb,EAAE,CAAC,UAAU,EACb,EAAE,CAAC,UAAU,EACb,eAAe,EACf,8BAA8B,EAC9B,YAAY,EACZ,EAAE,CAAC,gBAAgB,EACnB,SAAS,EACT,gBAAgB,CACjB,CAAC;AACJ,CAAC","sourcesContent":["const RowIndexAttribute = 'data-index';\nexport const StickyGroupHeader = 'sticky-group-header';\n\nfunction getKeyWithMaxValueFromMap(map) {\n if (!map) return;\n return [...map.entries()].reduce((a, b) => (b[1] > a[1] ? b : a))[0];\n}\n\n// Find nearest element to view.\n// It always find nearest element from top left of container.\nfunction getNearestElementTo(rContainer, targetBoundingBox) {\n const elements = Array.from(rContainer.childNodes);\n const itemCoords = [];\n const items = [];\n const overlappingGroupHeadersCountMap = new Map();\n\n elements.forEach(item => {\n const rect = item.getBoundingClientRect();\n const inHorizontalBoundaries =\n rect.right >= targetBoundingBox.left && rect.left <= targetBoundingBox.right;\n // considering only those items which are in view area.\n if (\n (rect.top >= targetBoundingBox.top &&\n rect.top <= targetBoundingBox.bottom &&\n inHorizontalBoundaries) ||\n (rect.bottom >= targetBoundingBox.top &&\n rect.bottom <= targetBoundingBox.bottom &&\n inHorizontalBoundaries)\n ) {\n itemCoords.push([rect.left, rect.bottom]);\n items.push(item);\n }\n });\n const distances = [];\n itemCoords.forEach((itemCoord, index) => {\n const distance = Math.hypot(\n itemCoord[0] - targetBoundingBox.left,\n itemCoord[1] - targetBoundingBox.top\n );\n const parsedDistance = parseInt(distance, 10);\n distances.push(parsedDistance);\n\n // Keeping track of group header distances to identify the overlap due to sticky position.\n // The distance with max count will represent the sub-group user is actually seeing.\n if (items[index]?.classList?.contains(StickyGroupHeader)) {\n overlappingGroupHeadersCountMap.set(\n parsedDistance,\n (overlappingGroupHeadersCountMap.get(parsedDistance) || 0) + 1\n );\n }\n });\n\n if (distances.length) {\n // BUG-740809 The closest item to view in case of sticky-group-header is first visible sticky-group-header\n const closestItemIndexFromTop = distances.lastIndexOf(Math.min(...distances));\n\n let closestItemFromTop = items[closestItemIndexFromTop];\n /**\n * BUG-81875: Considering sticky sub-group headers\n * When nested grouping is applied and groups have sticky position, the parent group will always be on the top and nested group headers will come after that.\n * Due to this, the nearest element will always be the parent group header even though user might have scrolled down some sub-group header.\n * Actual nearest element should be the sub-group visible to the user.\n */\n if (closestItemFromTop.classList?.contains(StickyGroupHeader)) {\n const topVisibleGroupKey = getKeyWithMaxValueFromMap(overlappingGroupHeadersCountMap);\n closestItemFromTop = items[distances.lastIndexOf(topVisibleGroupKey)];\n }\n const closestItemIndexFromBottom = distances.lastIndexOf(Math.max(...distances));\n\n if (targetBoundingBox.height === 0) {\n closestItemFromTop = elements[0];\n }\n return [closestItemFromTop, items[closestItemIndexFromBottom]];\n }\n return [];\n}\n\n// When element is present in view , find which direction has\n// enough count as we need to get record in another direction.\n// direction 1 - up, -1 - down\n// Nearest element is one which lies in view boundary.\n\nfunction getDirectionWhereCountIsEnough(nearestViewElement, currentRowIndex, targetBoundingBox) {\n let previousSiblingsCountAboveView = 0;\n let nextSiblingsCountBelowView = 0;\n let startElement = nearestViewElement;\n let dir = 1;\n if (currentRowIndex !== 0 && !startElement.previousElementSibling) dir = -1;\n else {\n while (startElement.previousElementSibling) {\n // BUG-740809 in case of overlapped sticky-group-header the previousElementSibling are at same 'top' location\n if (startElement.previousElementSibling.classList.contains(StickyGroupHeader)) {\n previousSiblingsCountAboveView += 1;\n } else {\n const itemCoords = startElement.previousElementSibling.getBoundingClientRect();\n if (itemCoords.bottom < targetBoundingBox.top) previousSiblingsCountAboveView += 1;\n }\n startElement = startElement.previousElementSibling;\n }\n if (nearestViewElement.classList.contains(StickyGroupHeader))\n previousSiblingsCountAboveView -= 1;\n if (parseInt(startElement.getAttribute(RowIndexAttribute), 10) === 0) dir = 1;\n else {\n startElement = nearestViewElement;\n while (startElement.nextElementSibling) {\n const itemCoords = startElement.nextElementSibling.getBoundingClientRect();\n if (itemCoords.top > targetBoundingBox.bottom) nextSiblingsCountBelowView += 1;\n startElement = startElement.nextElementSibling;\n }\n // iterate in either direction where count is more\n // until you find top element whose left match with nearest view element match.\n // and matched index will be either top or bottom buffer index.\n if (currentRowIndex !== 0 && nextSiblingsCountBelowView >= previousSiblingsCountAboveView)\n dir = -1;\n }\n }\n return dir;\n}\n\n// Get start and end index which view represent at any monument.\n// Add extra information as well to adjust virtualiser position.\n\nfunction getOptimalInfo(\n target,\n rowHeight,\n rContainer,\n bufferContainer,\n oldElementCount,\n heightComposingOldElementCount,\n totalRecords,\n bufferMultiplier,\n isRefresh,\n isInfiniteScroll\n) {\n let currentRowIndex = 0;\n let topRowIndex = 0;\n let topBufferIndex = 0;\n let existingItemBoundingBox;\n\n // Estimated buffer count based on view height and row container count.\n // Increase in buffer count can improve performance.\n // A safeguard value which will apply on initial load.\n const INITIAL_BUFFER = 10;\n const buffer = INITIAL_BUFFER * bufferMultiplier;\n let bottomBufferIndex = buffer * 5;\n\n // Since in Infinite scroll, the records need to be fetched in one direction only, fetching more records reduce the number of API calls.\n const scrollDirectionBuffer = isInfiniteScroll ? buffer * 4 : buffer * 2;\n const scrollOppositeDirectionBuffer = buffer;\n\n let rowsInView = heightComposingOldElementCount\n ? Math.floor((oldElementCount / heightComposingOldElementCount) * target.offsetHeight)\n : 0;\n rowsInView = Number.isNaN(rowsInView) ? 0 : rowsInView;\n\n if (totalRecords > 0) {\n const targetBoundingBox = target.getBoundingClientRect();\n const rowConBoundingBox = rContainer.getBoundingClientRect();\n\n // Check if any element exist in current view. Calculation will change the required index\n // As we have to fix the container to not show any flicker.\n const [nearestViewElementFromTop, nearestViewElementFromBottom] = getNearestElementTo(\n rContainer,\n targetBoundingBox\n );\n if (nearestViewElementFromTop) {\n currentRowIndex = parseInt(nearestViewElementFromTop.getAttribute(RowIndexAttribute), 10);\n existingItemBoundingBox = nearestViewElementFromTop.getBoundingClientRect();\n\n // check how long this nearest item is from top of view.\n // to estimate top row index ( What could be possible index on view top.)\n const spaceInMid = existingItemBoundingBox.top - targetBoundingBox.top;\n const elementsInMid = Math.floor(\n (oldElementCount / heightComposingOldElementCount) * spaceInMid\n );\n topRowIndex = elementsInMid < 0 ? currentRowIndex : currentRowIndex - elementsInMid;\n } else {\n currentRowIndex =\n Math.floor((target.scrollTop / heightComposingOldElementCount) * oldElementCount) || 0;\n topRowIndex = currentRowIndex;\n }\n\n // If element exist in current view, traverse dom elements\n // to find top buffer index or bottom buffer index\n // where left match to not change layout.\n if (existingItemBoundingBox) {\n let dir = 1;\n\n // We will consider direction 1 always in case of refresh as item count might have been changed.\n // change in item count is always from downside.\n if (!isRefresh)\n dir = getDirectionWhereCountIsEnough(\n nearestViewElementFromTop,\n currentRowIndex,\n targetBoundingBox\n );\n\n // We will iterate either upside or downside and pick that element\n // which we can select as either top buffer or botton buffer and don't\n // change layout as well and go for max iteration of buffer.\n let maxIteration = buffer;\n let startElement = dir === 1 ? nearestViewElementFromTop : nearestViewElementFromBottom;\n while (startElement && maxIteration > 0) {\n const e = dir === 1 ? startElement.previousElementSibling : startElement.nextElementSibling;\n if (\n e &&\n rowConBoundingBox.left ===\n e.getBoundingClientRect().left - parseInt(window.getComputedStyle(e).marginLeft, 10)\n ) {\n if (dir === 1) topBufferIndex = parseInt(e.getAttribute(RowIndexAttribute), 10);\n else bottomBufferIndex = parseInt(e.getAttribute(RowIndexAttribute), 10);\n }\n startElement = e;\n maxIteration -= 1;\n }\n\n if (dir === 1) bottomBufferIndex = currentRowIndex + rowsInView + scrollDirectionBuffer;\n else topBufferIndex = topRowIndex - scrollDirectionBuffer;\n } else {\n // if user jumps the scroll and there is no overlapping with the previous records\n topBufferIndex = currentRowIndex - scrollOppositeDirectionBuffer;\n bottomBufferIndex = currentRowIndex + rowsInView + scrollDirectionBuffer;\n }\n }\n\n // Safe edge check when indexes goes out of range.\n if (topBufferIndex < 0) topBufferIndex = 0;\n // As safari does elastic scroll, so currentRowIndex and topRowIndex can go negative , fallback these to zero.\n if (currentRowIndex < 0) currentRowIndex = 0;\n if (topRowIndex < 0) topRowIndex = 0;\n if (\n !isInfiniteScroll &&\n bottomBufferIndex > totalRecords &&\n totalRecords !== null &&\n totalRecords !== undefined\n )\n bottomBufferIndex = totalRecords - 1;\n\n // When we get start index 0 from scrolling then , on edge case we might get whitespace\n // As we always adjust row container top to show previous item in place.\n // To solve this, make sure top index is also 0 when start index is zero to avoid white space\n // otherwise we will make start index to 1 if it is zero.\n // if (topBufferIndex === 0 && topRowIndex !== 0) topBufferIndex = 1;\n\n // before pagination is in progress, put scroll node coords here\n // to track how much user scrolled while pagination is in progress.\n const bufferOldCords = bufferContainer.getBoundingClientRect();\n return {\n existingItemBoundingBox, // coordinates of current row index.\n currentRowIndex, // common visible item in view before and after paint (previous and next paint)\n topRowIndex, // What could be possible index on view top.\n bufferOldCords, // buffer coordinates while pagination.\n bufferNewCords: bufferOldCords, // buffer coordinates while pagination is in progress and user scroll.\n view: {\n startIndex: Math.floor(topBufferIndex),\n endIndex: Math.floor(bottomBufferIndex)\n }\n };\n}\n\nexport default function getPaginationInfo(\n target,\n totalRecords,\n vi,\n isRefresh = false,\n isInfiniteScroll = false\n) {\n const oldElementCount = vi.itemCount === undefined ? 0 : vi.itemCount;\n const heightComposingOldElementCount =\n vi.rowContainerHeight === undefined ? 0 : vi.rowContainerHeight;\n return getOptimalInfo(\n target,\n vi.itemHeight,\n vi.rContainer,\n vi.bContainer,\n oldElementCount,\n heightComposingOldElementCount,\n totalRecords,\n vi.bufferMultiplier,\n isRefresh,\n isInfiniteScroll\n );\n}\n"]}
@@ -1,3 +1,6 @@
1
- export default function useScroll(callback: any, getContext: any, vi: any, totalRecordCount: any, header: any, isFetching: any, viewHeight: any): ((top: any) => void)[];
1
+ export default function useScroll(callback: any, getContext: any, vi: any, totalRecordCount: any, header: any, isFetching: any, viewHeight: any, paginationTriggerRatios?: {
2
+ down: number;
3
+ up: number;
4
+ }): ((top: any) => void)[];
2
5
  export function useApplyStyleOnScroll(vi: any): () => void;
3
6
  //# sourceMappingURL=UseScroll.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UseScroll.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/UseScroll.js"],"names":[],"mappings":"AA0BA,yKA8FC;AAjHM,2DAiBN"}
1
+ {"version":3,"file":"UseScroll.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/UseScroll.js"],"names":[],"mappings":"AA+BA;;;2BAwGC;AA3HM,2DAiBN"}
@@ -2,6 +2,10 @@ import { useState, useEffect, useRef, useCallback } from 'react';
2
2
  import useThrottle from '../../Hooks/useThrottle';
3
3
  import { getRecordCountForLayoutPaint, isViewNotFilled } from './utility';
4
4
  // import useDebounce from '../../Hooks/UseDebounce';
5
+ const DEFAULT_PAGINATION_TRIGGER_RATIOS = {
6
+ down: 0.8,
7
+ up: 0.2
8
+ };
5
9
  export const useApplyStyleOnScroll = vi => {
6
10
  const footerElement = vi.pContainer?.querySelector('.footer > .row');
7
11
  return useCallback(() => {
@@ -17,7 +21,7 @@ export const useApplyStyleOnScroll = vi => {
17
21
  }
18
22
  }, [vi.pContainer, vi.rContainer, vi.pContainer?.offsetHeight, footerElement]);
19
23
  };
20
- export default function useScroll(callback, getContext, vi, totalRecordCount, header, isFetching, viewHeight) {
24
+ export default function useScroll(callback, getContext, vi, totalRecordCount, header, isFetching, viewHeight, paginationTriggerRatios = DEFAULT_PAGINATION_TRIGGER_RATIOS) {
21
25
  const applyScrollEndStyle = useApplyStyleOnScroll(vi);
22
26
  const [vScroll, setVScroll] = useState();
23
27
  const ref = useRef({
@@ -57,7 +61,7 @@ export default function useScroll(callback, getContext, vi, totalRecordCount, he
57
61
  if (!context)
58
62
  return;
59
63
  const direction = getDirection();
60
- const distance = direction === 1 ? 0.8 : 0.2;
64
+ const distance = direction === 1 ? paginationTriggerRatios.down : paginationTriggerRatios.up;
61
65
  const eleIndex = Math.floor(vi.rContainer.childElementCount * distance);
62
66
  const boundaryEle = vi.rContainer.childNodes[eleIndex];
63
67
  const boundaryElePos = boundaryEle?.getBoundingClientRect();
@@ -71,7 +75,16 @@ export default function useScroll(callback, getContext, vi, totalRecordCount, he
71
75
  vi.direction = direction;
72
76
  callback();
73
77
  }
74
- }, [getDirection, vi, getContext, isFetching, totalRecordCount, header, callback]);
78
+ }, [
79
+ getDirection,
80
+ paginationTriggerRatios,
81
+ vi,
82
+ getContext,
83
+ isFetching,
84
+ totalRecordCount,
85
+ header,
86
+ callback
87
+ ]);
75
88
  useThrottle(vScroll, handleScroll);
76
89
  useEffect(() => {
77
90
  const context = getContext();
@@ -1 +1 @@
1
- {"version":3,"file":"UseScroll.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/UseScroll.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,4BAA4B,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC1E,qDAAqD;AAErD,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC,EAAE;IACxC,MAAM,aAAa,GAAG,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACrE,OAAO,WAAW,CAAC,GAAG,EAAE;QACtB,6EAA6E;QAC7E,8FAA8F;QAC9F,IACE,IAAI,CAAC,GAAG,CACN,EAAE,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,MAAM;YAC1C,EAAE,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,MAAM;YAC5C,CAAC,aAAa,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CACpE,GAAG,CAAC,EACL,CAAC;YACD,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC5C,CAAC;aA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State, useEffect, useRef, useCallback } from 'react';\n\nimport useThrottle from '../../Hooks/useThrottle';\n\nimport { getRecordCountForLayoutPaint, isViewNotFilled } from './utility';\n// import useDebounce from '../../Hooks/UseDebounce';\n\nexport const useApplyStyleOnScroll = vi => {\n const footerElement = vi.pContainer?.querySelector('.footer > .row');\n return useCallback(() => {\n // Calculate the difference between bottom co-ordinates of p and r Containers\n // along with the row height of footer element to check if the bottom of the table is reached.\n if (\n Math.abs(\n vi.pContainer.getBoundingClientRect().bottom -\n vi.rContainer.getBoundingClientRect().bottom -\n (footerElement?.hasChildNodes() ? footerElement.offsetHeight : 0)\n ) < 1\n ) {\n vi.rContainer.classList.add('scroll-end');\n } else {\n vi.rContainer.classList.remove('scroll-end');\n }\n }, [vi.pContainer, vi.rContainer, vi.pContainer?.offsetHeight, footerElement]);\n};\n\nexport default function useScroll(\n callback,\n getContext,\n vi,\n totalRecordCount,\n header,\n isFetching,\n viewHeight\n) {\n const applyScrollEndStyle = useApplyStyleOnScroll(vi);\n const [vScroll, setVScroll] = useState();\n const ref = useRef({\n oldScrollTop: 0\n }).current;\n const updateScrollTop = useCallback(\n top => {\n ref.oldScrollTop = top;\n },\n [ref]\n );\n // const deBouncedVScroll = useDebounce(vScroll, 100);\n\n const getDirection = useCallback(() => {\n const context = getContext();\n let dir;\n if (ref.oldScrollTop > context.scrollTop) dir = -1;\n else if (ref.oldScrollTop < context.scrollTop) dir = 1;\n ref.oldScrollTop = context.scrollTop;\n return dir;\n }, [getContext, ref.oldScrollTop]);\n\n const onScroll = useCallback(\n e => {\n setVScroll(e.target.scrollTop);\n vi.pInfo.bufferNewCords = vi.bContainer.getBoundingClientRect();\n\n // Style is to be applied upon scroll after successful\n // check of bottom position of containers\n applyScrollEndStyle(vi.rContainer, vi.pContainer);\n },\n [\n isFetching,\n vi.pInfo.bufferNewCords,\n vi.bContainer,\n vi.pContainer,\n vi.rContainer,\n applyScrollEndStyle\n ]\n );\n\n const handleScroll = useCallback(() => {\n const context = getContext();\n // Returning in case the throttle function runs after some delay and by that time the virtualizer has unmounted\n if (!context) return;\n\n const direction = getDirection();\n const distance = direction === 1 ? 0.8 : 0.2;\n const eleIndex = Math.floor(vi.rContainer.childElementCount * distance);\n const boundaryEle = vi.rContainer.childNodes[eleIndex];\n const boundaryElePos = boundaryEle?.getBoundingClientRect();\n const { bottom, top } = context?.getBoundingClientRect() || {};\n if (\n (direction === 1 &&\n boundaryElePos?.bottom < bottom &&\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.view?.endIndex + 1 < totalRecordCount) ||\n (direction === -1 && boundaryElePos?.top > top && vi.pInfo?.view?.startIndex > 0) ||\n isViewNotFilled(getRecordCountForLayoutPaint(totalRecordCount), vi, context, header)\n ) {\n vi.direction = direction;\n callback();\n }\n }, [getDirection, vi, getContext, isFetching, totalRecordCount, header, callback]);\n\n useThrottle(vScroll, handleScroll);\n\n useEffect(() => {\n const context = getContext();\n if (context) context.addEventListener('scroll', onScroll);\n return () => {\n if (context) context.removeEventListener('scroll', onScroll);\n };\n }, [getContext, onScroll, vi.rContainer, vi.pContainer, applyScrollEndStyle]);\n\n // useEffect for scrollEndStyle hook\n useEffect(() => {\n applyScrollEndStyle(vi.rContainer, vi.pContainer);\n }, [vi.rContainer, vi.pContainer, applyScrollEndStyle, totalRecordCount, viewHeight]);\n // useEffect(() => {\n // if (deBouncedVScroll !== undefined)\n // handleScroll();\n // }, [deBouncedVScroll]);\n\n return [updateScrollTop];\n}\n"]}
1
+ {"version":3,"file":"UseScroll.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/UseScroll.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,4BAA4B,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC1E,qDAAqD;AAErD,MAAM,iCAAiC,GA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I,OAAO;YAAE,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC1D,OAAO,GAAG,EAAE;YACV,IAAI,OAAO;gBAAE,OAAO,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC/D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAE9E,oCAAoC;IACpC,SAAS,CAAC,GAAG,EAAE;QACb,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC,CAAC;IACtF,oBAAoB;IACpB,wCAAwC;IACxC,sBAAsB;IACtB,0BAA0B;IAE1B,OAAO,CAAC,eAAe,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import { useState, useEffect, useRef, useCallback } from 'react';\n\nimport useThrottle from '../../Hooks/useThrottle';\n\nimport { getRecordCountForLayoutPaint, isViewNotFilled } from './utility';\n// import useDebounce from '../../Hooks/UseDebounce';\n\nconst DEFAULT_PAGINATION_TRIGGER_RATIOS = {\n down: 0.8,\n up: 0.2\n};\n\nexport const useApplyStyleOnScroll = vi => {\n const footerElement = vi.pContainer?.querySelector('.footer > .row');\n return useCallback(() => {\n // Calculate the difference between bottom co-ordinates of p and r Containers\n // along with the row height of footer element to check if the bottom of the table is reached.\n if (\n Math.abs(\n vi.pContainer.getBoundingClientRect().bottom -\n vi.rContainer.getBoundingClientRect().bottom -\n (footerElement?.hasChildNodes() ? footerElement.offsetHeight : 0)\n ) < 1\n ) {\n vi.rContainer.classList.add('scroll-end');\n } else {\n vi.rContainer.classList.remove('scroll-end');\n }\n }, [vi.pContainer, vi.rContainer, vi.pContainer?.offsetHeight, footerElement]);\n};\n\nexport default function useScroll(\n callback,\n getContext,\n vi,\n totalRecordCount,\n header,\n isFetching,\n viewHeight,\n paginationTriggerRatios = DEFAULT_PAGINATION_TRIGGER_RATIOS\n) {\n const applyScrollEndStyle = useApplyStyleOnScroll(vi);\n const [vScroll, setVScroll] = useState();\n const ref = useRef({\n oldScrollTop: 0\n }).current;\n const updateScrollTop = useCallback(\n top => {\n ref.oldScrollTop = top;\n },\n [ref]\n );\n // const deBouncedVScroll = useDebounce(vScroll, 100);\n\n const getDirection = useCallback(() => {\n const context = getContext();\n let dir;\n if (ref.oldScrollTop > context.scrollTop) dir = -1;\n else if (ref.oldScrollTop < context.scrollTop) dir = 1;\n ref.oldScrollTop = context.scrollTop;\n return dir;\n }, [getContext, ref.oldScrollTop]);\n\n const onScroll = useCallback(\n e => {\n setVScroll(e.target.scrollTop);\n vi.pInfo.bufferNewCords = vi.bContainer.getBoundingClientRect();\n\n // Style is to be applied upon scroll after successful\n // check of bottom position of containers\n applyScrollEndStyle(vi.rContainer, vi.pContainer);\n },\n [\n isFetching,\n vi.pInfo.bufferNewCords,\n vi.bContainer,\n vi.pContainer,\n vi.rContainer,\n applyScrollEndStyle\n ]\n );\n\n const handleScroll = useCallback(() => {\n const context = getContext();\n // Returning in case the throttle function runs after some delay and by that time the virtualizer has unmounted\n if (!context) return;\n\n const direction = getDirection();\n const distance = direction === 1 ? paginationTriggerRatios.down : paginationTriggerRatios.up;\n const eleIndex = Math.floor(vi.rContainer.childElementCount * distance);\n const boundaryEle = vi.rContainer.childNodes[eleIndex];\n const boundaryElePos = boundaryEle?.getBoundingClientRect();\n const { bottom, top } = context?.getBoundingClientRect() || {};\n if (\n (direction === 1 &&\n boundaryElePos?.bottom < bottom &&\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.view?.endIndex + 1 < totalRecordCount) ||\n (direction === -1 && boundaryElePos?.top > top && vi.pInfo?.view?.startIndex > 0) ||\n isViewNotFilled(getRecordCountForLayoutPaint(totalRecordCount), vi, context, header)\n ) {\n vi.direction = direction;\n callback();\n }\n }, [\n getDirection,\n paginationTriggerRatios,\n vi,\n getContext,\n isFetching,\n totalRecordCount,\n header,\n callback\n ]);\n\n useThrottle(vScroll, handleScroll);\n\n useEffect(() => {\n const context = getContext();\n if (context) context.addEventListener('scroll', onScroll);\n return () => {\n if (context) context.removeEventListener('scroll', onScroll);\n };\n }, [getContext, onScroll, vi.rContainer, vi.pContainer, applyScrollEndStyle]);\n\n // useEffect for scrollEndStyle hook\n useEffect(() => {\n applyScrollEndStyle(vi.rContainer, vi.pContainer);\n }, [vi.rContainer, vi.pContainer, applyScrollEndStyle, totalRecordCount, viewHeight]);\n // useEffect(() => {\n // if (deBouncedVScroll !== undefined)\n // handleScroll();\n // }, [deBouncedVScroll]);\n\n return [updateScrollTop];\n}\n"]}
@@ -42,6 +42,10 @@ const StyledLoader = Styled.div `
42
42
  top: ${props => props.$style.top};
43
43
  bottom: ${props => props.$style.bottom};
44
44
  `;
45
+ const PAGINATION_TRIGGER_RATIOS = {
46
+ down: 0.9,
47
+ up: 0.1
48
+ };
45
49
  const VirtualizeInfinite = forwardRef(({ id, viewHeight, viewWidth, itemHeight, callback, rowContainerClass, children, renderHeader, renderFooter, state, bufferMultiplier, viewMaxHeight, showLoadingIndicator, resetCount, countUpdateCallback, isFetching, hasMoreResults, renderEmptyRecords }, inputRef) => {
46
50
  const rowBuffer = 5;
47
51
  const [rContainerDimensionUpdate, setRContainerDimensionUpdate] = useState();
@@ -158,7 +162,7 @@ const VirtualizeInfinite = forwardRef(({ id, viewHeight, viewWidth, itemHeight,
158
162
  setRContainerDimensionUpdate({});
159
163
  }, [getRowContainer]);
160
164
  useResizeObserver(getRowContainer, onRowContainerDimensionChange);
161
- const [updateScrollTop] = useScroll(getPagination, getPContainer, vi, getTotalRowsIncludingBuffer(), renderHeader, isFetching, viewHeight);
165
+ const [updateScrollTop] = useScroll(getPagination, getPContainer, vi, getTotalRowsIncludingBuffer(), renderHeader, isFetching, viewHeight, PAGINATION_TRIGGER_RATIOS);
162
166
  useLayoutEffect(() => {
163
167
  const rContainer = getRowContainer();
164
168
  if (state && state.startIndex >= 0 && vi && rContainer) {
@@ -249,7 +253,7 @@ const VirtualizeInfinite = forwardRef(({ id, viewHeight, viewWidth, itemHeight,
249
253
  ]);
250
254
  return (_jsxs(StyledPContainer, { "$style": {
251
255
  maxHeight,
252
- minHeight: vi.totalRowsLoaded === 0 ? '100px' : 'auto',
256
+ minHeight: !vi.totalRowsLoaded ? '100px' : 'auto',
253
257
  renderFooter,
254
258
  itemHeight,
255
259
  height,
@@ -260,7 +264,13 @@ const VirtualizeInfinite = forwardRef(({ id, viewHeight, viewWidth, itemHeight,
260
264
  vi.bContainer = c;
261
265
  }, children: _jsxs("div", { className: `${rowContainerClass} row-container`, ref: c => {
262
266
  vi.rContainer = c;
263
- }, role: 'rowgroup', children: [showLoadingIndicator && isFetching && loadingIndicatorInfo.isScrollingUp && (_jsx(StyledLoader, { "$style": { bottom: '100%' }, children: _jsx(Progress, { className: 'above-loader', placement: 'block', tabIndex: 0, "aria-label": translate('Loading more results') }) })), children, showLoadingIndicator && isFetching && loadingIndicatorInfo.isScrollingDown && (_jsx(StyledLoader, { "$style": { top: '100%' }, children: _jsx(Progress, { className: 'below-loader', placement: 'block', tabIndex: 0, "aria-label": translate('Loading more results') }) }))] }) }), vi.totalRowsLoaded === 0 && !isFetching
267
+ }, role: 'rowgroup', children: [vi.totalRowsLoaded >= 0 &&
268
+ showLoadingIndicator &&
269
+ isFetching &&
270
+ loadingIndicatorInfo.isScrollingUp && (_jsx(StyledLoader, { "$style": { bottom: '100%' }, children: _jsx(Progress, { className: 'above-loader', placement: 'block', tabIndex: 0, "aria-label": translate('Loading more results') }) })), children, vi.totalRowsLoaded >= 0 &&
271
+ showLoadingIndicator &&
272
+ isFetching &&
273
+ loadingIndicatorInfo.isScrollingDown && (_jsx(StyledLoader, { "$style": { top: '100%' }, children: _jsx(Progress, { className: 'below-loader', placement: 'block', tabIndex: 0, "aria-label": translate('Loading more results') }) }))] }) }), vi.totalRowsLoaded === 0 && !isFetching
264
274
  ? renderEmptyRecords && renderEmptyRecords()
265
275
  : null, renderFooter && renderFooter()] }));
266
276
  });
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizeInfinite.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/VirtualizeInfinite.jsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,SAAS,EACT,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,iBAAiB,MAAM,cAAc,CAAC;AAC7C,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,WAAW,CAAC;AACnB,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,SAAS,sBAAsB,CAAC,KAAK;IACnC,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;AAChG,CAAC;AAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;;;wBAGX,KAAK,CAAC,E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EAAE,IAAI;CACzB,CAAC;AAEF,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAEtD,eAAe,IAAI,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import {\n forwardRef,\n memo,\n useEffect,\n useRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useLayoutEffect,\n useState\n} from 'react';\nimport Styled from 'styled-components';\nimport PropTypes from 'prop-types';\n\nimport { defaultThemeProp, Progress } from '@pega/cosmos-react-core';\nimport { isEmpty } from 'pega-repeating-structures-core';\n\nimport useTranslate from '../../Hooks/useTranslate';\nimport { StyledSkeletonRow } from '../../Views/Table/SkeletonRows';\n\nimport getPaginationInfo from './Pagination';\nimport useScroll from './UseScroll';\nimport {\n getCurrentEstimation,\n getRecordCountForLayoutPaint,\n getValueWithUnit,\n getMaxHeight,\n isViewNotFilled,\n setAttributesOnItems,\n updateRowContainerTop\n} from './utility';\nimport useResizeObserver from './UseResizeObserver';\n\nfunction getBContainerMinHeight(props) {\n return props.$style.renderFooter ? `calc(100% - ${2 * props.$style.itemHeight + 1}px) ` : '0';\n}\n\nconst StyledPContainer = Styled.div`\n position: relative;\n overflow: auto;\n max-height: ${props => props.$style.maxHeight};\n width: ${props => props.$style.width};\n height: ${props => props.$style.height};\n min-height: ${props => props.$style.minHeight};\n border-radius: inherit;\n\n &:has(${StyledSkeletonRow}) {\n overflow: hidden;\n }\n\n .bContainer {\n position: relative;\n min-height: ${props => getBContainerMinHeight(props)};\n border-radius: inherit;\n }\n`;\n\nStyledPContainer.defaultProps = defaultThemeProp;\n\nconst StyledLoader = Styled.div`\n display: flex;\n justify-content: center;\n padding: 0.5rem;\n position: absolute;\n width: 100%;\n top: ${props => props.$style.top};\n bottom: ${props => props.$style.bottom};\n`;\n\nconst VirtualizeInfinite = forwardRef(\n (\n {\n id,\n viewHeight,\n viewWidth,\n itemHeight,\n callback,\n rowContainerClass,\n children,\n renderHeader,\n renderFooter,\n state,\n bufferMultiplier,\n viewMaxHeight,\n showLoadingIndicator,\n resetCount,\n countUpdateCallback,\n isFetching,\n hasMoreResults,\n renderEmptyRecords\n },\n inputRef\n ) => {\n const rowBuffer = 5;\n\n const [rContainerDimensionUpdate, setRContainerDimensionUpdate] = useState();\n const [loadingIndicatorInfo, setLoadingIndicatorInfo] = useState({});\n const [translate] = useTranslate();\n\n // Create ref to store virtualize related data.\n const vi = useRef({\n itemHeight,\n bufferMultiplier,\n pInfo: {},\n totalRowsLoaded: undefined,\n isInitialized: false\n }).current;\n\n // tracking both state and pInfo.view to identify the initialization as in case of fullscreen, state will be available but pInfo.view won't\n const isInitialized = state && !!Object.keys(vi.pInfo.view ?? {}).length;\n\n const getTotalRowsIncludingBuffer = useCallback(() => {\n if (isEmpty(vi.totalRowsLoaded)) return;\n return hasMoreResults ? vi.totalRowsLoaded + rowBuffer : vi.totalRowsLoaded;\n }, [vi.totalRowsLoaded, hasMoreResults]);\n\n const getRowContainer = useCallback(() => vi.rContainer, [vi.rContainer]);\n const getPContainer = useCallback(() => vi.pContainer, [vi.pContainer]);\n const getBContainer = useCallback(() => vi.bContainer, [vi.bContainer]);\n\n // API used when user want to scroll to top programmatically.\n // Though component auto scroll to top if no element is in view.\n // But calling this API upfront might save one extra call to Fetch API.\n const scrollToTop = useCallback(() => {\n if (!isInitialized) return;\n getPContainer().scrollTop = 0;\n vi.pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n vi,\n false,\n true\n );\n callback({ ...vi.pInfo.view, id }, { takeLatestAction: true });\n }, [id, vi, getPContainer, callback, isInitialized]);\n\n // expose APIs and properties here to help client to communicate.\n useImperativeHandle(inputRef, () => ({\n getParentContainer: getPContainer,\n scrollToTop,\n vi,\n id\n }));\n\n const { width, height } = useMemo(\n () => ({\n width: getValueWithUnit(viewWidth, '100%'),\n height: getValueWithUnit(viewHeight, 'auto')\n }),\n [viewWidth, viewHeight]\n );\n\n const maxHeight = useMemo(() => getMaxHeight(viewMaxHeight), [viewMaxHeight]);\n\n // Calculate the pagination indexes and notify callback.\n // resetIsFetchingWhenNoNewIndexes - flag specific for isViewNotFilled\n // If view is not filled, we want to call this but resting isFetch to false\n // goes to this method when callback is note fired.\n const getPagination = useCallback(\n (isRefresh = false, resetIsFetchingWhenNoNewIndexes = false) => {\n if (!isFetching || resetIsFetchingWhenNoNewIndexes) {\n const pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n vi,\n isRefresh,\n true\n );\n const { startIndex, endIndex } = pInfo.view;\n // if new indexes are subset of existing state indexes, no need to update the consumer.\n if (\n isRefresh ||\n !state ||\n !(startIndex >= state.startIndex && endIndex <= state.endIndex)\n ) {\n vi.pInfo = pInfo;\n if (state) {\n const { startIndex: oldStartIndex, endIndex: oldEndIndex } = state;\n if (startIndex < oldStartIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingUp: true };\n });\n }\n if (endIndex > oldEndIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingDown: true };\n });\n }\n }\n\n callback({ ...vi.pInfo.view, id });\n } else if (resetIsFetchingWhenNoNewIndexes) {\n setLoadingIndicatorInfo({});\n }\n }\n },\n [isFetching, getPContainer, getTotalRowsIncludingBuffer, vi, state, callback, id]\n );\n\n // update average stats for next calculation.\n const updateAvarageInVirtualizeInstance = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight, averageNumberOfItemsInARow, averageRowHeight } =\n currentEstimation;\n Object.assign(vi, {\n itemCount: (itemCount + vi.itemCount || itemCount) / 2,\n rowContainerHeight:\n (rowContainerHeight + vi.rowContainerHeight || rowContainerHeight) / 2,\n averageNumberOfItemsInARow:\n (averageNumberOfItemsInARow + vi.averageNumberOfItemsInARow ||\n averageNumberOfItemsInARow) / 2,\n averageRowHeight: (averageRowHeight + vi.averageRowHeight || averageRowHeight) / 2\n });\n },\n [vi]\n );\n\n const getBufferHeight = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let h = 0;\n if (itemCount > 0)\n h =\n (getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()) / itemCount) *\n rowContainerHeight;\n return h;\n },\n [getTotalRowsIncludingBuffer]\n );\n\n const getScrollTop = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let scrollTop = 0;\n if (itemCount > 0) {\n const scrollNodeTopChange =\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.bufferNewCords?.top - vi.pInfo?.bufferOldCords?.top || 0;\n scrollTop = (vi.pInfo.topRowIndex / itemCount) * rowContainerHeight - scrollNodeTopChange;\n }\n return scrollTop;\n },\n [vi]\n );\n\n const onRowContainerDimensionChange = useCallback(() => {\n const { height: rowContainerHeight, width: rowContainerWidth } =\n getRowContainer()?.getBoundingClientRect() ?? {};\n // trigger virtualizer operations only when row container has some height and width\n if (rowContainerHeight && rowContainerWidth) setRContainerDimensionUpdate({});\n }, [getRowContainer]);\n\n useResizeObserver(getRowContainer, onRowContainerDimensionChange);\n\n const [updateScrollTop] = useScroll(\n getPagination,\n getPContainer,\n vi,\n getTotalRowsIncludingBuffer(),\n renderHeader,\n isFetching,\n viewHeight\n );\n\n useLayoutEffect(() => {\n const rContainer = getRowContainer();\n if (state && state.startIndex >= 0 && vi && rContainer) {\n setAttributesOnItems(state, rContainer);\n }\n });\n\n useLayoutEffect(() => {\n if (isFetching || !isInitialized) return;\n\n const rowElements = Array.from(getRowContainer().children || []).filter(a =>\n a.hasAttribute('data-key')\n );\n if (!rowElements.length) {\n vi.totalRowsLoaded = 0;\n return;\n }\n\n const lastRow = rowElements[rowElements.length - 1];\n const lastRowDataIndex = parseInt(lastRow.getAttribute('data-index'), 10);\n const newCount = hasMoreResults ? lastRowDataIndex + 1 + rowBuffer : lastRowDataIndex + 1;\n\n // if user is scrolling up/down within the already encountered records, the record count shouldn't update\n if (newCount < getTotalRowsIncludingBuffer() && !resetCount) return;\n\n vi.totalRowsLoaded = lastRowDataIndex + 1;\n countUpdateCallback(vi.totalRowsLoaded);\n }, [children, isFetching]);\n\n // Get estimate and update buffer height\n useLayoutEffect(() => {\n if (!isInitialized) return;\n\n vi.currentEstimation = getCurrentEstimation(getRowContainer(), true);\n updateAvarageInVirtualizeInstance(vi.currentEstimation);\n const h = getBufferHeight(vi.currentEstimation);\n getBContainer().style.height = `${h}px`;\n }, [\n vi,\n children,\n rContainerDimensionUpdate,\n getBContainer,\n getBufferHeight,\n getRowContainer,\n getTotalRowsIncludingBuffer,\n updateAvarageInVirtualizeInstance\n ]);\n\n useLayoutEffect(() => {\n if (isFetching || !isInitialized) return;\n\n const pContainer = getPContainer();\n const scrollTop = getScrollTop(vi.currentEstimation);\n if (vi.pInfo.view.startIndex !== 0) pContainer.scrollTop = scrollTop;\n\n // Setting scrollTop from pContainer.scrollTop as getScrollTop can return value with higher decimal accuracy.\n // but scrollTop attribute from HTML element will round it automatically.\n updateScrollTop(pContainer.scrollTop);\n updateRowContainerTop(\n vi,\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n state,\n pContainer,\n pContainer.scrollTop\n );\n }, [\n vi,\n state,\n isFetching,\n getScrollTop,\n getPContainer,\n updateScrollTop,\n getTotalRowsIncludingBuffer\n ]);\n\n // On mount that means state is not initialized yet, trigger pagination.\n // or whenever count changes or width /height of view port changes, if view is not filled with data, get indexes again.\n useEffect(() => {\n if (isFetching) return;\n\n if (!isInitialized) {\n getPagination(true);\n return;\n }\n\n if (\n isViewNotFilled(\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n vi,\n getPContainer(),\n renderHeader\n )\n ) {\n getPagination(false, true);\n } else {\n setLoadingIndicatorInfo({});\n }\n }, [\n vi,\n isFetching,\n children,\n viewWidth,\n viewHeight,\n renderHeader,\n rContainerDimensionUpdate,\n getPagination,\n getPContainer,\n getTotalRowsIncludingBuffer\n ]);\n\n return (\n <StyledPContainer\n $style={{\n maxHeight,\n minHeight: vi.totalRowsLoaded === 0 ? '100px' : 'auto',\n renderFooter,\n itemHeight,\n height,\n width\n }}\n data-total-records={vi.totalRowsLoaded}\n className='pContainer'\n ref={c => {\n vi.pContainer = c;\n }}\n >\n {renderHeader && renderHeader()}\n <div\n className='bContainer'\n ref={c => {\n vi.bContainer = c;\n }}\n >\n <div\n className={`${rowContainerClass} row-container`}\n ref={c => {\n vi.rContainer = c;\n }}\n role='rowgroup'\n >\n {showLoadingIndicator && isFetching && loadingIndicatorInfo.isScrollingUp && (\n <StyledLoader $style={{ bottom: '100%' }}>\n <Progress\n className='above-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n {children}\n {showLoadingIndicator && isFetching && loadingIndicatorInfo.isScrollingDown && (\n <StyledLoader $style={{ top: '100%' }}>\n <Progress\n className='below-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n </div>\n </div>\n {vi.totalRowsLoaded === 0 && !isFetching\n ? renderEmptyRecords && renderEmptyRecords()\n : null}\n {renderFooter && renderFooter()}\n </StyledPContainer>\n );\n }\n);\n\nVirtualizeInfinite.propTypes = {\n id: PropTypes.string.isRequired,\n viewHeight: PropTypes.number,\n viewWidth: PropTypes.number,\n itemHeight: PropTypes.number,\n callback: PropTypes.func,\n isFetching: PropTypes.bool,\n hasMoreResults: PropTypes.bool,\n rowContainerClass: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,\n renderHeader: PropTypes.func,\n renderFooter: PropTypes.func,\n state: PropTypes.shape({\n startIndex: PropTypes.number,\n endIndex: PropTypes.number\n }),\n bufferMultiplier: PropTypes.number,\n viewMaxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n showLoadingIndicator: PropTypes.bool,\n resetCount: PropTypes.bool,\n countUpdateCallback: PropTypes.func,\n renderEmptyRecords: PropTypes.func\n};\n\nVirtualizeInfinite.defaultProps = {\n bufferMultiplier: 2,\n callback: () => {},\n isFetching: false,\n hasMoreResults: false,\n rowContainerClass: '',\n viewWidth: 0,\n itemHeight: 40,\n renderHeader: null,\n renderFooter: null,\n state: undefined,\n viewMaxHeight: undefined,\n showLoadingIndicator: false,\n resetCount: false,\n countUpdateCallback: () => {},\n renderEmptyRecords: null\n};\n\nVirtualizeInfinite.displayName = 'VirtualizeInfinite';\n\nexport default memo(VirtualizeInfinite);\n"]}
1
+ {"version":3,"file":"VirtualizeInfinite.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/VirtualizeInfinite.jsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,SAAS,EACT,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,iBAAiB,MAAM,cAAc,CAAC;AAC7C,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,WAAW,CAAC;AACnB,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,SAAS,sBAAsB,CAAC,KAAK;IACnC,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;AAChG,CAAC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AE,CAAC;IACZ,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,KAAK,EAAE,SAAS;IAChB,aAAa,EAAE,SAAS;IACxB,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE,KAAK;IACjB,mBAAmB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC7B,kBAAkB,EAAE,IAAI;CACzB,CAAC;AAEF,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC;AAEtD,eAAe,IAAI,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import {\n forwardRef,\n memo,\n useEffect,\n useRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useLayoutEffect,\n useState\n} from 'react';\nimport Styled from 'styled-components';\nimport PropTypes from 'prop-types';\n\nimport { defaultThemeProp, Progress } from '@pega/cosmos-react-core';\nimport { isEmpty } from 'pega-repeating-structures-core';\n\nimport useTranslate from '../../Hooks/useTranslate';\nimport { StyledSkeletonRow } from '../../Views/Table/SkeletonRows';\n\nimport getPaginationInfo from './Pagination';\nimport useScroll from './UseScroll';\nimport {\n getCurrentEstimation,\n getRecordCountForLayoutPaint,\n getValueWithUnit,\n getMaxHeight,\n isViewNotFilled,\n setAttributesOnItems,\n updateRowContainerTop\n} from './utility';\nimport useResizeObserver from './UseResizeObserver';\n\nfunction getBContainerMinHeight(props) {\n return props.$style.renderFooter ? `calc(100% - ${2 * props.$style.itemHeight + 1}px) ` : '0';\n}\n\nconst StyledPContainer = Styled.div`\n position: relative;\n overflow: auto;\n max-height: ${props => props.$style.maxHeight};\n width: ${props => props.$style.width};\n height: ${props => props.$style.height};\n min-height: ${props => props.$style.minHeight};\n border-radius: inherit;\n\n &:has(${StyledSkeletonRow}) {\n overflow: hidden;\n }\n\n .bContainer {\n position: relative;\n min-height: ${props => getBContainerMinHeight(props)};\n border-radius: inherit;\n }\n`;\n\nStyledPContainer.defaultProps = defaultThemeProp;\n\nconst StyledLoader = Styled.div`\n display: flex;\n justify-content: center;\n padding: 0.5rem;\n position: absolute;\n width: 100%;\n top: ${props => props.$style.top};\n bottom: ${props => props.$style.bottom};\n`;\n\nconst PAGINATION_TRIGGER_RATIOS = {\n down: 0.9,\n up: 0.1\n};\n\nconst VirtualizeInfinite = forwardRef(\n (\n {\n id,\n viewHeight,\n viewWidth,\n itemHeight,\n callback,\n rowContainerClass,\n children,\n renderHeader,\n renderFooter,\n state,\n bufferMultiplier,\n viewMaxHeight,\n showLoadingIndicator,\n resetCount,\n countUpdateCallback,\n isFetching,\n hasMoreResults,\n renderEmptyRecords\n },\n inputRef\n ) => {\n const rowBuffer = 5;\n\n const [rContainerDimensionUpdate, setRContainerDimensionUpdate] = useState();\n const [loadingIndicatorInfo, setLoadingIndicatorInfo] = useState({});\n const [translate] = useTranslate();\n\n // Create ref to store virtualize related data.\n const vi = useRef({\n itemHeight,\n bufferMultiplier,\n pInfo: {},\n totalRowsLoaded: undefined,\n isInitialized: false\n }).current;\n\n // tracking both state and pInfo.view to identify the initialization as in case of fullscreen, state will be available but pInfo.view won't\n const isInitialized = state && !!Object.keys(vi.pInfo.view ?? {}).length;\n\n const getTotalRowsIncludingBuffer = useCallback(() => {\n if (isEmpty(vi.totalRowsLoaded)) return;\n return hasMoreResults ? vi.totalRowsLoaded + rowBuffer : vi.totalRowsLoaded;\n }, [vi.totalRowsLoaded, hasMoreResults]);\n\n const getRowContainer = useCallback(() => vi.rContainer, [vi.rContainer]);\n const getPContainer = useCallback(() => vi.pContainer, [vi.pContainer]);\n const getBContainer = useCallback(() => vi.bContainer, [vi.bContainer]);\n\n // API used when user want to scroll to top programmatically.\n // Though component auto scroll to top if no element is in view.\n // But calling this API upfront might save one extra call to Fetch API.\n const scrollToTop = useCallback(() => {\n if (!isInitialized) return;\n getPContainer().scrollTop = 0;\n vi.pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n vi,\n false,\n true\n );\n callback({ ...vi.pInfo.view, id }, { takeLatestAction: true });\n }, [id, vi, getPContainer, callback, isInitialized]);\n\n // expose APIs and properties here to help client to communicate.\n useImperativeHandle(inputRef, () => ({\n getParentContainer: getPContainer,\n scrollToTop,\n vi,\n id\n }));\n\n const { width, height } = useMemo(\n () => ({\n width: getValueWithUnit(viewWidth, '100%'),\n height: getValueWithUnit(viewHeight, 'auto')\n }),\n [viewWidth, viewHeight]\n );\n\n const maxHeight = useMemo(() => getMaxHeight(viewMaxHeight), [viewMaxHeight]);\n\n // Calculate the pagination indexes and notify callback.\n // resetIsFetchingWhenNoNewIndexes - flag specific for isViewNotFilled\n // If view is not filled, we want to call this but resting isFetch to false\n // goes to this method when callback is note fired.\n const getPagination = useCallback(\n (isRefresh = false, resetIsFetchingWhenNoNewIndexes = false) => {\n if (!isFetching || resetIsFetchingWhenNoNewIndexes) {\n const pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n vi,\n isRefresh,\n true\n );\n const { startIndex, endIndex } = pInfo.view;\n // if new indexes are subset of existing state indexes, no need to update the consumer.\n if (\n isRefresh ||\n !state ||\n !(startIndex >= state.startIndex && endIndex <= state.endIndex)\n ) {\n vi.pInfo = pInfo;\n if (state) {\n const { startIndex: oldStartIndex, endIndex: oldEndIndex } = state;\n if (startIndex < oldStartIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingUp: true };\n });\n }\n if (endIndex > oldEndIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingDown: true };\n });\n }\n }\n\n callback({ ...vi.pInfo.view, id });\n } else if (resetIsFetchingWhenNoNewIndexes) {\n setLoadingIndicatorInfo({});\n }\n }\n },\n [isFetching, getPContainer, getTotalRowsIncludingBuffer, vi, state, callback, id]\n );\n\n // update average stats for next calculation.\n const updateAvarageInVirtualizeInstance = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight, averageNumberOfItemsInARow, averageRowHeight } =\n currentEstimation;\n Object.assign(vi, {\n itemCount: (itemCount + vi.itemCount || itemCount) / 2,\n rowContainerHeight:\n (rowContainerHeight + vi.rowContainerHeight || rowContainerHeight) / 2,\n averageNumberOfItemsInARow:\n (averageNumberOfItemsInARow + vi.averageNumberOfItemsInARow ||\n averageNumberOfItemsInARow) / 2,\n averageRowHeight: (averageRowHeight + vi.averageRowHeight || averageRowHeight) / 2\n });\n },\n [vi]\n );\n\n const getBufferHeight = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let h = 0;\n if (itemCount > 0)\n h =\n (getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()) / itemCount) *\n rowContainerHeight;\n return h;\n },\n [getTotalRowsIncludingBuffer]\n );\n\n const getScrollTop = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let scrollTop = 0;\n if (itemCount > 0) {\n const scrollNodeTopChange =\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.bufferNewCords?.top - vi.pInfo?.bufferOldCords?.top || 0;\n scrollTop = (vi.pInfo.topRowIndex / itemCount) * rowContainerHeight - scrollNodeTopChange;\n }\n return scrollTop;\n },\n [vi]\n );\n\n const onRowContainerDimensionChange = useCallback(() => {\n const { height: rowContainerHeight, width: rowContainerWidth } =\n getRowContainer()?.getBoundingClientRect() ?? {};\n // trigger virtualizer operations only when row container has some height and width\n if (rowContainerHeight && rowContainerWidth) setRContainerDimensionUpdate({});\n }, [getRowContainer]);\n\n useResizeObserver(getRowContainer, onRowContainerDimensionChange);\n\n const [updateScrollTop] = useScroll(\n getPagination,\n getPContainer,\n vi,\n getTotalRowsIncludingBuffer(),\n renderHeader,\n isFetching,\n viewHeight,\n PAGINATION_TRIGGER_RATIOS\n );\n\n useLayoutEffect(() => {\n const rContainer = getRowContainer();\n if (state && state.startIndex >= 0 && vi && rContainer) {\n setAttributesOnItems(state, rContainer);\n }\n });\n\n useLayoutEffect(() => {\n if (isFetching || !isInitialized) return;\n\n const rowElements = Array.from(getRowContainer().children || []).filter(a =>\n a.hasAttribute('data-key')\n );\n if (!rowElements.length) {\n vi.totalRowsLoaded = 0;\n return;\n }\n\n const lastRow = rowElements[rowElements.length - 1];\n const lastRowDataIndex = parseInt(lastRow.getAttribute('data-index'), 10);\n const newCount = hasMoreResults ? lastRowDataIndex + 1 + rowBuffer : lastRowDataIndex + 1;\n\n // if user is scrolling up/down within the already encountered records, the record count shouldn't update\n if (newCount < getTotalRowsIncludingBuffer() && !resetCount) return;\n\n vi.totalRowsLoaded = lastRowDataIndex + 1;\n countUpdateCallback(vi.totalRowsLoaded);\n }, [children, isFetching]);\n\n // Get estimate and update buffer height\n useLayoutEffect(() => {\n if (!isInitialized) return;\n\n vi.currentEstimation = getCurrentEstimation(getRowContainer(), true);\n updateAvarageInVirtualizeInstance(vi.currentEstimation);\n const h = getBufferHeight(vi.currentEstimation);\n getBContainer().style.height = `${h}px`;\n }, [\n vi,\n children,\n rContainerDimensionUpdate,\n getBContainer,\n getBufferHeight,\n getRowContainer,\n getTotalRowsIncludingBuffer,\n updateAvarageInVirtualizeInstance\n ]);\n\n useLayoutEffect(() => {\n if (isFetching || !isInitialized) return;\n\n const pContainer = getPContainer();\n const scrollTop = getScrollTop(vi.currentEstimation);\n if (vi.pInfo.view.startIndex !== 0) pContainer.scrollTop = scrollTop;\n\n // Setting scrollTop from pContainer.scrollTop as getScrollTop can return value with higher decimal accuracy.\n // but scrollTop attribute from HTML element will round it automatically.\n updateScrollTop(pContainer.scrollTop);\n updateRowContainerTop(\n vi,\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n state,\n pContainer,\n pContainer.scrollTop\n );\n }, [\n vi,\n state,\n isFetching,\n getScrollTop,\n getPContainer,\n updateScrollTop,\n getTotalRowsIncludingBuffer\n ]);\n\n // On mount that means state is not initialized yet, trigger pagination.\n // or whenever count changes or width /height of view port changes, if view is not filled with data, get indexes again.\n useEffect(() => {\n if (isFetching) return;\n\n if (!isInitialized) {\n getPagination(true);\n return;\n }\n\n if (\n isViewNotFilled(\n getRecordCountForLayoutPaint(getTotalRowsIncludingBuffer()),\n vi,\n getPContainer(),\n renderHeader\n )\n ) {\n getPagination(false, true);\n } else {\n setLoadingIndicatorInfo({});\n }\n }, [\n vi,\n isFetching,\n children,\n viewWidth,\n viewHeight,\n renderHeader,\n rContainerDimensionUpdate,\n getPagination,\n getPContainer,\n getTotalRowsIncludingBuffer\n ]);\n\n return (\n <StyledPContainer\n $style={{\n maxHeight,\n minHeight: !vi.totalRowsLoaded ? '100px' : 'auto',\n renderFooter,\n itemHeight,\n height,\n width\n }}\n data-total-records={vi.totalRowsLoaded}\n className='pContainer'\n ref={c => {\n vi.pContainer = c;\n }}\n >\n {renderHeader && renderHeader()}\n <div\n className='bContainer'\n ref={c => {\n vi.bContainer = c;\n }}\n >\n <div\n className={`${rowContainerClass} row-container`}\n ref={c => {\n vi.rContainer = c;\n }}\n role='rowgroup'\n >\n {/* Show loader only when there are some rows otherwise the parent spinner on RS should appear.\n Since in case of infinite table, totalRowsLoaded is derived from the rows only, using totalRowsLoaded here. */}\n {vi.totalRowsLoaded >= 0 &&\n showLoadingIndicator &&\n isFetching &&\n loadingIndicatorInfo.isScrollingUp && (\n <StyledLoader $style={{ bottom: '100%' }}>\n <Progress\n className='above-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n {children}\n {vi.totalRowsLoaded >= 0 &&\n showLoadingIndicator &&\n isFetching &&\n loadingIndicatorInfo.isScrollingDown && (\n <StyledLoader $style={{ top: '100%' }}>\n <Progress\n className='below-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n </div>\n </div>\n {vi.totalRowsLoaded === 0 && !isFetching\n ? renderEmptyRecords && renderEmptyRecords()\n : null}\n {renderFooter && renderFooter()}\n </StyledPContainer>\n );\n }\n);\n\nVirtualizeInfinite.propTypes = {\n id: PropTypes.string.isRequired,\n viewHeight: PropTypes.number,\n viewWidth: PropTypes.number,\n itemHeight: PropTypes.number,\n callback: PropTypes.func,\n isFetching: PropTypes.bool,\n hasMoreResults: PropTypes.bool,\n rowContainerClass: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,\n renderHeader: PropTypes.func,\n renderFooter: PropTypes.func,\n state: PropTypes.shape({\n startIndex: PropTypes.number,\n endIndex: PropTypes.number\n }),\n bufferMultiplier: PropTypes.number,\n viewMaxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n showLoadingIndicator: PropTypes.bool,\n resetCount: PropTypes.bool,\n countUpdateCallback: PropTypes.func,\n renderEmptyRecords: PropTypes.func\n};\n\nVirtualizeInfinite.defaultProps = {\n bufferMultiplier: 2,\n callback: () => {},\n isFetching: false,\n hasMoreResults: false,\n rowContainerClass: '',\n viewWidth: 0,\n itemHeight: 40,\n renderHeader: null,\n renderFooter: null,\n state: undefined,\n viewMaxHeight: undefined,\n showLoadingIndicator: false,\n resetCount: false,\n countUpdateCallback: () => {},\n renderEmptyRecords: null\n};\n\nVirtualizeInfinite.displayName = 'VirtualizeInfinite';\n\nexport default memo(VirtualizeInfinite);\n"]}
@@ -1,4 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * This component is only used for grouped table
4
+ */
2
5
  import { forwardRef, memo, useEffect, useRef, useCallback, useImperativeHandle, useMemo, useLayoutEffect, useState } from 'react';
3
6
  import Styled from 'styled-components';
4
7
  import PropTypes from 'prop-types';
@@ -83,7 +86,7 @@ const Virtualize = forwardRef(({ id, viewHeight, viewWidth, totalRecordCount, it
83
86
  height: getValueWithUnit(viewHeight, 'auto')
84
87
  }), [viewWidth, viewHeight]);
85
88
  const maxHeight = useMemo(() => getMaxHeight(viewMaxHeight), [viewMaxHeight]);
86
- const minHeight = useMemo(() => (totalRecordCount === 0 ? '100px' : 'auto'), [totalRecordCount]);
89
+ const minHeight = useMemo(() => (!totalRecordCount ? '100px' : 'auto'), [totalRecordCount]);
87
90
  // Calculate the pagination indexes and notify callback.
88
91
  // resetIsFetchingWhenNoNewIndexes - flag specific for isViewNotFilled
89
92
  // If view is not filled, we want to call this but restting isFetch to false
@@ -259,12 +262,18 @@ const Virtualize = forwardRef(({ id, viewHeight, viewWidth, totalRecordCount, it
259
262
  vi.pContainer = c;
260
263
  }, children: [renderHeader && renderHeader(), _jsxs("div", { className: 'bContainer', ref: c => {
261
264
  vi.bContainer = c;
262
- }, children: [showLoadingIndicator && isFetching && loadingIndicatorInfo.isScrollingUp && (_jsx(StyledLoader, { "$style": {
265
+ }, children: [totalRecordCount >= 0 &&
266
+ showLoadingIndicator &&
267
+ isFetching &&
268
+ loadingIndicatorInfo.isScrollingUp && (_jsx(StyledLoader, { "$style": {
263
269
  top: '--above-loader-top',
264
270
  left: '--loader-left'
265
271
  }, children: _jsx(Progress, { className: 'above-loader', placement: 'block', tabIndex: 0, "aria-label": translate('Loading more results') }) })), _jsx("div", { className: `${rowContainerClass} row-container`, ref: c => {
266
272
  vi.rContainer = c;
267
- }, role: 'rowgroup', children: totalRecordCount === 0 && !isFetching ? null : children }), showLoadingIndicator && isFetching && loadingIndicatorInfo.isScrollingDown && (_jsx(StyledLoader, { "$style": {
273
+ }, role: 'rowgroup', children: totalRecordCount === 0 && !isFetching ? null : children }), totalRecordCount >= 0 &&
274
+ showLoadingIndicator &&
275
+ isFetching &&
276
+ loadingIndicatorInfo.isScrollingDown && (_jsx(StyledLoader, { "$style": {
268
277
  top: '--below-loader-top',
269
278
  left: '--loader-left'
270
279
  }, children: _jsx(Progress, { className: 'below-loader', placement: 'block', tabIndex: 0, "aria-label": translate('Loading more results') }) }))] }), totalRecordCount === 0 ? renderEmptyRecords && renderEmptyRecords() : null, renderFooter && renderFooter()] }));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/index.jsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAA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Effect,\n useRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useLayoutEffect,\n useState\n} from 'react';\nimport Styled from 'styled-components';\nimport PropTypes from 'prop-types';\n\nimport { defaultThemeProp, Progress } from '@pega/cosmos-react-core';\nimport { isEmpty } from 'pega-repeating-structures-core';\n\nimport useTranslate from '../../Hooks/useTranslate';\nimport { StyledSkeletonRow } from '../../Views/Table/SkeletonRows';\n\nimport getPaginationInfo from './Pagination';\nimport useScroll from './UseScroll';\nimport {\n getCurrentEstimation,\n updateRowContainerTop,\n setAttributesOnItems,\n isViewNotFilled,\n getRecordCountForLayoutPaint,\n getValueWithUnit,\n getMaxHeight,\n getPContainerClientWidth\n} from './utility';\nimport useResizeObserver from './UseResizeObserver';\n\nfunction getBContainerMinHeight(props) {\n return props.$style.renderFooter ? `calc(100% - ${2 * props.$style.itemHeight + 1}px) ` : '0';\n}\n\nconst StyledPContainer = Styled.div`\n position: relative;\n overflow: auto;\n max-height: ${props => props.$style.maxHeight};\n width: ${props => props.$style.width};\n height: ${props => props.$style.height};\n min-height: ${props => props.$style.minHeight};\n\n &:has(${StyledSkeletonRow}) {\n overflow: hidden;\n }\n\n /**\n * When height and maxHeight is auto, virtualization is not going to happen and the scroll jump on row deletion scenario is not going to happen.\n * In such cases, using relative position as sticky was used to fix scroll jump in firefox during virtualization.\n */\n .bContainer {\n position: ${props =>\n props.$style.maxHeight?.startsWith?.('auto') &&\n props.$style.height?.startsWith?.('auto')\n ? 'relative'\n : 'sticky'};\n min-height: ${props => getBContainerMinHeight(props)};\n border-radius: inherit;\n }\n`;\n\nStyledPContainer.defaultProps = defaultThemeProp;\n\nconst StyledLoader = Styled.div`\n display: flex;\n justify-content: center;\n padding: 0.5rem;\n position: absolute;\n width: 100%;\n left: ${props => `var(${props.$style.left})`};\n top: ${props => `var(${props.$style.top})`};\n`;\n\nconst Virtualize = forwardRef(\n (\n {\n id,\n viewHeight,\n viewWidth,\n totalRecordCount,\n itemHeight,\n callback,\n isFetching,\n rowContainerClass,\n children,\n renderHeader,\n renderFooter,\n state,\n bufferMultiplier,\n viewMaxHeight,\n showLoadingIndicator,\n renderEmptyRecords\n },\n inputRef\n ) => {\n const [rContainerDimensionUpdate, setRContainerDimensionUpdate] = useState();\n const [loadingIndicatorInfo, setLoadingIndicatorInfo] = useState({});\n const [translate] = useTranslate();\n // Create ref to store virtualize related data.\n const vi = useRef({\n itemHeight,\n bufferMultiplier,\n pInfo: {}\n }).current;\n\n const getRowContainer = useCallback(() => vi.rContainer, [vi.rContainer]);\n const getPContainer = useCallback(() => vi.pContainer, [vi.pContainer]);\n const getBContainer = useCallback(() => vi.bContainer, [vi.bContainer]);\n\n // API used when user want to scroll to top programmatically.\n // Though component auto scroll to top if no element is in view.\n // But calling this API upfront might save one extra call to Fetch API.\n const scrollToTop = useCallback(() => {\n if (!state) return;\n getPContainer().scrollTop = 0;\n vi.pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(totalRecordCount),\n vi,\n false,\n true\n );\n callback({ ...vi.pInfo.view, id }, { takeLatestAction: true });\n }, [id, vi, state, getPContainer]);\n\n // expose APIs and properties here to help client to communicate.\n useImperativeHandle(inputRef, () => ({\n getParentContainer: getPContainer,\n scrollToTop,\n vi,\n id\n }));\n\n const { width, height } = useMemo(\n () => ({\n width: getValueWithUnit(viewWidth, '100%'),\n height: getValueWithUnit(viewHeight, 'auto')\n }),\n [viewWidth, viewHeight]\n );\n\n const maxHeight = useMemo(() => getMaxHeight(viewMaxHeight), [viewMaxHeight]);\n\n const minHeight = useMemo(\n () => (totalRecordCount === 0 ? '100px' : 'auto'),\n [totalRecordCount]\n );\n\n // Calculate the pagination indexes and notify callback.\n // resetIsFetchingWhenNoNewIndexes - flag specific for isViewNotFilled\n // If view is not filled, we want to call this but restting isFetch to false\n // goes to this methid when callback is note fired.\n const getPagination = useCallback(\n (isRefresh = false, resetIsFetchingWhenNoNewIndexes = false) => {\n if (resetIsFetchingWhenNoNewIndexes) {\n setLoadingIndicatorInfo({});\n }\n const pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(totalRecordCount),\n vi,\n isRefresh\n );\n const { startIndex, endIndex } = pInfo.view;\n // if new indexes are subset of existing state indexes, no need to update the consumer.\n if (!state || !(startIndex >= state.startIndex && endIndex <= state.endIndex)) {\n vi.pInfo = pInfo;\n if (state) {\n const { startIndex: oldStartIndex, endIndex: oldEndIndex } = state;\n if (startIndex < oldStartIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingUp: true };\n });\n }\n if (endIndex > oldEndIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingDown: true };\n });\n }\n }\n callback({ ...vi.pInfo.view, id }, { takeLatestAction: true });\n }\n },\n [vi, totalRecordCount, state, callback, id, getPContainer]\n );\n\n // update average stats for next calculation.\n const updateAverageInVirtualizeInstance = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight, averageNumberOfItemsInARow, averageRowHeight } =\n currentEstimation;\n Object.assign(vi, {\n itemCount: (itemCount + vi.itemCount || itemCount) / 2,\n rowContainerHeight:\n (rowContainerHeight + vi.rowContainerHeight || rowContainerHeight) / 2,\n averageNumberOfItemsInARow:\n (averageNumberOfItemsInARow + vi.averageNumberOfItemsInARow ||\n averageNumberOfItemsInARow) / 2,\n averageRowHeight: (averageRowHeight + vi.averageRowHeight || averageRowHeight) / 2\n });\n },\n [vi]\n );\n\n const getBufferHeight = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let h = 0;\n if (itemCount > 0)\n h = (getRecordCountForLayoutPaint(totalRecordCount) / itemCount) * rowContainerHeight;\n return h;\n },\n [totalRecordCount]\n );\n\n const getScrollTop = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let scrollTop = 0;\n if (itemCount > 0) {\n const scrollNodeTopChange =\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.bufferNewCords?.top - vi.pInfo?.bufferOldCords?.top || 0;\n scrollTop = (vi.pInfo.topRowIndex / itemCount) * rowContainerHeight - scrollNodeTopChange;\n }\n return scrollTop;\n },\n [vi]\n );\n\n const onRowContainerDimensionChange = useCallback(() => {\n const { height: rowContainerHeight, width: rowContainerWidth } =\n getRowContainer()?.getBoundingClientRect() ?? {};\n\n // trigger virtualizer operations only when row container has some height and width\n if (rowContainerHeight && rowContainerWidth) setRContainerDimensionUpdate({});\n }, [getRowContainer]);\n\n // observe on row container to adjust the buffer container height.\n useResizeObserver(getRowContainer, onRowContainerDimensionChange);\n\n const [updateScrollTop] = useScroll(\n getPagination,\n getPContainer,\n vi,\n totalRecordCount,\n renderHeader,\n isFetching,\n viewHeight\n );\n\n useLayoutEffect(() => {\n const rContainer = getRowContainer();\n if (state && state.startIndex >= 0 && vi && rContainer) {\n setAttributesOnItems(state, rContainer);\n }\n });\n\n // Get estimate and update buffer height\n useLayoutEffect(() => {\n if (state && !isEmpty(totalRecordCount)) {\n vi.currentEstimation = getCurrentEstimation(getRowContainer());\n updateAverageInVirtualizeInstance(vi.currentEstimation);\n const h = Math.floor(getBufferHeight(vi.currentEstimation));\n const previousHeight = getBContainer().offsetHeight;\n\n getBContainer().style.height = `${h}px`;\n vi.bContainerHeight = h;\n\n // if there was no previous height, then keep the scrolltop to 0 by default\n if (h !== previousHeight && previousHeight) {\n const pContainer = getPContainer();\n const scrollTop = getScrollTop(vi.currentEstimation);\n if (scrollTop >= 0) {\n pContainer.scrollTop = scrollTop;\n }\n }\n }\n }, [\n rContainerDimensionUpdate,\n getBContainer,\n getBufferHeight,\n getRowContainer,\n state,\n totalRecordCount,\n updateAverageInVirtualizeInstance,\n vi,\n getPContainer,\n getScrollTop\n ]);\n\n // update parent scroll top and row container top.\n useLayoutEffect(() => {\n if (state && !isEmpty(totalRecordCount)) {\n const pContainer = getPContainer();\n\n // Setting scrollTop from pContainer.scrollTop as getScrollTop can return value with higher decimal accuracy.\n // but scrollTop attribute from HTML element will round it automatically.\n updateScrollTop(pContainer.scrollTop);\n updateRowContainerTop(\n vi,\n getRecordCountForLayoutPaint(totalRecordCount),\n state,\n pContainer,\n pContainer.scrollTop\n );\n\n const topLoaderHeight = 80;\n let top = getRowContainer().style.top;\n if (!top) {\n top = 0;\n }\n getBContainer().style.setProperty(\n '--above-loader-top',\n `${parseInt(top, 10) - topLoaderHeight}px`\n );\n\n getBContainer().style.setProperty(\n '--below-loader-top',\n `${parseInt(top, 10) + getRowContainer().offsetHeight}px`\n );\n }\n }, [\n getPContainer,\n getScrollTop,\n state,\n updateScrollTop,\n vi,\n rContainerDimensionUpdate,\n totalRecordCount,\n getRowContainer,\n getBContainer\n ]);\n\n // Added this block to overcome clipping issue for group header.\n const onPContainerDimensionUpdate = useCallback(() => {\n getPContainer()?.style.setProperty(\n '--container-width',\n `${getPContainerClientWidth(getPContainer())}px`\n );\n }, [getPContainer]);\n\n // observe on pContainer to adjust the width of row container.\n useResizeObserver(getPContainer, onPContainerDimensionUpdate);\n\n // On mount that means state is not initialized yet, trigger pagination.\n // or whenever count changes or width /height of view port changes, if view is not filled with data, get indexes again.\n useEffect(() => {\n if (state && !isFetching && !isEmpty(totalRecordCount)) {\n if (\n isViewNotFilled(\n getRecordCountForLayoutPaint(totalRecordCount),\n vi,\n getPContainer(),\n renderHeader\n )\n )\n getPagination(false, true);\n else {\n setLoadingIndicatorInfo({});\n }\n } else if (!state || !Object.keys(vi.pInfo).length) getPagination(true);\n }, [\n rContainerDimensionUpdate,\n state,\n vi,\n totalRecordCount,\n viewHeight,\n viewWidth,\n renderHeader,\n getPagination,\n getPContainer\n ]);\n\n useEffect(() => {\n if (!isFetching) return;\n getBContainer().style.setProperty('--loader-left', `${getPContainer().scrollLeft}px`);\n }, [isFetching, getPContainer()?.scrollLeft]);\n\n return (\n <StyledPContainer\n $style={{\n maxHeight,\n minHeight,\n renderFooter,\n itemHeight,\n height,\n width\n }}\n data-total-records={totalRecordCount}\n className='pContainer'\n ref={c => {\n vi.pContainer = c;\n }}\n >\n {renderHeader && renderHeader()}\n <div\n className='bContainer'\n ref={c => {\n vi.bContainer = c;\n }}\n >\n {showLoadingIndicator && isFetching && loadingIndicatorInfo.isScrollingUp && (\n <StyledLoader\n $style={{\n top: '--above-loader-top',\n left: '--loader-left'\n }}\n >\n <Progress\n className='above-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n <div\n className={`${rowContainerClass} row-container`}\n ref={c => {\n vi.rContainer = c;\n }}\n role='rowgroup'\n >\n {/** Do not add any other element in row-container apart from the rows as it will generate incorrect estimations */}\n {totalRecordCount === 0 && !isFetching ? null : children}\n </div>\n {showLoadingIndicator && isFetching && loadingIndicatorInfo.isScrollingDown && (\n <StyledLoader\n $style={{\n top: '--below-loader-top',\n left: '--loader-left'\n }}\n >\n <Progress\n className='below-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n </div>\n {totalRecordCount === 0 ? renderEmptyRecords && renderEmptyRecords() : null}\n {renderFooter && renderFooter()}\n </StyledPContainer>\n );\n }\n);\n\nVirtualize.propTypes = {\n id: PropTypes.string.isRequired,\n viewHeight: PropTypes.number,\n viewWidth: PropTypes.number,\n totalRecordCount: PropTypes.number,\n itemHeight: PropTypes.number,\n callback: PropTypes.func,\n isFetching: PropTypes.bool,\n rowContainerClass: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,\n renderHeader: PropTypes.func,\n renderFooter: PropTypes.func,\n state: PropTypes.shape({\n startIndex: PropTypes.number,\n endIndex: PropTypes.number\n }),\n bufferMultiplier: PropTypes.number,\n viewMaxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n showLoadingIndicator: PropTypes.bool,\n renderEmptyRecords: PropTypes.func\n};\n\nVirtualize.defaultProps = {\n bufferMultiplier: 2,\n callback: () => {},\n isFetching: false,\n rowContainerClass: '',\n viewWidth: 0,\n itemHeight: 40,\n renderHeader: null,\n renderFooter: null,\n state: undefined,\n totalRecordCount: undefined,\n viewMaxHeight: undefined,\n showLoadingIndicator: false,\n renderEmptyRecords: null\n};\n\nVirtualize.displayName = 'Virtualize';\n\nexport default memo(Virtualize);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/index.jsx"],"names":[],"mappings":";AAAA;;GAEG;AAEH,OAAO,EACL,UAAU,EACV,IAAI,EACJ,SAAS,EACT,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,iBAAiB,MAAM,cAAc,CAAC;AAC7C,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,4BAA4B,EAC5B,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACzB,MAAM,WAAW,CAAC;AACnB,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,SAAS,sBAAsB,CAAC,KAAK;IACnC,OAAO,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;AAChG,CAAC;AAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;;;wBAGX,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS;m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YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,KAAK,EAAE,SAAS;IAChB,gBAAgB,EAAE,SAAS;IAC3B,aAAa,EAAE,SAAS;IACxB,oBAAoB,EAAE,KAAK;IAC3B,kBAAkB,EAAE,IAAI;CACzB,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAEtC,eAAe,IAAI,CAAC,UAAU,CAAC,CAAC","sourcesContent":["/**\n * This component is only used for grouped table\n */\n\nimport {\n forwardRef,\n memo,\n useEffect,\n useRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useLayoutEffect,\n useState\n} from 'react';\nimport Styled from 'styled-components';\nimport PropTypes from 'prop-types';\n\nimport { defaultThemeProp, Progress } from '@pega/cosmos-react-core';\nimport { isEmpty } from 'pega-repeating-structures-core';\n\nimport useTranslate from '../../Hooks/useTranslate';\nimport { StyledSkeletonRow } from '../../Views/Table/SkeletonRows';\n\nimport getPaginationInfo from './Pagination';\nimport useScroll from './UseScroll';\nimport {\n getCurrentEstimation,\n updateRowContainerTop,\n setAttributesOnItems,\n isViewNotFilled,\n getRecordCountForLayoutPaint,\n getValueWithUnit,\n getMaxHeight,\n getPContainerClientWidth\n} from './utility';\nimport useResizeObserver from './UseResizeObserver';\n\nfunction getBContainerMinHeight(props) {\n return props.$style.renderFooter ? `calc(100% - ${2 * props.$style.itemHeight + 1}px) ` : '0';\n}\n\nconst StyledPContainer = Styled.div`\n position: relative;\n overflow: auto;\n max-height: ${props => props.$style.maxHeight};\n width: ${props => props.$style.width};\n height: ${props => props.$style.height};\n min-height: ${props => props.$style.minHeight};\n\n &:has(${StyledSkeletonRow}) {\n overflow: hidden;\n }\n\n /**\n * When height and maxHeight is auto, virtualization is not going to happen and the scroll jump on row deletion scenario is not going to happen.\n * In such cases, using relative position as sticky was used to fix scroll jump in firefox during virtualization.\n */\n .bContainer {\n position: ${props =>\n props.$style.maxHeight?.startsWith?.('auto') &&\n props.$style.height?.startsWith?.('auto')\n ? 'relative'\n : 'sticky'};\n min-height: ${props => getBContainerMinHeight(props)};\n border-radius: inherit;\n }\n`;\n\nStyledPContainer.defaultProps = defaultThemeProp;\n\nconst StyledLoader = Styled.div`\n display: flex;\n justify-content: center;\n padding: 0.5rem;\n position: absolute;\n width: 100%;\n left: ${props => `var(${props.$style.left})`};\n top: ${props => `var(${props.$style.top})`};\n`;\n\nconst Virtualize = forwardRef(\n (\n {\n id,\n viewHeight,\n viewWidth,\n totalRecordCount,\n itemHeight,\n callback,\n isFetching,\n rowContainerClass,\n children,\n renderHeader,\n renderFooter,\n state,\n bufferMultiplier,\n viewMaxHeight,\n showLoadingIndicator,\n renderEmptyRecords\n },\n inputRef\n ) => {\n const [rContainerDimensionUpdate, setRContainerDimensionUpdate] = useState();\n const [loadingIndicatorInfo, setLoadingIndicatorInfo] = useState({});\n const [translate] = useTranslate();\n // Create ref to store virtualize related data.\n const vi = useRef({\n itemHeight,\n bufferMultiplier,\n pInfo: {}\n }).current;\n\n const getRowContainer = useCallback(() => vi.rContainer, [vi.rContainer]);\n const getPContainer = useCallback(() => vi.pContainer, [vi.pContainer]);\n const getBContainer = useCallback(() => vi.bContainer, [vi.bContainer]);\n\n // API used when user want to scroll to top programmatically.\n // Though component auto scroll to top if no element is in view.\n // But calling this API upfront might save one extra call to Fetch API.\n const scrollToTop = useCallback(() => {\n if (!state) return;\n getPContainer().scrollTop = 0;\n vi.pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(totalRecordCount),\n vi,\n false,\n true\n );\n callback({ ...vi.pInfo.view, id }, { takeLatestAction: true });\n }, [id, vi, state, getPContainer]);\n\n // expose APIs and properties here to help client to communicate.\n useImperativeHandle(inputRef, () => ({\n getParentContainer: getPContainer,\n scrollToTop,\n vi,\n id\n }));\n\n const { width, height } = useMemo(\n () => ({\n width: getValueWithUnit(viewWidth, '100%'),\n height: getValueWithUnit(viewHeight, 'auto')\n }),\n [viewWidth, viewHeight]\n );\n\n const maxHeight = useMemo(() => getMaxHeight(viewMaxHeight), [viewMaxHeight]);\n\n const minHeight = useMemo(() => (!totalRecordCount ? '100px' : 'auto'), [totalRecordCount]);\n\n // Calculate the pagination indexes and notify callback.\n // resetIsFetchingWhenNoNewIndexes - flag specific for isViewNotFilled\n // If view is not filled, we want to call this but restting isFetch to false\n // goes to this methid when callback is note fired.\n const getPagination = useCallback(\n (isRefresh = false, resetIsFetchingWhenNoNewIndexes = false) => {\n if (resetIsFetchingWhenNoNewIndexes) {\n setLoadingIndicatorInfo({});\n }\n const pInfo = getPaginationInfo(\n getPContainer(),\n getRecordCountForLayoutPaint(totalRecordCount),\n vi,\n isRefresh\n );\n const { startIndex, endIndex } = pInfo.view;\n // if new indexes are subset of existing state indexes, no need to update the consumer.\n if (!state || !(startIndex >= state.startIndex && endIndex <= state.endIndex)) {\n vi.pInfo = pInfo;\n if (state) {\n const { startIndex: oldStartIndex, endIndex: oldEndIndex } = state;\n if (startIndex < oldStartIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingUp: true };\n });\n }\n if (endIndex > oldEndIndex) {\n setLoadingIndicatorInfo(info => {\n return { ...info, isScrollingDown: true };\n });\n }\n }\n callback({ ...vi.pInfo.view, id }, { takeLatestAction: true });\n }\n },\n [vi, totalRecordCount, state, callback, id, getPContainer]\n );\n\n // update average stats for next calculation.\n const updateAverageInVirtualizeInstance = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight, averageNumberOfItemsInARow, averageRowHeight } =\n currentEstimation;\n Object.assign(vi, {\n itemCount: (itemCount + vi.itemCount || itemCount) / 2,\n rowContainerHeight:\n (rowContainerHeight + vi.rowContainerHeight || rowContainerHeight) / 2,\n averageNumberOfItemsInARow:\n (averageNumberOfItemsInARow + vi.averageNumberOfItemsInARow ||\n averageNumberOfItemsInARow) / 2,\n averageRowHeight: (averageRowHeight + vi.averageRowHeight || averageRowHeight) / 2\n });\n },\n [vi]\n );\n\n const getBufferHeight = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let h = 0;\n if (itemCount > 0)\n h = (getRecordCountForLayoutPaint(totalRecordCount) / itemCount) * rowContainerHeight;\n return h;\n },\n [totalRecordCount]\n );\n\n const getScrollTop = useCallback(\n currentEstimation => {\n const { itemCount, rowContainerHeight } = currentEstimation;\n let scrollTop = 0;\n if (itemCount > 0) {\n const scrollNodeTopChange =\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.bufferNewCords?.top - vi.pInfo?.bufferOldCords?.top || 0;\n scrollTop = (vi.pInfo.topRowIndex / itemCount) * rowContainerHeight - scrollNodeTopChange;\n }\n return scrollTop;\n },\n [vi]\n );\n\n const onRowContainerDimensionChange = useCallback(() => {\n const { height: rowContainerHeight, width: rowContainerWidth } =\n getRowContainer()?.getBoundingClientRect() ?? {};\n\n // trigger virtualizer operations only when row container has some height and width\n if (rowContainerHeight && rowContainerWidth) setRContainerDimensionUpdate({});\n }, [getRowContainer]);\n\n // observe on row container to adjust the buffer container height.\n useResizeObserver(getRowContainer, onRowContainerDimensionChange);\n\n const [updateScrollTop] = useScroll(\n getPagination,\n getPContainer,\n vi,\n totalRecordCount,\n renderHeader,\n isFetching,\n viewHeight\n );\n\n useLayoutEffect(() => {\n const rContainer = getRowContainer();\n if (state && state.startIndex >= 0 && vi && rContainer) {\n setAttributesOnItems(state, rContainer);\n }\n });\n\n // Get estimate and update buffer height\n useLayoutEffect(() => {\n if (state && !isEmpty(totalRecordCount)) {\n vi.currentEstimation = getCurrentEstimation(getRowContainer());\n updateAverageInVirtualizeInstance(vi.currentEstimation);\n const h = Math.floor(getBufferHeight(vi.currentEstimation));\n const previousHeight = getBContainer().offsetHeight;\n\n getBContainer().style.height = `${h}px`;\n vi.bContainerHeight = h;\n\n // if there was no previous height, then keep the scrolltop to 0 by default\n if (h !== previousHeight && previousHeight) {\n const pContainer = getPContainer();\n const scrollTop = getScrollTop(vi.currentEstimation);\n if (scrollTop >= 0) {\n pContainer.scrollTop = scrollTop;\n }\n }\n }\n }, [\n rContainerDimensionUpdate,\n getBContainer,\n getBufferHeight,\n getRowContainer,\n state,\n totalRecordCount,\n updateAverageInVirtualizeInstance,\n vi,\n getPContainer,\n getScrollTop\n ]);\n\n // update parent scroll top and row container top.\n useLayoutEffect(() => {\n if (state && !isEmpty(totalRecordCount)) {\n const pContainer = getPContainer();\n\n // Setting scrollTop from pContainer.scrollTop as getScrollTop can return value with higher decimal accuracy.\n // but scrollTop attribute from HTML element will round it automatically.\n updateScrollTop(pContainer.scrollTop);\n updateRowContainerTop(\n vi,\n getRecordCountForLayoutPaint(totalRecordCount),\n state,\n pContainer,\n pContainer.scrollTop\n );\n\n const topLoaderHeight = 80;\n let top = getRowContainer().style.top;\n if (!top) {\n top = 0;\n }\n getBContainer().style.setProperty(\n '--above-loader-top',\n `${parseInt(top, 10) - topLoaderHeight}px`\n );\n\n getBContainer().style.setProperty(\n '--below-loader-top',\n `${parseInt(top, 10) + getRowContainer().offsetHeight}px`\n );\n }\n }, [\n getPContainer,\n getScrollTop,\n state,\n updateScrollTop,\n vi,\n rContainerDimensionUpdate,\n totalRecordCount,\n getRowContainer,\n getBContainer\n ]);\n\n // Added this block to overcome clipping issue for group header.\n const onPContainerDimensionUpdate = useCallback(() => {\n getPContainer()?.style.setProperty(\n '--container-width',\n `${getPContainerClientWidth(getPContainer())}px`\n );\n }, [getPContainer]);\n\n // observe on pContainer to adjust the width of row container.\n useResizeObserver(getPContainer, onPContainerDimensionUpdate);\n\n // On mount that means state is not initialized yet, trigger pagination.\n // or whenever count changes or width /height of view port changes, if view is not filled with data, get indexes again.\n useEffect(() => {\n if (state && !isFetching && !isEmpty(totalRecordCount)) {\n if (\n isViewNotFilled(\n getRecordCountForLayoutPaint(totalRecordCount),\n vi,\n getPContainer(),\n renderHeader\n )\n )\n getPagination(false, true);\n else {\n setLoadingIndicatorInfo({});\n }\n } else if (!state || !Object.keys(vi.pInfo).length) getPagination(true);\n }, [\n rContainerDimensionUpdate,\n state,\n vi,\n totalRecordCount,\n viewHeight,\n viewWidth,\n renderHeader,\n getPagination,\n getPContainer\n ]);\n\n useEffect(() => {\n if (!isFetching) return;\n getBContainer().style.setProperty('--loader-left', `${getPContainer().scrollLeft}px`);\n }, [isFetching, getPContainer()?.scrollLeft]);\n\n return (\n <StyledPContainer\n $style={{\n maxHeight,\n minHeight,\n renderFooter,\n itemHeight,\n height,\n width\n }}\n data-total-records={totalRecordCount}\n className='pContainer'\n ref={c => {\n vi.pContainer = c;\n }}\n >\n {renderHeader && renderHeader()}\n <div\n className='bContainer'\n ref={c => {\n vi.bContainer = c;\n }}\n >\n {/* Show loader only when there are some rows otherwise the parent spinner on RS should appear.\n Since in case of grouped table, presence of totalRecordsCount is always available and is tied with the rows, using totalRecordsCount here. */}\n {totalRecordCount >= 0 &&\n showLoadingIndicator &&\n isFetching &&\n loadingIndicatorInfo.isScrollingUp && (\n <StyledLoader\n $style={{\n top: '--above-loader-top',\n left: '--loader-left'\n }}\n >\n <Progress\n className='above-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n <div\n className={`${rowContainerClass} row-container`}\n ref={c => {\n vi.rContainer = c;\n }}\n role='rowgroup'\n >\n {/** Do not add any other element in row-container apart from the rows as it will generate incorrect estimations */}\n {totalRecordCount === 0 && !isFetching ? null : children}\n </div>\n {totalRecordCount >= 0 &&\n showLoadingIndicator &&\n isFetching &&\n loadingIndicatorInfo.isScrollingDown && (\n <StyledLoader\n $style={{\n top: '--below-loader-top',\n left: '--loader-left'\n }}\n >\n <Progress\n className='below-loader'\n placement='block'\n tabIndex={0}\n aria-label={translate('Loading more results')}\n />\n </StyledLoader>\n )}\n </div>\n {totalRecordCount === 0 ? renderEmptyRecords && renderEmptyRecords() : null}\n {renderFooter && renderFooter()}\n </StyledPContainer>\n );\n }\n);\n\nVirtualize.propTypes = {\n id: PropTypes.string.isRequired,\n viewHeight: PropTypes.number,\n viewWidth: PropTypes.number,\n totalRecordCount: PropTypes.number,\n itemHeight: PropTypes.number,\n callback: PropTypes.func,\n isFetching: PropTypes.bool,\n rowContainerClass: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,\n renderHeader: PropTypes.func,\n renderFooter: PropTypes.func,\n state: PropTypes.shape({\n startIndex: PropTypes.number,\n endIndex: PropTypes.number\n }),\n bufferMultiplier: PropTypes.number,\n viewMaxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n showLoadingIndicator: PropTypes.bool,\n renderEmptyRecords: PropTypes.func\n};\n\nVirtualize.defaultProps = {\n bufferMultiplier: 2,\n callback: () => {},\n isFetching: false,\n rowContainerClass: '',\n viewWidth: 0,\n itemHeight: 40,\n renderHeader: null,\n renderFooter: null,\n state: undefined,\n totalRecordCount: undefined,\n viewMaxHeight: undefined,\n showLoadingIndicator: false,\n renderEmptyRecords: null\n};\n\nVirtualize.displayName = 'Virtualize';\n\nexport default memo(Virtualize);\n"]}
@@ -1,4 +1,4 @@
1
1
  import type { GalleryCardProps } from '../Gallery.types';
2
- declare const GalleryCard: import("react").MemoExoticComponent<({ headerColumn, actionColumn, row, meta, visibleColumns }: GalleryCardProps) => import("react/jsx-runtime").JSX.Element>;
2
+ declare const GalleryCard: import("react").MemoExoticComponent<({ headerColumn, row, meta, visibleColumns }: GalleryCardProps) => import("react/jsx-runtime").JSX.Element>;
3
3
  export default GalleryCard;
4
4
  //# sourceMappingURL=GalleryCard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GalleryCard.d.ts","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,QAAA,MAAM,WAAW,kGAC6C,gBAAgB,6CAW7E,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"GalleryCard.d.ts","sourceRoot":"","sources":["../../../../../Core/Views/Gallery/Components/GalleryCard.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,QAAA,MAAM,WAAW,oFAAsD,gBAAgB,6CA0BrF,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -1,16 +1,18 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
3
  import { SelectionCardDisplay } from '@pega/cosmos-react-core';
4
- import { getCardData } from '../utils';
5
- const GalleryCard = memo(({ headerColumn, actionColumn, row, meta, visibleColumns }) => {
6
- const { label, image, fields } = getCardData({
4
+ import { getCardData, getCardUIProps } from '../utils';
5
+ import useRowActions from '../hooks/useRowActions';
6
+ const GalleryCard = memo(({ headerColumn, row, meta, visibleColumns }) => {
7
+ const { label, image, fields, 'aria-label': ariaLabel } = getCardData({
7
8
  row,
8
9
  visibleColumns,
9
10
  meta,
10
- headerColumn,
11
- actionColumn
11
+ headerColumn
12
12
  });
13
- return _jsx(SelectionCardDisplay, { label: label, image: image, fields: fields });
13
+ const uiProps = getCardUIProps({ row });
14
+ const fetchActionsCb = useRowActions({ row, meta });
15
+ return (_jsx(SelectionCardDisplay, { "aria-label": ariaLabel, label: label, image: image, fields: fields, actions: fetchActionsCb, ...uiProps }));
14
16
  });
15
17
  export default GalleryCard;
16
18
  //# sourceMappingURL=GalleryCard.js.map