@pega/lists-react 9.0.0-build.2.9 → 9.0.0-build.20.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.
- package/README.md +1 -4
- package/lib/Core/Components/A11y/RepeatingStructureA11y.d.ts +10 -5
- package/lib/Core/Components/A11y/RepeatingStructureA11y.d.ts.map +1 -1
- package/lib/Core/Components/A11y/RepeatingStructureA11y.js +27 -2
- package/lib/Core/Components/A11y/RepeatingStructureA11y.js.map +1 -1
- package/lib/Core/Components/AggregateMenu.d.ts +1 -0
- package/lib/Core/Components/AggregateMenu.d.ts.map +1 -1
- package/lib/Core/Components/AggregateMenu.js +32 -18
- package/lib/Core/Components/AggregateMenu.js.map +1 -1
- package/lib/Core/Components/ContextMenu/ContextMenuContainer.d.ts +6 -15
- package/lib/Core/Components/ContextMenu/ContextMenuContainer.d.ts.map +1 -1
- package/lib/Core/Components/ContextMenu/ContextMenuContainer.js +91 -163
- package/lib/Core/Components/ContextMenu/ContextMenuContainer.js.map +1 -1
- package/lib/Core/Components/ContextMenu/QuickFilter.js +7 -7
- package/lib/Core/Components/ContextMenu/QuickFilter.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/ColumnMergeTemplates/CustomCellWrapper.d.ts +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/ColumnMergeTemplates/CustomCellWrapper.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowActionMenu.d.ts +2 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowActionMenu.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowActionMenu.js +9 -21
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowActionMenu.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowDragDropHandle.d.ts +2 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowDragDropHandle.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowDragDropHandle.js +4 -3
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowDragDropHandle.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowError.d.ts +2 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowError.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowError.js +4 -3
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowError.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/index.d.ts +0 -2
- package/lib/Core/Components/DefaultComponents/CellRenderers/index.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/index.js +0 -2
- package/lib/Core/Components/DefaultComponents/CellRenderers/index.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/EmptyContainer.d.ts +5 -1
- package/lib/Core/Components/DefaultComponents/EmptyContainer.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/EmptyContainer.js +12 -5
- package/lib/Core/Components/DefaultComponents/EmptyContainer.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/PersonalizationCreateEdit.d.ts +3 -2
- package/lib/Core/Components/DefaultComponents/PersonalizationCreateEdit.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/PersonalizationCreateEdit.js +13 -26
- package/lib/Core/Components/DefaultComponents/PersonalizationCreateEdit.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/PersonalizationDeleteConfirmation.js +2 -2
- package/lib/Core/Components/DefaultComponents/PersonalizationDeleteConfirmation.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/PersonalizationSelector.d.ts +0 -2
- package/lib/Core/Components/DefaultComponents/PersonalizationSelector.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/PersonalizationSelector.js +11 -9
- package/lib/Core/Components/DefaultComponents/PersonalizationSelector.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/SelectAllCheckbox.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/SelectAllCheckbox.js +5 -0
- package/lib/Core/Components/DefaultComponents/SelectAllCheckbox.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/index.d.ts +5 -3
- package/lib/Core/Components/DefaultComponents/index.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/index.js +0 -2
- package/lib/Core/Components/DefaultComponents/index.js.map +1 -1
- package/lib/Core/Components/Filters/CommonFilter.d.ts.map +1 -1
- package/lib/Core/Components/Filters/CommonFilter.js +2 -2
- package/lib/Core/Components/Filters/CommonFilter.js.map +1 -1
- package/lib/Core/Components/Filters/FilterType.js +5 -5
- package/lib/Core/Components/Filters/FilterType.js.map +1 -1
- package/lib/Core/Components/Filters/SelectFilter.d.ts.map +1 -1
- package/lib/Core/Components/Filters/SelectFilter.js +2 -2
- package/lib/Core/Components/Filters/SelectFilter.js.map +1 -1
- package/lib/Core/Components/Filters/styles.d.ts +1 -1
- package/lib/Core/Components/FooterAggregators.d.ts.map +1 -1
- package/lib/Core/Components/FooterAggregators.js +3 -2
- package/lib/Core/Components/FooterAggregators.js.map +1 -1
- package/lib/Core/Components/GroupRenderer/GroupAdditionalFieldDataModal.d.ts +12 -0
- package/lib/Core/Components/GroupRenderer/GroupAdditionalFieldDataModal.d.ts.map +1 -0
- package/lib/Core/Components/GroupRenderer/GroupAdditionalFieldDataModal.js +62 -0
- package/lib/Core/Components/GroupRenderer/GroupAdditionalFieldDataModal.js.map +1 -0
- package/lib/Core/Components/GroupRenderer/GroupAdditionalInfo.d.ts +33 -0
- package/lib/Core/Components/GroupRenderer/GroupAdditionalInfo.d.ts.map +1 -0
- package/lib/Core/Components/GroupRenderer/GroupAdditionalInfo.js +106 -0
- package/lib/Core/Components/GroupRenderer/GroupAdditionalInfo.js.map +1 -0
- package/lib/Core/Components/{GroupRenderer.d.ts → GroupRenderer/index.d.ts} +8 -1
- package/lib/Core/Components/GroupRenderer/index.d.ts.map +1 -0
- package/lib/Core/Components/GroupRenderer/index.js +367 -0
- package/lib/Core/Components/GroupRenderer/index.js.map +1 -0
- package/lib/Core/Components/Grouping/GroupingMenu.d.ts.map +1 -1
- package/lib/Core/Components/Grouping/GroupingMenu.js +6 -5
- package/lib/Core/Components/Grouping/GroupingMenu.js.map +1 -1
- package/lib/Core/Components/HeaderCell.d.ts.map +1 -1
- package/lib/Core/Components/HeaderCell.js +8 -5
- package/lib/Core/Components/HeaderCell.js.map +1 -1
- package/lib/Core/Components/HeaderMenu/actions.d.ts.map +1 -1
- package/lib/Core/Components/HeaderMenu/actions.js +3 -3
- package/lib/Core/Components/HeaderMenu/actions.js.map +1 -1
- package/lib/Core/Components/HeaderMenu/index.d.ts.map +1 -1
- package/lib/Core/Components/HeaderMenu/index.js +2 -2
- package/lib/Core/Components/HeaderMenu/index.js.map +1 -1
- package/lib/Core/Components/NotificationManager.js +1 -1
- package/lib/Core/Components/NotificationManager.js.map +1 -1
- package/lib/Core/Components/RSWrapper/HeaderBarGadget.d.ts.map +1 -1
- package/lib/Core/Components/RSWrapper/HeaderBarGadget.js +2 -1
- package/lib/Core/Components/RSWrapper/HeaderBarGadget.js.map +1 -1
- package/lib/Core/Components/RenderingEngine/RenderCell.d.ts +1 -1
- package/lib/Core/Components/RenderingEngine/RenderCell.d.ts.map +1 -1
- package/lib/Core/Components/RenderingEngine/RenderCell.js +2 -1
- package/lib/Core/Components/RenderingEngine/RenderCell.js.map +1 -1
- package/lib/Core/Components/TestIdConstants.d.ts +1 -0
- package/lib/Core/Components/TestIdConstants.js +2 -1
- package/lib/Core/Components/TestIdConstants.js.map +1 -1
- package/lib/Core/Components/Toolbar/AdvanceToolbar.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/AdvanceToolbar.js +9 -33
- package/lib/Core/Components/Toolbar/AdvanceToolbar.js.map +1 -1
- package/lib/Core/Components/Toolbar/AnnounceRowsCount.d.ts +1 -1
- package/lib/Core/Components/Toolbar/AnnounceRowsCount.js +1 -1
- package/lib/Core/Components/Toolbar/AnnounceRowsCount.js.map +1 -1
- package/lib/Core/Components/Toolbar/ColumnSelector.d.ts +20 -9
- package/lib/Core/Components/Toolbar/ColumnSelector.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/ColumnSelector.js +89 -65
- package/lib/Core/Components/Toolbar/ColumnSelector.js.map +1 -1
- package/lib/Core/Components/Toolbar/DebugInfo.d.ts +3 -5
- package/lib/Core/Components/Toolbar/DebugInfo.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/DebugInfo.js +3 -3
- package/lib/Core/Components/Toolbar/DebugInfo.js.map +1 -1
- package/lib/Core/Components/Toolbar/FieldSelector.d.ts +1 -0
- package/lib/Core/Components/Toolbar/FieldSelector.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/FieldSelector.js +3 -2
- package/lib/Core/Components/Toolbar/FieldSelector.js.map +1 -1
- package/lib/Core/Components/Toolbar/Grouping.types.d.ts +0 -6
- package/lib/Core/Components/Toolbar/Grouping.types.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/Grouping.types.js.map +1 -1
- package/lib/Core/Components/Toolbar/SimpleToolbar.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/SimpleToolbar.js +4 -3
- package/lib/Core/Components/Toolbar/SimpleToolbar.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.d.ts +14 -18
- package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.js +15 -16
- package/lib/Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.d.ts +2 -1
- package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.js +10 -7
- package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useGroup/useGroup.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useGroup/useGroup.js +6 -3
- package/lib/Core/Components/Toolbar/hooks/useGroup/useGroup.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useGroup/utils.d.ts +7 -2
- package/lib/Core/Components/Toolbar/hooks/useGroup/utils.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useGroup/utils.js +11 -3
- package/lib/Core/Components/Toolbar/hooks/useGroup/utils.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useMore.d.ts +1 -1
- package/lib/Core/Components/Toolbar/hooks/useMore.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useMore.js +81 -79
- package/lib/Core/Components/Toolbar/hooks/useMore.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/usePersonalization.d.ts +8 -6
- package/lib/Core/Components/Toolbar/hooks/usePersonalization.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/usePersonalization.js +18 -3
- package/lib/Core/Components/Toolbar/hooks/usePersonalization.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSearch.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSearch.js +6 -9
- package/lib/Core/Components/Toolbar/hooks/useSearch.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/Row.d.ts +4 -4
- package/lib/Core/Components/Toolbar/hooks/useSort/Row.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/Row.js +6 -6
- package/lib/Core/Components/Toolbar/hooks/useSort/Row.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.d.ts +2 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.js +8 -2
- package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/useSort.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/useSort.js +2 -2
- package/lib/Core/Components/Toolbar/hooks/useSort/useSort.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useWrapAction.d.ts +6 -0
- package/lib/Core/Components/Toolbar/hooks/useWrapAction.d.ts.map +1 -0
- package/lib/Core/Components/Toolbar/hooks/useWrapAction.js +17 -0
- package/lib/Core/Components/Toolbar/hooks/useWrapAction.js.map +1 -0
- package/lib/Core/Components/Toolbar/utils/utils.d.ts +1 -1
- package/lib/Core/Components/Toolbar/utils/utils.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/utils/utils.js +2 -1
- package/lib/Core/Components/Toolbar/utils/utils.js.map +1 -1
- package/lib/Core/Components/Virtualise/Pagination.d.ts.map +1 -1
- package/lib/Core/Components/Virtualise/Pagination.js +2 -1
- package/lib/Core/Components/Virtualise/Pagination.js.map +1 -1
- package/lib/Core/Components/Virtualise/UseScroll.d.ts +4 -1
- package/lib/Core/Components/Virtualise/UseScroll.d.ts.map +1 -1
- package/lib/Core/Components/Virtualise/UseScroll.js +16 -3
- package/lib/Core/Components/Virtualise/UseScroll.js.map +1 -1
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.d.ts +97 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.d.ts.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.js +251 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.js.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.d.ts +22 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.d.ts.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.js +38 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useChildrenHeightResizeObserver.js.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.d.ts +22 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.d.ts.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.js +45 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useLoaderPositioning.js.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.d.ts +49 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.d.ts.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.js +55 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/usePagination.js.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.d.ts +21 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.d.ts.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.js +39 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useScroll.js.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.d.ts +38 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.d.ts.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.js +62 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/useVirtualizerItemCount.js.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.d.ts +112 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.d.ts.map +1 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.js +214 -0
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.js.map +1 -0
- package/lib/Core/Components/Virtualise/VirtualizeInfinite.js +21 -8
- package/lib/Core/Components/Virtualise/VirtualizeInfinite.js.map +1 -1
- package/lib/Core/Components/Virtualise/index.js +21 -13
- package/lib/Core/Components/Virtualise/index.js.map +1 -1
- package/lib/Core/Components/Virtualise/utility.d.ts +1 -1
- package/lib/Core/Components/Virtualise/utility.d.ts.map +1 -1
- package/lib/Core/Components/Virtualise/utility.js +3 -2
- package/lib/Core/Components/Virtualise/utility.js.map +1 -1
- package/lib/Core/Context/LocalizationContext.d.ts +1 -1
- package/lib/Core/Context/LocalizationContext.d.ts.map +1 -1
- package/lib/Core/Context/LocalizationContext.js.map +1 -1
- package/lib/Core/Hooks/a11y/useAnnounce.d.ts +19 -0
- package/lib/Core/Hooks/a11y/useAnnounce.d.ts.map +1 -0
- package/lib/Core/Hooks/a11y/useAnnounce.js +49 -0
- package/lib/Core/Hooks/a11y/useAnnounce.js.map +1 -0
- package/lib/Core/Hooks/useDragDrop.d.ts.map +1 -1
- package/lib/Core/Hooks/useDragDrop.js +2 -0
- package/lib/Core/Hooks/useDragDrop.js.map +1 -1
- package/lib/Core/Hooks/useRepeat.d.ts.map +1 -1
- package/lib/Core/Hooks/useRepeat.js +20 -1
- package/lib/Core/Hooks/useRepeat.js.map +1 -1
- package/lib/Core/Localization/defaultTranslations.d.ts +16 -13
- package/lib/Core/Localization/defaultTranslations.d.ts.map +1 -1
- package/lib/Core/Localization/defaultTranslations.js +17 -14
- package/lib/Core/Localization/defaultTranslations.js.map +1 -1
- package/lib/Core/Test/JUnitMocks.d.ts +6 -617
- package/lib/Core/Test/JUnitMocks.d.ts.map +1 -1
- package/lib/Core/Test/JUnitMocks.js +5 -4
- package/lib/Core/Test/JUnitMocks.js.map +1 -1
- package/lib/Core/Utils/index.d.ts +11 -0
- package/lib/Core/Utils/index.d.ts.map +1 -1
- package/lib/Core/Utils/index.js +22 -8
- package/lib/Core/Utils/index.js.map +1 -1
- package/lib/Core/Utils/styles.d.ts +2 -2
- package/lib/Core/Utils/styles.d.ts.map +1 -1
- package/lib/Core/Views/Gallery/Components/GalleryCard.d.ts +4 -0
- package/lib/Core/Views/Gallery/Components/GalleryCard.d.ts.map +1 -0
- package/lib/Core/Views/Gallery/Components/GalleryCard.js +18 -0
- package/lib/Core/Views/Gallery/Components/GalleryCard.js.map +1 -0
- package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.d.ts +8 -0
- package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.d.ts.map +1 -0
- package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.js +25 -0
- package/lib/Core/Views/Gallery/Components/GalleryCheckboxCard.js.map +1 -0
- package/lib/Core/Views/Gallery/Components/GalleryFieldValue.d.ts +8 -0
- package/lib/Core/Views/Gallery/Components/GalleryFieldValue.d.ts.map +1 -0
- package/lib/Core/Views/Gallery/Components/GalleryFieldValue.js +8 -0
- package/lib/Core/Views/Gallery/Components/GalleryFieldValue.js.map +1 -0
- package/lib/Core/Views/Gallery/Components/GalleryHeader.d.ts +8 -0
- package/lib/Core/Views/Gallery/Components/GalleryHeader.d.ts.map +1 -0
- package/lib/Core/Views/Gallery/Components/GalleryHeader.js +15 -0
- package/lib/Core/Views/Gallery/Components/GalleryHeader.js.map +1 -0
- package/lib/Core/Views/Gallery/Gallery.types.d.ts +8 -0
- package/lib/Core/Views/Gallery/Gallery.types.d.ts.map +1 -0
- package/lib/Core/Views/Gallery/Gallery.types.js +2 -0
- package/lib/Core/Views/Gallery/Gallery.types.js.map +1 -0
- package/lib/Core/Views/Gallery/StyledGalleryContainer.d.ts +13 -1
- package/lib/Core/Views/Gallery/StyledGalleryContainer.d.ts.map +1 -1
- package/lib/Core/Views/Gallery/StyledGalleryContainer.js +30 -40
- package/lib/Core/Views/Gallery/StyledGalleryContainer.js.map +1 -1
- package/lib/Core/Views/Gallery/_tests_/Samples/GalleryA11ySample.js +1 -1
- package/lib/Core/Views/Gallery/_tests_/Samples/GalleryA11ySample.js.map +1 -1
- package/lib/Core/Views/Gallery/hooks/useRowActions.d.ts +9 -0
- package/lib/Core/Views/Gallery/hooks/useRowActions.d.ts.map +1 -0
- package/lib/Core/Views/Gallery/hooks/useRowActions.js +25 -0
- package/lib/Core/Views/Gallery/hooks/useRowActions.js.map +1 -0
- package/lib/Core/Views/Gallery/index.d.ts +4 -8
- package/lib/Core/Views/Gallery/index.d.ts.map +1 -1
- package/lib/Core/Views/Gallery/index.js +22 -62
- package/lib/Core/Views/Gallery/index.js.map +1 -1
- package/lib/Core/Views/Gallery/utils.d.ts +36 -0
- package/lib/Core/Views/Gallery/utils.d.ts.map +1 -0
- package/lib/Core/Views/Gallery/utils.js +91 -0
- package/lib/Core/Views/Gallery/utils.js.map +1 -0
- package/lib/Core/Views/Map/Map.styles.d.ts +190 -6
- package/lib/Core/Views/Map/Map.styles.d.ts.map +1 -1
- package/lib/Core/Views/Map/Map.styles.js.map +1 -1
- package/lib/Core/Views/Map/index.d.ts.map +1 -1
- package/lib/Core/Views/Map/index.js +10 -4
- package/lib/Core/Views/Map/index.js.map +1 -1
- package/lib/Core/Views/RsCardWrapper.js.map +1 -1
- package/lib/Core/Views/Table/CellWrapper.d.ts +1 -1
- package/lib/Core/Views/Table/CellWrapper.d.ts.map +1 -1
- package/lib/Core/Views/Table/CellWrapper.js +4 -2
- package/lib/Core/Views/Table/CellWrapper.js.map +1 -1
- package/lib/Core/Views/Table/HeaderWrapper.d.ts.map +1 -1
- package/lib/Core/Views/Table/HeaderWrapper.js +5 -5
- package/lib/Core/Views/Table/HeaderWrapper.js.map +1 -1
- package/lib/Core/Views/Table/Row.d.ts +3 -1
- package/lib/Core/Views/Table/Row.d.ts.map +1 -1
- package/lib/Core/Views/Table/Row.js +5 -3
- package/lib/Core/Views/Table/Row.js.map +1 -1
- package/lib/Core/Views/Table/SkeletonRows.d.ts +1 -1
- package/lib/Core/Views/Table/SkeletonRows.d.ts.map +1 -1
- package/lib/Core/Views/Table/StyledTableContainer.d.ts +3 -1
- package/lib/Core/Views/Table/StyledTableContainer.d.ts.map +1 -1
- package/lib/Core/Views/Table/StyledTableContainer.js +269 -158
- package/lib/Core/Views/Table/StyledTableContainer.js.map +1 -1
- package/lib/Core/Views/Table/TableA11y.d.ts +11 -0
- package/lib/Core/Views/Table/TableA11y.d.ts.map +1 -1
- package/lib/Core/Views/Table/TableA11y.js +207 -2
- package/lib/Core/Views/Table/TableA11y.js.map +1 -1
- package/lib/Core/Views/Table/VirtualizeWrapper.d.ts +5 -1
- package/lib/Core/Views/Table/VirtualizeWrapper.d.ts.map +1 -1
- package/lib/Core/Views/Table/VirtualizeWrapper.js +38 -15
- package/lib/Core/Views/Table/VirtualizeWrapper.js.map +1 -1
- package/lib/Core/Views/Table/index.d.ts.map +1 -1
- package/lib/Core/Views/Table/index.js +6 -4
- package/lib/Core/Views/Table/index.js.map +1 -1
- package/lib/Core/Views/Table/useCountChange.d.ts +10 -0
- package/lib/Core/Views/Table/useCountChange.d.ts.map +1 -0
- package/lib/Core/Views/Table/useCountChange.js +39 -0
- package/lib/Core/Views/Table/useCountChange.js.map +1 -0
- package/lib/Core/Views/Timeline/Timeline.d.ts +5 -0
- package/lib/Core/Views/Timeline/Timeline.d.ts.map +1 -0
- package/lib/Core/Views/Timeline/Timeline.js +28 -0
- package/lib/Core/Views/Timeline/Timeline.js.map +1 -0
- package/lib/Core/Views/Timeline/Timeline.styles.d.ts +393 -0
- package/lib/Core/Views/Timeline/Timeline.styles.d.ts.map +1 -0
- package/lib/Core/Views/Timeline/Timeline.styles.js +175 -0
- package/lib/Core/Views/Timeline/Timeline.styles.js.map +1 -0
- package/lib/Core/Views/Timeline/Timeline.types.d.ts +48 -0
- package/lib/Core/Views/Timeline/Timeline.types.d.ts.map +1 -0
- package/lib/Core/Views/Timeline/Timeline.types.js +2 -0
- package/lib/Core/Views/Timeline/Timeline.types.js.map +1 -0
- package/lib/Core/Views/Timeline/TimelineItem.d.ts +12 -0
- package/lib/Core/Views/Timeline/TimelineItem.d.ts.map +1 -0
- package/lib/Core/Views/Timeline/TimelineItem.js +43 -0
- package/lib/Core/Views/Timeline/TimelineItem.js.map +1 -0
- package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.d.ts +4 -0
- package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.d.ts.map +1 -0
- package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.js +141 -0
- package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.js.map +1 -0
- package/lib/Core/Views/Timeline/index.d.ts.map +1 -1
- package/lib/Core/Views/Timeline/index.js +14 -8
- package/lib/Core/Views/Timeline/index.js.map +1 -1
- package/lib/Core/Views/Timeline/utils.d.ts +10 -0
- package/lib/Core/Views/Timeline/utils.d.ts.map +1 -0
- package/lib/Core/Views/Timeline/utils.js +144 -0
- package/lib/Core/Views/Timeline/utils.js.map +1 -0
- package/lib/Core/Views/rs-styles.d.ts +1 -1
- package/lib/Core/constants.d.ts.map +1 -1
- package/lib/Core/constants.js +1 -0
- package/lib/Core/constants.js.map +1 -1
- package/lib/Core/templateFeatureSupport.d.ts +17 -0
- package/lib/Core/templateFeatureSupport.d.ts.map +1 -0
- package/lib/Core/templateFeatureSupport.js +30 -0
- package/lib/Core/templateFeatureSupport.js.map +1 -0
- package/lib/types.d.ts +2 -0
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +11 -12
- package/lib/Core/Components/DefaultComponents/CardItem.d.ts +0 -3
- package/lib/Core/Components/DefaultComponents/CardItem.d.ts.map +0 -1
- package/lib/Core/Components/DefaultComponents/CardItem.js +0 -78
- package/lib/Core/Components/DefaultComponents/CardItem.js.map +0 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/DateTime.d.ts +0 -12
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/DateTime.d.ts.map +0 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/DateTime.js +0 -35
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/DateTime.js.map +0 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/Radio.d.ts +0 -15
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/Radio.d.ts.map +0 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/Radio.js +0 -49
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/Radio.js.map +0 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/TextInput.d.ts +0 -12
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/TextInput.d.ts.map +0 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/TextInput.js +0 -44
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/TextInput.js.map +0 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/index.d.ts +0 -16
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/index.d.ts.map +0 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/index.js +0 -63
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/index.js.map +0 -1
- package/lib/Core/Components/EmptyContainer.d.ts +0 -5
- package/lib/Core/Components/EmptyContainer.d.ts.map +0 -1
- package/lib/Core/Components/EmptyContainer.js +0 -12
- package/lib/Core/Components/EmptyContainer.js.map +0 -1
- package/lib/Core/Components/GroupRenderer.d.ts.map +0 -1
- package/lib/Core/Components/GroupRenderer.js +0 -240
- package/lib/Core/Components/GroupRenderer.js.map +0 -1
- package/lib/Core/Components/Toolbar/KeyboardInstructions.d.ts +0 -6
- package/lib/Core/Components/Toolbar/KeyboardInstructions.d.ts.map +0 -1
- package/lib/Core/Components/Toolbar/KeyboardInstructions.js +0 -32
- package/lib/Core/Components/Toolbar/KeyboardInstructions.js.map +0 -1
- package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.d.ts +0 -8
- package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.d.ts.map +0 -1
- package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.js +0 -61
- package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.js.map +0 -1
- package/lib/Core/Hooks/useSelect.d.ts +0 -9
- package/lib/Core/Hooks/useSelect.d.ts.map +0 -1
- package/lib/Core/Hooks/useSelect.js +0 -24
- package/lib/Core/Hooks/useSelect.js.map +0 -1
- package/lib/Core/Views/Gallery/ItemWrapper.d.ts +0 -19
- package/lib/Core/Views/Gallery/ItemWrapper.d.ts.map +0 -1
- package/lib/Core/Views/Gallery/ItemWrapper.js +0 -34
- package/lib/Core/Views/Gallery/ItemWrapper.js.map +0 -1
- package/lib/Core/Views/Timeline/utility.d.ts +0 -8
- package/lib/Core/Views/Timeline/utility.d.ts.map +0 -1
- package/lib/Core/Views/Timeline/utility.js +0 -120
- package/lib/Core/Views/Timeline/utility.js.map +0 -1
|
@@ -30,25 +30,25 @@ const Row = ({ updateSortItemId, updateSortItemOrder, columns, removeSortItem, s
|
|
|
30
30
|
direction: 'row',
|
|
31
31
|
wrap: 'no-wrap',
|
|
32
32
|
itemGap: 0.5
|
|
33
|
-
}, ref: focusRowRef, children: [_jsx(StyledDragHandle, { forwardedAs: 'div', role: 'button', icon: true, variant: 'simple', compact: true, ...dragProps, children: _jsx(Icon, { name: 'drag' }) }), _jsx(Flex, { item: { grow: 1 }, children: _jsx(FieldSelector, { label: translate('Field'), columns: validSortColumnsInRow, value: id, onChange: newID => updateSortItemId(newID, sequence), fieldProp: 'id' }) }), _jsx(Flex, { item: { grow: 1 }, children: _jsxs(Select, { label: translate('Sort order'), className: 'select-sorts', "data-testid": 'SortSelector', value: label, onChange: e => {
|
|
33
|
+
}, ref: focusRowRef, children: [_jsx(StyledDragHandle, { forwardedAs: 'div', role: 'button', icon: true, variant: 'simple', compact: true, disabled: !dragProps, ...dragProps, children: _jsx(Icon, { name: 'drag' }) }), _jsx(Flex, { item: { grow: 1, basis: '0' }, children: _jsx(FieldSelector, { label: translate('Field'), columns: validSortColumnsInRow, value: id, onChange: newID => updateSortItemId(newID, sequence), fieldProp: 'id', readOnly: !updateSortItemId }) }), _jsx(Flex, { item: { grow: 1, basis: '0' }, children: _jsxs(Select, { label: translate('Sort order'), className: 'select-sorts', "data-testid": 'SortSelector', value: label, onChange: e => {
|
|
34
34
|
const o = validSortOrders.find(v => v.label === e.target.value);
|
|
35
35
|
if (o) {
|
|
36
36
|
updateSortItemOrder(e, sequence, o.id);
|
|
37
37
|
}
|
|
38
|
-
}, children: [_jsx("option", { value: '', children: translate('Select...') }), validSortOrders.map((v, i) => (_jsx(Option, { value: v.label, children: translate(v.label) }, keyFrom(v.label, i))))] }) }), _jsx(Flex, { item: true, children: _jsx(Button, {
|
|
38
|
+
}, children: [_jsx("option", { value: '', children: translate('Select...') }), validSortOrders.map((v, i) => (_jsx(Option, { value: v.label, children: translate(v.label) }, keyFrom(v.label, i))))] }) }), _jsx(Flex, { item: true, children: _jsx(Button, { icon: true, variant: 'simple', onClick: () => removeSortItem(index, order), label: translate('Remove sort'), disabled: !removeSortItem, children: _jsx(Icon, { name: 'trash' }) }) })] }) }));
|
|
39
39
|
};
|
|
40
40
|
Row.propTypes = {
|
|
41
|
-
updateSortItemId: PropTypes.func
|
|
41
|
+
updateSortItemId: PropTypes.func,
|
|
42
42
|
updateSortItemOrder: PropTypes.func.isRequired,
|
|
43
43
|
columns: PropTypes.arrayOf(PropTypes.any).isRequired,
|
|
44
|
-
removeSortItem: PropTypes.func
|
|
44
|
+
removeSortItem: PropTypes.func,
|
|
45
45
|
sortItems: PropTypes.arrayOf(PropTypes.any).isRequired,
|
|
46
46
|
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
47
47
|
index: PropTypes.number.isRequired,
|
|
48
48
|
order: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
49
49
|
sequence: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
50
|
-
dragProps: PropTypes.objectOf(PropTypes.any)
|
|
51
|
-
dropProps: PropTypes.objectOf(PropTypes.any)
|
|
50
|
+
dragProps: PropTypes.objectOf(PropTypes.any),
|
|
51
|
+
dropProps: PropTypes.objectOf(PropTypes.any),
|
|
52
52
|
focusRowRef: PropTypes.objectOf(PropTypes.any)
|
|
53
53
|
};
|
|
54
54
|
Row.displayName = 'Row';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Row.js","sourceRoot":"","sources":["../../../../../../Core/Components/Toolbar/hooks/useSort/Row.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE/F,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,YAAY,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEvE,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,OAAO,GAAG,CAAA;;yBAEa,KAAK,CAAC,IAAI,CAAC,OAAO;;;2BAGhB,KAAK,CAAC,IAAI,CAAC,OAAO;;GAE1C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,MAAM,GAAG,GAAG,CAAC,EACX,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,EACP,cAAc,EACd,SAAS,EACT,KAAK,EACL,EAAE,EACF,KAAK,EACL,QAAQ,EACR,SAAS,EACT,SAAS,EACT,WAAW,EACZ,EAAE,EAAE;IACH,MAAM,CAAC,SAAS,CAAC,GAAG,YAAY,EAAE,CAAC;IACnC,MAAM,qBAAqB,GAAG,wBAAwB,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IAC/E,I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AC;AAExB,eAAe,GAAG,CAAC","sourcesContent":["import PropTypes from 'prop-types';\nimport styled, { css } from 'styled-components';\n\nimport { Button, defaultThemeProp, Flex, Icon, Option, Select } from '@pega/cosmos-react-core';\n\nimport FieldSelector from '../../FieldSelector';\nimport { keyFrom } from '../../../../Utils';\nimport useTranslate from '../../../../Hooks/useTranslate';\n\nimport { getValidSortColumnsInRow, getValidSortOrders } from './utils';\n\nconst StyledDragHandle = styled(Button)(({ theme }) => {\n return css`\n cursor: grab;\n margin-block: calc(${theme.base.spacing} * 0.5);\n\n @media (pointer: coarse) {\n margin-block: calc(${theme.base.spacing} * 1.25);\n }\n `;\n});\n\nStyledDragHandle.defaultProps = defaultThemeProp;\n\nconst Row = ({\n updateSortItemId,\n updateSortItemOrder,\n columns,\n removeSortItem,\n sortItems,\n index,\n id,\n order,\n sequence,\n dragProps,\n dropProps,\n focusRowRef\n}) => {\n const [translate] = useTranslate();\n const validSortColumnsInRow = getValidSortColumnsInRow(columns, sortItems, id);\n if (!validSortColumnsInRow || !validSortColumnsInRow.length) return null;\n const validSortOrders = getValidSortOrders();\n const { label } = validSortOrders.find(v => v.id === order) || {};\n\n return (\n <div {...dropProps} data-sequence={sequence}>\n <Flex\n container={{\n justify: 'between',\n alignItems: 'end',\n direction: 'row',\n wrap: 'no-wrap',\n itemGap: 0.5\n }}\n ref={focusRowRef}\n >\n <StyledDragHandle\n forwardedAs='div'\n role='button'\n icon\n variant='simple'\n compact\n disabled={!dragProps}\n {...dragProps}\n >\n <Icon name='drag' />\n </StyledDragHandle>\n <Flex item={{ grow: 1, basis: '0' }}>\n <FieldSelector\n label={translate('Field')}\n columns={validSortColumnsInRow}\n value={id}\n onChange={newID => updateSortItemId(newID, sequence)}\n fieldProp='id'\n readOnly={!updateSortItemId}\n />\n </Flex>\n <Flex item={{ grow: 1, basis: '0' }}>\n <Select\n label={translate('Sort order')}\n className='select-sorts'\n data-testid='SortSelector'\n value={label}\n onChange={e => {\n const o = validSortOrders.find(v => v.label === e.target.value);\n if (o) {\n updateSortItemOrder(e, sequence, o.id);\n }\n }}\n >\n <option value=''>{translate('Select...')}</option>\n {validSortOrders.map((v, i) => (\n <Option key={keyFrom(v.label, i)} value={v.label}>\n {translate(v.label)}\n </Option>\n ))}\n </Select>\n </Flex>\n <Flex item>\n <Button\n icon\n variant='simple'\n onClick={() => removeSortItem(index, order)}\n label={translate('Remove sort')}\n disabled={!removeSortItem}\n >\n <Icon name='trash' />\n </Button>\n </Flex>\n </Flex>\n </div>\n );\n};\n\nRow.propTypes = {\n updateSortItemId: PropTypes.func,\n updateSortItemOrder: PropTypes.func.isRequired,\n columns: PropTypes.arrayOf(PropTypes.any).isRequired,\n removeSortItem: PropTypes.func,\n sortItems: PropTypes.arrayOf(PropTypes.any).isRequired,\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n index: PropTypes.number.isRequired,\n order: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n sequence: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n dragProps: PropTypes.objectOf(PropTypes.any),\n dropProps: PropTypes.objectOf(PropTypes.any),\n focusRowRef: PropTypes.objectOf(PropTypes.any)\n};\n\nRow.displayName = 'Row';\n\nexport default Row;\n"]}
|
|
@@ -7,7 +7,8 @@ interface SortRendererProps {
|
|
|
7
7
|
updateSortItems: (sortItems: (Sort | {
|
|
8
8
|
order: string;
|
|
9
9
|
})[]) => void;
|
|
10
|
+
template: RsCoreTypes.Meta['template'];
|
|
10
11
|
}
|
|
11
|
-
declare const SortRenderer: ({ sortItems, columns, updateSortItems }: SortRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare const SortRenderer: ({ sortItems, columns, updateSortItems, template }: SortRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export default SortRenderer;
|
|
13
14
|
//# sourceMappingURL=SortRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortRenderer.d.ts","sourceRoot":"","sources":["../../../../../../Core/Components/Toolbar/hooks/useSort/SortRenderer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"SortRenderer.d.ts","sourceRoot":"","sources":["../../../../../../Core/Components/Toolbar/hooks/useSort/SortRenderer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kDAAkD,CAAC;AAE7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAOlE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI1C,UAAU,iBAAiB;IACzB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC;IAC9B,eAAe,EAAE,CAAC,SAAS,EAAE,CAAC,IAAI,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,KAAK,IAAI,CAAC;IACnE,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;CACxC;AAED,QAAA,MAAM,YAAY,GAAI,mDAAmD,iBAAiB,4CAiIzF,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useRef } from 'react';
|
|
3
3
|
import { Button, createUID, Flex, Icon, useI18n } from '@pega/cosmos-react-core';
|
|
4
|
+
import { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';
|
|
4
5
|
import useRowFocus from '../useRowFocus';
|
|
5
6
|
import useDragDrop from '../../../../Hooks/useDragDrop';
|
|
6
7
|
import { getValidSortColumnsInRow } from './utils';
|
|
7
8
|
import Row from './Row';
|
|
8
9
|
const DropSelector = '[data-drop]';
|
|
9
|
-
const SortRenderer = ({ sortItems, columns, updateSortItems }) => {
|
|
10
|
+
const SortRenderer = ({ sortItems, columns, updateSortItems, template }) => {
|
|
10
11
|
const t = useI18n();
|
|
11
12
|
const { focusRowRef, focusRowId, setFocusRowId } = useRowFocus();
|
|
12
13
|
const dragDropRef = useRef(null);
|
|
@@ -75,7 +76,12 @@ const SortRenderer = ({ sortItems, columns, updateSortItems }) => {
|
|
|
75
76
|
return (_jsxs(Flex, { container: { direction: 'column', gap: 2 }, children: [_jsx(Flex, { container: { direction: 'column', gap: 1 }, ref: dragDropRef, children: sortItems
|
|
76
77
|
.slice()
|
|
77
78
|
.sort((a, b) => a.sequence - b.sequence)
|
|
78
|
-
.map((s, i) => (_jsx(Row, {
|
|
79
|
+
.map((s, i) => (_jsx(Row, { updateSortItemOrder: updateSortItemOrder, columns: columns, sortItems: sortItems, index: i, id: s.columnId, order: s.order, sequence: s.sequence, focusRowRef: sortItems[i].id === focusRowId ? focusRowRef : null, ...(!(i === 0 && template === REPEATING_STRUCTURE_TEMPLATES.TIMELINE) && {
|
|
80
|
+
updateSortItemId,
|
|
81
|
+
removeSortItem,
|
|
82
|
+
dragProps,
|
|
83
|
+
dropProps
|
|
84
|
+
}) }, s.id))) }), _jsx("div", { children: _jsx(Button, { variant: 'link', "aria-label": t('add_sort'), onClick: addSortItem, children: _jsxs(Flex, { container: { inline: true, alignItems: 'start', gap: 1 }, as: 'span', children: [_jsx(Icon, { name: 'plus' }), _jsx("span", { children: t('add') })] }) }) })] }));
|
|
79
85
|
};
|
|
80
86
|
export default SortRenderer;
|
|
81
87
|
//# sourceMappingURL=SortRenderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortRenderer.js","sourceRoot":"","sources":["../../../../../../Core/Components/Toolbar/hooks/useSort/SortRenderer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,EAAE,MAAM,E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AE,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,IAZ3D,CAAC,CAAC,EAAE,CAaT,CACH,CAAC,GACC,EACP,wBACE,KAAC,MAAM,IAAC,OAAO,EAAC,MAAM,gBAAa,CAAC,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,WAAW,YACpE,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAC,MAAM,aACvE,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,EACpB,yBAAO,CAAC,CAAC,KAAK,CAAC,GAAQ,IAClB,GACA,GACL,IACD,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\nimport type { ChangeEvent } from 'react';\n\nimport { Button, createUID, Flex, Icon, useI18n } from '@pega/cosmos-react-core';\nimport type { Sort } from 'pega-repeating-structures-core/types/State.types';\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\n\nimport useRowFocus from '../useRowFocus';\nimport useDragDrop from '../../../../Hooks/useDragDrop';\n\nimport { getValidSortColumnsInRow } from './utils';\nimport Row from './Row';\nimport type { SortItem } from './useSort';\n\nconst DropSelector = '[data-drop]';\n\ninterface SortRendererProps {\n sortItems: SortItem[];\n columns: RsCoreTypes.Column[];\n updateSortItems: (sortItems: (Sort | { order: string })[]) => void;\n}\n\nconst SortRenderer = ({ sortItems, columns, updateSortItems }: SortRendererProps) => {\n const t = useI18n();\n const { focusRowRef, focusRowId, setFocusRowId } = useRowFocus();\n\n const dragDropRef = useRef<HTMLDivElement>(null);\n const getAnimationSelector = useCallback((target: Element) => target.closest(DropSelector), []);\n\n const updateSortItemSequence = useCallback(\n (srcSequence: Sort['sequence'], destSequence: Sort['sequence']) => {\n const items = sortItems.slice().sort((a, b) => a.sequence - b.sequence);\n items.splice(destSequence - 1, 0, items.splice(srcSequence - 1, 1)[0]);\n items.forEach((item, index) => {\n item.sequence = index + 1;\n });\n updateSortItems(items);\n },\n [sortItems]\n );\n\n const onDrop = useCallback(\n (dest: Element, src: Element) => {\n updateSortItemSequence(\n parseInt(src.getAttribute('data-sequence') ?? '', 10),\n parseInt(dest.getAttribute('data-sequence') ?? '', 10)\n );\n },\n [updateSortItemSequence]\n );\n const { dragProps, dropProps } = useDragDrop({\n context: dragDropRef,\n getAnimationSelector,\n getGhostImageSelector: getAnimationSelector,\n getDraggedObject: getAnimationSelector,\n onDrop\n });\n\n const addSortItem = useCallback(() => {\n const validSortColumnsInRow = getValidSortColumnsInRow(columns, sortItems);\n if (validSortColumnsInRow && validSortColumnsInRow.length) {\n const newRow = {\n id: createUID(),\n columnId: '',\n order: '',\n sequence: sortItems.length + 1\n };\n const newSortItems = [...sortItems, newRow];\n updateSortItems(newSortItems);\n setFocusRowId(newRow.id);\n }\n }, [sortItems, columns, setFocusRowId]);\n\n const updateSortItemId = useCallback(\n (id: Sort['columnId'], sequence: Sort['sequence']) => {\n const index = sortItems.findIndex(s => s.sequence === sequence);\n const items = [...sortItems];\n items[index].columnId = id;\n updateSortItems(items);\n },\n [sortItems]\n );\n\n const updateSortItemOrder = useCallback(\n (e: ChangeEvent, sequence: Sort['sequence'], o: Sort['order']) => {\n const index = sortItems.findIndex(s => s.sequence === sequence);\n const items = [...sortItems];\n items[index].order = o;\n updateSortItems(items);\n },\n [sortItems]\n );\n\n const removeSortItem = useCallback(\n (index: number) => {\n const items = sortItems.map(v => ({ ...v }));\n const { sequence } = items[index];\n items.splice(index, 1);\n items.forEach(item => {\n if (item.sequence > sequence) item.sequence -= 1;\n });\n updateSortItems(items);\n\n if (items.length > 0)\n setFocusRowId(index === sortItems.length - 1 ? items[index - 1].id : items[index].id);\n },\n [sortItems, setFocusRowId]\n );\n\n useEffect(() => {\n if (!sortItems.length) {\n addSortItem();\n }\n }, [sortItems, addSortItem]);\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Flex container={{ direction: 'column', gap: 1 }} ref={dragDropRef}>\n {sortItems\n .slice()\n .sort((a, b) => a.sequence - b.sequence)\n .map((s, i) => (\n <Row\n key={s.id}\n updateSortItemId={updateSortItemId}\n updateSortItemOrder={updateSortItemOrder}\n columns={columns}\n removeSortItem={removeSortItem}\n sortItems={sortItems}\n index={i}\n id={s.columnId}\n order={s.order}\n sequence={s.sequence}\n dragProps={dragProps}\n dropProps={dropProps}\n focusRowRef={sortItems[i].id === focusRowId ? focusRowRef : null}\n />\n ))}\n </Flex>\n <div>\n <Button variant='link' aria-label={t('add_sort')} onClick={addSortItem}>\n <Flex container={{ inline: true, alignItems: 'start', gap: 1 }} as='span'>\n <Icon name='plus' />\n <span>{t('add')}</span>\n </Flex>\n </Button>\n </div>\n </Flex>\n );\n};\n\nexport default SortRenderer;\n"]}
|
|
1
|
+
{"version":3,"file":"SortRenderer.js","sourceRoot":"","sources":["../../../../../../Core/Components/Toolbar/hooks/useSort/SortRenderer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGvD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAG/E,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,WAAW,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,GAAG,MAAM,OAAO,CAAC;AAGxB,MAAM,YAAY,GAAG,aAAa,CAAC;AASnC,MAAM,YAAY,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAqB,EAAE,EAAE;IAC5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,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAC,MAAM,aACvE,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,GAAG,EACpB,yBAAO,CAAC,CAAC,KAAK,CAAC,GAAQ,IAClB,GACA,GACL,IACD,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\nimport type { ChangeEvent } from 'react';\n\nimport { Button, createUID, Flex, Icon, useI18n } from '@pega/cosmos-react-core';\nimport type { Sort } from 'pega-repeating-structures-core/types/State.types';\nimport { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\n\nimport useRowFocus from '../useRowFocus';\nimport useDragDrop from '../../../../Hooks/useDragDrop';\n\nimport { getValidSortColumnsInRow } from './utils';\nimport Row from './Row';\nimport type { SortItem } from './useSort';\n\nconst DropSelector = '[data-drop]';\n\ninterface SortRendererProps {\n sortItems: SortItem[];\n columns: RsCoreTypes.Column[];\n updateSortItems: (sortItems: (Sort | { order: string })[]) => void;\n template: RsCoreTypes.Meta['template'];\n}\n\nconst SortRenderer = ({ sortItems, columns, updateSortItems, template }: SortRendererProps) => {\n const t = useI18n();\n const { focusRowRef, focusRowId, setFocusRowId } = useRowFocus();\n\n const dragDropRef = useRef<HTMLDivElement>(null);\n const getAnimationSelector = useCallback((target: Element) => target.closest(DropSelector), []);\n\n const updateSortItemSequence = useCallback(\n (srcSequence: Sort['sequence'], destSequence: Sort['sequence']) => {\n const items = sortItems.slice().sort((a, b) => a.sequence - b.sequence);\n items.splice(destSequence - 1, 0, items.splice(srcSequence - 1, 1)[0]);\n items.forEach((item, index) => {\n item.sequence = index + 1;\n });\n updateSortItems(items);\n },\n [sortItems]\n );\n\n const onDrop = useCallback(\n (dest: Element, src: Element) => {\n updateSortItemSequence(\n parseInt(src.getAttribute('data-sequence') ?? '', 10),\n parseInt(dest.getAttribute('data-sequence') ?? '', 10)\n );\n },\n [updateSortItemSequence]\n );\n const { dragProps, dropProps } = useDragDrop({\n context: dragDropRef,\n getAnimationSelector,\n getGhostImageSelector: getAnimationSelector,\n getDraggedObject: getAnimationSelector,\n onDrop\n });\n\n const addSortItem = useCallback(() => {\n const validSortColumnsInRow = getValidSortColumnsInRow(columns, sortItems);\n if (validSortColumnsInRow && validSortColumnsInRow.length) {\n const newRow = {\n id: createUID(),\n columnId: '',\n order: '',\n sequence: sortItems.length + 1\n };\n const newSortItems = [...sortItems, newRow];\n updateSortItems(newSortItems);\n setFocusRowId(newRow.id);\n }\n }, [sortItems, columns, setFocusRowId]);\n\n const updateSortItemId = useCallback(\n (id: Sort['columnId'], sequence: Sort['sequence']) => {\n const index = sortItems.findIndex(s => s.sequence === sequence);\n const items = [...sortItems];\n items[index].columnId = id;\n updateSortItems(items);\n },\n [sortItems]\n );\n\n const updateSortItemOrder = useCallback(\n (e: ChangeEvent, sequence: Sort['sequence'], o: Sort['order']) => {\n const index = sortItems.findIndex(s => s.sequence === sequence);\n const items = [...sortItems];\n items[index].order = o;\n updateSortItems(items);\n },\n [sortItems]\n );\n\n const removeSortItem = useCallback(\n (index: number) => {\n const items = sortItems.map(v => ({ ...v }));\n const { sequence } = items[index];\n items.splice(index, 1);\n items.forEach(item => {\n if (item.sequence > sequence) item.sequence -= 1;\n });\n updateSortItems(items);\n\n if (items.length > 0)\n setFocusRowId(index === sortItems.length - 1 ? items[index - 1].id : items[index].id);\n },\n [sortItems, setFocusRowId]\n );\n\n useEffect(() => {\n if (!sortItems.length) {\n addSortItem();\n }\n }, [sortItems, addSortItem]);\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Flex container={{ direction: 'column', gap: 1 }} ref={dragDropRef}>\n {sortItems\n .slice()\n .sort((a, b) => a.sequence - b.sequence)\n .map((s, i) => (\n <Row\n key={s.id}\n updateSortItemOrder={updateSortItemOrder}\n columns={columns}\n sortItems={sortItems}\n index={i}\n id={s.columnId}\n order={s.order}\n sequence={s.sequence}\n focusRowRef={sortItems[i].id === focusRowId ? focusRowRef : null}\n {...(!(i === 0 && template === REPEATING_STRUCTURE_TEMPLATES.TIMELINE) && {\n updateSortItemId,\n removeSortItem,\n dragProps,\n dropProps\n })}\n />\n ))}\n </Flex>\n <div>\n <Button variant='link' aria-label={t('add_sort')} onClick={addSortItem}>\n <Flex container={{ inline: true, alignItems: 'start', gap: 1 }} as='span'>\n <Icon name='plus' />\n <span>{t('add')}</span>\n </Flex>\n </Button>\n </div>\n </Flex>\n );\n};\n\nexport default SortRenderer;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSort.d.ts","sourceRoot":"","sources":["../../../../../../Core/Components/Toolbar/hooks/useSort/useSort.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,gBAAgB,EAAe,MAAM,yBAAyB,CAAC;AACxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kDAAkD,CAAC;AAO7E,MAAM,WAAW,QAAS,SAAQ,IAAI;IACpC,EAAE,EAAE,MAAM,CAAC;CACZ;AAKD,QAAA,MAAM,OAAO,GAAI,UAAU;IAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAA;CAAE,KAAG,gBAAgB,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"useSort.d.ts","sourceRoot":"","sources":["../../../../../../Core/Components/Toolbar/hooks/useSort/useSort.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,gBAAgB,EAAe,MAAM,yBAAyB,CAAC;AACxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kDAAkD,CAAC;AAO7E,MAAM,WAAW,QAAS,SAAQ,IAAI;IACpC,EAAE,EAAE,MAAM,CAAC;CACZ;AAKD,QAAA,MAAM,OAAO,GAAI,UAAU;IAAE,IAAI,EAAE,WAAW,CAAC,IAAI,CAAA;CAAE,KAAG,gBAAgB,CAAC,MAAM,CAyC9E,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { deepCopy, deepEqual } from '../../../../Utils/index';
|
|
|
5
5
|
import SortRenderer from './SortRenderer';
|
|
6
6
|
const convertSortingOrderToSortItems = (sortingOrder) => sortingOrder.map(sort => ({ ...sort, id: createUID() }));
|
|
7
7
|
const useSort = ({ view }) => {
|
|
8
|
-
const { columns = [], state: { sortingOrder = [] } = {}, type: { applySorting } } = view;
|
|
8
|
+
const { columns = [], state: { sortingOrder = [] } = {}, meta: { template }, type: { applySorting } } = view;
|
|
9
9
|
const displaySort = view.shouldDisplayFeature(TOOLBAR_FEATURES.SORT);
|
|
10
10
|
const [sortItems, updateSortItems] = useState([]);
|
|
11
11
|
const onSubmit = useCallback(() => {
|
|
@@ -32,7 +32,7 @@ const useSort = ({ view }) => {
|
|
|
32
32
|
return {
|
|
33
33
|
count: sortingOrder.length > 0 ? sortingOrder.length : undefined,
|
|
34
34
|
renderer: SortRenderer,
|
|
35
|
-
rendererProps: { sortItems, columns, updateSortItems },
|
|
35
|
+
rendererProps: { sortItems, columns, updateSortItems, template },
|
|
36
36
|
onSubmit,
|
|
37
37
|
onCancel
|
|
38
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSort.js","sourceRoot":"","sources":["../../../../../../Core/Components/Toolbar/hooks/useSort/useSort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAyB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAIxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAA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CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,MAAM,gBAAgB,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC;IACnD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,gBAAgB,CAAC,EAAE,CAAC;YAC/C,eAAe,CAAC,QAAQ,CAAC,8BAA8B,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAErC,IAAI,CAAC,WAAW;QAAE,OAAO;IAEzB,OAAO;QACL,KAAK,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;QAChE,QAAQ,EAAE,YAAY;QACtB,aAAa,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE;QAChE,QAAQ;QACR,QAAQ;KACT,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport { createUID, type ListToolbarProps, usePrevious } from '@pega/cosmos-react-core';\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\nimport type { Sort } from 'pega-repeating-structures-core/types/State.types';\n\nimport { TOOLBAR_FEATURES } from '../../../../constants';\nimport { deepCopy, deepEqual } from '../../../../Utils/index';\n\nimport SortRenderer from './SortRenderer';\n\nexport interface SortItem extends Sort {\n id: string;\n}\n\nconst convertSortingOrderToSortItems = (sortingOrder: Sort[]) =>\n sortingOrder.map(sort => ({ ...sort, id: createUID() }));\n\nconst useSort = ({ view }: { view: RsCoreTypes.View }): ListToolbarProps['sort'] => {\n const {\n columns = [],\n state: { sortingOrder = [] } = {},\n meta: { template },\n type: { applySorting }\n } = view;\n const displaySort = view.shouldDisplayFeature(TOOLBAR_FEATURES.SORT);\n const [sortItems, updateSortItems] = useState<SortItem[]>([]);\n\n const onSubmit = useCallback(() => {\n const finalSortItems = sortItems\n .sort((a, b) => a.sequence - b.sequence)\n .filter(ele => ele.columnId && ele.order)\n .map((item, index) => {\n const { id, ...rest } = item;\n return { ...rest, sequence: index + 1 };\n });\n applySorting(finalSortItems);\n }, [sortItems, applySorting]);\n\n const onCancel = useCallback(() => {\n updateSortItems(deepCopy(convertSortingOrderToSortItems(sortingOrder)));\n }, [sortingOrder]);\n\n const prevSortingOrder = usePrevious(sortingOrder);\n useEffect(() => {\n if (!deepEqual(sortingOrder, prevSortingOrder)) {\n updateSortItems(deepCopy(convertSortingOrderToSortItems(sortingOrder)));\n }\n }, [sortingOrder, prevSortingOrder]);\n\n if (!displaySort) return;\n\n return {\n count: sortingOrder.length > 0 ? sortingOrder.length : undefined,\n renderer: SortRenderer,\n rendererProps: { sortItems, columns, updateSortItems, template },\n onSubmit,\n onCancel\n };\n};\n\nexport default useSort;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWrapAction.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/hooks/useWrapAction.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI;;;EAe3D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { ROW_DENSITY } from 'pega-repeating-structures-core/lib/types/Meta.types';
|
|
3
|
+
export default function useWrapAction(view) {
|
|
4
|
+
const { selectedHeightOption } = view.state;
|
|
5
|
+
return useMemo(() => ({
|
|
6
|
+
enabled: selectedHeightOption === ROW_DENSITY.WRAP_CONTENT,
|
|
7
|
+
onClick: () => {
|
|
8
|
+
if (selectedHeightOption !== ROW_DENSITY.WRAP_CONTENT) {
|
|
9
|
+
view.type.applyRowHeight(ROW_DENSITY.WRAP_CONTENT);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
view.type.applyRowHeight(ROW_DENSITY.SHORT);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}), [selectedHeightOption]);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=useWrapAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWrapAction.js","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/hooks/useWrapAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAGlF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,IAAsB;IAC1D,MAAM,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;IAC5C,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,OAAO,EAAE,oBAAoB,KAAK,WAAW,CAAC,YAAY;QAC1D,OAAO,EAAE,GAAG,EAAE;YACZ,IAAI,oBAAoB,KAAK,WAAW,CAAC,YAAY,EAAE,CAAC;gBACtD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YACrD,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;KACF,CAAC,EACF,CAAC,oBAAoB,CAAC,CACvB,CAAC;AACJ,CAAC","sourcesContent":["import { useMemo } from 'react';\n\nimport { ROW_DENSITY } from 'pega-repeating-structures-core/lib/types/Meta.types';\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\n\nexport default function useWrapAction(view: RsCoreTypes.View) {\n const { selectedHeightOption } = view.state;\n return useMemo(\n () => ({\n enabled: selectedHeightOption === ROW_DENSITY.WRAP_CONTENT,\n onClick: () => {\n if (selectedHeightOption !== ROW_DENSITY.WRAP_CONTENT) {\n view.type.applyRowHeight(ROW_DENSITY.WRAP_CONTENT);\n } else {\n view.type.applyRowHeight(ROW_DENSITY.SHORT);\n }\n }\n }),\n [selectedHeightOption]\n );\n}\n"]}
|
|
@@ -47,5 +47,5 @@ export default getMenuItemsFromColumns;
|
|
|
47
47
|
}
|
|
48
48
|
]
|
|
49
49
|
*/
|
|
50
|
-
declare function getMenuItemsFromColumns(columns: array, fieldProp: string, selectedField: string, defaultType?:
|
|
50
|
+
declare function getMenuItemsFromColumns(columns: array, fieldProp: string, selectedField: string, defaultType?: "text"): array;
|
|
51
51
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/utils/utils.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../Core/Components/Toolbar/utils/utils.js"],"names":[],"mappings":";AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CE;AAEF,kDA9CW,KAAK,aACL,MAAM,iBACN,MAAM,yBACJ,KAAK,CAmEjB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FieldType } from 'pega-repeating-structures-core';
|
|
1
2
|
import { typeMap } from '../../Filters/config';
|
|
2
3
|
const getCategoryItems = (id, arr) => {
|
|
3
4
|
for (const obj of arr) {
|
|
@@ -74,7 +75,7 @@ const prepareCategoryItems = (categories, items) => {
|
|
|
74
75
|
}
|
|
75
76
|
]
|
|
76
77
|
*/
|
|
77
|
-
function getMenuItemsFromColumns(columns, fieldProp, selectedField, defaultType =
|
|
78
|
+
function getMenuItemsFromColumns(columns, fieldProp, selectedField, defaultType = FieldType.TEXT) {
|
|
78
79
|
const items = [];
|
|
79
80
|
let categoryArr = [];
|
|
80
81
|
if (!columns) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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E,KAAK,CAAC,EAAE,KAAK,aAAa;SACrC,CAAC;QAEF,WAAW,GAAG,KAAK,CAAC;QACpB,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,WAAW,GAAG,oBAAoB,CAAC,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAClE,CAAC;QACD,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC;AACD,eAAe,uBAAuB,CAAC","sourcesContent":["import { FieldType } from 'pega-repeating-structures-core';\n\nimport { typeMap } from '../../Filters/config';\n\nconst getCategoryItems = (id, arr) => {\n for (const obj of arr) {\n if (obj.id === id && obj.items) {\n return obj.items;\n }\n }\n};\n\nconst prepareCategoryInfo = (id, label, arr) => {\n const items = [];\n arr.push({ id, primary: label, items });\n return items;\n};\n\nconst prepareCategoryItems = (categories, items) => {\n let curPath = '';\n let leafCategoryArr = items;\n for (let i = 0; i < categories.length; i += 1) {\n curPath = i > 0 ? `${curPath}.${categories[i].label}-${i}` : `${categories[i].label}-${i}`;\n\n const existingCategoryArr = getCategoryItems(curPath, leafCategoryArr);\n if (!existingCategoryArr) {\n leafCategoryArr = prepareCategoryInfo(curPath, categories[i].label, leafCategoryArr);\n } else {\n leafCategoryArr = existingCategoryArr;\n }\n }\n return leafCategoryArr;\n};\n\n/**\n * returns copy of embedded property's leafNode model from store or null\n * @function getMenuItemsFromColumns\n * @param {array} columns columns array containing each column object\n * @param {string} fieldProp value for id prop(either 'name' of 'id')\n * @param {string} selectedField field which is already selected as part of sort/group/filter action\n * @returns {array} returns an array of objects where each object is one category\n *\n * @example <caption>Example for getMenuItemsFromColumns.</caption>\n * We have two fields named ID and Priority where ID does not belong to any category and priority belongs to Bugs class category\n *\n * columns example(fieldDefs) :\n * [\n * {\n filter: true,\n type: 'text',\n name: 'pyID',\n label: 'ID',\n id: '2',\n category: [{ label: 'Profile' }],\n sort: true\n },\n {\n type: 'text',\n name: 'pyLabel',\n label: 'Name',\n id: '3',\n category: [{ label: 'Profile' }],\n sort: true\n }\n ]\n *\n * getMenuItemsFromColumns(columns) returns :\n * [\n {\n id: 'ID',\n primary: ID,\n items: undefined,\n selected: undefined\n },\n {\n id: ‘Bugs Class’,\n primary: ‘Bugs Class’,\n selected: undefined,\n items: [ {id: ‘Priority', primary: ‘Priority’, selected: true, items: undefined}]\n }\n ]\n*/\n\nfunction getMenuItemsFromColumns(columns, fieldProp, selectedField, defaultType = FieldType.TEXT) {\n const items = [];\n let categoryArr = [];\n\n if (!columns) {\n return items;\n }\n columns.forEach(column => {\n const { field } = column;\n const leafCategoryItem = {\n id: field[fieldProp],\n primary: field.label,\n type: typeMap[field.type?.toLowerCase()] || typeMap[defaultType],\n selected: field.id === selectedField\n };\n\n categoryArr = items;\n if (field.category) {\n categoryArr = prepareCategoryItems(field.category, categoryArr);\n }\n categoryArr.push(leafCategoryItem);\n });\n\n return items;\n}\nexport default getMenuItemsFromColumns;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/Pagination.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/Pagination.js"],"names":[],"mappings":"AAoQA;;;;;;;;;;EAsBC;AAzRD,gCAAiC,qBAAqB,CAAC"}
|
|
@@ -117,7 +117,8 @@ function getOptimalInfo(target, rowHeight, rContainer, bufferContainer, oldEleme
|
|
|
117
117
|
const INITIAL_BUFFER = 10;
|
|
118
118
|
const buffer = INITIAL_BUFFER * bufferMultiplier;
|
|
119
119
|
let bottomBufferIndex = buffer * 5;
|
|
120
|
-
|
|
120
|
+
// Since in Infinite scroll, the records need to be fetched in one direction only, fetching more records reduce the number of API calls.
|
|
121
|
+
const scrollDirectionBuffer = isInfiniteScroll ? buffer * 4 : buffer * 2;
|
|
121
122
|
const scrollOppositeDirectionBuffer = buffer;
|
|
122
123
|
let rowsInView = heightComposingOldElementCount
|
|
123
124
|
? Math.floor((oldElementCount / heightComposingOldElementCount) * target.offsetHeight)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/Pagination.js"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,YAAY,CAAC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEvD,SAAS,yBAAyB,CAAC,GAAG;IACpC,IAAI,CAAC,GAAG;QAAE,OAAO;IACjB,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,gCAAgC;AAChC,6DAA6D;AAC7D,SAAS,mBAAmB,CAAC,UAAU,EAAE,iBAAiB;IACxD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACnD,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,MAAM,+BAA+B,GAAG,IAAI,GAAG,EAAE,CAAC;IAElD,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC1C,MAAM,sBAAsB,GAC1B,IAAI,CAAC,KAAK,IAAI,iBAAiB,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,iBAAiB,CAAC,KAAK,CAAC;QAC/E,uDAAuD;QACvD,IACE,CAAC,IAAI,CAAC,GAAG,IAAI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;QACtG,IAAI,EAAE;YACJ,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;YACtC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC;SACxC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAAM,EACN,YAAY,EACZ,EAAE,EACF,SAAS,GAAG,KAAK,EACjB,gBAAgB,GAAG,KAAK;IAExB,MAAM,eAAe,GAAG,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC;IACtE,MAAM,8BAA8B,GAClC,EAAE,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC;IAClE,OAAO,cAAc,CACnB,MAAM,EACN,EAAE,CAAC,UAAU,EACb,EAAE,CAAC,UAAU,EACb,EAAE,CAAC,UAAU,EACb,eAAe,EACf,8BAA8B,EAC9B,YAAY,EACZ,EAAE,CAAC,gBAAgB,EACnB,SAAS,EACT,gBAAgB,CACjB,CAAC;AACJ,CAAC","sourcesContent":["const RowIndexAttribute = 'data-index';\nexport const StickyGroupHeader = 'sticky-group-header';\n\nfunction getKeyWithMaxValueFromMap(map) {\n if (!map) return;\n return [...map.entries()].reduce((a, b) => (b[1] > a[1] ? b : a))[0];\n}\n\n// Find nearest element to view.\n// It always find nearest element from top left of container.\nfunction getNearestElementTo(rContainer, targetBoundingBox) {\n const elements = Array.from(rContainer.childNodes);\n const itemCoords = [];\n const items = [];\n const overlappingGroupHeadersCountMap = new Map();\n\n elements.forEach(item => {\n const rect = item.getBoundingClientRect();\n const inHorizontalBoundaries =\n rect.right >= targetBoundingBox.left && rect.left <= targetBoundingBox.right;\n // considering only those items which are in view area.\n if (\n (rect.top >= targetBoundingBox.top &&\n rect.top <= targetBoundingBox.bottom &&\n inHorizontalBoundaries) ||\n (rect.bottom >= targetBoundingBox.top &&\n rect.bottom <= targetBoundingBox.bottom &&\n inHorizontalBoundaries)\n ) {\n itemCoords.push([rect.left, rect.bottom]);\n items.push(item);\n }\n });\n const distances = [];\n itemCoords.forEach((itemCoord, index) => {\n const distance = Math.hypot(\n itemCoord[0] - targetBoundingBox.left,\n itemCoord[1] - targetBoundingBox.top\n );\n const parsedDistance = parseInt(distance, 10);\n distances.push(parsedDistance);\n\n // Keeping track of group header distances to identify the overlap due to sticky position.\n // The distance with max count will represent the sub-group user is actually seeing.\n if (items[index]?.classList?.contains(StickyGroupHeader)) {\n overlappingGroupHeadersCountMap.set(\n parsedDistance,\n (overlappingGroupHeadersCountMap.get(parsedDistance) || 0) + 1\n );\n }\n });\n\n if (distances.length) {\n // BUG-740809 The closest item to view in case of sticky-group-header is first visible sticky-group-header\n const closestItemIndexFromTop = distances.lastIndexOf(Math.min(...distances));\n\n let closestItemFromTop = items[closestItemIndexFromTop];\n /**\n * BUG-81875: Considering sticky sub-group headers\n * When nested grouping is applied and groups have sticky position, the parent group will always be on the top and nested group headers will come after that.\n * Due to this, the nearest element will always be the parent group header even though user might have scrolled down some sub-group header.\n * Actual nearest element should be the sub-group visible to the user.\n */\n if (closestItemFromTop.classList?.contains(StickyGroupHeader)) {\n const topVisibleGroupKey = getKeyWithMaxValueFromMap(overlappingGroupHeadersCountMap);\n closestItemFromTop = items[distances.lastIndexOf(topVisibleGroupKey)];\n }\n const closestItemIndexFromBottom = distances.lastIndexOf(Math.max(...distances));\n\n if (targetBoundingBox.height === 0) {\n closestItemFromTop = elements[0];\n }\n return [closestItemFromTop, items[closestItemIndexFromBottom]];\n }\n return [];\n}\n\n// When element is present in view , find which direction has\n// enough count as we need to get record in another direction.\n// direction 1 - up, -1 - down\n// Nearest element is one which lies in view boundary.\n\nfunction getDirectionWhereCountIsEnough(nearestViewElement, currentRowIndex, targetBoundingBox) {\n let previousSiblingsCountAboveView = 0;\n let nextSiblingsCountBelowView = 0;\n let startElement = nearestViewElement;\n let dir = 1;\n if (currentRowIndex !== 0 && !startElement.previousElementSibling) dir = -1;\n else {\n while (startElement.previousElementSibling) {\n // BUG-740809 in case of overlapped sticky-group-header the previousElementSibling are at same 'top' location\n if (startElement.previousElementSibling.classList.contains(StickyGroupHeader)) {\n previousSiblingsCountAboveView += 1;\n } else {\n const itemCoords = startElement.previousElementSibling.getBoundingClientRect();\n if (itemCoords.bottom < targetBoundingBox.top) previousSiblingsCountAboveView += 1;\n }\n startElement = startElement.previousElementSibling;\n }\n if (nearestViewElement.classList.contains(StickyGroupHeader))\n previousSiblingsCountAboveView -= 1;\n if (parseInt(startElement.getAttribute(RowIndexAttribute), 10) === 0) dir = 1;\n else {\n startElement = nearestViewElement;\n while (startElement.nextElementSibling) {\n const itemCoords = startElement.nextElementSibling.getBoundingClientRect();\n if (itemCoords.top > targetBoundingBox.bottom) nextSiblingsCountBelowView += 1;\n startElement = startElement.nextElementSibling;\n }\n // iterate in either direction where count is more\n // until you find top element whose left match with nearest view element match.\n // and matched index will be either top or bottom buffer index.\n if (currentRowIndex !== 0 && nextSiblingsCountBelowView >= previousSiblingsCountAboveView)\n dir = -1;\n }\n }\n return dir;\n}\n\n// Get start and end index which view represent at any monument.\n// Add extra information as well to adjust virtualiser position.\n\nfunction getOptimalInfo(\n target,\n rowHeight,\n rContainer,\n bufferContainer,\n oldElementCount,\n heightComposingOldElementCount,\n totalRecords,\n bufferMultiplier,\n isRefresh,\n isInfiniteScroll\n) {\n let currentRowIndex = 0;\n let topRowIndex = 0;\n let topBufferIndex = 0;\n let existingItemBoundingBox;\n\n // Estimated buffer count based on view height and row container count.\n // Increase in buffer count can improve performance.\n // A safeguard value which will apply on initial load.\n const INITIAL_BUFFER = 10;\n const buffer = INITIAL_BUFFER * bufferMultiplier;\n let bottomBufferIndex = buffer * 5;\n const scrollDirectionBuffer = buffer * 2;\n const scrollOppositeDirectionBuffer = buffer;\n\n let rowsInView = heightComposingOldElementCount\n ? Math.floor((oldElementCount / heightComposingOldElementCount) * target.offsetHeight)\n : 0;\n rowsInView = Number.isNaN(rowsInView) ? 0 : rowsInView;\n\n if (totalRecords > 0) {\n const targetBoundingBox = target.getBoundingClientRect();\n const rowConBoundingBox = rContainer.getBoundingClientRect();\n\n // Check if any element exist in current view. Calculation will change the required index\n // As we have to fix the container to not show any flicker.\n const [nearestViewElementFromTop, nearestViewElementFromBottom] = getNearestElementTo(\n rContainer,\n targetBoundingBox\n );\n if (nearestViewElementFromTop) {\n currentRowIndex = parseInt(nearestViewElementFromTop.getAttribute(RowIndexAttribute), 10);\n existingItemBoundingBox = nearestViewElementFromTop.getBoundingClientRect();\n\n // check how long this nearest item is from top of view.\n // to estimate top row index ( What could be possible index on view top.)\n const spaceInMid = existingItemBoundingBox.top - targetBoundingBox.top;\n const elementsInMid = Math.floor(\n (oldElementCount / heightComposingOldElementCount) * spaceInMid\n );\n topRowIndex = elementsInMid < 0 ? currentRowIndex : currentRowIndex - elementsInMid;\n } else {\n currentRowIndex =\n Math.floor((target.scrollTop / heightComposingOldElementCount) * oldElementCount) || 0;\n topRowIndex = currentRowIndex;\n }\n\n // If element exist in current view, traverse dom elements\n // to find top buffer index or bottom buffer index\n // where left match to not change layout.\n if (existingItemBoundingBox) {\n let dir = 1;\n\n // We will consider direction 1 always in case of refresh as item count might have been changed.\n // change in item count is always from downside.\n if (!isRefresh)\n dir = getDirectionWhereCountIsEnough(\n nearestViewElementFromTop,\n currentRowIndex,\n targetBoundingBox\n );\n\n // We will iterate either upside or downside and pick that element\n // which we can select as either top buffer or botton buffer and don't\n // change layout as well and go for max iteration of buffer.\n let maxIteration = buffer;\n let startElement = dir === 1 ? nearestViewElementFromTop : nearestViewElementFromBottom;\n while (startElement && maxIteration > 0) {\n const e = dir === 1 ? startElement.previousElementSibling : startElement.nextElementSibling;\n if (\n e &&\n rowConBoundingBox.left ===\n e.getBoundingClientRect().left - parseInt(window.getComputedStyle(e).marginLeft, 10)\n ) {\n if (dir === 1) topBufferIndex = parseInt(e.getAttribute(RowIndexAttribute), 10);\n else bottomBufferIndex = parseInt(e.getAttribute(RowIndexAttribute), 10);\n }\n startElement = e;\n maxIteration -= 1;\n }\n\n if (dir === 1) bottomBufferIndex = currentRowIndex + rowsInView + scrollDirectionBuffer;\n else topBufferIndex = topRowIndex - scrollDirectionBuffer;\n } else {\n // if user jumps the scroll and there is no overlapping with the previous records\n topBufferIndex = currentRowIndex - scrollOppositeDirectionBuffer;\n bottomBufferIndex = currentRowIndex + rowsInView + scrollDirectionBuffer;\n }\n }\n\n // Safe edge check when indexes goes out of range.\n if (topBufferIndex < 0) topBufferIndex = 0;\n // As safari does elastic scroll, so currentRowIndex and topRowIndex can go negative , fallback these to zero.\n if (currentRowIndex < 0) currentRowIndex = 0;\n if (topRowIndex < 0) topRowIndex = 0;\n if (\n !isInfiniteScroll &&\n bottomBufferIndex > totalRecords &&\n totalRecords !== null &&\n totalRecords !== undefined\n )\n bottomBufferIndex = totalRecords - 1;\n\n // When we get start index 0 from scrolling then , on edge case we might get whitespace\n // As we always adjust row container top to show previous item in place.\n // To solve this, make sure top index is also 0 when start index is zero to avoid white space\n // otherwise we will make start index to 1 if it is zero.\n // if (topBufferIndex === 0 && topRowIndex !== 0) topBufferIndex = 1;\n\n // before pagination is in progress, put scroll node coords here\n // to track how much user scrolled while pagination is in progress.\n const bufferOldCords = bufferContainer.getBoundingClientRect();\n return {\n existingItemBoundingBox, // coordinates of current row index.\n currentRowIndex, // common visible item in view before and after paint (previous and next paint)\n topRowIndex, // What could be possible index on view top.\n bufferOldCords, // buffer coordinates while pagination.\n bufferNewCords: bufferOldCords, // buffer coordinates while pagination is in progress and user scroll.\n view: {\n startIndex: Math.floor(topBufferIndex),\n endIndex: Math.floor(bottomBufferIndex)\n }\n };\n}\n\nexport default function getPaginationInfo(\n target,\n totalRecords,\n vi,\n isRefresh = false,\n isInfiniteScroll = false\n) {\n const oldElementCount = vi.itemCount === undefined ? 0 : vi.itemCount;\n const heightComposingOldElementCount =\n vi.rowContainerHeight === undefined ? 0 : vi.rowContainerHeight;\n return getOptimalInfo(\n target,\n vi.itemHeight,\n vi.rContainer,\n vi.bContainer,\n oldElementCount,\n heightComposingOldElementCount,\n totalRecords,\n vi.bufferMultiplier,\n isRefresh,\n isInfiniteScroll\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/Pagination.js"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,YAAY,CAAC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEvD,SAAS,yBAAyB,CAAC,GAAG;IACpC,IAAI,CAAC,GAAG;QAAE,OAAO;IACjB,OAAO,CAAC,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,gCAAgC;AAChC,6DAA6D;AAC7D,SAAS,mBAAmB,CAAC,UAAU,EAAE,iBAAiB;IACxD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACnD,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,MAAM,+BAA+B,GAAG,IAAI,GAAG,EAAE,CAAC;IAElD,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC1C,MAAM,sBAAsB,GAC1B,IAAI,CAAC,KAAK,IAAI,iBAAiB,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,iBAAiB,CAAC,KAAK,CAAC;QAC/E,uDA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AoC;QAC7D,eAAe,EAAE,+EAA+E;QAChG,WAAW,EAAE,4CAA4C;QACzD,cAAc,EAAE,uCAAuC;QACvD,cAAc,EAAE,cAAc,EAAE,sEAAsE;QACtG,IAAI,EAAE;YACJ,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;YACtC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC;SACxC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,MAAM,EACN,YAAY,EACZ,EAAE,EACF,SAAS,GAAG,KAAK,EACjB,gBAAgB,GAAG,KAAK;IAExB,MAAM,eAAe,GAAG,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC;IACtE,MAAM,8BAA8B,GAClC,EAAE,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC;IAClE,OAAO,cAAc,CACnB,MAAM,EACN,EAAE,CAAC,UAAU,EACb,EAAE,CAAC,UAAU,EACb,EAAE,CAAC,UAAU,EACb,eAAe,EACf,8BAA8B,EAC9B,YAAY,EACZ,EAAE,CAAC,gBAAgB,EACnB,SAAS,EACT,gBAAgB,CACjB,CAAC;AACJ,CAAC","sourcesContent":["const RowIndexAttribute = 'data-index';\nexport const StickyGroupHeader = 'sticky-group-header';\n\nfunction getKeyWithMaxValueFromMap(map) {\n if (!map) return;\n return [...map.entries()].reduce((a, b) => (b[1] > a[1] ? b : a))[0];\n}\n\n// Find nearest element to view.\n// It always find nearest element from top left of container.\nfunction getNearestElementTo(rContainer, targetBoundingBox) {\n const elements = Array.from(rContainer.childNodes);\n const itemCoords = [];\n const items = [];\n const overlappingGroupHeadersCountMap = new Map();\n\n elements.forEach(item => {\n const rect = item.getBoundingClientRect();\n const inHorizontalBoundaries =\n rect.right >= targetBoundingBox.left && rect.left <= targetBoundingBox.right;\n // considering only those items which are in view area.\n if (\n (rect.top >= targetBoundingBox.top &&\n rect.top <= targetBoundingBox.bottom &&\n inHorizontalBoundaries) ||\n (rect.bottom >= targetBoundingBox.top &&\n rect.bottom <= targetBoundingBox.bottom &&\n inHorizontalBoundaries)\n ) {\n itemCoords.push([rect.left, rect.bottom]);\n items.push(item);\n }\n });\n const distances = [];\n itemCoords.forEach((itemCoord, index) => {\n const distance = Math.hypot(\n itemCoord[0] - targetBoundingBox.left,\n itemCoord[1] - targetBoundingBox.top\n );\n const parsedDistance = parseInt(distance, 10);\n distances.push(parsedDistance);\n\n // Keeping track of group header distances to identify the overlap due to sticky position.\n // The distance with max count will represent the sub-group user is actually seeing.\n if (items[index]?.classList?.contains(StickyGroupHeader)) {\n overlappingGroupHeadersCountMap.set(\n parsedDistance,\n (overlappingGroupHeadersCountMap.get(parsedDistance) || 0) + 1\n );\n }\n });\n\n if (distances.length) {\n // BUG-740809 The closest item to view in case of sticky-group-header is first visible sticky-group-header\n const closestItemIndexFromTop = distances.lastIndexOf(Math.min(...distances));\n\n let closestItemFromTop = items[closestItemIndexFromTop];\n /**\n * BUG-81875: Considering sticky sub-group headers\n * When nested grouping is applied and groups have sticky position, the parent group will always be on the top and nested group headers will come after that.\n * Due to this, the nearest element will always be the parent group header even though user might have scrolled down some sub-group header.\n * Actual nearest element should be the sub-group visible to the user.\n */\n if (closestItemFromTop.classList?.contains(StickyGroupHeader)) {\n const topVisibleGroupKey = getKeyWithMaxValueFromMap(overlappingGroupHeadersCountMap);\n closestItemFromTop = items[distances.lastIndexOf(topVisibleGroupKey)];\n }\n const closestItemIndexFromBottom = distances.lastIndexOf(Math.max(...distances));\n\n if (targetBoundingBox.height === 0) {\n closestItemFromTop = elements[0];\n }\n return [closestItemFromTop, items[closestItemIndexFromBottom]];\n }\n return [];\n}\n\n// When element is present in view , find which direction has\n// enough count as we need to get record in another direction.\n// direction 1 - up, -1 - down\n// Nearest element is one which lies in view boundary.\n\nfunction getDirectionWhereCountIsEnough(nearestViewElement, currentRowIndex, targetBoundingBox) {\n let previousSiblingsCountAboveView = 0;\n let nextSiblingsCountBelowView = 0;\n let startElement = nearestViewElement;\n let dir = 1;\n if (currentRowIndex !== 0 && !startElement.previousElementSibling) dir = -1;\n else {\n while (startElement.previousElementSibling) {\n // BUG-740809 in case of overlapped sticky-group-header the previousElementSibling are at same 'top' location\n if (startElement.previousElementSibling.classList.contains(StickyGroupHeader)) {\n previousSiblingsCountAboveView += 1;\n } else {\n const itemCoords = startElement.previousElementSibling.getBoundingClientRect();\n if (itemCoords.bottom < targetBoundingBox.top) previousSiblingsCountAboveView += 1;\n }\n startElement = startElement.previousElementSibling;\n }\n if (nearestViewElement.classList.contains(StickyGroupHeader))\n previousSiblingsCountAboveView -= 1;\n if (parseInt(startElement.getAttribute(RowIndexAttribute), 10) === 0) dir = 1;\n else {\n startElement = nearestViewElement;\n while (startElement.nextElementSibling) {\n const itemCoords = startElement.nextElementSibling.getBoundingClientRect();\n if (itemCoords.top > targetBoundingBox.bottom) nextSiblingsCountBelowView += 1;\n startElement = startElement.nextElementSibling;\n }\n // iterate in either direction where count is more\n // until you find top element whose left match with nearest view element match.\n // and matched index will be either top or bottom buffer index.\n if (currentRowIndex !== 0 && nextSiblingsCountBelowView >= previousSiblingsCountAboveView)\n dir = -1;\n }\n }\n return dir;\n}\n\n// Get start and end index which view represent at any monument.\n// Add extra information as well to adjust virtualiser position.\n\nfunction getOptimalInfo(\n target,\n rowHeight,\n rContainer,\n bufferContainer,\n oldElementCount,\n heightComposingOldElementCount,\n totalRecords,\n bufferMultiplier,\n isRefresh,\n isInfiniteScroll\n) {\n let currentRowIndex = 0;\n let topRowIndex = 0;\n let topBufferIndex = 0;\n let existingItemBoundingBox;\n\n // Estimated buffer count based on view height and row container count.\n // Increase in buffer count can improve performance.\n // A safeguard value which will apply on initial load.\n const INITIAL_BUFFER = 10;\n const buffer = INITIAL_BUFFER * bufferMultiplier;\n let bottomBufferIndex = buffer * 5;\n\n // Since in Infinite scroll, the records need to be fetched in one direction only, fetching more records reduce the number of API calls.\n const scrollDirectionBuffer = isInfiniteScroll ? buffer * 4 : buffer * 2;\n const scrollOppositeDirectionBuffer = buffer;\n\n let rowsInView = heightComposingOldElementCount\n ? Math.floor((oldElementCount / heightComposingOldElementCount) * target.offsetHeight)\n : 0;\n rowsInView = Number.isNaN(rowsInView) ? 0 : rowsInView;\n\n if (totalRecords > 0) {\n const targetBoundingBox = target.getBoundingClientRect();\n const rowConBoundingBox = rContainer.getBoundingClientRect();\n\n // Check if any element exist in current view. Calculation will change the required index\n // As we have to fix the container to not show any flicker.\n const [nearestViewElementFromTop, nearestViewElementFromBottom] = getNearestElementTo(\n rContainer,\n targetBoundingBox\n );\n if (nearestViewElementFromTop) {\n currentRowIndex = parseInt(nearestViewElementFromTop.getAttribute(RowIndexAttribute), 10);\n existingItemBoundingBox = nearestViewElementFromTop.getBoundingClientRect();\n\n // check how long this nearest item is from top of view.\n // to estimate top row index ( What could be possible index on view top.)\n const spaceInMid = existingItemBoundingBox.top - targetBoundingBox.top;\n const elementsInMid = Math.floor(\n (oldElementCount / heightComposingOldElementCount) * spaceInMid\n );\n topRowIndex = elementsInMid < 0 ? currentRowIndex : currentRowIndex - elementsInMid;\n } else {\n currentRowIndex =\n Math.floor((target.scrollTop / heightComposingOldElementCount) * oldElementCount) || 0;\n topRowIndex = currentRowIndex;\n }\n\n // If element exist in current view, traverse dom elements\n // to find top buffer index or bottom buffer index\n // where left match to not change layout.\n if (existingItemBoundingBox) {\n let dir = 1;\n\n // We will consider direction 1 always in case of refresh as item count might have been changed.\n // change in item count is always from downside.\n if (!isRefresh)\n dir = getDirectionWhereCountIsEnough(\n nearestViewElementFromTop,\n currentRowIndex,\n targetBoundingBox\n );\n\n // We will iterate either upside or downside and pick that element\n // which we can select as either top buffer or botton buffer and don't\n // change layout as well and go for max iteration of buffer.\n let maxIteration = buffer;\n let startElement = dir === 1 ? nearestViewElementFromTop : nearestViewElementFromBottom;\n while (startElement && maxIteration > 0) {\n const e = dir === 1 ? startElement.previousElementSibling : startElement.nextElementSibling;\n if (\n e &&\n rowConBoundingBox.left ===\n e.getBoundingClientRect().left - parseInt(window.getComputedStyle(e).marginLeft, 10)\n ) {\n if (dir === 1) topBufferIndex = parseInt(e.getAttribute(RowIndexAttribute), 10);\n else bottomBufferIndex = parseInt(e.getAttribute(RowIndexAttribute), 10);\n }\n startElement = e;\n maxIteration -= 1;\n }\n\n if (dir === 1) bottomBufferIndex = currentRowIndex + rowsInView + scrollDirectionBuffer;\n else topBufferIndex = topRowIndex - scrollDirectionBuffer;\n } else {\n // if user jumps the scroll and there is no overlapping with the previous records\n topBufferIndex = currentRowIndex - scrollOppositeDirectionBuffer;\n bottomBufferIndex = currentRowIndex + rowsInView + scrollDirectionBuffer;\n }\n }\n\n // Safe edge check when indexes goes out of range.\n if (topBufferIndex < 0) topBufferIndex = 0;\n // As safari does elastic scroll, so currentRowIndex and topRowIndex can go negative , fallback these to zero.\n if (currentRowIndex < 0) currentRowIndex = 0;\n if (topRowIndex < 0) topRowIndex = 0;\n if (\n !isInfiniteScroll &&\n bottomBufferIndex > totalRecords &&\n totalRecords !== null &&\n totalRecords !== undefined\n )\n bottomBufferIndex = totalRecords - 1;\n\n // When we get start index 0 from scrolling then , on edge case we might get whitespace\n // As we always adjust row container top to show previous item in place.\n // To solve this, make sure top index is also 0 when start index is zero to avoid white space\n // otherwise we will make start index to 1 if it is zero.\n // if (topBufferIndex === 0 && topRowIndex !== 0) topBufferIndex = 1;\n\n // before pagination is in progress, put scroll node coords here\n // to track how much user scrolled while pagination is in progress.\n const bufferOldCords = bufferContainer.getBoundingClientRect();\n return {\n existingItemBoundingBox, // coordinates of current row index.\n currentRowIndex, // common visible item in view before and after paint (previous and next paint)\n topRowIndex, // What could be possible index on view top.\n bufferOldCords, // buffer coordinates while pagination.\n bufferNewCords: bufferOldCords, // buffer coordinates while pagination is in progress and user scroll.\n view: {\n startIndex: Math.floor(topBufferIndex),\n endIndex: Math.floor(bottomBufferIndex)\n }\n };\n}\n\nexport default function getPaginationInfo(\n target,\n totalRecords,\n vi,\n isRefresh = false,\n isInfiniteScroll = false\n) {\n const oldElementCount = vi.itemCount === undefined ? 0 : vi.itemCount;\n const heightComposingOldElementCount =\n vi.rowContainerHeight === undefined ? 0 : vi.rowContainerHeight;\n return getOptimalInfo(\n target,\n vi.itemHeight,\n vi.rContainer,\n vi.bContainer,\n oldElementCount,\n heightComposingOldElementCount,\n totalRecords,\n vi.bufferMultiplier,\n isRefresh,\n isInfiniteScroll\n );\n}\n"]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export default function useScroll(callback: any, getContext: any, vi: any, totalRecordCount: any, header: any, isFetching: any, viewHeight: any
|
|
1
|
+
export default function useScroll(callback: any, getContext: any, vi: any, totalRecordCount: any, header: any, isFetching: any, viewHeight: any, paginationTriggerRatios?: {
|
|
2
|
+
down: number;
|
|
3
|
+
up: number;
|
|
4
|
+
}): ((top: any) => void)[];
|
|
2
5
|
export function useApplyStyleOnScroll(vi: any): () => void;
|
|
3
6
|
//# sourceMappingURL=UseScroll.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseScroll.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/UseScroll.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UseScroll.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/UseScroll.js"],"names":[],"mappings":"AA+BA;;;2BAwGC;AA3HM,2DAiBN"}
|
|
@@ -2,6 +2,10 @@ import { useState, useEffect, useRef, useCallback } from 'react';
|
|
|
2
2
|
import useThrottle from '../../Hooks/useThrottle';
|
|
3
3
|
import { getRecordCountForLayoutPaint, isViewNotFilled } from './utility';
|
|
4
4
|
// import useDebounce from '../../Hooks/UseDebounce';
|
|
5
|
+
const DEFAULT_PAGINATION_TRIGGER_RATIOS = {
|
|
6
|
+
down: 0.8,
|
|
7
|
+
up: 0.2
|
|
8
|
+
};
|
|
5
9
|
export const useApplyStyleOnScroll = vi => {
|
|
6
10
|
const footerElement = vi.pContainer?.querySelector('.footer > .row');
|
|
7
11
|
return useCallback(() => {
|
|
@@ -17,7 +21,7 @@ export const useApplyStyleOnScroll = vi => {
|
|
|
17
21
|
}
|
|
18
22
|
}, [vi.pContainer, vi.rContainer, vi.pContainer?.offsetHeight, footerElement]);
|
|
19
23
|
};
|
|
20
|
-
export default function useScroll(callback, getContext, vi, totalRecordCount, header, isFetching, viewHeight) {
|
|
24
|
+
export default function useScroll(callback, getContext, vi, totalRecordCount, header, isFetching, viewHeight, paginationTriggerRatios = DEFAULT_PAGINATION_TRIGGER_RATIOS) {
|
|
21
25
|
const applyScrollEndStyle = useApplyStyleOnScroll(vi);
|
|
22
26
|
const [vScroll, setVScroll] = useState();
|
|
23
27
|
const ref = useRef({
|
|
@@ -57,7 +61,7 @@ export default function useScroll(callback, getContext, vi, totalRecordCount, he
|
|
|
57
61
|
if (!context)
|
|
58
62
|
return;
|
|
59
63
|
const direction = getDirection();
|
|
60
|
-
const distance = direction === 1 ?
|
|
64
|
+
const distance = direction === 1 ? paginationTriggerRatios.down : paginationTriggerRatios.up;
|
|
61
65
|
const eleIndex = Math.floor(vi.rContainer.childElementCount * distance);
|
|
62
66
|
const boundaryEle = vi.rContainer.childNodes[eleIndex];
|
|
63
67
|
const boundaryElePos = boundaryEle?.getBoundingClientRect();
|
|
@@ -71,7 +75,16 @@ export default function useScroll(callback, getContext, vi, totalRecordCount, he
|
|
|
71
75
|
vi.direction = direction;
|
|
72
76
|
callback();
|
|
73
77
|
}
|
|
74
|
-
}, [
|
|
78
|
+
}, [
|
|
79
|
+
getDirection,
|
|
80
|
+
paginationTriggerRatios,
|
|
81
|
+
vi,
|
|
82
|
+
getContext,
|
|
83
|
+
isFetching,
|
|
84
|
+
totalRecordCount,
|
|
85
|
+
header,
|
|
86
|
+
callback
|
|
87
|
+
]);
|
|
75
88
|
useThrottle(vScroll, handleScroll);
|
|
76
89
|
useEffect(() => {
|
|
77
90
|
const context = getContext();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseScroll.js","sourceRoot":"","sources":["../../../../Core/Components/Virtualise/UseScroll.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAE,4BAA4B,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC1E,qDAAqD;AAErD,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC,EAAE;IACxC,MAAM,aAAa,GAAG,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACrE,OAAO,WAAW,CAAC,GAAG,EAAE;QACtB,6EAA6E;QAC7E,8FAA8F;QAC9F,IACE,IAAI,CAAC,GAAG,CACN,EAAE,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,MAAM;YAC1C,EAAE,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,MAAM;YAC5C,CAAC,aAAa,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CACpE,GAAG,CAAC,EACL,CAAC;YACD,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC;AACjF,CAAC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,SAAS,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AgB,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,EACpF,CAAC;YACD,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC;YACzB,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,EAAE;QACD,YAAY;QACZ,uBAAuB;QACvB,EAAE;QACF,UAAU;QACV,UAAU;QACV,gBAAgB;QAChB,MAAM;QACN,QAAQ;KACT,CAAC,CAAC;IAEH,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAEnC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;QAC7B,IAAI,OAAO;YAAE,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC1D,OAAO,GAAG,EAAE;YACV,IAAI,OAAO;gBAAE,OAAO,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC/D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAE9E,oCAAoC;IACpC,SAAS,CAAC,GAAG,EAAE;QACb,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC,CAAC;IACtF,oBAAoB;IACpB,wCAAwC;IACxC,sBAAsB;IACtB,0BAA0B;IAE1B,OAAO,CAAC,eAAe,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import { useState, useEffect, useRef, useCallback } from 'react';\n\nimport useThrottle from '../../Hooks/useThrottle';\n\nimport { getRecordCountForLayoutPaint, isViewNotFilled } from './utility';\n// import useDebounce from '../../Hooks/UseDebounce';\n\nconst DEFAULT_PAGINATION_TRIGGER_RATIOS = {\n down: 0.8,\n up: 0.2\n};\n\nexport const useApplyStyleOnScroll = vi => {\n const footerElement = vi.pContainer?.querySelector('.footer > .row');\n return useCallback(() => {\n // Calculate the difference between bottom co-ordinates of p and r Containers\n // along with the row height of footer element to check if the bottom of the table is reached.\n if (\n Math.abs(\n vi.pContainer.getBoundingClientRect().bottom -\n vi.rContainer.getBoundingClientRect().bottom -\n (footerElement?.hasChildNodes() ? footerElement.offsetHeight : 0)\n ) < 1\n ) {\n vi.rContainer.classList.add('scroll-end');\n } else {\n vi.rContainer.classList.remove('scroll-end');\n }\n }, [vi.pContainer, vi.rContainer, vi.pContainer?.offsetHeight, footerElement]);\n};\n\nexport default function useScroll(\n callback,\n getContext,\n vi,\n totalRecordCount,\n header,\n isFetching,\n viewHeight,\n paginationTriggerRatios = DEFAULT_PAGINATION_TRIGGER_RATIOS\n) {\n const applyScrollEndStyle = useApplyStyleOnScroll(vi);\n const [vScroll, setVScroll] = useState();\n const ref = useRef({\n oldScrollTop: 0\n }).current;\n const updateScrollTop = useCallback(\n top => {\n ref.oldScrollTop = top;\n },\n [ref]\n );\n // const deBouncedVScroll = useDebounce(vScroll, 100);\n\n const getDirection = useCallback(() => {\n const context = getContext();\n let dir;\n if (ref.oldScrollTop > context.scrollTop) dir = -1;\n else if (ref.oldScrollTop < context.scrollTop) dir = 1;\n ref.oldScrollTop = context.scrollTop;\n return dir;\n }, [getContext, ref.oldScrollTop]);\n\n const onScroll = useCallback(\n e => {\n setVScroll(e.target.scrollTop);\n vi.pInfo.bufferNewCords = vi.bContainer.getBoundingClientRect();\n\n // Style is to be applied upon scroll after successful\n // check of bottom position of containers\n applyScrollEndStyle(vi.rContainer, vi.pContainer);\n },\n [\n isFetching,\n vi.pInfo.bufferNewCords,\n vi.bContainer,\n vi.pContainer,\n vi.rContainer,\n applyScrollEndStyle\n ]\n );\n\n const handleScroll = useCallback(() => {\n const context = getContext();\n // Returning in case the throttle function runs after some delay and by that time the virtualizer has unmounted\n if (!context) return;\n\n const direction = getDirection();\n const distance = direction === 1 ? paginationTriggerRatios.down : paginationTriggerRatios.up;\n const eleIndex = Math.floor(vi.rContainer.childElementCount * distance);\n const boundaryEle = vi.rContainer.childNodes[eleIndex];\n const boundaryElePos = boundaryEle?.getBoundingClientRect();\n const { bottom, top } = context?.getBoundingClientRect() || {};\n if (\n (direction === 1 &&\n boundaryElePos?.bottom < bottom &&\n // eslint-disable-next-line no-unsafe-optional-chaining\n vi.pInfo?.view?.endIndex + 1 < totalRecordCount) ||\n (direction === -1 && boundaryElePos?.top > top && vi.pInfo?.view?.startIndex > 0) ||\n isViewNotFilled(getRecordCountForLayoutPaint(totalRecordCount), vi, context, header)\n ) {\n vi.direction = direction;\n callback();\n }\n }, [\n getDirection,\n paginationTriggerRatios,\n vi,\n getContext,\n isFetching,\n totalRecordCount,\n header,\n callback\n ]);\n\n useThrottle(vScroll, handleScroll);\n\n useEffect(() => {\n const context = getContext();\n if (context) context.addEventListener('scroll', onScroll);\n return () => {\n if (context) context.removeEventListener('scroll', onScroll);\n };\n }, [getContext, onScroll, vi.rContainer, vi.pContainer, applyScrollEndStyle]);\n\n // useEffect for scrollEndStyle hook\n useEffect(() => {\n applyScrollEndStyle(vi.rContainer, vi.pContainer);\n }, [vi.rContainer, vi.pContainer, applyScrollEndStyle, totalRecordCount, viewHeight]);\n // useEffect(() => {\n // if (deBouncedVScroll !== undefined)\n // handleScroll();\n // }, [deBouncedVScroll]);\n\n return [updateScrollTop];\n}\n"]}
|