@astral/ui 4.104.2 → 4.106.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/components/ActionCellBase/ActionCellBase.js +10 -1
- package/components/ActionCellBase/MainAction/MainAction.js +6 -0
- package/components/ActionCellBase/MainAction/MainIconButton/MainIconButton.js +7 -4
- package/components/ActionCellBase/MainAction/MainIconButton/constants.d.ts +3 -0
- package/components/ActionCellBase/MainAction/MainIconButton/constants.js +4 -0
- package/components/ActionCellBase/MainAction/MainIconButton/styles.d.ts +11 -0
- package/components/ActionCellBase/MainAction/MainIconButton/styles.js +9 -0
- package/components/ActionCellBase/MainAction/MobileMainButton/MobileMainButton.d.ts +14 -0
- package/components/ActionCellBase/MainAction/MobileMainButton/MobileMainButton.js +17 -0
- package/components/ActionCellBase/MainAction/MobileMainButton/index.d.ts +1 -0
- package/components/ActionCellBase/MainAction/MobileMainButton/index.js +1 -0
- package/components/ActionCellBase/MainAction/MobileMainButton/styles.d.ts +11 -0
- package/components/ActionCellBase/MainAction/MobileMainButton/styles.js +7 -0
- package/components/ActionCellBase/SecondaryAction/SecondaryAction.js +2 -2
- package/components/ActionCellBase/SecondaryAction/styles.d.ts +4 -0
- package/components/ActionCellBase/SecondaryAction/styles.js +9 -0
- package/components/ActionCellBase/constants.d.ts +4 -0
- package/components/ActionCellBase/constants.js +5 -0
- package/components/ActionCellBase/styles.js +11 -0
- package/components/ActionCellBase/types.d.ts +25 -0
- package/components/ActionGroup/MainActions/ActionNode/ActionNode.d.ts +9 -0
- package/components/ActionGroup/MainActions/ActionNode/ActionNode.js +30 -0
- package/components/ActionGroup/MainActions/ActionNode/index.d.ts +1 -0
- package/components/ActionGroup/MainActions/ActionNode/index.js +1 -0
- package/components/ActionGroup/MainActions/MainActions.d.ts +1 -1
- package/components/ActionGroup/MainActions/MainActions.js +3 -14
- package/components/ActionGroup/MainActions/hooks/useMainActions/useMainActions.d.ts +352 -3
- package/components/ActionGroup/MainActions/hooks/useMainActions/useMainActions.js +33 -6
- package/components/ActionGroup/MainActions/index.d.ts +1 -0
- package/components/ActionGroup/MainActions/index.js +1 -0
- package/components/ActionGroup/MainActions/styles.d.ts +5 -6
- package/components/ActionGroup/MainActions/styles.js +6 -7
- package/components/ActionGroup/SecondaryVisibleActions/ActionNode/ActionNode.d.ts +12 -0
- package/components/ActionGroup/SecondaryVisibleActions/ActionNode/ActionNode.js +30 -0
- package/components/ActionGroup/SecondaryVisibleActions/ActionNode/index.d.ts +1 -0
- package/components/ActionGroup/SecondaryVisibleActions/ActionNode/index.js +1 -0
- package/components/ActionGroup/SecondaryVisibleActions/SecondaryVisibleActions.d.ts +1 -1
- package/components/ActionGroup/SecondaryVisibleActions/SecondaryVisibleActions.js +3 -7
- package/components/ActionGroup/constants.d.ts +3 -0
- package/components/ActionGroup/constants.js +4 -0
- package/components/ActionGroup/index.d.ts +2 -1
- package/components/ActionGroup/index.js +1 -0
- package/components/ActionGroup/public.d.ts +2 -1
- package/components/ActionGroup/public.js +1 -0
- package/components/ActionGroup/styles.js +5 -0
- package/components/ActionGroup/types.d.ts +48 -6
- package/components/InfiniteTreeList/InfiniteTreeList.js +16 -2
- package/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContext.d.ts +4 -0
- package/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContext.js +1 -0
- package/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContextProvider/InfiniteTreeListContextProvider.d.ts +2 -2
- package/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContextProvider/InfiniteTreeListContextProvider.js +3 -1
- package/components/InfiniteTreeList/InfiniteTreeListItem/ErrorPlaceholder/styles.js +8 -0
- package/components/InfiniteTreeList/InfiniteTreeListItem/InfiniteTreeListItem.js +7 -4
- package/components/InfiniteTreeList/InfiniteTreeListItem/constants.d.ts +2 -0
- package/components/InfiniteTreeList/InfiniteTreeListItem/constants.js +2 -0
- package/components/InfiniteTreeList/InfiniteTreeListItem/index.d.ts +1 -0
- package/components/InfiniteTreeList/InfiniteTreeListItem/index.js +1 -0
- package/components/InfiniteTreeList/InfiniteTreeListItem/styles.d.ts +14 -0
- package/components/InfiniteTreeList/InfiniteTreeListItem/styles.js +66 -2
- package/components/InfiniteTreeList/LevelHeader/LevelHeader.d.ts +5 -0
- package/components/InfiniteTreeList/LevelHeader/LevelHeader.js +17 -0
- package/components/InfiniteTreeList/LevelHeader/constants.d.ts +3 -0
- package/components/InfiniteTreeList/LevelHeader/constants.js +3 -0
- package/components/InfiniteTreeList/LevelHeader/index.d.ts +2 -0
- package/components/InfiniteTreeList/LevelHeader/index.js +2 -0
- package/components/InfiniteTreeList/LevelHeader/styles.d.ts +365 -0
- package/components/InfiniteTreeList/LevelHeader/styles.js +51 -0
- package/components/InfiniteTreeList/LevelHeader/types.d.ts +14 -0
- package/components/InfiniteTreeList/LevelHeader/types.js +1 -0
- package/components/InfiniteTreeList/ListFooter/styles.js +8 -0
- package/components/InfiniteTreeList/OnTopButton/styles.js +7 -0
- package/components/InfiniteTreeList/ParentItems/Item/Item.js +10 -2
- package/components/InfiniteTreeList/ParentItems/Item/useLogic/useLogic.d.ts +1 -0
- package/components/InfiniteTreeList/ParentItems/Item/useLogic/useLogic.js +10 -2
- package/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/NoDataRow.js +2 -2
- package/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/styles.d.ts +3 -0
- package/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/styles.js +11 -0
- package/components/InfiniteTreeList/TreeItem/TreeItem.js +6 -3
- package/components/InfiniteTreeList/TreeItem/styles.js +19 -0
- package/components/InfiniteTreeList/TreeItem/useLogic/useLogic.d.ts +2 -1
- package/components/InfiniteTreeList/TreeItem/useLogic/useLogic.js +5 -4
- package/components/InfiniteTreeList/constants.d.ts +21 -0
- package/components/InfiniteTreeList/constants.js +21 -0
- package/components/InfiniteTreeList/hooks/index.d.ts +2 -0
- package/components/InfiniteTreeList/hooks/index.js +2 -0
- package/components/InfiniteTreeList/hooks/useLevelNavigation/index.d.ts +2 -0
- package/components/InfiniteTreeList/hooks/useLevelNavigation/index.js +2 -0
- package/components/InfiniteTreeList/hooks/useLevelNavigation/types.d.ts +15 -0
- package/components/InfiniteTreeList/hooks/useLevelNavigation/types.js +1 -0
- package/components/InfiniteTreeList/hooks/useLevelNavigation/useLevelNavigation.d.ts +15 -0
- package/components/InfiniteTreeList/hooks/useLevelNavigation/useLevelNavigation.js +48 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/index.d.ts +3 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/index.js +3 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/index.d.ts +2 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/index.js +2 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.d.ts +16 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.js +1 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.d.ts +12 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.js +42 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.d.ts +2 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.js +2 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.d.ts +12 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.js +1 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/useScrollToTopButton.d.ts +15 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/useScrollToTopButton.js +27 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/index.d.ts +2 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/index.js +2 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/types.d.ts +11 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/types.js +1 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.d.ts +12 -0
- package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.js +39 -0
- package/components/InfiniteTreeList/hooks/useListScroll/types.d.ts +14 -2
- package/components/InfiniteTreeList/hooks/useListScroll/useListScroll.d.ts +9 -6
- package/components/InfiniteTreeList/hooks/useListScroll/useListScroll.js +192 -28
- package/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/getOffsetTop.d.ts +4 -0
- package/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/getOffsetTop.js +6 -0
- package/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/index.d.ts +1 -0
- package/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/index.js +1 -0
- package/components/InfiniteTreeList/hooks/useListScroll/utils/index.d.ts +1 -0
- package/components/InfiniteTreeList/hooks/useListScroll/utils/index.js +1 -0
- package/components/InfiniteTreeList/hooks/useNodeTitleValidation/index.d.ts +2 -0
- package/components/InfiniteTreeList/hooks/useNodeTitleValidation/index.js +2 -0
- package/components/InfiniteTreeList/hooks/useNodeTitleValidation/types.d.ts +14 -0
- package/components/InfiniteTreeList/hooks/useNodeTitleValidation/types.js +1 -0
- package/components/InfiniteTreeList/hooks/useNodeTitleValidation/useNodeTitleValidation.d.ts +5 -0
- package/components/InfiniteTreeList/hooks/useNodeTitleValidation/useNodeTitleValidation.js +18 -0
- package/components/InfiniteTreeList/styles.d.ts +5 -0
- package/components/InfiniteTreeList/styles.js +41 -0
- package/components/InfiniteTreeList/types.d.ts +4 -0
- package/components/InfiniteTreeList/useLogic/useLogic.d.ts +13 -5
- package/components/InfiniteTreeList/useLogic/useLogic.js +165 -27
- package/components/InfiniteTreeList/utils/checkHasFooterContent/checkHasFooterContent.d.ts +5 -0
- package/components/InfiniteTreeList/utils/checkHasFooterContent/checkHasFooterContent.js +4 -0
- package/components/InfiniteTreeList/utils/checkHasFooterContent/index.d.ts +1 -0
- package/components/InfiniteTreeList/utils/checkHasFooterContent/index.js +1 -0
- package/components/InfiniteTreeList/utils/checkHasNested/checkHasNested.d.ts +6 -0
- package/components/InfiniteTreeList/utils/checkHasNested/checkHasNested.js +5 -0
- package/components/InfiniteTreeList/utils/checkHasNested/index.d.ts +1 -0
- package/components/InfiniteTreeList/utils/checkHasNested/index.js +1 -0
- package/components/InfiniteTreeList/utils/createTailRegistry/createTailRegistry.d.ts +8 -3
- package/components/InfiniteTreeList/utils/createTailRegistry/createTailRegistry.js +30 -12
- package/components/InfiniteTreeList/utils/flattenTree/flattenTree.js +2 -1
- package/components/InfiniteTreeList/utils/getLevelKey/getLevelKey.d.ts +4 -0
- package/components/InfiniteTreeList/utils/getLevelKey/getLevelKey.js +5 -0
- package/components/InfiniteTreeList/utils/getLevelKey/index.d.ts +1 -0
- package/components/InfiniteTreeList/utils/getLevelKey/index.js +1 -0
- package/components/InfiniteTreeList/utils/index.d.ts +3 -0
- package/components/InfiniteTreeList/utils/index.js +3 -0
- package/components/PageHeader/MobilePageActions/MobilePageActions.js +2 -2
- package/components/PageHeader/MobilePageActions/useLogic/useLogic.d.ts +1 -0
- package/components/PageHeader/MobilePageActions/useLogic/useLogic.js +3 -0
- package/components/PageHeader/PageActions/MainActions/MainActions.d.ts +1 -1
- package/components/PageHeader/PageActions/MainActions/MainActions.js +2 -2
- package/components/PageHeader/PageActions/MainActions/styles.js +5 -0
- package/components/PageHeader/PageActions/PageActions.js +2 -2
- package/components/PageHeader/PageActions/SecondaryVisibleActions/SecondaryVisibleActions.d.ts +1 -1
- package/components/PageHeader/PageActions/SecondaryVisibleActions/SecondaryVisibleActions.js +3 -3
- package/components/PageHeader/PageActions/SecondaryVisibleActions/styles.d.ts +7 -1
- package/components/PageHeader/PageActions/useLogic/useLogic.d.ts +1 -0
- package/components/PageHeader/PageActions/useLogic/useLogic.js +3 -0
- package/components/index.d.ts +1 -1
- package/components/useScrollManagement/useScrollManagement.js +7 -6
- package/node/components/ActionCellBase/ActionCellBase.js +10 -1
- package/node/components/ActionCellBase/MainAction/MainAction.js +6 -0
- package/node/components/ActionCellBase/MainAction/MainIconButton/MainIconButton.js +7 -4
- package/node/components/ActionCellBase/MainAction/MainIconButton/constants.d.ts +3 -0
- package/node/components/ActionCellBase/MainAction/MainIconButton/constants.js +7 -0
- package/node/components/ActionCellBase/MainAction/MainIconButton/styles.d.ts +11 -0
- package/node/components/ActionCellBase/MainAction/MainIconButton/styles.js +12 -0
- package/node/components/ActionCellBase/MainAction/MobileMainButton/MobileMainButton.d.ts +14 -0
- package/node/components/ActionCellBase/MainAction/MobileMainButton/MobileMainButton.js +21 -0
- package/node/components/ActionCellBase/MainAction/MobileMainButton/index.d.ts +1 -0
- package/node/components/ActionCellBase/MainAction/MobileMainButton/index.js +17 -0
- package/node/components/ActionCellBase/MainAction/MobileMainButton/styles.d.ts +11 -0
- package/node/components/ActionCellBase/MainAction/MobileMainButton/styles.js +10 -0
- package/node/components/ActionCellBase/SecondaryAction/SecondaryAction.js +2 -2
- package/node/components/ActionCellBase/SecondaryAction/styles.d.ts +4 -0
- package/node/components/ActionCellBase/SecondaryAction/styles.js +12 -0
- package/node/components/ActionCellBase/constants.d.ts +4 -0
- package/node/components/ActionCellBase/constants.js +8 -0
- package/node/components/ActionCellBase/styles.js +11 -0
- package/node/components/ActionCellBase/types.d.ts +25 -0
- package/node/components/ActionGroup/MainActions/ActionNode/ActionNode.d.ts +9 -0
- package/node/components/ActionGroup/MainActions/ActionNode/ActionNode.js +34 -0
- package/node/components/ActionGroup/MainActions/ActionNode/index.d.ts +1 -0
- package/node/components/ActionGroup/MainActions/ActionNode/index.js +17 -0
- package/node/components/ActionGroup/MainActions/MainActions.d.ts +1 -1
- package/node/components/ActionGroup/MainActions/MainActions.js +3 -14
- package/node/components/ActionGroup/MainActions/hooks/useMainActions/useMainActions.d.ts +352 -3
- package/node/components/ActionGroup/MainActions/hooks/useMainActions/useMainActions.js +33 -6
- package/node/components/ActionGroup/MainActions/index.d.ts +1 -0
- package/node/components/ActionGroup/MainActions/index.js +1 -0
- package/node/components/ActionGroup/MainActions/styles.d.ts +5 -6
- package/node/components/ActionGroup/MainActions/styles.js +7 -8
- package/node/components/ActionGroup/SecondaryVisibleActions/ActionNode/ActionNode.d.ts +12 -0
- package/node/components/ActionGroup/SecondaryVisibleActions/ActionNode/ActionNode.js +34 -0
- package/node/components/ActionGroup/SecondaryVisibleActions/ActionNode/index.d.ts +1 -0
- package/node/components/ActionGroup/SecondaryVisibleActions/ActionNode/index.js +17 -0
- package/node/components/ActionGroup/SecondaryVisibleActions/SecondaryVisibleActions.d.ts +1 -1
- package/node/components/ActionGroup/SecondaryVisibleActions/SecondaryVisibleActions.js +3 -7
- package/node/components/ActionGroup/constants.d.ts +3 -0
- package/node/components/ActionGroup/constants.js +7 -0
- package/node/components/ActionGroup/index.d.ts +2 -1
- package/node/components/ActionGroup/index.js +3 -1
- package/node/components/ActionGroup/public.d.ts +2 -1
- package/node/components/ActionGroup/public.js +3 -1
- package/node/components/ActionGroup/styles.js +5 -0
- package/node/components/ActionGroup/types.d.ts +48 -6
- package/node/components/InfiniteTreeList/InfiniteTreeList.js +16 -2
- package/node/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContext.d.ts +4 -0
- package/node/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContext.js +1 -0
- package/node/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContextProvider/InfiniteTreeListContextProvider.d.ts +2 -2
- package/node/components/InfiniteTreeList/InfiniteTreeListContext/InfiniteTreeListContextProvider/InfiniteTreeListContextProvider.js +3 -1
- package/node/components/InfiniteTreeList/InfiniteTreeListItem/ErrorPlaceholder/styles.js +8 -0
- package/node/components/InfiniteTreeList/InfiniteTreeListItem/InfiniteTreeListItem.js +6 -3
- package/node/components/InfiniteTreeList/InfiniteTreeListItem/constants.d.ts +2 -0
- package/node/components/InfiniteTreeList/InfiniteTreeListItem/constants.js +2 -0
- package/node/components/InfiniteTreeList/InfiniteTreeListItem/index.d.ts +1 -0
- package/node/components/InfiniteTreeList/InfiniteTreeListItem/index.js +3 -0
- package/node/components/InfiniteTreeList/InfiniteTreeListItem/styles.d.ts +14 -0
- package/node/components/InfiniteTreeList/InfiniteTreeListItem/styles.js +67 -3
- package/node/components/InfiniteTreeList/LevelHeader/LevelHeader.d.ts +5 -0
- package/node/components/InfiniteTreeList/LevelHeader/LevelHeader.js +21 -0
- package/node/components/InfiniteTreeList/LevelHeader/constants.d.ts +3 -0
- package/node/components/InfiniteTreeList/LevelHeader/constants.js +6 -0
- package/node/components/InfiniteTreeList/LevelHeader/index.d.ts +2 -0
- package/node/components/InfiniteTreeList/LevelHeader/index.js +18 -0
- package/node/components/InfiniteTreeList/LevelHeader/styles.d.ts +365 -0
- package/node/components/InfiniteTreeList/LevelHeader/styles.js +54 -0
- package/node/components/InfiniteTreeList/LevelHeader/types.d.ts +14 -0
- package/node/components/InfiniteTreeList/LevelHeader/types.js +2 -0
- package/node/components/InfiniteTreeList/ListFooter/styles.js +8 -0
- package/node/components/InfiniteTreeList/OnTopButton/styles.js +7 -0
- package/node/components/InfiniteTreeList/ParentItems/Item/Item.js +10 -2
- package/node/components/InfiniteTreeList/ParentItems/Item/useLogic/useLogic.d.ts +1 -0
- package/node/components/InfiniteTreeList/ParentItems/Item/useLogic/useLogic.js +10 -2
- package/node/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/NoDataRow.js +2 -2
- package/node/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/styles.d.ts +3 -0
- package/node/components/InfiniteTreeList/TreeItem/ChildrenPlaceholder/NoDataRow/styles.js +14 -0
- package/node/components/InfiniteTreeList/TreeItem/TreeItem.js +6 -3
- package/node/components/InfiniteTreeList/TreeItem/styles.js +19 -0
- package/node/components/InfiniteTreeList/TreeItem/useLogic/useLogic.d.ts +2 -1
- package/node/components/InfiniteTreeList/TreeItem/useLogic/useLogic.js +4 -3
- package/node/components/InfiniteTreeList/constants.d.ts +21 -0
- package/node/components/InfiniteTreeList/constants.js +22 -1
- package/node/components/InfiniteTreeList/hooks/index.d.ts +2 -0
- package/node/components/InfiniteTreeList/hooks/index.js +2 -0
- package/node/components/InfiniteTreeList/hooks/useLevelNavigation/index.d.ts +2 -0
- package/node/components/InfiniteTreeList/hooks/useLevelNavigation/index.js +18 -0
- package/node/components/InfiniteTreeList/hooks/useLevelNavigation/types.d.ts +15 -0
- package/node/components/InfiniteTreeList/hooks/useLevelNavigation/types.js +2 -0
- package/node/components/InfiniteTreeList/hooks/useLevelNavigation/useLevelNavigation.d.ts +15 -0
- package/node/components/InfiniteTreeList/hooks/useLevelNavigation/useLevelNavigation.js +52 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/index.d.ts +3 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/index.js +19 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/index.d.ts +2 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/index.js +18 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.d.ts +16 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.js +2 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.d.ts +12 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.js +46 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.d.ts +2 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.js +18 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.d.ts +12 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.js +2 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/useScrollToTopButton.d.ts +15 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/useScrollToTopButton.js +31 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/index.d.ts +2 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/index.js +18 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/types.d.ts +11 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/types.js +2 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.d.ts +12 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.js +43 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/types.d.ts +14 -2
- package/node/components/InfiniteTreeList/hooks/useListScroll/useListScroll.d.ts +9 -6
- package/node/components/InfiniteTreeList/hooks/useListScroll/useListScroll.js +190 -26
- package/node/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/getOffsetTop.d.ts +4 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/getOffsetTop.js +10 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/index.d.ts +1 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/utils/getOffsetTop/index.js +17 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/utils/index.d.ts +1 -0
- package/node/components/InfiniteTreeList/hooks/useListScroll/utils/index.js +17 -0
- package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/index.d.ts +2 -0
- package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/index.js +18 -0
- package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/types.d.ts +14 -0
- package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/types.js +2 -0
- package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/useNodeTitleValidation.d.ts +5 -0
- package/node/components/InfiniteTreeList/hooks/useNodeTitleValidation/useNodeTitleValidation.js +22 -0
- package/node/components/InfiniteTreeList/styles.d.ts +5 -0
- package/node/components/InfiniteTreeList/styles.js +44 -0
- package/node/components/InfiniteTreeList/types.d.ts +4 -0
- package/node/components/InfiniteTreeList/useLogic/useLogic.d.ts +13 -5
- package/node/components/InfiniteTreeList/useLogic/useLogic.js +162 -24
- package/node/components/InfiniteTreeList/utils/checkHasFooterContent/checkHasFooterContent.d.ts +5 -0
- package/node/components/InfiniteTreeList/utils/checkHasFooterContent/checkHasFooterContent.js +8 -0
- package/node/components/InfiniteTreeList/utils/checkHasFooterContent/index.d.ts +1 -0
- package/node/components/InfiniteTreeList/utils/checkHasFooterContent/index.js +17 -0
- package/node/components/InfiniteTreeList/utils/checkHasNested/checkHasNested.d.ts +6 -0
- package/node/components/InfiniteTreeList/utils/checkHasNested/checkHasNested.js +9 -0
- package/node/components/InfiniteTreeList/utils/checkHasNested/index.d.ts +1 -0
- package/node/components/InfiniteTreeList/utils/checkHasNested/index.js +17 -0
- package/node/components/InfiniteTreeList/utils/createTailRegistry/createTailRegistry.d.ts +8 -3
- package/node/components/InfiniteTreeList/utils/createTailRegistry/createTailRegistry.js +30 -12
- package/node/components/InfiniteTreeList/utils/flattenTree/flattenTree.js +2 -1
- package/node/components/InfiniteTreeList/utils/getLevelKey/getLevelKey.d.ts +4 -0
- package/node/components/InfiniteTreeList/utils/getLevelKey/getLevelKey.js +9 -0
- package/node/components/InfiniteTreeList/utils/getLevelKey/index.d.ts +1 -0
- package/node/components/InfiniteTreeList/utils/getLevelKey/index.js +17 -0
- package/node/components/InfiniteTreeList/utils/index.d.ts +3 -0
- package/node/components/InfiniteTreeList/utils/index.js +3 -0
- package/node/components/PageHeader/MobilePageActions/MobilePageActions.js +2 -2
- package/node/components/PageHeader/MobilePageActions/useLogic/useLogic.d.ts +1 -0
- package/node/components/PageHeader/MobilePageActions/useLogic/useLogic.js +3 -0
- package/node/components/PageHeader/PageActions/MainActions/MainActions.d.ts +1 -1
- package/node/components/PageHeader/PageActions/MainActions/MainActions.js +2 -2
- package/node/components/PageHeader/PageActions/MainActions/styles.js +5 -0
- package/node/components/PageHeader/PageActions/PageActions.js +2 -2
- package/node/components/PageHeader/PageActions/SecondaryVisibleActions/SecondaryVisibleActions.d.ts +1 -1
- package/node/components/PageHeader/PageActions/SecondaryVisibleActions/SecondaryVisibleActions.js +3 -3
- package/node/components/PageHeader/PageActions/SecondaryVisibleActions/styles.d.ts +7 -1
- package/node/components/PageHeader/PageActions/useLogic/useLogic.d.ts +1 -0
- package/node/components/PageHeader/PageActions/useLogic/useLogic.js +3 -0
- package/node/components/index.d.ts +1 -1
- package/node/components/useScrollManagement/useScrollManagement.js +6 -5
- package/package.json +1 -1
|
@@ -1,24 +1,38 @@
|
|
|
1
|
-
import { useCallback, useRef } from 'react';
|
|
1
|
+
import { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
|
|
2
2
|
import { useScrollManagement } from '../../../useScrollManagement';
|
|
3
|
-
import { infiniteTreeListClassnames, OVERSCAN, VIRTUOSO_CONTAINER_ID, } from '../../constants';
|
|
4
|
-
import {
|
|
3
|
+
import { infiniteTreeListClassnames, LEVEL_TRANSITION_TIMEOUT_MS, OVERSCAN, VIRTUOSO_CONTAINER_ID, } from '../../constants';
|
|
4
|
+
import { useLevelSnapshots, useScrollToTopButton, useTailWatcher, } from './hooks';
|
|
5
|
+
import { getOffsetTop } from './utils';
|
|
5
6
|
/**
|
|
6
|
-
* Скролл-обвязка списка: props для `Virtuoso`,
|
|
7
|
-
*
|
|
8
|
-
* смене видимого диапазона проверяет, попал ли хвост в кадр
|
|
7
|
+
* Скролл-обвязка списка: props для `Virtuoso`, переход между уровнями
|
|
8
|
+
* и сборка кнопки «наверх», реестра хвостов и памяти уровней
|
|
9
9
|
*/
|
|
10
|
-
export const useListScroll = ({ scrollRef, isEndReached, onLoadMore,
|
|
10
|
+
export const useListScroll = ({ scrollRef, isEndReached, onLoadMore, displayedList, enterAnimation, isRootLevel, levelKey, activeLevelKeys, }) => {
|
|
11
11
|
const virtuosoRef = useRef(null);
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
12
|
+
const listRef = useRef(null);
|
|
13
|
+
const pendingLevelRef = useRef(null);
|
|
14
|
+
const pinnedHeightRef = useRef(null);
|
|
15
|
+
const heldHeightRef = useRef(null);
|
|
16
|
+
const { tailRegistry, trackRange } = useTailWatcher({
|
|
17
|
+
displayedList,
|
|
18
|
+
levelKey,
|
|
19
|
+
});
|
|
20
|
+
const { updateVisibility: updateTopButtonVisibility, onTopButtonProps } = useScrollToTopButton({ scrollRef, virtuosoRef });
|
|
21
|
+
const { rememberLevel, forgetLevel, getLevelPosition, levelState } = useLevelSnapshots({ levelKey, activeLevelKeys, virtuosoRef });
|
|
22
|
+
const isRootLevelRef = useRef(isRootLevel);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
isRootLevelRef.current = isRootLevel;
|
|
25
|
+
}, [isRootLevel]);
|
|
26
|
+
const handleListLoadMore = useCallback(() => {
|
|
27
|
+
if (!isRootLevelRef.current) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
onLoadMore?.();
|
|
31
|
+
}, [onLoadMore]);
|
|
18
32
|
const { scrollParent, recalculateVerticalScroll, handleEndReach, isEndReachedWithScroll, } = useScrollManagement({
|
|
19
33
|
scrollRef,
|
|
20
34
|
isEndReached,
|
|
21
|
-
onLoadMore,
|
|
35
|
+
onLoadMore: handleListLoadMore,
|
|
22
36
|
virtuosoId: VIRTUOSO_CONTAINER_ID,
|
|
23
37
|
});
|
|
24
38
|
// Скролл виртуализации монтирует строки, которые появлением не считаются
|
|
@@ -28,32 +42,182 @@ export const useListScroll = ({ scrollRef, isEndReached, onLoadMore, flatListRef
|
|
|
28
42
|
}
|
|
29
43
|
}, [enterAnimation]);
|
|
30
44
|
const handleRangeChanged = useCallback((range) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, [
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
updateTopButtonVisibility(range);
|
|
46
|
+
trackRange(range);
|
|
47
|
+
}, [updateTopButtonVisibility, trackRange]);
|
|
48
|
+
const getListTop = useCallback(() => {
|
|
49
|
+
const listElement = listRef.current;
|
|
50
|
+
if (!scrollParent || !listElement) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return Math.max(getOffsetTop(listElement, scrollParent), 0);
|
|
54
|
+
}, [scrollParent]);
|
|
55
|
+
const saveLevelSnapshot = useCallback(() => {
|
|
56
|
+
const listTop = getListTop();
|
|
57
|
+
if (!scrollParent || listTop === null) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
rememberLevel(scrollParent.scrollTop - listTop);
|
|
61
|
+
// Высота уходящего уровня держит список, пока новый не доехал
|
|
62
|
+
heldHeightRef.current = listRef.current?.offsetHeight ?? null;
|
|
63
|
+
}, [scrollParent, getListTop, rememberLevel]);
|
|
64
|
+
// Заданная высота снимается, когда строки уровня доехали и держат позицию сами
|
|
65
|
+
const releaseListHeight = useCallback(() => {
|
|
66
|
+
const listElement = listRef.current;
|
|
67
|
+
const pinnedHeight = pinnedHeightRef.current;
|
|
68
|
+
if (!scrollParent || !listElement || pinnedHeight === null) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const keptScrollTop = scrollParent.scrollTop;
|
|
72
|
+
pinnedHeightRef.current = null;
|
|
73
|
+
listElement.style.removeProperty('min-height');
|
|
74
|
+
if (scrollParent.scrollTop < keptScrollTop) {
|
|
75
|
+
pinnedHeightRef.current = pinnedHeight;
|
|
76
|
+
listElement.style.minHeight = `${pinnedHeight}px`;
|
|
77
|
+
scrollParent.scrollTop = keptScrollTop;
|
|
78
|
+
}
|
|
79
|
+
}, [scrollParent]);
|
|
80
|
+
const applyLevelPosition = useCallback(() => {
|
|
81
|
+
const pendingLevel = pendingLevelRef.current;
|
|
82
|
+
const listElement = listRef.current;
|
|
83
|
+
const listTop = getListTop();
|
|
84
|
+
if (!pendingLevel || !scrollParent || !listElement || listTop === null) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const offset = getLevelPosition(pendingLevel);
|
|
88
|
+
if (offset === undefined) {
|
|
89
|
+
pendingLevelRef.current = null;
|
|
90
|
+
scrollParent.scrollTop = Math.min(scrollParent.scrollTop, listTop);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const target = Math.max(listTop + offset, 0);
|
|
94
|
+
// Строки уровня попадают в список на кадр позже, чем меняется сам уровень.
|
|
95
|
+
// Пока их нет, страница короткая, и до сохранённой позиции скролл просто
|
|
96
|
+
// не достаёт
|
|
97
|
+
if (target > scrollParent.scrollHeight - scrollParent.clientHeight) {
|
|
98
|
+
const pinnedHeight = Math.max(offset + scrollParent.clientHeight, pinnedHeightRef.current ?? 0);
|
|
99
|
+
pinnedHeightRef.current = pinnedHeight;
|
|
100
|
+
listElement.style.minHeight = `${pinnedHeight}px`;
|
|
101
|
+
}
|
|
102
|
+
scrollParent.scrollTop = target;
|
|
103
|
+
if (scrollParent.scrollTop < target) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
pendingLevelRef.current = null;
|
|
107
|
+
}, [scrollParent, getListTop, getLevelPosition]);
|
|
108
|
+
const heightObserverRef = useRef(null);
|
|
109
|
+
const transitionTimerRef = useRef(null);
|
|
110
|
+
const stopWatchingLevelContent = useCallback(() => {
|
|
111
|
+
heightObserverRef.current?.disconnect();
|
|
112
|
+
heightObserverRef.current = null;
|
|
113
|
+
}, []);
|
|
114
|
+
// Переход открывает список и возвращает контейнеру `scroll-behavior: smooth`
|
|
115
|
+
const finishLevelTransition = useCallback(() => {
|
|
116
|
+
if (transitionTimerRef.current !== null) {
|
|
117
|
+
clearTimeout(transitionTimerRef.current);
|
|
118
|
+
transitionTimerRef.current = null;
|
|
119
|
+
}
|
|
120
|
+
listRef.current?.classList.remove(infiniteTreeListClassnames.levelTransition);
|
|
121
|
+
scrollParent?.style.removeProperty('scroll-behavior');
|
|
122
|
+
}, [scrollParent]);
|
|
123
|
+
const settleLevelTransition = useCallback(() => {
|
|
124
|
+
applyLevelPosition();
|
|
125
|
+
releaseListHeight();
|
|
126
|
+
if (pendingLevelRef.current || pinnedHeightRef.current !== null) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
stopWatchingLevelContent();
|
|
130
|
+
finishLevelTransition();
|
|
131
|
+
}, [
|
|
132
|
+
applyLevelPosition,
|
|
133
|
+
releaseListHeight,
|
|
134
|
+
stopWatchingLevelContent,
|
|
135
|
+
finishLevelTransition,
|
|
136
|
+
]);
|
|
137
|
+
const forceLevelTransitionEnd = useCallback(() => {
|
|
138
|
+
applyLevelPosition();
|
|
139
|
+
releaseListHeight();
|
|
140
|
+
stopWatchingLevelContent();
|
|
141
|
+
finishLevelTransition();
|
|
142
|
+
}, [
|
|
143
|
+
applyLevelPosition,
|
|
144
|
+
releaseListHeight,
|
|
145
|
+
stopWatchingLevelContent,
|
|
146
|
+
finishLevelTransition,
|
|
147
|
+
]);
|
|
148
|
+
const startLevelTransition = useCallback(() => {
|
|
149
|
+
const listElement = listRef.current;
|
|
150
|
+
finishLevelTransition();
|
|
151
|
+
listElement?.classList.add(infiniteTreeListClassnames.levelTransition);
|
|
152
|
+
scrollParent?.style.setProperty('scroll-behavior', 'auto');
|
|
153
|
+
const heldHeight = heldHeightRef.current;
|
|
154
|
+
if (listElement && heldHeight !== null) {
|
|
155
|
+
pinnedHeightRef.current = heldHeight;
|
|
156
|
+
listElement.style.minHeight = `${heldHeight}px`;
|
|
157
|
+
}
|
|
158
|
+
transitionTimerRef.current = setTimeout(forceLevelTransitionEnd, LEVEL_TRANSITION_TIMEOUT_MS);
|
|
159
|
+
}, [finishLevelTransition, forceLevelTransitionEnd, scrollParent]);
|
|
160
|
+
const watchLevelContent = useCallback(() => {
|
|
161
|
+
if (heightObserverRef.current) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const contentElement = listRef.current?.querySelector(`#${VIRTUOSO_CONTAINER_ID}`);
|
|
165
|
+
if (!contentElement) {
|
|
166
|
+
settleLevelTransition();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
170
|
+
// Первый замер приходит сразу за `observe`, когда список ещё пуст:
|
|
171
|
+
// снятый по нему переход показал бы обёртку без строк
|
|
172
|
+
if (!entry || entry.contentRect.height === 0) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
settleLevelTransition();
|
|
176
|
+
});
|
|
177
|
+
observer.observe(contentElement);
|
|
178
|
+
heightObserverRef.current = observer;
|
|
179
|
+
}, [settleLevelTransition]);
|
|
180
|
+
useEffect(() => () => {
|
|
181
|
+
stopWatchingLevelContent();
|
|
182
|
+
finishLevelTransition();
|
|
183
|
+
}, [stopWatchingLevelContent, finishLevelTransition]);
|
|
184
|
+
const shownLevelRef = useRef(levelKey);
|
|
185
|
+
// Позиция выставляется до отрисовки кадра: из обычного эффекта уровень успел
|
|
186
|
+
// бы показаться с чужой позиции, и переход читался бы как прокрутка
|
|
187
|
+
useLayoutEffect(() => {
|
|
188
|
+
if (shownLevelRef.current === levelKey) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
shownLevelRef.current = levelKey;
|
|
192
|
+
pendingLevelRef.current = levelKey;
|
|
193
|
+
// Высота, заданная прошлому переходу, к новому уровню не относится
|
|
194
|
+
pinnedHeightRef.current = null;
|
|
195
|
+
listRef.current?.style.removeProperty('min-height');
|
|
196
|
+
startLevelTransition();
|
|
197
|
+
applyLevelPosition();
|
|
198
|
+
watchLevelContent();
|
|
199
|
+
}, [levelKey, applyLevelPosition, watchLevelContent, startLevelTransition]);
|
|
40
200
|
return {
|
|
41
201
|
scrollParent,
|
|
202
|
+
listRef,
|
|
42
203
|
tailRegistry,
|
|
43
204
|
isEndReachedWithScroll,
|
|
205
|
+
saveLevelSnapshot,
|
|
206
|
+
dropLevelSnapshot: forgetLevel,
|
|
44
207
|
virtuosoProps: {
|
|
45
208
|
id: VIRTUOSO_CONTAINER_ID,
|
|
46
209
|
ref: virtuosoRef,
|
|
47
210
|
overscan: OVERSCAN,
|
|
211
|
+
restoreStateFrom: levelState,
|
|
212
|
+
// Из снимка нужны только высоты строк: позицию уровня список выставляет
|
|
213
|
+
// сам. Иначе `Virtuoso` уводит скролл в начало и возвращается к
|
|
214
|
+
// сохранённому месту собственной прокруткой
|
|
215
|
+
initialTopMostItemIndex: 0,
|
|
48
216
|
rangeChanged: handleRangeChanged,
|
|
49
217
|
endReached: handleEndReach,
|
|
50
218
|
totalListHeightChanged: recalculateVerticalScroll,
|
|
51
219
|
isScrolling: handleScrollingChange,
|
|
52
220
|
},
|
|
53
|
-
onTopButtonProps
|
|
54
|
-
buttonRef: scrollToTopButtonRef,
|
|
55
|
-
handleScrollToTop,
|
|
56
|
-
scrollRef,
|
|
57
|
-
},
|
|
221
|
+
onTopButtonProps,
|
|
58
222
|
};
|
|
59
223
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getOffsetTop';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getOffsetTop';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getOffsetTop';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getOffsetTop';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type UseNodeTitleValidationParams = {
|
|
2
|
+
/**
|
|
3
|
+
* Флаг мобильного отображения
|
|
4
|
+
*/
|
|
5
|
+
isMobile: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Id узла, чей уровень отображается
|
|
8
|
+
*/
|
|
9
|
+
currentNodeId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Заголовок отображаемого узла из его данных
|
|
12
|
+
*/
|
|
13
|
+
title?: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Проверяет, что у узла, содержимое которого отображается, задан `title`
|
|
4
|
+
*/
|
|
5
|
+
export const useNodeTitleValidation = ({ isMobile, currentNodeId, title, }) => {
|
|
6
|
+
const warnedNodeIdsRef = useRef(new Set());
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (!isMobile || !currentNodeId) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (title || warnedNodeIdsRef.current.has(currentNodeId)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
warnedNodeIdsRef.current.add(currentNodeId);
|
|
15
|
+
// biome-ignore lint/suspicious/noConsole: Предупреждение для интеграторов
|
|
16
|
+
console.warn(`InfiniteTreeList: у узла "${currentNodeId}" не задан параметр title`);
|
|
17
|
+
}, [isMobile, currentNodeId, title]);
|
|
18
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const InfiniteTreeListWrapper: import("../styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { styled } from '../styled';
|
|
2
|
+
import { infiniteTreeListClassnames, VIRTUOSO_CONTAINER_ID } from './constants';
|
|
3
|
+
export const InfiniteTreeListWrapper = styled.div `
|
|
4
|
+
/* Убираем якорь на android устройствах */
|
|
5
|
+
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
6
|
+
overflow-anchor: none;
|
|
7
|
+
|
|
8
|
+
${({ theme }) => theme.breakpoints.up('mobile')} {
|
|
9
|
+
&.${infiniteTreeListClassnames.loading},
|
|
10
|
+
&.${infiniteTreeListClassnames.error},
|
|
11
|
+
&.${infiniteTreeListClassnames.noData} {
|
|
12
|
+
height: 100%;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
|
|
19
|
+
height: auto;
|
|
20
|
+
margin: ${({ theme }) => theme.spacing(0, 4, 4)};
|
|
21
|
+
|
|
22
|
+
background-color: ${({ theme }) => theme.palette.background.default};
|
|
23
|
+
border: 1px solid ${({ theme }) => theme.palette.components.border.default};
|
|
24
|
+
border-radius: ${({ theme }) => theme.shape.medium};
|
|
25
|
+
|
|
26
|
+
&.${infiniteTreeListClassnames.loading},
|
|
27
|
+
&.${infiniteTreeListClassnames.error},
|
|
28
|
+
&.${infiniteTreeListClassnames.noData} {
|
|
29
|
+
height: ${({ theme }) => `calc(100% - ${theme.spacing(4)})`};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Смена уровня пересоздаёт список: строки нового уровня встают на место
|
|
33
|
+
не в том же кадре, поэтому до их появления виден фон обёртки.
|
|
34
|
+
Высоту на это время держит min-height от самого списка */
|
|
35
|
+
&.${infiniteTreeListClassnames.levelTransition} {
|
|
36
|
+
#${VIRTUOSO_CONTAINER_ID} {
|
|
37
|
+
visibility: hidden;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
@@ -11,6 +11,10 @@ export type InfiniteTreeListDataBase = {
|
|
|
11
11
|
* Статическое дерево описывается полем `children` и флага не требует
|
|
12
12
|
*/
|
|
13
13
|
hasChildren?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Заголовок узла в шапке уровня на мобильной ширине.
|
|
16
|
+
*/
|
|
17
|
+
title?: string;
|
|
14
18
|
/**
|
|
15
19
|
* Дополнительные поля
|
|
16
20
|
*/
|
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type ContentStateProps } from '../../ContentState';
|
|
3
|
+
import type { LevelHeaderProps } from '../LevelHeader';
|
|
3
4
|
import type { ListFooterContext } from '../ListFooter';
|
|
4
|
-
import type { InfiniteTreeListData, InfiniteTreeListProps } from '../types';
|
|
5
|
+
import type { FlattenTree, InfiniteTreeListData, InfiniteTreeListProps } from '../types';
|
|
5
6
|
type UseLogicParams<TData extends InfiniteTreeListData<TData>> = InfiniteTreeListProps<TData>;
|
|
6
7
|
/**
|
|
7
8
|
* Логика списка: сводит плоский список, данные дочерних элементов, скролл
|
|
8
9
|
* и анимацию появления строк в props для `Virtuoso` и дочерних компонентов
|
|
9
10
|
*/
|
|
10
11
|
export declare const useLogic: <TData extends InfiniteTreeListData<TData>>({ initialExpandedLevel, items, onRetry, errorMsg, isError, isLoading, scrollRef, isEndReached, onLoadMore, renderItem, renderParent, itemSkeleton, endOfScrollMsg, noDataImgSrc, errorImgSrc, }: UseLogicParams<TData>) => {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
displayedList: FlattenTree<TData>[];
|
|
13
|
+
levelKey: string;
|
|
14
|
+
lastRowId: string | undefined;
|
|
15
|
+
levelHeaderProps: LevelHeaderProps | undefined;
|
|
16
|
+
onToggle: (item: InfiniteTreeListData) => void;
|
|
13
17
|
nodePaginationMap: Record<string, import("../InfiniteTreeListContext").NodePagination>;
|
|
14
18
|
registerChildren: (itemId: string, childrenState: import("../types").InfiniteTreeChildrenPagination) => void;
|
|
15
19
|
notifyExpand: (itemId: string, onOpen?: (() => void) | undefined) => void;
|
|
16
|
-
parentItems:
|
|
20
|
+
parentItems: FlattenTree<TData>[];
|
|
17
21
|
acquireParentSlot: (itemId: string) => HTMLDivElement | null;
|
|
18
22
|
contentStateProps: Omit<ContentStateProps, "children">;
|
|
23
|
+
isNoData: boolean;
|
|
24
|
+
state: "error" | "loading" | "noData" | undefined;
|
|
19
25
|
scrollParent: HTMLElement | null;
|
|
26
|
+
listRef: import("react").RefObject<HTMLDivElement | null>;
|
|
20
27
|
virtuosoProps: {
|
|
21
28
|
id: string;
|
|
22
29
|
ref: import("react").RefObject<import("react-virtuoso").VirtuosoHandle | null>;
|
|
23
30
|
overscan: number;
|
|
31
|
+
restoreStateFrom: import("react-virtuoso").StateSnapshot | undefined;
|
|
32
|
+
initialTopMostItemIndex: number;
|
|
24
33
|
rangeChanged: (range: import("react-virtuoso").ListRange) => void;
|
|
25
34
|
endReached: () => void;
|
|
26
35
|
totalListHeightChanged: () => void;
|
|
@@ -39,7 +48,6 @@ export declare const useLogic: <TData extends InfiniteTreeListData<TData>>({ ini
|
|
|
39
48
|
renderParent: (item: TData & {
|
|
40
49
|
meta: import("../types").InfiniteTreeItemMeta;
|
|
41
50
|
}) => import("react").ReactNode;
|
|
42
|
-
items: TData[];
|
|
43
51
|
onRetry: () => void;
|
|
44
52
|
noDataImgSrc: string | undefined;
|
|
45
53
|
enterAnimation: import("../hooks").EnterAnimationResult;
|