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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/lib/Core/Components/ContextMenu/ContextMenuContainer.d.ts.map +1 -1
  2. package/lib/Core/Components/ContextMenu/ContextMenuContainer.js +4 -2
  3. package/lib/Core/Components/ContextMenu/ContextMenuContainer.js.map +1 -1
  4. package/lib/Core/Components/Grouping/GroupingMenu.js +1 -1
  5. package/lib/Core/Components/Grouping/GroupingMenu.js.map +1 -1
  6. package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.js +1 -1
  7. package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.js.map +1 -1
  8. package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.js +1 -1
  9. package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.js.map +1 -1
  10. package/lib/Core/Components/Toolbar/hooks/useSort/Row.js +1 -1
  11. package/lib/Core/Components/Toolbar/hooks/useSort/Row.js.map +1 -1
  12. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.d.ts +97 -0
  13. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.d.ts.map +1 -0
  14. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.js +249 -0
  15. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.js.map +1 -0
  16. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.d.ts +22 -0
  17. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.d.ts.map +1 -0
  18. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.js +38 -0
  19. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.js.map +1 -0
  20. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.d.ts +22 -0
  21. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.d.ts.map +1 -0
  22. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.js +45 -0
  23. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.js.map +1 -0
  24. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.d.ts +49 -0
  25. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.d.ts.map +1 -0
  26. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.js +55 -0
  27. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.js.map +1 -0
  28. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.d.ts +21 -0
  29. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.d.ts.map +1 -0
  30. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.js +39 -0
  31. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.js.map +1 -0
  32. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.d.ts +38 -0
  33. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.d.ts.map +1 -0
  34. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.js +62 -0
  35. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.js.map +1 -0
  36. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.d.ts +112 -0
  37. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.d.ts.map +1 -0
  38. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.js +213 -0
  39. package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.js.map +1 -0
  40. package/lib/Core/Components/Virtualise/utility.d.ts +1 -1
  41. package/lib/Core/Components/Virtualise/utility.d.ts.map +1 -1
  42. package/lib/Core/Components/Virtualise/utility.js +3 -2
  43. package/lib/Core/Components/Virtualise/utility.js.map +1 -1
  44. package/lib/Core/Hooks/useDragDrop.d.ts.map +1 -1
  45. package/lib/Core/Hooks/useDragDrop.js +2 -0
  46. package/lib/Core/Hooks/useDragDrop.js.map +1 -1
  47. package/lib/Core/Views/Table/Row.d.ts +3 -1
  48. package/lib/Core/Views/Table/Row.d.ts.map +1 -1
  49. package/lib/Core/Views/Table/Row.js +5 -3
  50. package/lib/Core/Views/Table/Row.js.map +1 -1
  51. package/lib/Core/Views/Table/StyledTableContainer.d.ts.map +1 -1
  52. package/lib/Core/Views/Table/StyledTableContainer.js +4 -0
  53. package/lib/Core/Views/Table/StyledTableContainer.js.map +1 -1
  54. package/lib/Core/Views/Table/VirtualizeWrapper.d.ts +3 -1
  55. package/lib/Core/Views/Table/VirtualizeWrapper.d.ts.map +1 -1
  56. package/lib/Core/Views/Table/VirtualizeWrapper.js +18 -2
  57. package/lib/Core/Views/Table/VirtualizeWrapper.js.map +1 -1
  58. package/lib/Core/Views/Table/index.d.ts.map +1 -1
  59. package/lib/Core/Views/Table/index.js +2 -2
  60. package/lib/Core/Views/Table/index.js.map +1 -1
  61. package/lib/Core/Views/Table/useCountChange.d.ts +10 -0
  62. package/lib/Core/Views/Table/useCountChange.d.ts.map +1 -0
  63. package/lib/Core/Views/Table/useCountChange.js +39 -0
  64. package/lib/Core/Views/Table/useCountChange.js.map +1 -0
  65. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"utility.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,2CAA2C;AAC3C,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAEtC,MAAM,UAAU,4BAA4B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,EAAE,KAAK,EAAE,EAAE;QACxC,CAAiB,CAAC,YAAY,CAAC,YAAY,EAAE,GAAG,KAAK,CAAC,UAAU,GAAG,KAAK,EAAE,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,UAAuB;IAC9D,IAAI,CAAC,UAAU;QAAE,OAAO;IAExB,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,UAAU,CAAC,qBAAqB,EAAE,CAAC;IAEtE,IAAI,qBAAqB,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IACxD,IAAI,UAAU,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;QACpD,qBAAqB,IAAI,iBAAiB,EAAE,CAAC;IAC/C,CAAC;IACD,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,KAAkC,EAClC,YAA6B;IAE7B,IAAI,CAAC,KAAK;QAAE,OAAO,YAAY,CAAC;IAChC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxE,OAAO,GAAG,KAAK,IAAI,CAAC;IACtB,CAAC;IACD,OAAO,GAAG,KAAK,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,aAA0C;IACrE,IAAI,CAAC,aAAa;QAAE,OAAO,MAAM,CAAC;IAClC,OAAO,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC;AAClF,CAAC","sourcesContent":["import { getScrollbarWidth } from 'pega-repeating-structures-core';\n\nimport { StickyGroupHeader } from './Pagination';\n\n// TODO: in future, take this count in meta\nconst MAX_SCROLLABLE_ROW_COUNT = 5000;\n\nexport function getRecordCountForLayoutPaint(totalRecordCount: number) {\n return totalRecordCount > MAX_SCROLLABLE_ROW_COUNT ? MAX_SCROLLABLE_ROW_COUNT : totalRecordCount;\n}\n\n// State should be communicated back from consumer to know\n// if pagination last request completed or not.\nexport function isPaginationRequestCompleted(\n requestedIndexes?: { startIndex: number; endIndex: number },\n receivedIndexes?: { startIndex: number; endIndex: number }\n) {\n // this is required when there is a pagination request which is raised just to update consumer\n // about updated index though pagination is really not required.\n return (\n receivedIndexes &&\n requestedIndexes &&\n receivedIndexes.startIndex === requestedIndexes.startIndex &&\n receivedIndexes.endIndex === requestedIndexes.endIndex\n );\n}\n\nexport function isViewNotFilled(\n totalRecordCount: number,\n vi: { rContainer: HTMLDivElement },\n pContainer: HTMLDivElement,\n renderHeader: boolean\n) {\n const parentContainerPosition = pContainer.getBoundingClientRect();\n // This is required to accommodate header height.\n // TODO: Need to find a better solution to pull out header out of this.\n const headerRowHeight =\n renderHeader && pContainer.childElementCount > 1\n ? (pContainer.childNodes[0] as HTMLElement).offsetHeight\n : 0;\n const scrollbarWidth = getScrollbarWidth();\n return (\n totalRecordCount &&\n vi.rContainer.childElementCount !== totalRecordCount &&\n (Math.floor(vi.rContainer.getBoundingClientRect().bottom) <\n Math.floor(parentContainerPosition.bottom - scrollbarWidth) ||\n Math.floor(vi.rContainer.getBoundingClientRect().top) >\n Math.floor(parentContainerPosition.top + headerRowHeight) ||\n vi.rContainer.childElementCount === 0)\n );\n}\n\nfunction getItemCountPerRow(rows: Element[]) {\n const itemsCountPerRow: {\n [key: string]: { count: number; height: number; isStickyGroupHeader: boolean };\n } = {};\n rows.forEach(item => {\n const itemBoundary = item.getBoundingClientRect();\n // isStickyGroupHeader flag helps in including the overlapped sticky-group-header for getting correct averages\n const isStickyGroupHeader = item.classList.contains(StickyGroupHeader);\n if (itemsCountPerRow[itemBoundary.top]) {\n itemsCountPerRow[itemBoundary.top].count += 1;\n if (itemsCountPerRow[itemBoundary.top].height < itemBoundary.height) {\n itemsCountPerRow[itemBoundary.top].height = itemBoundary.height;\n }\n } else {\n itemsCountPerRow[itemBoundary.top] = {\n count: 1,\n height: itemBoundary.height,\n isStickyGroupHeader\n };\n }\n });\n return itemsCountPerRow;\n}\n\n// Based on row container size, get estimated count,\n// average height and no of items in a row.\nexport function getCurrentEstimation(rContainer: HTMLDivElement, includeRowsOnly = false) {\n const rContainerChildren = Array.from(rContainer.children || []);\n const filteredRowsContainer = includeRowsOnly\n ? rContainerChildren.filter(r => r.hasAttribute('data-key'))\n : rContainerChildren;\n\n const itemsCountPerRow = getItemCountPerRow(filteredRowsContainer);\n const itemCount = filteredRowsContainer.length || 0;\n // TODO FIXME: #virtualizer Remove dependency on sticky-group-header class and try to make the key of ItemsCountPerRow unique which will work for overlapping scenarios\n // BUG-740809 handling the rowCount in case of overlapped sticky-group-header\n // If we have sticky-group-headers, add overlapped sticky-group-headers to rowCount.\n // So, that averageNumberOfItemsInARow will be 1 for grid. That's why adding the complete count.\n const rowCount = Object.values(itemsCountPerRow).reduce(\n (acc: number, o: { isStickyGroupHeader: boolean; count: number }) => {\n if (o.isStickyGroupHeader) {\n return acc + o.count;\n }\n return acc + 1;\n },\n 0\n );\n const averageNumberOfItemsInARow = rowCount > 0 ? itemCount / rowCount : 0;\n const height = Object.values(itemsCountPerRow).reduce(\n (acc: number, o: { isStickyGroupHeader: boolean; height: number; count: number }) => {\n if (o.isStickyGroupHeader) {\n return acc + o.height * o.count;\n }\n return acc + o.height;\n },\n 0\n );\n const averageRowHeight = rowCount > 0 ? height / rowCount : 0;\n const rowContainerHeight = rContainer.offsetHeight || 0;\n return { itemCount, rowContainerHeight, averageNumberOfItemsInARow, averageRowHeight };\n}\n\n// Calculate top which needs to set on row container when component rerender.\n// component can rerender many times though pagination is in progress.\nfunction calculateTop(\n vi: {\n rContainer: HTMLDivElement;\n pInfo?: {\n view?: { startIndex: number; endIndex: number };\n };\n currentEstimation: {\n itemCount: number;\n rowContainerHeight: number;\n averageNumberOfItemsInARow: number;\n averageRowHeight: number;\n };\n },\n scrollTop: number\n) {\n let top = 0;\n if (vi.pInfo && vi.pInfo?.view?.startIndex !== 0) {\n // slide row container for current view based on previous estimated value.\n const estimatedNoOfItemsPushedUp =\n scrollTop * (vi.currentEstimation.itemCount / vi.currentEstimation.rowContainerHeight);\n // estimated start view index of current view based on scroll top.\n\n const estimatedStartIndexInView = estimatedNoOfItemsPushedUp + 1;\n // estimated number of buffer records.\n\n const noOfBufferRecords = estimatedStartIndexInView - (vi.pInfo?.view?.startIndex ?? 0);\n const noOfBufferRecordsHeight =\n (noOfBufferRecords / vi.currentEstimation.averageNumberOfItemsInARow) *\n vi.currentEstimation.averageRowHeight;\n // calculated top of row container.\n top = scrollTop - noOfBufferRecordsHeight;\n if (top < 0) top = 0;\n }\n return top;\n}\n\nfunction adjustTopRowContainerToAvoidDrift(\n vi: {\n rContainer: HTMLDivElement;\n pInfo: {\n view: { startIndex: number; endIndex: number };\n currentEstimation: {\n itemCount: number;\n rowContainerHeight: number;\n averageNumberOfItemsInARow: number;\n averageRowHeight: number;\n };\n existingItemBoundingBox: { y: number };\n currentRowIndex: number;\n bufferNewCords: { top: number };\n bufferOldCords: { top: number };\n };\n currentEstimation: {\n itemCount: number;\n rowContainerHeight: number;\n averageNumberOfItemsInARow: number;\n averageRowHeight: number;\n };\n },\n existingTop: number\n) {\n // Adjust top if element was viewable when user stop scrolling and pagination trigger.\n // existing item should be viewable are at time of calculation\n // as we allow user to scroll even pagination request triggered.\n let effectiveTop = existingTop;\n const { existingItemBoundingBox, currentRowIndex } = vi.pInfo;\n // As safari does elastic scroll, we need this check to avoid any space on top.\n const safariIsFirstItem = currentRowIndex === 0;\n if (existingItemBoundingBox && !safariIsFirstItem) {\n const currentRowIndexItem = vi.rContainer.querySelector(\n `[data-index='${vi.pInfo.currentRowIndex}']`\n );\n if (currentRowIndexItem) {\n // scrollNodeTopChange - change in scroll while pagination is in progress.\n const scrollNodeTopChange = vi.pInfo.bufferNewCords.top - vi.pInfo.bufferOldCords.top;\n const newItemBoundingBox = currentRowIndexItem.getBoundingClientRect();\n const top = newItemBoundingBox.y - existingItemBoundingBox.y - scrollNodeTopChange;\n effectiveTop = existingTop - top;\n }\n }\n // As of now, we are making top to zero if it goes in negative, which is not right way.\n // -ve is possible value for it as scroll top is just approximation. Check when\n // gallery view gives you 0 to index result after some scroll.\n // scroll top is 0 as it is top row index based.\n // TODO: can go negative as bottom to top paint strategy is pending.\n // This check and expression is not required after that. This will be handled in next release.\n // Gallery issue wil also be handled in that. As of for first attempt we have to either scroll more.\n // or make buffer size more in that to avoid 0 to index number in next repaint.\n if (effectiveTop < 0 && vi.pInfo.view.startIndex === 0) effectiveTop = 0;\n if (effectiveTop !== existingTop) vi.rContainer.style.top = `${effectiveTop}px`;\n}\n\nexport function updateRowContainerTop(\n vi: {\n rContainer: HTMLDivElement;\n pInfo: {\n view: { startIndex: number; endIndex: number };\n currentEstimation: {\n itemCount: number;\n rowContainerHeight: number;\n averageNumberOfItemsInARow: number;\n averageRowHeight: number;\n };\n existingItemBoundingBox: { y: number };\n currentRowIndex: number;\n bufferNewCords: { top: number };\n bufferOldCords: { top: number };\n };\n currentEstimation: {\n itemCount: number;\n rowContainerHeight: number;\n averageNumberOfItemsInARow: number;\n averageRowHeight: number;\n };\n },\n totalRecordCount: number,\n state: { [key: string]: any },\n pContainer: HTMLDivElement,\n scrollTop: number\n) {\n // if you get last record , put row container to bottom always to Avoid\n // any space left because of estimation otherwise calculate top.\n // if next rerender you get less records,\n if (\n (vi.pInfo?.view?.startIndex === 0 && vi.pInfo?.view?.endIndex < totalRecordCount) ||\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.view?.startIndex + 1 > totalRecordCount ||\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.view?.endIndex - vi.pInfo?.view?.startIndex >= totalRecordCount\n ) {\n // This is a case when you scroll to top or say after filter your items count reduce to such level\n // it doesn't fit in current start and end index and put container top and fill view\n // will consider if empty.\n vi.rContainer.style.removeProperty('bottom');\n vi.rContainer.style.top = '0px';\n // Any action which makes indexes out of range to total record count,\n // scroll to top as a default behavior.\n if (vi.pInfo.view.startIndex + 1 > totalRecordCount) pContainer.scrollTop = 0;\n\n // commenting below line as it can cause white space on top sometime.\n // Commenting this line might cause a small flicker only when you reach at top.\n // We will solve this in 8.6 release.\n // else if (vi.pInfo?.topRowIndex > 0) adjustTopRowContainerToAvoidDrift(vi, 0);\n } else if (\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.view?.endIndex + 1 >= totalRecordCount &&\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.view?.startIndex + 1 <= totalRecordCount\n ) {\n vi.rContainer.style.removeProperty('top');\n vi.rContainer.style.bottom = '0px';\n } else {\n vi.rContainer.style.removeProperty('bottom');\n const top = calculateTop(vi, scrollTop);\n vi.rContainer.style.top = `${top}px`;\n adjustTopRowContainerToAvoidDrift(vi, top);\n }\n}\n\n// index attrs required to estimate next set.\nexport function setAttributesOnItems(\n state: { startIndex: number; endIndex: number },\n rContainer: HTMLElement\n) {\n rContainer.childNodes.forEach((r, index) => {\n (r as HTMLElement).setAttribute('data-index', `${state.startIndex + index}`);\n });\n}\n\nexport function getPContainerClientWidth(pContainer: HTMLElement) {\n if (!pContainer) return;\n\n const { width: pContainerWidth } = pContainer.getBoundingClientRect();\n\n let pContainerClientWidth = Math.floor(pContainerWidth);\n if (pContainer.offsetWidth > pContainer.clientWidth) {\n pContainerClientWidth -= getScrollbarWidth();\n }\n return pContainerClientWidth;\n}\n\nexport function getValueWithUnit(\n value: string | number | undefined,\n defaultValue: string | number\n): string | number {\n if (!value) return defaultValue;\n if (!value.toString().includes('px') && !value.toString().includes('%')) {\n return `${value}px`;\n }\n return `${value}`;\n}\n\nexport function getMaxHeight(viewMaxHeight: number | string | undefined): string {\n if (!viewMaxHeight) return 'none';\n return typeof viewMaxHeight === 'number' ? `${viewMaxHeight}px` : viewMaxHeight;\n}\n"]}
1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;IACtB,CAAC;IACD,OAAO,GAAG,KAAK,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,aAA0C;IACrE,IAAI,CAAC,aAAa;QAAE,OAAO,MAAM,CAAC;IAClC,OAAO,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC;AAClF,CAAC","sourcesContent":["import { getScrollbarWidth } from 'pega-repeating-structures-core';\n\nimport { StickyGroupHeader } from './Pagination';\n\n// TODO: in future, take this count in meta\nconst MAX_SCROLLABLE_ROW_COUNT = 5000;\n\nexport function getRecordCountForLayoutPaint(totalRecordCount: number) {\n return totalRecordCount > MAX_SCROLLABLE_ROW_COUNT ? MAX_SCROLLABLE_ROW_COUNT : totalRecordCount;\n}\n\n// State should be communicated back from consumer to know\n// if pagination last request completed or not.\nexport function isPaginationRequestCompleted(\n requestedIndexes?: { startIndex: number; endIndex: number },\n receivedIndexes?: { startIndex: number; endIndex: number }\n) {\n // this is required when there is a pagination request which is raised just to update consumer\n // about updated index though pagination is really not required.\n return (\n receivedIndexes &&\n requestedIndexes &&\n ((receivedIndexes.startIndex === requestedIndexes.startIndex &&\n receivedIndexes.endIndex === requestedIndexes.endIndex) ||\n (Object.keys(requestedIndexes).length === 0 && receivedIndexes.endIndex))\n );\n}\n\nexport function isViewNotFilled(\n totalRecordCount: number,\n vi: { rContainer: HTMLDivElement },\n pContainer: HTMLDivElement,\n renderHeader: boolean\n) {\n const parentContainerPosition = pContainer.getBoundingClientRect();\n // This is required to accommodate header height.\n // TODO: Need to find a better solution to pull out header out of this.\n const headerRowHeight =\n renderHeader && pContainer.childElementCount > 1\n ? (pContainer.childNodes[0] as HTMLElement).offsetHeight\n : 0;\n const scrollbarWidth = getScrollbarWidth();\n return (\n totalRecordCount &&\n vi.rContainer.childElementCount !== totalRecordCount &&\n (Math.floor(vi.rContainer.getBoundingClientRect().bottom) <\n Math.floor(parentContainerPosition.bottom - scrollbarWidth) ||\n Math.floor(vi.rContainer.getBoundingClientRect().top) >\n Math.floor(parentContainerPosition.top + headerRowHeight) ||\n vi.rContainer.childElementCount === 0)\n );\n}\n\nfunction getItemCountPerRow(rows: Element[]) {\n const itemsCountPerRow: {\n [key: string]: { count: number; height: number; isStickyGroupHeader: boolean };\n } = {};\n rows.forEach(item => {\n const itemBoundary = item.getBoundingClientRect();\n // isStickyGroupHeader flag helps in including the overlapped sticky-group-header for getting correct averages\n const isStickyGroupHeader = item.classList.contains(StickyGroupHeader);\n if (itemsCountPerRow[itemBoundary.top]) {\n itemsCountPerRow[itemBoundary.top].count += 1;\n if (itemsCountPerRow[itemBoundary.top].height < itemBoundary.height) {\n itemsCountPerRow[itemBoundary.top].height = itemBoundary.height;\n }\n } else {\n itemsCountPerRow[itemBoundary.top] = {\n count: 1,\n height: itemBoundary.height,\n isStickyGroupHeader\n };\n }\n });\n return itemsCountPerRow;\n}\n\n// Based on row container size, get estimated count,\n// average height and no of items in a row.\nexport function getCurrentEstimation(rContainer: HTMLDivElement, includeRowsOnly = false) {\n const rContainerChildren = Array.from(rContainer.children || []);\n const filteredRowsContainer = includeRowsOnly\n ? rContainerChildren.filter(r => r.hasAttribute('data-key'))\n : rContainerChildren;\n\n const itemsCountPerRow = getItemCountPerRow(filteredRowsContainer);\n const itemCount = filteredRowsContainer.length || 0;\n // TODO FIXME: #virtualizer Remove dependency on sticky-group-header class and try to make the key of ItemsCountPerRow unique which will work for overlapping scenarios\n // BUG-740809 handling the rowCount in case of overlapped sticky-group-header\n // If we have sticky-group-headers, add overlapped sticky-group-headers to rowCount.\n // So, that averageNumberOfItemsInARow will be 1 for grid. That's why adding the complete count.\n const rowCount = Object.values(itemsCountPerRow).reduce(\n (acc: number, o: { isStickyGroupHeader: boolean; count: number }) => {\n if (o.isStickyGroupHeader) {\n return acc + o.count;\n }\n return acc + 1;\n },\n 0\n );\n const averageNumberOfItemsInARow = rowCount > 0 ? itemCount / rowCount : 0;\n const height = Object.values(itemsCountPerRow).reduce(\n (acc: number, o: { isStickyGroupHeader: boolean; height: number; count: number }) => {\n if (o.isStickyGroupHeader) {\n return acc + o.height * o.count;\n }\n return acc + o.height;\n },\n 0\n );\n const averageRowHeight = rowCount > 0 ? height / rowCount : 0;\n const rowContainerHeight = rContainer.offsetHeight || 0;\n return { itemCount, rowContainerHeight, averageNumberOfItemsInARow, averageRowHeight };\n}\n\n// Calculate top which needs to set on row container when component rerender.\n// component can rerender many times though pagination is in progress.\nfunction calculateTop(\n vi: {\n rContainer: HTMLDivElement;\n pInfo?: {\n view?: { startIndex: number; endIndex: number };\n };\n currentEstimation: {\n itemCount: number;\n rowContainerHeight: number;\n averageNumberOfItemsInARow: number;\n averageRowHeight: number;\n };\n },\n scrollTop: number\n) {\n let top = 0;\n if (vi.pInfo && vi.pInfo?.view?.startIndex !== 0) {\n // slide row container for current view based on previous estimated value.\n const estimatedNoOfItemsPushedUp =\n scrollTop * (vi.currentEstimation.itemCount / vi.currentEstimation.rowContainerHeight);\n // estimated start view index of current view based on scroll top.\n\n const estimatedStartIndexInView = estimatedNoOfItemsPushedUp + 1;\n // estimated number of buffer records.\n\n const noOfBufferRecords = estimatedStartIndexInView - (vi.pInfo?.view?.startIndex ?? 0);\n const noOfBufferRecordsHeight =\n (noOfBufferRecords / vi.currentEstimation.averageNumberOfItemsInARow) *\n vi.currentEstimation.averageRowHeight;\n // calculated top of row container.\n top = scrollTop - noOfBufferRecordsHeight;\n if (top < 0) top = 0;\n }\n return top;\n}\n\nfunction adjustTopRowContainerToAvoidDrift(\n vi: {\n rContainer: HTMLDivElement;\n pInfo: {\n view: { startIndex: number; endIndex: number };\n currentEstimation: {\n itemCount: number;\n rowContainerHeight: number;\n averageNumberOfItemsInARow: number;\n averageRowHeight: number;\n };\n existingItemBoundingBox: { y: number };\n currentRowIndex: number;\n bufferNewCords: { top: number };\n bufferOldCords: { top: number };\n };\n currentEstimation: {\n itemCount: number;\n rowContainerHeight: number;\n averageNumberOfItemsInARow: number;\n averageRowHeight: number;\n };\n },\n existingTop: number\n) {\n // Adjust top if element was viewable when user stop scrolling and pagination trigger.\n // existing item should be viewable are at time of calculation\n // as we allow user to scroll even pagination request triggered.\n let effectiveTop = existingTop;\n const { existingItemBoundingBox, currentRowIndex } = vi.pInfo;\n // As safari does elastic scroll, we need this check to avoid any space on top.\n const safariIsFirstItem = currentRowIndex === 0;\n if (existingItemBoundingBox && !safariIsFirstItem) {\n const currentRowIndexItem = vi.rContainer.querySelector(\n `[data-index='${vi.pInfo.currentRowIndex}']`\n );\n if (currentRowIndexItem) {\n // scrollNodeTopChange - change in scroll while pagination is in progress.\n const scrollNodeTopChange = vi.pInfo.bufferNewCords.top - vi.pInfo.bufferOldCords.top;\n const newItemBoundingBox = currentRowIndexItem.getBoundingClientRect();\n const top = newItemBoundingBox.y - existingItemBoundingBox.y - scrollNodeTopChange;\n effectiveTop = existingTop - top;\n }\n }\n // As of now, we are making top to zero if it goes in negative, which is not right way.\n // -ve is possible value for it as scroll top is just approximation. Check when\n // gallery view gives you 0 to index result after some scroll.\n // scroll top is 0 as it is top row index based.\n // TODO: can go negative as bottom to top paint strategy is pending.\n // This check and expression is not required after that. This will be handled in next release.\n // Gallery issue wil also be handled in that. As of for first attempt we have to either scroll more.\n // or make buffer size more in that to avoid 0 to index number in next repaint.\n if (effectiveTop < 0 && vi.pInfo.view.startIndex === 0) effectiveTop = 0;\n if (effectiveTop !== existingTop) vi.rContainer.style.top = `${effectiveTop}px`;\n}\n\nexport function updateRowContainerTop(\n vi: {\n rContainer: HTMLDivElement;\n pInfo: {\n view: { startIndex: number; endIndex: number };\n currentEstimation: {\n itemCount: number;\n rowContainerHeight: number;\n averageNumberOfItemsInARow: number;\n averageRowHeight: number;\n };\n existingItemBoundingBox: { y: number };\n currentRowIndex: number;\n bufferNewCords: { top: number };\n bufferOldCords: { top: number };\n };\n currentEstimation: {\n itemCount: number;\n rowContainerHeight: number;\n averageNumberOfItemsInARow: number;\n averageRowHeight: number;\n };\n },\n totalRecordCount: number,\n state: { [key: string]: any },\n pContainer: HTMLDivElement,\n scrollTop: number\n) {\n // if you get last record , put row container to bottom always to Avoid\n // any space left because of estimation otherwise calculate top.\n // if next rerender you get less records,\n if (\n (vi.pInfo?.view?.startIndex === 0 && vi.pInfo?.view?.endIndex < totalRecordCount) ||\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.view?.startIndex + 1 > totalRecordCount ||\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.view?.endIndex - vi.pInfo?.view?.startIndex >= totalRecordCount\n ) {\n // This is a case when you scroll to top or say after filter your items count reduce to such level\n // it doesn't fit in current start and end index and put container top and fill view\n // will consider if empty.\n vi.rContainer.style.removeProperty('bottom');\n vi.rContainer.style.top = '0px';\n // Any action which makes indexes out of range to total record count,\n // scroll to top as a default behavior.\n if (vi.pInfo.view.startIndex + 1 > totalRecordCount) pContainer.scrollTop = 0;\n\n // commenting below line as it can cause white space on top sometime.\n // Commenting this line might cause a small flicker only when you reach at top.\n // We will solve this in 8.6 release.\n // else if (vi.pInfo?.topRowIndex > 0) adjustTopRowContainerToAvoidDrift(vi, 0);\n } else if (\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.view?.endIndex + 1 >= totalRecordCount &&\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.view?.startIndex + 1 <= totalRecordCount\n ) {\n vi.rContainer.style.removeProperty('top');\n vi.rContainer.style.bottom = '0px';\n } else {\n vi.rContainer.style.removeProperty('bottom');\n const top = calculateTop(vi, scrollTop);\n vi.rContainer.style.top = `${top}px`;\n adjustTopRowContainerToAvoidDrift(vi, top);\n }\n}\n\n// index attrs required to estimate next set.\nexport function setAttributesOnItems(\n state: { startIndex: number; endIndex: number },\n rContainer: HTMLElement\n) {\n rContainer.childNodes.forEach((r, index) => {\n (r as HTMLElement).setAttribute('data-index', `${state.startIndex + index}`);\n });\n}\n\nexport function getPContainerClientWidth(pContainer: HTMLElement) {\n if (!pContainer) return;\n\n const { width: pContainerWidth } = pContainer.getBoundingClientRect();\n\n let pContainerClientWidth = Math.floor(pContainerWidth);\n if (pContainer.offsetWidth > pContainer.clientWidth) {\n pContainerClientWidth -= getScrollbarWidth();\n }\n return pContainerClientWidth;\n}\n\nexport function getValueWithUnit(\n value: string | number | undefined,\n defaultValue: string | number\n): string | number {\n if (!value) return defaultValue;\n if (!value.toString().includes('px') && !value.toString().includes('%')) {\n return `${value}px`;\n }\n return `${value}`;\n}\n\nexport function getMaxHeight(viewMaxHeight: number | string | undefined): string {\n if (!viewMaxHeight) return 'none';\n return typeof viewMaxHeight === 'number' ? `${viewMaxHeight}px` : viewMaxHeight;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useDragDrop.d.ts","sourceRoot":"","sources":["../../../Core/Hooks/useDragDrop.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE5F;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,WAAuB,EACvB,SAAqB,EACrB,WAAuB,EACvB,WAAuB,EACvB,MAAM,EACN,gBAAuB,EACvB,oBAAoB,EACpB,iBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EACjB,EAAE,gBAAgB,GAAG,iBAAiB,CA8RtC"}
1
+ {"version":3,"file":"useDragDrop.d.ts","sourceRoot":"","sources":["../../../Core/Hooks/useDragDrop.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE5F;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,WAAuB,EACvB,SAAqB,EACrB,WAAuB,EACvB,WAAuB,EACvB,MAAM,EACN,gBAAuB,EACvB,oBAAoB,EACpB,iBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EACjB,EAAE,gBAAgB,GAAG,iBAAiB,CAgStC"}
@@ -126,6 +126,8 @@ export default function useDragDrop({ context, onDragStart = undefined, onDragEn
126
126
  ref.contextDragOverCb = contextDragOverCb;
127
127
  setGhostImage(ev);
128
128
  ev.dataTransfer.effectAllowed = 'move';
129
+ // Setting up some dummy data to make drag drop work in firefox. Refer https://medium.com/%40reiberdatschi/common-pitfalls-with-html5-drag-n-drop-api-9f011a09ee6c
130
+ ev.dataTransfer.setData('text/plain', 'RS_Dragged_Item');
129
131
  // fail safe reset drag target.
130
132
  if (ref.dragTarget)
131
133
  ref.dragTarget = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useDragDrop.js","sourceRoot":"","sources":["../../../Core/Hooks/useDragDrop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAIrD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,WAAW,GAAG,SAAS,EACvB,SAAS,GAAG,SAAS,EACrB,WAAW,GAAG,SAAS,EACvB,WAAW,GAAG,SAAS,EACvB,MAAM,EACN,gBAAgB,GAAG,IAAI,EACvB,oBAAoB,EACpB,iBAAiB,GAAG,IAAI,EACxB,qBAAqB,EACrB,gBAAgB,EACC;IACjB,6FAA6F;IAC7F,MAAM,GAAG,GAAG,MAAM,CAAc;QAC9B,UAAU,EAAE,EAAE;QACd,eAAe,EAAE,IAAI;QACrB,UAAU,EAAE,SAAS;KACtB,CAAC,CAAC,OAAO,CAAC;IAEX,MAAM,aAAa,GAAG,WAAW,CAC/B,CAAC,MAAe,EAAE,EAAE;QAClB,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YACvE,MAAM,IAAI,GAAG,KAAK,CA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AE,WAAW;QACxB,SAAS,EAAE,SAAS;KACrB,CAAC,EACF,CAAC,WAAW,EAAE,SAAS,CAAC,CACzB,CAAC;IAEF,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,CAAC;QACL,WAAW,EAAE,WAAW;QACxB,WAAW,EAAE,WAAW;QACxB,WAAW,EAAE,UAAU;KACxB,CAAC,EACF,CAAC,WAAW,EAAE,WAAW,CAAC,CAC3B,CAAC;IAEF,OAAO;QACL,SAAS;QACT,SAAS;KACV,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useMemo, useRef } from 'react';\n\nimport type { DragDropRef, UseDragDropProps, UseDragDropReturn } from './useDragDrop.types';\n\n/**\n * A custom React hook to handle drag-and-drop functionality with support for animations,\n * ghost images, and collision detection.\n *\n * @param {UseDragDropProps} params - The parameters for configuring the drag-and-drop behavior.\n * See {@link UseDragDropProps} for details.\n * @returns {UseDragDropReturn} An object containing `dragProps` and `dropProps` to be spread onto draggable and droppable elements.\n * See {@link UseDragDropReturn} for details.\n */\nexport default function useDragDrop({\n context,\n onDragStart = undefined,\n onDragEnd = undefined,\n onDragEnter = undefined,\n onDragLeave = undefined,\n onDrop,\n defaultAnimation = true,\n getAnimationSelector,\n defaultGhostImage = true,\n getGhostImageSelector,\n getDraggedObject\n}: UseDragDropProps): UseDragDropReturn {\n // A way to fire dragleave when we actually come out of drop target not only a child of that.\n const ref = useRef<DragDropRef>({\n dropTarget: [],\n dropTargetCoord: null,\n dragTarget: undefined\n }).current;\n\n const addDragEffect = useCallback(\n (target: Element) => {\n if (defaultAnimation) {\n const t = getAnimationSelector ? getAnimationSelector(target) : target;\n const elms = Array.isArray(t) ? t : [t];\n elms.forEach(elm => {\n elm.style.opacity = '0.5';\n });\n }\n },\n [defaultAnimation, getAnimationSelector]\n );\n\n const removeDragEffect = useCallback(\n (target: Element) => {\n if (defaultAnimation) {\n const t = getAnimationSelector ? getAnimationSelector(target) : target;\n const elms = Array.isArray(t) ? t : [t];\n elms.forEach(elm => {\n elm.style.opacity = '1';\n });\n }\n },\n [defaultAnimation, getAnimationSelector]\n );\n\n const setGhostImage = useCallback(\n (e: React.DragEvent<Element>) => {\n if (defaultGhostImage) {\n const elem = (\n getGhostImageSelector ? getGhostImageSelector(e.currentTarget) : e.currentTarget\n ) as HTMLElement;\n const ghostElement = elem.cloneNode(true) as HTMLElement;\n if (ghostElement) {\n ghostElement.style.height = `${elem.style.height}px`;\n ghostElement.style.width = `${elem.style.width}px`;\n ghostElement.style.position = 'absolute';\n ghostElement.style.top = '-1000000px';\n ghostElement.style.left = '-10000000px';\n ghostElement.style.zIndex = '-1';\n }\n context.current?.appendChild(ghostElement);\n e.dataTransfer?.setDragImage(ghostElement, 0, 0);\n\n setTimeout(() => {\n ghostElement.parentNode?.removeChild(ghostElement);\n }, 1000);\n }\n },\n [getGhostImageSelector, context, defaultGhostImage]\n );\n\n const isColliding = useCallback((x: number, y: number, coord: DOMRect): boolean => {\n const smallBuffer = 2;\n return !(\n x < coord.left - smallBuffer ||\n x > coord.right + smallBuffer ||\n y > coord.bottom + smallBuffer ||\n y < coord.top - smallBuffer\n );\n }, []);\n\n const addDropEffect = useCallback(\n (target: Element) => {\n if (defaultAnimation) {\n const t = getAnimationSelector ? getAnimationSelector(target) : target;\n const elms = Array.isArray(t) ? t : [t];\n elms.forEach(elm => {\n // Need to handle this in better way.TODO: need clean up as well.\n elm.style.transition = 'transform 0.25s';\n elm.style.transform = 'translate(20px)';\n });\n }\n },\n [defaultAnimation, getAnimationSelector]\n );\n\n const removeDropEffect = useCallback(\n (target: Element) => {\n if (defaultAnimation) {\n const t = getAnimationSelector ? getAnimationSelector(target) : target;\n const elms = Array.isArray(t) ? t : [t];\n elms.forEach(elm => {\n elm.style.transform = 'translate(0px)';\n });\n }\n },\n [defaultAnimation, getAnimationSelector]\n );\n\n const contextDragOverCb = useCallback(\n (e: DragEvent) => {\n e.stopPropagation();\n e.preventDefault();\n if (\n ref.dragLeaveSkipped &&\n ref.dropTarget &&\n ref.dropTarget[ref.dropTarget.length - 1] &&\n ref.dropTargetCoord &&\n !isColliding(e.clientX, e.clientY, ref.dropTargetCoord)\n ) {\n ref.forcedDragLeave = true;\n ref.dragLeaveSkipped = false;\n const elm = ref.dropTarget.shift();\n ref.dropTarget = [...ref.dropTarget];\n elm?.dispatchEvent(\n new MouseEvent('dragleave', {\n bubbles: true,\n cancelable: true,\n view: window\n })\n );\n }\n },\n [isColliding, ref]\n );\n\n const contextDropCb = useCallback(\n (ev: DragEvent) => {\n ev.stopPropagation();\n ev.preventDefault();\n const elm = ref.dropTarget[ref.dropTarget.length - 1] as HTMLElement;\n if (\n ref.dropTargetCoord &&\n elm !== ref.dragTarget &&\n isColliding(ev.clientX, ev.clientY, ref.dropTargetCoord)\n ) {\n removeDropEffect(elm);\n elm.classList.remove('dragEnter');\n if (onDrop && ref.dragTarget) onDrop(elm, ref.dragTarget);\n ref.dragTarget = undefined;\n ref.dropTargetCoord = null;\n ref.dropTarget = [];\n }\n },\n [ref, isColliding, removeDropEffect, onDrop]\n );\n\n const dragStartCb = useCallback(\n (ev: React.DragEvent<HTMLElement>) => {\n document.addEventListener('dragover', contextDragOverCb);\n context.current?.addEventListener('drop', contextDropCb);\n\n // clear the drag operation's data store when drag starts as its the only time when drag data is writable\n if (ev.dataTransfer) ev.dataTransfer.clearData();\n\n // We have to keep event handler in reference so that we can remove right handler when drag ends.\n // Handler might change in between because of deps.\n ref.contextDropCb = contextDropCb;\n ref.contextDragOverCb = contextDragOverCb;\n\n setGhostImage(ev);\n ev.dataTransfer.effectAllowed = 'move';\n // fail safe reset drag target.\n if (ref.dragTarget) ref.dragTarget = undefined;\n ref.dragTarget = getDraggedObject ? getDraggedObject(ev.currentTarget) : ev.currentTarget;\n ev.currentTarget.classList.add('dragStart');\n addDragEffect(ev.currentTarget);\n if (onDragStart) onDragStart(ev);\n },\n [\n contextDragOverCb,\n context,\n contextDropCb,\n setGhostImage,\n ref,\n getDraggedObject,\n addDragEffect,\n onDragStart\n ]\n );\n\n const dragEndCb = useCallback(\n (ev: React.DragEvent<HTMLElement>) => {\n if (ref.contextDragOverCb) document.removeEventListener('dragover', ref.contextDragOverCb);\n if (ref.contextDropCb) context.current?.removeEventListener('drop', ref.contextDropCb);\n ref.dropTarget = [];\n ref.dropTargetCoord = null;\n ref.forcedDragLeave = false;\n ref.dragLeaveSkipped = false;\n ev.currentTarget.classList.remove('dragStart');\n removeDragEffect(ev.currentTarget);\n if (onDragEnd) onDragEnd(ev);\n },\n [onDragEnd, removeDragEffect, context, ref]\n );\n\n const isValidDragEnter = useCallback(\n (e: React.DragEvent<Element>) => {\n let isValid = true;\n if (ref.dragTarget === e.currentTarget) isValid = false;\n else if (ref.dropTarget[ref.dropTarget.length - 1] === e.currentTarget) isValid = false;\n else if (\n ref.dropTarget[ref.dropTarget.length - 1] &&\n ref.dropTarget[ref.dropTarget.length - 1] !== e.currentTarget\n ) {\n const currentTargetCoord = e.currentTarget.getBoundingClientRect();\n const dropTargetCoord = ref.dropTarget[ref.dropTarget.length - 1].getBoundingClientRect();\n if (\n !isColliding(e.clientX, e.clientY, currentTargetCoord) &&\n isColliding(e.clientX, e.clientY, dropTargetCoord)\n )\n isValid = false;\n }\n return isValid;\n },\n [ref, isColliding]\n );\n\n const dragEnterCb = useCallback(\n (ev: React.DragEvent<HTMLElement>) => {\n ev.stopPropagation();\n if (isValidDragEnter(ev)) {\n ref.dropTarget = ref.dropTarget.length ? [...ref.dropTarget] : [];\n ref.dropTarget.push(ev.currentTarget);\n ev.currentTarget.classList.add('dragEnter');\n ev.dataTransfer.dropEffect = 'move';\n ref.dropTargetCoord = ev.currentTarget.getBoundingClientRect();\n addDropEffect(ev.currentTarget);\n if (onDragEnter) onDragEnter(ev);\n\n if (ref.dropTarget.length > 1) {\n const elm = ref.dropTarget.shift();\n ref.dropTarget = [...ref.dropTarget];\n ref.forcedDragLeave = true;\n elm?.dispatchEvent(\n new MouseEvent('dragleave', {\n bubbles: true,\n cancelable: true,\n view: window\n })\n );\n }\n }\n },\n [onDragEnter, addDropEffect, ref, isValidDragEnter]\n );\n\n const dragLeaveCb = useCallback(\n (ev: React.DragEvent<HTMLElement>) => {\n ev.stopPropagation();\n if (ref.forcedDragLeave) {\n ref.forcedDragLeave = false;\n ev.currentTarget.classList.remove('dragEnter');\n removeDropEffect(ev.currentTarget);\n if (onDragLeave) onDragLeave(ev);\n } else if (\n !ev.currentTarget.contains(ev.relatedTarget as Element) &&\n ref.dragTarget !== ev.currentTarget\n ) {\n ref.dragLeaveSkipped = true;\n }\n },\n [ref, removeDropEffect, onDragLeave]\n );\n\n const dragProps = useMemo(\n () => ({\n draggable: true,\n onDragStart: dragStartCb,\n onDragEnd: dragEndCb\n }),\n [dragStartCb, dragEndCb]\n );\n\n const dropProps = useMemo(\n () => ({\n onDragEnter: dragEnterCb,\n onDragLeave: dragLeaveCb,\n 'data-drop': 'dropzone'\n }),\n [dragEnterCb, dragLeaveCb]\n );\n\n return {\n dragProps,\n dropProps\n };\n}\n"]}
1
+ {"version":3,"file":"useDragDrop.js","sourceRoot":"","sources":["../../../Core/Hooks/useDragDrop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAIrD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,WAAW,GAAG,SAAS,EACvB,SAAS,GAAG,SAAS,EACrB,WAAW,GAAG,SAAS,EACvB,WAAW,GAAG,SAAS,EACvB,MAAM,EACN,gBAAgB,GAAG,IAAI,EACvB,oBAAoB,EACpB,iBAAiB,GAAG,IAAI,EACxB,qBAAqB,EACrB,gBAAgB,EACC;IACjB,6FAA6F;IAC7F,MAAM,GAAG,GAAG,MAAM,CAAc;QAC9B,UAAU,EAAE,EAAE;QACd,eAAe,EAAE,IAAI;QACrB,UAAU,EAAE,SAAS;KACtB,CAAC,CAAC,OAAO,CAAC;IAEX,MA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AC,EAAE,CAAC,aAAwB,CAAC;YACvD,GAAG,CAAC,UAAU,KAAK,EAAE,CAAC,aAAa,EACnC,CAAC;YACD,GAAG,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC9B,CAAC;IACH,CAAC,EACD,CAAC,GAAG,EAAE,gBAAgB,EAAE,WAAW,CAAC,CACrC,CAAC;IAEF,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,CAAC;QACL,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,WAAW;QACxB,SAAS,EAAE,SAAS;KACrB,CAAC,EACF,CAAC,WAAW,EAAE,SAAS,CAAC,CACzB,CAAC;IAEF,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,CAAC;QACL,WAAW,EAAE,WAAW;QACxB,WAAW,EAAE,WAAW;QACxB,WAAW,EAAE,UAAU;KACxB,CAAC,EACF,CAAC,WAAW,EAAE,WAAW,CAAC,CAC3B,CAAC;IAEF,OAAO;QACL,SAAS;QACT,SAAS;KACV,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useMemo, useRef } from 'react';\n\nimport type { DragDropRef, UseDragDropProps, UseDragDropReturn } from './useDragDrop.types';\n\n/**\n * A custom React hook to handle drag-and-drop functionality with support for animations,\n * ghost images, and collision detection.\n *\n * @param {UseDragDropProps} params - The parameters for configuring the drag-and-drop behavior.\n * See {@link UseDragDropProps} for details.\n * @returns {UseDragDropReturn} An object containing `dragProps` and `dropProps` to be spread onto draggable and droppable elements.\n * See {@link UseDragDropReturn} for details.\n */\nexport default function useDragDrop({\n context,\n onDragStart = undefined,\n onDragEnd = undefined,\n onDragEnter = undefined,\n onDragLeave = undefined,\n onDrop,\n defaultAnimation = true,\n getAnimationSelector,\n defaultGhostImage = true,\n getGhostImageSelector,\n getDraggedObject\n}: UseDragDropProps): UseDragDropReturn {\n // A way to fire dragleave when we actually come out of drop target not only a child of that.\n const ref = useRef<DragDropRef>({\n dropTarget: [],\n dropTargetCoord: null,\n dragTarget: undefined\n }).current;\n\n const addDragEffect = useCallback(\n (target: Element) => {\n if (defaultAnimation) {\n const t = getAnimationSelector ? getAnimationSelector(target) : target;\n const elms = Array.isArray(t) ? t : [t];\n elms.forEach(elm => {\n elm.style.opacity = '0.5';\n });\n }\n },\n [defaultAnimation, getAnimationSelector]\n );\n\n const removeDragEffect = useCallback(\n (target: Element) => {\n if (defaultAnimation) {\n const t = getAnimationSelector ? getAnimationSelector(target) : target;\n const elms = Array.isArray(t) ? t : [t];\n elms.forEach(elm => {\n elm.style.opacity = '1';\n });\n }\n },\n [defaultAnimation, getAnimationSelector]\n );\n\n const setGhostImage = useCallback(\n (e: React.DragEvent<Element>) => {\n if (defaultGhostImage) {\n const elem = (\n getGhostImageSelector ? getGhostImageSelector(e.currentTarget) : e.currentTarget\n ) as HTMLElement;\n const ghostElement = elem.cloneNode(true) as HTMLElement;\n if (ghostElement) {\n ghostElement.style.height = `${elem.style.height}px`;\n ghostElement.style.width = `${elem.style.width}px`;\n ghostElement.style.position = 'absolute';\n ghostElement.style.top = '-1000000px';\n ghostElement.style.left = '-10000000px';\n ghostElement.style.zIndex = '-1';\n }\n context.current?.appendChild(ghostElement);\n e.dataTransfer?.setDragImage(ghostElement, 0, 0);\n\n setTimeout(() => {\n ghostElement.parentNode?.removeChild(ghostElement);\n }, 1000);\n }\n },\n [getGhostImageSelector, context, defaultGhostImage]\n );\n\n const isColliding = useCallback((x: number, y: number, coord: DOMRect): boolean => {\n const smallBuffer = 2;\n return !(\n x < coord.left - smallBuffer ||\n x > coord.right + smallBuffer ||\n y > coord.bottom + smallBuffer ||\n y < coord.top - smallBuffer\n );\n }, []);\n\n const addDropEffect = useCallback(\n (target: Element) => {\n if (defaultAnimation) {\n const t = getAnimationSelector ? getAnimationSelector(target) : target;\n const elms = Array.isArray(t) ? t : [t];\n elms.forEach(elm => {\n // Need to handle this in better way.TODO: need clean up as well.\n elm.style.transition = 'transform 0.25s';\n elm.style.transform = 'translate(20px)';\n });\n }\n },\n [defaultAnimation, getAnimationSelector]\n );\n\n const removeDropEffect = useCallback(\n (target: Element) => {\n if (defaultAnimation) {\n const t = getAnimationSelector ? getAnimationSelector(target) : target;\n const elms = Array.isArray(t) ? t : [t];\n elms.forEach(elm => {\n elm.style.transform = 'translate(0px)';\n });\n }\n },\n [defaultAnimation, getAnimationSelector]\n );\n\n const contextDragOverCb = useCallback(\n (e: DragEvent) => {\n e.stopPropagation();\n e.preventDefault();\n if (\n ref.dragLeaveSkipped &&\n ref.dropTarget &&\n ref.dropTarget[ref.dropTarget.length - 1] &&\n ref.dropTargetCoord &&\n !isColliding(e.clientX, e.clientY, ref.dropTargetCoord)\n ) {\n ref.forcedDragLeave = true;\n ref.dragLeaveSkipped = false;\n const elm = ref.dropTarget.shift();\n ref.dropTarget = [...ref.dropTarget];\n elm?.dispatchEvent(\n new MouseEvent('dragleave', {\n bubbles: true,\n cancelable: true,\n view: window\n })\n );\n }\n },\n [isColliding, ref]\n );\n\n const contextDropCb = useCallback(\n (ev: DragEvent) => {\n ev.stopPropagation();\n ev.preventDefault();\n const elm = ref.dropTarget[ref.dropTarget.length - 1] as HTMLElement;\n if (\n ref.dropTargetCoord &&\n elm !== ref.dragTarget &&\n isColliding(ev.clientX, ev.clientY, ref.dropTargetCoord)\n ) {\n removeDropEffect(elm);\n elm.classList.remove('dragEnter');\n if (onDrop && ref.dragTarget) onDrop(elm, ref.dragTarget);\n ref.dragTarget = undefined;\n ref.dropTargetCoord = null;\n ref.dropTarget = [];\n }\n },\n [ref, isColliding, removeDropEffect, onDrop]\n );\n\n const dragStartCb = useCallback(\n (ev: React.DragEvent<HTMLElement>) => {\n document.addEventListener('dragover', contextDragOverCb);\n context.current?.addEventListener('drop', contextDropCb);\n\n // clear the drag operation's data store when drag starts as its the only time when drag data is writable\n if (ev.dataTransfer) ev.dataTransfer.clearData();\n\n // We have to keep event handler in reference so that we can remove right handler when drag ends.\n // Handler might change in between because of deps.\n ref.contextDropCb = contextDropCb;\n ref.contextDragOverCb = contextDragOverCb;\n\n setGhostImage(ev);\n ev.dataTransfer.effectAllowed = 'move';\n // Setting up some dummy data to make drag drop work in firefox. Refer https://medium.com/%40reiberdatschi/common-pitfalls-with-html5-drag-n-drop-api-9f011a09ee6c\n ev.dataTransfer.setData('text/plain', 'RS_Dragged_Item');\n // fail safe reset drag target.\n if (ref.dragTarget) ref.dragTarget = undefined;\n ref.dragTarget = getDraggedObject ? getDraggedObject(ev.currentTarget) : ev.currentTarget;\n ev.currentTarget.classList.add('dragStart');\n addDragEffect(ev.currentTarget);\n if (onDragStart) onDragStart(ev);\n },\n [\n contextDragOverCb,\n context,\n contextDropCb,\n setGhostImage,\n ref,\n getDraggedObject,\n addDragEffect,\n onDragStart\n ]\n );\n\n const dragEndCb = useCallback(\n (ev: React.DragEvent<HTMLElement>) => {\n if (ref.contextDragOverCb) document.removeEventListener('dragover', ref.contextDragOverCb);\n if (ref.contextDropCb) context.current?.removeEventListener('drop', ref.contextDropCb);\n ref.dropTarget = [];\n ref.dropTargetCoord = null;\n ref.forcedDragLeave = false;\n ref.dragLeaveSkipped = false;\n ev.currentTarget.classList.remove('dragStart');\n removeDragEffect(ev.currentTarget);\n if (onDragEnd) onDragEnd(ev);\n },\n [onDragEnd, removeDragEffect, context, ref]\n );\n\n const isValidDragEnter = useCallback(\n (e: React.DragEvent<Element>) => {\n let isValid = true;\n if (ref.dragTarget === e.currentTarget) isValid = false;\n else if (ref.dropTarget[ref.dropTarget.length - 1] === e.currentTarget) isValid = false;\n else if (\n ref.dropTarget[ref.dropTarget.length - 1] &&\n ref.dropTarget[ref.dropTarget.length - 1] !== e.currentTarget\n ) {\n const currentTargetCoord = e.currentTarget.getBoundingClientRect();\n const dropTargetCoord = ref.dropTarget[ref.dropTarget.length - 1].getBoundingClientRect();\n if (\n !isColliding(e.clientX, e.clientY, currentTargetCoord) &&\n isColliding(e.clientX, e.clientY, dropTargetCoord)\n )\n isValid = false;\n }\n return isValid;\n },\n [ref, isColliding]\n );\n\n const dragEnterCb = useCallback(\n (ev: React.DragEvent<HTMLElement>) => {\n ev.stopPropagation();\n if (isValidDragEnter(ev)) {\n ref.dropTarget = ref.dropTarget.length ? [...ref.dropTarget] : [];\n ref.dropTarget.push(ev.currentTarget);\n ev.currentTarget.classList.add('dragEnter');\n ev.dataTransfer.dropEffect = 'move';\n ref.dropTargetCoord = ev.currentTarget.getBoundingClientRect();\n addDropEffect(ev.currentTarget);\n if (onDragEnter) onDragEnter(ev);\n\n if (ref.dropTarget.length > 1) {\n const elm = ref.dropTarget.shift();\n ref.dropTarget = [...ref.dropTarget];\n ref.forcedDragLeave = true;\n elm?.dispatchEvent(\n new MouseEvent('dragleave', {\n bubbles: true,\n cancelable: true,\n view: window\n })\n );\n }\n }\n },\n [onDragEnter, addDropEffect, ref, isValidDragEnter]\n );\n\n const dragLeaveCb = useCallback(\n (ev: React.DragEvent<HTMLElement>) => {\n ev.stopPropagation();\n if (ref.forcedDragLeave) {\n ref.forcedDragLeave = false;\n ev.currentTarget.classList.remove('dragEnter');\n removeDropEffect(ev.currentTarget);\n if (onDragLeave) onDragLeave(ev);\n } else if (\n !ev.currentTarget.contains(ev.relatedTarget as Element) &&\n ref.dragTarget !== ev.currentTarget\n ) {\n ref.dragLeaveSkipped = true;\n }\n },\n [ref, removeDropEffect, onDragLeave]\n );\n\n const dragProps = useMemo(\n () => ({\n draggable: true,\n onDragStart: dragStartCb,\n onDragEnd: dragEndCb\n }),\n [dragStartCb, dragEndCb]\n );\n\n const dropProps = useMemo(\n () => ({\n onDragEnter: dragEnterCb,\n onDragLeave: dragLeaveCb,\n 'data-drop': 'dropzone'\n }),\n [dragEnterCb, dragLeaveCb]\n );\n\n return {\n dragProps,\n dropProps\n };\n}\n"]}
@@ -1,9 +1,10 @@
1
1
  declare const _default: import("react").MemoExoticComponent<typeof Row>;
2
2
  export default _default;
3
- declare function Row({ row, columns, level }: {
3
+ declare function Row({ row, columns, level, dataIndex }: {
4
4
  row: any;
5
5
  columns: any;
6
6
  level?: number | undefined;
7
+ dataIndex: any;
7
8
  }): import("react/jsx-runtime").JSX.Element;
8
9
  declare namespace Row {
9
10
  namespace propTypes {
@@ -12,6 +13,7 @@ declare namespace Row {
12
13
  [x: string]: any;
13
14
  }>;
14
15
  let level: PropTypes.Requireable<number>;
16
+ let dataIndex: PropTypes.Requireable<number>;
15
17
  }
16
18
  }
17
19
  import PropTypes from 'prop-types';
@@ -1 +1 @@
1
- {"version":3,"file":"Row.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Table/Row.jsx"],"names":[],"mappings":";;AAKA;;;;4CAYC;;;;;;;;;;sBAjBqB,YAAY"}
1
+ {"version":3,"file":"Row.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Table/Row.jsx"],"names":[],"mappings":";;AAKA;;;;;4CAcC;;;;;;;;;;;sBAnBqB,YAAY"}
@@ -2,8 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import PropTypes from 'prop-types';
3
3
  import { memo } from 'react';
4
4
  import CellWrapper from './CellWrapper';
5
- function Row({ row, columns, level = 0 }) {
6
- return (_jsx("div", { ...row.getUIProps(), children: [...columns]
5
+ function Row({ row, columns, level = 0, dataIndex }) {
6
+ const uiProps = { ...row.getUIProps(), ...(dataIndex >= 0 ? { 'data-index': dataIndex } : {}) };
7
+ return (_jsx("div", { ...uiProps, children: [...columns]
7
8
  .sort((colA, colB) => colA.order - colB.order)
8
9
  .map(column => {
9
10
  column.setExecutionContext(row);
@@ -15,7 +16,8 @@ function Row({ row, columns, level = 0 }) {
15
16
  Row.propTypes = {
16
17
  columns: PropTypes.arrayOf(PropTypes.any),
17
18
  row: PropTypes.objectOf(PropTypes.any),
18
- level: PropTypes.number
19
+ level: PropTypes.number,
20
+ dataIndex: PropTypes.number
19
21
  };
20
22
  export default memo(Row);
21
23
  //# sourceMappingURL=Row.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Row.js","sourceRoot":"","sources":["../../../../Core/Views/Table/Row.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,SAAS,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,EAAE;IACtC,OAAO,CACL,iBAAS,GAAG,CAAC,UAAU,EAAE,YACtB,CAAC,GAAG,OAAO,CAAC;aACV,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;aAC7C,GAAG,CAAC,MAAM,CAAC,EAAE;YACZ,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;YAChC,IAAI,MAAM,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YAC/B,OAAO,KAAC,WAAW,IAAuB,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,IAAvD,MAAM,CAAC,KAAK,CAAC,EAAE,CAA4C,CAAC;QACvF,CAAC,CAAC,GACA,CACP,CAAC;AACJ,CAAC;AAED,GAAG,CAAC,SAAS,GAAG;IACd,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC;IACzC,GAAG,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;IACtC,KAAK,EAAE,SAAS,CAAC,MAAM;CACxB,CAAC;AAEF,eAAe,IAAI,CAAC,GAAG,CAAC,CAAC","sourcesContent":["import PropTypes from 'prop-types';\nimport { memo } from 'react';\n\nimport CellWrapper from './CellWrapper';\n\nfunction Row({ row, columns, level = 0 }) {\n return (\n <div {...row.getUIProps()}>\n {[...columns]\n .sort((colA, colB) => colA.order - colB.order)\n .map(column => {\n column.setExecutionContext(row);\n if (column.hidden) return null;\n return <CellWrapper key={column.field.id} row={row} column={column} level={level} />;\n })}\n </div>\n );\n}\n\nRow.propTypes = {\n columns: PropTypes.arrayOf(PropTypes.any),\n row: PropTypes.objectOf(PropTypes.any),\n level: PropTypes.number\n};\n\nexport default memo(Row);\n"]}
1
+ {"version":3,"file":"Row.js","sourceRoot":"","sources":["../../../../Core/Views/Table/Row.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,SAAS,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,EAAE,SAAS,EAAE;IACjD,MAAM,OAAO,GAAG,EAAE,GAAG,GAAG,CAAC,UAAU,EAAE,EAAE,GAAG,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IAEhG,OAAO,CACL,iBAAS,OAAO,YACb,CAAC,GAAG,OAAO,CAAC;aACV,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;aAC7C,GAAG,CAAC,MAAM,CAAC,EAAE;YACZ,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;YAChC,IAAI,MAAM,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YAC/B,OAAO,KAAC,WAAW,IAAuB,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,IAAvD,MAAM,CAAC,KAAK,CAAC,EAAE,CAA4C,CAAC;QACvF,CAAC,CAAC,GACA,CACP,CAAC;AACJ,CAAC;AAED,GAAG,CAAC,SAAS,GAAG;IACd,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC;IACzC,GAAG,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;IACtC,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B,CAAC;AAEF,eAAe,IAAI,CAAC,GAAG,CAAC,CAAC","sourcesContent":["import PropTypes from 'prop-types';\nimport { memo } from 'react';\n\nimport CellWrapper from './CellWrapper';\n\nfunction Row({ row, columns, level = 0, dataIndex }) {\n const uiProps = { ...row.getUIProps(), ...(dataIndex >= 0 ? { 'data-index': dataIndex } : {}) };\n\n return (\n <div {...uiProps}>\n {[...columns]\n .sort((colA, colB) => colA.order - colB.order)\n .map(column => {\n column.setExecutionContext(row);\n if (column.hidden) return null;\n return <CellWrapper key={column.field.id} row={row} column={column} level={level} />;\n })}\n </div>\n );\n}\n\nRow.propTypes = {\n columns: PropTypes.arrayOf(PropTypes.any),\n row: PropTypes.objectOf(PropTypes.any),\n level: PropTypes.number,\n dataIndex: PropTypes.number\n};\n\nexport default memo(Row);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"StyledTableContainer.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Table/StyledTableContainer.jsx"],"names":[],"mappings":";AAkBA,oNAk5BG"}
1
+ {"version":3,"file":"StyledTableContainer.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Table/StyledTableContainer.jsx"],"names":[],"mappings":";AAkBA,oNAs5BG"}
@@ -622,6 +622,10 @@ const StyledTableContainer = styled(forwardRef((props, ref) => _jsx("div", { ref
622
622
  &:not(.wrap-content-height) > .row:not(.group-header-row) {
623
623
  height: var(--data-row-height);
624
624
  }
625
+
626
+ & > .row:not(.group-header-row) {
627
+ min-width: 100%;
628
+ }
625
629
  border-end-start-radius: inherit;
626
630
  border-end-end-radius: inherit;
627
631
 
@@ -1 +1 @@
1
- {"version":3,"file":"StyledTableContainer.js","sourceRoot":"","sources":["../../../../Core/Views/Table/StyledTableContainer.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM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C;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,oBAAoB,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport styled, { css } from 'styled-components';\nimport {\n getLuminance,\n meetsContrastGuidelines,\n mix,\n readableColor,\n transparentize\n} from 'polished';\n\nimport { StyledStatus } from '@pega/cosmos-react-core/lib/components/Badges/Status';\nimport { StyledRadioCheck } from '@pega/cosmos-react-core/lib/components/RadioCheck/RadioCheck';\nimport { StyledLabel, calculateFontSize, tryCatch } from '@pega/cosmos-react-core';\n\nimport { generateRSDataContainerHeightStyles, generateRSHeightStyles } from '../../Utils/styles';\n\nimport { CellIcon } from './CellWrapper';\n\nconst StyledTableContainer = styled(forwardRef((props, ref) => <div ref={ref} {...props} />))(({\n theme,\n view,\n isFullscreen\n}) => {\n const isAggregationApplied = view.columns?.filter(c => !c.hidden).some(c => c.aggregated);\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const showFreezeLine =\n view.state.responsive?.sm &&\n !(view.hasNoRecords || view.hasNoFrozenColumns || view.bHideFreezeLine);\n const selectedRowColor = tryCatch(() =>\n mix(0.85, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n const lightGreyColor = theme.base.colors.gray['extra-light'];\n const freezeLineShadowTransparent = transparentize(\n 0.9,\n theme.components.table.header['foreground-color']\n );\n const oddRowBackgroundColor =\n getLuminance(theme.components.table.body['secondary-background-color']) > 0.5\n ? theme.components.table.body['secondary-background-color']\n : mix(\n 0.75,\n theme.components.table.body['background-color'],\n theme.components.table.body['secondary-background-color']\n );\n\n const headerForegroundContrast = meetsContrastGuidelines(\n theme.components.table.header['foreground-color'],\n theme.components.table.header['background-color']\n ).AA;\n const usableHeaderForeground = headerForegroundContrast\n ? theme.components.table.header['foreground-color']\n : readableColor(\n theme.components.table.header['foreground-color'],\n theme.components.table.header['background-color']\n );\n const oddRowContrast = meetsContrastGuidelines(\n theme.components.table.body['foreground-color'],\n oddRowBackgroundColor\n ).AA;\n const useableOddRowForeground = oddRowContrast\n ? theme.components.table.body['foreground-color']\n : readableColor(theme.components.table.body['foreground-color'], oddRowBackgroundColor);\n\n return css`\n --primary-background: ${theme.base.palette['primary-background']};\n --secondary-background: ${theme.components.table.header['background-color']};\n --forground-color: ${theme.base.palette['foreground-color']};\n --interactive: ${theme.base.palette.interactive};\n --medium-blue: ${theme.base.colors.blue.medium};\n --border-color: ${theme.base.palette['border-line']};\n --border-color-freeze: #a5a5a5;\n --border-width: 0.062rem;\n --border-style: var(--border-width) solid var(--border-color);\n --font-stretch: ${theme.components.table.typography['font-stretch']};\n --letter-spacing: ${theme.components.table.typography['letter-spacing']};\n --cell-padding: ${theme.base.spacing};\n --cell-vertical-padding: calc(${theme.base.spacing} * 0.5);\n --header-cell-padding: 0 0.5rem 0 var(--cell-padding);\n --header-bg-color: var(--secondary-background);\n --header-fg-color: ${usableHeaderForeground};\n --default-group-header-height: 1.5rem;\n --group-header-height: var(--default-group-header-height);\n --box-sizing: content-box;\n --animation-ease: ${theme.base.animation.timing.ease};\n --font-weight-semi-bold: ${theme.base['font-weight']['semi-bold']};\n --row-height-multiplier: 1.125;\n --cell-fixed-position: sticky;\n position: relative;\n ${() => generateRSHeightStyles({ view, isFullscreen })}\n\n .small-screen-table {\n --cell-fixed-position: static;\n }\n\n .container {\n ${() => generateRSDataContainerHeightStyles()};\n border: var(--border-style);\n border-radius: var(--border-radius, ${theme.base['border-radius']});\n position: relative;\n letter-spacing: var(--letter-spacing);\n font-stretch: var(--font-stretch);\n }\n\n .hide-rows-till-ready .row[aria-rowindex] {\n visibility: hidden;\n }\n\n .table-drag-proxy {\n background: rgba(0, 0, 0, 0.21);\n position: absolute;\n top: 0;\n bottom: 0;\n z-index: 6;\n pointer-events: none;\n display: none;\n }\n\n .table-drag-line {\n background: #999999;\n position: absolute;\n top: 0;\n bottom: 0;\n width: 0.12rem;\n z-index: 6;\n pointer-events: none;\n display: none;\n }\n\n .cell-fixed {\n z-index: 1;\n }\n\n .group-wrapper {\n overflow: hidden;\n display: inline-flex;\n line-height: var(--group-header-height);\n\n .group-context-count {\n display: inline-flex;\n overflow: hidden;\n }\n }\n\n /* In review mode(Ex: Tabs) cosmos components are rendered and mark up is not compatible with\n group-wrapper cell. Overridden css in group-header when dl exists inside that class which indicates\n mark up is generated from cosmos which differentiates from normal table cell markup */\n .group-wrapper .group-context-count dl {\n grid-template-columns: auto;\n }\n\n .fallback,\n .fallback-footer {\n height: var(--row-height);\n background-color: var(--header-bg-color);\n color: var(--header-fg-color);\n position: absolute;\n width: 100%;\n z-index: -1;\n box-sizing: var(--box-sizing);\n }\n\n .fallback {\n /* stylelint-disable unit-allowed-list */\n top: -1px;\n border-bottom: var(--border-style);\n }\n\n .fallback-footer {\n top: 0;\n border-top: var(--border-style);\n }\n\n .sticky-header {\n display: grid;\n position: sticky;\n top: 0;\n z-index: 6;\n border-start-start-radius: inherit;\n border-start-end-radius: inherit;\n }\n\n .cell {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n\n .icons-ph {\n min-width: 1rem;\n }\n\n &.custom-item {\n width: 10em;\n }\n }\n\n .cell:focus {\n outline: 0.125rem auto var(--medium-blue);\n }\n\n .cell.selection-border:focus,\n .cell.editable-cell:focus {\n outline: none 0;\n }\n\n .editable-cell > span {\n height: 100%;\n display: flex;\n padding: 0 6px;\n align-items: center;\n }\n\n .row {\n display: inline-flex;\n height: var(--row-height);\n outline: none 0;\n transition: transform 0.5s var(--animation-ease);\n box-sizing: var(--box-sizing);\n position: relative;\n\n > .row-select-handle {\n display: flex;\n justify-content: center;\n &:active {\n outline: none;\n }\n\n > .header-lable-container {\n min-width: 20px;\n }\n /* stylelint-disable selector-max-class */\n &.cell-fixed > .cell-content {\n flex-grow: unset;\n }\n }\n\n > .cell,\n .group-header-aggregation-row > .cell {\n transition: transform 0.5s var(--animation-ease);\n border-right: var(--border-style);\n ${!theme.components.table['striped-rows'] &&\n css`\n border-bottom: var(--border-style);\n `}\n display: flex;\n align-items: center;\n\n &::after {\n opacity: 1;\n transition: opacity 0.1s var(--animation-ease);\n }\n\n .row-action-menu {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n &.cell-action {\n position: sticky;\n z-index: 4;\n right: 0;\n border-right: 0;\n justify-content: center;\n border-left: var(--border-style);\n\n /* The below styles are needed to avoid ellipses in safari when no text is present\n and to hide the 'Actions' label */\n\n /* stylelint-disable max-nesting-depth */\n\n div.header-label {\n text-overflow: unset;\n }\n }\n &.aggregateCell {\n background-color: var(--header-bg-color);\n }\n }\n\n /** Adds bottom border to the last row of a group, when striped-rows are enabled */\n &:has(+ .group-header-row) > .cell {\n ${theme.components.table['striped-rows'] &&\n css`\n border-bottom: var(--border-style);\n `}\n }\n &.header > .cell {\n border-bottom: var(--border-style);\n }\n .group-header-aggregation-row {\n > .cell {\n &.cell-action {\n overflow: initial;\n\n /* extending border on the top left of row action cell as we need to show border for at the end group label value when row actions are present */\n &::before {\n content: '';\n position: absolute;\n inline-size: 0;\n inset-inline-start: calc(var(--border-width) * -1);\n inset-block-start: calc(var(--group-header-height) * -1);\n block-size: var(--group-header-height);\n border-inline-start: var(--border-style);\n }\n }\n }\n }\n\n > .cell-action {\n background-color: var(--primary-background);\n }\n\n > .row-reorder-handle {\n padding: 0;\n border-right: 0 !important;\n justify-content: center;\n cursor: move;\n }\n\n .aggregateCell.cell {\n border-right: none;\n }\n\n > .cell.cell-fixed,\n .group-header-aggregation-row > .cell-fixed {\n position: var(--cell-fixed-position);\n z-index: 4;\n\n ${showFreezeLine &&\n css`\n &.cell-last-frozen {\n border-right: solid 1px var(--border-color-freeze);\n box-shadow: calc(${theme.base.spacing} * 0.25) 0 0 0 ${freezeLineShadowTransparent};\n transition: 0.5s;\n }\n `}\n\n /* As the row select column and row dragDrop column always have to be frozen */\n &[data-col-id='RowSelect'],\n &[data-col-id='RowDragDrop'],\n &[data-col-id='RowError'] {\n position: sticky;\n flex-shrink: 0;\n z-index: 5;\n }\n }\n\n > .cell.cell-fixed:focus-within,\n .group-header-aggregation-row > .cell-fixed {\n z-index: 6;\n }\n\n &.click {\n cursor: pointer;\n }\n\n &:last-child {\n border-end-start-radius: inherit;\n border-end-end-radius: inherit;\n\n > .cell {\n &:first-child {\n border-end-start-radius: inherit;\n }\n\n &:last-child {\n border-end-end-radius: inherit;\n }\n\n ${theme.components.table['striped-rows'] &&\n css`\n border-bottom: var(--border-style);\n `}\n }\n }\n }\n .row:not(.row-error):not(.group-header-row):not(.header) {\n .cell-fixed {\n background: var(--primary-background);\n }\n .cell-fixed.aggregateCell {\n background: var(--header-bg-color);\n }\n }\n ${theme.components.table['striped-rows'] &&\n css`\n /* Targets rows with an odd data-index attribute, excluding group header rows */\n .row[data-index$='1']:not(.group-header-row):not(.header),\n .row[data-index$='3']:not(.group-header-row):not(.header),\n .row[data-index$='5']:not(.group-header-row):not(.header),\n .row[data-index$='7']:not(.group-header-row):not(.header),\n .row[data-index$='9']:not(.group-header-row):not(.header) {\n background: ${oddRowBackgroundColor};\n color: ${useableOddRowForeground};\n .cell-fixed {\n background: ${oddRowBackgroundColor};\n color: ${useableOddRowForeground};\n }\n > .cell-action {\n background: ${oddRowBackgroundColor};\n }\n }\n `}\n\n .row-error {\n background: ${mix(\n 0.1,\n theme.components['form-field'].error['status-color'],\n theme.base.palette['primary-background']\n )};\n\n /* stylelint-disable no-descending-specificity */\n .cell-fixed,\n .cell-action {\n background: inherit;\n }\n\n > .cell:not(.cell-fixed):not(.cell-action) {\n background: none;\n }\n }\n\n .sort-info-container {\n margin-left: 0.312rem;\n\n .sort-sequence {\n font-size: 0.625rem;\n color: ${theme.base.colors.gray['extra-dark']};\n }\n }\n\n .filter-info-container {\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 0 0 0 0.312rem;\n\n svg {\n width: 14px;\n height: 14px;\n }\n }\n\n .cell.row-error-column {\n padding: 0;\n border-right: 0;\n text-align: right;\n outline: none;\n\n /* Focus handling will be done as part of interation 2: EPIC-88751 */\n\n svg {\n color: ${theme.base.colors.red.medium};\n }\n }\n\n .cell-right-align .filter-info-container svg {\n margin: 0 0.312rem 0 0;\n }\n\n .editable-cell {\n padding: 0;\n border: 2px solid ${theme.base.palette.interactive} !important;\n box-shadow: 0 0 1px 1px rgba(0, 118, 209) !important;\n }\n\n .editable-cell input {\n border: none;\n outline: none;\n min-width: calc(100%);\n min-height: 0;\n max-height: 100%;\n box-shadow: none !important;\n border-radius: 0;\n }\n\n .editable-cell.align-right input {\n justify-content: right;\n }\n\n &.show-expand-collapse-all {\n .row > .cell-first {\n padding-left: calc(var(--expand-collapse-all-width) + var(--cell-padding) + 0.25rem);\n &.row-reorder-handle,\n &.row-error-column {\n padding: 0;\n }\n &.row-select-handle {\n padding-left: calc(var(--expand-collapse-all-width) + 0.25rem);\n }\n }\n\n .row-container .row > .cell-first {\n &.row-select-handle {\n padding-inline-start: calc(\n var(--expand-collapse-all-width) - var(--cell-padding) + 0.25rem\n );\n }\n }\n\n /* stylelint-enable selector-max-class */\n .expand-collapse-all {\n position: absolute;\n width: var(--expand-collapse-all-width);\n z-index: 10;\n height: var(--row-height);\n background-color: var(--header-bg-color);\n color: var(--header-fg-color);\n border-right: var(--border-style);\n border-bottom: var(--border-style);\n border-start-start-radius: ${theme.base['border-radius']};\n padding-inline-start: 0.125rem;\n margin-inline-start: 0.25rem;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &::before {\n content: '';\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: -0.25rem;\n width: 0.25rem;\n height: 100%;\n background-color: var(--header-bg-color);\n z-index: 12;\n }\n\n > button {\n color: var(--forground-color);\n :focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n }\n .no-border-right {\n border-right: 0;\n }\n }\n\n /* stylelint-disable selector-max-class */\n\n .scroll-end {\n &.row-container > .row:last-child {\n & > .cell,\n & .group-header-aggregation-row > .cell {\n border-bottom: 0;\n }\n }\n }\n\n /* stylelint-enable selector-max-class */\n .header {\n font-weight: var(--font-weight-semi-bold);\n position: relative; /* This is required to position .border-fix element */\n border-start-start-radius: inherit;\n border-start-end-radius: inherit;\n\n > .cell.row-error-column {\n border-right: 0;\n }\n > .cell {\n display: flex;\n justify-content: space-between;\n align-items: center;\n z-index: 2;\n position: relative;\n cursor: pointer;\n background-color: var(--header-bg-color);\n color: var(--header-fg-color);\n font-weight: ${theme.base['font-weight'].bold};\n font-size: ${fontSize.xxs};\n border-right: var(--border-style);\n padding: var(--header-cell-padding);\n\n &:first-child {\n border-start-start-radius: inherit;\n }\n\n &:last-child {\n border-start-end-radius: inherit;\n }\n\n .header-lable-container {\n display: inline-flex;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: ${fontSize.xs};\n font-weight: var(--font-weight-semi-bold);\n align-items: center;\n }\n\n .header-label {\n overflow: hidden;\n text-overflow: ellipsis;\n\n /* To avoid browser tooltip when we get ellipsis in safari */\n &::after {\n content: '';\n display: block;\n }\n\n /* To utilize smart tooltip making it as a non-box element */\n /* stylelint-disable selector-max-class */\n .cell-content {\n display: contents;\n }\n }\n }\n\n > .row-reorder-handle {\n padding: 0;\n }\n\n > .row-select-handle {\n justify-content: center;\n }\n\n > .cell-right-align {\n padding: var(--header-cell-padding);\n justify-content: end;\n\n .header-lable-container {\n flex-direction: row-reverse;\n }\n\n .sort-info-container {\n margin-left: 0;\n margin-right: 0.312rem;\n }\n }\n\n > .cell-first {\n padding: 0 var(--cell-padding);\n }\n\n .row {\n border-bottom: none;\n }\n }\n\n /* 4 selectors required as aggregateCell of only footer need this effect */\n\n .pContainer:not(.pContainerScroll) .footer .aggregateCell.cell {\n border-bottom: none;\n }\n\n /* stylelint-enable selector-max-class */\n .row .cell.cell-last {\n border-right: 0;\n flex-grow: 1;\n }\n\n .row-container {\n --data-row-height: calc(\n var(--hit-area) * var(--row-height-multiplier) + var(--cell-vertical-padding)\n );\n --group-header-height: ${isAggregationApplied\n ? 'var(--default-group-header-height)'\n : 'var(--data-row-height)'};\n &:not(.wrap-content-height) > .row:not(.group-header-row) {\n height: var(--data-row-height);\n }\n border-end-start-radius: inherit;\n border-end-end-radius: inherit;\n\n & > .row .cell-content {\n /*\n * Using box sizing content-box so that the padding is not considered for the alignment of the cell content.\n * Vertical alignment is done using flex and max-height below even though the .cell-content might overflow due to padding + content size.\n */\n box-sizing: content-box;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n word-break: break-all;\n flex-grow: 1;\n\n /* Adding padding on .cell-content so that focus rings can appear properly and doesn't clip due to overflow: hidden */\n padding: var(--cell-vertical-padding) var(--cell-padding);\n\n /* setting max-height so that the elements with more height like RTL, align with the row density height */\n max-height: var(--data-row-height);\n\n /* hiding scroll bar in case the cell render introduces scrollbar based on its implementation */\n & * {\n scrollbar-width: none;\n }\n\n /* in case of combine columns, removing padding from parent cell-content as children already have the padding */\n &:has(.combined-cell) {\n padding: 0;\n\n /* stylelint-disable-next-line selector-max-class */\n .cell-content {\n flex-grow: unset;\n }\n }\n }\n }\n\n .row .aggregateCell .cell-content {\n line-height: initial;\n padding: 0;\n }\n\n .short-height,\n .medium-height {\n ${StyledStatus} {\n white-space: nowrap;\n }\n }\n\n .short-height {\n ${StyledRadioCheck} ${StyledLabel} {\n min-height: auto;\n }\n }\n\n .medium-height {\n --row-height-multiplier: 4 / 3;\n }\n\n .tall-height {\n --row-height-multiplier: calc(4 / 3 + 0.5);\n > .row:not(.group-header-row) {\n > .cell {\n display: inline-grid;\n align-items: start;\n white-space: normal;\n word-break: break-all;\n grid-auto-flow: column;\n\n :has(> ${CellIcon}) {\n /* Adds spacing between children when icons are rendered alongside cell content in the cell container. */\n justify-content: space-between;\n }\n\n /* stylelint-disable selector-max-class */\n /* stylelint-disable-next-line selector-max-compound-selectors */\n > .cell-content > .combined-cell > .combined-cell-content,\n > .cell-content {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n white-space: inherit;\n word-break: inherit;\n }\n\n ${CellIcon} {\n margin-block-start: 0.375rem;\n }\n }\n }\n }\n\n .wrap-content-height {\n --row-height-multiplier: 4 / 3;\n --row-min-height: calc(\n var(--hit-area) * var(--row-height-multiplier) + var(--cell-vertical-padding) * 2\n );\n --group-header-height: ${isAggregationApplied\n ? 'var(--default-group-header-height)'\n : 'var(--row-min-height)'};\n\n > .row:not(.group-header-row) {\n height: auto;\n min-height: var(--row-min-height);\n > .cell {\n white-space: normal;\n\n /* -- For BUG-625508 -- */\n word-break: break-word;\n display: inline-grid;\n align-items: start;\n padding-top: var(--cell-vertical-padding);\n padding-bottom: var(--cell-vertical-padding);\n grid-auto-flow: column;\n\n :has(> ${CellIcon}) {\n /* Adds spacing between children when icons are rendered alongside cell content in the cell container. */\n justify-content: space-between;\n }\n\n /* stylelint-disable-next-line selector-max-compound-selectors */\n > .cell-content > .combined-cell > .combined-cell-content,\n > .cell-content {\n /* for full-content, the row cells should adjust according to content */\n max-height: none;\n white-space: inherit;\n word-break: inherit;\n }\n\n ${CellIcon} {\n margin-block-start: 0.375rem;\n }\n }\n }\n }\n\n .footer {\n .row {\n .cell {\n padding: 0;\n }\n }\n }\n\n /* stylelint-disable no-duplicate-selectors */\n .row-container {\n position: absolute;\n display: grid;\n width: 100%;\n font-size: ${fontSize.s};\n\n > .group-header-row,\n .hierarchical-group-footer-row {\n height: var(--group-header-height);\n .cell {\n padding: 0;\n border-right-width: 0;\n }\n }\n\n > .hierarchical-group-header-row {\n height: var(--group-header-height);\n }\n input.checkbox-on-hover + label {\n opacity: 0;\n }\n input.checkbox-on-hover:checked + label {\n opacity: 1;\n }\n .row.selected-row {\n background-color: ${selectedRowColor};\n\n > .cell,\n .cell-fixed,\n .cell-action {\n background-color: ${selectedRowColor};\n }\n }\n .row-on-hover:hover {\n background-color: ${lightGreyColor};\n input.checkbox-on-hover + label {\n opacity: 1;\n }\n\n > .cell,\n .cell-fixed,\n .cell-action {\n background-color: ${lightGreyColor};\n }\n }\n .row.hierarchical-group-footer-row {\n .cell-fixed {\n background: ${lightGreyColor};\n }\n }\n }\n\n /* stylelint-enable selector-max-class */\n\n .toolbar-button-applied {\n padding: 0 8px;\n margin: 0 calc(${theme.base.spacing} / 4);\n }\n\n .toolbar-button {\n padding: 0 8px;\n margin: 0 calc(${theme.base.spacing} / 4);\n }\n\n .column-resizer {\n cursor: col-resize;\n position: absolute;\n top: 0;\n right: 0;\n z-index: 3;\n width: 0.25rem;\n height: 100%;\n }\n\n .column-resizer:hover,\n .column-resizer:active {\n background: var(--interactive);\n }\n\n .align-right {\n justify-content: right;\n\n .cell-content {\n text-align: right;\n }\n }\n\n .align-left {\n justify-content: left;\n\n .cell-content {\n text-align: left;\n }\n }\n\n .align-center {\n justify-content: center;\n\n .cell-content {\n text-align: center;\n }\n }\n\n .selection-border {\n border: 0.125rem solid var(--medium-blue) !important;\n }\n\n .disable-select {\n user-select: none; /* supported by Chrome and Firefox */\n -webkit-user-select: none; /* Safari */\n }\n\n .popper {\n div.row {\n display: flex;\n vertical-align: middle;\n line-height: unset;\n border-bottom: none;\n outline: none 0;\n height: auto;\n }\n }\n `;\n});\n\nexport default StyledTableContainer;\n"]}
1
+ {"version":3,"file":"StyledTableContainer.js","sourceRoot":"","sources":["../../../../Core/Views/Table/StyledTableContainer.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,GAAG,EACH,aAAa,EACb,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,YAAY,EAAE,MAAM,sDAAsD,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnF,OAAO,EAAE,mCAAmC,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjG,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,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;;;;;;;;;;;;;;;;;;;;;;;;+BAsEH,oBAAoB;QAC3C,CAAC,CAAC,oCAAoC;QACtC,CAAC,CAAC,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqD1B,YAAY;;;;;;QAMZ,gBAAgB,IAAI,WAAW;;;;;;;;;;;;;;;;;;;mBAmBpB,QAAQ;;;;;;;;;;;;;;;;YAgBf,QAAQ;;;;;;;;;;;;+BAYW,oBAAoB;QAC3C,CAAC,CAAC,oCAAoC;QACtC,CAAC,CAAC,uBAAuB;;;;;;;;;;;;;;;;mBAgBd,QAAQ;;;;;;;;;;;;;;YAcf,QAAQ;;;;;;;;;;;;;;;;;;;;mBAoBD,QAAQ,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;4BAqBD,gBAAgB;;;;;8BAKd,gBAAgB;;;;4BAIlB,cAAc;;;;;;;;8BAQZ,cAAc;;;;;wBAKpB,cAAc;;;;;;;;;uBASf,KAAK,CAAC,IAAI,CAAC,OAAO;;;;;uBAKlB,KAAK,CAAC,IAAI,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DtC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,oBAAoB,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport styled, { css } from 'styled-components';\nimport {\n getLuminance,\n meetsContrastGuidelines,\n mix,\n readableColor,\n transparentize\n} from 'polished';\n\nimport { StyledStatus } from '@pega/cosmos-react-core/lib/components/Badges/Status';\nimport { StyledRadioCheck } from '@pega/cosmos-react-core/lib/components/RadioCheck/RadioCheck';\nimport { StyledLabel, calculateFontSize, tryCatch } from '@pega/cosmos-react-core';\n\nimport { generateRSDataContainerHeightStyles, generateRSHeightStyles } from '../../Utils/styles';\n\nimport { CellIcon } from './CellWrapper';\n\nconst StyledTableContainer = styled(forwardRef((props, ref) => <div ref={ref} {...props} />))(({\n theme,\n view,\n isFullscreen\n}) => {\n const isAggregationApplied = view.columns?.filter(c => !c.hidden).some(c => c.aggregated);\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const showFreezeLine =\n view.state.responsive?.sm &&\n !(view.hasNoRecords || view.hasNoFrozenColumns || view.bHideFreezeLine);\n const selectedRowColor = tryCatch(() =>\n mix(0.85, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n const lightGreyColor = theme.base.colors.gray['extra-light'];\n const freezeLineShadowTransparent = transparentize(\n 0.9,\n theme.components.table.header['foreground-color']\n );\n const oddRowBackgroundColor =\n getLuminance(theme.components.table.body['secondary-background-color']) > 0.5\n ? theme.components.table.body['secondary-background-color']\n : mix(\n 0.75,\n theme.components.table.body['background-color'],\n theme.components.table.body['secondary-background-color']\n );\n\n const headerForegroundContrast = meetsContrastGuidelines(\n theme.components.table.header['foreground-color'],\n theme.components.table.header['background-color']\n ).AA;\n const usableHeaderForeground = headerForegroundContrast\n ? theme.components.table.header['foreground-color']\n : readableColor(\n theme.components.table.header['foreground-color'],\n theme.components.table.header['background-color']\n );\n const oddRowContrast = meetsContrastGuidelines(\n theme.components.table.body['foreground-color'],\n oddRowBackgroundColor\n ).AA;\n const useableOddRowForeground = oddRowContrast\n ? theme.components.table.body['foreground-color']\n : readableColor(theme.components.table.body['foreground-color'], oddRowBackgroundColor);\n\n return css`\n --primary-background: ${theme.base.palette['primary-background']};\n --secondary-background: ${theme.components.table.header['background-color']};\n --forground-color: ${theme.base.palette['foreground-color']};\n --interactive: ${theme.base.palette.interactive};\n --medium-blue: ${theme.base.colors.blue.medium};\n --border-color: ${theme.base.palette['border-line']};\n --border-color-freeze: #a5a5a5;\n --border-width: 0.062rem;\n --border-style: var(--border-width) solid var(--border-color);\n --font-stretch: ${theme.components.table.typography['font-stretch']};\n --letter-spacing: ${theme.components.table.typography['letter-spacing']};\n --cell-padding: ${theme.base.spacing};\n --cell-vertical-padding: calc(${theme.base.spacing} * 0.5);\n --header-cell-padding: 0 0.5rem 0 var(--cell-padding);\n --header-bg-color: var(--secondary-background);\n --header-fg-color: ${usableHeaderForeground};\n --default-group-header-height: 1.5rem;\n --group-header-height: var(--default-group-header-height);\n --box-sizing: content-box;\n --animation-ease: ${theme.base.animation.timing.ease};\n --font-weight-semi-bold: ${theme.base['font-weight']['semi-bold']};\n --row-height-multiplier: 1.125;\n --cell-fixed-position: sticky;\n position: relative;\n ${() => generateRSHeightStyles({ view, isFullscreen })}\n\n .small-screen-table {\n --cell-fixed-position: static;\n }\n\n .container {\n ${() => generateRSDataContainerHeightStyles()};\n border: var(--border-style);\n border-radius: var(--border-radius, ${theme.base['border-radius']});\n position: relative;\n letter-spacing: var(--letter-spacing);\n font-stretch: var(--font-stretch);\n }\n\n .hide-rows-till-ready .row[aria-rowindex] {\n visibility: hidden;\n }\n\n .table-drag-proxy {\n background: rgba(0, 0, 0, 0.21);\n position: absolute;\n top: 0;\n bottom: 0;\n z-index: 6;\n pointer-events: none;\n display: none;\n }\n\n .table-drag-line {\n background: #999999;\n position: absolute;\n top: 0;\n bottom: 0;\n width: 0.12rem;\n z-index: 6;\n pointer-events: none;\n display: none;\n }\n\n .cell-fixed {\n z-index: 1;\n }\n\n .group-wrapper {\n overflow: hidden;\n display: inline-flex;\n line-height: var(--group-header-height);\n\n .group-context-count {\n display: inline-flex;\n overflow: hidden;\n }\n }\n\n /* In review mode(Ex: Tabs) cosmos components are rendered and mark up is not compatible with\n group-wrapper cell. Overridden css in group-header when dl exists inside that class which indicates\n mark up is generated from cosmos which differentiates from normal table cell markup */\n .group-wrapper .group-context-count dl {\n grid-template-columns: auto;\n }\n\n .fallback,\n .fallback-footer {\n height: var(--row-height);\n background-color: var(--header-bg-color);\n color: var(--header-fg-color);\n position: absolute;\n width: 100%;\n z-index: -1;\n box-sizing: var(--box-sizing);\n }\n\n .fallback {\n /* stylelint-disable unit-allowed-list */\n top: -1px;\n border-bottom: var(--border-style);\n }\n\n .fallback-footer {\n top: 0;\n border-top: var(--border-style);\n }\n\n .sticky-header {\n display: grid;\n position: sticky;\n top: 0;\n z-index: 6;\n border-start-start-radius: inherit;\n border-start-end-radius: inherit;\n }\n\n .cell {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n\n .icons-ph {\n min-width: 1rem;\n }\n\n &.custom-item {\n width: 10em;\n }\n }\n\n .cell:focus {\n outline: 0.125rem auto var(--medium-blue);\n }\n\n .cell.selection-border:focus,\n .cell.editable-cell:focus {\n outline: none 0;\n }\n\n .editable-cell > span {\n height: 100%;\n display: flex;\n padding: 0 6px;\n align-items: center;\n }\n\n .row {\n display: inline-flex;\n height: var(--row-height);\n outline: none 0;\n transition: transform 0.5s var(--animation-ease);\n box-sizing: var(--box-sizing);\n position: relative;\n\n > .row-select-handle {\n display: flex;\n justify-content: center;\n &:active {\n outline: none;\n }\n\n > .header-lable-container {\n min-width: 20px;\n }\n /* stylelint-disable selector-max-class */\n &.cell-fixed > .cell-content {\n flex-grow: unset;\n }\n }\n\n > .cell,\n .group-header-aggregation-row > .cell {\n transition: transform 0.5s var(--animation-ease);\n border-right: var(--border-style);\n ${!theme.components.table['striped-rows'] &&\n css`\n border-bottom: var(--border-style);\n `}\n display: flex;\n align-items: center;\n\n &::after {\n opacity: 1;\n transition: opacity 0.1s var(--animation-ease);\n }\n\n .row-action-menu {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n &.cell-action {\n position: sticky;\n z-index: 4;\n right: 0;\n border-right: 0;\n justify-content: center;\n border-left: var(--border-style);\n\n /* The below styles are needed to avoid ellipses in safari when no text is present\n and to hide the 'Actions' label */\n\n /* stylelint-disable max-nesting-depth */\n\n div.header-label {\n text-overflow: unset;\n }\n }\n &.aggregateCell {\n background-color: var(--header-bg-color);\n }\n }\n\n /** Adds bottom border to the last row of a group, when striped-rows are enabled */\n &:has(+ .group-header-row) > .cell {\n ${theme.components.table['striped-rows'] &&\n css`\n border-bottom: var(--border-style);\n `}\n }\n &.header > .cell {\n border-bottom: var(--border-style);\n }\n .group-header-aggregation-row {\n > .cell {\n &.cell-action {\n overflow: initial;\n\n /* extending border on the top left of row action cell as we need to show border for at the end group label value when row actions are present */\n &::before {\n content: '';\n position: absolute;\n inline-size: 0;\n inset-inline-start: calc(var(--border-width) * -1);\n inset-block-start: calc(var(--group-header-height) * -1);\n block-size: var(--group-header-height);\n border-inline-start: var(--border-style);\n }\n }\n }\n }\n\n > .cell-action {\n background-color: var(--primary-background);\n }\n\n > .row-reorder-handle {\n padding: 0;\n border-right: 0 !important;\n justify-content: center;\n cursor: move;\n }\n\n .aggregateCell.cell {\n border-right: none;\n }\n\n > .cell.cell-fixed,\n .group-header-aggregation-row > .cell-fixed {\n position: var(--cell-fixed-position);\n z-index: 4;\n\n ${showFreezeLine &&\n css`\n &.cell-last-frozen {\n border-right: solid 1px var(--border-color-freeze);\n box-shadow: calc(${theme.base.spacing} * 0.25) 0 0 0 ${freezeLineShadowTransparent};\n transition: 0.5s;\n }\n `}\n\n /* As the row select column and row dragDrop column always have to be frozen */\n &[data-col-id='RowSelect'],\n &[data-col-id='RowDragDrop'],\n &[data-col-id='RowError'] {\n position: sticky;\n flex-shrink: 0;\n z-index: 5;\n }\n }\n\n > .cell.cell-fixed:focus-within,\n .group-header-aggregation-row > .cell-fixed {\n z-index: 6;\n }\n\n &.click {\n cursor: pointer;\n }\n\n &:last-child {\n border-end-start-radius: inherit;\n border-end-end-radius: inherit;\n\n > .cell {\n &:first-child {\n border-end-start-radius: inherit;\n }\n\n &:last-child {\n border-end-end-radius: inherit;\n }\n\n ${theme.components.table['striped-rows'] &&\n css`\n border-bottom: var(--border-style);\n `}\n }\n }\n }\n .row:not(.row-error):not(.group-header-row):not(.header) {\n .cell-fixed {\n background: var(--primary-background);\n }\n .cell-fixed.aggregateCell {\n background: var(--header-bg-color);\n }\n }\n ${theme.components.table['striped-rows'] &&\n css`\n /* Targets rows with an odd data-index attribute, excluding group header rows */\n .row[data-index$='1']:not(.group-header-row):not(.header),\n .row[data-index$='3']:not(.group-header-row):not(.header),\n .row[data-index$='5']:not(.group-header-row):not(.header),\n .row[data-index$='7']:not(.group-header-row):not(.header),\n .row[data-index$='9']:not(.group-header-row):not(.header) {\n background: ${oddRowBackgroundColor};\n color: ${useableOddRowForeground};\n .cell-fixed {\n background: ${oddRowBackgroundColor};\n color: ${useableOddRowForeground};\n }\n > .cell-action {\n background: ${oddRowBackgroundColor};\n }\n }\n `}\n\n .row-error {\n background: ${mix(\n 0.1,\n theme.components['form-field'].error['status-color'],\n theme.base.palette['primary-background']\n )};\n\n /* stylelint-disable no-descending-specificity */\n .cell-fixed,\n .cell-action {\n background: inherit;\n }\n\n > .cell:not(.cell-fixed):not(.cell-action) {\n background: none;\n }\n }\n\n .sort-info-container {\n margin-left: 0.312rem;\n\n .sort-sequence {\n font-size: 0.625rem;\n color: ${theme.base.colors.gray['extra-dark']};\n }\n }\n\n .filter-info-container {\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 0 0 0 0.312rem;\n\n svg {\n width: 14px;\n height: 14px;\n }\n }\n\n .cell.row-error-column {\n padding: 0;\n border-right: 0;\n text-align: right;\n outline: none;\n\n /* Focus handling will be done as part of interation 2: EPIC-88751 */\n\n svg {\n color: ${theme.base.colors.red.medium};\n }\n }\n\n .cell-right-align .filter-info-container svg {\n margin: 0 0.312rem 0 0;\n }\n\n .editable-cell {\n padding: 0;\n border: 2px solid ${theme.base.palette.interactive} !important;\n box-shadow: 0 0 1px 1px rgba(0, 118, 209) !important;\n }\n\n .editable-cell input {\n border: none;\n outline: none;\n min-width: calc(100%);\n min-height: 0;\n max-height: 100%;\n box-shadow: none !important;\n border-radius: 0;\n }\n\n .editable-cell.align-right input {\n justify-content: right;\n }\n\n &.show-expand-collapse-all {\n .row > .cell-first {\n padding-left: calc(var(--expand-collapse-all-width) + var(--cell-padding) + 0.25rem);\n &.row-reorder-handle,\n &.row-error-column {\n padding: 0;\n }\n &.row-select-handle {\n padding-left: calc(var(--expand-collapse-all-width) + 0.25rem);\n }\n }\n\n .row-container .row > .cell-first {\n &.row-select-handle {\n padding-inline-start: calc(\n var(--expand-collapse-all-width) - var(--cell-padding) + 0.25rem\n );\n }\n }\n\n /* stylelint-enable selector-max-class */\n .expand-collapse-all {\n position: absolute;\n width: var(--expand-collapse-all-width);\n z-index: 10;\n height: var(--row-height);\n background-color: var(--header-bg-color);\n color: var(--header-fg-color);\n border-right: var(--border-style);\n border-bottom: var(--border-style);\n border-start-start-radius: ${theme.base['border-radius']};\n padding-inline-start: 0.125rem;\n margin-inline-start: 0.25rem;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &::before {\n content: '';\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: -0.25rem;\n width: 0.25rem;\n height: 100%;\n background-color: var(--header-bg-color);\n z-index: 12;\n }\n\n > button {\n color: var(--forground-color);\n :focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n }\n .no-border-right {\n border-right: 0;\n }\n }\n\n /* stylelint-disable selector-max-class */\n\n .scroll-end {\n &.row-container > .row:last-child {\n & > .cell,\n & .group-header-aggregation-row > .cell {\n border-bottom: 0;\n }\n }\n }\n\n /* stylelint-enable selector-max-class */\n .header {\n font-weight: var(--font-weight-semi-bold);\n position: relative; /* This is required to position .border-fix element */\n border-start-start-radius: inherit;\n border-start-end-radius: inherit;\n\n > .cell.row-error-column {\n border-right: 0;\n }\n > .cell {\n display: flex;\n justify-content: space-between;\n align-items: center;\n z-index: 2;\n position: relative;\n cursor: pointer;\n background-color: var(--header-bg-color);\n color: var(--header-fg-color);\n font-weight: ${theme.base['font-weight'].bold};\n font-size: ${fontSize.xxs};\n border-right: var(--border-style);\n padding: var(--header-cell-padding);\n\n &:first-child {\n border-start-start-radius: inherit;\n }\n\n &:last-child {\n border-start-end-radius: inherit;\n }\n\n .header-lable-container {\n display: inline-flex;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: ${fontSize.xs};\n font-weight: var(--font-weight-semi-bold);\n align-items: center;\n }\n\n .header-label {\n overflow: hidden;\n text-overflow: ellipsis;\n\n /* To avoid browser tooltip when we get ellipsis in safari */\n &::after {\n content: '';\n display: block;\n }\n\n /* To utilize smart tooltip making it as a non-box element */\n /* stylelint-disable selector-max-class */\n .cell-content {\n display: contents;\n }\n }\n }\n\n > .row-reorder-handle {\n padding: 0;\n }\n\n > .row-select-handle {\n justify-content: center;\n }\n\n > .cell-right-align {\n padding: var(--header-cell-padding);\n justify-content: end;\n\n .header-lable-container {\n flex-direction: row-reverse;\n }\n\n .sort-info-container {\n margin-left: 0;\n margin-right: 0.312rem;\n }\n }\n\n > .cell-first {\n padding: 0 var(--cell-padding);\n }\n\n .row {\n border-bottom: none;\n }\n }\n\n /* 4 selectors required as aggregateCell of only footer need this effect */\n\n .pContainer:not(.pContainerScroll) .footer .aggregateCell.cell {\n border-bottom: none;\n }\n\n /* stylelint-enable selector-max-class */\n .row .cell.cell-last {\n border-right: 0;\n flex-grow: 1;\n }\n\n .row-container {\n --data-row-height: calc(\n var(--hit-area) * var(--row-height-multiplier) + var(--cell-vertical-padding)\n );\n --group-header-height: ${isAggregationApplied\n ? 'var(--default-group-header-height)'\n : 'var(--data-row-height)'};\n &:not(.wrap-content-height) > .row:not(.group-header-row) {\n height: var(--data-row-height);\n }\n\n & > .row:not(.group-header-row) {\n min-width: 100%;\n }\n border-end-start-radius: inherit;\n border-end-end-radius: inherit;\n\n & > .row .cell-content {\n /*\n * Using box sizing content-box so that the padding is not considered for the alignment of the cell content.\n * Vertical alignment is done using flex and max-height below even though the .cell-content might overflow due to padding + content size.\n */\n box-sizing: content-box;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n word-break: break-all;\n flex-grow: 1;\n\n /* Adding padding on .cell-content so that focus rings can appear properly and doesn't clip due to overflow: hidden */\n padding: var(--cell-vertical-padding) var(--cell-padding);\n\n /* setting max-height so that the elements with more height like RTL, align with the row density height */\n max-height: var(--data-row-height);\n\n /* hiding scroll bar in case the cell render introduces scrollbar based on its implementation */\n & * {\n scrollbar-width: none;\n }\n\n /* in case of combine columns, removing padding from parent cell-content as children already have the padding */\n &:has(.combined-cell) {\n padding: 0;\n\n /* stylelint-disable-next-line selector-max-class */\n .cell-content {\n flex-grow: unset;\n }\n }\n }\n }\n\n .row .aggregateCell .cell-content {\n line-height: initial;\n padding: 0;\n }\n\n .short-height,\n .medium-height {\n ${StyledStatus} {\n white-space: nowrap;\n }\n }\n\n .short-height {\n ${StyledRadioCheck} ${StyledLabel} {\n min-height: auto;\n }\n }\n\n .medium-height {\n --row-height-multiplier: 4 / 3;\n }\n\n .tall-height {\n --row-height-multiplier: calc(4 / 3 + 0.5);\n > .row:not(.group-header-row) {\n > .cell {\n display: inline-grid;\n align-items: start;\n white-space: normal;\n word-break: break-all;\n grid-auto-flow: column;\n\n :has(> ${CellIcon}) {\n /* Adds spacing between children when icons are rendered alongside cell content in the cell container. */\n justify-content: space-between;\n }\n\n /* stylelint-disable selector-max-class */\n /* stylelint-disable-next-line selector-max-compound-selectors */\n > .cell-content > .combined-cell > .combined-cell-content,\n > .cell-content {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n white-space: inherit;\n word-break: inherit;\n }\n\n ${CellIcon} {\n margin-block-start: 0.375rem;\n }\n }\n }\n }\n\n .wrap-content-height {\n --row-height-multiplier: 4 / 3;\n --row-min-height: calc(\n var(--hit-area) * var(--row-height-multiplier) + var(--cell-vertical-padding) * 2\n );\n --group-header-height: ${isAggregationApplied\n ? 'var(--default-group-header-height)'\n : 'var(--row-min-height)'};\n\n > .row:not(.group-header-row) {\n height: auto;\n min-height: var(--row-min-height);\n > .cell {\n white-space: normal;\n\n /* -- For BUG-625508 -- */\n word-break: break-word;\n display: inline-grid;\n align-items: start;\n padding-top: var(--cell-vertical-padding);\n padding-bottom: var(--cell-vertical-padding);\n grid-auto-flow: column;\n\n :has(> ${CellIcon}) {\n /* Adds spacing between children when icons are rendered alongside cell content in the cell container. */\n justify-content: space-between;\n }\n\n /* stylelint-disable-next-line selector-max-compound-selectors */\n > .cell-content > .combined-cell > .combined-cell-content,\n > .cell-content {\n /* for full-content, the row cells should adjust according to content */\n max-height: none;\n white-space: inherit;\n word-break: inherit;\n }\n\n ${CellIcon} {\n margin-block-start: 0.375rem;\n }\n }\n }\n }\n\n .footer {\n .row {\n .cell {\n padding: 0;\n }\n }\n }\n\n /* stylelint-disable no-duplicate-selectors */\n .row-container {\n position: absolute;\n display: grid;\n width: 100%;\n font-size: ${fontSize.s};\n\n > .group-header-row,\n .hierarchical-group-footer-row {\n height: var(--group-header-height);\n .cell {\n padding: 0;\n border-right-width: 0;\n }\n }\n\n > .hierarchical-group-header-row {\n height: var(--group-header-height);\n }\n input.checkbox-on-hover + label {\n opacity: 0;\n }\n input.checkbox-on-hover:checked + label {\n opacity: 1;\n }\n .row.selected-row {\n background-color: ${selectedRowColor};\n\n > .cell,\n .cell-fixed,\n .cell-action {\n background-color: ${selectedRowColor};\n }\n }\n .row-on-hover:hover {\n background-color: ${lightGreyColor};\n input.checkbox-on-hover + label {\n opacity: 1;\n }\n\n > .cell,\n .cell-fixed,\n .cell-action {\n background-color: ${lightGreyColor};\n }\n }\n .row.hierarchical-group-footer-row {\n .cell-fixed {\n background: ${lightGreyColor};\n }\n }\n }\n\n /* stylelint-enable selector-max-class */\n\n .toolbar-button-applied {\n padding: 0 8px;\n margin: 0 calc(${theme.base.spacing} / 4);\n }\n\n .toolbar-button {\n padding: 0 8px;\n margin: 0 calc(${theme.base.spacing} / 4);\n }\n\n .column-resizer {\n cursor: col-resize;\n position: absolute;\n top: 0;\n right: 0;\n z-index: 3;\n width: 0.25rem;\n height: 100%;\n }\n\n .column-resizer:hover,\n .column-resizer:active {\n background: var(--interactive);\n }\n\n .align-right {\n justify-content: right;\n\n .cell-content {\n text-align: right;\n }\n }\n\n .align-left {\n justify-content: left;\n\n .cell-content {\n text-align: left;\n }\n }\n\n .align-center {\n justify-content: center;\n\n .cell-content {\n text-align: center;\n }\n }\n\n .selection-border {\n border: 0.125rem solid var(--medium-blue) !important;\n }\n\n .disable-select {\n user-select: none; /* supported by Chrome and Firefox */\n -webkit-user-select: none; /* Safari */\n }\n\n .popper {\n div.row {\n display: flex;\n vertical-align: middle;\n line-height: unset;\n border-bottom: none;\n outline: none 0;\n height: auto;\n }\n }\n `;\n});\n\nexport default StyledTableContainer;\n"]}
@@ -1,4 +1,4 @@
1
- declare function VirtualizeWrapper({ view, children, id, renderHeader, rowContainerClass, renderFooter, isFullscreen }: {
1
+ declare function VirtualizeWrapper({ view, children, id, renderHeader, rowContainerClass, renderFooter, isFullscreen, useVariableRowHeightVirtualization }: {
2
2
  view: any;
3
3
  children: any;
4
4
  id: any;
@@ -6,6 +6,7 @@ declare function VirtualizeWrapper({ view, children, id, renderHeader, rowContai
6
6
  rowContainerClass?: string | undefined;
7
7
  renderFooter?: null | undefined;
8
8
  isFullscreen?: boolean | undefined;
9
+ useVariableRowHeightVirtualization?: boolean | undefined;
9
10
  }): import("react/jsx-runtime").JSX.Element;
10
11
  declare namespace VirtualizeWrapper {
11
12
  namespace propTypes {
@@ -18,6 +19,7 @@ declare namespace VirtualizeWrapper {
18
19
  [x: string]: any;
19
20
  }>;
20
21
  let isFullscreen: PropTypes.Requireable<boolean>;
22
+ let useVariableRowHeightVirtualization: PropTypes.Requireable<boolean>;
21
23
  }
22
24
  }
23
25
  export default VirtualizeWrapper;
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizeWrapper.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Table/VirtualizeWrapper.jsx"],"names":[],"mappings":"AASA;;;;;;;;4CAgGC;;;;;;;;;;;;;;;sBAzGqB,YAAY"}
1
+ {"version":3,"file":"VirtualizeWrapper.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Table/VirtualizeWrapper.jsx"],"names":[],"mappings":"AAcA;;;;;;;;;4CAwIC;;;;;;;;;;;;;;;;sBAtJqB,YAAY"}
@@ -4,8 +4,14 @@ import { useCallback, useEffect, useRef, useState } from 'react';
4
4
  import { isEmpty, REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';
5
5
  import Virtualize from '../../Components/Virtualise';
6
6
  import VirtualizeInfinite from '../../Components/Virtualise/VirtualizeInfinite';
7
+ import VariableHeightVirtualizer from '../../Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer';
7
8
  import { isPaginationRequestCompleted } from '../../Components/Virtualise/utility';
8
- export default function VirtualizeWrapper({ view, children, id, renderHeader = null, rowContainerClass = '', renderFooter = null, isFullscreen = false }) {
9
+ import EmptyContainer from '../../Components/DefaultComponents/EmptyContainer';
10
+ import useCountChange from './useCountChange';
11
+ import Row from './Row';
12
+ export default function VirtualizeWrapper({ view, children, id, renderHeader = null, rowContainerClass = '', renderFooter = null, isFullscreen = false,
13
+ // TODO: Remove this prop and deprecate older virtualizers once we fully migrate to variable row height virtualizer for gallery and grouped list views
14
+ useVariableRowHeightVirtualization = false }) {
9
15
  const isProgressiveVirtualizerEverLoaded = useRef(false);
10
16
  const paginationPayload = useRef({});
11
17
  const [isFetching, setIsFetching] = useState(false);
@@ -33,6 +39,15 @@ export default function VirtualizeWrapper({ view, children, id, renderHeader = n
33
39
  const requestedRows = paginationPayload.current.endIndex - paginationPayload.current.startIndex + 1;
34
40
  setHasMoreResults(view.rows?.length === requestedRows);
35
41
  }, [view.isInstantRender, view.state?.paginationOptions?.[id]]);
42
+ useCountChange(view, isFetching, view.getVirtualizeElement?.(id)?.notifyCountChange);
43
+ const noResultRenderer = useCallback(() => _jsx(EmptyContainer, {}), []);
44
+ if (useVariableRowHeightVirtualization) {
45
+ const paginationStartIndex = view?.state?.paginationOptions?.rootVirtualiser?.startIndex || 0;
46
+ return (_jsx(VariableHeightVirtualizer, { id: id, totalItemCount: view.totalItemCount, isDataFetching: isFetching, loadedDataRange: view?.state?.paginationOptions?.[id] || {}, apiCallback: paginationCallback, defaultItemHeight: 40, maxItemsToPaint: 5000, headerRenderer: renderHeader, footerRenderer: renderFooter, noResultRenderer: noResultRenderer, itemContainerClass: `${rowContainerClass} ${view.rowHeightClass}`, ref: r => {
47
+ view.putVirtualizeElement(id, r);
48
+ view.setScrollNode(r?.getBufferContainer());
49
+ }, viewMaxHeight: isFullscreen ? null : view.bodyHeight, minHeightWhenNoItemsRendered: '100px', children: view?.groupHeaders?.[0]?.getRows()?.map((row, index) => (_jsx(Row, { row: row, columns: view.columns, level: 0, dataIndex: paginationStartIndex + index }, row.reactKey))) }));
50
+ }
36
51
  if (infiniteModeTable) {
37
52
  return (_jsx(VirtualizeInfinite, { id: id, viewMaxHeight: isFullscreen ? null : view.bodyHeight, itemHeight: view.rowHeight, callback: paginationCallback, isFetching: isFetching, hasMoreResults: hasMoreResults, renderHeader: renderHeader, renderFooter: renderFooter, ref: r => {
38
53
  view.putVirtualizeElement(id, r);
@@ -51,6 +66,7 @@ VirtualizeWrapper.propTypes = {
51
66
  renderFooter: PropTypes.func,
52
67
  rowContainerClass: PropTypes.string,
53
68
  view: PropTypes.objectOf(PropTypes.any).isRequired,
54
- isFullscreen: PropTypes.bool
69
+ isFullscreen: PropTypes.bool,
70
+ useVariableRowHeightVirtualization: PropTypes.bool
55
71
  };
56
72
  //# sourceMappingURL=VirtualizeWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizeWrapper.js","sourceRoot":"","sources":["../../../../Core/Views/Table/VirtualizeWrapper.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAExF,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,OAAO,kBAAkB,MAAM,gDAAgD,CAAC;AAChF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAEnF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CA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CAAC,MAAM,CAAC,CAAC,CAAC,UAAU;IACxE,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,iBAAiB,EAAE,SAAS,CAAC,MAAM;IACnC,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU;IAClD,YAAY,EAAE,SAAS,CAAC,IAAI;CAC7B,CAAC","sourcesContent":["import PropTypes from 'prop-types';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { isEmpty, REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';\n\nimport Virtualize from '../../Components/Virtualise';\nimport VirtualizeInfinite from '../../Components/Virtualise/VirtualizeInfinite';\nimport { isPaginationRequestCompleted } from '../../Components/Virtualise/utility';\n\nexport default function VirtualizeWrapper({\n view,\n children,\n id,\n renderHeader = null,\n rowContainerClass = '',\n renderFooter = null,\n isFullscreen = false\n}) {\n const isProgressiveVirtualizerEverLoaded = useRef(false);\n const paginationPayload = useRef({});\n\n const [isFetching, setIsFetching] = useState(false);\n const [hasMoreResults, setHasMoreResults] = useState(false);\n\n const infiniteModeTable = isProgressiveVirtualizerEverLoaded.current\n ? false\n : !view.state?.groups?.length && isEmpty(view.resultsCount);\n\n if (!infiniteModeTable && !isProgressiveVirtualizerEverLoaded.current) {\n isProgressiveVirtualizerEverLoaded.current = true;\n }\n\n const paginationCallback = useCallback(\n (payload, payloadMeta) => {\n paginationPayload.current = payload;\n setIsFetching(true);\n view.type.onPaginate(payload, payloadMeta);\n },\n [view.type.onPaginate]\n );\n\n useEffect(() => {\n if (view.isInstantRender) return;\n\n const isRequestComplete = isPaginationRequestCompleted(\n paginationPayload.current,\n view.state?.paginationOptions?.[id]\n );\n setIsFetching(!isRequestComplete);\n }, [view.isInstantRender, view.state?.paginationOptions?.[id]]);\n\n useEffect(() => {\n if (view.isInstantRender || !paginationPayload.current) return;\n\n const requestedRows =\n paginationPayload.current.endIndex - paginationPayload.current.startIndex + 1;\n setHasMoreResults(view.rows?.length === requestedRows);\n }, [view.isInstantRender, view.state?.paginationOptions?.[id]]);\n\n if (infiniteModeTable) {\n return (\n <VirtualizeInfinite\n id={id}\n viewMaxHeight={isFullscreen ? null : view.bodyHeight}\n itemHeight={view.rowHeight}\n callback={paginationCallback}\n isFetching={isFetching}\n hasMoreResults={hasMoreResults}\n renderHeader={renderHeader}\n renderFooter={renderFooter}\n ref={r => {\n view.putVirtualizeElement(id, r);\n view.setScrollNode(r && r.vi && r.vi.bContainer);\n }}\n rowContainerClass={`${rowContainerClass} ${view.rowHeightClass}`}\n state={view.state?.paginationOptions?.[id]}\n resetCount={view.isCountUpdateRequired}\n showLoadingIndicator={view.meta.template === REPEATING_STRUCTURE_TEMPLATES.TABLE}\n >\n {children}\n </VirtualizeInfinite>\n );\n }\n\n return (\n <Virtualize\n id={id}\n viewMaxHeight={isFullscreen ? null : view.bodyHeight}\n totalRecordCount={view.totalItemCount}\n itemHeight={view.rowHeight}\n callback={paginationCallback}\n isFetching={isFetching}\n renderHeader={renderHeader}\n renderFooter={renderFooter}\n ref={r => {\n view.putVirtualizeElement(id, r);\n view.setScrollNode(r && r.vi && r.vi.bContainer);\n }}\n rowContainerClass={`${rowContainerClass} ${view.rowHeightClass}`}\n state={view.state?.paginationOptions?.[id]}\n showLoadingIndicator={view.meta.template === REPEATING_STRUCTURE_TEMPLATES.TABLE}\n >\n {children}\n </Virtualize>\n );\n}\n\nVirtualizeWrapper.propTypes = {\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,\n id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,\n renderHeader: PropTypes.func,\n renderFooter: PropTypes.func,\n rowContainerClass: PropTypes.string,\n view: PropTypes.objectOf(PropTypes.any).isRequired,\n isFullscreen: PropTypes.bool\n};\n"]}
1
+ {"version":3,"file":"VirtualizeWrapper.js","sourceRoot":"","sources":["../../../../Core/Views/Table/VirtualizeWrap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EACtB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,CAAC,CAAC,EAAE;YACP,IAAI,CAAC,oBAAoB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YACjC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;QACnD,CAAC,EACD,iBAAiB,EAAE,GAAG,iBAAiB,IAAI,IAAI,CAAC,cAAc,EAAE,EAChE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC,EAC1C,oBAAoB,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,6BAA6B,CAAC,KAAK,YAE/E,QAAQ,GACE,CACd,CAAC;AACJ,CAAC;AAED,iBAAiB,CAAC,SAAS,GAAG;IAC5B,QAAQ,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU;IAC7E,EAAE,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU;IACxE,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,iBAAiB,EAAE,SAAS,CAAC,MAAM;IACnC,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU;IAClD,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,kCAAkC,EAAE,SAAS,CAAC,IAAI;CACnD,CAAC","sourcesContent":["import PropTypes from 'prop-types';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { isEmpty, REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';\n\nimport Virtualize from '../../Components/Virtualise';\nimport VirtualizeInfinite from '../../Components/Virtualise/VirtualizeInfinite';\nimport VariableHeightVirtualizer from '../../Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer';\nimport { isPaginationRequestCompleted } from '../../Components/Virtualise/utility';\nimport EmptyContainer from '../../Components/DefaultComponents/EmptyContainer';\n\nimport useCountChange from './useCountChange';\nimport Row from './Row';\n\nexport default function VirtualizeWrapper({\n view,\n children,\n id,\n renderHeader = null,\n rowContainerClass = '',\n renderFooter = null,\n isFullscreen = false,\n // TODO: Remove this prop and deprecate older virtualizers once we fully migrate to variable row height virtualizer for gallery and grouped list views\n useVariableRowHeightVirtualization = false\n}) {\n const isProgressiveVirtualizerEverLoaded = useRef(false);\n const paginationPayload = useRef({});\n\n const [isFetching, setIsFetching] = useState(false);\n const [hasMoreResults, setHasMoreResults] = useState(false);\n\n const infiniteModeTable = isProgressiveVirtualizerEverLoaded.current\n ? false\n : !view.state?.groups?.length && isEmpty(view.resultsCount);\n\n if (!infiniteModeTable && !isProgressiveVirtualizerEverLoaded.current) {\n isProgressiveVirtualizerEverLoaded.current = true;\n }\n\n const paginationCallback = useCallback(\n (payload, payloadMeta) => {\n paginationPayload.current = payload;\n setIsFetching(true);\n view.type.onPaginate(payload, payloadMeta);\n },\n [view.type.onPaginate]\n );\n\n useEffect(() => {\n if (view.isInstantRender) return;\n\n const isRequestComplete = isPaginationRequestCompleted(\n paginationPayload.current,\n view.state?.paginationOptions?.[id]\n );\n setIsFetching(!isRequestComplete);\n }, [view.isInstantRender, view.state?.paginationOptions?.[id]]);\n\n useEffect(() => {\n if (view.isInstantRender || !paginationPayload.current) return;\n\n const requestedRows =\n paginationPayload.current.endIndex - paginationPayload.current.startIndex + 1;\n setHasMoreResults(view.rows?.length === requestedRows);\n }, [view.isInstantRender, view.state?.paginationOptions?.[id]]);\n\n useCountChange(view, isFetching, view.getVirtualizeElement?.(id)?.notifyCountChange);\n\n const noResultRenderer = useCallback(() => <EmptyContainer />, []);\n if (useVariableRowHeightVirtualization) {\n const paginationStartIndex = view?.state?.paginationOptions?.rootVirtualiser?.startIndex || 0;\n return (\n <VariableHeightVirtualizer\n id={id}\n totalItemCount={view.totalItemCount}\n isDataFetching={isFetching}\n loadedDataRange={view?.state?.paginationOptions?.[id] || {}}\n apiCallback={paginationCallback}\n defaultItemHeight={40}\n maxItemsToPaint={5000}\n headerRenderer={renderHeader}\n footerRenderer={renderFooter}\n noResultRenderer={noResultRenderer}\n itemContainerClass={`${rowContainerClass} ${view.rowHeightClass}`}\n ref={r => {\n view.putVirtualizeElement(id, r);\n view.setScrollNode(r?.getBufferContainer());\n }}\n viewMaxHeight={isFullscreen ? null : view.bodyHeight}\n minHeightWhenNoItemsRendered='100px'\n >\n {view?.groupHeaders?.[0]?.getRows()?.map((row, index) => (\n <Row\n key={row.reactKey}\n row={row}\n columns={view.columns}\n level={0}\n dataIndex={paginationStartIndex + index}\n />\n ))}\n </VariableHeightVirtualizer>\n );\n }\n\n if (infiniteModeTable) {\n return (\n <VirtualizeInfinite\n id={id}\n viewMaxHeight={isFullscreen ? null : view.bodyHeight}\n itemHeight={view.rowHeight}\n callback={paginationCallback}\n isFetching={isFetching}\n hasMoreResults={hasMoreResults}\n renderHeader={renderHeader}\n renderFooter={renderFooter}\n ref={r => {\n view.putVirtualizeElement(id, r);\n view.setScrollNode(r && r.vi && r.vi.bContainer);\n }}\n rowContainerClass={`${rowContainerClass} ${view.rowHeightClass}`}\n state={view.state?.paginationOptions?.[id]}\n resetCount={view.isCountUpdateRequired}\n showLoadingIndicator={view.meta.template === REPEATING_STRUCTURE_TEMPLATES.TABLE}\n >\n {children}\n </VirtualizeInfinite>\n );\n }\n\n return (\n <Virtualize\n id={id}\n viewMaxHeight={isFullscreen ? null : view.bodyHeight}\n totalRecordCount={view.totalItemCount}\n itemHeight={view.rowHeight}\n callback={paginationCallback}\n isFetching={isFetching}\n renderHeader={renderHeader}\n renderFooter={renderFooter}\n ref={r => {\n view.putVirtualizeElement(id, r);\n view.setScrollNode(r && r.vi && r.vi.bContainer);\n }}\n rowContainerClass={`${rowContainerClass} ${view.rowHeightClass}`}\n state={view.state?.paginationOptions?.[id]}\n showLoadingIndicator={view.meta.template === REPEATING_STRUCTURE_TEMPLATES.TABLE}\n >\n {children}\n </Virtualize>\n );\n}\n\nVirtualizeWrapper.propTypes = {\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired,\n id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,\n renderHeader: PropTypes.func,\n renderFooter: PropTypes.func,\n rowContainerClass: PropTypes.string,\n view: PropTypes.objectOf(PropTypes.any).isRequired,\n isFullscreen: PropTypes.bool,\n useVariableRowHeightVirtualization: PropTypes.bool\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Table/index.jsx"],"names":[],"mappings":";AA4BA;;4CA8HC;;;;;;;;sBA1JqB,YAAY"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../Core/Views/Table/index.jsx"],"names":[],"mappings":";AA4BA;;4CA2IC;;;;;;;;sBAvKqB,YAAY"}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import PropTypes from 'prop-types';
3
3
  import { useCallback, useRef, useEffect } from 'react';
4
4
  import { useLiveLog } from '@pega/cosmos-react-core/lib/hooks';
@@ -83,7 +83,7 @@ function StyledTable({ view }) {
83
83
  'show-expand-collapse-all': view.showGroupingExpandCollapseAll
84
84
  }), theme: theme, view: view, isFullscreen: isFullscreen, children: [_jsx(Toolbar, { view: view }), _jsx(RenderView, { type: EXTERNAL_FILTERS, view: view }), _jsx(NotificationManager, { view: view }), _jsx(RepeatingStructureA11y, { view: view, a11yRef: a11yRef, children: _jsxs("div", { className: cx('container', view.className, {
85
85
  'small-screen-table': !isSmallOrAbove
86
- }), ref: containerRef, ...view.getUIProps(), onClick: onClickHandler, onKeyDown: keyDownHandler, children: [_jsx(GroupingHeaderCell, { ...view.groupingHeaderCellProps }), _jsx(Virtualiser, { id: 'rootVirtualiser', view: view, renderHeader: renderHeader, renderFooter: renderFooter, isFullscreen: isFullscreen, children: _jsx(Body, { groupHeaders: groupHeaders, columns: columns, hierarchicalGroupEnabled: view.hierarchicalGroupEnabled }) }), _jsx(LoadingIndicator, { view: view, show: !rows || !!view.isLoading }), _jsx(ContextMenuContainer, { view: view, selector: contextMenuSelector })] }) })] }) }));
86
+ }), ref: containerRef, ...view.getUIProps(), onClick: onClickHandler, onKeyDown: keyDownHandler, children: [view.state?.groups?.length ? (_jsxs(_Fragment, { children: [_jsx(GroupingHeaderCell, { ...view.groupingHeaderCellProps }), _jsx(Virtualiser, { id: 'rootVirtualiser', view: view, renderHeader: renderHeader, renderFooter: renderFooter, isFullscreen: isFullscreen, children: _jsx(Body, { groupHeaders: groupHeaders, columns: columns, hierarchicalGroupEnabled: view.hierarchicalGroupEnabled }) })] })) : (_jsx(Virtualiser, { id: 'rootVirtualiser', view: view, renderHeader: renderHeader, renderFooter: renderFooter, isFullscreen: isFullscreen, useVariableRowHeightVirtualization: true })), _jsx(LoadingIndicator, { view: view, show: !rows || !!view.isLoading }), _jsx(ContextMenuContainer, { view: view, selector: contextMenuSelector })] }) })] }) }));
87
87
  }
88
88
  StyledTable.propTypes = {
89
89
  view: PropTypes.objectOf(PropTypes.any).isRequired