@portnet/ui 6.0.1 → 6.0.3
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/CHANGELOG.md +737 -0
- package/dist/esm/index.js +90 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/v2/__tests__/AppMain.test.js +130 -0
- package/dist/esm/v2/__tests__/AppMain.test.js.map +1 -0
- package/dist/esm/v2/__tests__/ChartFigure.test.js +180 -0
- package/dist/esm/v2/__tests__/ChartFigure.test.js.map +1 -0
- package/dist/esm/v2/__tests__/DataGridRowActionsPropagation.test.js +150 -0
- package/dist/esm/v2/__tests__/DataGridRowActionsPropagation.test.js.map +1 -0
- package/dist/esm/v2/__tests__/DrawerTactileTargets.test.js +93 -0
- package/dist/esm/v2/__tests__/DrawerTactileTargets.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FieldError.test.js +71 -39
- package/dist/esm/v2/__tests__/FieldError.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FieldNaming.test.js +160 -0
- package/dist/esm/v2/__tests__/FieldNaming.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FieldWidth.test.js +146 -0
- package/dist/esm/v2/__tests__/FieldWidth.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FileCard.test.js +18 -18
- package/dist/esm/v2/__tests__/FileCard.test.js.map +1 -1
- package/dist/esm/v2/__tests__/FormikCheckbox.test.js +173 -0
- package/dist/esm/v2/__tests__/FormikCheckbox.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FormikDateTimePicker.test.js +236 -0
- package/dist/esm/v2/__tests__/FormikDateTimePicker.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FormikDisplayWidth.test.js +101 -0
- package/dist/esm/v2/__tests__/FormikDisplayWidth.test.js.map +1 -0
- package/dist/esm/v2/__tests__/FormikRadioGroup.test.js +299 -0
- package/dist/esm/v2/__tests__/FormikRadioGroup.test.js.map +1 -0
- package/dist/esm/v2/__tests__/MobileRowCard.test.js +44 -43
- package/dist/esm/v2/__tests__/MobileRowCard.test.js.map +1 -1
- package/dist/esm/v2/__tests__/PreviewDrawer.test.js +165 -0
- package/dist/esm/v2/__tests__/PreviewDrawer.test.js.map +1 -0
- package/dist/esm/v2/__tests__/ReferentielFieldContainer.test.js +156 -0
- package/dist/esm/v2/__tests__/ReferentielFieldContainer.test.js.map +1 -0
- package/dist/esm/v2/__tests__/SectionErrorBoundary.test.js +37 -52
- package/dist/esm/v2/__tests__/SectionErrorBoundary.test.js.map +1 -1
- package/dist/esm/v2/__tests__/apiError.test.js +50 -69
- package/dist/esm/v2/__tests__/apiError.test.js.map +1 -1
- package/dist/esm/v2/__tests__/banned-patterns.test.js +41 -122
- package/dist/esm/v2/__tests__/banned-patterns.test.js.map +1 -1
- package/dist/esm/v2/__tests__/chart-palette.test.js +204 -0
- package/dist/esm/v2/__tests__/chart-palette.test.js.map +1 -0
- package/dist/esm/v2/__tests__/contrast-palette.test.js +42 -74
- package/dist/esm/v2/__tests__/contrast-palette.test.js.map +1 -1
- package/dist/esm/v2/__tests__/cssVariables.test.js +44 -51
- package/dist/esm/v2/__tests__/cssVariables.test.js.map +1 -1
- package/dist/esm/v2/__tests__/fileValidation.test.js +134 -0
- package/dist/esm/v2/__tests__/fileValidation.test.js.map +1 -0
- package/dist/esm/v2/__tests__/filterCriteria.test.js +321 -0
- package/dist/esm/v2/__tests__/filterCriteria.test.js.map +1 -0
- package/dist/esm/v2/__tests__/fmtDate.test.js +68 -0
- package/dist/esm/v2/__tests__/fmtDate.test.js.map +1 -0
- package/dist/esm/v2/__tests__/gap-leakage-refonte.test.js +218 -0
- package/dist/esm/v2/__tests__/gap-leakage-refonte.test.js.map +1 -0
- package/dist/esm/v2/__tests__/labels-merge.test.js +17 -22
- package/dist/esm/v2/__tests__/labels-merge.test.js.map +1 -1
- package/dist/esm/v2/__tests__/locale-fallback.test.js +35 -40
- package/dist/esm/v2/__tests__/locale-fallback.test.js.map +1 -1
- package/dist/esm/v2/__tests__/reviveSavedCriteria.test.js +143 -0
- package/dist/esm/v2/__tests__/reviveSavedCriteria.test.js.map +1 -0
- package/dist/esm/v2/__tests__/rowActions.test.js +182 -0
- package/dist/esm/v2/__tests__/rowActions.test.js.map +1 -0
- package/dist/esm/v2/__tests__/useFocusOnRouteChange.test.js +155 -0
- package/dist/esm/v2/__tests__/useFocusOnRouteChange.test.js.map +1 -0
- package/dist/esm/v2/__tests__/useFocusTrap.test.js +266 -402
- package/dist/esm/v2/__tests__/useFocusTrap.test.js.map +1 -1
- package/dist/esm/v2/__tests__/usePrefersReducedMotion.test.js +120 -0
- package/dist/esm/v2/__tests__/usePrefersReducedMotion.test.js.map +1 -0
- package/dist/esm/v2/components/Accordion.js +48 -70
- package/dist/esm/v2/components/Accordion.js.map +1 -1
- package/dist/esm/v2/components/ActionStrip.js +31 -43
- package/dist/esm/v2/components/ActionStrip.js.map +1 -1
- package/dist/esm/v2/components/Banner.js +25 -22
- package/dist/esm/v2/components/Banner.js.map +1 -1
- package/dist/esm/v2/components/Busy.js +14 -19
- package/dist/esm/v2/components/Busy.js.map +1 -1
- package/dist/esm/v2/components/Button.js +34 -45
- package/dist/esm/v2/components/Button.js.map +1 -1
- package/dist/esm/v2/components/CategoryTag.js +44 -27
- package/dist/esm/v2/components/CategoryTag.js.map +1 -1
- package/dist/esm/v2/components/Checkbox.js +32 -38
- package/dist/esm/v2/components/Checkbox.js.map +1 -1
- package/dist/esm/v2/components/Chip.js +23 -36
- package/dist/esm/v2/components/Chip.js.map +1 -1
- package/dist/esm/v2/components/Combobox.js +112 -136
- package/dist/esm/v2/components/Combobox.js.map +1 -1
- package/dist/esm/v2/components/CommandPalette.js +113 -198
- package/dist/esm/v2/components/CommandPalette.js.map +1 -1
- package/dist/esm/v2/components/ConfirmDialog.js +36 -45
- package/dist/esm/v2/components/ConfirmDialog.js.map +1 -1
- package/dist/esm/v2/components/DatePicker.js +78 -81
- package/dist/esm/v2/components/DatePicker.js.map +1 -1
- package/dist/esm/v2/components/DateRangePicker.js +63 -74
- package/dist/esm/v2/components/DateRangePicker.js.map +1 -1
- package/dist/esm/v2/components/DateTimePicker.js +118 -90
- package/dist/esm/v2/components/DateTimePicker.js.map +1 -1
- package/dist/esm/v2/components/Drawer.js +71 -65
- package/dist/esm/v2/components/Drawer.js.map +1 -1
- package/dist/esm/v2/components/Dropzone.js +130 -177
- package/dist/esm/v2/components/Dropzone.js.map +1 -1
- package/dist/esm/v2/components/EmptyState.js +9 -9
- package/dist/esm/v2/components/EmptyState.js.map +1 -1
- package/dist/esm/v2/components/FavoriteToggle.js +24 -33
- package/dist/esm/v2/components/FavoriteToggle.js.map +1 -1
- package/dist/esm/v2/components/Field.js +210 -52
- package/dist/esm/v2/components/Field.js.map +1 -1
- package/dist/esm/v2/components/FieldError.js +9 -13
- package/dist/esm/v2/components/FieldError.js.map +1 -1
- package/dist/esm/v2/components/FieldHelp.js +28 -49
- package/dist/esm/v2/components/FieldHelp.js.map +1 -1
- package/dist/esm/v2/components/FileCard.js +14 -19
- package/dist/esm/v2/components/FileCard.js.map +1 -1
- package/dist/esm/v2/components/FilterTab.js +22 -31
- package/dist/esm/v2/components/FilterTab.js.map +1 -1
- package/dist/esm/v2/components/ForbiddenPage.js +28 -8
- package/dist/esm/v2/components/ForbiddenPage.js.map +1 -1
- package/dist/esm/v2/components/FormGrid.js +48 -54
- package/dist/esm/v2/components/FormGrid.js.map +1 -1
- package/dist/esm/v2/components/FormikDisplay.js +98 -24
- package/dist/esm/v2/components/FormikDisplay.js.map +1 -1
- package/dist/esm/v2/components/Input.js +75 -34
- package/dist/esm/v2/components/Input.js.map +1 -1
- package/dist/esm/v2/components/KPICard.js +42 -51
- package/dist/esm/v2/components/KPICard.js.map +1 -1
- package/dist/esm/v2/components/KPIStrip.js +9 -15
- package/dist/esm/v2/components/KPIStrip.js.map +1 -1
- package/dist/esm/v2/components/KV.js +16 -23
- package/dist/esm/v2/components/KV.js.map +1 -1
- package/dist/esm/v2/components/KVGrid.js +15 -23
- package/dist/esm/v2/components/KVGrid.js.map +1 -1
- package/dist/esm/v2/components/Layout.js +81 -117
- package/dist/esm/v2/components/Layout.js.map +1 -1
- package/dist/esm/v2/components/MobileRowCard.js +64 -75
- package/dist/esm/v2/components/MobileRowCard.js.map +1 -1
- package/dist/esm/v2/components/Modal.js +44 -53
- package/dist/esm/v2/components/Modal.js.map +1 -1
- package/dist/esm/v2/components/NetworkErrorPage.js +28 -11
- package/dist/esm/v2/components/NetworkErrorPage.js.map +1 -1
- package/dist/esm/v2/components/NotFoundPage.js +28 -9
- package/dist/esm/v2/components/NotFoundPage.js.map +1 -1
- package/dist/esm/v2/components/NumberInput.js +77 -107
- package/dist/esm/v2/components/NumberInput.js.map +1 -1
- package/dist/esm/v2/components/OverflowMenu.js +24 -42
- package/dist/esm/v2/components/OverflowMenu.js.map +1 -1
- package/dist/esm/v2/components/PdfViewer.js +24 -33
- package/dist/esm/v2/components/PdfViewer.js.map +1 -1
- package/dist/esm/v2/components/ProgressBar.js +28 -36
- package/dist/esm/v2/components/ProgressBar.js.map +1 -1
- package/dist/esm/v2/components/Radio.js +49 -57
- package/dist/esm/v2/components/Radio.js.map +1 -1
- package/dist/esm/v2/components/SectionErrorBoundary.js +84 -130
- package/dist/esm/v2/components/SectionErrorBoundary.js.map +1 -1
- package/dist/esm/v2/components/SectionHeader.js +24 -31
- package/dist/esm/v2/components/SectionHeader.js.map +1 -1
- package/dist/esm/v2/components/Segmented.js +59 -84
- package/dist/esm/v2/components/Segmented.js.map +1 -1
- package/dist/esm/v2/components/Select.js +100 -138
- package/dist/esm/v2/components/Select.js.map +1 -1
- package/dist/esm/v2/components/ServerErrorPage.js +27 -10
- package/dist/esm/v2/components/ServerErrorPage.js.map +1 -1
- package/dist/esm/v2/components/Skeleton.js +81 -96
- package/dist/esm/v2/components/Skeleton.js.map +1 -1
- package/dist/esm/v2/components/SkipLink.js +6 -7
- package/dist/esm/v2/components/SkipLink.js.map +1 -1
- package/dist/esm/v2/components/Spinner.js +13 -22
- package/dist/esm/v2/components/Spinner.js.map +1 -1
- package/dist/esm/v2/components/Status.js +14 -25
- package/dist/esm/v2/components/Status.js.map +1 -1
- package/dist/esm/v2/components/Stepper.js +68 -71
- package/dist/esm/v2/components/Stepper.js.map +1 -1
- package/dist/esm/v2/components/Surface.js +25 -44
- package/dist/esm/v2/components/Surface.js.map +1 -1
- package/dist/esm/v2/components/Switch.js +21 -29
- package/dist/esm/v2/components/Switch.js.map +1 -1
- package/dist/esm/v2/components/TabPanel.js +84 -0
- package/dist/esm/v2/components/TabPanel.js.map +1 -0
- package/dist/esm/v2/components/Tabs.js +43 -19
- package/dist/esm/v2/components/Tabs.js.map +1 -1
- package/dist/esm/v2/components/TelInput.js +75 -108
- package/dist/esm/v2/components/TelInput.js.map +1 -1
- package/dist/esm/v2/components/Textarea.js +21 -30
- package/dist/esm/v2/components/Textarea.js.map +1 -1
- package/dist/esm/v2/components/TimePicker.js +59 -69
- package/dist/esm/v2/components/TimePicker.js.map +1 -1
- package/dist/esm/v2/components/Toast.js +109 -163
- package/dist/esm/v2/components/Toast.js.map +1 -1
- package/dist/esm/v2/components/Tooltip.js +18 -31
- package/dist/esm/v2/components/Tooltip.js.map +1 -1
- package/dist/esm/v2/components/_ErrorPageBody.js +6 -5
- package/dist/esm/v2/components/_ErrorPageBody.js.map +1 -1
- package/dist/esm/v2/components/_pickerShared.js +2 -2
- package/dist/esm/v2/components/_pickerShared.js.map +1 -1
- package/dist/esm/v2/components/index.js +64 -0
- package/dist/esm/v2/components/index.js.map +1 -1
- package/dist/esm/v2/hooks/index.js +62 -0
- package/dist/esm/v2/hooks/index.js.map +1 -1
- package/dist/esm/v2/hooks/useAppliedFilters.js +112 -0
- package/dist/esm/v2/hooks/useAppliedFilters.js.map +1 -0
- package/dist/esm/v2/hooks/useDebouncedCallback.js +82 -0
- package/dist/esm/v2/hooks/useDebouncedCallback.js.map +1 -0
- package/dist/esm/v2/hooks/useDelayedFlag.js +5 -19
- package/dist/esm/v2/hooks/useDelayedFlag.js.map +1 -1
- package/dist/esm/v2/hooks/useDensity.js +13 -17
- package/dist/esm/v2/hooks/useDensity.js.map +1 -1
- package/dist/esm/v2/hooks/useFocusFirstError.js +25 -33
- package/dist/esm/v2/hooks/useFocusFirstError.js.map +1 -1
- package/dist/esm/v2/hooks/useFocusOnRouteChange.js +81 -0
- package/dist/esm/v2/hooks/useFocusOnRouteChange.js.map +1 -0
- package/dist/esm/v2/hooks/useFocusTrap.js +19 -23
- package/dist/esm/v2/hooks/useFocusTrap.js.map +1 -1
- package/dist/esm/v2/hooks/useFormAutoSave.js +38 -53
- package/dist/esm/v2/hooks/useFormAutoSave.js.map +1 -1
- package/dist/esm/v2/hooks/useFormCompletionProgress.js +32 -51
- package/dist/esm/v2/hooks/useFormCompletionProgress.js.map +1 -1
- package/dist/esm/v2/hooks/useKeyboardShortcuts.js +125 -0
- package/dist/esm/v2/hooks/useKeyboardShortcuts.js.map +1 -0
- package/dist/esm/v2/hooks/usePrefersReducedMotion.js +99 -0
- package/dist/esm/v2/hooks/usePrefersReducedMotion.js.map +1 -0
- package/dist/esm/v2/hooks/useResolvedDensity.js +2 -10
- package/dist/esm/v2/hooks/useResolvedDensity.js.map +1 -1
- package/dist/esm/v2/hooks/useSortedRows.js +3 -5
- package/dist/esm/v2/hooks/useSortedRows.js.map +1 -1
- package/dist/esm/v2/hooks/useTabLoading.js +6 -21
- package/dist/esm/v2/hooks/useTabLoading.js.map +1 -1
- package/dist/esm/v2/index.js +14 -4
- package/dist/esm/v2/index.js.map +1 -1
- package/dist/esm/v2/modalContext.js +2 -2
- package/dist/esm/v2/modalContext.js.map +1 -1
- package/dist/esm/v2/models/favorite.js.map +1 -1
- package/dist/esm/v2/models/personalization.js.map +1 -1
- package/dist/esm/v2/models/referentiel.js.map +1 -1
- package/dist/esm/v2/models/savedFilter.js.map +1 -1
- package/dist/esm/v2/patterns/ActionBar.js +115 -159
- package/dist/esm/v2/patterns/ActionBar.js.map +1 -1
- package/dist/esm/v2/patterns/AppMain.js +108 -0
- package/dist/esm/v2/patterns/AppMain.js.map +1 -0
- package/dist/esm/v2/patterns/BulkActionBar.js +31 -34
- package/dist/esm/v2/patterns/BulkActionBar.js.map +1 -1
- package/dist/esm/v2/patterns/ChartFigure.js +151 -0
- package/dist/esm/v2/patterns/ChartFigure.js.map +1 -0
- package/dist/esm/v2/patterns/CollapsibleDataGrid.js +111 -152
- package/dist/esm/v2/patterns/CollapsibleDataGrid.js.map +1 -1
- package/dist/esm/v2/patterns/ColumnsToggle.js +43 -77
- package/dist/esm/v2/patterns/ColumnsToggle.js.map +1 -1
- package/dist/esm/v2/patterns/DataGrid.js +221 -255
- package/dist/esm/v2/patterns/DataGrid.js.map +1 -1
- package/dist/esm/v2/patterns/DataGridSettingsMenu.js +76 -94
- package/dist/esm/v2/patterns/DataGridSettingsMenu.js.map +1 -1
- package/dist/esm/v2/patterns/DataGridToolbar.js +85 -89
- package/dist/esm/v2/patterns/DataGridToolbar.js.map +1 -1
- package/dist/esm/v2/patterns/DataGridVirtualized.js +141 -182
- package/dist/esm/v2/patterns/DataGridVirtualized.js.map +1 -1
- package/dist/esm/v2/patterns/DeleteResourceConfirmDialog.js +26 -30
- package/dist/esm/v2/patterns/DeleteResourceConfirmDialog.js.map +1 -1
- package/dist/esm/v2/patterns/DetailSplit.js +108 -0
- package/dist/esm/v2/patterns/DetailSplit.js.map +1 -0
- package/dist/esm/v2/patterns/FavoriteColumn.js +26 -75
- package/dist/esm/v2/patterns/FavoriteColumn.js.map +1 -1
- package/dist/esm/v2/patterns/FavoritesFilter.js +30 -39
- package/dist/esm/v2/patterns/FavoritesFilter.js.map +1 -1
- package/dist/esm/v2/patterns/FilterTabBar.js +112 -0
- package/dist/esm/v2/patterns/FilterTabBar.js.map +1 -0
- package/dist/esm/v2/patterns/FormErrorSummary.js +12 -13
- package/dist/esm/v2/patterns/FormErrorSummary.js.map +1 -1
- package/dist/esm/v2/patterns/FormPageShell.js +43 -41
- package/dist/esm/v2/patterns/FormPageShell.js.map +1 -1
- package/dist/esm/v2/patterns/FormSection.js +30 -38
- package/dist/esm/v2/patterns/FormSection.js.map +1 -1
- package/dist/esm/v2/patterns/FormikCheckbox.js +130 -0
- package/dist/esm/v2/patterns/FormikCheckbox.js.map +1 -0
- package/dist/esm/v2/patterns/FormikCheckboxGroup.js +56 -60
- package/dist/esm/v2/patterns/FormikCheckboxGroup.js.map +1 -1
- package/dist/esm/v2/patterns/FormikCombobox.js +51 -66
- package/dist/esm/v2/patterns/FormikCombobox.js.map +1 -1
- package/dist/esm/v2/patterns/FormikDatePicker.js +51 -99
- package/dist/esm/v2/patterns/FormikDatePicker.js.map +1 -1
- package/dist/esm/v2/patterns/FormikDateTimePicker.js +136 -0
- package/dist/esm/v2/patterns/FormikDateTimePicker.js.map +1 -0
- package/dist/esm/v2/patterns/FormikErrorFocus.js +22 -23
- package/dist/esm/v2/patterns/FormikErrorFocus.js.map +1 -1
- package/dist/esm/v2/patterns/FormikErrorSummary.js +89 -0
- package/dist/esm/v2/patterns/FormikErrorSummary.js.map +1 -0
- package/dist/esm/v2/patterns/FormikFile.js +94 -78
- package/dist/esm/v2/patterns/FormikFile.js.map +1 -1
- package/dist/esm/v2/patterns/FormikInput.js +40 -50
- package/dist/esm/v2/patterns/FormikInput.js.map +1 -1
- package/dist/esm/v2/patterns/FormikRadioGroup.js +129 -0
- package/dist/esm/v2/patterns/FormikRadioGroup.js.map +1 -0
- package/dist/esm/v2/patterns/FormikReferentielField.js +49 -59
- package/dist/esm/v2/patterns/FormikReferentielField.js.map +1 -1
- package/dist/esm/v2/patterns/FormikSelect.js +64 -84
- package/dist/esm/v2/patterns/FormikSelect.js.map +1 -1
- package/dist/esm/v2/patterns/FormikTextarea.js +30 -43
- package/dist/esm/v2/patterns/FormikTextarea.js.map +1 -1
- package/dist/esm/v2/patterns/KeyboardShortcutsHelp.js +64 -65
- package/dist/esm/v2/patterns/KeyboardShortcutsHelp.js.map +1 -1
- package/dist/esm/v2/patterns/NetworkErrorBanner.js +6 -7
- package/dist/esm/v2/patterns/NetworkErrorBanner.js.map +1 -1
- package/dist/esm/v2/patterns/PageContent.js +10 -14
- package/dist/esm/v2/patterns/PageContent.js.map +1 -1
- package/dist/esm/v2/patterns/PreviewDrawer.js +153 -0
- package/dist/esm/v2/patterns/PreviewDrawer.js.map +1 -0
- package/dist/esm/v2/patterns/ReferentielField.js +327 -312
- package/dist/esm/v2/patterns/ReferentielField.js.map +1 -1
- package/dist/esm/v2/patterns/RowFavoriteToggle.js +127 -0
- package/dist/esm/v2/patterns/RowFavoriteToggle.js.map +1 -0
- package/dist/esm/v2/patterns/SaveFilterDialog.js +38 -66
- package/dist/esm/v2/patterns/SaveFilterDialog.js.map +1 -1
- package/dist/esm/v2/patterns/SavedFiltersMenu.js +62 -81
- package/dist/esm/v2/patterns/SavedFiltersMenu.js.map +1 -1
- package/dist/esm/v2/patterns/SkeletonPageShell.js +106 -129
- package/dist/esm/v2/patterns/SkeletonPageShell.js.map +1 -1
- package/dist/esm/v2/patterns/SortableHeader.js +22 -45
- package/dist/esm/v2/patterns/SortableHeader.js.map +1 -1
- package/dist/esm/v2/patterns/Tour.js +94 -120
- package/dist/esm/v2/patterns/Tour.js.map +1 -1
- package/dist/esm/v2/patterns/_dataGridShared.js +107 -128
- package/dist/esm/v2/patterns/_dataGridShared.js.map +1 -1
- package/dist/esm/v2/patterns/_pickerSerialisation.js +72 -0
- package/dist/esm/v2/patterns/_pickerSerialisation.js.map +1 -0
- package/dist/esm/v2/patterns/_sort.js +17 -33
- package/dist/esm/v2/patterns/_sort.js.map +1 -1
- package/dist/esm/v2/patterns/_useColumnReorder.js +122 -160
- package/dist/esm/v2/patterns/_useColumnReorder.js.map +1 -1
- package/dist/esm/v2/patterns/_useColumnResize.js +78 -96
- package/dist/esm/v2/patterns/_useColumnResize.js.map +1 -1
- package/dist/esm/v2/patterns/filterCriteria.js +102 -0
- package/dist/esm/v2/patterns/filterCriteria.js.map +1 -0
- package/dist/esm/v2/patterns/index.js +235 -0
- package/dist/esm/v2/patterns/index.js.map +1 -1
- package/dist/esm/v2/patterns/rowActions.js +223 -0
- package/dist/esm/v2/patterns/rowActions.js.map +1 -0
- package/dist/esm/v2/personalization/PersonalizationProvider.js +50 -47
- package/dist/esm/v2/personalization/PersonalizationProvider.js.map +1 -1
- package/dist/esm/v2/personalization/adapters/_storageKey.js +5 -5
- package/dist/esm/v2/personalization/adapters/_storageKey.js.map +1 -1
- package/dist/esm/v2/personalization/adapters/createLocalStorageAdapter.js +22 -23
- package/dist/esm/v2/personalization/adapters/createLocalStorageAdapter.js.map +1 -1
- package/dist/esm/v2/personalization/adapters/createMemoryAdapter.js +13 -13
- package/dist/esm/v2/personalization/adapters/createMemoryAdapter.js.map +1 -1
- package/dist/esm/v2/personalization/capabilities/favorites.js +36 -60
- package/dist/esm/v2/personalization/capabilities/favorites.js.map +1 -1
- package/dist/esm/v2/personalization/capabilities/favoritesView.js +22 -34
- package/dist/esm/v2/personalization/capabilities/favoritesView.js.map +1 -1
- package/dist/esm/v2/personalization/capabilities/gridPreferences.js +203 -0
- package/dist/esm/v2/personalization/capabilities/gridPreferences.js.map +1 -0
- package/dist/esm/v2/personalization/capabilities/index.js +5 -0
- package/dist/esm/v2/personalization/capabilities/index.js.map +1 -1
- package/dist/esm/v2/personalization/capabilities/reviveSavedCriteria.js +119 -0
- package/dist/esm/v2/personalization/capabilities/reviveSavedCriteria.js.map +1 -0
- package/dist/esm/v2/personalization/capabilities/savedFilters.js +90 -98
- package/dist/esm/v2/personalization/capabilities/savedFilters.js.map +1 -1
- package/dist/esm/v2/personalization/createPersonalizationStore.js +78 -181
- package/dist/esm/v2/personalization/createPersonalizationStore.js.map +1 -1
- package/dist/esm/v2/personalization/index.js +35 -0
- package/dist/esm/v2/personalization/index.js.map +1 -1
- package/dist/esm/v2/personalization/personalizationContext.js +9 -9
- package/dist/esm/v2/personalization/personalizationContext.js.map +1 -1
- package/dist/esm/v2/personalization/schema.js +8 -9
- package/dist/esm/v2/personalization/schema.js.map +1 -1
- package/dist/esm/v2/referentiel/ReferentielProvider.js +27 -42
- package/dist/esm/v2/referentiel/ReferentielProvider.js.map +1 -1
- package/dist/esm/v2/referentiel/types.js +2 -0
- package/dist/esm/v2/referentiel/types.js.map +1 -0
- package/dist/esm/v2/referentiel/useReferentielClient.js +10 -11
- package/dist/esm/v2/referentiel/useReferentielClient.js.map +1 -1
- package/dist/esm/v2/referentiel/useReferentielOptions.js +60 -117
- package/dist/esm/v2/referentiel/useReferentielOptions.js.map +1 -1
- package/dist/esm/v2/referentiel/useReferentielSearch.js +37 -91
- package/dist/esm/v2/referentiel/useReferentielSearch.js.map +1 -1
- package/dist/esm/v2/theme/_brand.js +8 -24
- package/dist/esm/v2/theme/_brand.js.map +1 -1
- package/dist/esm/v2/theme/_brandSecondary.js +8 -24
- package/dist/esm/v2/theme/_brandSecondary.js.map +1 -1
- package/dist/esm/v2/theme/createPortnetTheme.js +51 -61
- package/dist/esm/v2/theme/createPortnetTheme.js.map +1 -1
- package/dist/esm/v2/theme/cssVariables.js +62 -69
- package/dist/esm/v2/theme/cssVariables.js.map +1 -1
- package/dist/esm/v2/theme/index.js +5 -5
- package/dist/esm/v2/theme/index.js.map +1 -1
- package/dist/esm/v2/tokens/breakpoints.js +14 -14
- package/dist/esm/v2/tokens/breakpoints.js.map +1 -1
- package/dist/esm/v2/tokens/chart.js +261 -0
- package/dist/esm/v2/tokens/chart.js.map +1 -0
- package/dist/esm/v2/tokens/colors.js +22 -22
- package/dist/esm/v2/tokens/colors.js.map +1 -1
- package/dist/esm/v2/tokens/density.js +62 -7
- package/dist/esm/v2/tokens/density.js.map +1 -1
- package/dist/esm/v2/tokens/index.js +49 -34
- package/dist/esm/v2/tokens/index.js.map +1 -1
- package/dist/esm/v2/tokens/motion.js +12 -20
- package/dist/esm/v2/tokens/motion.js.map +1 -1
- package/dist/esm/v2/tokens/radius.js +1 -1
- package/dist/esm/v2/tokens/radius.js.map +1 -1
- package/dist/esm/v2/tokens/shadows.js +6 -6
- package/dist/esm/v2/tokens/shadows.js.map +1 -1
- package/dist/esm/v2/tokens/spacing.js +2 -2
- package/dist/esm/v2/tokens/spacing.js.map +1 -1
- package/dist/esm/v2/tokens/state.js +1 -1
- package/dist/esm/v2/tokens/state.js.map +1 -1
- package/dist/esm/v2/tokens/statusPalette.js +17 -21
- package/dist/esm/v2/tokens/statusPalette.js.map +1 -1
- package/dist/esm/v2/tokens/tokens.json +6 -1
- package/dist/esm/v2/tokens/typography.js +13 -13
- package/dist/esm/v2/tokens/typography.js.map +1 -1
- package/dist/esm/v2/tokens/zIndex.js +1 -1
- package/dist/esm/v2/tokens/zIndex.js.map +1 -1
- package/dist/esm/v2/types/datagrid.js.map +1 -1
- package/dist/esm/v2/utils/apiError.js +16 -37
- package/dist/esm/v2/utils/apiError.js.map +1 -1
- package/dist/esm/v2/utils/contrast.js +31 -32
- package/dist/esm/v2/utils/contrast.js.map +1 -1
- package/dist/esm/v2/utils/cx.js +5 -25
- package/dist/esm/v2/utils/cx.js.map +1 -1
- package/dist/esm/v2/utils/fileDownload.js +23 -26
- package/dist/esm/v2/utils/fileDownload.js.map +1 -1
- package/dist/esm/v2/utils/fileValidation.js +209 -0
- package/dist/esm/v2/utils/fileValidation.js.map +1 -0
- package/dist/esm/v2/utils/fmtDate.js +111 -0
- package/dist/esm/v2/utils/fmtDate.js.map +1 -0
- package/dist/esm/v2/utils/fmtMoney.js +8 -10
- package/dist/esm/v2/utils/fmtMoney.js.map +1 -1
- package/dist/esm/v2/utils/formikErrors.js +78 -0
- package/dist/esm/v2/utils/formikErrors.js.map +1 -0
- package/dist/esm/v2/utils/index.js +35 -2
- package/dist/esm/v2/utils/index.js.map +1 -1
- package/dist/esm/v2/utils/mergeLabels.js +7 -12
- package/dist/esm/v2/utils/mergeLabels.js.map +1 -1
- package/dist/esm/v2/utils/networkStatus.js +12 -12
- package/dist/esm/v2/utils/networkStatus.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +122 -47
- package/dist/index.js.map +1 -1
- package/dist/v2/__tests__/AppMain.test.js +133 -0
- package/dist/v2/__tests__/AppMain.test.js.map +1 -0
- package/dist/v2/__tests__/ChartFigure.test.js +183 -0
- package/dist/v2/__tests__/ChartFigure.test.js.map +1 -0
- package/dist/v2/__tests__/DataGridRowActionsPropagation.test.js +153 -0
- package/dist/v2/__tests__/DataGridRowActionsPropagation.test.js.map +1 -0
- package/dist/v2/__tests__/DrawerTactileTargets.test.js +94 -0
- package/dist/v2/__tests__/DrawerTactileTargets.test.js.map +1 -0
- package/dist/v2/__tests__/FieldError.test.js +98 -69
- package/dist/v2/__tests__/FieldError.test.js.map +1 -1
- package/dist/v2/__tests__/FieldNaming.test.js +161 -0
- package/dist/v2/__tests__/FieldNaming.test.js.map +1 -0
- package/dist/v2/__tests__/FieldWidth.test.js +148 -0
- package/dist/v2/__tests__/FieldWidth.test.js.map +1 -0
- package/dist/v2/__tests__/FileCard.test.js +45 -48
- package/dist/v2/__tests__/FileCard.test.js.map +1 -1
- package/dist/v2/__tests__/FormikCheckbox.test.js +175 -0
- package/dist/v2/__tests__/FormikCheckbox.test.js.map +1 -0
- package/dist/v2/__tests__/FormikDateTimePicker.test.js +237 -0
- package/dist/v2/__tests__/FormikDateTimePicker.test.js.map +1 -0
- package/dist/v2/__tests__/FormikDisplayWidth.test.js +102 -0
- package/dist/v2/__tests__/FormikDisplayWidth.test.js.map +1 -0
- package/dist/v2/__tests__/FormikRadioGroup.test.js +300 -0
- package/dist/v2/__tests__/FormikRadioGroup.test.js.map +1 -0
- package/dist/v2/__tests__/MobileRowCard.test.js +100 -102
- package/dist/v2/__tests__/MobileRowCard.test.js.map +1 -1
- package/dist/v2/__tests__/PreviewDrawer.test.js +169 -0
- package/dist/v2/__tests__/PreviewDrawer.test.js.map +1 -0
- package/dist/v2/__tests__/ReferentielFieldContainer.test.js +159 -0
- package/dist/v2/__tests__/ReferentielFieldContainer.test.js.map +1 -0
- package/dist/v2/__tests__/SectionErrorBoundary.test.js +53 -68
- package/dist/v2/__tests__/SectionErrorBoundary.test.js.map +1 -1
- package/dist/v2/__tests__/apiError.test.js +50 -69
- package/dist/v2/__tests__/apiError.test.js.map +1 -1
- package/dist/v2/__tests__/banned-patterns.test.js +42 -123
- package/dist/v2/__tests__/banned-patterns.test.js.map +1 -1
- package/dist/v2/__tests__/chart-palette.test.js +205 -0
- package/dist/v2/__tests__/chart-palette.test.js.map +1 -0
- package/dist/v2/__tests__/contrast-palette.test.js +42 -74
- package/dist/v2/__tests__/contrast-palette.test.js.map +1 -1
- package/dist/v2/__tests__/cssVariables.test.js +44 -51
- package/dist/v2/__tests__/cssVariables.test.js.map +1 -1
- package/dist/v2/__tests__/fileValidation.test.js +136 -0
- package/dist/v2/__tests__/fileValidation.test.js.map +1 -0
- package/dist/v2/__tests__/filterCriteria.test.js +324 -0
- package/dist/v2/__tests__/filterCriteria.test.js.map +1 -0
- package/dist/v2/__tests__/fmtDate.test.js +69 -0
- package/dist/v2/__tests__/fmtDate.test.js.map +1 -0
- package/dist/v2/__tests__/gap-leakage-refonte.test.js +221 -0
- package/dist/v2/__tests__/gap-leakage-refonte.test.js.map +1 -0
- package/dist/v2/__tests__/labels-merge.test.js +38 -46
- package/dist/v2/__tests__/labels-merge.test.js.map +1 -1
- package/dist/v2/__tests__/locale-fallback.test.js +47 -52
- package/dist/v2/__tests__/locale-fallback.test.js.map +1 -1
- package/dist/v2/__tests__/reviveSavedCriteria.test.js +144 -0
- package/dist/v2/__tests__/reviveSavedCriteria.test.js.map +1 -0
- package/dist/v2/__tests__/rowActions.test.js +186 -0
- package/dist/v2/__tests__/rowActions.test.js.map +1 -0
- package/dist/v2/__tests__/useFocusOnRouteChange.test.js +156 -0
- package/dist/v2/__tests__/useFocusOnRouteChange.test.js.map +1 -0
- package/dist/v2/__tests__/useFocusTrap.test.js +270 -407
- package/dist/v2/__tests__/useFocusTrap.test.js.map +1 -1
- package/dist/v2/__tests__/usePrefersReducedMotion.test.js +123 -0
- package/dist/v2/__tests__/usePrefersReducedMotion.test.js.map +1 -0
- package/dist/v2/components/Accordion.js +60 -82
- package/dist/v2/components/Accordion.js.map +1 -1
- package/dist/v2/components/ActionStrip.js +40 -52
- package/dist/v2/components/ActionStrip.js.map +1 -1
- package/dist/v2/components/Banner.js +42 -41
- package/dist/v2/components/Banner.js.map +1 -1
- package/dist/v2/components/Busy.js +22 -27
- package/dist/v2/components/Busy.js.map +1 -1
- package/dist/v2/components/Button.js +39 -50
- package/dist/v2/components/Button.js.map +1 -1
- package/dist/v2/components/CategoryTag.d.ts.map +1 -1
- package/dist/v2/components/CategoryTag.js +49 -32
- package/dist/v2/components/CategoryTag.js.map +1 -1
- package/dist/v2/components/Checkbox.js +39 -45
- package/dist/v2/components/Checkbox.js.map +1 -1
- package/dist/v2/components/Chip.js +29 -42
- package/dist/v2/components/Chip.js.map +1 -1
- package/dist/v2/components/Combobox.js +122 -144
- package/dist/v2/components/Combobox.js.map +1 -1
- package/dist/v2/components/CommandPalette.js +138 -225
- package/dist/v2/components/CommandPalette.js.map +1 -1
- package/dist/v2/components/ConfirmDialog.js +46 -56
- package/dist/v2/components/ConfirmDialog.js.map +1 -1
- package/dist/v2/components/DatePicker.js +81 -86
- package/dist/v2/components/DatePicker.js.map +1 -1
- package/dist/v2/components/DateRangePicker.js +77 -87
- package/dist/v2/components/DateRangePicker.js.map +1 -1
- package/dist/v2/components/DateTimePicker.d.ts.map +1 -1
- package/dist/v2/components/DateTimePicker.js +121 -95
- package/dist/v2/components/DateTimePicker.js.map +1 -1
- package/dist/v2/components/Drawer.d.ts.map +1 -1
- package/dist/v2/components/Drawer.js +93 -88
- package/dist/v2/components/Drawer.js.map +1 -1
- package/dist/v2/components/Dropzone.js +150 -196
- package/dist/v2/components/Dropzone.js.map +1 -1
- package/dist/v2/components/EmptyState.js +18 -20
- package/dist/v2/components/EmptyState.js.map +1 -1
- package/dist/v2/components/FavoriteToggle.js +28 -39
- package/dist/v2/components/FavoriteToggle.js.map +1 -1
- package/dist/v2/components/Field.d.ts +121 -5
- package/dist/v2/components/Field.d.ts.map +1 -1
- package/dist/v2/components/Field.js +221 -62
- package/dist/v2/components/Field.js.map +1 -1
- package/dist/v2/components/FieldError.js +18 -21
- package/dist/v2/components/FieldError.js.map +1 -1
- package/dist/v2/components/FieldHelp.js +40 -60
- package/dist/v2/components/FieldHelp.js.map +1 -1
- package/dist/v2/components/FileCard.js +27 -31
- package/dist/v2/components/FileCard.js.map +1 -1
- package/dist/v2/components/FilterTab.js +30 -38
- package/dist/v2/components/FilterTab.js.map +1 -1
- package/dist/v2/components/ForbiddenPage.d.ts +25 -1
- package/dist/v2/components/ForbiddenPage.d.ts.map +1 -1
- package/dist/v2/components/ForbiddenPage.js +37 -17
- package/dist/v2/components/ForbiddenPage.js.map +1 -1
- package/dist/v2/components/FormGrid.js +53 -59
- package/dist/v2/components/FormGrid.js.map +1 -1
- package/dist/v2/components/FormikDisplay.d.ts +50 -1
- package/dist/v2/components/FormikDisplay.d.ts.map +1 -1
- package/dist/v2/components/FormikDisplay.js +108 -33
- package/dist/v2/components/FormikDisplay.js.map +1 -1
- package/dist/v2/components/Input.d.ts +40 -0
- package/dist/v2/components/Input.d.ts.map +1 -1
- package/dist/v2/components/Input.js +81 -41
- package/dist/v2/components/Input.js.map +1 -1
- package/dist/v2/components/KPICard.js +57 -67
- package/dist/v2/components/KPICard.js.map +1 -1
- package/dist/v2/components/KPIStrip.js +16 -22
- package/dist/v2/components/KPIStrip.js.map +1 -1
- package/dist/v2/components/KV.js +25 -31
- package/dist/v2/components/KV.js.map +1 -1
- package/dist/v2/components/KVGrid.js +19 -26
- package/dist/v2/components/KVGrid.js.map +1 -1
- package/dist/v2/components/Layout.js +91 -120
- package/dist/v2/components/Layout.js.map +1 -1
- package/dist/v2/components/MobileRowCard.js +79 -91
- package/dist/v2/components/MobileRowCard.js.map +1 -1
- package/dist/v2/components/Modal.js +61 -69
- package/dist/v2/components/Modal.js.map +1 -1
- package/dist/v2/components/NetworkErrorPage.d.ts +19 -1
- package/dist/v2/components/NetworkErrorPage.d.ts.map +1 -1
- package/dist/v2/components/NetworkErrorPage.js +38 -21
- package/dist/v2/components/NetworkErrorPage.js.map +1 -1
- package/dist/v2/components/NotFoundPage.d.ts +17 -1
- package/dist/v2/components/NotFoundPage.d.ts.map +1 -1
- package/dist/v2/components/NotFoundPage.js +37 -18
- package/dist/v2/components/NotFoundPage.js.map +1 -1
- package/dist/v2/components/NumberInput.js +88 -118
- package/dist/v2/components/NumberInput.js.map +1 -1
- package/dist/v2/components/OverflowMenu.js +38 -56
- package/dist/v2/components/OverflowMenu.js.map +1 -1
- package/dist/v2/components/PdfViewer.js +34 -45
- package/dist/v2/components/PdfViewer.js.map +1 -1
- package/dist/v2/components/ProgressBar.js +42 -49
- package/dist/v2/components/ProgressBar.js.map +1 -1
- package/dist/v2/components/Radio.js +59 -67
- package/dist/v2/components/Radio.js.map +1 -1
- package/dist/v2/components/SectionErrorBoundary.js +90 -135
- package/dist/v2/components/SectionErrorBoundary.js.map +1 -1
- package/dist/v2/components/SectionHeader.js +34 -41
- package/dist/v2/components/SectionHeader.js.map +1 -1
- package/dist/v2/components/Segmented.js +69 -93
- package/dist/v2/components/Segmented.js.map +1 -1
- package/dist/v2/components/Select.d.ts +26 -2
- package/dist/v2/components/Select.d.ts.map +1 -1
- package/dist/v2/components/Select.js +120 -155
- package/dist/v2/components/Select.js.map +1 -1
- package/dist/v2/components/ServerErrorPage.d.ts +27 -1
- package/dist/v2/components/ServerErrorPage.d.ts.map +1 -1
- package/dist/v2/components/ServerErrorPage.js +37 -20
- package/dist/v2/components/ServerErrorPage.js.map +1 -1
- package/dist/v2/components/Skeleton.js +86 -100
- package/dist/v2/components/Skeleton.js.map +1 -1
- package/dist/v2/components/SkipLink.js +9 -12
- package/dist/v2/components/SkipLink.js.map +1 -1
- package/dist/v2/components/Spinner.js +16 -25
- package/dist/v2/components/Spinner.js.map +1 -1
- package/dist/v2/components/Status.js +18 -29
- package/dist/v2/components/Status.js.map +1 -1
- package/dist/v2/components/Stepper.js +80 -82
- package/dist/v2/components/Stepper.js.map +1 -1
- package/dist/v2/components/Surface.js +34 -49
- package/dist/v2/components/Surface.js.map +1 -1
- package/dist/v2/components/Switch.js +29 -37
- package/dist/v2/components/Switch.js.map +1 -1
- package/dist/v2/components/TabPanel.d.ts +17 -0
- package/dist/v2/components/TabPanel.d.ts.map +1 -0
- package/dist/v2/components/TabPanel.js +90 -0
- package/dist/v2/components/TabPanel.js.map +1 -0
- package/dist/v2/components/Tabs.d.ts +25 -0
- package/dist/v2/components/Tabs.d.ts.map +1 -1
- package/dist/v2/components/Tabs.js +53 -29
- package/dist/v2/components/Tabs.js.map +1 -1
- package/dist/v2/components/TelInput.js +80 -115
- package/dist/v2/components/TelInput.js.map +1 -1
- package/dist/v2/components/Textarea.js +26 -35
- package/dist/v2/components/Textarea.js.map +1 -1
- package/dist/v2/components/TimePicker.js +62 -74
- package/dist/v2/components/TimePicker.js.map +1 -1
- package/dist/v2/components/Toast.js +119 -174
- package/dist/v2/components/Toast.js.map +1 -1
- package/dist/v2/components/Tooltip.js +23 -38
- package/dist/v2/components/Tooltip.js.map +1 -1
- package/dist/v2/components/_ErrorPageBody.js +15 -16
- package/dist/v2/components/_ErrorPageBody.js.map +1 -1
- package/dist/v2/components/_pickerShared.js +5 -5
- package/dist/v2/components/_pickerShared.js.map +1 -1
- package/dist/v2/components/index.d.ts +67 -1
- package/dist/v2/components/index.d.ts.map +1 -1
- package/dist/v2/components/index.js +153 -136
- package/dist/v2/components/index.js.map +1 -1
- package/dist/v2/hooks/index.d.ts +65 -0
- package/dist/v2/hooks/index.d.ts.map +1 -1
- package/dist/v2/hooks/index.js +63 -24
- package/dist/v2/hooks/index.js.map +1 -1
- package/dist/v2/hooks/useAppliedFilters.d.ts +102 -0
- package/dist/v2/hooks/useAppliedFilters.d.ts.map +1 -0
- package/dist/v2/hooks/useAppliedFilters.js +117 -0
- package/dist/v2/hooks/useAppliedFilters.js.map +1 -0
- package/dist/v2/hooks/useDebouncedCallback.d.ts +64 -0
- package/dist/v2/hooks/useDebouncedCallback.d.ts.map +1 -0
- package/dist/v2/hooks/useDebouncedCallback.js +87 -0
- package/dist/v2/hooks/useDebouncedCallback.js.map +1 -0
- package/dist/v2/hooks/useDelayedFlag.js +6 -20
- package/dist/v2/hooks/useDelayedFlag.js.map +1 -1
- package/dist/v2/hooks/useDensity.d.ts.map +1 -1
- package/dist/v2/hooks/useDensity.js +14 -18
- package/dist/v2/hooks/useDensity.js.map +1 -1
- package/dist/v2/hooks/useFocusFirstError.js +26 -34
- package/dist/v2/hooks/useFocusFirstError.js.map +1 -1
- package/dist/v2/hooks/useFocusOnRouteChange.d.ts +65 -0
- package/dist/v2/hooks/useFocusOnRouteChange.d.ts.map +1 -0
- package/dist/v2/hooks/useFocusOnRouteChange.js +88 -0
- package/dist/v2/hooks/useFocusOnRouteChange.js.map +1 -0
- package/dist/v2/hooks/useFocusTrap.js +20 -24
- package/dist/v2/hooks/useFocusTrap.js.map +1 -1
- package/dist/v2/hooks/useFormAutoSave.d.ts +4 -4
- package/dist/v2/hooks/useFormAutoSave.d.ts.map +1 -1
- package/dist/v2/hooks/useFormAutoSave.js +39 -54
- package/dist/v2/hooks/useFormAutoSave.js.map +1 -1
- package/dist/v2/hooks/useFormCompletionProgress.d.ts +1 -1
- package/dist/v2/hooks/useFormCompletionProgress.d.ts.map +1 -1
- package/dist/v2/hooks/useFormCompletionProgress.js +33 -52
- package/dist/v2/hooks/useFormCompletionProgress.js.map +1 -1
- package/dist/v2/hooks/useKeyboardShortcuts.d.ts +25 -0
- package/dist/v2/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/dist/v2/hooks/useKeyboardShortcuts.js +132 -0
- package/dist/v2/hooks/useKeyboardShortcuts.js.map +1 -0
- package/dist/v2/hooks/usePrefersReducedMotion.d.ts +56 -0
- package/dist/v2/hooks/usePrefersReducedMotion.d.ts.map +1 -0
- package/dist/v2/hooks/usePrefersReducedMotion.js +105 -0
- package/dist/v2/hooks/usePrefersReducedMotion.js.map +1 -0
- package/dist/v2/hooks/useResolvedDensity.js +5 -13
- package/dist/v2/hooks/useResolvedDensity.js.map +1 -1
- package/dist/v2/hooks/useSortedRows.js +4 -6
- package/dist/v2/hooks/useSortedRows.js.map +1 -1
- package/dist/v2/hooks/useTabLoading.js +7 -22
- package/dist/v2/hooks/useTabLoading.js.map +1 -1
- package/dist/v2/index.d.ts.map +1 -1
- package/dist/v2/index.js +143 -145
- package/dist/v2/index.js.map +1 -1
- package/dist/v2/modalContext.js +2 -2
- package/dist/v2/modalContext.js.map +1 -1
- package/dist/v2/models/favorite.d.ts +8 -9
- package/dist/v2/models/favorite.d.ts.map +1 -1
- package/dist/v2/models/favorite.js.map +1 -1
- package/dist/v2/models/index.js +4 -4
- package/dist/v2/models/index.js.map +1 -1
- package/dist/v2/models/personalization.d.ts +44 -48
- package/dist/v2/models/personalization.d.ts.map +1 -1
- package/dist/v2/models/personalization.js.map +1 -1
- package/dist/v2/models/referentiel.d.ts +32 -50
- package/dist/v2/models/referentiel.d.ts.map +1 -1
- package/dist/v2/models/referentiel.js.map +1 -1
- package/dist/v2/models/savedFilter.d.ts +8 -17
- package/dist/v2/models/savedFilter.d.ts.map +1 -1
- package/dist/v2/models/savedFilter.js.map +1 -1
- package/dist/v2/patterns/ActionBar.js +152 -187
- package/dist/v2/patterns/ActionBar.js.map +1 -1
- package/dist/v2/patterns/AppMain.d.ts +109 -0
- package/dist/v2/patterns/AppMain.d.ts.map +1 -0
- package/dist/v2/patterns/AppMain.js +115 -0
- package/dist/v2/patterns/AppMain.js.map +1 -0
- package/dist/v2/patterns/BulkActionBar.js +40 -42
- package/dist/v2/patterns/BulkActionBar.js.map +1 -1
- package/dist/v2/patterns/ChartFigure.d.ts +124 -0
- package/dist/v2/patterns/ChartFigure.d.ts.map +1 -0
- package/dist/v2/patterns/ChartFigure.js +159 -0
- package/dist/v2/patterns/ChartFigure.js.map +1 -0
- package/dist/v2/patterns/CollapsibleDataGrid.js +138 -174
- package/dist/v2/patterns/CollapsibleDataGrid.js.map +1 -1
- package/dist/v2/patterns/ColumnsToggle.js +60 -94
- package/dist/v2/patterns/ColumnsToggle.js.map +1 -1
- package/dist/v2/patterns/DataGrid.d.ts.map +1 -1
- package/dist/v2/patterns/DataGrid.js +262 -297
- package/dist/v2/patterns/DataGrid.js.map +1 -1
- package/dist/v2/patterns/DataGridSettingsMenu.d.ts +12 -0
- package/dist/v2/patterns/DataGridSettingsMenu.d.ts.map +1 -1
- package/dist/v2/patterns/DataGridSettingsMenu.js +104 -121
- package/dist/v2/patterns/DataGridSettingsMenu.js.map +1 -1
- package/dist/v2/patterns/DataGridToolbar.js +103 -106
- package/dist/v2/patterns/DataGridToolbar.js.map +1 -1
- package/dist/v2/patterns/DataGridVirtualized.js +179 -217
- package/dist/v2/patterns/DataGridVirtualized.js.map +1 -1
- package/dist/v2/patterns/DeleteResourceConfirmDialog.js +32 -35
- package/dist/v2/patterns/DeleteResourceConfirmDialog.js.map +1 -1
- package/dist/v2/patterns/DetailSplit.d.ts +87 -0
- package/dist/v2/patterns/DetailSplit.d.ts.map +1 -0
- package/dist/v2/patterns/DetailSplit.js +116 -0
- package/dist/v2/patterns/DetailSplit.js.map +1 -0
- package/dist/v2/patterns/FavoriteColumn.d.ts +9 -9
- package/dist/v2/patterns/FavoriteColumn.d.ts.map +1 -1
- package/dist/v2/patterns/FavoriteColumn.js +32 -80
- package/dist/v2/patterns/FavoriteColumn.js.map +1 -1
- package/dist/v2/patterns/FavoritesFilter.js +36 -44
- package/dist/v2/patterns/FavoritesFilter.js.map +1 -1
- package/dist/v2/patterns/FilterTabBar.d.ts +28 -0
- package/dist/v2/patterns/FilterTabBar.d.ts.map +1 -0
- package/dist/v2/patterns/FilterTabBar.js +120 -0
- package/dist/v2/patterns/FilterTabBar.js.map +1 -0
- package/dist/v2/patterns/FormErrorSummary.js +20 -23
- package/dist/v2/patterns/FormErrorSummary.js.map +1 -1
- package/dist/v2/patterns/FormPageShell.js +53 -50
- package/dist/v2/patterns/FormPageShell.js.map +1 -1
- package/dist/v2/patterns/FormSection.d.ts +8 -3
- package/dist/v2/patterns/FormSection.d.ts.map +1 -1
- package/dist/v2/patterns/FormSection.js +44 -51
- package/dist/v2/patterns/FormSection.js.map +1 -1
- package/dist/v2/patterns/FormikCheckbox.d.ts +77 -0
- package/dist/v2/patterns/FormikCheckbox.d.ts.map +1 -0
- package/dist/v2/patterns/FormikCheckbox.js +138 -0
- package/dist/v2/patterns/FormikCheckbox.js.map +1 -0
- package/dist/v2/patterns/FormikCheckboxGroup.d.ts +17 -1
- package/dist/v2/patterns/FormikCheckboxGroup.d.ts.map +1 -1
- package/dist/v2/patterns/FormikCheckboxGroup.js +62 -65
- package/dist/v2/patterns/FormikCheckboxGroup.js.map +1 -1
- package/dist/v2/patterns/FormikCombobox.d.ts +7 -1
- package/dist/v2/patterns/FormikCombobox.d.ts.map +1 -1
- package/dist/v2/patterns/FormikCombobox.js +55 -69
- package/dist/v2/patterns/FormikCombobox.js.map +1 -1
- package/dist/v2/patterns/FormikDatePicker.d.ts +13 -1
- package/dist/v2/patterns/FormikDatePicker.d.ts.map +1 -1
- package/dist/v2/patterns/FormikDatePicker.js +59 -106
- package/dist/v2/patterns/FormikDatePicker.js.map +1 -1
- package/dist/v2/patterns/FormikDateTimePicker.d.ts +111 -0
- package/dist/v2/patterns/FormikDateTimePicker.d.ts.map +1 -0
- package/dist/v2/patterns/FormikDateTimePicker.js +144 -0
- package/dist/v2/patterns/FormikDateTimePicker.js.map +1 -0
- package/dist/v2/patterns/FormikErrorFocus.js +25 -26
- package/dist/v2/patterns/FormikErrorFocus.js.map +1 -1
- package/dist/v2/patterns/FormikErrorSummary.d.ts +74 -0
- package/dist/v2/patterns/FormikErrorSummary.d.ts.map +1 -0
- package/dist/v2/patterns/FormikErrorSummary.js +97 -0
- package/dist/v2/patterns/FormikErrorSummary.js.map +1 -0
- package/dist/v2/patterns/FormikFile.d.ts +14 -1
- package/dist/v2/patterns/FormikFile.d.ts.map +1 -1
- package/dist/v2/patterns/FormikFile.js +99 -83
- package/dist/v2/patterns/FormikFile.js.map +1 -1
- package/dist/v2/patterns/FormikInput.d.ts +11 -1
- package/dist/v2/patterns/FormikInput.d.ts.map +1 -1
- package/dist/v2/patterns/FormikInput.js +45 -55
- package/dist/v2/patterns/FormikInput.js.map +1 -1
- package/dist/v2/patterns/FormikRadioGroup.d.ts +80 -0
- package/dist/v2/patterns/FormikRadioGroup.d.ts.map +1 -0
- package/dist/v2/patterns/FormikRadioGroup.js +137 -0
- package/dist/v2/patterns/FormikRadioGroup.js.map +1 -0
- package/dist/v2/patterns/FormikReferentielField.d.ts +12 -1
- package/dist/v2/patterns/FormikReferentielField.d.ts.map +1 -1
- package/dist/v2/patterns/FormikReferentielField.js +54 -64
- package/dist/v2/patterns/FormikReferentielField.js.map +1 -1
- package/dist/v2/patterns/FormikSelect.d.ts +9 -1
- package/dist/v2/patterns/FormikSelect.d.ts.map +1 -1
- package/dist/v2/patterns/FormikSelect.js +70 -89
- package/dist/v2/patterns/FormikSelect.js.map +1 -1
- package/dist/v2/patterns/FormikTextarea.d.ts +9 -1
- package/dist/v2/patterns/FormikTextarea.d.ts.map +1 -1
- package/dist/v2/patterns/FormikTextarea.js +35 -48
- package/dist/v2/patterns/FormikTextarea.js.map +1 -1
- package/dist/v2/patterns/KeyboardShortcutsHelp.d.ts +14 -1
- package/dist/v2/patterns/KeyboardShortcutsHelp.d.ts.map +1 -1
- package/dist/v2/patterns/KeyboardShortcutsHelp.js +71 -74
- package/dist/v2/patterns/KeyboardShortcutsHelp.js.map +1 -1
- package/dist/v2/patterns/NetworkErrorBanner.js +13 -16
- package/dist/v2/patterns/NetworkErrorBanner.js.map +1 -1
- package/dist/v2/patterns/PageContent.js +17 -20
- package/dist/v2/patterns/PageContent.js.map +1 -1
- package/dist/v2/patterns/PreviewDrawer.d.ts +49 -0
- package/dist/v2/patterns/PreviewDrawer.d.ts.map +1 -0
- package/dist/v2/patterns/PreviewDrawer.js +159 -0
- package/dist/v2/patterns/PreviewDrawer.js.map +1 -0
- package/dist/v2/patterns/ReferentielField.d.ts +86 -2
- package/dist/v2/patterns/ReferentielField.d.ts.map +1 -1
- package/dist/v2/patterns/ReferentielField.js +347 -327
- package/dist/v2/patterns/ReferentielField.js.map +1 -1
- package/dist/v2/patterns/RowFavoriteToggle.d.ts +98 -0
- package/dist/v2/patterns/RowFavoriteToggle.d.ts.map +1 -0
- package/dist/v2/patterns/RowFavoriteToggle.js +135 -0
- package/dist/v2/patterns/RowFavoriteToggle.js.map +1 -0
- package/dist/v2/patterns/SaveFilterDialog.js +50 -77
- package/dist/v2/patterns/SaveFilterDialog.js.map +1 -1
- package/dist/v2/patterns/SavedFiltersMenu.js +89 -107
- package/dist/v2/patterns/SavedFiltersMenu.js.map +1 -1
- package/dist/v2/patterns/SkeletonPageShell.js +122 -143
- package/dist/v2/patterns/SkeletonPageShell.js.map +1 -1
- package/dist/v2/patterns/SortableHeader.js +35 -57
- package/dist/v2/patterns/SortableHeader.js.map +1 -1
- package/dist/v2/patterns/Tour.js +121 -142
- package/dist/v2/patterns/Tour.js.map +1 -1
- package/dist/v2/patterns/_dataGridShared.d.ts.map +1 -1
- package/dist/v2/patterns/_dataGridShared.js +131 -147
- package/dist/v2/patterns/_dataGridShared.js.map +1 -1
- package/dist/v2/patterns/_pickerSerialisation.d.ts +44 -0
- package/dist/v2/patterns/_pickerSerialisation.d.ts.map +1 -0
- package/dist/v2/patterns/_pickerSerialisation.js +80 -0
- package/dist/v2/patterns/_pickerSerialisation.js.map +1 -0
- package/dist/v2/patterns/_sort.js +17 -33
- package/dist/v2/patterns/_sort.js.map +1 -1
- package/dist/v2/patterns/_useColumnReorder.js +124 -163
- package/dist/v2/patterns/_useColumnReorder.js.map +1 -1
- package/dist/v2/patterns/_useColumnResize.js +80 -99
- package/dist/v2/patterns/_useColumnResize.js.map +1 -1
- package/dist/v2/patterns/filterCriteria.d.ts +78 -0
- package/dist/v2/patterns/filterCriteria.d.ts.map +1 -0
- package/dist/v2/patterns/filterCriteria.js +110 -0
- package/dist/v2/patterns/filterCriteria.js.map +1 -0
- package/dist/v2/patterns/index.d.ts +247 -0
- package/dist/v2/patterns/index.d.ts.map +1 -1
- package/dist/v2/patterns/index.js +182 -70
- package/dist/v2/patterns/index.js.map +1 -1
- package/dist/v2/patterns/rowActions.d.ts +150 -0
- package/dist/v2/patterns/rowActions.d.ts.map +1 -0
- package/dist/v2/patterns/rowActions.js +232 -0
- package/dist/v2/patterns/rowActions.js.map +1 -0
- package/dist/v2/personalization/PersonalizationProvider.d.ts.map +1 -1
- package/dist/v2/personalization/PersonalizationProvider.js +57 -53
- package/dist/v2/personalization/PersonalizationProvider.js.map +1 -1
- package/dist/v2/personalization/adapters/_storageKey.js +5 -5
- package/dist/v2/personalization/adapters/_storageKey.js.map +1 -1
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.js +25 -24
- package/dist/v2/personalization/adapters/createLocalStorageAdapter.js.map +1 -1
- package/dist/v2/personalization/adapters/createMemoryAdapter.js +14 -14
- package/dist/v2/personalization/adapters/createMemoryAdapter.js.map +1 -1
- package/dist/v2/personalization/adapters/index.js +5 -5
- package/dist/v2/personalization/adapters/index.js.map +1 -1
- package/dist/v2/personalization/capabilities/favorites.js +39 -62
- package/dist/v2/personalization/capabilities/favorites.js.map +1 -1
- package/dist/v2/personalization/capabilities/favoritesView.js +25 -37
- package/dist/v2/personalization/capabilities/favoritesView.js.map +1 -1
- package/dist/v2/personalization/capabilities/gridPreferences.d.ts +100 -0
- package/dist/v2/personalization/capabilities/gridPreferences.d.ts.map +1 -0
- package/dist/v2/personalization/capabilities/gridPreferences.js +210 -0
- package/dist/v2/personalization/capabilities/gridPreferences.js.map +1 -0
- package/dist/v2/personalization/capabilities/index.d.ts +6 -0
- package/dist/v2/personalization/capabilities/index.d.ts.map +1 -1
- package/dist/v2/personalization/capabilities/index.js +23 -10
- package/dist/v2/personalization/capabilities/index.js.map +1 -1
- package/dist/v2/personalization/capabilities/reviveSavedCriteria.d.ts +88 -0
- package/dist/v2/personalization/capabilities/reviveSavedCriteria.d.ts.map +1 -0
- package/dist/v2/personalization/capabilities/reviveSavedCriteria.js +126 -0
- package/dist/v2/personalization/capabilities/reviveSavedCriteria.js.map +1 -0
- package/dist/v2/personalization/capabilities/savedFilters.js +93 -100
- package/dist/v2/personalization/capabilities/savedFilters.js.map +1 -1
- package/dist/v2/personalization/createPersonalizationStore.d.ts.map +1 -1
- package/dist/v2/personalization/createPersonalizationStore.js +81 -182
- package/dist/v2/personalization/createPersonalizationStore.js.map +1 -1
- package/dist/v2/personalization/index.d.ts +34 -0
- package/dist/v2/personalization/index.d.ts.map +1 -1
- package/dist/v2/personalization/index.js +41 -21
- package/dist/v2/personalization/index.js.map +1 -1
- package/dist/v2/personalization/personalizationContext.js +10 -12
- package/dist/v2/personalization/personalizationContext.js.map +1 -1
- package/dist/v2/personalization/schema.js +8 -9
- package/dist/v2/personalization/schema.js.map +1 -1
- package/dist/v2/referentiel/ReferentielProvider.js +31 -45
- package/dist/v2/referentiel/ReferentielProvider.js.map +1 -1
- package/dist/v2/referentiel/index.js +11 -13
- package/dist/v2/referentiel/index.js.map +1 -1
- package/dist/v2/referentiel/types.d.ts +105 -0
- package/dist/v2/referentiel/types.d.ts.map +1 -0
- package/dist/v2/referentiel/types.js +6 -0
- package/dist/v2/referentiel/types.js.map +1 -0
- package/dist/v2/referentiel/useReferentielClient.js +13 -16
- package/dist/v2/referentiel/useReferentielClient.js.map +1 -1
- package/dist/v2/referentiel/useReferentielOptions.d.ts +7 -17
- package/dist/v2/referentiel/useReferentielOptions.d.ts.map +1 -1
- package/dist/v2/referentiel/useReferentielOptions.js +63 -120
- package/dist/v2/referentiel/useReferentielOptions.js.map +1 -1
- package/dist/v2/referentiel/useReferentielSearch.d.ts +7 -48
- package/dist/v2/referentiel/useReferentielSearch.d.ts.map +1 -1
- package/dist/v2/referentiel/useReferentielSearch.js +40 -95
- package/dist/v2/referentiel/useReferentielSearch.js.map +1 -1
- package/dist/v2/theme/_brand.js +12 -26
- package/dist/v2/theme/_brand.js.map +1 -1
- package/dist/v2/theme/_brandSecondary.js +12 -26
- package/dist/v2/theme/_brandSecondary.js.map +1 -1
- package/dist/v2/theme/createPortnetTheme.js +41 -49
- package/dist/v2/theme/createPortnetTheme.js.map +1 -1
- package/dist/v2/theme/cssVariables.d.ts +3 -3
- package/dist/v2/theme/cssVariables.d.ts.map +1 -1
- package/dist/v2/theme/cssVariables.js +65 -70
- package/dist/v2/theme/cssVariables.js.map +1 -1
- package/dist/v2/theme/index.js +10 -10
- package/dist/v2/theme/index.js.map +1 -1
- package/dist/v2/tokens/breakpoints.js +16 -16
- package/dist/v2/tokens/breakpoints.js.map +1 -1
- package/dist/v2/tokens/chart.d.ts +103 -0
- package/dist/v2/tokens/chart.d.ts.map +1 -0
- package/dist/v2/tokens/chart.js +270 -0
- package/dist/v2/tokens/chart.js.map +1 -0
- package/dist/v2/tokens/colors.js +24 -24
- package/dist/v2/tokens/colors.js.map +1 -1
- package/dist/v2/tokens/density.d.ts +104 -0
- package/dist/v2/tokens/density.d.ts.map +1 -1
- package/dist/v2/tokens/density.js +67 -12
- package/dist/v2/tokens/density.js.map +1 -1
- package/dist/v2/tokens/index.d.ts +50 -1
- package/dist/v2/tokens/index.d.ts.map +1 -1
- package/dist/v2/tokens/index.js +116 -68
- package/dist/v2/tokens/index.js.map +1 -1
- package/dist/v2/tokens/motion.js +16 -22
- package/dist/v2/tokens/motion.js.map +1 -1
- package/dist/v2/tokens/radius.js +3 -3
- package/dist/v2/tokens/radius.js.map +1 -1
- package/dist/v2/tokens/shadows.js +8 -8
- package/dist/v2/tokens/shadows.js.map +1 -1
- package/dist/v2/tokens/spacing.js +4 -4
- package/dist/v2/tokens/spacing.js.map +1 -1
- package/dist/v2/tokens/state.js +3 -3
- package/dist/v2/tokens/state.js.map +1 -1
- package/dist/v2/tokens/statusPalette.js +21 -23
- package/dist/v2/tokens/statusPalette.js.map +1 -1
- package/dist/v2/tokens/tokens.json +6 -1
- package/dist/v2/tokens/typography.js +15 -15
- package/dist/v2/tokens/typography.js.map +1 -1
- package/dist/v2/tokens/zIndex.js +3 -3
- package/dist/v2/tokens/zIndex.js.map +1 -1
- package/dist/v2/types/datagrid.d.ts +9 -1
- package/dist/v2/types/datagrid.d.ts.map +1 -1
- package/dist/v2/types/datagrid.js.map +1 -1
- package/dist/v2/types/index.js +2 -2
- package/dist/v2/types/index.js.map +1 -1
- package/dist/v2/utils/apiError.js +16 -37
- package/dist/v2/utils/apiError.js.map +1 -1
- package/dist/v2/utils/contrast.js +31 -32
- package/dist/v2/utils/contrast.js.map +1 -1
- package/dist/v2/utils/cx.js +7 -27
- package/dist/v2/utils/cx.js.map +1 -1
- package/dist/v2/utils/fileDownload.js +25 -28
- package/dist/v2/utils/fileDownload.js.map +1 -1
- package/dist/v2/utils/fileValidation.d.ts +116 -0
- package/dist/v2/utils/fileValidation.d.ts.map +1 -0
- package/dist/v2/utils/fileValidation.js +220 -0
- package/dist/v2/utils/fileValidation.js.map +1 -0
- package/dist/v2/utils/fmtDate.d.ts +103 -0
- package/dist/v2/utils/fmtDate.d.ts.map +1 -0
- package/dist/v2/utils/fmtDate.js +119 -0
- package/dist/v2/utils/fmtDate.js.map +1 -0
- package/dist/v2/utils/fmtMoney.d.ts +3 -3
- package/dist/v2/utils/fmtMoney.d.ts.map +1 -1
- package/dist/v2/utils/fmtMoney.js +9 -11
- package/dist/v2/utils/fmtMoney.js.map +1 -1
- package/dist/v2/utils/formikErrors.d.ts +67 -0
- package/dist/v2/utils/formikErrors.d.ts.map +1 -0
- package/dist/v2/utils/formikErrors.js +85 -0
- package/dist/v2/utils/formikErrors.js.map +1 -0
- package/dist/v2/utils/index.d.ts +5 -0
- package/dist/v2/utils/index.d.ts.map +1 -1
- package/dist/v2/utils/index.js +67 -18
- package/dist/v2/utils/index.js.map +1 -1
- package/dist/v2/utils/mergeLabels.js +9 -14
- package/dist/v2/utils/mergeLabels.js.map +1 -1
- package/dist/v2/utils/networkStatus.js +14 -14
- package/dist/v2/utils/networkStatus.js.map +1 -1
- package/package.json +26 -9
|
@@ -9,12 +9,8 @@ exports.useIsFavorite = useIsFavorite;
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _schema = require("../schema");
|
|
11
11
|
var _personalizationContext = require("../personalizationContext");
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
15
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
17
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } /**
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
/**
|
|
18
14
|
* favorites — Portnet UI v2 · personalization capability
|
|
19
15
|
*
|
|
20
16
|
* The Favorites framework. Self-registers the "favorites" capability with
|
|
@@ -36,12 +32,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
36
32
|
* boolean per-row selector lets each grid cell re-render only when its own
|
|
37
33
|
* membership flips.
|
|
38
34
|
*/
|
|
35
|
+
|
|
39
36
|
/** The favorites capability payload: favorites arrays keyed by resourceKey. */
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
const FAVORITES_CAPABILITY_ID = exports.FAVORITES_CAPABILITY_ID = "favorites";
|
|
39
|
+
const SCHEMA_VERSION = 1;
|
|
40
|
+
const EMPTY_LIST = Object.freeze([]);
|
|
41
|
+
const EMPTY_MAP = Object.freeze({});
|
|
45
42
|
|
|
46
43
|
/* Register at import time — the foundation reads this at hydration. */
|
|
47
44
|
(0, _schema.registerCapability)({
|
|
@@ -51,50 +48,41 @@ var EMPTY_MAP = Object.freeze({});
|
|
|
51
48
|
// { [resourceKey]: FavoriteRef[] }
|
|
52
49
|
migrate: function migrateFavorites(_fromVersion, payload) {
|
|
53
50
|
// v1 is the initial schema. Defensive normalisation only.
|
|
54
|
-
return payload &&
|
|
51
|
+
return payload && typeof payload === "object" ? payload : {};
|
|
55
52
|
}
|
|
56
53
|
});
|
|
57
54
|
|
|
58
55
|
/* ── pure, resourceKey-scoped state helpers (structural sharing) ────── */
|
|
59
56
|
|
|
60
57
|
function listFor(map, resourceKey) {
|
|
61
|
-
|
|
58
|
+
const list = map ? map[resourceKey] : undefined;
|
|
62
59
|
return Array.isArray(list) ? list : EMPTY_LIST;
|
|
63
60
|
}
|
|
64
61
|
function hasRef(map, resourceKey, id) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
try {
|
|
69
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
70
|
-
var ref = _step.value;
|
|
71
|
-
if (ref.id === id) return true;
|
|
72
|
-
}
|
|
73
|
-
} catch (err) {
|
|
74
|
-
_iterator.e(err);
|
|
75
|
-
} finally {
|
|
76
|
-
_iterator.f();
|
|
62
|
+
const list = listFor(map, resourceKey);
|
|
63
|
+
for (const ref of list) {
|
|
64
|
+
if (ref.id === id) return true;
|
|
77
65
|
}
|
|
78
66
|
return false;
|
|
79
67
|
}
|
|
80
68
|
function addRef(map, resourceKey, id) {
|
|
81
|
-
|
|
69
|
+
const base = map || EMPTY_MAP;
|
|
82
70
|
if (hasRef(base, resourceKey, id)) return base; // no-op → store short-circuits
|
|
83
|
-
|
|
71
|
+
const nextList = listFor(base, resourceKey).concat([{
|
|
84
72
|
id: id,
|
|
85
73
|
addedAt: new Date().toISOString()
|
|
86
74
|
}]);
|
|
87
|
-
|
|
75
|
+
const next = Object.assign({}, base);
|
|
88
76
|
next[resourceKey] = nextList;
|
|
89
77
|
return next;
|
|
90
78
|
}
|
|
91
79
|
function removeRef(map, resourceKey, id) {
|
|
92
|
-
|
|
80
|
+
const base = map || EMPTY_MAP;
|
|
93
81
|
if (!hasRef(base, resourceKey, id)) return base; // no-op
|
|
94
|
-
|
|
82
|
+
const nextList = listFor(base, resourceKey).filter(function keep(r) {
|
|
95
83
|
return r.id !== id;
|
|
96
84
|
});
|
|
97
|
-
|
|
85
|
+
const next = Object.assign({}, base);
|
|
98
86
|
if (nextList.length === 0) delete next[resourceKey]; // keep the map tidy
|
|
99
87
|
else next[resourceKey] = nextList;
|
|
100
88
|
return next;
|
|
@@ -103,9 +91,9 @@ function toggleRef(map, resourceKey, id) {
|
|
|
103
91
|
return hasRef(map, resourceKey, id) ? removeRef(map, resourceKey, id) : addRef(map, resourceKey, id);
|
|
104
92
|
}
|
|
105
93
|
function clearRefs(map, resourceKey) {
|
|
106
|
-
|
|
94
|
+
const base = map || EMPTY_MAP;
|
|
107
95
|
if (!base[resourceKey]) return base;
|
|
108
|
-
|
|
96
|
+
const next = Object.assign({}, base);
|
|
109
97
|
delete next[resourceKey];
|
|
110
98
|
return next;
|
|
111
99
|
}
|
|
@@ -121,52 +109,41 @@ function useEnsureFavorites(store) {
|
|
|
121
109
|
* useFavorites(resourceKey) — list, membership and actions for one resource.
|
|
122
110
|
*/
|
|
123
111
|
function useFavorites(resourceKey) {
|
|
124
|
-
|
|
112
|
+
const store = (0, _personalizationContext.usePersonalizationStore)();
|
|
125
113
|
useEnsureFavorites(store);
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
const selectList = React.useCallback(function selectList(snapshot) {
|
|
115
|
+
const slice = snapshot[FAVORITES_CAPABILITY_ID];
|
|
128
116
|
return slice ? listFor(slice, resourceKey) : EMPTY_LIST;
|
|
129
117
|
}, [resourceKey]);
|
|
130
|
-
|
|
118
|
+
const items = (0, _personalizationContext.useStoreSelector)(selectList);
|
|
131
119
|
|
|
132
120
|
// Stable while `items` is stable (structural sharing) → O(1) membership.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
_step2;
|
|
137
|
-
try {
|
|
138
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
139
|
-
var ref = _step2.value;
|
|
140
|
-
set.add(ref.id);
|
|
141
|
-
}
|
|
142
|
-
} catch (err) {
|
|
143
|
-
_iterator2.e(err);
|
|
144
|
-
} finally {
|
|
145
|
-
_iterator2.f();
|
|
146
|
-
}
|
|
121
|
+
const ids = React.useMemo(function buildIdSet() {
|
|
122
|
+
const set = new Set();
|
|
123
|
+
for (const ref of items) set.add(ref.id);
|
|
147
124
|
return set;
|
|
148
125
|
}, [items]);
|
|
149
|
-
|
|
126
|
+
const add = React.useCallback(function add(id) {
|
|
150
127
|
store.write(FAVORITES_CAPABILITY_ID, function (prev) {
|
|
151
128
|
return addRef(prev, resourceKey, id);
|
|
152
129
|
});
|
|
153
130
|
}, [store, resourceKey]);
|
|
154
|
-
|
|
131
|
+
const remove = React.useCallback(function remove(id) {
|
|
155
132
|
store.write(FAVORITES_CAPABILITY_ID, function (prev) {
|
|
156
133
|
return removeRef(prev, resourceKey, id);
|
|
157
134
|
});
|
|
158
135
|
}, [store, resourceKey]);
|
|
159
|
-
|
|
136
|
+
const toggle = React.useCallback(function toggle(id) {
|
|
160
137
|
store.write(FAVORITES_CAPABILITY_ID, function (prev) {
|
|
161
138
|
return toggleRef(prev, resourceKey, id);
|
|
162
139
|
});
|
|
163
140
|
}, [store, resourceKey]);
|
|
164
|
-
|
|
141
|
+
const clear = React.useCallback(function clear() {
|
|
165
142
|
store.write(FAVORITES_CAPABILITY_ID, function (prev) {
|
|
166
143
|
return clearRefs(prev, resourceKey);
|
|
167
144
|
});
|
|
168
145
|
}, [store, resourceKey]);
|
|
169
|
-
|
|
146
|
+
const isFavorite = React.useCallback(function isFavorite(id) {
|
|
170
147
|
return ids.has(id);
|
|
171
148
|
}, [ids]);
|
|
172
149
|
return React.useMemo(function value() {
|
|
@@ -189,24 +166,24 @@ function useFavorites(resourceKey) {
|
|
|
189
166
|
* favorite column consumes (Batch 5).
|
|
190
167
|
*/
|
|
191
168
|
function useIsFavorite(resourceKey, id) {
|
|
192
|
-
|
|
169
|
+
const store = (0, _personalizationContext.usePersonalizationStore)();
|
|
193
170
|
useEnsureFavorites(store);
|
|
194
|
-
|
|
195
|
-
|
|
171
|
+
const selectIsFavorite = React.useCallback(function selectIsFavorite(snapshot) {
|
|
172
|
+
const slice = snapshot[FAVORITES_CAPABILITY_ID];
|
|
196
173
|
return slice ? hasRef(slice, resourceKey, id) : false;
|
|
197
174
|
}, [resourceKey, id]);
|
|
198
|
-
|
|
199
|
-
|
|
175
|
+
const isFavorite = (0, _personalizationContext.useStoreSelector)(selectIsFavorite);
|
|
176
|
+
const toggle = React.useCallback(function toggle() {
|
|
200
177
|
store.write(FAVORITES_CAPABILITY_ID, function (prev) {
|
|
201
178
|
return toggleRef(prev, resourceKey, id);
|
|
202
179
|
});
|
|
203
180
|
}, [store, resourceKey, id]);
|
|
204
|
-
|
|
181
|
+
const add = React.useCallback(function add() {
|
|
205
182
|
store.write(FAVORITES_CAPABILITY_ID, function (prev) {
|
|
206
183
|
return addRef(prev, resourceKey, id);
|
|
207
184
|
});
|
|
208
185
|
}, [store, resourceKey, id]);
|
|
209
|
-
|
|
186
|
+
const remove = React.useCallback(function remove() {
|
|
210
187
|
store.write(FAVORITES_CAPABILITY_ID, function (prev) {
|
|
211
188
|
return removeRef(prev, resourceKey, id);
|
|
212
189
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"favorites.js","names":["React","_interopRequireWildcard","require","_schema","_personalizationContext","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","step","next","_e2","minLen","_arrayLikeToArray","toString","slice","constructor","name","from","test","arr","len","arr2","FAVORITES_CAPABILITY_ID","exports","SCHEMA_VERSION","EMPTY_LIST","freeze","EMPTY_MAP","registerCapability","id","schemaVersion","defaultState","migrate","migrateFavorites","_fromVersion","payload","listFor","map","resourceKey","list","undefined","hasRef","_iterator","_step","ref","addRef","base","nextList","concat","addedAt","Date","toISOString","assign","removeRef","filter","keep","r","toggleRef","clearRefs","useEnsureFavorites","store","useEffect","ensure","ensureCapability","useFavorites","usePersonalizationStore","selectList","useCallback","snapshot","items","useStoreSelector","ids","useMemo","buildIdSet","Set","_iterator2","_step2","add","write","prev","remove","toggle","clear","isFavorite","count","useIsFavorite","selectIsFavorite"],"sources":["../../../../src/lib/v2/personalization/capabilities/favorites.ts"],"sourcesContent":["/**\r\n * favorites — Portnet UI v2 · personalization capability\r\n *\r\n * The Favorites framework. Self-registers the \"favorites\" capability with\r\n * the schema registry at import time, so the capability-agnostic\r\n * foundation discovers its schemaVersion / defaultState / migrate without\r\n * any hardcoding.\r\n *\r\n * State model (the capability payload):\r\n * { [resourceKey]: FavoriteRef[] } FavoriteRef = { id, addedAt }\r\n *\r\n * `resourceKey` namespaces favorites per list/entity type (e.g.\r\n * \"ti:list\", \"declarations:list\"), so one user's favorites across\r\n * different screens never collide. `id` is the business row id.\r\n *\r\n * Performance: the pure helpers below rebuild only the touched\r\n * resourceKey's array and shallow-copy the map, so the store's structural\r\n * sharing keeps every OTHER resource's list referentially stable —\r\n * toggling a favorite on screen B does not re-render screen A, and a\r\n * boolean per-row selector lets each grid cell re-render only when its own\r\n * membership flips.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { registerCapability } from \"../schema\";\r\nimport {\r\n usePersonalizationStore,\r\n useStoreSelector,\r\n} from \"../personalizationContext\";\r\nimport type {\r\n PersonalizationSnapshot,\r\n PersonalizationStore,\r\n} from \"../createPersonalizationStore\";\r\nimport type { FavoriteRef } from \"../types\";\r\nimport type { RowId } from \"../../types/common\";\r\n\r\n/** The favorites capability payload: favorites arrays keyed by resourceKey. */\r\ntype FavoritesState = Record<string, FavoriteRef[]>;\r\n\r\nexport const FAVORITES_CAPABILITY_ID = \"favorites\";\r\nconst SCHEMA_VERSION = 1;\r\n\r\nconst EMPTY_LIST: readonly FavoriteRef[] = Object.freeze([]);\r\nconst EMPTY_MAP: FavoritesState = Object.freeze({});\r\n\r\n/* Register at import time — the foundation reads this at hydration. */\r\nregisterCapability({\r\n id: FAVORITES_CAPABILITY_ID,\r\n schemaVersion: SCHEMA_VERSION,\r\n defaultState: EMPTY_MAP, // { [resourceKey]: FavoriteRef[] }\r\n migrate: function migrateFavorites(\r\n _fromVersion: number,\r\n payload: unknown\r\n ): unknown {\r\n // v1 is the initial schema. Defensive normalisation only.\r\n return payload && typeof payload === \"object\" ? payload : {};\r\n },\r\n});\r\n\r\n/* ── pure, resourceKey-scoped state helpers (structural sharing) ────── */\r\n\r\nfunction listFor(\r\n map: FavoritesState | null | undefined,\r\n resourceKey: string\r\n): readonly FavoriteRef[] {\r\n const list = map ? map[resourceKey] : undefined;\r\n return Array.isArray(list) ? list : EMPTY_LIST;\r\n}\r\n\r\nfunction hasRef(\r\n map: FavoritesState | null | undefined,\r\n resourceKey: string,\r\n id: RowId\r\n): boolean {\r\n const list = listFor(map, resourceKey);\r\n for (const ref of list) {\r\n if (ref.id === id) return true;\r\n }\r\n return false;\r\n}\r\n\r\nfunction addRef(\r\n map: FavoritesState | null | undefined,\r\n resourceKey: string,\r\n id: RowId\r\n): FavoritesState {\r\n const base = map || EMPTY_MAP;\r\n if (hasRef(base, resourceKey, id)) return base; // no-op → store short-circuits\r\n const nextList = listFor(base, resourceKey).concat([\r\n { id: id, addedAt: new Date().toISOString() },\r\n ]);\r\n const next: FavoritesState = Object.assign({}, base);\r\n next[resourceKey] = nextList;\r\n return next;\r\n}\r\n\r\nfunction removeRef(\r\n map: FavoritesState | null | undefined,\r\n resourceKey: string,\r\n id: RowId\r\n): FavoritesState {\r\n const base = map || EMPTY_MAP;\r\n if (!hasRef(base, resourceKey, id)) return base; // no-op\r\n const nextList = listFor(base, resourceKey).filter(function keep(r) {\r\n return r.id !== id;\r\n });\r\n const next: FavoritesState = Object.assign({}, base);\r\n if (nextList.length === 0) delete next[resourceKey]; // keep the map tidy\r\n else next[resourceKey] = nextList;\r\n return next;\r\n}\r\n\r\nfunction toggleRef(\r\n map: FavoritesState | null | undefined,\r\n resourceKey: string,\r\n id: RowId\r\n): FavoritesState {\r\n return hasRef(map, resourceKey, id)\r\n ? removeRef(map, resourceKey, id)\r\n : addRef(map, resourceKey, id);\r\n}\r\n\r\nfunction clearRefs(\r\n map: FavoritesState | null | undefined,\r\n resourceKey: string\r\n): FavoritesState {\r\n const base = map || EMPTY_MAP;\r\n if (!base[resourceKey]) return base;\r\n const next: FavoritesState = Object.assign({}, base);\r\n delete next[resourceKey];\r\n return next;\r\n}\r\n\r\n/* ── hooks ──────────────────────────────────────────────────────────── */\r\n\r\nfunction useEnsureFavorites(store: PersonalizationStore): void {\r\n React.useEffect(\r\n function ensure() {\r\n store.ensureCapability(FAVORITES_CAPABILITY_ID);\r\n },\r\n [store]\r\n );\r\n}\r\n\r\nexport interface UseFavoritesResult {\r\n items: readonly FavoriteRef[];\r\n ids: Set<RowId>;\r\n count: number;\r\n isFavorite: (id: RowId) => boolean;\r\n add: (id: RowId) => void;\r\n remove: (id: RowId) => void;\r\n toggle: (id: RowId) => void;\r\n clear: () => void;\r\n}\r\n\r\n/**\r\n * useFavorites(resourceKey) — list, membership and actions for one resource.\r\n */\r\nexport function useFavorites(resourceKey: string): UseFavoritesResult {\r\n const store = usePersonalizationStore();\r\n useEnsureFavorites(store);\r\n\r\n const selectList = React.useCallback(\r\n function selectList(snapshot: PersonalizationSnapshot): readonly FavoriteRef[] {\r\n const slice = snapshot[FAVORITES_CAPABILITY_ID] as\r\n | FavoritesState\r\n | undefined;\r\n return slice ? listFor(slice, resourceKey) : EMPTY_LIST;\r\n },\r\n [resourceKey]\r\n );\r\n const items = useStoreSelector(selectList);\r\n\r\n // Stable while `items` is stable (structural sharing) → O(1) membership.\r\n const ids = React.useMemo(\r\n function buildIdSet(): Set<RowId> {\r\n const set = new Set<RowId>();\r\n for (const ref of items) set.add(ref.id);\r\n return set;\r\n },\r\n [items]\r\n );\r\n\r\n const add = React.useCallback(\r\n function add(id: RowId): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return addRef(prev, resourceKey, id);\r\n });\r\n },\r\n [store, resourceKey]\r\n );\r\n const remove = React.useCallback(\r\n function remove(id: RowId): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return removeRef(prev, resourceKey, id);\r\n });\r\n },\r\n [store, resourceKey]\r\n );\r\n const toggle = React.useCallback(\r\n function toggle(id: RowId): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return toggleRef(prev, resourceKey, id);\r\n });\r\n },\r\n [store, resourceKey]\r\n );\r\n const clear = React.useCallback(\r\n function clear(): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return clearRefs(prev, resourceKey);\r\n });\r\n },\r\n [store, resourceKey]\r\n );\r\n const isFavorite = React.useCallback(\r\n function isFavorite(id: RowId): boolean {\r\n return ids.has(id);\r\n },\r\n [ids]\r\n );\r\n\r\n return React.useMemo(\r\n function value(): UseFavoritesResult {\r\n return {\r\n items: items,\r\n ids: ids,\r\n count: items.length,\r\n isFavorite: isFavorite,\r\n add: add,\r\n remove: remove,\r\n toggle: toggle,\r\n clear: clear,\r\n };\r\n },\r\n [items, ids, isFavorite, add, remove, toggle, clear]\r\n );\r\n}\r\n\r\nexport interface UseIsFavoriteResult {\r\n isFavorite: boolean;\r\n toggle: () => void;\r\n add: () => void;\r\n remove: () => void;\r\n}\r\n\r\n/**\r\n * useIsFavorite(resourceKey, id) — focused per-row hook. Returns a boolean\r\n * (Object.is bail-out: a row re-renders only when ITS membership flips)\r\n * plus a bound toggle/add/remove. This is the cell-level hook the DataGrid\r\n * favorite column consumes (Batch 5).\r\n */\r\nexport function useIsFavorite(\r\n resourceKey: string,\r\n id: RowId\r\n): UseIsFavoriteResult {\r\n const store = usePersonalizationStore();\r\n useEnsureFavorites(store);\r\n\r\n const selectIsFavorite = React.useCallback(\r\n function selectIsFavorite(snapshot: PersonalizationSnapshot): boolean {\r\n const slice = snapshot[FAVORITES_CAPABILITY_ID] as\r\n | FavoritesState\r\n | undefined;\r\n return slice ? hasRef(slice, resourceKey, id) : false;\r\n },\r\n [resourceKey, id]\r\n );\r\n const isFavorite = useStoreSelector(selectIsFavorite);\r\n\r\n const toggle = React.useCallback(\r\n function toggle(): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return toggleRef(prev, resourceKey, id);\r\n });\r\n },\r\n [store, resourceKey, id]\r\n );\r\n const add = React.useCallback(\r\n function add(): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return addRef(prev, resourceKey, id);\r\n });\r\n },\r\n [store, resourceKey, id]\r\n );\r\n const remove = React.useCallback(\r\n function remove(): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return removeRef(prev, resourceKey, id);\r\n });\r\n },\r\n [store, resourceKey, id]\r\n );\r\n\r\n return React.useMemo(\r\n function value(): UseIsFavoriteResult {\r\n return {\r\n isFavorite: isFavorite,\r\n toggle: toggle,\r\n add: add,\r\n remove: remove,\r\n };\r\n },\r\n [isFavorite, toggle, add, remove]\r\n );\r\n}\r\n"],"mappings":";;;;;;;;AAuBA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,uBAAA,GAAAF,OAAA;AAGmC,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,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"favorites.js","names":["React","_interopRequireWildcard","require","_schema","_personalizationContext","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","FAVORITES_CAPABILITY_ID","exports","SCHEMA_VERSION","EMPTY_LIST","freeze","EMPTY_MAP","registerCapability","id","schemaVersion","defaultState","migrate","migrateFavorites","_fromVersion","payload","listFor","map","resourceKey","list","undefined","Array","isArray","hasRef","ref","addRef","base","nextList","concat","addedAt","Date","toISOString","next","assign","removeRef","filter","keep","length","toggleRef","clearRefs","useEnsureFavorites","store","useEffect","ensure","ensureCapability","useFavorites","usePersonalizationStore","selectList","useCallback","snapshot","slice","items","useStoreSelector","ids","useMemo","buildIdSet","Set","add","write","prev","remove","toggle","clear","isFavorite","value","count","useIsFavorite","selectIsFavorite"],"sources":["../../../../src/lib/v2/personalization/capabilities/favorites.ts"],"sourcesContent":["/**\r\n * favorites — Portnet UI v2 · personalization capability\r\n *\r\n * The Favorites framework. Self-registers the \"favorites\" capability with\r\n * the schema registry at import time, so the capability-agnostic\r\n * foundation discovers its schemaVersion / defaultState / migrate without\r\n * any hardcoding.\r\n *\r\n * State model (the capability payload):\r\n * { [resourceKey]: FavoriteRef[] } FavoriteRef = { id, addedAt }\r\n *\r\n * `resourceKey` namespaces favorites per list/entity type (e.g.\r\n * \"ti:list\", \"declarations:list\"), so one user's favorites across\r\n * different screens never collide. `id` is the business row id.\r\n *\r\n * Performance: the pure helpers below rebuild only the touched\r\n * resourceKey's array and shallow-copy the map, so the store's structural\r\n * sharing keeps every OTHER resource's list referentially stable —\r\n * toggling a favorite on screen B does not re-render screen A, and a\r\n * boolean per-row selector lets each grid cell re-render only when its own\r\n * membership flips.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { registerCapability } from \"../schema\";\r\nimport {\r\n usePersonalizationStore,\r\n useStoreSelector,\r\n} from \"../personalizationContext\";\r\nimport type {\r\n PersonalizationSnapshot,\r\n PersonalizationStore,\r\n} from \"../createPersonalizationStore\";\r\nimport type { FavoriteRef } from \"../types\";\r\nimport type { RowId } from \"../../types/common\";\r\n\r\n/** The favorites capability payload: favorites arrays keyed by resourceKey. */\r\ntype FavoritesState = Record<string, FavoriteRef[]>;\r\n\r\nexport const FAVORITES_CAPABILITY_ID = \"favorites\";\r\nconst SCHEMA_VERSION = 1;\r\n\r\nconst EMPTY_LIST: readonly FavoriteRef[] = Object.freeze([]);\r\nconst EMPTY_MAP: FavoritesState = Object.freeze({});\r\n\r\n/* Register at import time — the foundation reads this at hydration. */\r\nregisterCapability({\r\n id: FAVORITES_CAPABILITY_ID,\r\n schemaVersion: SCHEMA_VERSION,\r\n defaultState: EMPTY_MAP, // { [resourceKey]: FavoriteRef[] }\r\n migrate: function migrateFavorites(\r\n _fromVersion: number,\r\n payload: unknown\r\n ): unknown {\r\n // v1 is the initial schema. Defensive normalisation only.\r\n return payload && typeof payload === \"object\" ? payload : {};\r\n },\r\n});\r\n\r\n/* ── pure, resourceKey-scoped state helpers (structural sharing) ────── */\r\n\r\nfunction listFor(\r\n map: FavoritesState | null | undefined,\r\n resourceKey: string\r\n): readonly FavoriteRef[] {\r\n const list = map ? map[resourceKey] : undefined;\r\n return Array.isArray(list) ? list : EMPTY_LIST;\r\n}\r\n\r\nfunction hasRef(\r\n map: FavoritesState | null | undefined,\r\n resourceKey: string,\r\n id: RowId\r\n): boolean {\r\n const list = listFor(map, resourceKey);\r\n for (const ref of list) {\r\n if (ref.id === id) return true;\r\n }\r\n return false;\r\n}\r\n\r\nfunction addRef(\r\n map: FavoritesState | null | undefined,\r\n resourceKey: string,\r\n id: RowId\r\n): FavoritesState {\r\n const base = map || EMPTY_MAP;\r\n if (hasRef(base, resourceKey, id)) return base; // no-op → store short-circuits\r\n const nextList = listFor(base, resourceKey).concat([\r\n { id: id, addedAt: new Date().toISOString() },\r\n ]);\r\n const next: FavoritesState = Object.assign({}, base);\r\n next[resourceKey] = nextList;\r\n return next;\r\n}\r\n\r\nfunction removeRef(\r\n map: FavoritesState | null | undefined,\r\n resourceKey: string,\r\n id: RowId\r\n): FavoritesState {\r\n const base = map || EMPTY_MAP;\r\n if (!hasRef(base, resourceKey, id)) return base; // no-op\r\n const nextList = listFor(base, resourceKey).filter(function keep(r) {\r\n return r.id !== id;\r\n });\r\n const next: FavoritesState = Object.assign({}, base);\r\n if (nextList.length === 0) delete next[resourceKey]; // keep the map tidy\r\n else next[resourceKey] = nextList;\r\n return next;\r\n}\r\n\r\nfunction toggleRef(\r\n map: FavoritesState | null | undefined,\r\n resourceKey: string,\r\n id: RowId\r\n): FavoritesState {\r\n return hasRef(map, resourceKey, id)\r\n ? removeRef(map, resourceKey, id)\r\n : addRef(map, resourceKey, id);\r\n}\r\n\r\nfunction clearRefs(\r\n map: FavoritesState | null | undefined,\r\n resourceKey: string\r\n): FavoritesState {\r\n const base = map || EMPTY_MAP;\r\n if (!base[resourceKey]) return base;\r\n const next: FavoritesState = Object.assign({}, base);\r\n delete next[resourceKey];\r\n return next;\r\n}\r\n\r\n/* ── hooks ──────────────────────────────────────────────────────────── */\r\n\r\nfunction useEnsureFavorites(store: PersonalizationStore): void {\r\n React.useEffect(\r\n function ensure() {\r\n store.ensureCapability(FAVORITES_CAPABILITY_ID);\r\n },\r\n [store]\r\n );\r\n}\r\n\r\nexport interface UseFavoritesResult {\r\n items: readonly FavoriteRef[];\r\n ids: Set<RowId>;\r\n count: number;\r\n isFavorite: (id: RowId) => boolean;\r\n add: (id: RowId) => void;\r\n remove: (id: RowId) => void;\r\n toggle: (id: RowId) => void;\r\n clear: () => void;\r\n}\r\n\r\n/**\r\n * useFavorites(resourceKey) — list, membership and actions for one resource.\r\n */\r\nexport function useFavorites(resourceKey: string): UseFavoritesResult {\r\n const store = usePersonalizationStore();\r\n useEnsureFavorites(store);\r\n\r\n const selectList = React.useCallback(\r\n function selectList(snapshot: PersonalizationSnapshot): readonly FavoriteRef[] {\r\n const slice = snapshot[FAVORITES_CAPABILITY_ID] as\r\n | FavoritesState\r\n | undefined;\r\n return slice ? listFor(slice, resourceKey) : EMPTY_LIST;\r\n },\r\n [resourceKey]\r\n );\r\n const items = useStoreSelector(selectList);\r\n\r\n // Stable while `items` is stable (structural sharing) → O(1) membership.\r\n const ids = React.useMemo(\r\n function buildIdSet(): Set<RowId> {\r\n const set = new Set<RowId>();\r\n for (const ref of items) set.add(ref.id);\r\n return set;\r\n },\r\n [items]\r\n );\r\n\r\n const add = React.useCallback(\r\n function add(id: RowId): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return addRef(prev, resourceKey, id);\r\n });\r\n },\r\n [store, resourceKey]\r\n );\r\n const remove = React.useCallback(\r\n function remove(id: RowId): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return removeRef(prev, resourceKey, id);\r\n });\r\n },\r\n [store, resourceKey]\r\n );\r\n const toggle = React.useCallback(\r\n function toggle(id: RowId): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return toggleRef(prev, resourceKey, id);\r\n });\r\n },\r\n [store, resourceKey]\r\n );\r\n const clear = React.useCallback(\r\n function clear(): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return clearRefs(prev, resourceKey);\r\n });\r\n },\r\n [store, resourceKey]\r\n );\r\n const isFavorite = React.useCallback(\r\n function isFavorite(id: RowId): boolean {\r\n return ids.has(id);\r\n },\r\n [ids]\r\n );\r\n\r\n return React.useMemo(\r\n function value(): UseFavoritesResult {\r\n return {\r\n items: items,\r\n ids: ids,\r\n count: items.length,\r\n isFavorite: isFavorite,\r\n add: add,\r\n remove: remove,\r\n toggle: toggle,\r\n clear: clear,\r\n };\r\n },\r\n [items, ids, isFavorite, add, remove, toggle, clear]\r\n );\r\n}\r\n\r\nexport interface UseIsFavoriteResult {\r\n isFavorite: boolean;\r\n toggle: () => void;\r\n add: () => void;\r\n remove: () => void;\r\n}\r\n\r\n/**\r\n * useIsFavorite(resourceKey, id) — focused per-row hook. Returns a boolean\r\n * (Object.is bail-out: a row re-renders only when ITS membership flips)\r\n * plus a bound toggle/add/remove. This is the cell-level hook the DataGrid\r\n * favorite column consumes (Batch 5).\r\n */\r\nexport function useIsFavorite(\r\n resourceKey: string,\r\n id: RowId\r\n): UseIsFavoriteResult {\r\n const store = usePersonalizationStore();\r\n useEnsureFavorites(store);\r\n\r\n const selectIsFavorite = React.useCallback(\r\n function selectIsFavorite(snapshot: PersonalizationSnapshot): boolean {\r\n const slice = snapshot[FAVORITES_CAPABILITY_ID] as\r\n | FavoritesState\r\n | undefined;\r\n return slice ? hasRef(slice, resourceKey, id) : false;\r\n },\r\n [resourceKey, id]\r\n );\r\n const isFavorite = useStoreSelector(selectIsFavorite);\r\n\r\n const toggle = React.useCallback(\r\n function toggle(): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return toggleRef(prev, resourceKey, id);\r\n });\r\n },\r\n [store, resourceKey, id]\r\n );\r\n const add = React.useCallback(\r\n function add(): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return addRef(prev, resourceKey, id);\r\n });\r\n },\r\n [store, resourceKey, id]\r\n );\r\n const remove = React.useCallback(\r\n function remove(): void {\r\n store.write<FavoritesState>(FAVORITES_CAPABILITY_ID, function (prev) {\r\n return removeRef(prev, resourceKey, id);\r\n });\r\n },\r\n [store, resourceKey, id]\r\n );\r\n\r\n return React.useMemo(\r\n function value(): UseIsFavoriteResult {\r\n return {\r\n isFavorite: isFavorite,\r\n toggle: toggle,\r\n add: add,\r\n remove: remove,\r\n };\r\n },\r\n [isFavorite, toggle, add, remove]\r\n );\r\n}\r\n"],"mappings":";;;;;;;;AAuBA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,uBAAA,GAAAF,OAAA;AAGmC,SAAAD,wBAAAI,CAAA,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EACD,CAACgC,KAAK,EAAEvB,WAAW,EAAET,EAAE,CACzB,CAAC;EACD,MAAMgD,GAAG,GAAG/E,KAAK,CAACsE,WAAW,CAC3B,SAASS,GAAGA,CAAA,EAAS;IACnBhB,KAAK,CAACiB,KAAK,CAAiBxD,uBAAuB,EAAE,UAAUyD,IAAI,EAAE;MACnE,OAAOlC,MAAM,CAACkC,IAAI,EAAEzC,WAAW,EAAET,EAAE,CAAC;IACtC,CAAC,CAAC;EACJ,CAAC,EACD,CAACgC,KAAK,EAAEvB,WAAW,EAAET,EAAE,CACzB,CAAC;EACD,MAAMmD,MAAM,GAAGlF,KAAK,CAACsE,WAAW,CAC9B,SAASY,MAAMA,CAAA,EAAS;IACtBnB,KAAK,CAACiB,KAAK,CAAiBxD,uBAAuB,EAAE,UAAUyD,IAAI,EAAE;MACnE,OAAOzB,SAAS,CAACyB,IAAI,EAAEzC,WAAW,EAAET,EAAE,CAAC;IACzC,CAAC,CAAC;EACJ,CAAC,EACD,CAACgC,KAAK,EAAEvB,WAAW,EAAET,EAAE,CACzB,CAAC;EAED,OAAO/B,KAAK,CAAC4E,OAAO,CAClB,SAASU,KAAKA,CAAA,EAAwB;IACpC,OAAO;MACLD,UAAU,EAAEA,UAAU;MACtBF,MAAM,EAAEA,MAAM;MACdJ,GAAG,EAAEA,GAAG;MACRG,MAAM,EAAEA;IACV,CAAC;EACH,CAAC,EACD,CAACG,UAAU,EAAEF,MAAM,EAAEJ,GAAG,EAAEG,MAAM,CAClC,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -10,11 +9,8 @@ exports.sortRowsByFavorites = sortRowsByFavorites;
|
|
|
10
9
|
exports.useFavoritesView = useFavoritesView;
|
|
11
10
|
var React = _interopRequireWildcard(require("react"));
|
|
12
11
|
var _favorites = require("./favorites");
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
16
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
17
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } /**
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
/**
|
|
18
14
|
* favoritesView — Portnet UI v2 · personalization
|
|
19
15
|
*
|
|
20
16
|
* Grid-agnostic favorites VIEW logic: filter (all / favorites-only) and
|
|
@@ -26,16 +22,17 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
26
22
|
* only reorder/subset the rows array the host already has — they never
|
|
27
23
|
* fetch or mutate.
|
|
28
24
|
*/
|
|
29
|
-
|
|
25
|
+
|
|
26
|
+
const FAVORITES_FILTER = exports.FAVORITES_FILTER = Object.freeze({
|
|
30
27
|
ALL: "all",
|
|
31
28
|
ONLY: "only"
|
|
32
29
|
});
|
|
33
|
-
|
|
30
|
+
const FAVORITES_SORT = exports.FAVORITES_SORT = Object.freeze({
|
|
34
31
|
NONE: "none",
|
|
35
32
|
FIRST: "first",
|
|
36
33
|
LAST: "last"
|
|
37
34
|
});
|
|
38
|
-
|
|
35
|
+
const EMPTY_ROWS = Object.freeze([]);
|
|
39
36
|
function toIdSet(ids) {
|
|
40
37
|
return ids instanceof Set ? ids : new Set(ids || []);
|
|
41
38
|
}
|
|
@@ -52,9 +49,9 @@ function resolveGetRowId(getRowId) {
|
|
|
52
49
|
function filterRowsByFavorites(rows, favoriteIds, getRowId, mode) {
|
|
53
50
|
if (mode !== FAVORITES_FILTER.ONLY || !Array.isArray(rows)) return rows;
|
|
54
51
|
// Array.isArray widened `rows` to any[]; re-establish the element type.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
const source = rows;
|
|
53
|
+
const ids = toIdSet(favoriteIds);
|
|
54
|
+
const getId = resolveGetRowId(getRowId);
|
|
58
55
|
return source.filter(function keepFavorite(r) {
|
|
59
56
|
return ids.has(getId(r));
|
|
60
57
|
});
|
|
@@ -70,22 +67,13 @@ function sortRowsByFavorites(rows, favoriteIds, getRowId, placement) {
|
|
|
70
67
|
return rows;
|
|
71
68
|
}
|
|
72
69
|
// Array.isArray widened `rows` to any[]; re-establish the element type.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
try {
|
|
81
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
82
|
-
var row = _step.value;
|
|
83
|
-
if (ids.has(getId(row))) fav.push(row);else rest.push(row);
|
|
84
|
-
}
|
|
85
|
-
} catch (err) {
|
|
86
|
-
_iterator.e(err);
|
|
87
|
-
} finally {
|
|
88
|
-
_iterator.f();
|
|
70
|
+
const source = rows;
|
|
71
|
+
const ids = toIdSet(favoriteIds);
|
|
72
|
+
const getId = resolveGetRowId(getRowId);
|
|
73
|
+
const fav = [];
|
|
74
|
+
const rest = [];
|
|
75
|
+
for (const row of source) {
|
|
76
|
+
if (ids.has(getId(row))) fav.push(row);else rest.push(row);
|
|
89
77
|
}
|
|
90
78
|
if (fav.length === 0 || rest.length === 0) return source; // nothing to reorder
|
|
91
79
|
return placement === FAVORITES_SORT.FIRST ? fav.concat(rest) : rest.concat(fav);
|
|
@@ -98,15 +86,15 @@ function sortRowsByFavorites(rows, favoriteIds, getRowId, placement) {
|
|
|
98
86
|
* reference is returned unchanged.
|
|
99
87
|
*/
|
|
100
88
|
function useFavoritesView(resourceKey, rows, options) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
89
|
+
const opts = options || {};
|
|
90
|
+
const getRowId = opts.getRowId;
|
|
91
|
+
const filterMode = opts.filterMode || FAVORITES_FILTER.ALL;
|
|
92
|
+
const sortPlacement = opts.sortPlacement || FAVORITES_SORT.NONE;
|
|
93
|
+
const fav = (0, _favorites.useFavorites)(resourceKey);
|
|
94
|
+
const ids = fav.ids;
|
|
95
|
+
const processed = React.useMemo(function compute() {
|
|
96
|
+
const base = Array.isArray(rows) ? rows : EMPTY_ROWS;
|
|
97
|
+
const filtered = filterRowsByFavorites(base, ids, getRowId, filterMode);
|
|
110
98
|
return sortRowsByFavorites(filtered, ids, getRowId, sortPlacement);
|
|
111
99
|
}, [rows, ids, getRowId, filterMode, sortPlacement]);
|
|
112
100
|
return React.useMemo(function value() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"favoritesView.js","names":["React","_interopRequireWildcard","require","_favorites","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","step","next","_e2","minLen","_arrayLikeToArray","toString","slice","constructor","name","from","test","arr","len","arr2","FAVORITES_FILTER","exports","freeze","ALL","ONLY","FAVORITES_SORT","NONE","FIRST","LAST","EMPTY_ROWS","toIdSet","ids","Set","resolveGetRowId","getRowId","defaultGetRowId","r","id","filterRowsByFavorites","rows","favoriteIds","mode","source","getId","filter","keepFavorite","sortRowsByFavorites","placement","fav","rest","_iterator","_step","row","push","concat","useFavoritesView","resourceKey","options","opts","filterMode","sortPlacement","useFavorites","processed","useMemo","compute","base","filtered","favoriteCount","count","isFiltering"],"sources":["../../../../src/lib/v2/personalization/capabilities/favoritesView.ts"],"sourcesContent":["/**\r\n * favoritesView — Portnet UI v2 · personalization\r\n *\r\n * Grid-agnostic favorites VIEW logic: filter (all / favorites-only) and\r\n * sort (favorites-first / favorites-last). Pure helpers usable anywhere,\r\n * plus a useFavoritesView hook that wires them to the favorites capability.\r\n *\r\n * The host owns its row id contract and the toggle UI (use FavoritesFilter\r\n * or any control bound to `filterMode` / `sortPlacement`). These helpers\r\n * only reorder/subset the rows array the host already has — they never\r\n * fetch or mutate.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { useFavorites } from \"./favorites\";\r\nimport type { RowId } from \"../../types/common\";\r\n\r\nexport const FAVORITES_FILTER = Object.freeze({\r\n ALL: \"all\",\r\n ONLY: \"only\",\r\n} as const);\r\nexport const FAVORITES_SORT = Object.freeze({\r\n NONE: \"none\",\r\n FIRST: \"first\",\r\n LAST: \"last\",\r\n} as const);\r\n\r\nexport type FavoritesFilterMode =\r\n (typeof FAVORITES_FILTER)[keyof typeof FAVORITES_FILTER];\r\nexport type FavoritesSortPlacement =\r\n (typeof FAVORITES_SORT)[keyof typeof FAVORITES_SORT];\r\n\r\nconst EMPTY_ROWS: readonly never[] = Object.freeze([]);\r\n\r\nfunction toIdSet(\r\n ids: Set<RowId> | readonly RowId[] | null | undefined\r\n): Set<RowId> {\r\n return ids instanceof Set ? ids : new Set(ids || []);\r\n}\r\n\r\nfunction resolveGetRowId<T>(getRowId?: (row: T) => RowId): (row: T) => RowId {\r\n return typeof getRowId === \"function\"\r\n ? getRowId\r\n : function defaultGetRowId(r: T): RowId {\r\n return (r as { id: RowId }).id;\r\n };\r\n}\r\n\r\n/**\r\n * Keep only favorited rows when mode === \"only\"; otherwise return `rows`\r\n * unchanged (same reference).\r\n */\r\nexport function filterRowsByFavorites<T>(\r\n rows: readonly T[],\r\n favoriteIds: Set<RowId> | readonly RowId[] | null | undefined,\r\n getRowId: ((row: T) => RowId) | undefined,\r\n mode: FavoritesFilterMode\r\n): readonly T[] {\r\n if (mode !== FAVORITES_FILTER.ONLY || !Array.isArray(rows)) return rows;\r\n // Array.isArray widened `rows` to any[]; re-establish the element type.\r\n const source: readonly T[] = rows;\r\n const ids = toIdSet(favoriteIds);\r\n const getId = resolveGetRowId(getRowId);\r\n return source.filter(function keepFavorite(r) {\r\n return ids.has(getId(r));\r\n });\r\n}\r\n\r\n/**\r\n * Move favorited rows to the front (\"first\") or back (\"last\"), preserving\r\n * the host's existing order WITHIN each group (stable partition). Returns\r\n * `rows` unchanged when placement is \"none\" or when reordering is a no-op.\r\n */\r\nexport function sortRowsByFavorites<T>(\r\n rows: readonly T[],\r\n favoriteIds: Set<RowId> | readonly RowId[] | null | undefined,\r\n getRowId: ((row: T) => RowId) | undefined,\r\n placement: FavoritesSortPlacement\r\n): readonly T[] {\r\n if (\r\n (placement !== FAVORITES_SORT.FIRST && placement !== FAVORITES_SORT.LAST) ||\r\n !Array.isArray(rows)\r\n ) {\r\n return rows;\r\n }\r\n // Array.isArray widened `rows` to any[]; re-establish the element type.\r\n const source: readonly T[] = rows;\r\n const ids = toIdSet(favoriteIds);\r\n const getId = resolveGetRowId(getRowId);\r\n const fav: T[] = [];\r\n const rest: T[] = [];\r\n for (const row of source) {\r\n if (ids.has(getId(row))) fav.push(row);\r\n else rest.push(row);\r\n }\r\n if (fav.length === 0 || rest.length === 0) return source; // nothing to reorder\r\n return placement === FAVORITES_SORT.FIRST\r\n ? fav.concat(rest)\r\n : rest.concat(fav);\r\n}\r\n\r\nexport interface UseFavoritesViewOptions<T> {\r\n /** Should be stable; MUST match the grid's getRowId. Defaults to (r) => r.id. */\r\n getRowId?: ((row: T) => RowId) | undefined;\r\n /** @default \"all\" */\r\n filterMode?: FavoritesFilterMode | undefined;\r\n /** @default \"none\" */\r\n sortPlacement?: FavoritesSortPlacement | undefined;\r\n}\r\n\r\nexport interface UseFavoritesViewResult<T> {\r\n rows: readonly T[];\r\n favoriteIds: Set<RowId>;\r\n favoriteCount: number;\r\n isFiltering: boolean;\r\n}\r\n\r\n/**\r\n * useFavoritesView(resourceKey, rows, options)\r\n *\r\n * Reads the favorites id Set for `resourceKey` and applies the favorites\r\n * filter + sort to `rows`. In the all/none case the original `rows`\r\n * reference is returned unchanged.\r\n */\r\nexport function useFavoritesView<T>(\r\n resourceKey: string,\r\n rows: readonly T[],\r\n options?: UseFavoritesViewOptions<T>\r\n): UseFavoritesViewResult<T> {\r\n const opts: UseFavoritesViewOptions<T> = options || {};\r\n const getRowId = opts.getRowId;\r\n const filterMode = opts.filterMode || FAVORITES_FILTER.ALL;\r\n const sortPlacement = opts.sortPlacement || FAVORITES_SORT.NONE;\r\n\r\n const fav = useFavorites(resourceKey);\r\n const ids = fav.ids;\r\n\r\n const processed = React.useMemo(\r\n function compute(): readonly T[] {\r\n const base: readonly T[] = Array.isArray(rows) ? rows : EMPTY_ROWS;\r\n const filtered = filterRowsByFavorites(base, ids, getRowId, filterMode);\r\n return sortRowsByFavorites(filtered, ids, getRowId, sortPlacement);\r\n },\r\n [rows, ids, getRowId, filterMode, sortPlacement]\r\n );\r\n\r\n return React.useMemo(\r\n function value(): UseFavoritesViewResult<T> {\r\n return {\r\n rows: processed,\r\n favoriteIds: ids,\r\n favoriteCount: fav.count,\r\n isFiltering: filterMode === FAVORITES_FILTER.ONLY,\r\n };\r\n },\r\n [processed, ids, fav.count, filterMode]\r\n );\r\n}\r\n"],"mappings":";;;;;;;;;;AAaA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAA2C,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,uCAAAA,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,K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AAE/B,GAAG,EAAEiB,GAAG,CAACoB,KAAK,EAAET,UAAU,CACxC,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"favoritesView.js","names":["React","_interopRequireWildcard","require","_favorites","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","FAVORITES_FILTER","exports","freeze","ALL","ONLY","FAVORITES_SORT","NONE","FIRST","LAST","EMPTY_ROWS","toIdSet","ids","Set","resolveGetRowId","getRowId","defaultGetRowId","id","filterRowsByFavorites","rows","favoriteIds","mode","Array","isArray","source","getId","filter","keepFavorite","sortRowsByFavorites","placement","fav","rest","row","push","length","concat","useFavoritesView","resourceKey","options","opts","filterMode","sortPlacement","useFavorites","processed","useMemo","compute","base","filtered","value","favoriteCount","count","isFiltering"],"sources":["../../../../src/lib/v2/personalization/capabilities/favoritesView.ts"],"sourcesContent":["/**\r\n * favoritesView — Portnet UI v2 · personalization\r\n *\r\n * Grid-agnostic favorites VIEW logic: filter (all / favorites-only) and\r\n * sort (favorites-first / favorites-last). Pure helpers usable anywhere,\r\n * plus a useFavoritesView hook that wires them to the favorites capability.\r\n *\r\n * The host owns its row id contract and the toggle UI (use FavoritesFilter\r\n * or any control bound to `filterMode` / `sortPlacement`). These helpers\r\n * only reorder/subset the rows array the host already has — they never\r\n * fetch or mutate.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { useFavorites } from \"./favorites\";\r\nimport type { RowId } from \"../../types/common\";\r\n\r\nexport const FAVORITES_FILTER = Object.freeze({\r\n ALL: \"all\",\r\n ONLY: \"only\",\r\n} as const);\r\nexport const FAVORITES_SORT = Object.freeze({\r\n NONE: \"none\",\r\n FIRST: \"first\",\r\n LAST: \"last\",\r\n} as const);\r\n\r\nexport type FavoritesFilterMode =\r\n (typeof FAVORITES_FILTER)[keyof typeof FAVORITES_FILTER];\r\nexport type FavoritesSortPlacement =\r\n (typeof FAVORITES_SORT)[keyof typeof FAVORITES_SORT];\r\n\r\nconst EMPTY_ROWS: readonly never[] = Object.freeze([]);\r\n\r\nfunction toIdSet(\r\n ids: Set<RowId> | readonly RowId[] | null | undefined\r\n): Set<RowId> {\r\n return ids instanceof Set ? ids : new Set(ids || []);\r\n}\r\n\r\nfunction resolveGetRowId<T>(getRowId?: (row: T) => RowId): (row: T) => RowId {\r\n return typeof getRowId === \"function\"\r\n ? getRowId\r\n : function defaultGetRowId(r: T): RowId {\r\n return (r as { id: RowId }).id;\r\n };\r\n}\r\n\r\n/**\r\n * Keep only favorited rows when mode === \"only\"; otherwise return `rows`\r\n * unchanged (same reference).\r\n */\r\nexport function filterRowsByFavorites<T>(\r\n rows: readonly T[],\r\n favoriteIds: Set<RowId> | readonly RowId[] | null | undefined,\r\n getRowId: ((row: T) => RowId) | undefined,\r\n mode: FavoritesFilterMode\r\n): readonly T[] {\r\n if (mode !== FAVORITES_FILTER.ONLY || !Array.isArray(rows)) return rows;\r\n // Array.isArray widened `rows` to any[]; re-establish the element type.\r\n const source: readonly T[] = rows;\r\n const ids = toIdSet(favoriteIds);\r\n const getId = resolveGetRowId(getRowId);\r\n return source.filter(function keepFavorite(r) {\r\n return ids.has(getId(r));\r\n });\r\n}\r\n\r\n/**\r\n * Move favorited rows to the front (\"first\") or back (\"last\"), preserving\r\n * the host's existing order WITHIN each group (stable partition). Returns\r\n * `rows` unchanged when placement is \"none\" or when reordering is a no-op.\r\n */\r\nexport function sortRowsByFavorites<T>(\r\n rows: readonly T[],\r\n favoriteIds: Set<RowId> | readonly RowId[] | null | undefined,\r\n getRowId: ((row: T) => RowId) | undefined,\r\n placement: FavoritesSortPlacement\r\n): readonly T[] {\r\n if (\r\n (placement !== FAVORITES_SORT.FIRST && placement !== FAVORITES_SORT.LAST) ||\r\n !Array.isArray(rows)\r\n ) {\r\n return rows;\r\n }\r\n // Array.isArray widened `rows` to any[]; re-establish the element type.\r\n const source: readonly T[] = rows;\r\n const ids = toIdSet(favoriteIds);\r\n const getId = resolveGetRowId(getRowId);\r\n const fav: T[] = [];\r\n const rest: T[] = [];\r\n for (const row of source) {\r\n if (ids.has(getId(row))) fav.push(row);\r\n else rest.push(row);\r\n }\r\n if (fav.length === 0 || rest.length === 0) return source; // nothing to reorder\r\n return placement === FAVORITES_SORT.FIRST\r\n ? fav.concat(rest)\r\n : rest.concat(fav);\r\n}\r\n\r\nexport interface UseFavoritesViewOptions<T> {\r\n /** Should be stable; MUST match the grid's getRowId. Defaults to (r) => r.id. */\r\n getRowId?: ((row: T) => RowId) | undefined;\r\n /** @default \"all\" */\r\n filterMode?: FavoritesFilterMode | undefined;\r\n /** @default \"none\" */\r\n sortPlacement?: FavoritesSortPlacement | undefined;\r\n}\r\n\r\nexport interface UseFavoritesViewResult<T> {\r\n rows: readonly T[];\r\n favoriteIds: Set<RowId>;\r\n favoriteCount: number;\r\n isFiltering: boolean;\r\n}\r\n\r\n/**\r\n * useFavoritesView(resourceKey, rows, options)\r\n *\r\n * Reads the favorites id Set for `resourceKey` and applies the favorites\r\n * filter + sort to `rows`. In the all/none case the original `rows`\r\n * reference is returned unchanged.\r\n */\r\nexport function useFavoritesView<T>(\r\n resourceKey: string,\r\n rows: readonly T[],\r\n options?: UseFavoritesViewOptions<T>\r\n): UseFavoritesViewResult<T> {\r\n const opts: UseFavoritesViewOptions<T> = options || {};\r\n const getRowId = opts.getRowId;\r\n const filterMode = opts.filterMode || FAVORITES_FILTER.ALL;\r\n const sortPlacement = opts.sortPlacement || FAVORITES_SORT.NONE;\r\n\r\n const fav = useFavorites(resourceKey);\r\n const ids = fav.ids;\r\n\r\n const processed = React.useMemo(\r\n function compute(): readonly T[] {\r\n const base: readonly T[] = Array.isArray(rows) ? rows : EMPTY_ROWS;\r\n const filtered = filterRowsByFavorites(base, ids, getRowId, filterMode);\r\n return sortRowsByFavorites(filtered, ids, getRowId, sortPlacement);\r\n },\r\n [rows, ids, getRowId, filterMode, sortPlacement]\r\n );\r\n\r\n return React.useMemo(\r\n function value(): UseFavoritesViewResult<T> {\r\n return {\r\n rows: processed,\r\n favoriteIds: ids,\r\n favoriteCount: fav.count,\r\n isFiltering: filterMode === FAVORITES_FILTER.ONLY,\r\n };\r\n },\r\n [processed, ids, fav.count, filterMode]\r\n );\r\n}\r\n"],"mappings":";;;;;;;;;AAaA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAA2C,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAf3C;AACA;AAC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D,IAAI,CAACC,UAAU,IAAIvC,gBAAgB,CAACG,GAAG;EAC1D,MAAMqC,aAAa,GAAGF,IAAI,CAACE,aAAa,IAAInC,cAAc,CAACC,IAAI;EAE/D,MAAMuB,GAAG,GAAG,IAAAY,uBAAY,EAACL,WAAW,CAAC;EACrC,MAAMzB,GAAG,GAAGkB,GAAG,CAAClB,GAAG;EAEnB,MAAM+B,SAAS,GAAGjE,KAAK,CAACkE,OAAO,CAC7B,SAASC,OAAOA,CAAA,EAAiB;IAC/B,MAAMC,IAAkB,GAAGxB,KAAK,CAACC,OAAO,CAACJ,IAAI,CAAC,GAAGA,IAAI,GAAGT,UAAU;IAClE,MAAMqC,QAAQ,GAAG7B,qBAAqB,CAAC4B,IAAI,EAAElC,GAAG,EAAEG,QAAQ,EAAEyB,UAAU,CAAC;IACvE,OAAOZ,mBAAmB,CAACmB,QAAQ,EAAEnC,GAAG,EAAEG,QAAQ,EAAE0B,aAAa,CAAC;EACpE,CAAC,EACD,CAACtB,IAAI,EAAEP,GAAG,EAAEG,QAAQ,EAAEyB,UAAU,EAAEC,aAAa,CACjD,CAAC;EAED,OAAO/D,KAAK,CAACkE,OAAO,CAClB,SAASI,KAAKA,CAAA,EAA8B;IAC1C,OAAO;MACL7B,IAAI,EAAEwB,SAAS;MACfvB,WAAW,EAAER,GAAG;MAChBqC,aAAa,EAAEnB,GAAG,CAACoB,KAAK;MACxBC,WAAW,EAAEX,UAAU,KAAKvC,gBAAgB,CAACI;IAC/C,CAAC;EACH,CAAC,EACD,CAACsC,SAAS,EAAE/B,GAAG,EAAEkB,GAAG,CAACoB,KAAK,EAAEV,UAAU,CACxC,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gridPreferences — Portnet UI v2 · personalization capability
|
|
3
|
+
*
|
|
4
|
+
* Per-user, per-resource DataGrid preferences. Self-registers the
|
|
5
|
+
* "gridPreferences" capability with the schema registry at import time, so the
|
|
6
|
+
* capability-agnostic foundation discovers its schemaVersion / defaultState /
|
|
7
|
+
* migrate without any hardcoding.
|
|
8
|
+
*
|
|
9
|
+
* State model (the capability payload):
|
|
10
|
+
* { [resourceKey]: { hiddenColumns: string[] } }
|
|
11
|
+
*
|
|
12
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
13
|
+
* WHY THIS BELONGS IN THE LIBRARY (capability gap G-35)
|
|
14
|
+
*
|
|
15
|
+
* `DataGridToolbar` owns the column-visibility UI (`hiddenColumns` +
|
|
16
|
+
* `onHiddenColumnsChange`) but deliberately holds no state, so PERSISTING the
|
|
17
|
+
* choice is left to the host. Every listing screen therefore reached for raw
|
|
18
|
+
* `localStorage` — observed in onssa-export-fe as
|
|
19
|
+
* `"onssaCertificates:listing:hiddenColumns"`, hand-written JSON.parse
|
|
20
|
+
* included.
|
|
21
|
+
*
|
|
22
|
+
* That is not merely duplication. A bare `localStorage` key is NOT USER-SCOPED,
|
|
23
|
+
* while this foundation's own key scheme is:
|
|
24
|
+
*
|
|
25
|
+
* portnet-ui:perso:v1:{tenantId?}:{userId}:{capabilityId}
|
|
26
|
+
*
|
|
27
|
+
* So on a shared workstation — the norm at a port — user B inherited user A's
|
|
28
|
+
* hidden columns, and a column A had hidden stayed invisible to B with no
|
|
29
|
+
* affordance explaining why. Favorites and saved filters were already immune
|
|
30
|
+
* because they route through this foundation; column visibility was the one
|
|
31
|
+
* grid preference that did not.
|
|
32
|
+
*
|
|
33
|
+
* It could not be fixed in a host, either. `registerCapability` is exported as
|
|
34
|
+
* a "capability registration seam — for custom/host-defined capabilities", but
|
|
35
|
+
* the two primitives every capability hook needs — `usePersonalizationStore`
|
|
36
|
+
* and `useStoreSelector` — are deliberately private ("architecture doc §2.8 —
|
|
37
|
+
* minimum API surface"). A host could register a descriptor and then had no way
|
|
38
|
+
* to read or write its payload. The seam was advertised but not complete, so
|
|
39
|
+
* the slice has to live here, exactly like favorites and savedFilters.
|
|
40
|
+
*
|
|
41
|
+
* DENSITY IS DELIBERATELY NOT PART OF THIS. `useDensity` (v2/hooks) owns the
|
|
42
|
+
* density preference as a GLOBAL, non-resource-scoped value on its own
|
|
43
|
+
* `portnet-ui-density` key, and it applies `data-density` to <html>. Folding it
|
|
44
|
+
* in here would give one preference two owners. Note however that it is
|
|
45
|
+
* unscoped for the same reason this capability exists — tracked separately,
|
|
46
|
+
* since moving it into the foundation changes its storage key and would make it
|
|
47
|
+
* require a provider (a breaking change for current callers).
|
|
48
|
+
* ─────────────────────────────────────────────────────────────────────────────
|
|
49
|
+
*
|
|
50
|
+
* Usage:
|
|
51
|
+
*
|
|
52
|
+
* const { hiddenColumns, setHiddenColumns } = useGridPreferences("ti:list");
|
|
53
|
+
*
|
|
54
|
+
* <DataGridToolbar
|
|
55
|
+
* columns={columns}
|
|
56
|
+
* hiddenColumns={hiddenColumns}
|
|
57
|
+
* onHiddenColumnsChange={setHiddenColumns}
|
|
58
|
+
* … />
|
|
59
|
+
* <DataGrid columns={columns} hiddenColumns={hiddenColumns} … />
|
|
60
|
+
*
|
|
61
|
+
* `resourceKey` namespaces preferences per list (e.g. "ti:list",
|
|
62
|
+
* "declarations:list") so two grids in one app never collide. Requires a
|
|
63
|
+
* <UserPersonalizationProvider> ancestor.
|
|
64
|
+
*
|
|
65
|
+
* Performance: the pure helpers rebuild only the touched resourceKey's entry
|
|
66
|
+
* and shallow-copy the map, so the store's structural sharing keeps every OTHER
|
|
67
|
+
* resource's preferences referentially stable — and the exposed `Set` is
|
|
68
|
+
* memoised on the stored array, so its identity survives re-renders and does
|
|
69
|
+
* not defeat DataGrid's memoisation.
|
|
70
|
+
*/
|
|
71
|
+
/** One resource's grid preferences. Optional members so the shape can grow
|
|
72
|
+
* (column order, widths) without a schemaVersion bump. */
|
|
73
|
+
export interface GridPreferencesEntry {
|
|
74
|
+
hiddenColumns?: string[] | undefined;
|
|
75
|
+
}
|
|
76
|
+
export declare const GRID_PREFERENCES_CAPABILITY_ID = "gridPreferences";
|
|
77
|
+
export interface UseGridPreferencesResult {
|
|
78
|
+
/**
|
|
79
|
+
* Hidden column keys, ready to hand straight to DataGrid /
|
|
80
|
+
* DataGridToolbar.
|
|
81
|
+
*
|
|
82
|
+
* A mutable `Set`, not a `ReadonlySet`, on purpose: both components declare
|
|
83
|
+
* `hiddenColumns?: Set<string> | string[]`, and `ReadonlySet` is not
|
|
84
|
+
* assignable to `Set` (no add/delete/clear), so a readonly type would force
|
|
85
|
+
* every call site into a cast. This mirrors `useFavorites().ids`. Treat it
|
|
86
|
+
* as read-only regardless — it is memoised and shared, so mutating it in
|
|
87
|
+
* place would desynchronise the store without persisting anything.
|
|
88
|
+
*/
|
|
89
|
+
hiddenColumns: Set<string>;
|
|
90
|
+
/** Replace the hidden-column set. Accepts a Set or an array. */
|
|
91
|
+
setHiddenColumns: (hidden: Iterable<string>) => void;
|
|
92
|
+
/** Show every column again (drops this resource's entry). */
|
|
93
|
+
resetHiddenColumns: () => void;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* useGridPreferences(resourceKey) — persisted, per-user grid preferences for
|
|
97
|
+
* one resource.
|
|
98
|
+
*/
|
|
99
|
+
export declare function useGridPreferences(resourceKey: string): UseGridPreferencesResult;
|
|
100
|
+
//# sourceMappingURL=gridPreferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gridPreferences.d.ts","sourceRoot":"","sources":["../../../../src/lib/v2/personalization/capabilities/gridPreferences.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAcH;2DAC2D;AAC3D,MAAM,WAAW,oBAAoB;IACnC,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACtC;AAKD,eAAO,MAAM,8BAA8B,oBAAoB,CAAC;AAmGhE,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;;OAUG;IACH,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,gEAAgE;IAChE,gBAAgB,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IACrD,6DAA6D;IAC7D,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,GAClB,wBAAwB,CA6D1B"}
|