@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
|
@@ -17,7 +17,7 @@ export declare const useLogic: ({ item, context, ...itemProps }: UseLogicParams)
|
|
|
17
17
|
item: import("../../types").FlattenTree<import("../../types").InfiniteTreeListData>;
|
|
18
18
|
renderItem: (item: import("../../types").FlattenTree<import("../../types").InfiniteTreeListData>) => import("react").ReactNode;
|
|
19
19
|
onToggle: (item: import("../../types").InfiniteTreeListData) => void;
|
|
20
|
-
|
|
20
|
+
itemProps: {
|
|
21
21
|
style?: CSSProperties | undefined;
|
|
22
22
|
'data-index': number;
|
|
23
23
|
'data-item-group-index'?: number | undefined;
|
|
@@ -27,5 +27,6 @@ export declare const useLogic: ({ item, context, ...itemProps }: UseLogicParams)
|
|
|
27
27
|
cssVars: CSSProperties;
|
|
28
28
|
isSpinner: boolean;
|
|
29
29
|
hasAddAnimation: boolean;
|
|
30
|
+
isLastRow: boolean;
|
|
30
31
|
};
|
|
31
32
|
export {};
|
|
@@ -17,8 +17,7 @@ const InfiniteTreeListContext_1 = require("../../InfiniteTreeListContext");
|
|
|
17
17
|
* этого нет
|
|
18
18
|
*/
|
|
19
19
|
const useLogic = ({ item, context, ...itemProps }) => {
|
|
20
|
-
const { renderItem, onToggle, nodePaginationMap, onLoadMore, enterAnimation, tailRegistry, } = (0, react_1.useContext)(InfiniteTreeListContext_1.InfiniteTreeListContext);
|
|
21
|
-
const memoizedItemProps = (0, react_1.useMemo)(() => itemProps, [itemProps.style]);
|
|
20
|
+
const { renderItem, onToggle, nodePaginationMap, onLoadMore, enterAnimation, tailRegistry, lastRowId, } = (0, react_1.useContext)(InfiniteTreeListContext_1.InfiniteTreeListContext);
|
|
22
21
|
const { parentId, siblingIndex, level } = item.meta;
|
|
23
22
|
const parentPagination = parentId ? nodePaginationMap[parentId] : undefined;
|
|
24
23
|
const isLastChild = parentPagination?.lastChildId === item.id;
|
|
@@ -51,6 +50,7 @@ const useLogic = ({ item, context, ...itemProps }) => {
|
|
|
51
50
|
};
|
|
52
51
|
}, [shouldRegister, parentId, item.id, tailRegistry, onLoadMore]);
|
|
53
52
|
const isSpinner = item.placeholderKind === 'spinner';
|
|
53
|
+
const isLastRow = item.id === lastRowId;
|
|
54
54
|
// Уровень вложенности и индекс каскада — динамические значения, поэтому
|
|
55
55
|
// передаются в стили через css vars, а не через styled props
|
|
56
56
|
const cssVars = {
|
|
@@ -61,10 +61,11 @@ const useLogic = ({ item, context, ...itemProps }) => {
|
|
|
61
61
|
item,
|
|
62
62
|
renderItem,
|
|
63
63
|
onToggle,
|
|
64
|
-
|
|
64
|
+
itemProps,
|
|
65
65
|
cssVars,
|
|
66
66
|
isSpinner,
|
|
67
67
|
hasAddAnimation: !isSpinner && shouldAnimate,
|
|
68
|
+
isLastRow,
|
|
68
69
|
};
|
|
69
70
|
};
|
|
70
71
|
exports.useLogic = useLogic;
|
|
@@ -6,13 +6,34 @@ export declare const OVERSCAN = 30;
|
|
|
6
6
|
* data, поэтому `useLayoutEffect` снимает метку слишком рано
|
|
7
7
|
*/
|
|
8
8
|
export declare const ENTER_ANIMATION_MOUNT_WINDOW_MS = 100;
|
|
9
|
+
/**
|
|
10
|
+
* Предел, после которого переход между уровнями открывает список принудительно.
|
|
11
|
+
*/
|
|
12
|
+
export declare const LEVEL_TRANSITION_TIMEOUT_MS = 200;
|
|
9
13
|
export declare const CHILDREN_SKELETON_COUNT = 3;
|
|
10
14
|
export declare const CHILDREN_NO_DATA_MSG = "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445";
|
|
15
|
+
/**
|
|
16
|
+
* Ключ корневого уровня в снимках позиции скролла: у корня нет id узла
|
|
17
|
+
*/
|
|
18
|
+
export declare const ROOT_LEVEL_KEY = "root";
|
|
19
|
+
/**
|
|
20
|
+
* Префикс ключа уровня узла: отделяет id узлов от ключа корневого уровня
|
|
21
|
+
*/
|
|
22
|
+
export declare const NODE_LEVEL_KEY_PREFIX = "node:";
|
|
11
23
|
export declare const infiniteTreeListClassnames: {
|
|
24
|
+
root: string;
|
|
25
|
+
loading: string;
|
|
26
|
+
noData: string;
|
|
27
|
+
error: string;
|
|
28
|
+
levelHeader: string;
|
|
29
|
+
levelHeaderWithBackButton: string;
|
|
30
|
+
levelHeaderBackButton: string;
|
|
31
|
+
levelTransition: string;
|
|
12
32
|
row: string;
|
|
13
33
|
rowAddAnimation: string;
|
|
14
34
|
rowRemoveAnimation: string;
|
|
15
35
|
rowSpinner: string;
|
|
36
|
+
rowLast: string;
|
|
16
37
|
scrollToTopButton: string;
|
|
17
38
|
visibleScrollToTopButton: string;
|
|
18
39
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.infiniteTreeListClassnames = exports.CHILDREN_NO_DATA_MSG = exports.CHILDREN_SKELETON_COUNT = exports.ENTER_ANIMATION_MOUNT_WINDOW_MS = exports.OVERSCAN = exports.VIRTUOSO_CONTAINER_ID = void 0;
|
|
3
|
+
exports.infiniteTreeListClassnames = exports.NODE_LEVEL_KEY_PREFIX = exports.ROOT_LEVEL_KEY = exports.CHILDREN_NO_DATA_MSG = exports.CHILDREN_SKELETON_COUNT = exports.LEVEL_TRANSITION_TIMEOUT_MS = exports.ENTER_ANIMATION_MOUNT_WINDOW_MS = exports.OVERSCAN = exports.VIRTUOSO_CONTAINER_ID = void 0;
|
|
4
4
|
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
5
|
exports.VIRTUOSO_CONTAINER_ID = 'virtuoso-container';
|
|
6
6
|
exports.OVERSCAN = 30;
|
|
@@ -10,13 +10,34 @@ exports.OVERSCAN = 30;
|
|
|
10
10
|
* data, поэтому `useLayoutEffect` снимает метку слишком рано
|
|
11
11
|
*/
|
|
12
12
|
exports.ENTER_ANIMATION_MOUNT_WINDOW_MS = 100;
|
|
13
|
+
/**
|
|
14
|
+
* Предел, после которого переход между уровнями открывает список принудительно.
|
|
15
|
+
*/
|
|
16
|
+
exports.LEVEL_TRANSITION_TIMEOUT_MS = 200;
|
|
13
17
|
exports.CHILDREN_SKELETON_COUNT = 3;
|
|
14
18
|
exports.CHILDREN_NO_DATA_MSG = 'Нет данных';
|
|
19
|
+
/**
|
|
20
|
+
* Ключ корневого уровня в снимках позиции скролла: у корня нет id узла
|
|
21
|
+
*/
|
|
22
|
+
exports.ROOT_LEVEL_KEY = 'root';
|
|
23
|
+
/**
|
|
24
|
+
* Префикс ключа уровня узла: отделяет id узлов от ключа корневого уровня
|
|
25
|
+
*/
|
|
26
|
+
exports.NODE_LEVEL_KEY_PREFIX = 'node:';
|
|
15
27
|
exports.infiniteTreeListClassnames = {
|
|
28
|
+
root: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list'),
|
|
29
|
+
loading: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list_loading'),
|
|
30
|
+
noData: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list_no-data'),
|
|
31
|
+
error: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list_error'),
|
|
32
|
+
levelHeader: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list__level-header'),
|
|
33
|
+
levelHeaderWithBackButton: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list__level-header_with-back-button'),
|
|
34
|
+
levelHeaderBackButton: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list__level-header-back-button'),
|
|
35
|
+
levelTransition: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list_level-transition'),
|
|
16
36
|
row: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list__row'),
|
|
17
37
|
rowAddAnimation: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list__row_add-animation'),
|
|
18
38
|
rowRemoveAnimation: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list__row_remove-animation'),
|
|
19
39
|
rowSpinner: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list__row_spinner'),
|
|
40
|
+
rowLast: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list__row_last'),
|
|
20
41
|
scrollToTopButton: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list__scroll-to-top-button'),
|
|
21
42
|
visibleScrollToTopButton: (0, createUIKitClassname_1.createUIKitClassname)('infinite-tree-list__scroll-to-top-button_visible'),
|
|
22
43
|
};
|
|
@@ -18,4 +18,6 @@ __exportStar(require("./useChildrenState"), exports);
|
|
|
18
18
|
__exportStar(require("./useEnterAnimation"), exports);
|
|
19
19
|
__exportStar(require("./useExpandNotifier"), exports);
|
|
20
20
|
__exportStar(require("./useFlatTree"), exports);
|
|
21
|
+
__exportStar(require("./useLevelNavigation"), exports);
|
|
21
22
|
__exportStar(require("./useListScroll"), exports);
|
|
23
|
+
__exportStar(require("./useNodeTitleValidation"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./useLevelNavigation"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { InfiniteTreeListData } from '../../types';
|
|
2
|
+
export type UseLevelNavigationParams<TData extends InfiniteTreeListData<TData>> = {
|
|
3
|
+
/**
|
|
4
|
+
* Список элементов дерева: из него выводится базовый уровень
|
|
5
|
+
*/
|
|
6
|
+
items: TData[];
|
|
7
|
+
/**
|
|
8
|
+
* Флаг мобильного отображения
|
|
9
|
+
*/
|
|
10
|
+
isMobile: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Функция проверки узла в списке
|
|
13
|
+
*/
|
|
14
|
+
checkNodeExists: (nodeId: string) => boolean;
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { InfiniteTreeListData } from '../../types';
|
|
2
|
+
import type { UseLevelNavigationParams } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Уровень, который список отображает на мобильной ширине: id текущего узла
|
|
5
|
+
* и стек пройденных узлов.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useLevelNavigation: <TData extends InfiniteTreeListData<TData>>({ items, isMobile, checkNodeExists, }: UseLevelNavigationParams<TData>) => {
|
|
8
|
+
currentNodeId: string;
|
|
9
|
+
baseNodeId: string | undefined;
|
|
10
|
+
activeLevelKeys: string[];
|
|
11
|
+
hasUpperLevel: boolean;
|
|
12
|
+
isRootLevel: boolean;
|
|
13
|
+
enterNode: (itemId: string) => void;
|
|
14
|
+
leaveNode: () => void;
|
|
15
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLevelNavigation = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
/**
|
|
7
|
+
* Уровень, который список отображает на мобильной ширине: id текущего узла
|
|
8
|
+
* и стек пройденных узлов.
|
|
9
|
+
*/
|
|
10
|
+
const useLevelNavigation = ({ items, isMobile, checkNodeExists, }) => {
|
|
11
|
+
const [enteredIds, setEnteredIds] = (0, react_1.useState)([]);
|
|
12
|
+
const baseNodeId = (0, react_1.useMemo)(() => {
|
|
13
|
+
if (items.length !== 1) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const [rootItem] = items;
|
|
17
|
+
return (0, utils_1.checkHasNested)(rootItem) ? rootItem.id : undefined;
|
|
18
|
+
}, [items]);
|
|
19
|
+
// Смена ширины в обе стороны возвращает список на базовый уровень
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
setEnteredIds([]);
|
|
22
|
+
}, [isMobile]);
|
|
23
|
+
// Узел мог уйти из данных: показывать его уровень и всё, что ниже, нечем
|
|
24
|
+
(0, react_1.useEffect)(() => {
|
|
25
|
+
const lostIndex = enteredIds.findIndex((itemId) => !checkNodeExists(itemId));
|
|
26
|
+
if (lostIndex === -1) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setEnteredIds(enteredIds.slice(0, lostIndex));
|
|
30
|
+
}, [enteredIds, checkNodeExists]);
|
|
31
|
+
const enterNode = (0, react_1.useCallback)((itemId) => {
|
|
32
|
+
setEnteredIds((prev) => [...prev, itemId]);
|
|
33
|
+
}, []);
|
|
34
|
+
const leaveNode = (0, react_1.useCallback)(() => {
|
|
35
|
+
setEnteredIds((prev) => prev.slice(0, -1));
|
|
36
|
+
}, []);
|
|
37
|
+
// Уровни, до которых доберётся возврат
|
|
38
|
+
const activeLevelKeys = (0, react_1.useMemo)(() => [
|
|
39
|
+
(0, utils_1.getLevelKey)(isMobile ? baseNodeId : undefined),
|
|
40
|
+
...enteredIds.map((itemId) => (0, utils_1.getLevelKey)(itemId)),
|
|
41
|
+
], [isMobile, baseNodeId, enteredIds]);
|
|
42
|
+
return {
|
|
43
|
+
currentNodeId: enteredIds[enteredIds.length - 1] ?? baseNodeId,
|
|
44
|
+
baseNodeId,
|
|
45
|
+
activeLevelKeys,
|
|
46
|
+
hasUpperLevel: enteredIds.length > 0,
|
|
47
|
+
isRootLevel: !isMobile || (enteredIds.length === 0 && baseNodeId === undefined),
|
|
48
|
+
enterNode,
|
|
49
|
+
leaveNode,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
exports.useLevelNavigation = useLevelNavigation;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useLevelSnapshots"), exports);
|
|
18
|
+
__exportStar(require("./useScrollToTopButton"), exports);
|
|
19
|
+
__exportStar(require("./useTailWatcher"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./useLevelSnapshots"), exports);
|
package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/types.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { VirtuosoHandle } from 'react-virtuoso';
|
|
3
|
+
export type UseLevelSnapshotsParams = {
|
|
4
|
+
/**
|
|
5
|
+
* Ключ отображаемого уровня
|
|
6
|
+
*/
|
|
7
|
+
levelKey: string;
|
|
8
|
+
/**
|
|
9
|
+
* Ключи уровней, до которых доберётся возврат: снимки остальных не нужны
|
|
10
|
+
*/
|
|
11
|
+
activeLevelKeys: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Ref на список: с него снимаются измеренные высоты строк
|
|
14
|
+
*/
|
|
15
|
+
virtuosoRef: RefObject<VirtuosoHandle | null>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StateSnapshot } from 'react-virtuoso';
|
|
2
|
+
import type { UseLevelSnapshotsParams } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Память уровней: куда был прокручен уровень и какими он намерил свои строки.
|
|
5
|
+
* Снимки живут, пока до уровня может добраться возврат
|
|
6
|
+
*/
|
|
7
|
+
export declare const useLevelSnapshots: ({ levelKey, activeLevelKeys, virtuosoRef, }: UseLevelSnapshotsParams) => {
|
|
8
|
+
rememberLevel: (offset: number) => void;
|
|
9
|
+
forgetLevel: (targetLevelKey: string) => void;
|
|
10
|
+
getLevelPosition: (targetLevelKey: string) => number | undefined;
|
|
11
|
+
levelState: StateSnapshot | undefined;
|
|
12
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLevelSnapshots = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* Память уровней: куда был прокручен уровень и какими он намерил свои строки.
|
|
7
|
+
* Снимки живут, пока до уровня может добраться возврат
|
|
8
|
+
*/
|
|
9
|
+
const useLevelSnapshots = ({ levelKey, activeLevelKeys, virtuosoRef, }) => {
|
|
10
|
+
// Позиция уровня запоминается смещением скролла внутри списка
|
|
11
|
+
const levelPositionsRef = (0, react_1.useRef)(new Map());
|
|
12
|
+
// Кеш измеренных высот у `Virtuoso` привязан к индексу строки, а не к её id,
|
|
13
|
+
// поэтому уровни затирают замеры друг друга. Снимок уровня возвращает его
|
|
14
|
+
// собственные высоты: иначе после возврата список ниже настоящего, и каждая
|
|
15
|
+
// строка, домеренная при прокрутке вверх, толкает позицию обратно вниз
|
|
16
|
+
const levelStatesRef = (0, react_1.useRef)(new Map());
|
|
17
|
+
const rememberLevel = (0, react_1.useCallback)((offset) => {
|
|
18
|
+
levelPositionsRef.current.set(levelKey, offset);
|
|
19
|
+
virtuosoRef.current?.getState((state) => {
|
|
20
|
+
levelStatesRef.current.set(levelKey, state);
|
|
21
|
+
});
|
|
22
|
+
}, [levelKey, virtuosoRef]);
|
|
23
|
+
const forgetLevel = (0, react_1.useCallback)((targetLevelKey) => {
|
|
24
|
+
levelPositionsRef.current.delete(targetLevelKey);
|
|
25
|
+
levelStatesRef.current.delete(targetLevelKey);
|
|
26
|
+
}, []);
|
|
27
|
+
const getLevelPosition = (0, react_1.useCallback)((targetLevelKey) => levelPositionsRef.current.get(targetLevelKey), []);
|
|
28
|
+
// Уровни вне текущего пути возврату недоступны, и их снимки только копятся
|
|
29
|
+
(0, react_1.useEffect)(() => {
|
|
30
|
+
const keptKeys = new Set(activeLevelKeys);
|
|
31
|
+
levelPositionsRef.current.forEach((_, key) => {
|
|
32
|
+
if (keptKeys.has(key)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
levelPositionsRef.current.delete(key);
|
|
36
|
+
levelStatesRef.current.delete(key);
|
|
37
|
+
});
|
|
38
|
+
}, [activeLevelKeys]);
|
|
39
|
+
return {
|
|
40
|
+
rememberLevel,
|
|
41
|
+
forgetLevel,
|
|
42
|
+
getLevelPosition,
|
|
43
|
+
levelState: levelStatesRef.current.get(levelKey),
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.useLevelSnapshots = useLevelSnapshots;
|
package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./useScrollToTopButton"), exports);
|
package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useScrollToTopButton/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { VirtuosoHandle } from 'react-virtuoso';
|
|
3
|
+
export type UseScrollToTopButtonParams = {
|
|
4
|
+
/**
|
|
5
|
+
* Ref на контейнер, в котором должен быть скролл
|
|
6
|
+
*/
|
|
7
|
+
scrollRef: RefObject<HTMLElement | null>;
|
|
8
|
+
/**
|
|
9
|
+
* Ref на список: кнопка возвращает его к первой строке
|
|
10
|
+
*/
|
|
11
|
+
virtuosoRef: RefObject<VirtuosoHandle | null>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ListRange } from 'react-virtuoso';
|
|
3
|
+
import type { UseScrollToTopButtonParams } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Кнопка «наверх»: показывается, когда список ушёл от начала, и возвращает
|
|
6
|
+
* его к первой строке
|
|
7
|
+
*/
|
|
8
|
+
export declare const useScrollToTopButton: ({ scrollRef, virtuosoRef, }: UseScrollToTopButtonParams) => {
|
|
9
|
+
updateVisibility: (range: ListRange) => void;
|
|
10
|
+
onTopButtonProps: {
|
|
11
|
+
buttonRef: import("react").RefObject<HTMLButtonElement | null>;
|
|
12
|
+
handleScrollToTop: () => void;
|
|
13
|
+
scrollRef: import("react").RefObject<HTMLElement | null>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useScrollToTopButton = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const constants_1 = require("../../../../constants");
|
|
6
|
+
/**
|
|
7
|
+
* Кнопка «наверх»: показывается, когда список ушёл от начала, и возвращает
|
|
8
|
+
* его к первой строке
|
|
9
|
+
*/
|
|
10
|
+
const useScrollToTopButton = ({ scrollRef, virtuosoRef, }) => {
|
|
11
|
+
const buttonRef = (0, react_1.useRef)(null);
|
|
12
|
+
// Класс переключается мимо рендера: кнопка меняется на каждом кадре скролла
|
|
13
|
+
const updateVisibility = (0, react_1.useCallback)((range) => {
|
|
14
|
+
buttonRef.current?.classList.toggle(constants_1.infiniteTreeListClassnames.visibleScrollToTopButton, range.startIndex > 2);
|
|
15
|
+
}, []);
|
|
16
|
+
const handleScrollToTop = (0, react_1.useCallback)(() => {
|
|
17
|
+
if (scrollRef.current) {
|
|
18
|
+
scrollRef.current.style.scrollBehavior = 'auto';
|
|
19
|
+
}
|
|
20
|
+
virtuosoRef.current?.scrollToIndex(0);
|
|
21
|
+
}, [scrollRef, virtuosoRef]);
|
|
22
|
+
return {
|
|
23
|
+
updateVisibility,
|
|
24
|
+
onTopButtonProps: {
|
|
25
|
+
buttonRef,
|
|
26
|
+
handleScrollToTop,
|
|
27
|
+
scrollRef,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
exports.useScrollToTopButton = useScrollToTopButton;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./useTailWatcher"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FlattenTree, InfiniteTreeListData } from '../../../../types';
|
|
2
|
+
export type UseTailWatcherParams<TData extends InfiniteTreeListData<TData>> = {
|
|
3
|
+
/**
|
|
4
|
+
* Строки, отданные `Virtuoso`
|
|
5
|
+
*/
|
|
6
|
+
displayedList: FlattenTree<TData>[];
|
|
7
|
+
/**
|
|
8
|
+
* Ключ отображаемого уровня
|
|
9
|
+
*/
|
|
10
|
+
levelKey: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ListRange } from 'react-virtuoso';
|
|
2
|
+
import type { InfiniteTreeListData } from '../../../../types';
|
|
3
|
+
import { type TailRegistry } from '../../../../utils';
|
|
4
|
+
import type { UseTailWatcherParams } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Хвосты вложенных веток: строки регистрируют себя сами, хук создаёт реестр
|
|
7
|
+
* и на смене видимого диапазона проверяет, попал ли хвост в кадр
|
|
8
|
+
*/
|
|
9
|
+
export declare const useTailWatcher: <TData extends InfiniteTreeListData<TData>>({ displayedList, levelKey, }: UseTailWatcherParams<TData>) => {
|
|
10
|
+
tailRegistry: TailRegistry;
|
|
11
|
+
trackRange: (range: ListRange) => void;
|
|
12
|
+
};
|
package/node/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTailWatcher = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const utils_1 = require("../../../../utils");
|
|
6
|
+
/**
|
|
7
|
+
* Хвосты вложенных веток: строки регистрируют себя сами, хук создаёт реестр
|
|
8
|
+
* и на смене видимого диапазона проверяет, попал ли хвост в кадр
|
|
9
|
+
*/
|
|
10
|
+
const useTailWatcher = ({ displayedList, levelKey, }) => {
|
|
11
|
+
const tailRegistryRef = (0, react_1.useRef)(null);
|
|
12
|
+
if (!tailRegistryRef.current) {
|
|
13
|
+
tailRegistryRef.current = (0, utils_1.createTailRegistry)();
|
|
14
|
+
}
|
|
15
|
+
const tailRegistry = tailRegistryRef.current;
|
|
16
|
+
const displayedListRef = (0, react_1.useRef)(displayedList);
|
|
17
|
+
const lastRangeRef = (0, react_1.useRef)(null);
|
|
18
|
+
const checkTails = (0, react_1.useCallback)(() => {
|
|
19
|
+
const range = lastRangeRef.current;
|
|
20
|
+
if (!range) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
tailRegistry.checkRange(range.endIndex, (itemId) => displayedListRef.current.findIndex((item) => item.id === itemId));
|
|
24
|
+
}, [tailRegistry]);
|
|
25
|
+
// Диапазон прежнего уровня к новому набору строк не относится
|
|
26
|
+
(0, react_1.useEffect)(() => {
|
|
27
|
+
lastRangeRef.current = null;
|
|
28
|
+
tailRegistry.forgetRange();
|
|
29
|
+
}, [levelKey, tailRegistry]);
|
|
30
|
+
(0, react_1.useEffect)(() => {
|
|
31
|
+
displayedListRef.current = displayedList;
|
|
32
|
+
checkTails();
|
|
33
|
+
}, [displayedList, checkTails]);
|
|
34
|
+
const trackRange = (0, react_1.useCallback)((range) => {
|
|
35
|
+
lastRangeRef.current = range;
|
|
36
|
+
checkTails();
|
|
37
|
+
}, [checkTails]);
|
|
38
|
+
return {
|
|
39
|
+
tailRegistry,
|
|
40
|
+
trackRange,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
exports.useTailWatcher = useTailWatcher;
|
|
@@ -15,11 +15,23 @@ export type UseListScrollParams<TData extends InfiniteTreeListData<TData>> = {
|
|
|
15
15
|
*/
|
|
16
16
|
onLoadMore?: () => void;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Строки, отданные `Virtuoso`
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
displayedList: FlattenTree<TData>[];
|
|
21
21
|
/**
|
|
22
22
|
* Контроллер enter-анимации: скролл снимает метки со строк
|
|
23
23
|
*/
|
|
24
24
|
enterAnimation: EnterAnimationResult;
|
|
25
|
+
/**
|
|
26
|
+
* Флаг корневого уровня
|
|
27
|
+
*/
|
|
28
|
+
isRootLevel: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Ключ отображаемого уровня
|
|
31
|
+
*/
|
|
32
|
+
levelKey: string;
|
|
33
|
+
/**
|
|
34
|
+
* Ключи активных узлов
|
|
35
|
+
*/
|
|
36
|
+
activeLevelKeys: string[];
|
|
25
37
|
};
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ListRange, VirtuosoHandle } from 'react-virtuoso';
|
|
3
3
|
import type { InfiniteTreeListData } from '../../types';
|
|
4
|
-
import { type TailRegistry } from '../../utils';
|
|
5
4
|
import type { UseListScrollParams } from './types';
|
|
6
5
|
/**
|
|
7
|
-
* Скролл-обвязка списка: props для `Virtuoso`,
|
|
8
|
-
*
|
|
9
|
-
* смене видимого диапазона проверяет, попал ли хвост в кадр
|
|
6
|
+
* Скролл-обвязка списка: props для `Virtuoso`, переход между уровнями
|
|
7
|
+
* и сборка кнопки «наверх», реестра хвостов и памяти уровней
|
|
10
8
|
*/
|
|
11
|
-
export declare const useListScroll: <TData extends InfiniteTreeListData<TData>>({ scrollRef, isEndReached, onLoadMore,
|
|
9
|
+
export declare const useListScroll: <TData extends InfiniteTreeListData<TData>>({ scrollRef, isEndReached, onLoadMore, displayedList, enterAnimation, isRootLevel, levelKey, activeLevelKeys, }: UseListScrollParams<TData>) => {
|
|
12
10
|
scrollParent: HTMLElement | null;
|
|
13
|
-
|
|
11
|
+
listRef: import("react").RefObject<HTMLDivElement | null>;
|
|
12
|
+
tailRegistry: import("../../utils").TailRegistry;
|
|
14
13
|
isEndReachedWithScroll: boolean | undefined;
|
|
14
|
+
saveLevelSnapshot: () => void;
|
|
15
|
+
dropLevelSnapshot: (targetLevelKey: string) => void;
|
|
15
16
|
virtuosoProps: {
|
|
16
17
|
id: string;
|
|
17
18
|
ref: import("react").RefObject<VirtuosoHandle | null>;
|
|
18
19
|
overscan: number;
|
|
20
|
+
restoreStateFrom: import("react-virtuoso").StateSnapshot | undefined;
|
|
21
|
+
initialTopMostItemIndex: number;
|
|
19
22
|
rangeChanged: (range: ListRange) => void;
|
|
20
23
|
endReached: () => void;
|
|
21
24
|
totalListHeightChanged: () => void;
|