@pega/lists-react 9.0.0-build.9.9 → 9.0.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 +0 -4
- package/lib/Core/Components/A11y/RepeatingStructureA11y.d.ts.map +1 -1
- package/lib/Core/Components/A11y/RepeatingStructureA11y.js +2 -1
- package/lib/Core/Components/A11y/RepeatingStructureA11y.js.map +1 -1
- package/lib/Core/Components/AggregateMenu.d.ts.map +1 -1
- package/lib/Core/Components/AggregateMenu.js +6 -2
- package/lib/Core/Components/AggregateMenu.js.map +1 -1
- package/lib/Core/Components/AggregatorCell.d.ts.map +1 -1
- package/lib/Core/Components/AggregatorCell.js +3 -1
- package/lib/Core/Components/AggregatorCell.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 +111 -166
- package/lib/Core/Components/ContextMenu/ContextMenuContainer.js.map +1 -1
- package/lib/Core/Components/ContextMenu/QuickFilter.js +1 -1
- 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.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowActionMenu.js +33 -5
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowActionMenu.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowDeleteAction.d.ts +10 -0
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowDeleteAction.d.ts.map +1 -0
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowDeleteAction.js +27 -0
- package/lib/Core/Components/DefaultComponents/CellRenderers/RowDeleteAction.js.map +1 -0
- package/lib/Core/Components/DefaultComponents/CellRenderers/index.d.ts +2 -2
- package/lib/Core/Components/DefaultComponents/CellRenderers/index.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/CellRenderers/index.js +2 -2
- package/lib/Core/Components/DefaultComponents/CellRenderers/index.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/EmptyContainer.d.ts +3 -1
- package/lib/Core/Components/DefaultComponents/EmptyContainer.d.ts.map +1 -1
- package/lib/Core/Components/DefaultComponents/EmptyContainer.js +11 -2
- 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 +20 -19
- package/lib/Core/Components/DefaultComponents/SelectAllCheckbox.js.map +1 -1
- package/lib/Core/Components/DefaultComponents/index.d.ts +4 -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/AdvanceFilter.d.ts.map +1 -1
- package/lib/Core/Components/Filters/AdvanceFilter.js +5 -2
- package/lib/Core/Components/Filters/AdvanceFilter.js.map +1 -1
- package/lib/Core/Components/Filters/SelectFilter.d.ts +1 -1
- package/lib/Core/Components/Filters/SelectFilter.d.ts.map +1 -1
- package/lib/Core/Components/Filters/SelectFilter.js +43 -44
- package/lib/Core/Components/Filters/SelectFilter.js.map +1 -1
- package/lib/Core/Components/Filters/SimpleFilter.js +1 -1
- package/lib/Core/Components/Filters/SimpleFilter.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 +6 -3
- 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/index.d.ts +22 -0
- package/lib/Core/Components/GroupRenderer/index.d.ts.map +1 -0
- package/lib/Core/Components/GroupRenderer/index.js +395 -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 +2 -1
- 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 +3 -3
- package/lib/Core/Components/HeaderCell.js.map +1 -1
- package/lib/Core/Components/HeaderMenu/actions.d.ts +1 -1
- package/lib/Core/Components/HeaderMenu/actions.d.ts.map +1 -1
- package/lib/Core/Components/HeaderMenu/actions.js +3 -4
- 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 +5 -5
- package/lib/Core/Components/HeaderMenu/index.js.map +1 -1
- package/lib/Core/Components/HierarchicalGroupRenderer.d.ts.map +1 -1
- package/lib/Core/Components/HierarchicalGroupRenderer.js +6 -2
- package/lib/Core/Components/HierarchicalGroupRenderer.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/RFColumnConfigurator.d.ts.map +1 -1
- package/lib/Core/Components/RFColumnConfigurator.js +32 -9
- package/lib/Core/Components/RFColumnConfigurator.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/RSWrapper/index.d.ts.map +1 -1
- package/lib/Core/Components/RSWrapper/index.js +2 -9
- package/lib/Core/Components/RSWrapper/index.js.map +1 -1
- package/lib/Core/Components/RenderingEngine/Formatter.d.ts.map +1 -1
- package/lib/Core/Components/RenderingEngine/Formatter.js +4 -1
- package/lib/Core/Components/RenderingEngine/Formatter.js.map +1 -1
- package/lib/Core/Components/RenderingEngine/RenderCell.d.ts.map +1 -1
- package/lib/Core/Components/RenderingEngine/RenderCell.js +19 -8
- package/lib/Core/Components/RenderingEngine/RenderCell.js.map +1 -1
- package/lib/Core/Components/RenderingEngine/useHighlighter.d.ts.map +1 -1
- package/lib/Core/Components/RenderingEngine/useHighlighter.js +0 -1
- package/lib/Core/Components/RenderingEngine/useHighlighter.js.map +1 -1
- package/lib/Core/Components/TestIdConstants.d.ts +2 -0
- package/lib/Core/Components/TestIdConstants.js +3 -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 +7 -18
- package/lib/Core/Components/Toolbar/AdvanceToolbar.js.map +1 -1
- package/lib/Core/Components/Toolbar/ColumnSelector.d.ts +6 -4
- package/lib/Core/Components/Toolbar/ColumnSelector.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/ColumnSelector.js +18 -21
- 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 +2 -1
- package/lib/Core/Components/Toolbar/FieldSelector.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/FieldSelector.js +14 -7
- 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/RefreshBanner.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/RefreshBanner.js +1 -0
- package/lib/Core/Components/Toolbar/RefreshBanner.js.map +1 -1
- package/lib/Core/Components/Toolbar/SimpleToolbar.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/SimpleToolbar.js +2 -4
- package/lib/Core/Components/Toolbar/SimpleToolbar.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useFilter.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useFilter.js +4 -1
- package/lib/Core/Components/Toolbar/hooks/useFilter.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 +4 -2
- package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useGroup/GroupRenderer.js +30 -22
- 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 +17 -6
- 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 +12 -5
- 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 +134 -80
- 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 +7 -10
- package/lib/Core/Components/Toolbar/hooks/useSearch.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/Row.d.ts +8 -6
- package/lib/Core/Components/Toolbar/hooks/useSort/Row.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/Row.js +16 -10
- package/lib/Core/Components/Toolbar/hooks/useSort/Row.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.d.ts +4 -2
- package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/SortRenderer.js +9 -3
- 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 +8 -2
- package/lib/Core/Components/Toolbar/hooks/useSort/useSort.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/utils.d.ts +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/utils.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useSort/utils.js +2 -2
- package/lib/Core/Components/Toolbar/hooks/useSort/utils.js.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useWrapAction.d.ts +2 -1
- package/lib/Core/Components/Toolbar/hooks/useWrapAction.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/hooks/useWrapAction.js +36 -12
- package/lib/Core/Components/Toolbar/hooks/useWrapAction.js.map +1 -1
- package/lib/Core/Components/Toolbar/utils/utils.d.ts +28 -7
- package/lib/Core/Components/Toolbar/utils/utils.d.ts.map +1 -1
- package/lib/Core/Components/Toolbar/utils/utils.js +43 -11
- 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.js +1 -1
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/VariableHeightVirtualizer.js.map +1 -1
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.d.ts +1 -1
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.js +1 -1
- package/lib/Core/Components/Virtualise/VariableHeightVirtualizer/utils.js.map +1 -1
- package/lib/Core/Components/Virtualise/VirtualizeInfinite.js +14 -4
- package/lib/Core/Components/Virtualise/VirtualizeInfinite.js.map +1 -1
- package/lib/Core/Components/Virtualise/index.js +19 -4
- package/lib/Core/Components/Virtualise/index.js.map +1 -1
- package/lib/Core/Components/Virtualise/utility.js +1 -1
- package/lib/Core/Components/Virtualise/utility.js.map +1 -1
- package/lib/Core/Components/WarningBanner.d.ts +11 -0
- package/lib/Core/Components/WarningBanner.d.ts.map +1 -0
- package/lib/Core/Components/WarningBanner.js +23 -0
- package/lib/Core/Components/WarningBanner.js.map +1 -0
- 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 +3 -4
- package/lib/Core/Hooks/a11y/useAnnounce.d.ts.map +1 -1
- package/lib/Core/Hooks/a11y/useAnnounce.js +3 -4
- package/lib/Core/Hooks/a11y/useAnnounce.js.map +1 -1
- package/lib/Core/Hooks/useDebounce.js +1 -1
- package/lib/Core/Hooks/useDebounce.js.map +1 -1
- package/lib/Core/Hooks/useDragDrop.d.ts +2 -2
- package/lib/Core/Hooks/useDragDrop.d.ts.map +1 -1
- package/lib/Core/Hooks/useDragDrop.js +9 -9
- package/lib/Core/Hooks/useDragDrop.js.map +1 -1
- package/lib/Core/Hooks/useRepeat.d.ts +1 -1
- package/lib/Core/Hooks/useRepeat.d.ts.map +1 -1
- package/lib/Core/Hooks/useRepeat.js +58 -11
- package/lib/Core/Hooks/useRepeat.js.map +1 -1
- package/lib/Core/Hooks/useSelectAllCheckbox.d.ts +21 -0
- package/lib/Core/Hooks/useSelectAllCheckbox.d.ts.map +1 -0
- package/lib/Core/Hooks/useSelectAllCheckbox.js +23 -0
- package/lib/Core/Hooks/useSelectAllCheckbox.js.map +1 -0
- package/lib/Core/Localization/defaultTranslations.d.ts +15 -13
- package/lib/Core/Localization/defaultTranslations.d.ts.map +1 -1
- package/lib/Core/Localization/defaultTranslations.js +16 -14
- package/lib/Core/Localization/defaultTranslations.js.map +1 -1
- package/lib/Core/Test/JUnitMocks.d.ts +12 -0
- package/lib/Core/Test/JUnitMocks.d.ts.map +1 -1
- package/lib/Core/Test/JUnitMocks.js +27 -8
- package/lib/Core/Test/JUnitMocks.js.map +1 -1
- package/lib/Core/Test/TestUtils.d.ts +0 -1
- package/lib/Core/Test/TestUtils.d.ts.map +1 -1
- package/lib/Core/Test/TestUtils.js +3 -7
- package/lib/Core/Test/TestUtils.js.map +1 -1
- package/lib/Core/Utils/index.d.ts +15 -0
- package/lib/Core/Utils/index.d.ts.map +1 -1
- package/lib/Core/Utils/index.js +22 -0
- 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 +29 -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/GalleryA11y.d.ts +7 -5
- package/lib/Core/Views/Gallery/GalleryA11y.d.ts.map +1 -1
- package/lib/Core/Views/Gallery/GalleryA11y.js +9 -52
- package/lib/Core/Views/Gallery/GalleryA11y.js.map +1 -1
- package/lib/Core/Views/Gallery/GalleryContainer.d.ts +23 -0
- package/lib/Core/Views/Gallery/GalleryContainer.d.ts.map +1 -0
- package/lib/Core/Views/Gallery/GalleryContainer.js +66 -0
- package/lib/Core/Views/Gallery/GalleryContainer.js.map +1 -0
- 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 +38 -59
- 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 +115 -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 +2 -2
- package/lib/Core/Views/Map/index.js.map +1 -1
- package/lib/Core/Views/RsCardWrapper.js.map +1 -1
- package/lib/Core/Views/Table/Body.d.ts.map +1 -1
- package/lib/Core/Views/Table/Body.js +5 -2
- package/lib/Core/Views/Table/Body.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/GroupingHeaderCell.d.ts +6 -15
- package/lib/Core/Views/Table/GroupingHeaderCell.d.ts.map +1 -1
- package/lib/Core/Views/Table/GroupingHeaderCell.js +16 -14
- package/lib/Core/Views/Table/GroupingHeaderCell.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/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 +270 -155
- package/lib/Core/Views/Table/StyledTableContainer.js.map +1 -1
- package/lib/Core/Views/Table/TableA11y.d.ts +13 -1
- package/lib/Core/Views/Table/TableA11y.d.ts.map +1 -1
- package/lib/Core/Views/Table/TableA11y.js +233 -13
- package/lib/Core/Views/Table/TableA11y.js.map +1 -1
- package/lib/Core/Views/Table/VirtualizeWrapper.d.ts +3 -1
- package/lib/Core/Views/Table/VirtualizeWrapper.d.ts.map +1 -1
- package/lib/Core/Views/Table/VirtualizeWrapper.js +16 -16
- 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 +16 -7
- package/lib/Core/Views/Table/index.js.map +1 -1
- package/lib/Core/Views/Timeline/Timeline.d.ts.map +1 -1
- package/lib/Core/Views/Timeline/Timeline.js +15 -20
- package/lib/Core/Views/Timeline/Timeline.js.map +1 -1
- package/lib/Core/Views/Timeline/Timeline.styles.d.ts +392 -15
- package/lib/Core/Views/Timeline/Timeline.styles.d.ts.map +1 -1
- package/lib/Core/Views/Timeline/Timeline.styles.js +44 -44
- package/lib/Core/Views/Timeline/Timeline.styles.js.map +1 -1
- package/lib/Core/Views/Timeline/Timeline.types.d.ts +11 -7
- package/lib/Core/Views/Timeline/Timeline.types.d.ts.map +1 -1
- package/lib/Core/Views/Timeline/Timeline.types.js.map +1 -1
- package/lib/Core/Views/Timeline/TimelineGroup.d.ts +13 -0
- package/lib/Core/Views/Timeline/TimelineGroup.d.ts.map +1 -0
- package/lib/Core/Views/Timeline/TimelineGroup.js +21 -0
- package/lib/Core/Views/Timeline/TimelineGroup.js.map +1 -0
- package/lib/Core/Views/Timeline/TimelineItem.d.ts +1 -3
- package/lib/Core/Views/Timeline/TimelineItem.d.ts.map +1 -1
- package/lib/Core/Views/Timeline/TimelineItem.js +7 -6
- package/lib/Core/Views/Timeline/TimelineItem.js.map +1 -1
- package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.d.ts +2 -2
- package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.d.ts.map +1 -1
- package/lib/Core/Views/Timeline/__tests__/Timeline.mocks.js.map +1 -1
- package/lib/Core/Views/Timeline/index.d.ts.map +1 -1
- package/lib/Core/Views/Timeline/index.js +13 -6
- package/lib/Core/Views/Timeline/index.js.map +1 -1
- package/lib/Core/Views/Timeline/utils.d.ts +8 -10
- package/lib/Core/Views/Timeline/utils.d.ts.map +1 -1
- package/lib/Core/Views/Timeline/utils.js +136 -58
- package/lib/Core/Views/Timeline/utils.js.map +1 -1
- package/lib/Core/Views/rs-styles.d.ts +1 -1
- package/lib/Core/a11y/loadingAnnouncementBehavior.d.ts +12 -0
- package/lib/Core/a11y/loadingAnnouncementBehavior.d.ts.map +1 -0
- package/lib/Core/a11y/loadingAnnouncementBehavior.js +37 -0
- package/lib/Core/a11y/loadingAnnouncementBehavior.js.map +1 -0
- 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/index.d.ts.map +1 -1
- package/lib/Core/index.js +1 -2
- package/lib/Core/index.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 +31 -0
- package/lib/Core/templateFeatureSupport.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types/RepeatingStructuresBoot.types.d.ts +12 -8
- package/lib/types/RepeatingStructuresBoot.types.d.ts.map +1 -1
- package/lib/types/RepeatingStructuresBoot.types.js.map +1 -1
- 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 -13
- 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 -36
- 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 -50
- 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 -64
- package/lib/Core/Components/DefaultComponents/CellRenderers/EditComponents/index.js.map +0 -1
- package/lib/Core/Components/GroupRenderer.d.ts +0 -31
- package/lib/Core/Components/GroupRenderer.d.ts.map +0 -1
- package/lib/Core/Components/GroupRenderer.js +0 -348
- package/lib/Core/Components/GroupRenderer.js.map +0 -1
- package/lib/Core/Components/RSWrapper/__mocks__/uuid.d.ts +0 -2
- package/lib/Core/Components/RSWrapper/__mocks__/uuid.d.ts.map +0 -1
- package/lib/Core/Components/RSWrapper/__mocks__/uuid.js +0 -4
- package/lib/Core/Components/RSWrapper/__mocks__/uuid.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 -7
- package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.d.ts.map +0 -1
- package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.js +0 -109
- package/lib/Core/Components/Toolbar/Timeline/TimelineToolbar.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/Gallery/StyledGalleryContainer.d.ts +0 -3
- package/lib/Core/Views/Gallery/StyledGalleryContainer.d.ts.map +0 -1
- package/lib/Core/Views/Gallery/StyledGalleryContainer.js +0 -51
- package/lib/Core/Views/Gallery/StyledGalleryContainer.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
package/README.md
CHANGED
|
@@ -146,7 +146,6 @@ fieldDefs
|
|
|
146
146
|
| ----------------------- | ---------------------- | :-------: | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
147
147
|
| toolBarOptions | `Array<Array<Object>>` | No | `[]` | This property extends options provided in toolbar. Object structure: `{ id: <string(required)>, icon: <optional>, label: <required>, show: <bool(optional)> , onClick: <Func(optional)> }` |
|
|
148
148
|
| onViewReady | Function | No | `null` | This function acts as a callback that is invoked when the view is ready |
|
|
149
|
-
| onRowClickAction | Function | No | `null` | This function is invoked when an item/entry is clicked. The corresponding item data is passed into the function on invocation |
|
|
150
149
|
| showExportToExcelOption | Boolean | No | `false` | This option is shown in the toolbar menu when the ListView is sourced from queryable DataPage |
|
|
151
150
|
| additionalInfo | Object | No | `undefined | AdditionalInfo displayed on the toolbar is passed as is to List Toolbar component |
|
|
152
151
|
|
|
@@ -203,9 +202,6 @@ APIs exposed on the component ref are accessible via `compRef.current.<API_NAME>
|
|
|
203
202
|
|
|
204
203
|
- The first focus will be on the table's first header cell if earlier no navigation has been done.
|
|
205
204
|
- To navigate between the cells, use the arrow keys.
|
|
206
|
-
- Pressing enter on the cell can turn the cell in edit mode if it is editable.
|
|
207
|
-
- Pressing enter again will submit the data
|
|
208
|
-
- Pressing escape will discard the changes and turn the cell back to read mode.
|
|
209
205
|
- To focus out from the table cells, press the tab key and focus will be shifted to the next focusable element on the page after table.
|
|
210
206
|
- Next time when navigated again to the table, the last visited cell will be focused.
|
|
211
207
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeatingStructureA11y.d.ts","sourceRoot":"","sources":["../../../../Core/Components/A11y/RepeatingStructureA11y.jsx"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AACH,qEALW,MAAM,GAGJ,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"RepeatingStructureA11y.d.ts","sourceRoot":"","sources":["../../../../Core/Components/A11y/RepeatingStructureA11y.jsx"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AACH,qEALW,MAAM,GAGJ,GAAG,CAAC,OAAO,CAiDvB;;;;;;;;;;;;;;;;;sBAvEqB,YAAY"}
|
|
@@ -27,9 +27,10 @@ export default function RepeatingStructureA11y({ children, a11yRef, view }) {
|
|
|
27
27
|
a11yRef.current.boundaryElementsFocusHandler(e);
|
|
28
28
|
}, [a11yRef]);
|
|
29
29
|
const { state } = view;
|
|
30
|
+
const visibleColumns = view.getVisibleColumnIds();
|
|
30
31
|
// For show/hide columns, we only use the 'modified' message because there is always at least one column present.
|
|
31
32
|
// Any change—whether adding or removing a column is considered a modification for accessibility announcement.
|
|
32
|
-
useAnnounce(
|
|
33
|
+
useAnnounce(visibleColumns, {
|
|
33
34
|
modified: translate('Show/Hide modified')
|
|
34
35
|
}, state.personalization?.active);
|
|
35
36
|
useAnnounce(state.freezeColumns, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeatingStructureA11y.js","sourceRoot":"","sources":["../../../../Core/Components/A11y/RepeatingStructureA11y.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,WAAW,MAAM,8BAA8B,CAAC;AACvD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAEpD,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;;;CAO/B,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE;IACxE,MAAM,CAAC,SAAS,CAAC,GAAG,YAAY,EAAE,CAAC;IACnC,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,CAAC,EAAE;QACF,OAAO,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IACF,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,iHAAiH;IACjH,8GAA8G;IAC9G,WAAW,CACT,
|
|
1
|
+
{"version":3,"file":"RepeatingStructureA11y.js","sourceRoot":"","sources":["../../../../Core/Components/A11y/RepeatingSt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AAC;QACrC,OAAO,EAAE,SAAS,CAAC,eAAe,CAAC;KACpC,EACD,KAAK,CAAC,eAAe,EAAE,MAAM,CAC9B,CAAC;IAEF,OAAO,CACL,8BACE,KAAC,WAAW,IAAC,SAAS,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,uBAAa,OAAO,EAAE,cAAc,GAAI,EAC/E,QAAQ,EACT,KAAC,WAAW,IAAC,SAAS,EAAC,QAAQ,EAAC,IAAI,EAAC,MAAM,uBAAa,OAAO,EAAE,cAAc,GAAI,IAClF,CACJ,CAAC;AACJ,CAAC;AAED,sBAAsB,CAAC,SAAS,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IAClE,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,UAAU;IAC1D,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU;CACnD,CAAC;AAEF,sBAAsB,CAAC,YAAY,GAAG;IACpC,QAAQ,EAAE,EAAE;CACb,CAAC","sourcesContent":["import { useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from 'styled-components';\n\nimport useAnnounce from '../../Hooks/a11y/useAnnounce';\nimport useTranslate from '../../Hooks/useTranslate';\n\nconst StyledInput = styled.input`\n width: 0;\n height: 0;\n border-width: 0;\n position: absolute;\n outline: none;\n opacity: 0;\n`;\n\n/**\n * Provides accessibility features for repeating structures, including focus boundary handling\n * and announcing changes in the view's state for accessibility purposes.\n *\n * @param {Object} props.a11yRef - A reference object containing accessibility-related handlers.\n * @param {Object} props.view - The view object containing the current state of the repeating structure.\n *\n * @returns {JSX.Element} The rendered structure with accessibility features.\n */\nexport default function RepeatingStructureA11y({ children, a11yRef, view }) {\n const [translate] = useTranslate();\n const onFocusHandler = useCallback(\n e => {\n a11yRef.current.boundaryElementsFocusHandler(e);\n },\n [a11yRef]\n );\n const { state } = view;\n const visibleColumns = view.getVisibleColumnIds();\n // For show/hide columns, we only use the 'modified' message because there is always at least one column present.\n // Any change—whether adding or removing a column is considered a modification for accessibility announcement.\n useAnnounce(\n visibleColumns,\n {\n modified: translate('Show/Hide modified')\n },\n state.personalization?.active\n );\n\n useAnnounce(\n state.freezeColumns,\n {\n added: translate('Freeze applied'),\n modified: translate('Freeze modified'),\n removed: translate('Freeze removed')\n },\n state.personalization?.active\n );\n\n useAnnounce(\n state.groups,\n {\n added: translate('Group applied'),\n modified: translate('Group modified'),\n removed: translate('Group removed')\n },\n state.personalization?.active\n );\n\n return (\n <>\n <StyledInput className='top' type='text' aria-hidden onFocus={onFocusHandler} />\n {children}\n <StyledInput className='bottom' type='text' aria-hidden onFocus={onFocusHandler} />\n </>\n );\n}\n\nRepeatingStructureA11y.propTypes = {\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n a11yRef: PropTypes.objectOf(PropTypes.objectOf).isRequired,\n view: PropTypes.objectOf(PropTypes.any).isRequired\n};\n\nRepeatingStructureA11y.defaultProps = {\n children: []\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AggregateMenu.d.ts","sourceRoot":"","sources":["../../../Core/Components/AggregateMenu.jsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AggregateMenu.d.ts","sourceRoot":"","sources":["../../../Core/Components/AggregateMenu.jsx"],"names":[],"mappings":"AAqEA;;;mDA2DC;;;;;;;;;;;;;;;;;;AA9EM,kEALI,MAAM,GAAC,MAAM,mBACb,MAAM,UACN,OAAO,gCAAgC,EAAE,WAAW,CAAC,MAAM,GACzD,MAAM,GAAC,MAAM,CAmBzB;sBAlEqB,YAAY"}
|
|
@@ -12,6 +12,9 @@ const StyledMenuButton = styled(MenuButton) `
|
|
|
12
12
|
}
|
|
13
13
|
`;
|
|
14
14
|
const StyledCell = styled.div `
|
|
15
|
+
&:not(:has(${StyledMenuButton})) {
|
|
16
|
+
gap: 0.25rem;
|
|
17
|
+
}
|
|
15
18
|
display: flex;
|
|
16
19
|
text-align: right;
|
|
17
20
|
justify-content: flex-end;
|
|
@@ -54,6 +57,7 @@ export default function AggregateMenu({ column, context }) {
|
|
|
54
57
|
const { aggregationType } = column;
|
|
55
58
|
const uid = createUID();
|
|
56
59
|
const [translate] = useTranslate();
|
|
60
|
+
const isFooterAggregate = context.getExecutionContext?.()?.name === 'footer';
|
|
57
61
|
const actions = aggregateOptions[column.field.type]?.map(label => ({
|
|
58
62
|
primary: translate(label),
|
|
59
63
|
id: label,
|
|
@@ -65,12 +69,12 @@ export default function AggregateMenu({ column, context }) {
|
|
|
65
69
|
const rawAggregationValue = context.getValue();
|
|
66
70
|
const aggregationValue = getFormattedAggregationValue(rawAggregationValue, aggregationType, column);
|
|
67
71
|
const buttonText = translate('Aggregate options');
|
|
68
|
-
return (_jsxs(StyledCell, { children: [_jsx("span", { children: translate(aggregationType) }), _jsx(StyledMenuButton, { className: 'aggregate-button', menu: {
|
|
72
|
+
return (_jsxs(StyledCell, { children: [_jsx("span", { children: translate(aggregationType) }), isFooterAggregate && (_jsx(StyledMenuButton, { className: 'aggregate-button', menu: {
|
|
69
73
|
items: actions,
|
|
70
74
|
mode: 'single-select'
|
|
71
75
|
}, popover: {
|
|
72
76
|
portal: true
|
|
73
|
-
}, icon: 'arrow-micro-down', iconOnly: true, variant: 'simple', compact: true, text: buttonText, "aria-labelledby": `${uid}_label` }), _jsx(Flex, { container: true, as: StyledAggregationValue, item: { shrink: 0 }, "data-testid": TestIdConstants.aggregateDisplayValue, children: aggregationValue }), _jsx(VisuallyHiddenText, { id: `${uid}_label`, "aria-hidden": true, children: `${translate(aggregationType)} ${context.getValue()} ${buttonText}` })] }));
|
|
77
|
+
}, icon: 'arrow-micro-down', iconOnly: true, variant: 'simple', compact: true, text: buttonText, "aria-labelledby": `${uid}_label` })), _jsx(Flex, { container: true, as: StyledAggregationValue, item: { shrink: 0 }, "data-testid": TestIdConstants.aggregateDisplayValue, children: aggregationValue }), _jsx(VisuallyHiddenText, { id: `${uid}_label`, "aria-hidden": true, children: `${translate(aggregationType)} ${context.getValue()} ${buttonText}` })] }));
|
|
74
78
|
}
|
|
75
79
|
AggregateMenu.propTypes = {
|
|
76
80
|
column: PropTypes.objectOf(PropTypes.any),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AggregateMenu.js","sourceRoot":"","sources":["../../../Core/Components/AggregateMenu.jsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,YAAY,MAAM,uBAAuB,CAAC;AAEjD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;WAChC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC;;;;;CAK/D,CAAC;AAEF,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"AggregateMenu.js","sourceRoot":"","sources":["../../../Core/Components/AggregateMenu.jsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,YAAY,MAAM,uBAAuB,CAAC;AAEjD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;WAChC,KAAK,CAAC,EAAE,CAAC,KAA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ACH,SAAS,QACT,EAAE,EAAE,sBAAsB,EAC1B,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,iBACN,eAAe,CAAC,qBAAqB,YAEjD,gBAAgB,GACZ,EACP,KAAC,kBAAkB,IAAC,EAAE,EAAE,GAAG,GAAG,QAAQ,iCACnC,GAAG,SAAS,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,IAAI,UAAU,EAAE,GACjD,IACV,CACd,CAAC;AACJ,CAAC;AAED,aAAa,CAAC,SAAS,GAAG;IACxB,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;IACzC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;CAC3C,CAAC;AAEF,aAAa,CAAC,YAAY,GAAG;IAC3B,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,EAAE;CACZ,CAAC","sourcesContent":["import styled from 'styled-components';\nimport PropTypes from 'prop-types';\n\nimport {\n Flex,\n MenuButton,\n VisuallyHiddenText,\n createUID,\n formatNumber\n} from '@pega/cosmos-react-core';\n\nimport useTranslate from '../Hooks/useTranslate';\n\nimport TestIdConstants from './TestIdConstants';\n\nconst StyledMenuButton = styled(MenuButton)`\n color: ${props => props.theme.base.palette['foreground-color']};\n svg {\n width: 1.5rem;\n height: 1.5rem;\n }\n`;\n\nconst StyledCell = styled.div`\n &:not(:has(${StyledMenuButton})) {\n gap: 0.25rem;\n }\n display: flex;\n text-align: right;\n justify-content: flex-end;\n align-items: center;\n margin-inline-end: var(--cell-padding);\n\n &:hover {\n background-clip: padding-box;\n }\n`;\n\nconst StyledAggregationValue = styled.div`\n font-weight: ${props => props.theme.base['font-weight']['semi-bold']};\n`;\n\n/**\n * Formats the aggregation value based on the aggregation type and column context.\n *\n * @param {number|string} rawAggregationValue - The raw aggregation value to format.\n * @param {string} aggregationType - The type of aggregation (e.g., 'Avg').\n * @param {import('pega-repeating-structures-core').RsCoreTypes.Column} column - The column object.\n * @returns {string|number} The formatted aggregation value or the raw value if no formatter is available.\n */\nexport const getFormattedAggregationValue = (rawAggregationValue, aggregationType, column) => {\n const formatter = column.getContext().getFormatter();\n const fieldDef = column.getContext().getField();\n const { fieldType } = fieldDef;\n const { locale, timezone } = column.parent.meta;\n\n if (!formatter) return rawAggregationValue;\n\n if (aggregationType === 'Avg' && fieldType === 'Integer') {\n return formatNumber(Number(rawAggregationValue), {\n locale,\n useGrouping: true,\n maximumFractionDigits: 2\n });\n }\n\n return formatter(rawAggregationValue, { locale, timezone, fieldDef });\n};\n\nexport default function AggregateMenu({ column, context }) {\n const { aggregateOptions } = column.parent.meta;\n const { aggregationType } = column;\n const uid = createUID();\n const [translate] = useTranslate();\n const isFooterAggregate = context.getExecutionContext?.()?.name === 'footer';\n\n const actions = aggregateOptions[column.field.type]?.map(label => ({\n primary: translate(label),\n id: label,\n onClick: () => column.applyAggregation(label),\n selected: aggregationType === label\n }));\n if (!actions) return null;\n\n const rawAggregationValue = context.getValue();\n\n const aggregationValue = getFormattedAggregationValue(\n rawAggregationValue,\n aggregationType,\n column\n );\n\n const buttonText = translate('Aggregate options');\n\n return (\n <StyledCell>\n <span>{translate(aggregationType)}</span>\n {isFooterAggregate && (\n <StyledMenuButton\n className='aggregate-button'\n menu={{\n items: actions,\n mode: 'single-select'\n }}\n popover={{\n portal: true\n }}\n icon='arrow-micro-down'\n iconOnly\n variant='simple'\n compact\n text={buttonText} // Text property to display tooltip on hover\n aria-labelledby={`${uid}_label`}\n />\n )}\n <Flex\n container\n as={StyledAggregationValue}\n item={{ shrink: 0 }}\n data-testid={TestIdConstants.aggregateDisplayValue}\n >\n {aggregationValue}\n </Flex>\n <VisuallyHiddenText id={`${uid}_label`} aria-hidden>\n {`${translate(aggregationType)} ${context.getValue()} ${buttonText}`}\n </VisuallyHiddenText>\n </StyledCell>\n );\n}\n\nAggregateMenu.propTypes = {\n column: PropTypes.objectOf(PropTypes.any),\n context: PropTypes.objectOf(PropTypes.any)\n};\n\nAggregateMenu.defaultProps = {\n column: {},\n context: {}\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AggregatorCell.d.ts","sourceRoot":"","sources":["../../../Core/Components/AggregatorCell.jsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AggregatorCell.d.ts","sourceRoot":"","sources":["../../../Core/Components/AggregatorCell.jsx"],"names":[],"mappings":"AASA;;;mDAgCC;;;;;;;;;;;;sBAxCqB,YAAY"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import { useI18n, VisuallyHiddenText } from '@pega/cosmos-react-core';
|
|
4
5
|
import { createClassName as cx } from '../Utils';
|
|
5
6
|
import AggregateActionMenu from './AggregateMenu';
|
|
6
7
|
export default function AggregatorCell({ column, context }) {
|
|
8
|
+
const t = useI18n();
|
|
7
9
|
if (column.hidden)
|
|
8
10
|
return null;
|
|
9
11
|
const { field: { id, idHash } } = column;
|
|
@@ -16,7 +18,7 @@ export default function AggregatorCell({ column, context }) {
|
|
|
16
18
|
left: `var(--col-left-${idHash})`,
|
|
17
19
|
order: `var(--col-order-${idHash})`,
|
|
18
20
|
width: `var(--col-width-${idHash})`
|
|
19
|
-
}, "data-test-id": id, "data-testid": id, children: column.aggregated
|
|
21
|
+
}, "data-test-id": id, "data-testid": id, children: column.aggregated ? (_jsx(Fragment, { children: _jsx(AggregateActionMenu, { column: column, context: context }) }, id)) : (_jsx(VisuallyHiddenText, { children: t('no_value') })) }));
|
|
20
22
|
}
|
|
21
23
|
AggregatorCell.propTypes = {
|
|
22
24
|
column: PropTypes.objectOf(PropTypes.any),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AggregatorCell.js","sourceRoot":"","sources":["../../../Core/Components/AggregatorCell.jsx"],"names":[],"mappings":";AAA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AAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE;IACxD,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAC/B,MAAM,EACJ,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EACtB,GAAG,MAAM,CAAC;IACX,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACzD,OAAO,CACL,iBACM,UAAU,EACd,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE,GAAG,SAAS,EAAE;YAChD,YAAY,EAAE,MAAM,CAAC,MAAM;YAC3B,aAAa,EAAE,MAAM,CAAC,UAAU;YAChC,WAAW,EAAE,MAAM,CAAC,YAAY;SACjC,CAAC,EACF,KAAK,EAAE;YACL,IAAI,EAAE,kBAAkB,MAAM,GAAG;YACjC,KAAK,EAAE,mBAAmB,MAAM,GAAG;YACnC,KAAK,EAAE,mBAAmB,MAAM,GAAG;SACpC,kBACa,EAAE,iBACH,EAAE,YAEd,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CACnB,KAAC,QAAQ,cACP,KAAC,mBAAmB,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAI,IAD5C,EAAE,CAEN,CACZ,CAAC,CAAC,CAAC,CACF,KAAC,kBAAkB,cAAE,CAAC,CAAC,UAAU,CAAC,GAAsB,CACzD,GACG,CACP,CAAC;AACJ,CAAC;AAED,cAAc,CAAC,SAAS,GAAG;IACzB,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;IACzC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;CAC3C,CAAC","sourcesContent":["import { Fragment } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { useI18n, VisuallyHiddenText } from '@pega/cosmos-react-core';\n\nimport { createClassName as cx } from '../Utils';\n\nimport AggregateActionMenu from './AggregateMenu';\n\nexport default function AggregatorCell({ column, context }) {\n const t = useI18n();\n if (column.hidden) return null;\n const {\n field: { id, idHash }\n } = column;\n const { classList, ...otherProps } = column.getUIProps();\n return (\n <div\n {...otherProps}\n className={cx('aggregateCell cell', ...classList, {\n 'cell-fixed': column.frozen,\n 'align-right': column.aggregated,\n 'cell-last': column.isLastColumn\n })}\n style={{\n left: `var(--col-left-${idHash})`,\n order: `var(--col-order-${idHash})`,\n width: `var(--col-width-${idHash})`\n }}\n data-test-id={id}\n data-testid={id}\n >\n {column.aggregated ? (\n <Fragment key={id}>\n <AggregateActionMenu column={column} context={context} />\n </Fragment>\n ) : (\n <VisuallyHiddenText>{t('no_value')}</VisuallyHiddenText>\n )}\n </div>\n );\n}\n\nAggregatorCell.propTypes = {\n column: PropTypes.objectOf(PropTypes.any),\n context: PropTypes.objectOf(PropTypes.any)\n};\n"]}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { RsCoreTypes } from 'pega-repeating-structures-core';
|
|
2
|
+
export default function ContextMenuContainer({ view, selector }: {
|
|
3
|
+
view: RsCoreTypes.View;
|
|
4
|
+
selector: {
|
|
5
|
+
query: string;
|
|
6
|
+
};
|
|
4
7
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
-
declare namespace ContextMenuContainer {
|
|
6
|
-
namespace propTypes {
|
|
7
|
-
let view: PropTypes.Validator<{
|
|
8
|
-
[x: string]: any;
|
|
9
|
-
}>;
|
|
10
|
-
let selector: PropTypes.Validator<{
|
|
11
|
-
[x: string]: any;
|
|
12
|
-
}>;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export default ContextMenuContainer;
|
|
16
|
-
import PropTypes from 'prop-types';
|
|
17
8
|
//# sourceMappingURL=ContextMenuContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuContainer.d.ts","sourceRoot":"","sources":["../../../../Core/Components/ContextMenu/ContextMenuContainer.
|
|
1
|
+
{"version":3,"file":"ContextMenuContainer.d.ts","sourceRoot":"","sources":["../../../../Core/Components/ContextMenu/ContextMenuContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AA0FlE,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,IAAI,EACJ,QAAQ,EACT,EAAE;IACD,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;IACvB,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7B,kDAuIA"}
|
|
@@ -1,136 +1,54 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import styled, { css } from 'styled-components';
|
|
5
|
-
import { mix } from 'polished';
|
|
6
|
-
import { Popover, Icon, useElement, useOuterEvent, tryCatch } from '@pega/cosmos-react-core';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useMemo, useEffect, useCallback } from 'react';
|
|
3
|
+
import { Popover, Icon, useElement, useOuterEvent, Menu, isInstance } from '@pega/cosmos-react-core';
|
|
7
4
|
import { getRowContextData, getScrollerElem, isFilterApplied } from 'pega-repeating-structures-core';
|
|
8
|
-
import { createClassName as cx } from '../../Utils';
|
|
9
5
|
import useTranslate from '../../Hooks/useTranslate';
|
|
10
6
|
import useScrollAway from '../../Hooks/useScrollAway';
|
|
7
|
+
import TestIdConstants from '../TestIdConstants';
|
|
11
8
|
import { applyFilter, quickFilterEnabled, removeFilter } from './QuickFilter';
|
|
12
9
|
import copyText from './CopyPaste';
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
white-space: nowrap;
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
text-overflow: ellipsis;
|
|
22
|
-
padding: 0.25rem;
|
|
23
|
-
border-radius: 0.156rem;
|
|
24
|
-
box-sizing: border-box;
|
|
25
|
-
cursor: pointer;
|
|
26
|
-
margin-top: 0.125rem;
|
|
27
|
-
margin-bottom: 0.125rem;
|
|
28
|
-
:hover {
|
|
29
|
-
background-color: ${hoverColor};
|
|
30
|
-
box-shadow: ${theme.base.shadow['focus-inset']};
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
});
|
|
34
|
-
const StyledListItem = styled.div(({ theme }) => {
|
|
35
|
-
return css `
|
|
36
|
-
button {
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
/* stylelint-disable unit-allowed-list */
|
|
40
|
-
padding: 4px 8px;
|
|
41
|
-
}
|
|
42
|
-
.label {
|
|
43
|
-
padding-left: 14px;
|
|
44
|
-
vertical-align: text-top;
|
|
45
|
-
}
|
|
46
|
-
.disabled {
|
|
47
|
-
padding-left: 14px;
|
|
48
|
-
vertical-align: text-top;
|
|
49
|
-
opacity: ${theme.base['disabled-opacity']};
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
});
|
|
53
|
-
const StyledButton = styled.button `
|
|
54
|
-
display: block;
|
|
55
|
-
text-align: start;
|
|
56
|
-
background: none;
|
|
57
|
-
border: none;
|
|
58
|
-
line-height: 1;
|
|
59
|
-
outline: none;
|
|
60
|
-
cursor: pointer;
|
|
61
|
-
color: ${props => props.theme.base.palette['foreground-color']};
|
|
62
|
-
border-radius: 0;
|
|
63
|
-
`;
|
|
64
|
-
const getDefaultMenuItems = (column, rowContextData, targetCell, columns, filterExpression, actionColumnFiltering, actionClearFiltering, translate) => {
|
|
65
|
-
const isFiltered = isFilterApplied(column, filterExpression);
|
|
66
|
-
return [
|
|
67
|
-
{
|
|
10
|
+
const getMenuItems = (targetCell, column, rowContextData, view, translate) => {
|
|
11
|
+
const { columns = [], state: { filterExpression } = {}, type: { applyFilter: applyViewFilter, clearFilter } } = view;
|
|
12
|
+
const defaultMenuItems = [];
|
|
13
|
+
if (quickFilterEnabled(columns, column.field.id)) {
|
|
14
|
+
const isFiltered = filterExpression && isFilterApplied(column, filterExpression);
|
|
15
|
+
defaultMenuItems.push({
|
|
68
16
|
id: 'quickFilter',
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
show: !!quickFilterEnabled(columns, column.field.id),
|
|
72
|
-
disabled: false,
|
|
17
|
+
visual: isFiltered ? _jsx(Icon, { name: 'times' }) : _jsx(Icon, { name: 'filter' }),
|
|
18
|
+
primary: isFiltered ? translate('Remove filter') : translate('Filter by this'),
|
|
73
19
|
onClick: () => {
|
|
74
20
|
if (isFiltered) {
|
|
75
|
-
|
|
21
|
+
removeFilter(filterExpression, targetCell, applyViewFilter, clearFilter);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
applyFilter(columns, targetCell, rowContextData, filterExpression, applyViewFilter);
|
|
76
25
|
}
|
|
77
|
-
return applyFilter(columns, targetCell, rowContextData, filterExpression, actionColumnFiltering);
|
|
78
26
|
}
|
|
79
|
-
}
|
|
80
|
-
{
|
|
81
|
-
id: 'copyText',
|
|
82
|
-
icon: 'copy',
|
|
83
|
-
label: translate('Copy text'),
|
|
84
|
-
show: true,
|
|
85
|
-
disabled: false,
|
|
86
|
-
onClick: () => copyText(targetCell)
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
id: 'pasteText',
|
|
90
|
-
icon: 'documents',
|
|
91
|
-
label: translate('Paste text'),
|
|
92
|
-
show: true,
|
|
93
|
-
disabled: true,
|
|
94
|
-
onClick: () => { }
|
|
95
|
-
}
|
|
96
|
-
];
|
|
97
|
-
};
|
|
98
|
-
const getMenuItems = (targetCell, column, rowContextData, columns, filterExpression, actionColumnFiltering, actionClearFiltering, translate) => {
|
|
99
|
-
const fieldContextOptions = column.field?.contextMenuOptions || [];
|
|
100
|
-
return [
|
|
101
|
-
...getDefaultMenuItems(column, rowContextData, targetCell, columns, filterExpression, actionColumnFiltering, actionClearFiltering, translate),
|
|
102
|
-
...fieldContextOptions
|
|
103
|
-
];
|
|
104
|
-
};
|
|
105
|
-
const shouldOverrideContextMenu = (targetCell, columns) => {
|
|
106
|
-
if (!targetCell) {
|
|
107
|
-
return false;
|
|
27
|
+
});
|
|
108
28
|
}
|
|
29
|
+
defaultMenuItems.push({
|
|
30
|
+
id: 'copyText',
|
|
31
|
+
visual: _jsx(Icon, { name: 'copy' }),
|
|
32
|
+
primary: translate('Copy text'),
|
|
33
|
+
onClick: () => copyText(targetCell)
|
|
34
|
+
});
|
|
35
|
+
const fieldSpecificMenuItems = (column.field?.contextMenuOptions || []).map(option => ({
|
|
36
|
+
id: option.id,
|
|
37
|
+
visual: option.icon ? _jsx(Icon, { name: option.icon }) : undefined,
|
|
38
|
+
primary: option.label || '',
|
|
39
|
+
onClick: () => option.onClick?.(targetCell)
|
|
40
|
+
}));
|
|
41
|
+
return [...defaultMenuItems, ...fieldSpecificMenuItems];
|
|
42
|
+
};
|
|
43
|
+
const shouldOverrideContextMenu = (targetCell, columns = []) => {
|
|
109
44
|
const { colId } = targetCell.dataset;
|
|
110
45
|
const { field } = columns.find(col => col.field.id.toString() === colId?.toString()) || {};
|
|
111
46
|
return !(!field || field?.noContextMenu);
|
|
112
47
|
};
|
|
113
|
-
const MenuItem = ({ menu = {}, target = {}, column = {}, rowContextData = {}, onMenuItemClick = () => { } }) => {
|
|
114
|
-
const { onClick = () => { }, icon, disabled = false, show = true, label } = menu;
|
|
115
|
-
if (!show) {
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
return (_jsx(StyledContent, { onClick: () => {
|
|
119
|
-
onMenuItemClick();
|
|
120
|
-
onClick(target, column, rowContextData);
|
|
121
|
-
}, children: _jsx(StyledListItem, { children: _jsxs(StyledButton, { children: [icon && _jsx(Icon, { name: icon }), _jsx("span", { className: cx('label', { disabled }), children: label })] }) }) }));
|
|
122
|
-
};
|
|
123
|
-
MenuItem.propTypes = {
|
|
124
|
-
menu: PropTypes.objectOf(PropTypes.any),
|
|
125
|
-
target: PropTypes.objectOf(PropTypes.any),
|
|
126
|
-
column: PropTypes.objectOf(PropTypes.any),
|
|
127
|
-
rowContextData: PropTypes.objectOf(PropTypes.any),
|
|
128
|
-
onMenuItemClick: PropTypes.func
|
|
129
|
-
};
|
|
130
48
|
export default function ContextMenuContainer({ view, selector }) {
|
|
131
|
-
const { columns, data, state: { paginationOptions
|
|
49
|
+
const { columns = [], data = [], state: { paginationOptions } = {}, domContainer } = view;
|
|
132
50
|
const [translate] = useTranslate();
|
|
133
|
-
const
|
|
51
|
+
const [menuContext, setMenuContext] = useState(null);
|
|
134
52
|
const [showMenu, setShowMenu] = useState(false);
|
|
135
53
|
const [menuItems, setMenuItems] = useState([]);
|
|
136
54
|
const [popperRef, setPopperRef] = useElement();
|
|
@@ -141,63 +59,90 @@ export default function ContextMenuContainer({ view, selector }) {
|
|
|
141
59
|
useScrollAway(popperRef, scrollerElem, () => {
|
|
142
60
|
setShowMenu(false);
|
|
143
61
|
});
|
|
144
|
-
|
|
145
|
-
if (
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!showMenu) {
|
|
64
|
+
const targetCell = menuContext?.targetCell;
|
|
65
|
+
if (targetCell) {
|
|
66
|
+
targetCell.removeAttribute('data-context-menu-active');
|
|
67
|
+
targetCell.removeAttribute('aria-expanded');
|
|
68
|
+
targetCell.removeAttribute('aria-controls');
|
|
69
|
+
}
|
|
70
|
+
setMenuContext(null);
|
|
71
|
+
}
|
|
72
|
+
}, [showMenu]);
|
|
73
|
+
const openContextMenu = useCallback((targetElement, eventTarget) => {
|
|
74
|
+
if (!shouldOverrideContextMenu(targetElement, columns) || eventTarget.closest('a')) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
const { colId } = targetElement.dataset;
|
|
78
|
+
const column = columns.find(col => col.field.id.toString() === colId?.toString());
|
|
79
|
+
if (!column)
|
|
80
|
+
return true;
|
|
81
|
+
targetElement.setAttribute('data-context-menu-active', 'true');
|
|
82
|
+
targetElement.setAttribute('aria-expanded', 'true');
|
|
83
|
+
const menuId = `rs-context-menu-${crypto.randomUUID()}`;
|
|
84
|
+
targetElement.setAttribute('aria-controls', menuId);
|
|
85
|
+
const rowContextData = getRowContextData(data, paginationOptions || {}, targetElement);
|
|
86
|
+
const options = getMenuItems(targetElement, column, rowContextData, view, translate);
|
|
87
|
+
if (!options.length)
|
|
88
|
+
return true;
|
|
89
|
+
setShowMenu(true);
|
|
90
|
+
setMenuItems(options);
|
|
91
|
+
setMenuContext({
|
|
92
|
+
column,
|
|
93
|
+
targetCell: targetElement,
|
|
94
|
+
rowContextData,
|
|
95
|
+
menuId
|
|
96
|
+
});
|
|
97
|
+
return true;
|
|
98
|
+
}, [columns, data, paginationOptions, translate, view]);
|
|
99
|
+
const contextMenuListener = useCallback((e) => {
|
|
100
|
+
const target = e.target;
|
|
101
|
+
if (!isInstance(target, Element))
|
|
102
|
+
return;
|
|
103
|
+
const targetElement = target.closest(selector.query.toString());
|
|
104
|
+
if (!isInstance(targetElement, HTMLElement))
|
|
105
|
+
return;
|
|
106
|
+
if (openContextMenu(targetElement, target)) {
|
|
107
|
+
e.stopPropagation();
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
}
|
|
110
|
+
}, [selector, openContextMenu]);
|
|
111
|
+
const onKeydown = useCallback((e) => {
|
|
112
|
+
if (e.key === 'Escape') {
|
|
113
|
+
setShowMenu(false);
|
|
146
114
|
return;
|
|
147
115
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
116
|
+
if (!(e.key === 'F10' && e.shiftKey))
|
|
117
|
+
return;
|
|
118
|
+
const activeElement = document.activeElement;
|
|
119
|
+
if (!isInstance(activeElement, Element))
|
|
120
|
+
return;
|
|
121
|
+
const targetElement = activeElement.closest(selector.query.toString());
|
|
122
|
+
if (!isInstance(targetElement, HTMLElement))
|
|
123
|
+
return;
|
|
124
|
+
if (openContextMenu(targetElement, activeElement)) {
|
|
155
125
|
e.stopPropagation();
|
|
156
126
|
e.preventDefault();
|
|
157
|
-
contextMenuRef.targetCell = targetElement;
|
|
158
|
-
const { colId } = contextMenuRef.targetCell.dataset;
|
|
159
|
-
contextMenuRef.column = columns.find(col => col.field.id.toString() === colId?.toString());
|
|
160
|
-
contextMenuRef.rowContextData = getRowContextData(data, paginationOptions, targetElement);
|
|
161
|
-
targetElement.classList.add('selection-border', 'disable-select');
|
|
162
|
-
const options = getMenuItems(targetElement, contextMenuRef.column, contextMenuRef.rowContextData, columns, filterExpression, applyViewFilter, clearFilter, translate);
|
|
163
|
-
setShowMenu(true);
|
|
164
|
-
setMenuItems(options);
|
|
165
127
|
}
|
|
166
|
-
}, [
|
|
167
|
-
selector,
|
|
168
|
-
columns,
|
|
169
|
-
contextMenuRef.targetCell,
|
|
170
|
-
contextMenuRef.column,
|
|
171
|
-
contextMenuRef.rowContextData,
|
|
172
|
-
data,
|
|
173
|
-
paginationOptions,
|
|
174
|
-
filterExpression,
|
|
175
|
-
applyViewFilter,
|
|
176
|
-
clearFilter,
|
|
177
|
-
translate
|
|
178
|
-
]);
|
|
128
|
+
}, [selector, openContextMenu]);
|
|
179
129
|
useEffect(() => {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
130
|
+
const abortController = new AbortController();
|
|
131
|
+
if (!domContainer)
|
|
132
|
+
return;
|
|
133
|
+
domContainer.addEventListener('contextmenu', contextMenuListener, {
|
|
134
|
+
signal: abortController.signal
|
|
135
|
+
});
|
|
136
|
+
domContainer.addEventListener('keydown', onKeydown, {
|
|
137
|
+
signal: abortController.signal
|
|
138
|
+
});
|
|
184
139
|
return () => {
|
|
185
|
-
|
|
186
|
-
domContainer.removeEventListener('contextmenu', contextMenuListener);
|
|
187
|
-
domContainer.removeEventListener('keydown', onMenuItemClick);
|
|
188
|
-
}
|
|
140
|
+
abortController.abort();
|
|
189
141
|
};
|
|
190
|
-
}, [domContainer, contextMenuListener,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
return (_jsx(Popover, { portal: true, ref: setPopperRef, target: contextMenuRef.targetCell, children: _jsx(StyledPopover, { children: menuItems.map(menu => (_jsx(MenuItem, { onMenuItemClick: onMenuItemClick, target: contextMenuRef.targetCell, column: contextMenuRef.column, rowContextData: contextMenuRef.rowContextData, menu: menu }, menu.id))) }) }));
|
|
142
|
+
}, [domContainer, contextMenuListener, onKeydown]);
|
|
143
|
+
return showMenu && menuContext ? (_jsx(Popover, { ref: setPopperRef, target: menuContext.targetCell, children: _jsx(Menu, { id: menuContext.menuId, items: menuItems, onItemClick: (_, e) => {
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
setShowMenu(false);
|
|
146
|
+
}, focusControlEl: menuContext.targetCell, className: 'action-menu', "data-testid": TestIdConstants.contextMenu, "data-test-id": 'action-menu' }) })) : null;
|
|
198
147
|
}
|
|
199
|
-
ContextMenuContainer.propTypes = {
|
|
200
|
-
view: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
201
|
-
selector: PropTypes.objectOf(PropTypes.any).isRequired
|
|
202
|
-
};
|
|
203
148
|
//# sourceMappingURL=ContextMenuContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuContainer.js","sourceRoot":"","sources":["../../../../Core/Components/ContextMenu/ContextMenuContainer.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,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SAAS,EAAE,eAAe,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,EAAE,mBAAmB,EAAE,eAAe,CAAC,CAAC,CAAC;IAEzD,IAAI,CAAC,cAAc,CAAC,UAAU,IAAI,CAAC,QAAQ,IAAI,CAAC,YAAY,EAAE,CAAC;QAC7D,IAAI,cAAc,CAAC,UAAU,IAAI,QAAQ,EAAE,CAAC;YAC1C,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;QACnF,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,KAAC,OAAO,IAAC,MAAM,QAAC,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,CAAC,UAAU,YAClE,KAAC,aAAa,cACX,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACrB,KAAC,QAAQ,IAEP,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,cAAc,CAAC,UAAU,EACjC,MAAM,EAAE,cAAc,CAAC,MAAM,EAC7B,cAAc,EAAE,cAAc,CAAC,cAAc,EAC7C,IAAI,EAAE,IAAI,IALL,IAAI,CAAC,EAAE,CAMZ,CACH,CAAC,GACY,GACR,CACX,CAAC;AACJ,CAAC;AAED,oBAAoB,CAAC,SAAS,GAAG;IAC/B,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU;IAClD,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU;CACvD,CAAC","sourcesContent":["import PropTypes from 'prop-types';\nimport { useRef, useState, useMemo, useEffect, useCallback } from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport { Popover, Icon, useElement, useOuterEvent, tryCatch } from '@pega/cosmos-react-core';\nimport {\n getRowContextData,\n getScrollerElem,\n isFilterApplied\n} from 'pega-repeating-structures-core';\n\nimport { createClassName as cx } from '../../Utils';\nimport useTranslate from '../../Hooks/useTranslate';\nimport useScrollAway from '../../Hooks/useScrollAway';\n\nimport { applyFilter, quickFilterEnabled, removeFilter } from './QuickFilter';\nimport copyText from './CopyPaste';\n\nconst StyledPopover = styled.div`\n width: 10rem;\n`;\n\nconst StyledContent = styled.div(({ theme }) => {\n const hoverColor = tryCatch(() =>\n mix(0.95, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n return css`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: 0.25rem;\n border-radius: 0.156rem;\n box-sizing: border-box;\n cursor: pointer;\n margin-top: 0.125rem;\n margin-bottom: 0.125rem;\n :hover {\n background-color: ${hoverColor};\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n `;\n});\n\nconst StyledListItem = styled.div(({ theme }) => {\n return css`\n button {\n display: flex;\n align-items: center;\n /* stylelint-disable unit-allowed-list */\n padding: 4px 8px;\n }\n .label {\n padding-left: 14px;\n vertical-align: text-top;\n }\n .disabled {\n padding-left: 14px;\n vertical-align: text-top;\n opacity: ${theme.base['disabled-opacity']};\n }\n `;\n});\n\nconst StyledButton = styled.button`\n display: block;\n text-align: start;\n background: none;\n border: none;\n line-height: 1;\n outline: none;\n cursor: pointer;\n color: ${props => props.theme.base.palette['foreground-color']};\n border-radius: 0;\n`;\n\nconst getDefaultMenuItems = (\n column,\n rowContextData,\n targetCell,\n columns,\n filterExpression,\n actionColumnFiltering,\n actionClearFiltering,\n translate\n) => {\n const isFiltered = isFilterApplied(column, filterExpression);\n return [\n {\n id: 'quickFilter',\n icon: isFiltered ? 'times' : 'filter',\n label: isFiltered ? translate('Remove filter') : translate('Filter by this'),\n show: !!quickFilterEnabled(columns, column.field.id),\n disabled: false,\n onClick: () => {\n if (isFiltered) {\n return removeFilter(\n filterExpression,\n targetCell,\n actionColumnFiltering,\n actionClearFiltering\n );\n }\n return applyFilter(\n columns,\n targetCell,\n rowContextData,\n filterExpression,\n actionColumnFiltering\n );\n }\n },\n {\n id: 'copyText',\n icon: 'copy',\n label: translate('Copy text'),\n show: true,\n disabled: false,\n onClick: () => copyText(targetCell)\n },\n {\n id: 'pasteText',\n icon: 'documents',\n label: translate('Paste text'),\n show: true,\n disabled: true,\n onClick: () => {}\n }\n ];\n};\n\nconst getMenuItems = (\n targetCell,\n column,\n rowContextData,\n columns,\n filterExpression,\n actionColumnFiltering,\n actionClearFiltering,\n translate\n) => {\n const fieldContextOptions = column.field?.contextMenuOptions || [];\n return [\n ...getDefaultMenuItems(\n column,\n rowContextData,\n targetCell,\n columns,\n filterExpression,\n actionColumnFiltering,\n actionClearFiltering,\n translate\n ),\n ...fieldContextOptions\n ];\n};\n\nconst shouldOverrideContextMenu = (targetCell, columns) => {\n if (!targetCell) {\n return false;\n }\n const { colId } = targetCell.dataset;\n\n const { field } = columns.find(col => col.field.id.toString() === colId?.toString()) || {};\n return !(!field || field?.noContextMenu);\n};\n\nconst MenuItem = ({\n menu = {},\n target = {},\n column = {},\n rowContextData = {},\n onMenuItemClick = () => {}\n}) => {\n const { onClick = () => {}, icon, disabled = false, show = true, label } = menu;\n if (!show) {\n return null;\n }\n\n return (\n <StyledContent\n onClick={() => {\n onMenuItemClick();\n onClick(target, column, rowContextData);\n }}\n >\n <StyledListItem>\n <StyledButton>\n {icon && <Icon name={icon} />}\n <span className={cx('label', { disabled })}>{label}</span>\n </StyledButton>\n </StyledListItem>\n </StyledContent>\n );\n};\n\nMenuItem.propTypes = {\n menu: PropTypes.objectOf(PropTypes.any),\n target: PropTypes.objectOf(PropTypes.any),\n column: PropTypes.objectOf(PropTypes.any),\n rowContextData: PropTypes.objectOf(PropTypes.any),\n onMenuItemClick: PropTypes.func\n};\n\nexport default function ContextMenuContainer({ view, selector }) {\n const {\n columns,\n data,\n state: { paginationOptions, filterExpression } = {},\n domContainer,\n type: { applyFilter: applyViewFilter, clearFilter }\n } = view;\n const [translate] = useTranslate();\n const contextMenuRef = useRef({}).current;\n const [showMenu, setShowMenu] = useState(false);\n const [menuItems, setMenuItems] = useState([]);\n const [popperRef, setPopperRef] = useElement();\n const scrollerElem = useMemo(() => getScrollerElem(view), [view]);\n\n useOuterEvent('mousedown', [popperRef], () => {\n setShowMenu(false);\n });\n\n useScrollAway(popperRef, scrollerElem, () => {\n setShowMenu(false);\n });\n\n const onMenuItemClick = useCallback(event => {\n if (event && event.key !== 'Escape') {\n return;\n }\n setShowMenu(false);\n }, []);\n\n const contextMenuListener = useCallback(\n e => {\n const targetElement = selector ? e.target.closest(selector.query.toString()) : e.target;\n if (\n shouldOverrideContextMenu(targetElement, columns) &&\n // TODO: We will add \"Open link in new tab\" option in context menu once the custom context menu is made accessible.\n !e.target.closest('a')\n ) {\n e.stopPropagation();\n e.preventDefault();\n contextMenuRef.targetCell = targetElement;\n const { colId } = contextMenuRef.targetCell.dataset;\n contextMenuRef.column = columns.find(col => col.field.id.toString() === colId?.toString());\n contextMenuRef.rowContextData = getRowContextData(data, paginationOptions, targetElement);\n targetElement.classList.add('selection-border', 'disable-select');\n const options = getMenuItems(\n targetElement,\n contextMenuRef.column,\n contextMenuRef.rowContextData,\n columns,\n filterExpression,\n applyViewFilter,\n clearFilter,\n translate\n );\n setShowMenu(true);\n setMenuItems(options);\n }\n },\n\n [\n selector,\n columns,\n contextMenuRef.targetCell,\n contextMenuRef.column,\n contextMenuRef.rowContextData,\n data,\n paginationOptions,\n filterExpression,\n applyViewFilter,\n clearFilter,\n translate\n ]\n );\n\n useEffect(() => {\n if (domContainer) {\n domContainer.addEventListener('contextmenu', contextMenuListener);\n domContainer.addEventListener('keydown', onMenuItemClick);\n }\n return () => {\n if (domContainer) {\n domContainer.removeEventListener('contextmenu', contextMenuListener);\n domContainer.removeEventListener('keydown', onMenuItemClick);\n }\n };\n }, [domContainer, contextMenuListener, onMenuItemClick]);\n\n if (!contextMenuRef.targetCell || !showMenu || !domContainer) {\n if (contextMenuRef.targetCell && selector) {\n contextMenuRef.targetCell.classList.remove('selection-border', 'disable-select');\n }\n return null;\n }\n\n return (\n <Popover portal ref={setPopperRef} target={contextMenuRef.targetCell}>\n <StyledPopover>\n {menuItems.map(menu => (\n <MenuItem\n key={menu.id}\n onMenuItemClick={onMenuItemClick}\n target={contextMenuRef.targetCell}\n column={contextMenuRef.column}\n rowContextData={contextMenuRef.rowContextData}\n menu={menu}\n />\n ))}\n </StyledPopover>\n </Popover>\n );\n}\n\nContextMenuContainer.propTypes = {\n view: PropTypes.objectOf(PropTypes.any).isRequired,\n selector: PropTypes.objectOf(PropTypes.any).isRequired\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ContextMenuContainer.js","sourceRoot":"","sources":["../../../../Core/Components/ContextMenu/ContextMenuContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAIlE,OAAO,EACL,OAAO,EACP,IAAI,EACJ,UAAU,EACV,aAAa,EACb,IAAI,EACJ,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,eAAe,EAChB,MAAM,gCAAgC,CAAC;AAExC,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,QAAQ,MAAM,aAAa,CAAC;AASnC,MAAM,YAAY,GAAG,CACnB,UAAuB,EACvB,MAA0B,EAC1B,cAAmC,EACnC,IAAsB,EACtB,SAAkC,EACjB,EAAE;IACnB,MAAM,EACJ,OAAO,GAAG,EAAE,EACZ,KAAK,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,EAChC,IAAI,EAAE,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE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;YAChE,MAAM,EAAE,eAAe,CAAC,MAAM;SAC/B,CAAC,CAAC;QACH,YAAY,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE;YAClD,MAAM,EAAE,eAAe,CAAC,MAAM;SAC/B,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,eAAe,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,EAAE,mBAAmB,EAAE,SAAS,CAAC,CAAC,CAAC;IAEnD,OAAO,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,CAC/B,KAAC,OAAO,IAAC,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,UAAU,YACxD,KAAC,IAAI,IACH,EAAE,EAAE,WAAW,CAAC,MAAM,EACtB,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;gBACpB,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,WAAW,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC,EACD,cAAc,EAAE,WAAW,CAAC,UAAU,EACtC,SAAS,EAAC,aAAa,iBACV,eAAe,CAAC,WAAW,kBAE3B,aAAa,GAC1B,GACM,CACX,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC","sourcesContent":["import { useState, useMemo, useEffect, useCallback } from 'react';\n\nimport type { RsCoreTypes } from 'pega-repeating-structures-core';\nimport type { MenuItemProps } from '@pega/cosmos-react-core';\nimport {\n Popover,\n Icon,\n useElement,\n useOuterEvent,\n Menu,\n isInstance\n} from '@pega/cosmos-react-core';\nimport {\n getRowContextData,\n getScrollerElem,\n isFilterApplied\n} from 'pega-repeating-structures-core';\n\nimport useTranslate from '../../Hooks/useTranslate';\nimport useScrollAway from '../../Hooks/useScrollAway';\nimport TestIdConstants from '../TestIdConstants';\n\nimport { applyFilter, quickFilterEnabled, removeFilter } from './QuickFilter';\nimport copyText from './CopyPaste';\n\ntype MenuContext = {\n targetCell: HTMLElement;\n column: RsCoreTypes.Column;\n rowContextData: RsCoreTypes.RowData;\n menuId: string;\n} | null;\n\nconst getMenuItems = (\n targetCell: HTMLElement,\n column: RsCoreTypes.Column,\n rowContextData: RsCoreTypes.RowData,\n view: RsCoreTypes.View,\n translate: (key: string) => string\n): MenuItemProps[] => {\n const {\n columns = [],\n state: { filterExpression } = {},\n type: { applyFilter: applyViewFilter, clearFilter }\n } = view;\n const defaultMenuItems: MenuItemProps[] = [];\n\n if (quickFilterEnabled(columns, column.field.id)) {\n const isFiltered = filterExpression && isFilterApplied(column, filterExpression);\n defaultMenuItems.push({\n id: 'quickFilter',\n visual: isFiltered ? <Icon name='times' /> : <Icon name='filter' />,\n primary: isFiltered ? translate('Remove filter') : translate('Filter by this'),\n\n onClick: () => {\n if (isFiltered) {\n removeFilter(filterExpression, targetCell, applyViewFilter, clearFilter);\n } else {\n applyFilter(columns, targetCell, rowContextData, filterExpression, applyViewFilter);\n }\n }\n });\n }\n\n defaultMenuItems.push({\n id: 'copyText',\n visual: <Icon name='copy' />,\n primary: translate('Copy text'),\n onClick: () => copyText(targetCell)\n });\n\n const fieldSpecificMenuItems: MenuItemProps[] = (column.field?.contextMenuOptions || []).map(\n option => ({\n id: option.id,\n visual: option.icon ? <Icon name={option.icon} /> : undefined,\n primary: option.label || '',\n onClick: () => option.onClick?.(targetCell)\n })\n );\n\n return [...defaultMenuItems, ...fieldSpecificMenuItems];\n};\n\nconst shouldOverrideContextMenu = (\n targetCell: HTMLElement,\n columns: RsCoreTypes.Column[] = []\n): boolean => {\n const { colId } = targetCell.dataset;\n\n const { field } = columns.find(col => col.field.id.toString() === colId?.toString()) || {};\n return !(!field || field?.noContextMenu);\n};\n\nexport default function ContextMenuContainer({\n view,\n selector\n}: {\n view: RsCoreTypes.View;\n selector: { query: string };\n}) {\n const { columns = [], data = [], state: { paginationOptions } = {}, domContainer } = view;\n\n const [translate] = useTranslate();\n const [menuContext, setMenuContext] = useState<MenuContext>(null);\n const [showMenu, setShowMenu] = useState(false);\n const [menuItems, setMenuItems] = useState<MenuItemProps[]>([]);\n const [popperRef, setPopperRef] = useElement();\n const scrollerElem = useMemo(() => getScrollerElem(view), [view]);\n\n useOuterEvent('mousedown', [popperRef], () => {\n setShowMenu(false);\n });\n\n useScrollAway(popperRef, scrollerElem, () => {\n setShowMenu(false);\n });\n\n useEffect(() => {\n if (!showMenu) {\n const targetCell = menuContext?.targetCell;\n if (targetCell) {\n targetCell.removeAttribute('data-context-menu-active');\n targetCell.removeAttribute('aria-expanded');\n targetCell.removeAttribute('aria-controls');\n }\n setMenuContext(null);\n }\n }, [showMenu]);\n\n const openContextMenu = useCallback(\n (targetElement: HTMLElement, eventTarget: Element): boolean => {\n if (!shouldOverrideContextMenu(targetElement, columns) || eventTarget.closest('a')) {\n return false;\n }\n\n const { colId } = targetElement.dataset;\n const column = columns.find(col => col.field.id.toString() === colId?.toString());\n if (!column) return true;\n\n targetElement.setAttribute('data-context-menu-active', 'true');\n targetElement.setAttribute('aria-expanded', 'true');\n const menuId = `rs-context-menu-${crypto.randomUUID()}`;\n targetElement.setAttribute('aria-controls', menuId);\n\n const rowContextData = getRowContextData(data, paginationOptions || {}, targetElement);\n const options = getMenuItems(targetElement, column, rowContextData, view, translate);\n if (!options.length) return true;\n\n setShowMenu(true);\n setMenuItems(options);\n setMenuContext({\n column,\n targetCell: targetElement,\n rowContextData,\n menuId\n });\n\n return true;\n },\n [columns, data, paginationOptions, translate, view]\n );\n\n const contextMenuListener = useCallback(\n (e: MouseEvent) => {\n const target = e.target;\n if (!isInstance(target, Element)) return;\n\n const targetElement = target.closest(selector.query.toString());\n if (!isInstance(targetElement, HTMLElement)) return;\n\n if (openContextMenu(targetElement, target)) {\n e.stopPropagation();\n e.preventDefault();\n }\n },\n [selector, openContextMenu]\n );\n\n const onKeydown = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n setShowMenu(false);\n return;\n }\n\n if (!(e.key === 'F10' && e.shiftKey)) return;\n\n const activeElement = document.activeElement;\n if (!isInstance(activeElement, Element)) return;\n\n const targetElement = activeElement.closest(selector.query.toString());\n if (!isInstance(targetElement, HTMLElement)) return;\n\n if (openContextMenu(targetElement, activeElement)) {\n e.stopPropagation();\n e.preventDefault();\n }\n },\n [selector, openContextMenu]\n );\n\n useEffect(() => {\n const abortController = new AbortController();\n if (!domContainer) return;\n\n domContainer.addEventListener('contextmenu', contextMenuListener, {\n signal: abortController.signal\n });\n domContainer.addEventListener('keydown', onKeydown, {\n signal: abortController.signal\n });\n\n return () => {\n abortController.abort();\n };\n }, [domContainer, contextMenuListener, onKeydown]);\n\n return showMenu && menuContext ? (\n <Popover ref={setPopperRef} target={menuContext.targetCell}>\n <Menu\n id={menuContext.menuId}\n items={menuItems}\n onItemClick={(_, e) => {\n e.preventDefault();\n setShowMenu(false);\n }}\n focusControlEl={menuContext.targetCell}\n className='action-menu'\n data-testid={TestIdConstants.contextMenu}\n // TODO: remove this older test-id syntax after checking usage across the test suites\n data-test-id='action-menu'\n />\n </Popover>\n ) : null;\n}\n"]}
|