@flipdish/ui-library 0.70.0 → 0.71.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/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/components/organisms/Tables/index.d.ts +12 -0
- 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/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/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,56 @@
|
|
|
1
|
+
import { type LoadState } from '@flipdish/ui-library/hooks/useLoadState';
|
|
2
|
+
/** The fields `usePagedList` reads from a list query; the rest of the query, such as its search and filters, passes through. */
|
|
3
|
+
export interface PagedListQuery {
|
|
4
|
+
/** The page requested, from 1. */
|
|
5
|
+
page: number;
|
|
6
|
+
/** Rows per page. */
|
|
7
|
+
pageSize: number;
|
|
8
|
+
}
|
|
9
|
+
export interface UsePagedListOptions<Row, Query extends PagedListQuery = PagedListQuery> {
|
|
10
|
+
/** Names the request: the page's query, or its `listQueryKeyOf` key. */
|
|
11
|
+
query: Query;
|
|
12
|
+
/** The page's rows, `undefined` until they arrive. */
|
|
13
|
+
rows: readonly Row[] | undefined;
|
|
14
|
+
/** The row total of the whole result set, from the API, `undefined` until a page arrives; `NaN` or `Infinity` counts as unknown. */
|
|
15
|
+
total: number | undefined;
|
|
16
|
+
/** The request has no data yet, as TanStack Query's `isPending`. */
|
|
17
|
+
isPending: boolean;
|
|
18
|
+
/** The request failed. */
|
|
19
|
+
isError: boolean;
|
|
20
|
+
/** The previous request's rows are standing in while this one lands, as TanStack Query's `isPlaceholderData`. */
|
|
21
|
+
isPreviousData?: boolean;
|
|
22
|
+
/** How many times the request has failed, as TanStack Query's `errorUpdateCount`, so a retry that fails again has a new `resultKey`. */
|
|
23
|
+
errorCount?: number;
|
|
24
|
+
/** Starts the request again. A returned promise ends the retry when it settles; anything else ends it at once. */
|
|
25
|
+
refetch: () => unknown;
|
|
26
|
+
}
|
|
27
|
+
/** What `usePagedList` reports a paged list shows. */
|
|
28
|
+
export interface PagedListState<Row> extends Omit<LoadState, 'showData'> {
|
|
29
|
+
/** The rows to draw: none while nothing has arrived or while the error shows, cached rows of a failed refetch included. */
|
|
30
|
+
rows: readonly Row[];
|
|
31
|
+
/** The current result set's row total, kept across page and page-size changes and through an error; `undefined` until a page lands. */
|
|
32
|
+
total: number | undefined;
|
|
33
|
+
/** The page count for the pager; `0` while `total` is unknown. */
|
|
34
|
+
totalPages: number;
|
|
35
|
+
/** Names the query whose rows are on screen, for keying a status announcement; each failed attempt has a key of its own. */
|
|
36
|
+
resultKey: string | undefined;
|
|
37
|
+
/** A page past the last one has landed with no rows, as from a stale link. */
|
|
38
|
+
isPastEnd: boolean;
|
|
39
|
+
/** How many placeholder rows a loading page draws: the size the page will land at when the total is known. */
|
|
40
|
+
loadingRowCount: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Reports what a paged list shows, from the state of the request its page makes, which keeps its own `useQuery`. Use it for
|
|
44
|
+
* any list with a pager: it keeps the row total across page changes, holds a failed load's error through its retry, and
|
|
45
|
+
* names the query on screen for the status region that announces it.
|
|
46
|
+
*
|
|
47
|
+
* @param options The page's query, its rows and total, the request's state as the data library reports it, and its `refetch`;
|
|
48
|
+
* see `UsePagedListOptions`.
|
|
49
|
+
* @returns The `rows` to draw, `[]` while there is nothing to show or the error shows, as it does for a failed refetch whose
|
|
50
|
+
* rows are cached; `total` and `totalPages`, which stay through a page or rows-per-page change and an error, and are unknown
|
|
51
|
+
* again once anything else changes; the load state of `useLoadState`; `resultKey`, which changes as another query's result
|
|
52
|
+
* lands and with each failed attempt, but not for a refresh of the same query; `isPastEnd` for a link to a page past the
|
|
53
|
+
* last; and `loadingRowCount`, so a short last page does not load taller than it lands.
|
|
54
|
+
*/
|
|
55
|
+
export declare const usePagedList: <Row, Query extends PagedListQuery = PagedListQuery>({ query, rows, total, isPending, isError, isPreviousData, errorCount, refetch, }: UsePagedListOptions<Row, Query>) => PagedListState<Row>;
|
|
56
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePagedList/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,yCAAyC,CAAC;AAKvF,gIAAgI;AAChI,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB,CAAC,GAAG,EAAE,KAAK,SAAS,cAAc,GAAG,cAAc;IACrF,wEAAwE;IACxE,KAAK,EAAE,KAAK,CAAC;IACb,sDAAsD;IACtD,IAAI,EAAE,SAAS,GAAG,EAAE,GAAG,SAAS,CAAC;IACjC,oIAAoI;IACpI,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,oEAAoE;IACpE,SAAS,EAAE,OAAO,CAAC;IACnB,0BAA0B;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,iHAAiH;IACjH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wIAAwI;IACxI,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kHAAkH;IAClH,OAAO,EAAE,MAAM,OAAO,CAAC;CACxB;AAED,sDAAsD;AACtD,MAAM,WAAW,cAAc,CAAC,GAAG,CAAE,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IACtE,2HAA2H;IAC3H,IAAI,EAAE,SAAS,GAAG,EAAE,CAAC;IACrB,uIAAuI;IACvI,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;IACnB,4HAA4H;IAC5H,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,8EAA8E;IAC9E,SAAS,EAAE,OAAO,CAAC;IACnB,8GAA8G;IAC9G,eAAe,EAAE,MAAM,CAAC;CACzB;AAKD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,GAAI,GAAG,EAAE,KAAK,SAAS,cAAc,GAAG,cAAc,EAAE,kFAS9E,mBAAmB,CAAC,GAAG,EAAE,KAAK,CAAC,KAAG,cAAc,CAAC,GAAG,CAuCtD,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useLoadState } from '@flipdish/ui-library/hooks/useLoadState';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { resultSetKeyOf, pageCountOf } from '../../utilities/__internal__/listStateUtils/listState.utils.js';
|
|
4
|
+
import { stableKeyOf } from '../../utilities/__internal__/stableKeyUtils/stableKey.utils.js';
|
|
5
|
+
|
|
6
|
+
// One empty array for every render with nothing to draw, so `rows` keeps its identity while it stays empty.
|
|
7
|
+
const NO_ROWS = [];
|
|
8
|
+
/**
|
|
9
|
+
* Reports what a paged list shows, from the state of the request its page makes, which keeps its own `useQuery`. Use it for
|
|
10
|
+
* any list with a pager: it keeps the row total across page changes, holds a failed load's error through its retry, and
|
|
11
|
+
* names the query on screen for the status region that announces it.
|
|
12
|
+
*
|
|
13
|
+
* @param options The page's query, its rows and total, the request's state as the data library reports it, and its `refetch`;
|
|
14
|
+
* see `UsePagedListOptions`.
|
|
15
|
+
* @returns The `rows` to draw, `[]` while there is nothing to show or the error shows, as it does for a failed refetch whose
|
|
16
|
+
* rows are cached; `total` and `totalPages`, which stay through a page or rows-per-page change and an error, and are unknown
|
|
17
|
+
* again once anything else changes; the load state of `useLoadState`; `resultKey`, which changes as another query's result
|
|
18
|
+
* lands and with each failed attempt, but not for a refresh of the same query; `isPastEnd` for a link to a page past the
|
|
19
|
+
* last; and `loadingRowCount`, so a short last page does not load taller than it lands.
|
|
20
|
+
*/
|
|
21
|
+
const usePagedList = ({ query, rows, total, isPending, isError, isPreviousData = false, errorCount = 0, refetch, }) => {
|
|
22
|
+
const key = stableKeyOf(query);
|
|
23
|
+
const { showData, ...state } = useLoadState({ key, isPending, isError, isPreviousData, refetch });
|
|
24
|
+
// Rows standing in from the previous request belong to its result set, so neither their total nor their key is kept.
|
|
25
|
+
const hasLanded = rows !== undefined && !isPreviousData;
|
|
26
|
+
// Kept per result set, so the pager stays through a page change but never offers pages a new search or filter may not have.
|
|
27
|
+
const resultSet = resultSetKeyOf(query);
|
|
28
|
+
// A `NaN` total, as from `Number()` of a missing header, never equals the kept one and would set state on every render.
|
|
29
|
+
const landedTotal = hasLanded && Number.isFinite(total) ? total : undefined;
|
|
30
|
+
const [kept, setKept] = useState();
|
|
31
|
+
if (landedTotal !== undefined && (kept?.resultSet !== resultSet || kept.total !== landedTotal))
|
|
32
|
+
setKept({ resultSet, total: landedTotal });
|
|
33
|
+
const knownTotal = landedTotal ?? (kept?.resultSet === resultSet ? kept.total : undefined);
|
|
34
|
+
const totalPages = pageCountOf(knownTotal, query.pageSize);
|
|
35
|
+
// Keyed by query, not by response: a background refetch landing new rows for the same query must not be announced again.
|
|
36
|
+
const shownResult = hasLanded ? key : undefined;
|
|
37
|
+
const [landedResult, setLandedResult] = useState();
|
|
38
|
+
if (shownResult !== undefined && shownResult !== landedResult)
|
|
39
|
+
setLandedResult(shownResult);
|
|
40
|
+
// A failed attempt gets a key of its own, so a retry that fails again is announced although the words are the same.
|
|
41
|
+
const resultKey = state.isError ? `${key} failed ${errorCount}` : (shownResult ?? landedResult);
|
|
42
|
+
const shownRows = showData ? (rows ?? NO_ROWS) : NO_ROWS;
|
|
43
|
+
const isSettled = !state.isLoading && !state.isSearching && !state.isError;
|
|
44
|
+
const isPastEnd = isSettled && hasLanded && shownRows.length === 0 && knownTotal !== undefined && knownTotal > 0 && query.page > totalPages;
|
|
45
|
+
const rowsBeforePage = (query.page - 1) * query.pageSize;
|
|
46
|
+
const rowsOnPage = knownTotal === undefined ? 0 : Math.min(knownTotal - rowsBeforePage, query.pageSize);
|
|
47
|
+
return {
|
|
48
|
+
...state,
|
|
49
|
+
rows: shownRows,
|
|
50
|
+
total: knownTotal,
|
|
51
|
+
totalPages,
|
|
52
|
+
resultKey,
|
|
53
|
+
isPastEnd,
|
|
54
|
+
loadingRowCount: rowsOnPage > 0 ? rowsOnPage : query.pageSize,
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { usePagedList };
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/hooks/usePagedList/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAkDA;AACA,MAAM,OAAO,GAAqB,EAAE;AAEpC;;;;;;;;;;;;AAYG;AACI,MAAM,YAAY,GAAG,CAAqD,EAC/E,KAAK,EACL,IAAI,EACJ,KAAK,EACL,SAAS,EACT,OAAO,EACP,cAAc,GAAG,KAAK,EACtB,UAAU,GAAG,CAAC,EACd,OAAO,GACyB,KAAyB;AACzD,IAAA,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC;IAC9B,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,GAAG,YAAY,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;;IAGjG,MAAM,SAAS,GAAG,IAAI,KAAK,SAAS,IAAI,CAAC,cAAc;;AAGvD,IAAA,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC;;AAEvC,IAAA,MAAM,WAAW,GAAG,SAAS,IAAI,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AAG,CAAC,IAAI,KAAK,CAAC,QAAQ;IACxD,MAAM,UAAU,GAAG,UAAU,KAAK,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC;IAEvG,OAAO;AACL,QAAA,GAAG,KAAK;AACR,QAAA,IAAI,EAAE,SAAS;AACf,QAAA,KAAK,EAAE,UAAU;QACjB,UAAU;QACV,SAAS;QACT,SAAS;AACT,QAAA,eAAe,EAAE,UAAU,GAAG,CAAC,GAAG,UAAU,GAAG,KAAK,CAAC,QAAQ;KAC9D;AACH;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Tables` has no React Native implementation.
|
|
3
|
+
*
|
|
4
|
+
* This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
|
|
5
|
+
* that importing `@flipdish/ui-library/components/organisms/Tables` from React Native fails at
|
|
6
|
+
* compile time rather than resolving to the web build's types. There is no
|
|
7
|
+
* matching `index.js`, so Metro cannot bundle this module either.
|
|
8
|
+
*
|
|
9
|
+
* To make `Tables` available on React Native, add an `index.native.tsx` beside
|
|
10
|
+
* its `index.tsx` — the build picks it up automatically and this stub disappears.
|
|
11
|
+
*/
|
|
12
|
+
export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `useListQueryParams` has no React Native implementation.
|
|
3
|
+
*
|
|
4
|
+
* This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
|
|
5
|
+
* that importing `@flipdish/ui-library/hooks/useListQueryParams` from React Native fails at
|
|
6
|
+
* compile time rather than resolving to the web build's types. There is no
|
|
7
|
+
* matching `index.js`, so Metro cannot bundle this module either.
|
|
8
|
+
*
|
|
9
|
+
* To make `useListQueryParams` available on React Native, add an `index.native.tsx` beside
|
|
10
|
+
* its `index.tsx` — the build picks it up automatically and this stub disappears.
|
|
11
|
+
*/
|
|
12
|
+
export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `useLoadState` has no React Native implementation.
|
|
3
|
+
*
|
|
4
|
+
* This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
|
|
5
|
+
* that importing `@flipdish/ui-library/hooks/useLoadState` from React Native fails at
|
|
6
|
+
* compile time rather than resolving to the web build's types. There is no
|
|
7
|
+
* matching `index.js`, so Metro cannot bundle this module either.
|
|
8
|
+
*
|
|
9
|
+
* To make `useLoadState` available on React Native, add an `index.native.tsx` beside
|
|
10
|
+
* its `index.tsx` — the build picks it up automatically and this stub disappears.
|
|
11
|
+
*/
|
|
12
|
+
export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `usePagedList` has no React Native implementation.
|
|
3
|
+
*
|
|
4
|
+
* This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
|
|
5
|
+
* that importing `@flipdish/ui-library/hooks/usePagedList` from React Native fails at
|
|
6
|
+
* compile time rather than resolving to the web build's types. There is no
|
|
7
|
+
* matching `index.js`, so Metro cannot bundle this module either.
|
|
8
|
+
*
|
|
9
|
+
* To make `usePagedList` available on React Native, add an `index.native.tsx` beside
|
|
10
|
+
* its `index.tsx` — the build picks it up automatically and this stub disappears.
|
|
11
|
+
*/
|
|
12
|
+
export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `listQueryUtils` has no React Native implementation.
|
|
3
|
+
*
|
|
4
|
+
* This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
|
|
5
|
+
* that importing `@flipdish/ui-library/utilities/listQueryUtils` from React Native fails at
|
|
6
|
+
* compile time rather than resolving to the web build's types. There is no
|
|
7
|
+
* matching `index.js`, so Metro cannot bundle this module either.
|
|
8
|
+
*
|
|
9
|
+
* To make `listQueryUtils` available on React Native, add an `index.native.tsx` beside
|
|
10
|
+
* its `index.tsx` — the build picks it up automatically and this stub disappears.
|
|
11
|
+
*/
|
|
12
|
+
export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var stableKey_utils = require('../stableKeyUtils/stableKey.utils.cjs');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The state helpers under `useLoadState` and `usePagedList`: what a load shows, which result set a page belongs to, and its
|
|
7
|
+
* page count. INTERNAL: import as `#internal/utilities/listStateUtils/listState.utils`.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Names the result set a page of rows belongs to, so a row total can outlive page and page-size changes.
|
|
11
|
+
*
|
|
12
|
+
* @param query Any query object with a `page` and `pageSize`, plus whatever else the list filters on.
|
|
13
|
+
* @returns A string that is the same for every page and page size of one result set, and different once anything else changes.
|
|
14
|
+
*/
|
|
15
|
+
const resultSetKeyOf = ({ page: _page, pageSize: _pageSize, ...rest }) => stableKey_utils.stableKeyOf(rest);
|
|
16
|
+
/**
|
|
17
|
+
* Decides what a load shows. An error always shows as one: TanStack Query keeps a failed refetch's cached data, and drops the
|
|
18
|
+
* error as soon as a retry fetches again, so the error and the button that started a retry hold until it succeeds.
|
|
19
|
+
*
|
|
20
|
+
* @param state The query's result and whether a retry is running; see `LoadStateInput`.
|
|
21
|
+
* @returns At most one of `isLoading` (loading rows), `isSearching` (stand-in rows) and `isError`, which wins over the others
|
|
22
|
+
* while the query is in error or a retry runs; and `showData`, which is `false` exactly while `isError` is `true`, so cached or
|
|
23
|
+
* stand-in rows stay hidden behind the error.
|
|
24
|
+
*/
|
|
25
|
+
const loadStateOf = ({ isPending, isError, isPreviousData, isRetrying }) => {
|
|
26
|
+
if (isError || isRetrying)
|
|
27
|
+
return { isLoading: false, isSearching: false, isError: true, showData: false };
|
|
28
|
+
// Rows standing in are data to show, so they are not also a load.
|
|
29
|
+
return { isLoading: isPending && !isPreviousData, isSearching: isPreviousData, isError: false, showData: true };
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Counts the pages a result set spans.
|
|
33
|
+
*
|
|
34
|
+
* @param total The row total from the API, `undefined` while it is not known.
|
|
35
|
+
* @param pageSize Rows per page.
|
|
36
|
+
* @returns `Math.ceil(total / pageSize)`; `0` when `total` is unknown or zero, or `pageSize` is not a positive number.
|
|
37
|
+
*/
|
|
38
|
+
const pageCountOf = (total, pageSize) => {
|
|
39
|
+
if (!total || !(pageSize > 0))
|
|
40
|
+
return 0;
|
|
41
|
+
return Math.ceil(total / pageSize);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.loadStateOf = loadStateOf;
|
|
45
|
+
exports.pageCountOf = pageCountOf;
|
|
46
|
+
exports.resultSetKeyOf = resultSetKeyOf;
|
|
47
|
+
//# sourceMappingURL=listState.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listState.utils.cjs","sources":["../../../../src/utilities/__internal__/listStateUtils/listState.utils.ts"],"sourcesContent":[null],"names":["stableKeyOf"],"mappings":";;;;AAAA;;;AAGG;AAGH;;;;;AAKG;AACI,MAAM,cAAc,GAAG,CAAmD,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAS,KACnIA,2BAAW,CAAC,IAAI;AA0BlB;;;;;;;;AAQG;AACI,MAAM,WAAW,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAkB,KAAqB;IACjH,IAAI,OAAO,IAAI,UAAU;AAAE,QAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE;;IAE1G,OAAO,EAAE,SAAS,EAAE,SAAS,IAAI,CAAC,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;AACjH;AAEA;;;;;;AAMG;MACU,WAAW,GAAG,CAAC,KAAyB,EAAE,QAAgB,KAAY;IACjF,IAAI,CAAC,KAAK,IAAI,EAAE,QAAQ,GAAG,CAAC,CAAC;AAAE,QAAA,OAAO,CAAC;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;AACpC;;;;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names the result set a page of rows belongs to, so a row total can outlive page and page-size changes.
|
|
3
|
+
*
|
|
4
|
+
* @param query Any query object with a `page` and `pageSize`, plus whatever else the list filters on.
|
|
5
|
+
* @returns A string that is the same for every page and page size of one result set, and different once anything else changes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const resultSetKeyOf: <Query extends {
|
|
8
|
+
page: number;
|
|
9
|
+
pageSize: number;
|
|
10
|
+
}>({ page: _page, pageSize: _pageSize, ...rest }: Query) => string;
|
|
11
|
+
/** A query's result as TanStack's `useQuery` reports it, and whether the page's `retry` is still running for it. */
|
|
12
|
+
export interface LoadStateInput {
|
|
13
|
+
/** The query has no data yet. */
|
|
14
|
+
isPending: boolean;
|
|
15
|
+
/** The query failed, a refetch with data cached included. */
|
|
16
|
+
isError: boolean;
|
|
17
|
+
/** TanStack Query's `isPlaceholderData`, when `placeholderData` keeps the previous rows standing in, as for a search. */
|
|
18
|
+
isPreviousData: boolean;
|
|
19
|
+
/** `retry` was called for this query and its fetch has not settled. */
|
|
20
|
+
isRetrying: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** What `loadStateOf` decides a load shows. */
|
|
23
|
+
export interface LoadStateResult {
|
|
24
|
+
/** Draw loading rows. */
|
|
25
|
+
isLoading: boolean;
|
|
26
|
+
/** The previous rows stand in while a search lands. */
|
|
27
|
+
isSearching: boolean;
|
|
28
|
+
/** Show the error and its retry button. */
|
|
29
|
+
isError: boolean;
|
|
30
|
+
/** The data may be drawn; `false` while the error shows. */
|
|
31
|
+
showData: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Decides what a load shows. An error always shows as one: TanStack Query keeps a failed refetch's cached data, and drops the
|
|
35
|
+
* error as soon as a retry fetches again, so the error and the button that started a retry hold until it succeeds.
|
|
36
|
+
*
|
|
37
|
+
* @param state The query's result and whether a retry is running; see `LoadStateInput`.
|
|
38
|
+
* @returns At most one of `isLoading` (loading rows), `isSearching` (stand-in rows) and `isError`, which wins over the others
|
|
39
|
+
* while the query is in error or a retry runs; and `showData`, which is `false` exactly while `isError` is `true`, so cached or
|
|
40
|
+
* stand-in rows stay hidden behind the error.
|
|
41
|
+
*/
|
|
42
|
+
export declare const loadStateOf: ({ isPending, isError, isPreviousData, isRetrying }: LoadStateInput) => LoadStateResult;
|
|
43
|
+
/**
|
|
44
|
+
* Counts the pages a result set spans.
|
|
45
|
+
*
|
|
46
|
+
* @param total The row total from the API, `undefined` while it is not known.
|
|
47
|
+
* @param pageSize Rows per page.
|
|
48
|
+
* @returns `Math.ceil(total / pageSize)`; `0` when `total` is unknown or zero, or `pageSize` is not a positive number.
|
|
49
|
+
*/
|
|
50
|
+
export declare const pageCountOf: (total: number | undefined, pageSize: number) => number;
|
|
51
|
+
//# sourceMappingURL=listState.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listState.utils.d.ts","sourceRoot":"","sources":["../../../../src/utilities/__internal__/listStateUtils/listState.utils.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,+CAA+C,KAAK,KAAG,MACrH,CAAC;AAEpB,oHAAoH;AACpH,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,OAAO,EAAE,OAAO,CAAC;IACjB,yHAAyH;IACzH,cAAc,EAAE,OAAO,CAAC;IACxB,uEAAuE;IACvE,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC9B,yBAAyB;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,uDAAuD;IACvD,WAAW,EAAE,OAAO,CAAC;IACrB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,4DAA4D;IAC5D,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAI,oDAAoD,cAAc,KAAG,eAIhG,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,GAAG,SAAS,EAAE,UAAU,MAAM,KAAG,MAGzE,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { stableKeyOf } from '../stableKeyUtils/stableKey.utils.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The state helpers under `useLoadState` and `usePagedList`: what a load shows, which result set a page belongs to, and its
|
|
5
|
+
* page count. INTERNAL: import as `#internal/utilities/listStateUtils/listState.utils`.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Names the result set a page of rows belongs to, so a row total can outlive page and page-size changes.
|
|
9
|
+
*
|
|
10
|
+
* @param query Any query object with a `page` and `pageSize`, plus whatever else the list filters on.
|
|
11
|
+
* @returns A string that is the same for every page and page size of one result set, and different once anything else changes.
|
|
12
|
+
*/
|
|
13
|
+
const resultSetKeyOf = ({ page: _page, pageSize: _pageSize, ...rest }) => stableKeyOf(rest);
|
|
14
|
+
/**
|
|
15
|
+
* Decides what a load shows. An error always shows as one: TanStack Query keeps a failed refetch's cached data, and drops the
|
|
16
|
+
* error as soon as a retry fetches again, so the error and the button that started a retry hold until it succeeds.
|
|
17
|
+
*
|
|
18
|
+
* @param state The query's result and whether a retry is running; see `LoadStateInput`.
|
|
19
|
+
* @returns At most one of `isLoading` (loading rows), `isSearching` (stand-in rows) and `isError`, which wins over the others
|
|
20
|
+
* while the query is in error or a retry runs; and `showData`, which is `false` exactly while `isError` is `true`, so cached or
|
|
21
|
+
* stand-in rows stay hidden behind the error.
|
|
22
|
+
*/
|
|
23
|
+
const loadStateOf = ({ isPending, isError, isPreviousData, isRetrying }) => {
|
|
24
|
+
if (isError || isRetrying)
|
|
25
|
+
return { isLoading: false, isSearching: false, isError: true, showData: false };
|
|
26
|
+
// Rows standing in are data to show, so they are not also a load.
|
|
27
|
+
return { isLoading: isPending && !isPreviousData, isSearching: isPreviousData, isError: false, showData: true };
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Counts the pages a result set spans.
|
|
31
|
+
*
|
|
32
|
+
* @param total The row total from the API, `undefined` while it is not known.
|
|
33
|
+
* @param pageSize Rows per page.
|
|
34
|
+
* @returns `Math.ceil(total / pageSize)`; `0` when `total` is unknown or zero, or `pageSize` is not a positive number.
|
|
35
|
+
*/
|
|
36
|
+
const pageCountOf = (total, pageSize) => {
|
|
37
|
+
if (!total || !(pageSize > 0))
|
|
38
|
+
return 0;
|
|
39
|
+
return Math.ceil(total / pageSize);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { loadStateOf, pageCountOf, resultSetKeyOf };
|
|
43
|
+
//# sourceMappingURL=listState.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listState.utils.js","sources":["../../../../src/utilities/__internal__/listStateUtils/listState.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAGH;;;;;AAKG;AACI,MAAM,cAAc,GAAG,CAAmD,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAS,KACnI,WAAW,CAAC,IAAI;AA0BlB;;;;;;;;AAQG;AACI,MAAM,WAAW,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAkB,KAAqB;IACjH,IAAI,OAAO,IAAI,UAAU;AAAE,QAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE;;IAE1G,OAAO,EAAE,SAAS,EAAE,SAAS,IAAI,CAAC,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;AACjH;AAEA;;;;;;AAMG;MACU,WAAW,GAAG,CAAC,KAAyB,EAAE,QAAgB,KAAY;IACjF,IAAI,CAAC,KAAK,IAAI,EAAE,QAAQ,GAAG,CAAC,CAAC;AAAE,QAAA,OAAO,CAAC;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;AACpC;;"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cache-key helpers that give equal values equal strings, whatever their key order, `Set` order or `Map` order.
|
|
5
|
+
* INTERNAL: import as `#internal/utilities/stableKeyUtils/stableKey.utils`.
|
|
6
|
+
*/
|
|
7
|
+
// Plain UTF-16 code-unit order: `localeCompare` depends on the runtime's locale and can rank distinct strings as equal.
|
|
8
|
+
const byCodeUnit = (a, b) => {
|
|
9
|
+
if (a < b)
|
|
10
|
+
return -1;
|
|
11
|
+
return a > b ? 1 : 0;
|
|
12
|
+
};
|
|
13
|
+
// Object keys are sorted at every depth so insertion order never changes the string.
|
|
14
|
+
const sortedKeys = (_key, value) => {
|
|
15
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
16
|
+
return value;
|
|
17
|
+
return Object.fromEntries(Object.entries(value).sort(([a], [b]) => byCodeUnit(a, b)));
|
|
18
|
+
};
|
|
19
|
+
const keyOfSafe = (safe) => JSON.stringify(safe, sortedKeys) ?? 'undefined';
|
|
20
|
+
const sortedByKey = (members) => members
|
|
21
|
+
.map((member) => ({ member, key: keyOfSafe(member) }))
|
|
22
|
+
.sort((a, b) => byCodeUnit(a.key, b.key))
|
|
23
|
+
.map(({ member }) => member);
|
|
24
|
+
// A primitive member becomes a string, so the id `1` and the `'1'` a URL reads back key the same.
|
|
25
|
+
const setMemberOf = (member) => (member !== null && typeof member === 'object' ? jsonSafeOf(member) : String(member));
|
|
26
|
+
/**
|
|
27
|
+
* Copies a value into plain JSON data, so equal values serialise the same. TanStack Query hashes every `Set` and `Map` as
|
|
28
|
+
* `{}`, so two selections would otherwise share a cache entry.
|
|
29
|
+
*
|
|
30
|
+
* @param value The value to copy: a primitive, array, `Set`, `Map`, object or class instance, nested to any depth.
|
|
31
|
+
* @returns A `Set` becomes an array of its members, each primitive as a string and each object copied like any other value,
|
|
32
|
+
* sorted by their keys, so it keys the same as that array; a `Map` becomes `{ $map: [key, value][] }`, sorted by key, so it
|
|
33
|
+
* never keys like a plain object or array of the same entries; an array keeps its order; a value with `toJSON`, such as a
|
|
34
|
+
* `Date`, becomes its result; an object or class instance becomes a plain object of its own enumerable keys, without the
|
|
35
|
+
* members that are `undefined` or functions. Primitives and `null` pass through.
|
|
36
|
+
*/
|
|
37
|
+
function jsonSafeOf(value) {
|
|
38
|
+
if (value === null || typeof value !== 'object')
|
|
39
|
+
return value;
|
|
40
|
+
if (value instanceof Set)
|
|
41
|
+
return sortedByKey([...value].map(setMemberOf));
|
|
42
|
+
if (value instanceof Map)
|
|
43
|
+
return { $map: sortedByKey([...value].map(([key, member]) => [jsonSafeOf(key), jsonSafeOf(member)])) };
|
|
44
|
+
const withToJson = value;
|
|
45
|
+
if (typeof withToJson.toJSON === 'function')
|
|
46
|
+
return jsonSafeOf(withToJson.toJSON.call(value));
|
|
47
|
+
if (Array.isArray(value))
|
|
48
|
+
return value.map((member) => jsonSafeOf(member));
|
|
49
|
+
// Built from entries rather than by assignment, so an own `__proto__` field stays a field instead of setting a prototype.
|
|
50
|
+
return Object.fromEntries(Object.entries(value)
|
|
51
|
+
.filter(([, member]) => member !== undefined && typeof member !== 'function')
|
|
52
|
+
.map(([key, member]) => [key, jsonSafeOf(member)]));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Turns a value into a string that is the same for every equal value.
|
|
56
|
+
*
|
|
57
|
+
* Limits, as JSON has them: `NaN` and `Infinity` key as `null`, and so does `undefined` in an array; a cyclic value throws, and
|
|
58
|
+
* so does a `BigInt` anywhere but in a `Set`.
|
|
59
|
+
*
|
|
60
|
+
* @param value The value to key, as `jsonSafeOf` accepts it.
|
|
61
|
+
* @returns The JSON of `jsonSafeOf(value)` with object keys sorted at every depth.
|
|
62
|
+
*/
|
|
63
|
+
const stableKeyOf = (value) => keyOfSafe(jsonSafeOf(value));
|
|
64
|
+
|
|
65
|
+
exports.jsonSafeOf = jsonSafeOf;
|
|
66
|
+
exports.stableKeyOf = stableKeyOf;
|
|
67
|
+
//# sourceMappingURL=stableKey.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stableKey.utils.cjs","sources":["../../../../src/utilities/__internal__/stableKeyUtils/stableKey.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAEH;AACA,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS,KAAY;IAClD,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE;IACpB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;AACtB,CAAC;AAED;AACA,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,KAAc,KAAa;AAC3D,IAAA,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK;AACrF,IAAA,OAAO,MAAM,CAAC,WAAW,CAAC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AAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;IAChI,MAAM,UAAU,GAAG,KAA6B;AAChD,IAAA,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,UAAU;QAAE,OAAO,UAAU,CAAE,UAAU,CAAC,MAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChH,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,CAAC,CAAC;;IAE1E,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK;AACjB,SAAA,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,MAAM,KAAK,SAAS,IAAI,OAAO,MAAM,KAAK,UAAU;SAC3E,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CACrD;AACH;AAEA;;;;;;;;AAQG;AACI,MAAM,WAAW,GAAG,CAAC,KAAc,KAAa,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache-key helpers that give equal values equal strings, whatever their key order, `Set` order or `Map` order.
|
|
3
|
+
* INTERNAL: import as `#internal/utilities/stableKeyUtils/stableKey.utils`.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Copies a value into plain JSON data, so equal values serialise the same. TanStack Query hashes every `Set` and `Map` as
|
|
7
|
+
* `{}`, so two selections would otherwise share a cache entry.
|
|
8
|
+
*
|
|
9
|
+
* @param value The value to copy: a primitive, array, `Set`, `Map`, object or class instance, nested to any depth.
|
|
10
|
+
* @returns A `Set` becomes an array of its members, each primitive as a string and each object copied like any other value,
|
|
11
|
+
* sorted by their keys, so it keys the same as that array; a `Map` becomes `{ $map: [key, value][] }`, sorted by key, so it
|
|
12
|
+
* never keys like a plain object or array of the same entries; an array keeps its order; a value with `toJSON`, such as a
|
|
13
|
+
* `Date`, becomes its result; an object or class instance becomes a plain object of its own enumerable keys, without the
|
|
14
|
+
* members that are `undefined` or functions. Primitives and `null` pass through.
|
|
15
|
+
*/
|
|
16
|
+
export declare function jsonSafeOf(value: unknown): unknown;
|
|
17
|
+
/**
|
|
18
|
+
* Turns a value into a string that is the same for every equal value.
|
|
19
|
+
*
|
|
20
|
+
* Limits, as JSON has them: `NaN` and `Infinity` key as `null`, and so does `undefined` in an array; a cyclic value throws, and
|
|
21
|
+
* so does a `BigInt` anywhere but in a `Set`.
|
|
22
|
+
*
|
|
23
|
+
* @param value The value to key, as `jsonSafeOf` accepts it.
|
|
24
|
+
* @returns The JSON of `jsonSafeOf(value)` with object keys sorted at every depth.
|
|
25
|
+
*/
|
|
26
|
+
export declare const stableKeyOf: (value: unknown) => string;
|
|
27
|
+
//# sourceMappingURL=stableKey.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stableKey.utils.d.ts","sourceRoot":"","sources":["../../../../src/utilities/__internal__/stableKeyUtils/stableKey.utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyBH;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAalD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,MAAsC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache-key helpers that give equal values equal strings, whatever their key order, `Set` order or `Map` order.
|
|
3
|
+
* INTERNAL: import as `#internal/utilities/stableKeyUtils/stableKey.utils`.
|
|
4
|
+
*/
|
|
5
|
+
// Plain UTF-16 code-unit order: `localeCompare` depends on the runtime's locale and can rank distinct strings as equal.
|
|
6
|
+
const byCodeUnit = (a, b) => {
|
|
7
|
+
if (a < b)
|
|
8
|
+
return -1;
|
|
9
|
+
return a > b ? 1 : 0;
|
|
10
|
+
};
|
|
11
|
+
// Object keys are sorted at every depth so insertion order never changes the string.
|
|
12
|
+
const sortedKeys = (_key, value) => {
|
|
13
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
14
|
+
return value;
|
|
15
|
+
return Object.fromEntries(Object.entries(value).sort(([a], [b]) => byCodeUnit(a, b)));
|
|
16
|
+
};
|
|
17
|
+
const keyOfSafe = (safe) => JSON.stringify(safe, sortedKeys) ?? 'undefined';
|
|
18
|
+
const sortedByKey = (members) => members
|
|
19
|
+
.map((member) => ({ member, key: keyOfSafe(member) }))
|
|
20
|
+
.sort((a, b) => byCodeUnit(a.key, b.key))
|
|
21
|
+
.map(({ member }) => member);
|
|
22
|
+
// A primitive member becomes a string, so the id `1` and the `'1'` a URL reads back key the same.
|
|
23
|
+
const setMemberOf = (member) => (member !== null && typeof member === 'object' ? jsonSafeOf(member) : String(member));
|
|
24
|
+
/**
|
|
25
|
+
* Copies a value into plain JSON data, so equal values serialise the same. TanStack Query hashes every `Set` and `Map` as
|
|
26
|
+
* `{}`, so two selections would otherwise share a cache entry.
|
|
27
|
+
*
|
|
28
|
+
* @param value The value to copy: a primitive, array, `Set`, `Map`, object or class instance, nested to any depth.
|
|
29
|
+
* @returns A `Set` becomes an array of its members, each primitive as a string and each object copied like any other value,
|
|
30
|
+
* sorted by their keys, so it keys the same as that array; a `Map` becomes `{ $map: [key, value][] }`, sorted by key, so it
|
|
31
|
+
* never keys like a plain object or array of the same entries; an array keeps its order; a value with `toJSON`, such as a
|
|
32
|
+
* `Date`, becomes its result; an object or class instance becomes a plain object of its own enumerable keys, without the
|
|
33
|
+
* members that are `undefined` or functions. Primitives and `null` pass through.
|
|
34
|
+
*/
|
|
35
|
+
function jsonSafeOf(value) {
|
|
36
|
+
if (value === null || typeof value !== 'object')
|
|
37
|
+
return value;
|
|
38
|
+
if (value instanceof Set)
|
|
39
|
+
return sortedByKey([...value].map(setMemberOf));
|
|
40
|
+
if (value instanceof Map)
|
|
41
|
+
return { $map: sortedByKey([...value].map(([key, member]) => [jsonSafeOf(key), jsonSafeOf(member)])) };
|
|
42
|
+
const withToJson = value;
|
|
43
|
+
if (typeof withToJson.toJSON === 'function')
|
|
44
|
+
return jsonSafeOf(withToJson.toJSON.call(value));
|
|
45
|
+
if (Array.isArray(value))
|
|
46
|
+
return value.map((member) => jsonSafeOf(member));
|
|
47
|
+
// Built from entries rather than by assignment, so an own `__proto__` field stays a field instead of setting a prototype.
|
|
48
|
+
return Object.fromEntries(Object.entries(value)
|
|
49
|
+
.filter(([, member]) => member !== undefined && typeof member !== 'function')
|
|
50
|
+
.map(([key, member]) => [key, jsonSafeOf(member)]));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Turns a value into a string that is the same for every equal value.
|
|
54
|
+
*
|
|
55
|
+
* Limits, as JSON has them: `NaN` and `Infinity` key as `null`, and so does `undefined` in an array; a cyclic value throws, and
|
|
56
|
+
* so does a `BigInt` anywhere but in a `Set`.
|
|
57
|
+
*
|
|
58
|
+
* @param value The value to key, as `jsonSafeOf` accepts it.
|
|
59
|
+
* @returns The JSON of `jsonSafeOf(value)` with object keys sorted at every depth.
|
|
60
|
+
*/
|
|
61
|
+
const stableKeyOf = (value) => keyOfSafe(jsonSafeOf(value));
|
|
62
|
+
|
|
63
|
+
export { jsonSafeOf, stableKeyOf };
|
|
64
|
+
//# sourceMappingURL=stableKey.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stableKey.utils.js","sources":["../../../../src/utilities/__internal__/stableKeyUtils/stableKey.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;AAGG;AAEH;AACA,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS,KAAY;IAClD,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE;IACpB,OAAO,CAAC,GAAG,CAAC,GAAG,C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C,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACzE,IAAI,KAAK,YAAY,GAAG;AAAE,QAAA,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;IAChI,MAAM,UAAU,GAAG,KAA6B;AAChD,IAAA,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,UAAU;QAAE,OAAO,UAAU,CAAE,UAAU,CAAC,MAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChH,IAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,CAAC,CAAC;;IAE1E,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK;AACjB,SAAA,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,MAAM,KAAK,SAAS,IAAI,OAAO,MAAM,KAAK,UAAU;SAC3E,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CACrD;AACH;AAEA;;;;;;;;AAQG;AACI,MAAM,WAAW,GAAG,CAAC,KAAc,KAAa,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;;"}
|
|
@@ -118,9 +118,37 @@ const createWebStorageItem = (getStorage, key, options = {}) => {
|
|
|
118
118
|
},
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
|
+
/**
|
|
122
|
+
* Calls `onChange` when another document of the same origin, such as another tab, writes or clears `key` in the watched
|
|
123
|
+
* storage: the browser's `storage` event, which never fires for a write in this document.
|
|
124
|
+
*
|
|
125
|
+
* @param storageName The storage the key lives in; the same event reports writes to the other one, which are ignored.
|
|
126
|
+
* @param key The storage key to watch.
|
|
127
|
+
* @param onChange Called after each such write, or after the other document clears that whole storage.
|
|
128
|
+
* @returns Stops watching. Without `window`, as on the server, nothing is watched.
|
|
129
|
+
*/
|
|
130
|
+
const subscribeToOtherDocumentWrites = (storageName, key, onChange) => {
|
|
131
|
+
if (typeof window === 'undefined')
|
|
132
|
+
return () => { };
|
|
133
|
+
const handleStorage = (event) => {
|
|
134
|
+
let storage;
|
|
135
|
+
try {
|
|
136
|
+
storage = window[storageName];
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
// A `null` key is a `clear()` of the whole storage, which only counts for the storage watched.
|
|
142
|
+
if (event.storageArea === storage && (event.key === key || event.key === null))
|
|
143
|
+
onChange();
|
|
144
|
+
};
|
|
145
|
+
window.addEventListener('storage', handleStorage);
|
|
146
|
+
return () => window.removeEventListener('storage', handleStorage);
|
|
147
|
+
};
|
|
121
148
|
|
|
122
149
|
exports.createWebStorageItem = createWebStorageItem;
|
|
123
150
|
exports.isBoolean = isBoolean;
|
|
124
151
|
exports.isString = isString;
|
|
125
152
|
exports.parseBooleanString = parseBooleanString;
|
|
153
|
+
exports.subscribeToOtherDocumentWrites = subscribeToOtherDocumentWrites;
|
|
126
154
|
//# sourceMappingURL=webStorage.utils.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webStorage.utils.cjs","sources":["../../../../src/utilities/__internal__/webStorageUtils/webStorage.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;;;AAUG;AAKH,MAAM,OAAO,GAAG,CAAC,UAA2B,EAAE,GAAW,KAAmB;IAC1E,IAAI,OAAO,MAAM,KAAK,WAAW;AAAE,QAAA,OAAO,IAAI;AAC9C,IAAA,IAAI;AACF,QAAA,OAAO,UAAU,EAAE,CAAC,O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KAA2B,EAAE,QAAQ,EAAE,GAAG,OAAO;IAExG,OAAO;QACL,GAAG,GAAA;YACD,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;YACpC,IAAI,GAAG,IAAI,IAAI;AAAE,gBAAA,OAAO,IAAI;AAC5B,YAAA,IAAI;AACF,gBAAA,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC;AAC9B,gBAAA,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;AAAE,oBAAA,OAAO,IAAI;AAC7C,gBAAA,OAAO,KAAK;YACd;AAAE,YAAA,MAAM;AACN,gBAAA,OAAO,IAAI;YACb;QACF,CAAC;AACD,QAAA,GAAG,CAAC,KAAK,EAAA;AACP,YAAA,IAAI;AACF,gBAAA,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC;;;;gBAInC,IAAI,OAAO,UAAU,KAAK,QAAQ;oBAAE;AACpC,gBAAA,OAAO,CAAC,UAAU,EAAE,GAAG,EAAE,UAAU,CAAC;YACtC;AAAE,YAAA,MAAM;;;YAGR;QACF,CAAC;QACD,KAAK,GAAA;AACH,YAAA,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC;QAC7B,CAAC;KACF;AACH
|
|
1
|
+
{"version":3,"file":"webStorage.utils.cjs","sources":["../../../../src/utilities/__internal__/webStorageUtils/webStorage.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;;;AAUG;AAKH,MAAM,OAAO,GAAG,CAAC,UAA2B,EAAE,GAAW,KAAmB;IAC1E,IAAI,OAAO,MAAM,KAAK,WAAW;AAAE,QAAA,OAAO,IAAI;AAC9C,IAAA,IAAI;AACF,QAAA,OAAO,UAAU,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;IAClC;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,IAAI;IACb;AACF,CAAC;AAED,MAAM,OAAO,GAAG,CAAC,UAA2B,EAAE,GAAW,EAAE,KA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AAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC;AACnE;;;;;;"}
|
|
@@ -60,5 +60,15 @@ export declare const parseBooleanString: (raw: string, errorMessage: string) =>
|
|
|
60
60
|
* @returns An accessor whose `get`, `set` and `clear` never throw.
|
|
61
61
|
*/
|
|
62
62
|
export declare const createWebStorageItem: <T>(getStorage: StorageAccessor, key: string, options?: WebStorageItemOptions<T>) => WebStorageItem<T>;
|
|
63
|
+
/**
|
|
64
|
+
* Calls `onChange` when another document of the same origin, such as another tab, writes or clears `key` in the watched
|
|
65
|
+
* storage: the browser's `storage` event, which never fires for a write in this document.
|
|
66
|
+
*
|
|
67
|
+
* @param storageName The storage the key lives in; the same event reports writes to the other one, which are ignored.
|
|
68
|
+
* @param key The storage key to watch.
|
|
69
|
+
* @param onChange Called after each such write, or after the other document clears that whole storage.
|
|
70
|
+
* @returns Stops watching. Without `window`, as on the server, nothing is watched.
|
|
71
|
+
*/
|
|
72
|
+
export declare const subscribeToOtherDocumentWrites: (storageName: "localStorage" | "sessionStorage", key: string, onChange: () => void) => (() => void);
|
|
63
73
|
export {};
|
|
64
74
|
//# sourceMappingURL=webStorage.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webStorage.utils.d.ts","sourceRoot":"","sources":["../../../../src/utilities/__internal__/webStorageUtils/webStorage.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,qFAAqF;AACrF,KAAK,eAAe,GAAG,MAAM,OAAO,CAAC;AA+BrC,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,gFAAgF;IAChF,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAChB,wEAAwE;IACxE,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACpB,mDAAmD;IACnD,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,8DAA8D;IAC9D,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC;IACjC,2DAA2D;IAC3D,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,CAAC;IACjC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC;CAC3C;AAED;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,OAAqC,CAAC;AAE1F;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAmC,CAAC;AAEvF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,EAAE,cAAc,MAAM,KAAG,OAItE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,EAAE,YAAY,eAAe,EAAE,KAAK,MAAM,EAAE,UAAS,qBAAqB,CAAC,CAAC,CAAM,KAAG,cAAc,CAAC,CAAC,CAgC1I,CAAC"}
|
|
1
|
+
{"version":3,"file":"webStorage.utils.d.ts","sourceRoot":"","sources":["../../../../src/utilities/__internal__/webStorageUtils/webStorage.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,qFAAqF;AACrF,KAAK,eAAe,GAAG,MAAM,OAAO,CAAC;AA+BrC,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,gFAAgF;IAChF,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAChB,wEAAwE;IACxE,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACpB,mDAAmD;IACnD,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,8DAA8D;IAC9D,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC;IACjC,2DAA2D;IAC3D,WA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