@pega/lists-react 9.0.0-build.2.9 → 9.0.0-build.20.1
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 +1 -1
- package/lib/Core/Components/HeaderMenu/actions.d.ts.map +1 -1
- package/lib/Core/Components/HeaderMenu/actions.js +6 -6
- 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 +4 -4
- 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/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/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 +1 -1
- package/lib/Core/Components/RenderingEngine/RenderCell.d.ts.map +1 -1
- package/lib/Core/Components/RenderingEngine/RenderCell.js +4 -2
- 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/RepeatingStructuresBoot.types.d.ts +12 -2
- 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 -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
|
@@ -1,18 +1,38 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import { memo, useCallback, useEffect,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback, useEffect, useState, useMemo } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { Icon, SearchInput, Menu, menuHelpers, useElement, Flex, Button } from '@pega/cosmos-react-core';
|
|
6
6
|
import { allowToggle, getFieldIcon } from '../../Utils';
|
|
7
|
+
import useTranslate from '../../Hooks/useTranslate';
|
|
7
8
|
export const colsVisibility = 'Show/hide columns';
|
|
8
9
|
export const pinning = 'Freeze columns';
|
|
10
|
+
/**
|
|
11
|
+
* Returns an Icon component based on the field type.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} type - The type of the field for which the icon is required.
|
|
14
|
+
* @returns {JSX.Element} - A React Icon component with the appropriate icon name.
|
|
15
|
+
*/
|
|
9
16
|
export function getIconByFieldType(type) {
|
|
10
17
|
const iconName = getFieldIcon(type);
|
|
11
18
|
return _jsx(Icon, { "data-test-id": iconName, "data-testid": iconName, name: iconName });
|
|
12
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Determines the list of changed column IDs.
|
|
22
|
+
*
|
|
23
|
+
* @param {Set<string>} initialSelectedColumns - The initial set of selected column IDs.
|
|
24
|
+
* @param {Set<string>} currentSelectedColumns - The current set of selected column IDs.
|
|
25
|
+
* @returns {string[]} - Array of modified column IDs.
|
|
26
|
+
*/
|
|
27
|
+
function getModifiedColumns(initialSelectedColumns, currentSelectedColumns) {
|
|
28
|
+
const addedColumns = [...currentSelectedColumns].filter(id => !initialSelectedColumns.has(id));
|
|
29
|
+
const removedColumns = [...initialSelectedColumns].filter(id => !currentSelectedColumns.has(id));
|
|
30
|
+
return [...addedColumns, ...removedColumns];
|
|
31
|
+
}
|
|
13
32
|
/**
|
|
14
33
|
* Transforms the columns array into array of columns grouped by category
|
|
15
|
-
* @param {Array} columns
|
|
34
|
+
* @param {Array} columns - The array of column objects to be transformed.
|
|
35
|
+
* @param {string} action - The action to perform, either 'Show/hide columns' or 'Freeze columns'.
|
|
16
36
|
* @returns Arrays of columns nested by category
|
|
17
37
|
*/
|
|
18
38
|
export function transformData(columns, action) {
|
|
@@ -26,35 +46,33 @@ export function transformData(columns, action) {
|
|
|
26
46
|
.forEach(column => {
|
|
27
47
|
const { field: { id, category = [], type }, label, hidden, frozen } = column;
|
|
28
48
|
const lastCategoryLabel = category.length ? category[category.length - 1].label : undefined;
|
|
29
|
-
let selectAction;
|
|
30
49
|
let disabled;
|
|
31
50
|
if (action === colsVisibility) {
|
|
32
|
-
selectAction = !hidden;
|
|
33
51
|
disabled = !allowColumnToggle && !hidden;
|
|
34
52
|
}
|
|
35
|
-
else if (action === pinning)
|
|
36
|
-
selectAction = frozen;
|
|
37
53
|
if (categoryObj[lastCategoryLabel])
|
|
38
54
|
categoryObj[lastCategoryLabel].items.push({
|
|
39
55
|
id,
|
|
40
56
|
primary: label,
|
|
41
57
|
label,
|
|
42
|
-
selected:
|
|
58
|
+
selected: action === colsVisibility ? !hidden : frozen,
|
|
43
59
|
type,
|
|
44
|
-
disabled
|
|
60
|
+
disabled,
|
|
61
|
+
visual: getIconByFieldType(type)
|
|
45
62
|
});
|
|
46
63
|
else {
|
|
47
64
|
categoryObj[lastCategoryLabel] = {
|
|
48
65
|
id: `category:${lastCategoryLabel}`,
|
|
49
|
-
|
|
66
|
+
primary: lastCategoryLabel,
|
|
50
67
|
items: [
|
|
51
68
|
{
|
|
52
69
|
id,
|
|
53
70
|
primary: label,
|
|
54
|
-
selected:
|
|
71
|
+
selected: action === colsVisibility ? !hidden : frozen,
|
|
55
72
|
label,
|
|
56
73
|
type,
|
|
57
|
-
disabled
|
|
74
|
+
disabled,
|
|
75
|
+
visual: getIconByFieldType(type)
|
|
58
76
|
}
|
|
59
77
|
]
|
|
60
78
|
};
|
|
@@ -72,69 +90,75 @@ export function transformData(columns, action) {
|
|
|
72
90
|
});
|
|
73
91
|
return result;
|
|
74
92
|
}
|
|
93
|
+
const Footer = memo(({ onCancel, onSubmit, disabled }) => {
|
|
94
|
+
const [translate] = useTranslate();
|
|
95
|
+
return (_jsxs(Flex, { container: { justify: 'between' }, children: [_jsx(Button, { onClick: onCancel, "data-testid": 'cancel', children: translate('Cancel') }), _jsx(Button, { variant: 'primary', onClick: onSubmit, disabled: disabled, "data-testid": 'submit', children: translate('Submit') })] }));
|
|
96
|
+
});
|
|
97
|
+
Footer.displayName = 'Footer';
|
|
98
|
+
Footer.propTypes = {
|
|
99
|
+
onCancel: PropTypes.func.isRequired,
|
|
100
|
+
onSubmit: PropTypes.func.isRequired,
|
|
101
|
+
disabled: PropTypes.bool.isRequired
|
|
102
|
+
};
|
|
103
|
+
const StyledMenu = styled(Menu) `
|
|
104
|
+
width: 16rem;
|
|
105
|
+
`;
|
|
75
106
|
export function ColumnSelectorControl(props) {
|
|
76
|
-
const { data,
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
const selectedData = flatData.filter(o => o.selected).map(obj => obj.id);
|
|
88
|
-
const [visibleColumns, onChecked] = useSelect(selectedData);
|
|
89
|
-
const onChange = useCallback(id => onChecked(id), [onChecked]);
|
|
90
|
-
const [searchQuery, onSearch] = useState('');
|
|
91
|
-
const [searchEl, setSearchEl] = useElement(null);
|
|
92
|
-
const hasMountedRef = useRef(false);
|
|
93
|
-
const onSearchTriggered = useCallback(searchString => {
|
|
94
|
-
onSearch(searchString);
|
|
95
|
-
}, [onSearch]);
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
if (forceShowPopup && searchEl)
|
|
98
|
-
searchEl.focus();
|
|
99
|
-
}, [forceShowPopup, searchEl]);
|
|
107
|
+
const { data, onSubmit, onCancel, action } = props;
|
|
108
|
+
const initialSelectedColumns = useMemo(() => new Set(menuHelpers
|
|
109
|
+
.flatten(data)
|
|
110
|
+
.filter(item => item.selected)
|
|
111
|
+
.map(item => item.id)), [data]);
|
|
112
|
+
const [searchText, setSearchText] = useState('');
|
|
113
|
+
const [searchRef, setSearchRef] = useElement(null);
|
|
114
|
+
const [items, setItems] = useState(data);
|
|
115
|
+
const selectedColumns = useMemo(() => new Set(menuHelpers.getSelected(items).map(item => item.id)), [items]);
|
|
100
116
|
useEffect(() => {
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
const currentVisibleColumns = [...visibleColumns];
|
|
104
|
-
const toggledColumns = [
|
|
105
|
-
...currentVisibleColumns.filter(id => !previousVisibleColumns.includes(id)),
|
|
106
|
-
...previousVisibleColumns.filter(id => !visibleColumns.has(id))
|
|
107
|
-
];
|
|
108
|
-
onSelect(toggledColumns);
|
|
117
|
+
if (searchRef) {
|
|
118
|
+
searchRef.focus();
|
|
109
119
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
}, [searchRef]);
|
|
121
|
+
const itemsToRender = useMemo(() => {
|
|
122
|
+
return menuHelpers.mapTree(searchText
|
|
123
|
+
? menuHelpers
|
|
124
|
+
.flatten(items)
|
|
125
|
+
.filter(({ primary }) => primary.toLowerCase().includes(searchText.toLowerCase()))
|
|
126
|
+
: items, item => {
|
|
127
|
+
return {
|
|
128
|
+
...item,
|
|
129
|
+
visual: item.visual,
|
|
130
|
+
selected: item.items ? undefined : item.selected,
|
|
131
|
+
disabled: item.selected && action === colsVisibility && selectedColumns.size <= 1
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
}, [searchText, items]);
|
|
135
|
+
const modifiedColumns = useMemo(() => getModifiedColumns(initialSelectedColumns, selectedColumns), [initialSelectedColumns, selectedColumns, action]);
|
|
136
|
+
const isSubmitEnabled = !(action === colsVisibility && selectedColumns.size === 0) && modifiedColumns.length > 0;
|
|
137
|
+
return (_jsx(StyledMenu, { items: itemsToRender, mode: 'multi-select', onItemClick: (id, args) => {
|
|
138
|
+
setItems(cur => menuHelpers.toggleSelected(cur, id, args.mode));
|
|
139
|
+
}, role: 'listbox', focusControlEl: searchRef || undefined, header: _jsx(SearchInput, { value: searchText, onSearchChange: setSearchText, ref: setSearchRef }), footer: _jsx(Footer, { onCancel: onCancel, onSubmit: () => onSubmit(modifiedColumns), disabled: !isSubmitEnabled }) }));
|
|
116
140
|
}
|
|
117
141
|
ColumnSelectorControl.propTypes = {
|
|
118
142
|
data: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
119
|
-
|
|
120
|
-
|
|
143
|
+
onSubmit: PropTypes.func.isRequired,
|
|
144
|
+
onCancel: PropTypes.func.isRequired,
|
|
145
|
+
action: PropTypes.string.isRequired
|
|
121
146
|
};
|
|
122
|
-
function ColumnSelector({ dispatch, columns, action }) {
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
setForceShowPopup(false);
|
|
147
|
+
function ColumnSelector({ dispatch, columns, action, finishPopOver }) {
|
|
148
|
+
const transformed = useMemo(() => transformData(columns, action), [columns, action]);
|
|
149
|
+
const onSubmitHandler = useCallback(changedCols => {
|
|
150
|
+
if (changedCols.length > 0) {
|
|
151
|
+
dispatch(changedCols);
|
|
128
152
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return (_jsx(_Fragment, { children: forceShowPopup && (_jsx(ColumnSelectorControl, { data: data, onSelect: onSelectHandler, forceShowPopup: forceShowPopup })) }));
|
|
153
|
+
finishPopOver();
|
|
154
|
+
}, [dispatch]);
|
|
155
|
+
return (_jsx(ColumnSelectorControl, { data: transformed, onSubmit: onSubmitHandler, onCancel: finishPopOver, action: action }));
|
|
133
156
|
}
|
|
134
157
|
ColumnSelector.propTypes = {
|
|
135
158
|
dispatch: PropTypes.func.isRequired,
|
|
136
159
|
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
137
|
-
action: PropTypes.string.isRequired
|
|
160
|
+
action: PropTypes.string.isRequired,
|
|
161
|
+
finishPopOver: PropTypes.func.isRequired
|
|
138
162
|
};
|
|
139
163
|
export default memo(ColumnSelector);
|
|
140
164
|
//# sourceMappingURL=ColumnSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnSelector.js","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/ColumnSelector.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM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AAQ,EAAE,eAAe,EACzB,cAAc,EAAE,cAAc,GAC9B,CACH,GACA,CACJ,CAAC;AACJ,CAAC;AAED,cAAc,CAAC,SAAS,GAAG;IACzB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,UAAU;IACvD,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;CACpC,CAAC;AAEF,eAAe,IAAI,CAAC,cAAc,CAAC,CAAC","sourcesContent":["import { memo, useCallback, useEffect, useRef, useState, useMemo } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { Icon, SearchInput, Menu, menuHelpers, useElement } from '@pega/cosmos-react-core';\n\nimport useSelect from '../../Hooks/useSelect';\nimport { allowToggle, getFieldIcon } from '../../Utils';\n\nexport const colsVisibility = 'Show/hide columns';\nexport const pinning = 'Freeze columns';\n\nexport function getIconByFieldType(type) {\n const iconName = getFieldIcon(type);\n return <Icon data-test-id={iconName} data-testid={iconName} name={iconName} />;\n}\n/**\n * Transforms the columns array into array of columns grouped by category\n * @param {Array} columns : ;\n * @returns Arrays of columns nested by category\n */\nexport function transformData(columns, action) {\n const result = [];\n if (!columns?.length) return result;\n\n const categoryObj = {};\n const allowColumnToggle = allowToggle(columns[0].parent.getVisibleColumns());\n\n columns\n ?.filter(c => c.field.toggle)\n .forEach(column => {\n const {\n field: { id, category = [], type },\n label,\n hidden,\n frozen\n } = column;\n const lastCategoryLabel = category.length ? category[category.length - 1].label : undefined;\n let selectAction;\n let disabled;\n if (action === colsVisibility) {\n selectAction = !hidden;\n disabled = !allowColumnToggle && !hidden;\n } else if (action === pinning) selectAction = frozen;\n if (categoryObj[lastCategoryLabel])\n categoryObj[lastCategoryLabel].items.push({\n id,\n primary: label,\n label,\n selected: selectAction,\n type,\n disabled\n });\n else {\n categoryObj[lastCategoryLabel] = {\n id: `category:${lastCategoryLabel}`,\n label: lastCategoryLabel,\n items: [\n {\n id,\n primary: label,\n selected: selectAction,\n label,\n type,\n disabled\n }\n ]\n };\n }\n });\n // Items with no category attribute are set in the root of returned array\n if (categoryObj[undefined] && categoryObj[undefined].items) {\n result.push(...categoryObj[undefined].items);\n delete categoryObj[undefined];\n }\n const keys = Object.keys(categoryObj);\n // Items with category attribute are grouped inside the nested category object\n keys.forEach(key => {\n result.push(categoryObj[key]);\n });\n return result;\n}\n\nexport function ColumnSelectorControl(props) {\n const { data, onSelect, forceShowPopup } = props;\n const flatData = menuHelpers.flatten(data);\n\n data.forEach(d => {\n if (d.items)\n d.items.forEach(item => {\n item.visual = getIconByFieldType(item.type);\n });\n else {\n d.visual = getIconByFieldType(d.type);\n }\n });\n\n const selectedData = flatData.filter(o => o.selected).map(obj => obj.id);\n const [visibleColumns, onChecked] = useSelect(selectedData);\n const onChange = useCallback(id => onChecked(id), [onChecked]);\n const [searchQuery, onSearch] = useState('');\n const [searchEl, setSearchEl] = useElement(null);\n\n const hasMountedRef = useRef(false);\n\n const onSearchTriggered = useCallback(\n searchString => {\n onSearch(searchString);\n },\n [onSearch]\n );\n\n useEffect(() => {\n if (forceShowPopup && searchEl) searchEl.focus();\n }, [forceShowPopup, searchEl]);\n\n useEffect(() => {\n if (hasMountedRef.current) {\n const previousVisibleColumns = flatData.filter(o => o.selected).map(o => o.id);\n const currentVisibleColumns = [...visibleColumns];\n const toggledColumns = [\n ...currentVisibleColumns.filter(id => !previousVisibleColumns.includes(id)),\n ...previousVisibleColumns.filter(id => !visibleColumns.has(id))\n ];\n onSelect(toggledColumns);\n }\n hasMountedRef.current = true;\n }, [visibleColumns]);\n\n const itemsToRender = searchQuery\n ? flatData.filter(item => item.label.toLowerCase().includes(searchQuery.toLowerCase()))\n : data;\n\n return (\n <Menu\n items={itemsToRender}\n mode='multi-select'\n onItemClick={onChange}\n role='listbox'\n focusControlEl={searchEl || undefined}\n header={\n <SearchInput value={searchQuery} onSearchChange={onSearchTriggered} ref={setSearchEl} />\n }\n />\n );\n}\n\nColumnSelectorControl.propTypes = {\n data: PropTypes.arrayOf(PropTypes.object).isRequired,\n onSelect: PropTypes.func.isRequired,\n forceShowPopup: PropTypes.bool.isRequired\n};\n\nfunction ColumnSelector({ dispatch, columns, action }) {\n const data = useMemo(() => transformData(columns, action), [columns, action]);\n const [forceShowPopup, setForceShowPopup] = useState(true);\n const onSelectHandler = useCallback(\n cols => {\n if (columns.length > 100) {\n setForceShowPopup(false);\n }\n if (cols.length > 0) dispatch(cols);\n },\n [dispatch, columns.length]\n );\n\n return (\n <>\n {forceShowPopup && (\n <ColumnSelectorControl\n data={data}\n onSelect={onSelectHandler}\n forceShowPopup={forceShowPopup}\n />\n )}\n </>\n );\n}\n\nColumnSelector.propTypes = {\n dispatch: PropTypes.func.isRequired,\n columns: PropTypes.arrayOf(PropTypes.object).isRequired,\n action: PropTypes.string.isRequired\n};\n\nexport default memo(ColumnSelector);\n"]}
|
|
1
|
+
{"version":3,"file":"ColumnSelector.js","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/ColumnSelector.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,WAAW,EACX,UAAU,EACV,IAAI,EACJ,MAAM,EACP,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAEpD,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAClD,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAI;IACrC,MAAM,QAAQ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,GAAG;IAChC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,UAAU;IACpD,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;CACpC,CAAC;AAEF,SAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE;IAClE,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAErF,MAAM,eAAe,GAAG,WAAW,CACjC,WAAW,CAAC,EAAE;QACZ,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,QAAQ,CAAC,WAAW,CAAC,CAAC;QACxB,CAAC;QACD,aAAa,EAAE,CAAC;IAClB,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,KAAC,qBAAqB,IACpB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC;AAED,cAAc,CAAC,SAAS,GAAG;IACzB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,UAAU;IACvD,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACnC,aAAa,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;CACzC,CAAC;AAEF,eAAe,IAAI,CAAC,cAAc,CAAC,CAAC","sourcesContent":["import { memo, useCallback, useEffect, useState, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport styled from 'styled-components';\n\nimport {\n Icon,\n SearchInput,\n Menu,\n menuHelpers,\n useElement,\n Flex,\n Button\n} from '@pega/cosmos-react-core';\n\nimport { allowToggle, getFieldIcon } from '../../Utils';\nimport useTranslate from '../../Hooks/useTranslate';\n\nexport const colsVisibility = 'Show/hide columns';\nexport const pinning = 'Freeze columns';\n\n/**\n * Returns an Icon component based on the field type.\n *\n * @param {string} type - The type of the field for which the icon is required.\n * @returns {JSX.Element} - A React Icon component with the appropriate icon name.\n */\nexport function getIconByFieldType(type) {\n const iconName = getFieldIcon(type);\n return <Icon data-test-id={iconName} data-testid={iconName} name={iconName} />;\n}\n\n/**\n * Determines the list of changed column IDs.\n *\n * @param {Set<string>} initialSelectedColumns - The initial set of selected column IDs.\n * @param {Set<string>} currentSelectedColumns - The current set of selected column IDs.\n * @returns {string[]} - Array of modified column IDs.\n */\nfunction getModifiedColumns(initialSelectedColumns, currentSelectedColumns) {\n const addedColumns = [...currentSelectedColumns].filter(id => !initialSelectedColumns.has(id));\n const removedColumns = [...initialSelectedColumns].filter(id => !currentSelectedColumns.has(id));\n return [...addedColumns, ...removedColumns];\n}\n\n/**\n * Transforms the columns array into array of columns grouped by category\n * @param {Array} columns - The array of column objects to be transformed.\n * @param {string} action - The action to perform, either 'Show/hide columns' or 'Freeze columns'.\n * @returns Arrays of columns nested by category\n */\nexport function transformData(columns, action) {\n const result = [];\n if (!columns?.length) return result;\n\n const categoryObj = {};\n const allowColumnToggle = allowToggle(columns[0].parent.getVisibleColumns());\n\n columns\n ?.filter(c => c.field.toggle)\n .forEach(column => {\n const {\n field: { id, category = [], type },\n label,\n hidden,\n frozen\n } = column;\n const lastCategoryLabel = category.length ? category[category.length - 1].label : undefined;\n let disabled;\n if (action === colsVisibility) {\n disabled = !allowColumnToggle && !hidden;\n }\n if (categoryObj[lastCategoryLabel])\n categoryObj[lastCategoryLabel].items.push({\n id,\n primary: label,\n label,\n selected: action === colsVisibility ? !hidden : frozen,\n type,\n disabled,\n visual: getIconByFieldType(type)\n });\n else {\n categoryObj[lastCategoryLabel] = {\n id: `category:${lastCategoryLabel}`,\n primary: lastCategoryLabel,\n items: [\n {\n id,\n primary: label,\n selected: action === colsVisibility ? !hidden : frozen,\n label,\n type,\n disabled,\n visual: getIconByFieldType(type)\n }\n ]\n };\n }\n });\n // Items with no category attribute are set in the root of returned array\n if (categoryObj[undefined] && categoryObj[undefined].items) {\n result.push(...categoryObj[undefined].items);\n delete categoryObj[undefined];\n }\n const keys = Object.keys(categoryObj);\n // Items with category attribute are grouped inside the nested category object\n keys.forEach(key => {\n result.push(categoryObj[key]);\n });\n\n return result;\n}\n\nconst Footer = memo(({ onCancel, onSubmit, disabled }) => {\n const [translate] = useTranslate();\n return (\n <Flex container={{ justify: 'between' }}>\n <Button onClick={onCancel} data-testid='cancel'>\n {translate('Cancel')}\n </Button>\n <Button variant='primary' onClick={onSubmit} disabled={disabled} data-testid='submit'>\n {translate('Submit')}\n </Button>\n </Flex>\n );\n});\n\nFooter.displayName = 'Footer';\n\nFooter.propTypes = {\n onCancel: PropTypes.func.isRequired,\n onSubmit: PropTypes.func.isRequired,\n disabled: PropTypes.bool.isRequired\n};\n\nconst StyledMenu = styled(Menu)`\n width: 16rem;\n`;\nexport function ColumnSelectorControl(props) {\n const { data, onSubmit, onCancel, action } = props;\n\n const initialSelectedColumns = useMemo(\n () =>\n new Set(\n menuHelpers\n .flatten(data)\n .filter(item => item.selected)\n .map(item => item.id)\n ),\n [data]\n );\n\n const [searchText, setSearchText] = useState('');\n const [searchRef, setSearchRef] = useElement(null);\n const [items, setItems] = useState(data);\n const selectedColumns = useMemo(\n () => new Set(menuHelpers.getSelected(items).map(item => item.id)),\n [items]\n );\n\n useEffect(() => {\n if (searchRef) {\n searchRef.focus();\n }\n }, [searchRef]);\n\n const itemsToRender = useMemo(() => {\n return menuHelpers.mapTree(\n searchText\n ? menuHelpers\n .flatten(items)\n .filter(({ primary }) => primary.toLowerCase().includes(searchText.toLowerCase()))\n : items,\n item => {\n return {\n ...item,\n visual: item.visual,\n selected: item.items ? undefined : item.selected,\n disabled: item.selected && action === colsVisibility && selectedColumns.size <= 1\n };\n }\n );\n }, [searchText, items]);\n\n const modifiedColumns = useMemo(\n () => getModifiedColumns(initialSelectedColumns, selectedColumns),\n [initialSelectedColumns, selectedColumns, action]\n );\n\n const isSubmitEnabled =\n !(action === colsVisibility && selectedColumns.size === 0) && modifiedColumns.length > 0;\n return (\n <StyledMenu\n items={itemsToRender}\n mode='multi-select'\n onItemClick={(id, args) => {\n setItems(cur => menuHelpers.toggleSelected(cur, id, args.mode));\n }}\n role='listbox'\n focusControlEl={searchRef || undefined}\n header={<SearchInput value={searchText} onSearchChange={setSearchText} ref={setSearchRef} />}\n footer={\n <Footer\n onCancel={onCancel}\n onSubmit={() => onSubmit(modifiedColumns)}\n disabled={!isSubmitEnabled}\n />\n }\n />\n );\n}\n\nColumnSelectorControl.propTypes = {\n data: PropTypes.arrayOf(PropTypes.object).isRequired,\n onSubmit: PropTypes.func.isRequired,\n onCancel: PropTypes.func.isRequired,\n action: PropTypes.string.isRequired\n};\n\nfunction ColumnSelector({ dispatch, columns, action, finishPopOver }) {\n const transformed = useMemo(() => transformData(columns, action), [columns, action]);\n\n const onSubmitHandler = useCallback(\n changedCols => {\n if (changedCols.length > 0) {\n dispatch(changedCols);\n }\n finishPopOver();\n },\n [dispatch]\n );\n\n return (\n <ColumnSelectorControl\n data={transformed}\n onSubmit={onSubmitHandler}\n onCancel={finishPopOver}\n action={action}\n />\n );\n}\n\nColumnSelector.propTypes = {\n dispatch: PropTypes.func.isRequired,\n columns: PropTypes.arrayOf(PropTypes.object).isRequired,\n action: PropTypes.string.isRequired,\n finishPopOver: PropTypes.func.isRequired\n};\n\nexport default memo(ColumnSelector);\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare const _default: import("react").MemoExoticComponent<typeof DebugInfo>;
|
|
2
2
|
export default _default;
|
|
3
|
-
declare function DebugInfo({ view,
|
|
3
|
+
declare function DebugInfo({ view, target, onClose }: {
|
|
4
4
|
view: any;
|
|
5
|
-
|
|
5
|
+
target: any;
|
|
6
6
|
onClose: any;
|
|
7
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
declare namespace DebugInfo {
|
|
@@ -10,9 +10,7 @@ declare namespace DebugInfo {
|
|
|
10
10
|
let view: PropTypes.Validator<{
|
|
11
11
|
[x: string]: any;
|
|
12
12
|
}>;
|
|
13
|
-
let
|
|
14
|
-
current: PropTypes.Requireable<Element>;
|
|
15
|
-
}>>>;
|
|
13
|
+
let target: PropTypes.Requireable<Element>;
|
|
16
14
|
let onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
15
|
}
|
|
18
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DebugInfo.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/DebugInfo.jsx"],"names":[],"mappings":";;AAgBA;;;;4CAwCC
|
|
1
|
+
{"version":3,"file":"DebugInfo.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/DebugInfo.jsx"],"names":[],"mappings":";;AAgBA;;;;4CAwCC;;;;;;;;;;sBAvDqB,YAAY"}
|
|
@@ -11,7 +11,7 @@ const fieldsConfiguration = [
|
|
|
11
11
|
{ field: debugInfoFields.timeTaken, defaultLabel: 'Time taken' },
|
|
12
12
|
{ field: debugInfoFields.insightId, defaultLabel: 'Insight ID', hideIfNotAvailable: true }
|
|
13
13
|
];
|
|
14
|
-
function DebugInfo({ view,
|
|
14
|
+
function DebugInfo({ view, target, onClose }) {
|
|
15
15
|
const [translate] = useTranslate();
|
|
16
16
|
const debugInfoList = view.debugInfo.length === 0 ? [{}] : view.debugInfo;
|
|
17
17
|
const headingRef = useRef(null);
|
|
@@ -30,11 +30,11 @@ function DebugInfo({ view, targetRef, onClose }) {
|
|
|
30
30
|
});
|
|
31
31
|
return result;
|
|
32
32
|
}, []));
|
|
33
|
-
return (_jsx(InfoDialog, { target:
|
|
33
|
+
return (_jsx(InfoDialog, { target: target, heading: translate('Query info'), onDismiss: onClose, children: formattedData.map((debugInfoEntry, index) => (_jsx(FieldValueList, { className: 'debug-record', variant: 'inline', fields: debugInfoEntry }, index))) }));
|
|
34
34
|
}
|
|
35
35
|
DebugInfo.propTypes = {
|
|
36
36
|
view: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
37
|
-
|
|
37
|
+
target: PropTypes.instanceOf(Element),
|
|
38
38
|
onClose: PropTypes.func
|
|
39
39
|
};
|
|
40
40
|
export default memo(DebugInfo);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DebugInfo.js","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/DebugInfo.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,mBAAmB,GAAG;IAC1B,EAAE,KAAK,EAAE,eAAe,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE;IAC3D,EAAE,KAAK,EAAE,eAAe,CAAC,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE;IAC9D,EAAE,KAAK,EAAE,eAAe,CAAC,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE;IAClE,EAAE,KAAK,EAAE,eAAe,CAAC,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE;IAChE,EAAE,KAAK,EAAE,eAAe,CAAC,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,IAAI,EAAE;CAC3F,CAAC;AAEF,SAAS,SAAS,CAAC,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,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AI,CAAC,SAAS,CAAC,CAAC","sourcesContent":["import { memo, useRef, useEffect } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { FieldValueList, Text, InfoDialog } from '@pega/cosmos-react-core';\n\nimport useTranslate from '../../Hooks/useTranslate';\nimport { debugInfoFields } from '../../constants';\n\nconst fieldsConfiguration = [\n { field: debugInfoFields.className, defaultLabel: 'Class' },\n { field: debugInfoFields.dataPage, defaultLabel: 'Data page' },\n { field: debugInfoFields.dataSource, defaultLabel: 'Data source' },\n { field: debugInfoFields.timeTaken, defaultLabel: 'Time taken' },\n { field: debugInfoFields.insightId, defaultLabel: 'Insight ID', hideIfNotAvailable: true }\n];\n\nfunction DebugInfo({ view, target, onClose }) {\n const [translate] = useTranslate();\n const debugInfoList = view.debugInfo.length === 0 ? [{}] : view.debugInfo;\n const headingRef = useRef(null);\n\n useEffect(() => {\n if (headingRef.current) headingRef.current.focus();\n }, []);\n\n const formattedData = debugInfoList.map(debugInfoEntry =>\n fieldsConfiguration.reduce((result, { field, defaultLabel, hideIfNotAvailable }) => {\n if (hideIfNotAvailable && !debugInfoEntry[field]) {\n return result;\n }\n result.push({\n id: field,\n name: translate(defaultLabel),\n value: debugInfoEntry[field] ? (\n <Text variant='h5' data-testid={`field-${field}`}>\n {debugInfoEntry[field]}\n </Text>\n ) : undefined\n });\n return result;\n }, [])\n );\n\n return (\n <InfoDialog target={target} heading={translate('Query info')} onDismiss={onClose}>\n {formattedData.map((debugInfoEntry, index) => (\n <FieldValueList\n className='debug-record'\n variant='inline'\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n fields={debugInfoEntry}\n />\n ))}\n </InfoDialog>\n );\n}\n\nDebugInfo.propTypes = {\n view: PropTypes.objectOf(PropTypes.any).isRequired,\n target: PropTypes.instanceOf(Element),\n onClose: PropTypes.func\n};\n\nexport default memo(DebugInfo);\n"]}
|
|
@@ -6,6 +6,7 @@ declare namespace FieldSelector {
|
|
|
6
6
|
let columns: PropTypes.Validator<any[]>;
|
|
7
7
|
let onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
8
8
|
let disabled: PropTypes.Requireable<boolean>;
|
|
9
|
+
let readOnly: PropTypes.Requireable<boolean>;
|
|
9
10
|
let fieldProp: PropTypes.Requireable<string>;
|
|
10
11
|
let label: PropTypes.Validator<string>;
|
|
11
12
|
let labelHidden: PropTypes.Requireable<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldSelector.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/FieldSelector.jsx"],"names":[],"mappings":";AASA,
|
|
1
|
+
{"version":3,"file":"FieldSelector.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/FieldSelector.jsx"],"names":[],"mappings":";AASA,oFAiEC;;;;;;;;;;;;;sBAzEqB,YAAY"}
|
|
@@ -5,7 +5,7 @@ import { ComboBox, menuHelpers } from '@pega/cosmos-react-core';
|
|
|
5
5
|
import useTranslate from '../../Hooks/useTranslate';
|
|
6
6
|
import getMenuItemsFromColumns from './utils/utils';
|
|
7
7
|
function FieldSelector(props) {
|
|
8
|
-
const { value, onChange, columns, disabled = false, fieldProp, label, labelHidden } = props;
|
|
8
|
+
const { value, onChange, columns, disabled = false, readOnly, fieldProp, label, labelHidden } = props;
|
|
9
9
|
const [translate] = useTranslate();
|
|
10
10
|
const items = useMemo(() => getMenuItemsFromColumns(columns, fieldProp, value), [columns, value, fieldProp]);
|
|
11
11
|
const selected = useMemo(() => {
|
|
@@ -25,7 +25,7 @@ function FieldSelector(props) {
|
|
|
25
25
|
? menuHelpers.flatten(items).filter(({ primary }) => filterRegex.test(primary))
|
|
26
26
|
: items;
|
|
27
27
|
}, [filterRegex, items]);
|
|
28
|
-
return (_jsx(ComboBox, { label: label, labelHidden: labelHidden, disabled: disabled, placeholder: translate('Select field'), mode: 'single-select', value: filterValue, testId: 'FieldSelector', onChange: ev => {
|
|
28
|
+
return (_jsx(ComboBox, { label: label, labelHidden: labelHidden, disabled: disabled, readOnly: readOnly, placeholder: translate('Select field'), mode: 'single-select', value: filterValue, testId: 'FieldSelector', onChange: ev => {
|
|
29
29
|
setFilterValue(ev.target.value);
|
|
30
30
|
}, selected: { items: selected }, menu: {
|
|
31
31
|
items: filteredItems,
|
|
@@ -45,6 +45,7 @@ FieldSelector.propTypes = {
|
|
|
45
45
|
columns: PropTypes.arrayOf(PropTypes.any).isRequired,
|
|
46
46
|
onChange: PropTypes.func.isRequired,
|
|
47
47
|
disabled: PropTypes.bool,
|
|
48
|
+
readOnly: PropTypes.bool,
|
|
48
49
|
fieldProp: PropTypes.string,
|
|
49
50
|
label: PropTypes.string.isRequired,
|
|
50
51
|
labelHidden: PropTypes.bool
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldSelector.js","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/FieldSelector.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAEpD,OAAO,uBAAuB,MAAM,eAAe,CAAC;AAEpD,SAAS,aAAa,CAAC,KAAK;IAC1B,MAAM,
|
|
1
|
+
{"version":3,"file":"FieldSelector.js","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/FieldSelector.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAEpD,OAAO,uBAAuB,MAAM,eAAe,CAAC;AAEpD,SAAS,aAAa,CAAC,KAAK;IAC1B,MAAM,EACJ,KAA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AAM,CAAC,UAAU;IAClC,WAAW,EAAE,SAAS,CAAC,IAAI;CAC5B,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useMemo, useState } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { ComboBox, menuHelpers } from '@pega/cosmos-react-core';\n\nimport useTranslate from '../../Hooks/useTranslate';\n\nimport getMenuItemsFromColumns from './utils/utils';\n\nfunction FieldSelector(props) {\n const {\n value,\n onChange,\n columns,\n disabled = false,\n readOnly,\n fieldProp,\n label,\n labelHidden\n } = props;\n const [translate] = useTranslate();\n\n const items = useMemo(\n () => getMenuItemsFromColumns(columns, fieldProp, value),\n [columns, value, fieldProp]\n );\n const selected = useMemo(() => {\n const selectedItem = menuHelpers.getItem(items, value);\n return selectedItem ? { id: selectedItem.id, text: selectedItem.primary } : undefined;\n }, [items, value]);\n\n const [filterValue, setFilterValue] = useState(undefined); // NOTE: `undefined` is needed to show the current selection\n const filterRegex = useMemo(() => {\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping\n // Literal string match from input, not user regex input.\n return filterValue\n ? new RegExp(filterValue.replace(/[.*+\\-?^${}()|[\\]\\\\]/g, '\\\\$&'), 'i')\n : undefined;\n }, [filterValue]);\n\n const filteredItems = useMemo(() => {\n return filterRegex\n ? menuHelpers.flatten(items).filter(({ primary }) => filterRegex.test(primary))\n : items;\n }, [filterRegex, items]);\n\n return (\n <ComboBox\n label={label}\n labelHidden={labelHidden}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={translate('Select field')}\n mode='single-select'\n value={filterValue}\n testId='FieldSelector'\n onChange={ev => {\n setFilterValue(ev.target.value);\n }}\n selected={{ items: selected }}\n menu={{\n items: filteredItems,\n mode: 'single-select',\n accent: filterRegex,\n emptyText: 'No items',\n onItemClick: id => {\n if (disabled) return;\n onChange(id);\n setFilterValue(undefined); // To show the selected value in the input\n }\n }}\n onDropdownButtonClick={() => {}}\n />\n );\n}\n\nFieldSelector.propTypes = {\n value: PropTypes.string,\n columns: PropTypes.arrayOf(PropTypes.any).isRequired,\n onChange: PropTypes.func.isRequired,\n disabled: PropTypes.bool,\n readOnly: PropTypes.bool,\n fieldProp: PropTypes.string,\n label: PropTypes.string.isRequired,\n labelHidden: PropTypes.bool\n};\n\nexport default FieldSelector;\n"]}
|
|
@@ -13,10 +13,4 @@ export interface GroupingOptions {
|
|
|
13
13
|
datetime: (DateFunction | undefined)[];
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
/** Option object in the DateFunctionSelector component */
|
|
17
|
-
export interface DateSelectorOption {
|
|
18
|
-
key: DateFunction | 'NONE';
|
|
19
|
-
dateFunction: DateFunction | undefined;
|
|
20
|
-
label: string;
|
|
21
|
-
}
|
|
22
16
|
//# sourceMappingURL=Grouping.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grouping.types.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/Grouping.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iFAAiF,CAAC;AAEpH,8HAA8H;AAC9H,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAE;QACT,CAAC,QAAQ,EAAE,MAAM,GAAG;YAClB,SAAS,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAC;YACxC,SAAS,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAC;SACzC,CAAC;KACH,CAAC;IACF,iBAAiB,EAAE;QACjB,IAAI,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAC;QACnC,QAAQ,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAC;KACxC,CAAC;CACH
|
|
1
|
+
{"version":3,"file":"Grouping.types.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/Grouping.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iFAAiF,CAAC;AAEpH,8HAA8H;AAC9H,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAE;QACT,CAAC,QAAQ,EAAE,MAAM,GAAG;YAClB,SAAS,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAC;YACxC,SAAS,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAC;SACzC,CAAC;KACH,CAAC;IACF,iBAAiB,EAAE;QACjB,IAAI,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAC;QACnC,QAAQ,EAAE,CAAC,YAAY,GAAG,SAAS,CAAC,EAAE,CAAC;KACxC,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grouping.types.js","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/Grouping.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DateFunction } from '@pega/cosmos-react-condition-builder/lib/components/ConditionBuilder/core/types';\n\n/** Metadata used to identify which fields and which date functions are/aren't available for selection in the Grouping menu */\nexport interface GroupingOptions {\n exhaustedFields: Set<string>;\n dateFuncs: {\n [columnId: string]: {\n exhausted: (DateFunction | undefined)[];\n available: (DateFunction | undefined)[];\n };\n };\n dateGroupVariants: {\n date: (DateFunction | undefined)[];\n datetime: (DateFunction | undefined)[];\n };\n}\n
|
|
1
|
+
{"version":3,"file":"Grouping.types.js","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/Grouping.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DateFunction } from '@pega/cosmos-react-condition-builder/lib/components/ConditionBuilder/core/types';\n\n/** Metadata used to identify which fields and which date functions are/aren't available for selection in the Grouping menu */\nexport interface GroupingOptions {\n exhaustedFields: Set<string>;\n dateFuncs: {\n [columnId: string]: {\n exhausted: (DateFunction | undefined)[];\n available: (DateFunction | undefined)[];\n };\n };\n dateGroupVariants: {\n date: (DateFunction | undefined)[];\n datetime: (DateFunction | undefined)[];\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleToolbar.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/SimpleToolbar.jsx"],"names":[],"mappings":"AAYA;;
|
|
1
|
+
{"version":3,"file":"SimpleToolbar.d.ts","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/SimpleToolbar.jsx"],"names":[],"mappings":"AAYA;;4CA+BC;;;;;;;;;sBA3CqB,YAAY"}
|
|
@@ -7,14 +7,15 @@ import getCount from './utils/getCount';
|
|
|
7
7
|
import AnnounceRowsCount from './AnnounceRowsCount';
|
|
8
8
|
import ValidateMessage from './ValidateMessage';
|
|
9
9
|
import useFormControlProps from './hooks/useFormControlProps';
|
|
10
|
-
import
|
|
10
|
+
import useWrapAction from './hooks/useWrapAction';
|
|
11
11
|
export default function SimpleToolbar({ view }) {
|
|
12
12
|
const { meta: { title, template } = {}, state, getContext, showCount, refreshNotification, type: { forceRefresh } } = view;
|
|
13
13
|
const { getRequiredDef } = getContext();
|
|
14
14
|
const { validatemessage } = getRequiredDef() || {};
|
|
15
|
-
const count = showCount ? getCount({ view }) :
|
|
15
|
+
const count = showCount ? getCount({ view }) : undefined;
|
|
16
16
|
const formControlProps = useFormControlProps(view);
|
|
17
|
-
|
|
17
|
+
const wrapAction = useWrapAction(view);
|
|
18
|
+
return (_jsxs(AnnounceRowsCount, { state: state, count: count, children: [_jsx(ValidateMessage, { message: validatemessage, children: _jsx(ListToolbar, { name: title, count: count, formControlProps: formControlProps, wrap: template === REPEATING_STRUCTURE_TEMPLATES.TABLE && wrapAction }) }), refreshNotification && (_jsx(RefreshBanner, { refreshNotification: refreshNotification, forceRefresh: forceRefresh }))] }));
|
|
18
19
|
}
|
|
19
20
|
SimpleToolbar.propTypes = {
|
|
20
21
|
view: PropTypes.objectOf(PropTypes.any).isRequired
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleToolbar.js","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/SimpleToolbar.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,mBAAmB,MAAM,6BAA6B,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"SimpleToolbar.js","sourceRoot":"","sources":["../../../../Core/Components/Toolbar/SimpleToolbar.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAE/E,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,mBAAmB,MAAM,6BAA6B,CAAC;AAC9D,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,IAAI,EAAE;IAC5C,MAAM,EACJ,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,EAC9B,KAAK,EACL,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,IAAI,EAAE,EAAE,YAAY,EAAE,EACvB,GAAG,IAAI,CAAC;IACT,MAAM,EAAE,cAAc,EAAE,GAAG,UAAU,EAAE,CAAC;IACxC,MAAM,EAAE,eAAe,EAAE,GAAG,cAAc,EAAE,IAAI,EAAE,CAAC;IACnD,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACzD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAEvC,OAAO,CACL,MAAC,iBAAiB,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,aAC3C,KAAC,eAAe,IAAC,OAAO,EAAE,eAAe,YACvC,KAAC,WAAW,IACV,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,QAAQ,KAAK,6BAA6B,CAAC,KAAK,IAAI,UAAU,GACpE,GAEc,EACjB,mBAAmB,IAAI,CACtB,KAAC,aAAa,IAAC,mBAAmB,EAAE,mBAAmB,EAAE,YAAY,EAAE,YAAY,GAAI,CACxF,IACiB,CACrB,CAAC;AACJ,CAAC;AAED,aAAa,CAAC,SAAS,GAAG;IACxB,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,UAAU;CACnD,CAAC","sourcesContent":["import PropTypes from 'prop-types';\n\nimport { ListToolbar } from '@pega/cosmos-react-core';\nimport { REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';\n\nimport RefreshBanner from './RefreshBanner';\nimport getCount from './utils/getCount';\nimport AnnounceRowsCount from './AnnounceRowsCount';\nimport ValidateMessage from './ValidateMessage';\nimport useFormControlProps from './hooks/useFormControlProps';\nimport useWrapAction from './hooks/useWrapAction';\n\nexport default function SimpleToolbar({ view }) {\n const {\n meta: { title, template } = {},\n state,\n getContext,\n showCount,\n refreshNotification,\n type: { forceRefresh }\n } = view;\n const { getRequiredDef } = getContext();\n const { validatemessage } = getRequiredDef() || {};\n const count = showCount ? getCount({ view }) : undefined;\n const formControlProps = useFormControlProps(view);\n const wrapAction = useWrapAction(view);\n\n return (\n <AnnounceRowsCount state={state} count={count}>\n <ValidateMessage message={validatemessage}>\n <ListToolbar\n name={title}\n count={count}\n formControlProps={formControlProps}\n wrap={template === REPEATING_STRUCTURE_TEMPLATES.TABLE && wrapAction}\n />\n {/* FIXME: This implementation of error status should be considered temporary until an official, and properly accessible, spec is determined. */}\n </ValidateMessage>\n {refreshNotification && (\n <RefreshBanner refreshNotification={refreshNotification} forceRefresh={forceRefresh} />\n )}\n </AnnounceRowsCount>\n );\n}\n\nSimpleToolbar.propTypes = {\n view: PropTypes.objectOf(PropTypes.any).isRequired\n};\n"]}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let groupingOptions: PropTypes.Validator<{
|
|
13
|
-
[x: string]: any;
|
|
14
|
-
}>;
|
|
15
|
-
let columns: PropTypes.Validator<any[]>;
|
|
16
|
-
let onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
-
}
|
|
1
|
+
import type { Group } from 'pega-repeating-structures-core/lib/types/State.types';
|
|
2
|
+
import type { RsCoreTypes } from 'pega-repeating-structures-core';
|
|
3
|
+
import type { GroupingOptions } from '../../Grouping.types';
|
|
4
|
+
import type { AppliedGroup } from './useGroup';
|
|
5
|
+
interface DateFunctionSelectorProps {
|
|
6
|
+
template: RsCoreTypes.Meta['template'];
|
|
7
|
+
group: AppliedGroup;
|
|
8
|
+
groupingOptions: GroupingOptions;
|
|
9
|
+
dateFunctions: RsCoreTypes.Meta['dateFunctions'];
|
|
10
|
+
columns: RsCoreTypes.Column[];
|
|
11
|
+
onChange: (newFunc: Group['dateFunction']) => void;
|
|
18
12
|
}
|
|
19
|
-
|
|
13
|
+
/** Renders a Date-function selector in a grouping row if applicable */
|
|
14
|
+
declare const DateFunctionSelector: ({ template, group, groupingOptions, dateFunctions, columns, onChange }: DateFunctionSelectorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
export default DateFunctionSelector;
|
|
20
16
|
//# sourceMappingURL=DateFunctionSelector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateFunctionSelector.d.ts","sourceRoot":"","sources":["../../../../../../Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.
|
|
1
|
+
{"version":3,"file":"DateFunctionSelector.d.ts","sourceRoot":"","sources":["../../../../../../Core/Components/Toolbar/hooks/useGroup/DateFunctionSelector.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sDAAsD,CAAC;AAOlF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAGlE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS/C,UAAU,yBAAyB;IACjC,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvC,KAAK,EAAE,YAAY,CAAC;IACpB,eAAe,EAAE,eAAe,CAAC;IACjC,aAAa,EAAE,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACjD,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC;IAC9B,QAAQ,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACpD;AAED,uEAAuE;AACvE,QAAA,MAAM,oBAAoB,GAAI,wEAO3B,yBAAyB,mDAmE3B,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import styled from 'styled-components';
|
|
5
4
|
import { Option, Select } from '@pega/cosmos-react-core';
|
|
6
|
-
import { dateFunctionLabels } from 'pega-repeating-structures-core';
|
|
5
|
+
import { dateFunctionLabels, FieldType, REPEATING_STRUCTURE_TEMPLATES } from 'pega-repeating-structures-core';
|
|
7
6
|
import useTranslate from '../../../../Hooks/useTranslate';
|
|
8
7
|
import { getFieldType } from './utils';
|
|
9
8
|
const StyledDateFuncWrapper = styled.div `
|
|
10
9
|
width: 9rem;
|
|
11
10
|
`;
|
|
11
|
+
const timelineAllowedDateFunctions = ['YEARS', 'QUARTERS', 'MONTHS', 'DAYS'];
|
|
12
12
|
/** Renders a Date-function selector in a grouping row if applicable */
|
|
13
|
-
const DateFunctionSelector =
|
|
14
|
-
const { group, groupingOptions, dateFunctions, columns, onChange } = props;
|
|
13
|
+
const DateFunctionSelector = ({ template, group, groupingOptions, dateFunctions, columns, onChange }) => {
|
|
15
14
|
const [translate] = useTranslate();
|
|
16
15
|
const fieldType = getFieldType(group.columnId, columns);
|
|
17
16
|
/**
|
|
18
17
|
* Determine what all date functions (if any) can be used for the given fieldType
|
|
19
|
-
* @type { import("./Grouping.types").DateSelectorOption[] }
|
|
20
18
|
*/
|
|
21
19
|
const allOptions = useMemo(() => {
|
|
22
20
|
// If date functions are disabled or not applicable to the current field type
|
|
23
|
-
if (!dateFunctions || !
|
|
21
|
+
if (!dateFunctions || !(fieldType === FieldType.DATE || fieldType === FieldType.DATE_TIME)) {
|
|
24
22
|
return [];
|
|
25
23
|
}
|
|
26
24
|
return [
|
|
27
25
|
// Date functions applicable for the given field type
|
|
28
|
-
...dateFunctions[fieldType ===
|
|
26
|
+
...dateFunctions[fieldType === FieldType.DATE ? 'DATE_ONLY' : 'DATE_TIME'].map(f => ({
|
|
29
27
|
key: f,
|
|
30
28
|
dateFunction: f,
|
|
31
29
|
label: translate(dateFunctionLabels[f])
|
|
@@ -43,15 +41,16 @@ const DateFunctionSelector = props => {
|
|
|
43
41
|
// NOTE: Doing it this way to preserve the order of options.
|
|
44
42
|
// If we instead appended `group.dateFunction` to `available`, the order or options will change on further selections.
|
|
45
43
|
const { available } = groupingOptions.dateFuncs[group.columnId];
|
|
46
|
-
const optionsToUse = allOptions.filter(o =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
const optionsToUse = allOptions.filter(o => {
|
|
45
|
+
if (template === REPEATING_STRUCTURE_TEMPLATES.TIMELINE &&
|
|
46
|
+
(!o.dateFunction || !timelineAllowedDateFunctions.includes(o.dateFunction))) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
return available.includes(o.dateFunction) || o.dateFunction === group.dateFunction;
|
|
50
|
+
});
|
|
51
|
+
return (_jsx(StyledDateFuncWrapper, { children: _jsx(Select, { label: 'Date function', labelHidden: true, "data-testid": 'GroupingDateFuncSelector', value: group.dateFunction || 'NONE', onChange: e => {
|
|
52
|
+
onChange(e.target.value === 'NONE' ? undefined : e.target.value);
|
|
53
|
+
}, children: optionsToUse.map(o => (_jsx(Option, { value: o.key, children: translate(o.label) }, o.key))) }) }));
|
|
55
54
|
};
|
|
56
55
|
export default DateFunctionSelector;
|
|
57
56
|
//# sourceMappingURL=DateFunctionSelector.js.map
|