@flipdish/ui-library 0.70.0 → 0.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/__internal__/controlFill/controlFill.context.cjs +13 -0
- package/dist/components/__internal__/controlFill/controlFill.context.cjs.map +1 -0
- package/dist/components/__internal__/controlFill/controlFill.context.d.ts +7 -0
- package/dist/components/__internal__/controlFill/controlFill.context.d.ts.map +1 -0
- package/dist/components/__internal__/controlFill/controlFill.context.js +11 -0
- package/dist/components/__internal__/controlFill/controlFill.context.js.map +1 -0
- package/dist/components/__internal__/focusHandOff/focusHandOff.context.cjs +13 -0
- package/dist/components/__internal__/focusHandOff/focusHandOff.context.cjs.map +1 -0
- package/dist/components/__internal__/focusHandOff/focusHandOff.context.d.ts +8 -0
- package/dist/components/__internal__/focusHandOff/focusHandOff.context.d.ts.map +1 -0
- package/dist/components/__internal__/focusHandOff/focusHandOff.context.js +11 -0
- package/dist/components/__internal__/focusHandOff/focusHandOff.context.js.map +1 -0
- package/dist/components/atoms/Buttons/IconButton/IconButton.cjs +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.cjs.map +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.js +1 -1
- package/dist/components/atoms/Buttons/IconButton/IconButton.js.map +1 -1
- package/dist/components/molecules/EmptyState/index.cjs +9 -1
- package/dist/components/molecules/EmptyState/index.cjs.map +1 -1
- package/dist/components/molecules/EmptyState/index.d.ts.map +1 -1
- package/dist/components/molecules/EmptyState/index.js +11 -3
- package/dist/components/molecules/EmptyState/index.js.map +1 -1
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.cjs +13 -0
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.cjs.map +1 -1
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.d.ts +8 -0
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.d.ts.map +1 -1
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.js +13 -1
- package/dist/components/molecules/EmptyState/utilities/emptyState.utils.js.map +1 -1
- package/dist/components/molecules/Modals/Modal/Modal.cjs +6 -5
- package/dist/components/molecules/Modals/Modal/Modal.cjs.map +1 -1
- package/dist/components/molecules/Modals/Modal/Modal.d.ts.map +1 -1
- package/dist/components/molecules/Modals/Modal/Modal.js +6 -5
- package/dist/components/molecules/Modals/Modal/Modal.js.map +1 -1
- package/dist/components/molecules/Paginations/utilities/paginationScroll.utils.cjs +1 -1
- package/dist/components/molecules/Paginations/utilities/paginationScroll.utils.d.ts +1 -1
- package/dist/components/molecules/Paginations/utilities/paginationScroll.utils.d.ts.map +1 -1
- package/dist/components/molecules/Paginations/utilities/paginationScroll.utils.js +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs +4 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.cjs.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js +5 -2
- package/dist/components/organisms/DatePickers/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.cjs +11 -6
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.cjs.map +1 -1
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.d.ts +4 -2
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.d.ts.map +1 -1
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.js +12 -7
- package/dist/components/organisms/FilterBar/components/FilterDropdownMenu.js.map +1 -1
- package/dist/components/organisms/FilterBar/hooks/useFilterDraft.cjs +53 -0
- package/dist/components/organisms/FilterBar/hooks/useFilterDraft.cjs.map +1 -0
- package/dist/components/organisms/FilterBar/hooks/useFilterDraft.d.ts +41 -0
- package/dist/components/organisms/FilterBar/hooks/useFilterDraft.d.ts.map +1 -0
- package/dist/components/organisms/FilterBar/hooks/useFilterDraft.js +51 -0
- package/dist/components/organisms/FilterBar/hooks/useFilterDraft.js.map +1 -0
- package/dist/components/organisms/FilterBar/index.cjs +19 -7
- package/dist/components/organisms/FilterBar/index.cjs.map +1 -1
- package/dist/components/organisms/FilterBar/index.d.ts +1 -0
- package/dist/components/organisms/FilterBar/index.d.ts.map +1 -1
- package/dist/components/organisms/FilterBar/index.js +18 -7
- package/dist/components/organisms/FilterBar/index.js.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.cjs +3 -1
- package/dist/components/organisms/SlideoutMenu/index.cjs.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.js +3 -1
- package/dist/components/organisms/SlideoutMenu/index.js.map +1 -1
- package/dist/components/organisms/Table/index.cjs +14 -285
- package/dist/components/organisms/Table/index.cjs.map +1 -1
- package/dist/components/organisms/Table/index.d.ts +29 -138
- package/dist/components/organisms/Table/index.d.ts.map +1 -1
- package/dist/components/organisms/Table/index.js +13 -284
- package/dist/components/organisms/Table/index.js.map +1 -1
- package/dist/components/organisms/Tables/Table/Table.cjs +305 -0
- package/dist/components/organisms/Tables/Table/Table.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/Table.d.ts +146 -0
- package/dist/components/organisms/Tables/Table/Table.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/Table.js +301 -0
- package/dist/components/organisms/Tables/Table/Table.js.map +1 -0
- package/dist/components/organisms/Tables/Table/Table.styles.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/Table.styles.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/Table.styles.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/Table.styles.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardList.cjs +2 -2
- package/dist/components/organisms/Tables/Table/components/TableCardList.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardList.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/components/TableCardList.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardList.js +2 -2
- package/dist/components/organisms/Tables/Table/components/TableCardList.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardRow.cjs +8 -4
- package/dist/components/organisms/Tables/Table/components/TableCardRow.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardRow.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/components/TableCardRow.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableCardRow.js +9 -5
- package/dist/components/organisms/Tables/Table/components/TableCardRow.js.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableCardsSelectAll.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableCardsSelectAll.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableCardsSelectAll.js.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableEmptyState.cjs +17 -0
- package/dist/components/organisms/Tables/Table/components/TableEmptyState.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableEmptyState.d.ts +5 -0
- package/dist/components/organisms/Tables/Table/components/TableEmptyState.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableEmptyState.js +15 -0
- package/dist/components/organisms/Tables/Table/components/TableEmptyState.js.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableFallbackCard.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableFallbackCard.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/components/TableFallbackCard.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableFallbackCard.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableRowCard.cjs +3 -3
- package/dist/components/organisms/Tables/Table/components/TableRowCard.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableRowCard.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/components/TableRowCard.js +3 -3
- package/dist/components/organisms/Tables/Table/components/TableRowCard.js.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableSortIcon.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableSortIcon.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/components/TableSortIcon.js.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useBusyCount.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useBusyCount.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useBusyCount.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useFirstSortDirection.cjs +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useFirstSortDirection.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useFirstSortDirection.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useFirstSortDirection.js +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useFirstSortDirection.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useIsPlaceholderPage.cjs +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useIsPlaceholderPage.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useIsPlaceholderPage.js +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useIsPlaceholderPage.js.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/usePlaceholderRows.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/usePlaceholderRows.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/hooks/usePlaceholderRows.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/usePlaceholderRows.js.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useSelectableRowRegistry.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useSelectableRowRegistry.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useSelectableRowRegistry.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useSelectableRowRegistry.js.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.cjs +83 -0
- package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.d.ts +23 -0
- package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.js +81 -0
- package/dist/components/organisms/Tables/Table/hooks/useTableFocusHandOff.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useTableSelection.cjs +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useTableSelection.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useTableSelection.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useTableSelection.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/hooks/useTableSelection.js +1 -1
- package/dist/components/organisms/Tables/Table/hooks/useTableSelection.js.map +1 -0
- package/dist/components/organisms/Tables/Table/providers/Table.context.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/providers/Table.context.d.ts +4 -1
- package/dist/components/organisms/Tables/Table/providers/Table.context.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/providers/Table.context.js.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.cjs +55 -0
- package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.d.ts +25 -0
- package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.js +51 -0
- package/dist/components/organisms/Tables/Table/utilities/tableFocusHandOff.utils.js.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/utilities/tableLoading.utils.cjs +1 -1
- package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/utilities/tableLoading.utils.d.ts +1 -1
- package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.d.ts.map +1 -0
- package/dist/components/organisms/{Table → Tables/Table}/utilities/tableLoading.utils.js +1 -1
- package/dist/components/organisms/Tables/Table/utilities/tableLoading.utils.js.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableSelection.utils.cjs.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableSelection.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/Table/utilities/tableSelection.utils.js.map +1 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.cjs +34 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.cjs.map +1 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.d.ts +37 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.d.ts.map +1 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.js +32 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/TableLayoutToggle.js.map +1 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.cjs +32 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.cjs.map +1 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.d.ts +21 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.d.ts.map +1 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.js +30 -0
- package/dist/components/organisms/Tables/TableLayoutToggle/hooks/useTableLayoutToggle.js.map +1 -0
- package/dist/components/organisms/{Table/components → Tables/TableSortMenu}/TableSortMenu.cjs +9 -2
- package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.cjs.map +1 -0
- package/dist/components/organisms/{Table/components → Tables/TableSortMenu}/TableSortMenu.d.ts +18 -6
- package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.d.ts.map +1 -0
- package/dist/components/organisms/{Table/components → Tables/TableSortMenu}/TableSortMenu.js +9 -2
- package/dist/components/organisms/Tables/TableSortMenu/TableSortMenu.js.map +1 -0
- package/dist/components/organisms/Tables/hooks/useIsAtLeastMd.cjs.map +1 -0
- package/dist/components/organisms/Tables/hooks/useIsAtLeastMd.d.ts.map +1 -0
- package/dist/components/organisms/Tables/hooks/useIsAtLeastMd.js.map +1 -0
- package/dist/components/organisms/Tables/hooks/useStoredTableLayout.cjs +84 -0
- package/dist/components/organisms/Tables/hooks/useStoredTableLayout.cjs.map +1 -0
- package/dist/components/organisms/Tables/hooks/useStoredTableLayout.d.ts +20 -0
- package/dist/components/organisms/Tables/hooks/useStoredTableLayout.d.ts.map +1 -0
- package/dist/components/organisms/Tables/hooks/useStoredTableLayout.js +81 -0
- package/dist/components/organisms/Tables/hooks/useStoredTableLayout.js.map +1 -0
- package/dist/components/organisms/Tables/index.cjs +14 -0
- package/dist/components/organisms/Tables/index.cjs.map +1 -0
- package/dist/components/organisms/Tables/index.d.ts +19 -0
- package/dist/components/organisms/Tables/index.d.ts.map +1 -0
- package/dist/components/organisms/Tables/index.js +4 -0
- package/dist/components/organisms/Tables/index.js.map +1 -0
- package/dist/components/organisms/{Table/table.types.d.ts → Tables/tables.types.d.ts} +4 -2
- package/dist/components/organisms/Tables/tables.types.d.ts.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableCard.utils.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables}/utilities/tableCard.utils.d.ts +1 -1
- package/dist/components/organisms/Tables/utilities/tableCard.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableCard.utils.js.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableChildren.utils.cjs.map +1 -0
- package/dist/components/organisms/{Table → Tables}/utilities/tableChildren.utils.d.ts +1 -1
- package/dist/components/organisms/Tables/utilities/tableChildren.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableChildren.utils.js.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableIterable.utils.cjs.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableIterable.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableIterable.utils.js.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableSort.utils.cjs.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableSort.utils.d.ts.map +1 -0
- package/dist/components/organisms/Tables/utilities/tableSort.utils.js.map +1 -0
- package/dist/hooks/{useFocusHandOff/index.cjs → __internal__/useFocusHandOff/useFocusHandOff.cjs} +2 -2
- package/dist/hooks/__internal__/useFocusHandOff/useFocusHandOff.cjs.map +1 -0
- package/dist/hooks/{useFocusHandOff/index.d.ts → __internal__/useFocusHandOff/useFocusHandOff.d.ts} +1 -1
- package/dist/hooks/__internal__/useFocusHandOff/useFocusHandOff.d.ts.map +1 -0
- package/dist/hooks/{useFocusHandOff/index.js → __internal__/useFocusHandOff/useFocusHandOff.js} +2 -2
- package/dist/hooks/__internal__/useFocusHandOff/useFocusHandOff.js.map +1 -0
- package/dist/hooks/useFocusAfterRetry/index.cjs +2 -2
- package/dist/hooks/useFocusAfterRetry/index.d.ts +1 -1
- package/dist/hooks/useFocusAfterRetry/index.js +2 -2
- package/dist/hooks/useListQueryParams/index.cjs +238 -0
- package/dist/hooks/useListQueryParams/index.cjs.map +1 -0
- package/dist/hooks/useListQueryParams/index.d.ts +77 -0
- package/dist/hooks/useListQueryParams/index.d.ts.map +1 -0
- package/dist/hooks/useListQueryParams/index.js +236 -0
- package/dist/hooks/useListQueryParams/index.js.map +1 -0
- package/dist/hooks/useLoadState/index.cjs +69 -0
- package/dist/hooks/useLoadState/index.cjs.map +1 -0
- package/dist/hooks/useLoadState/index.d.ts +44 -0
- package/dist/hooks/useLoadState/index.d.ts.map +1 -0
- package/dist/hooks/useLoadState/index.js +67 -0
- package/dist/hooks/useLoadState/index.js.map +1 -0
- package/dist/hooks/usePagedList/index.cjs +61 -0
- package/dist/hooks/usePagedList/index.cjs.map +1 -0
- package/dist/hooks/usePagedList/index.d.ts +56 -0
- package/dist/hooks/usePagedList/index.d.ts.map +1 -0
- package/dist/hooks/usePagedList/index.js +59 -0
- package/dist/hooks/usePagedList/index.js.map +1 -0
- package/dist/native/{hooks/useFocusHandOff → components/organisms/Tables}/index.d.ts +3 -3
- package/dist/native/hooks/useListQueryParams/index.d.ts +12 -0
- package/dist/native/hooks/useLoadState/index.d.ts +12 -0
- package/dist/native/hooks/usePagedList/index.d.ts +12 -0
- package/dist/native/utilities/listQueryUtils/index.d.ts +12 -0
- package/dist/styles.css +3 -3
- package/dist/utilities/__internal__/listStateUtils/listState.utils.cjs +47 -0
- package/dist/utilities/__internal__/listStateUtils/listState.utils.cjs.map +1 -0
- package/dist/utilities/__internal__/listStateUtils/listState.utils.d.ts +51 -0
- package/dist/utilities/__internal__/listStateUtils/listState.utils.d.ts.map +1 -0
- package/dist/utilities/__internal__/listStateUtils/listState.utils.js +43 -0
- package/dist/utilities/__internal__/listStateUtils/listState.utils.js.map +1 -0
- package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.cjs +67 -0
- package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.cjs.map +1 -0
- package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.d.ts +27 -0
- package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.d.ts.map +1 -0
- package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.js +64 -0
- package/dist/utilities/__internal__/stableKeyUtils/stableKey.utils.js.map +1 -0
- package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.cjs +28 -0
- package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.cjs.map +1 -1
- package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.d.ts +10 -0
- package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.d.ts.map +1 -1
- package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.js +28 -1
- package/dist/utilities/__internal__/webStorageUtils/webStorage.utils.js.map +1 -1
- package/dist/utilities/listQueryUtils/index.cjs +59 -0
- package/dist/utilities/listQueryUtils/index.cjs.map +1 -0
- package/dist/utilities/listQueryUtils/index.d.ts +46 -0
- package/dist/utilities/listQueryUtils/index.d.ts.map +1 -0
- package/dist/utilities/listQueryUtils/index.js +55 -0
- package/dist/utilities/listQueryUtils/index.js.map +1 -0
- package/dist/utilities/localStorageUtils/localStorageUtils.constants.cjs +2 -0
- package/dist/utilities/localStorageUtils/localStorageUtils.constants.cjs.map +1 -1
- package/dist/utilities/localStorageUtils/localStorageUtils.constants.d.ts +2 -0
- package/dist/utilities/localStorageUtils/localStorageUtils.constants.d.ts.map +1 -1
- package/dist/utilities/localStorageUtils/localStorageUtils.constants.js +2 -0
- package/dist/utilities/localStorageUtils/localStorageUtils.constants.js.map +1 -1
- package/package.json +3 -3
- package/dist/components/organisms/Table/Table.styles.cjs.map +0 -1
- package/dist/components/organisms/Table/Table.styles.d.ts.map +0 -1
- package/dist/components/organisms/Table/Table.styles.js.map +0 -1
- package/dist/components/organisms/Table/components/TableCardList.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableCardList.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableCardList.js.map +0 -1
- package/dist/components/organisms/Table/components/TableCardRow.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableCardRow.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableCardRow.js.map +0 -1
- package/dist/components/organisms/Table/components/TableCardsSelectAll.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableCardsSelectAll.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableCardsSelectAll.js.map +0 -1
- package/dist/components/organisms/Table/components/TableFallbackCard.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableFallbackCard.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableFallbackCard.js.map +0 -1
- package/dist/components/organisms/Table/components/TableLayoutToggle.cjs +0 -27
- package/dist/components/organisms/Table/components/TableLayoutToggle.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableLayoutToggle.d.ts +0 -17
- package/dist/components/organisms/Table/components/TableLayoutToggle.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableLayoutToggle.js +0 -25
- package/dist/components/organisms/Table/components/TableLayoutToggle.js.map +0 -1
- package/dist/components/organisms/Table/components/TableRowCard.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableRowCard.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableRowCard.js.map +0 -1
- package/dist/components/organisms/Table/components/TableSortIcon.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableSortIcon.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableSortIcon.js.map +0 -1
- package/dist/components/organisms/Table/components/TableSortMenu.cjs.map +0 -1
- package/dist/components/organisms/Table/components/TableSortMenu.d.ts.map +0 -1
- package/dist/components/organisms/Table/components/TableSortMenu.js.map +0 -1
- package/dist/components/organisms/Table/hooks/useBusyCount.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/useBusyCount.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/useBusyCount.js.map +0 -1
- package/dist/components/organisms/Table/hooks/useFirstSortDirection.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/useFirstSortDirection.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/useFirstSortDirection.js.map +0 -1
- package/dist/components/organisms/Table/hooks/useIsAtLeastMd.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/useIsAtLeastMd.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/useIsAtLeastMd.js.map +0 -1
- package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/useIsPlaceholderPage.js.map +0 -1
- package/dist/components/organisms/Table/hooks/usePlaceholderRows.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/usePlaceholderRows.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/usePlaceholderRows.js.map +0 -1
- package/dist/components/organisms/Table/hooks/useSelectableRowRegistry.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/useSelectableRowRegistry.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/useSelectableRowRegistry.js.map +0 -1
- package/dist/components/organisms/Table/hooks/useTableSelection.cjs.map +0 -1
- package/dist/components/organisms/Table/hooks/useTableSelection.d.ts.map +0 -1
- package/dist/components/organisms/Table/hooks/useTableSelection.js.map +0 -1
- package/dist/components/organisms/Table/providers/Table.context.cjs.map +0 -1
- package/dist/components/organisms/Table/providers/Table.context.d.ts.map +0 -1
- package/dist/components/organisms/Table/providers/Table.context.js.map +0 -1
- package/dist/components/organisms/Table/table.types.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableCard.utils.cjs.map +0 -1
- package/dist/components/organisms/Table/utilities/tableCard.utils.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableCard.utils.js.map +0 -1
- package/dist/components/organisms/Table/utilities/tableChildren.utils.cjs.map +0 -1
- package/dist/components/organisms/Table/utilities/tableChildren.utils.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableChildren.utils.js.map +0 -1
- package/dist/components/organisms/Table/utilities/tableIterable.utils.cjs.map +0 -1
- package/dist/components/organisms/Table/utilities/tableIterable.utils.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableIterable.utils.js.map +0 -1
- package/dist/components/organisms/Table/utilities/tableLoading.utils.cjs.map +0 -1
- package/dist/components/organisms/Table/utilities/tableLoading.utils.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableLoading.utils.js.map +0 -1
- package/dist/components/organisms/Table/utilities/tableSelection.utils.cjs.map +0 -1
- package/dist/components/organisms/Table/utilities/tableSelection.utils.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableSelection.utils.js.map +0 -1
- package/dist/components/organisms/Table/utilities/tableSort.utils.cjs.map +0 -1
- package/dist/components/organisms/Table/utilities/tableSort.utils.d.ts.map +0 -1
- package/dist/components/organisms/Table/utilities/tableSort.utils.js.map +0 -1
- package/dist/hooks/useFocusHandOff/index.cjs.map +0 -1
- package/dist/hooks/useFocusHandOff/index.d.ts.map +0 -1
- package/dist/hooks/useFocusHandOff/index.js.map +0 -1
- /package/dist/components/organisms/{Table → Tables/Table}/Table.styles.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/Table.styles.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableCardsSelectAll.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableCardsSelectAll.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableCardsSelectAll.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableFallbackCard.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableFallbackCard.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableRowCard.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableSortIcon.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableSortIcon.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/components/TableSortIcon.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/useBusyCount.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/useBusyCount.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/useBusyCount.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/useFirstSortDirection.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/usePlaceholderRows.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/usePlaceholderRows.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/useSelectableRowRegistry.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/hooks/useSelectableRowRegistry.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/providers/Table.context.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/providers/Table.context.js +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/utilities/tableSelection.utils.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/utilities/tableSelection.utils.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables/Table}/utilities/tableSelection.utils.js +0 -0
- /package/dist/components/organisms/{Table → Tables}/hooks/useIsAtLeastMd.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables}/hooks/useIsAtLeastMd.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables}/hooks/useIsAtLeastMd.js +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableCard.utils.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableCard.utils.js +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableChildren.utils.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableChildren.utils.js +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableIterable.utils.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableIterable.utils.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableIterable.utils.js +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableSort.utils.cjs +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableSort.utils.d.ts +0 -0
- /package/dist/components/organisms/{Table → Tables}/utilities/tableSort.utils.js +0 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var renderUtils = require('@flipdish/ui-library/utilities/renderUtils');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var log_utils = require('../../utilities/__internal__/logUtils/log.utils.cjs');
|
|
6
|
+
|
|
7
|
+
const ownedParams = (params, names) => {
|
|
8
|
+
const owned = new URLSearchParams();
|
|
9
|
+
for (const name of new Set(names)) {
|
|
10
|
+
for (const value of params.getAll(name))
|
|
11
|
+
owned.append(name, value);
|
|
12
|
+
}
|
|
13
|
+
return owned;
|
|
14
|
+
};
|
|
15
|
+
// The order params are written in carries no meaning, so it never makes two queries differ.
|
|
16
|
+
const keyOf = (params) => {
|
|
17
|
+
const sorted = new URLSearchParams(params);
|
|
18
|
+
sorted.sort();
|
|
19
|
+
return sorted.toString();
|
|
20
|
+
};
|
|
21
|
+
// `next`, with every param the hook does not own as the setter's `current` has it, so another feature's change there stands.
|
|
22
|
+
const withUnownedFrom = (current, next, owned) => {
|
|
23
|
+
const unownedOf = (params) => {
|
|
24
|
+
const unowned = new URLSearchParams(params);
|
|
25
|
+
for (const name of owned)
|
|
26
|
+
unowned.delete(name);
|
|
27
|
+
return unowned;
|
|
28
|
+
};
|
|
29
|
+
const result = unownedOf(current);
|
|
30
|
+
if (keyOf(result) === keyOf(unownedOf(next)))
|
|
31
|
+
return next;
|
|
32
|
+
for (const name of new Set(owned)) {
|
|
33
|
+
for (const value of next.getAll(name))
|
|
34
|
+
result.append(name, value);
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
// Only the owned names are taken out before a write, so any other name `serialize` writes is appended again on every write.
|
|
39
|
+
const warnOfUnownedParams = (written, names) => {
|
|
40
|
+
for (const name of new Set(written.keys())) {
|
|
41
|
+
if (names.includes(name))
|
|
42
|
+
continue;
|
|
43
|
+
log_utils.warnOnce(`useListQueryParams:unowned-param:${name}`, `useListQueryParams: \`serialize\` wrote \`${name}\`, which is not in \`paramNames\`, so every write adds another copy of it and \`parse\` never reads it. Add \`${name}\` to \`paramNames\`.`);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const warnOfMissingDetail = () => log_utils.warnOnce('useListQueryParams:no-detail', 'useListQueryParams: `openDetail` and `closeDetail` do nothing without the `detail` option. Pass `detail: { name, goBack }`.');
|
|
47
|
+
/**
|
|
48
|
+
* Keeps a list page's query, such as its view, search, sort and page, and the record open in its detail panel in the URL's
|
|
49
|
+
* search params, so a link, a reload or Back lands on the same list and record. Router-agnostic: pass react-router's
|
|
50
|
+
* `useSearchParams()` pair as it is, and call the hook once per URL, since writes build on each other only within one call.
|
|
51
|
+
* A list with no pager still carries `page: 1` in its query, which its `parse` always returns and its `serialize` never writes.
|
|
52
|
+
*
|
|
53
|
+
* @param options The router's search params and setter, the page's `parse` and `serialize`, the param names they own and the
|
|
54
|
+
* optional `detail` param; see `UseListQueryParamsOptions`.
|
|
55
|
+
* @returns `query`, parsed from the URL, and `update`, which writes a change to it: any change but the page alone starts
|
|
56
|
+
* again at page one, and one that writes the params the URL holds navigates nowhere. With `detail`, the open record's
|
|
57
|
+
* `detailId` and `openDetail` and `closeDetail`, which go back off their own push rather than leave an entry that reopens it.
|
|
58
|
+
* The functions are the same on every render.
|
|
59
|
+
*/
|
|
60
|
+
const useListQueryParams = (options) => {
|
|
61
|
+
const { searchParams, parse, paramNames, detail } = options;
|
|
62
|
+
const ownedKey = ownedParams(searchParams, paramNames).toString();
|
|
63
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: a page passes `parse` inline, so only a new owned param reads the query again
|
|
64
|
+
const query = React.useMemo(() => parse(new URLSearchParams(ownedKey)), [ownedKey]);
|
|
65
|
+
const detailId = detail ? searchParams.get(detail.name) || null : null;
|
|
66
|
+
// The handlers read these rather than a render's values, so they keep one identity and see the writes before them.
|
|
67
|
+
const latestOptions = React.useRef(options);
|
|
68
|
+
const pending = React.useRef(null);
|
|
69
|
+
const ownEntry = React.useRef(null);
|
|
70
|
+
// The params of the last detail write, to tell one still under way from an `update`.
|
|
71
|
+
const lastDetailWrite = React.useRef(null);
|
|
72
|
+
const leftoverPushes = React.useRef(new Set());
|
|
73
|
+
const searchKey = searchParams.toString();
|
|
74
|
+
// Layout timing, so no handler reads the params of a render older than the one committed.
|
|
75
|
+
React.useLayoutEffect(() => {
|
|
76
|
+
const previous = latestOptions.current.searchParams;
|
|
77
|
+
latestOptions.current = options;
|
|
78
|
+
if (!renderUtils.isProductionBuild() && detail && paramNames.includes(detail.name)) {
|
|
79
|
+
log_utils.warnOnce('useListQueryParams:detail-in-param-names', `useListQueryParams: take \`${detail.name}\` out of \`paramNames\`: it is the detail param, so \`update\` would remove it.`);
|
|
80
|
+
}
|
|
81
|
+
const entry = pending.current;
|
|
82
|
+
// Writes that end on the URL shown leave react-router's params object as it was, so no landing would ever clear them.
|
|
83
|
+
if (entry && !entry.back && entry.from === searchParams && keyOf(entry.params) === keyOf(searchParams)) {
|
|
84
|
+
pending.current = null;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (previous === searchParams || entry?.from !== previous || !entry.back)
|
|
88
|
+
return;
|
|
89
|
+
// Disarmed by the first URL change, so it can never act on a later one.
|
|
90
|
+
pending.current = null;
|
|
91
|
+
const { target, held, leftovers } = entry.back;
|
|
92
|
+
let writes = searchKey === target ? held : [];
|
|
93
|
+
if (detail && leftovers.has(searchKey)) {
|
|
94
|
+
// Short, on a record a second push left beneath: that entry loses the record, so a close always closes.
|
|
95
|
+
const mended = new URLSearchParams(searchParams);
|
|
96
|
+
mended.delete(detail.name);
|
|
97
|
+
writes = [{ params: mended, isReplace: true }, ...held];
|
|
98
|
+
}
|
|
99
|
+
// Any other URL is a navigation the hook did not make: it stands, and what was held goes with the URL it was meant for.
|
|
100
|
+
for (const write of writes)
|
|
101
|
+
send(write.params, write.isReplace);
|
|
102
|
+
const last = writes[writes.length - 1];
|
|
103
|
+
if (last)
|
|
104
|
+
pending.current = { from: searchParams, params: last.params };
|
|
105
|
+
});
|
|
106
|
+
// Keyed by string: a render before the router has the push changes nothing, and any other URL ends the claim.
|
|
107
|
+
React.useLayoutEffect(() => {
|
|
108
|
+
const entry = ownEntry.current;
|
|
109
|
+
ownEntry.current = entry?.key === searchKey ? { ...entry, isDelivered: true } : null;
|
|
110
|
+
}, [searchKey]);
|
|
111
|
+
const { send, update, openDetail, closeDetail } = React.useMemo(() => {
|
|
112
|
+
const send = (next, isReplace) => {
|
|
113
|
+
const { setSearchParams: set, paramNames: names, detail: detailOptions } = latestOptions.current;
|
|
114
|
+
const owned = detailOptions ? [...names, detailOptions.name] : names;
|
|
115
|
+
set((current) => withUnownedFrom(current, next, owned), { replace: isReplace });
|
|
116
|
+
};
|
|
117
|
+
const pendingNow = () => (pending.current?.from === latestOptions.current.searchParams ? pending.current : null);
|
|
118
|
+
const latest = () => pendingNow()?.params ?? latestOptions.current.searchParams;
|
|
119
|
+
const write = (next, isReplace) => {
|
|
120
|
+
const { searchParams: from } = latestOptions.current;
|
|
121
|
+
let back = pendingNow()?.back;
|
|
122
|
+
if (back?.isPastHandler) {
|
|
123
|
+
// A blocker or a `goBack` that goes nowhere would otherwise hold every later write for good.
|
|
124
|
+
for (const held of back.held)
|
|
125
|
+
send(held.params, held.isReplace);
|
|
126
|
+
back = undefined;
|
|
127
|
+
}
|
|
128
|
+
pending.current = { from, params: next, back };
|
|
129
|
+
if (back)
|
|
130
|
+
back.held.push({ params: next, isReplace });
|
|
131
|
+
else
|
|
132
|
+
send(next, isReplace);
|
|
133
|
+
};
|
|
134
|
+
// Another write still under way may have landed an entry of its own, so the claim no longer holds.
|
|
135
|
+
const isOwnEntry = (params) => ownEntry.current?.key === params.toString() && (!pendingNow() || params === lastDetailWrite.current);
|
|
136
|
+
const writeDetail = (next, isReplace) => {
|
|
137
|
+
lastDetailWrite.current = next;
|
|
138
|
+
write(next, isReplace);
|
|
139
|
+
};
|
|
140
|
+
return {
|
|
141
|
+
send,
|
|
142
|
+
update: (patch, updateOptions = {}) => {
|
|
143
|
+
const { parse: parseLatest, serialize, paramNames: names } = latestOptions.current;
|
|
144
|
+
const params = latest();
|
|
145
|
+
const current = parseLatest(ownedParams(params, names));
|
|
146
|
+
const changes = typeof patch === 'function' ? patch(current) : patch;
|
|
147
|
+
const before = keyOf(serialize(current));
|
|
148
|
+
const withPage = (page) => ({ ...current, ...changes, page });
|
|
149
|
+
let next = withPage(changes.page ?? current.page);
|
|
150
|
+
// Any change but the page itself starts again at page one, so a narrower result never points past its last page.
|
|
151
|
+
if (changes.page === undefined && keyOf(serialize(next)) !== before)
|
|
152
|
+
next = withPage(1);
|
|
153
|
+
const written = serialize(next);
|
|
154
|
+
if (!renderUtils.isProductionBuild())
|
|
155
|
+
warnOfUnownedParams(written, names);
|
|
156
|
+
// react-router navigates even to the params already in the URL, so a change that writes nothing new must not reach it.
|
|
157
|
+
if (keyOf(written) === before)
|
|
158
|
+
return;
|
|
159
|
+
const nextParams = new URLSearchParams(params);
|
|
160
|
+
for (const name of names)
|
|
161
|
+
nextParams.delete(name);
|
|
162
|
+
for (const [name, value] of written)
|
|
163
|
+
nextParams.append(name, value);
|
|
164
|
+
write(nextParams, updateOptions.history === 'replace');
|
|
165
|
+
},
|
|
166
|
+
openDetail: (id) => {
|
|
167
|
+
const param = latestOptions.current.detail?.name;
|
|
168
|
+
if (param === undefined) {
|
|
169
|
+
if (!renderUtils.isProductionBuild())
|
|
170
|
+
warnOfMissingDetail();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const params = latest();
|
|
174
|
+
const openId = params.get(param) || null;
|
|
175
|
+
if (!id || openId === id)
|
|
176
|
+
return;
|
|
177
|
+
const next = new URLSearchParams(params);
|
|
178
|
+
next.set(param, id);
|
|
179
|
+
const entry = ownEntry.current;
|
|
180
|
+
const isOwn = isOwnEntry(params);
|
|
181
|
+
if (openId === null) {
|
|
182
|
+
// Claimed only when nothing else is under way: going back off an entry that holds another write would undo it too.
|
|
183
|
+
ownEntry.current = pendingNow() ? null : { key: next.toString(), beneath: params.toString(), isDelivered: false };
|
|
184
|
+
leftoverPushes.current = new Set();
|
|
185
|
+
writeDetail(next, false);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (entry && isOwn && !entry.isDelivered) {
|
|
189
|
+
// A replace would rewrite the list's entry under a router still on the push; one that took it keeps both, which a close then mends.
|
|
190
|
+
ownEntry.current = { ...entry, key: next.toString(), isDelivered: false };
|
|
191
|
+
leftoverPushes.current.add(params.toString());
|
|
192
|
+
writeDetail(next, false);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
// Row to row replaces, so Back skips every record looked at; on the hook's own entry the claim moves to the new URL.
|
|
196
|
+
ownEntry.current = isOwn && entry ? { ...entry, key: next.toString() } : null;
|
|
197
|
+
writeDetail(next, true);
|
|
198
|
+
},
|
|
199
|
+
closeDetail: () => {
|
|
200
|
+
const { detail: detailOptions, searchParams: from } = latestOptions.current;
|
|
201
|
+
if (!detailOptions) {
|
|
202
|
+
if (!renderUtils.isProductionBuild())
|
|
203
|
+
warnOfMissingDetail();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const params = latest();
|
|
207
|
+
if (!params.get(detailOptions.name))
|
|
208
|
+
return;
|
|
209
|
+
const next = new URLSearchParams(params);
|
|
210
|
+
next.delete(detailOptions.name);
|
|
211
|
+
const entry = ownEntry.current;
|
|
212
|
+
const isOwn = entry?.isDelivered === true && isOwnEntry(params);
|
|
213
|
+
ownEntry.current = null;
|
|
214
|
+
lastDetailWrite.current = next;
|
|
215
|
+
// Never back past an `update` still under way, which the back would undo or race; a replace keeps it.
|
|
216
|
+
if (!isOwn) {
|
|
217
|
+
write(next, true);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
// The entry beneath as it was, which an empty value of the param, `?user=`, may still be on.
|
|
221
|
+
const beneath = new URLSearchParams(entry.beneath);
|
|
222
|
+
const back = { target: entry.beneath, held: [], isPastHandler: false, leftovers: leftoverPushes.current };
|
|
223
|
+
leftoverPushes.current = new Set();
|
|
224
|
+
lastDetailWrite.current = beneath;
|
|
225
|
+
pending.current = { from, params: beneath, back };
|
|
226
|
+
// A microtask runs once the handler has returned and sets only a flag, so nothing is left running after an unmount.
|
|
227
|
+
queueMicrotask(() => {
|
|
228
|
+
back.isPastHandler = true;
|
|
229
|
+
});
|
|
230
|
+
detailOptions.goBack();
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
}, []);
|
|
234
|
+
return { query, update, detailId, openDetail, closeDetail };
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
exports.useListQueryParams = useListQueryParams;
|
|
238
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useListQueryParams/index.ts"],"sourcesContent":[null],"names":["warnOnce","useMemo","useRef","useLayoutEffect","isProductionBuild"],"mappings":";;;;;;AA4FA,MAAM,WAAW,GAAG,CAAC,MAAuB,EAAE,KAAwB,KAAI;AACxE,IAAA,MAAM,KAAK,GAAG,IAAI,eAAe,EAAE;IACnC,KAAK,MAAM,IAAI,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE;QACjC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;AAAE,YAAA,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;IACpE;AACA,IAAA,OAAO,KAAK;AACd,CAAC;AAED;AACA,MAAM,KAAK,GAAG,CAAC,MAAuB,KAAI;AACxC,IAAA,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC;IAC1C,MAAM,CAAC,IAAI,EAAE;AACb,IAAA,OAAO,MAAM,CAAC,QAAQ,EAAE;AAC1B,CAAC;AAED;AACA,MAAM,eAAe,GAAG,CAAC,OAAwB,EAAE,IAAqB,EAAE,KAAwB,KAAI;AACpG,IAAA,MAAM,SAAS,GAAG,CAAC,MAAuB,KAAI;AAC5C,QA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;;"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes the URL's search params from the ones in it now, pushing a history entry unless `replace` is set. react-router's
|
|
3
|
+
* `setSearchParams` is one, as `useSearchParams` returns it.
|
|
4
|
+
*/
|
|
5
|
+
export type SetSearchParams = (update: (current: URLSearchParams) => URLSearchParams, options?: {
|
|
6
|
+
replace?: boolean;
|
|
7
|
+
}) => void;
|
|
8
|
+
/** The record open in the page's detail panel, kept in one search param beside the query. */
|
|
9
|
+
export interface ListQueryDetailOptions {
|
|
10
|
+
/** The param that holds the open record's id, such as `user`. Leave it out of `paramNames`: `parse` never sees it. */
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* Goes back one history entry through the app's router, which `closeDetail` does to take off the entry `openDetail`
|
|
14
|
+
* pushed: with react-router `() => navigate(-1)`, and with plain browser history `() => window.history.back()`.
|
|
15
|
+
*/
|
|
16
|
+
goBack: () => void;
|
|
17
|
+
}
|
|
18
|
+
export interface UseListQueryParamsOptions<Query extends {
|
|
19
|
+
page: number;
|
|
20
|
+
}> {
|
|
21
|
+
/**
|
|
22
|
+
* The search params in the URL now, such as the first value `useSearchParams` returns. It must stay the same object for as
|
|
23
|
+
* long as the URL holds, as react-router's does: a hand-written adapter memoises it, such as
|
|
24
|
+
* `useMemo(() => new URLSearchParams(search), [search])`, or a write held behind `closeDetail` is lost.
|
|
25
|
+
*/
|
|
26
|
+
searchParams: URLSearchParams;
|
|
27
|
+
/** Writes the next search params, such as the second value `useSearchParams` returns. */
|
|
28
|
+
setSearchParams: SetSearchParams;
|
|
29
|
+
/**
|
|
30
|
+
* Reads the query out of the params named in `paramNames`, the only ones it is given; anything malformed falls back to a
|
|
31
|
+
* default. It runs again only when one of those params changes, so it reads nothing else, such as a value from the render.
|
|
32
|
+
*/
|
|
33
|
+
parse: (params: URLSearchParams) => Query;
|
|
34
|
+
/** Writes the query as search params, leaving out every value at its default so the plain list is a bare path. */
|
|
35
|
+
serialize: (query: Query) => URLSearchParams;
|
|
36
|
+
/** Every param `serialize` writes. Any other param in the URL, such as another feature's, is kept as it is on every write. */
|
|
37
|
+
paramNames: readonly string[];
|
|
38
|
+
/** Keeps the record open in a detail panel in its own param. Leave it out for a list with no detail panel. */
|
|
39
|
+
detail?: ListQueryDetailOptions;
|
|
40
|
+
}
|
|
41
|
+
export interface ListQueryUpdateOptions {
|
|
42
|
+
/** `push` adds a history entry, so Back undoes the change; `replace` rewrites the one the user is on, as for a search. */
|
|
43
|
+
history?: 'push' | 'replace';
|
|
44
|
+
}
|
|
45
|
+
/** A change to the query: the fields to change, or a function from the latest query to them. */
|
|
46
|
+
export type ListQueryPatch<Query> = Partial<Query> | ((current: Query) => Partial<Query>);
|
|
47
|
+
export interface ListQueryParamsState<Query extends {
|
|
48
|
+
page: number;
|
|
49
|
+
}> {
|
|
50
|
+
/** The query the URL holds: the same object until a param in `paramNames` changes. */
|
|
51
|
+
query: Query;
|
|
52
|
+
/** Writes a change to the query into the URL, from the latest query, so two calls in one tick both land; keeps the open record. */
|
|
53
|
+
update: (patch: ListQueryPatch<Query>, options?: ListQueryUpdateOptions) => void;
|
|
54
|
+
/** The open record's id from the URL, or `null` when none is open, the value is empty or there is no `detail` option. */
|
|
55
|
+
detailId: string | null;
|
|
56
|
+
/** Opens a record: pushes an entry when none is open, so Back closes it, and replaces it when another is. An empty id does nothing. */
|
|
57
|
+
openDetail: (id: string) => void;
|
|
58
|
+
/** Closes the open record, going back off the entry `openDetail` pushed while it is still the current one; keeps the query. */
|
|
59
|
+
closeDetail: () => void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Keeps a list page's query, such as its view, search, sort and page, and the record open in its detail panel in the URL's
|
|
63
|
+
* search params, so a link, a reload or Back lands on the same list and record. Router-agnostic: pass react-router's
|
|
64
|
+
* `useSearchParams()` pair as it is, and call the hook once per URL, since writes build on each other only within one call.
|
|
65
|
+
* A list with no pager still carries `page: 1` in its query, which its `parse` always returns and its `serialize` never writes.
|
|
66
|
+
*
|
|
67
|
+
* @param options The router's search params and setter, the page's `parse` and `serialize`, the param names they own and the
|
|
68
|
+
* optional `detail` param; see `UseListQueryParamsOptions`.
|
|
69
|
+
* @returns `query`, parsed from the URL, and `update`, which writes a change to it: any change but the page alone starts
|
|
70
|
+
* again at page one, and one that writes the params the URL holds navigates nowhere. With `detail`, the open record's
|
|
71
|
+
* `detailId` and `openDetail` and `closeDetail`, which go back off their own push rather than leave an entry that reopens it.
|
|
72
|
+
* The functions are the same on every render.
|
|
73
|
+
*/
|
|
74
|
+
export declare const useListQueryParams: <Query extends {
|
|
75
|
+
page: number;
|
|
76
|
+
}>(options: UseListQueryParamsOptions<Query>) => ListQueryParamsState<Query>;
|
|
77
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useListQueryParams/index.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,eAAe,EAAE,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,KAAK,IAAI,CAAC;AAE/H,6FAA6F;AAC7F,MAAM,WAAW,sBAAsB;IACrC,sHAAsH;IACtH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB,CAAC,KAAK,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;IACvE;;;;OAIG;IACH,YAAY,EAAE,eAAe,CAAC;IAC9B,yFAAyF;IACzF,eAAe,EAAE,eAAe,CAAC;IACjC;;;OAGG;IACH,KAAK,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,KAAK,CAAC;IAC1C,kHAAkH;IAClH,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,eAAe,CAAC;IAC7C,8HAA8H;IAC9H,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,8GAA8G;IAC9G,MAAM,CAAC,EAAE,sBAAsB,CAAC;CACjC;AAED,MAAM,WAAW,sBAAsB;IACrC,0HAA0H;IAC1H,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,gGAAgG;AAChG,MAAM,MAAM,cAAc,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAE1F,MAAM,WAAW,oBAAoB,CAAC,KAAK,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;IAClE,sFAAsF;IACtF,KAAK,EAAE,KAAK,CAAC;IACb,mIAAmI;IACnI,MAAM,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACjF,yHAAyH;IACzH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,uIAAuI;IACvI,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,+HAA+H;IAC/H,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AA2ED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,GAAI,KAAK,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,SAAS,yBAAyB,CAAC,KAAK,CAAC,KAAG,oBAAoB,CAAC,KAAK,CA8KxI,CAAC"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { isProductionBuild } from '@flipdish/ui-library/utilities/renderUtils';
|
|
2
|
+
import { useMemo, useRef, useLayoutEffect } from 'react';
|
|
3
|
+
import { warnOnce } from '../../utilities/__internal__/logUtils/log.utils.js';
|
|
4
|
+
|
|
5
|
+
const ownedParams = (params, names) => {
|
|
6
|
+
const owned = new URLSearchParams();
|
|
7
|
+
for (const name of new Set(names)) {
|
|
8
|
+
for (const value of params.getAll(name))
|
|
9
|
+
owned.append(name, value);
|
|
10
|
+
}
|
|
11
|
+
return owned;
|
|
12
|
+
};
|
|
13
|
+
// The order params are written in carries no meaning, so it never makes two queries differ.
|
|
14
|
+
const keyOf = (params) => {
|
|
15
|
+
const sorted = new URLSearchParams(params);
|
|
16
|
+
sorted.sort();
|
|
17
|
+
return sorted.toString();
|
|
18
|
+
};
|
|
19
|
+
// `next`, with every param the hook does not own as the setter's `current` has it, so another feature's change there stands.
|
|
20
|
+
const withUnownedFrom = (current, next, owned) => {
|
|
21
|
+
const unownedOf = (params) => {
|
|
22
|
+
const unowned = new URLSearchParams(params);
|
|
23
|
+
for (const name of owned)
|
|
24
|
+
unowned.delete(name);
|
|
25
|
+
return unowned;
|
|
26
|
+
};
|
|
27
|
+
const result = unownedOf(current);
|
|
28
|
+
if (keyOf(result) === keyOf(unownedOf(next)))
|
|
29
|
+
return next;
|
|
30
|
+
for (const name of new Set(owned)) {
|
|
31
|
+
for (const value of next.getAll(name))
|
|
32
|
+
result.append(name, value);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
// Only the owned names are taken out before a write, so any other name `serialize` writes is appended again on every write.
|
|
37
|
+
const warnOfUnownedParams = (written, names) => {
|
|
38
|
+
for (const name of new Set(written.keys())) {
|
|
39
|
+
if (names.includes(name))
|
|
40
|
+
continue;
|
|
41
|
+
warnOnce(`useListQueryParams:unowned-param:${name}`, `useListQueryParams: \`serialize\` wrote \`${name}\`, which is not in \`paramNames\`, so every write adds another copy of it and \`parse\` never reads it. Add \`${name}\` to \`paramNames\`.`);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const warnOfMissingDetail = () => warnOnce('useListQueryParams:no-detail', 'useListQueryParams: `openDetail` and `closeDetail` do nothing without the `detail` option. Pass `detail: { name, goBack }`.');
|
|
45
|
+
/**
|
|
46
|
+
* Keeps a list page's query, such as its view, search, sort and page, and the record open in its detail panel in the URL's
|
|
47
|
+
* search params, so a link, a reload or Back lands on the same list and record. Router-agnostic: pass react-router's
|
|
48
|
+
* `useSearchParams()` pair as it is, and call the hook once per URL, since writes build on each other only within one call.
|
|
49
|
+
* A list with no pager still carries `page: 1` in its query, which its `parse` always returns and its `serialize` never writes.
|
|
50
|
+
*
|
|
51
|
+
* @param options The router's search params and setter, the page's `parse` and `serialize`, the param names they own and the
|
|
52
|
+
* optional `detail` param; see `UseListQueryParamsOptions`.
|
|
53
|
+
* @returns `query`, parsed from the URL, and `update`, which writes a change to it: any change but the page alone starts
|
|
54
|
+
* again at page one, and one that writes the params the URL holds navigates nowhere. With `detail`, the open record's
|
|
55
|
+
* `detailId` and `openDetail` and `closeDetail`, which go back off their own push rather than leave an entry that reopens it.
|
|
56
|
+
* The functions are the same on every render.
|
|
57
|
+
*/
|
|
58
|
+
const useListQueryParams = (options) => {
|
|
59
|
+
const { searchParams, parse, paramNames, detail } = options;
|
|
60
|
+
const ownedKey = ownedParams(searchParams, paramNames).toString();
|
|
61
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: a page passes `parse` inline, so only a new owned param reads the query again
|
|
62
|
+
const query = useMemo(() => parse(new URLSearchParams(ownedKey)), [ownedKey]);
|
|
63
|
+
const detailId = detail ? searchParams.get(detail.name) || null : null;
|
|
64
|
+
// The handlers read these rather than a render's values, so they keep one identity and see the writes before them.
|
|
65
|
+
const latestOptions = useRef(options);
|
|
66
|
+
const pending = useRef(null);
|
|
67
|
+
const ownEntry = useRef(null);
|
|
68
|
+
// The params of the last detail write, to tell one still under way from an `update`.
|
|
69
|
+
const lastDetailWrite = useRef(null);
|
|
70
|
+
const leftoverPushes = useRef(new Set());
|
|
71
|
+
const searchKey = searchParams.toString();
|
|
72
|
+
// Layout timing, so no handler reads the params of a render older than the one committed.
|
|
73
|
+
useLayoutEffect(() => {
|
|
74
|
+
const previous = latestOptions.current.searchParams;
|
|
75
|
+
latestOptions.current = options;
|
|
76
|
+
if (!isProductionBuild() && detail && paramNames.includes(detail.name)) {
|
|
77
|
+
warnOnce('useListQueryParams:detail-in-param-names', `useListQueryParams: take \`${detail.name}\` out of \`paramNames\`: it is the detail param, so \`update\` would remove it.`);
|
|
78
|
+
}
|
|
79
|
+
const entry = pending.current;
|
|
80
|
+
// Writes that end on the URL shown leave react-router's params object as it was, so no landing would ever clear them.
|
|
81
|
+
if (entry && !entry.back && entry.from === searchParams && keyOf(entry.params) === keyOf(searchParams)) {
|
|
82
|
+
pending.current = null;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (previous === searchParams || entry?.from !== previous || !entry.back)
|
|
86
|
+
return;
|
|
87
|
+
// Disarmed by the first URL change, so it can never act on a later one.
|
|
88
|
+
pending.current = null;
|
|
89
|
+
const { target, held, leftovers } = entry.back;
|
|
90
|
+
let writes = searchKey === target ? held : [];
|
|
91
|
+
if (detail && leftovers.has(searchKey)) {
|
|
92
|
+
// Short, on a record a second push left beneath: that entry loses the record, so a close always closes.
|
|
93
|
+
const mended = new URLSearchParams(searchParams);
|
|
94
|
+
mended.delete(detail.name);
|
|
95
|
+
writes = [{ params: mended, isReplace: true }, ...held];
|
|
96
|
+
}
|
|
97
|
+
// Any other URL is a navigation the hook did not make: it stands, and what was held goes with the URL it was meant for.
|
|
98
|
+
for (const write of writes)
|
|
99
|
+
send(write.params, write.isReplace);
|
|
100
|
+
const last = writes[writes.length - 1];
|
|
101
|
+
if (last)
|
|
102
|
+
pending.current = { from: searchParams, params: last.params };
|
|
103
|
+
});
|
|
104
|
+
// Keyed by string: a render before the router has the push changes nothing, and any other URL ends the claim.
|
|
105
|
+
useLayoutEffect(() => {
|
|
106
|
+
const entry = ownEntry.current;
|
|
107
|
+
ownEntry.current = entry?.key === searchKey ? { ...entry, isDelivered: true } : null;
|
|
108
|
+
}, [searchKey]);
|
|
109
|
+
const { send, update, openDetail, closeDetail } = useMemo(() => {
|
|
110
|
+
const send = (next, isReplace) => {
|
|
111
|
+
const { setSearchParams: set, paramNames: names, detail: detailOptions } = latestOptions.current;
|
|
112
|
+
const owned = detailOptions ? [...names, detailOptions.name] : names;
|
|
113
|
+
set((current) => withUnownedFrom(current, next, owned), { replace: isReplace });
|
|
114
|
+
};
|
|
115
|
+
const pendingNow = () => (pending.current?.from === latestOptions.current.searchParams ? pending.current : null);
|
|
116
|
+
const latest = () => pendingNow()?.params ?? latestOptions.current.searchParams;
|
|
117
|
+
const write = (next, isReplace) => {
|
|
118
|
+
const { searchParams: from } = latestOptions.current;
|
|
119
|
+
let back = pendingNow()?.back;
|
|
120
|
+
if (back?.isPastHandler) {
|
|
121
|
+
// A blocker or a `goBack` that goes nowhere would otherwise hold every later write for good.
|
|
122
|
+
for (const held of back.held)
|
|
123
|
+
send(held.params, held.isReplace);
|
|
124
|
+
back = undefined;
|
|
125
|
+
}
|
|
126
|
+
pending.current = { from, params: next, back };
|
|
127
|
+
if (back)
|
|
128
|
+
back.held.push({ params: next, isReplace });
|
|
129
|
+
else
|
|
130
|
+
send(next, isReplace);
|
|
131
|
+
};
|
|
132
|
+
// Another write still under way may have landed an entry of its own, so the claim no longer holds.
|
|
133
|
+
const isOwnEntry = (params) => ownEntry.current?.key === params.toString() && (!pendingNow() || params === lastDetailWrite.current);
|
|
134
|
+
const writeDetail = (next, isReplace) => {
|
|
135
|
+
lastDetailWrite.current = next;
|
|
136
|
+
write(next, isReplace);
|
|
137
|
+
};
|
|
138
|
+
return {
|
|
139
|
+
send,
|
|
140
|
+
update: (patch, updateOptions = {}) => {
|
|
141
|
+
const { parse: parseLatest, serialize, paramNames: names } = latestOptions.current;
|
|
142
|
+
const params = latest();
|
|
143
|
+
const current = parseLatest(ownedParams(params, names));
|
|
144
|
+
const changes = typeof patch === 'function' ? patch(current) : patch;
|
|
145
|
+
const before = keyOf(serialize(current));
|
|
146
|
+
const withPage = (page) => ({ ...current, ...changes, page });
|
|
147
|
+
let next = withPage(changes.page ?? current.page);
|
|
148
|
+
// Any change but the page itself starts again at page one, so a narrower result never points past its last page.
|
|
149
|
+
if (changes.page === undefined && keyOf(serialize(next)) !== before)
|
|
150
|
+
next = withPage(1);
|
|
151
|
+
const written = serialize(next);
|
|
152
|
+
if (!isProductionBuild())
|
|
153
|
+
warnOfUnownedParams(written, names);
|
|
154
|
+
// react-router navigates even to the params already in the URL, so a change that writes nothing new must not reach it.
|
|
155
|
+
if (keyOf(written) === before)
|
|
156
|
+
return;
|
|
157
|
+
const nextParams = new URLSearchParams(params);
|
|
158
|
+
for (const name of names)
|
|
159
|
+
nextParams.delete(name);
|
|
160
|
+
for (const [name, value] of written)
|
|
161
|
+
nextParams.append(name, value);
|
|
162
|
+
write(nextParams, updateOptions.history === 'replace');
|
|
163
|
+
},
|
|
164
|
+
openDetail: (id) => {
|
|
165
|
+
const param = latestOptions.current.detail?.name;
|
|
166
|
+
if (param === undefined) {
|
|
167
|
+
if (!isProductionBuild())
|
|
168
|
+
warnOfMissingDetail();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const params = latest();
|
|
172
|
+
const openId = params.get(param) || null;
|
|
173
|
+
if (!id || openId === id)
|
|
174
|
+
return;
|
|
175
|
+
const next = new URLSearchParams(params);
|
|
176
|
+
next.set(param, id);
|
|
177
|
+
const entry = ownEntry.current;
|
|
178
|
+
const isOwn = isOwnEntry(params);
|
|
179
|
+
if (openId === null) {
|
|
180
|
+
// Claimed only when nothing else is under way: going back off an entry that holds another write would undo it too.
|
|
181
|
+
ownEntry.current = pendingNow() ? null : { key: next.toString(), beneath: params.toString(), isDelivered: false };
|
|
182
|
+
leftoverPushes.current = new Set();
|
|
183
|
+
writeDetail(next, false);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (entry && isOwn && !entry.isDelivered) {
|
|
187
|
+
// A replace would rewrite the list's entry under a router still on the push; one that took it keeps both, which a close then mends.
|
|
188
|
+
ownEntry.current = { ...entry, key: next.toString(), isDelivered: false };
|
|
189
|
+
leftoverPushes.current.add(params.toString());
|
|
190
|
+
writeDetail(next, false);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
// Row to row replaces, so Back skips every record looked at; on the hook's own entry the claim moves to the new URL.
|
|
194
|
+
ownEntry.current = isOwn && entry ? { ...entry, key: next.toString() } : null;
|
|
195
|
+
writeDetail(next, true);
|
|
196
|
+
},
|
|
197
|
+
closeDetail: () => {
|
|
198
|
+
const { detail: detailOptions, searchParams: from } = latestOptions.current;
|
|
199
|
+
if (!detailOptions) {
|
|
200
|
+
if (!isProductionBuild())
|
|
201
|
+
warnOfMissingDetail();
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const params = latest();
|
|
205
|
+
if (!params.get(detailOptions.name))
|
|
206
|
+
return;
|
|
207
|
+
const next = new URLSearchParams(params);
|
|
208
|
+
next.delete(detailOptions.name);
|
|
209
|
+
const entry = ownEntry.current;
|
|
210
|
+
const isOwn = entry?.isDelivered === true && isOwnEntry(params);
|
|
211
|
+
ownEntry.current = null;
|
|
212
|
+
lastDetailWrite.current = next;
|
|
213
|
+
// Never back past an `update` still under way, which the back would undo or race; a replace keeps it.
|
|
214
|
+
if (!isOwn) {
|
|
215
|
+
write(next, true);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
// The entry beneath as it was, which an empty value of the param, `?user=`, may still be on.
|
|
219
|
+
const beneath = new URLSearchParams(entry.beneath);
|
|
220
|
+
const back = { target: entry.beneath, held: [], isPastHandler: false, leftovers: leftoverPushes.current };
|
|
221
|
+
leftoverPushes.current = new Set();
|
|
222
|
+
lastDetailWrite.current = beneath;
|
|
223
|
+
pending.current = { from, params: beneath, back };
|
|
224
|
+
// A microtask runs once the handler has returned and sets only a flag, so nothing is left running after an unmount.
|
|
225
|
+
queueMicrotask(() => {
|
|
226
|
+
back.isPastHandler = true;
|
|
227
|
+
});
|
|
228
|
+
detailOptions.goBack();
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
}, []);
|
|
232
|
+
return { query, update, detailId, openDetail, closeDetail };
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export { useListQueryParams };
|
|
236
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/hooks/useListQueryParams/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AA4FA,MAAM,WAAW,GAAG,CAAC,MAAuB,EAAE,KAAwB,KAAI;AACxE,IAAA,MAAM,KAAK,GAAG,IAAI,eAAe,EAAE;IACnC,KAAK,MAAM,IAAI,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE;QACjC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;AAAE,YAAA,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;IACpE;AACA,IAAA,OAAO,KAAK;AACd,CAAC;AAED;AACA,MAAM,KAAK,GAAG,CAAC,MAAuB,KAAI;AACxC,IAAA,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC;IAC1C,MAAM,CAAC,IAAI,EAAE;AACb,IAAA,OAAO,MAAM,CAAC,QAAQ,EAAE;AAC1B,CAAC;AAED;AACA,MAAM,eAAe,GAAG,CAAC,OAAwB,EAAE,IAAqB,EAAE,KAAwB,KAAI;AACpG,IAAA,MAAM,SAAS,GAAG,CAAC,MAAuB,KAAI;AAC5C,QAAA,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC;QAC3C,KAAK,MAAM,IAAI,IAAI,KAAK;AAAE,YAAA,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;AAC9C,QAAA,OAAO,OAAO;AAChB,IAAA,CAAC;AACD,IAAA,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC;IACjC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AA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