@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,14 +1,16 @@
|
|
|
1
|
-
import { useCallback, useContext, useMemo, useRef } from 'react';
|
|
1
|
+
import { useCallback, useContext, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { ConfigContext } from '../../ConfigProvider';
|
|
3
|
+
import { useViewportType } from '../../useViewportType';
|
|
3
4
|
import { CHILDREN_SKELETON_COUNT } from '../constants';
|
|
4
|
-
import { useChildrenState, useEnterAnimation, useExpandNotifier, useFlatTree, useListScroll, } from '../hooks';
|
|
5
|
-
import { createParentSlots } from '../utils';
|
|
5
|
+
import { useChildrenState, useEnterAnimation, useExpandNotifier, useFlatTree, useLevelNavigation, useListScroll, useNodeTitleValidation, } from '../hooks';
|
|
6
|
+
import { checkHasFooterContent, countDirectChildren, createParentSlots, getLevelKey, } from '../utils';
|
|
6
7
|
/**
|
|
7
8
|
* Логика списка: сводит плоский список, данные дочерних элементов, скролл
|
|
8
9
|
* и анимацию появления строк в props для `Virtuoso` и дочерних компонентов
|
|
9
10
|
*/
|
|
10
11
|
export const useLogic = ({ initialExpandedLevel, items, onRetry, errorMsg, isError, isLoading, scrollRef, isEndReached, onLoadMore, renderItem, renderParent, itemSkeleton, endOfScrollMsg, noDataImgSrc, errorImgSrc, }) => {
|
|
11
12
|
const { imagesMap } = useContext(ConfigContext);
|
|
13
|
+
const { isMobile } = useViewportType();
|
|
12
14
|
const enterAnimation = useEnterAnimation();
|
|
13
15
|
const parentSlotsRef = useRef(null);
|
|
14
16
|
if (!parentSlotsRef.current) {
|
|
@@ -25,6 +27,7 @@ export const useLogic = ({ initialExpandedLevel, items, onRetry, errorMsg, isErr
|
|
|
25
27
|
enterAnimation,
|
|
26
28
|
onCollapse: resetExpandNotification,
|
|
27
29
|
});
|
|
30
|
+
const skeletonCount = itemSkeleton ? CHILDREN_SKELETON_COUNT : 1;
|
|
28
31
|
const { registerChildren, nodePaginationMap, parentItems } = useChildrenState({
|
|
29
32
|
items,
|
|
30
33
|
flatList,
|
|
@@ -34,49 +37,185 @@ export const useLogic = ({ initialExpandedLevel, items, onRetry, errorMsg, isErr
|
|
|
34
37
|
enterAnimation,
|
|
35
38
|
insertChildren,
|
|
36
39
|
syncChildrenPlaceholders,
|
|
37
|
-
skeletonCount
|
|
40
|
+
skeletonCount,
|
|
38
41
|
releaseParentSlot,
|
|
39
42
|
});
|
|
40
|
-
const
|
|
43
|
+
const checkNodeExists = useCallback((nodeId) => flatList.some(({ id }) => id === nodeId), [flatList]);
|
|
44
|
+
const { currentNodeId, baseNodeId, activeLevelKeys, hasUpperLevel, isRootLevel, enterNode, leaveNode, } = useLevelNavigation({ items, isMobile, checkNodeExists });
|
|
45
|
+
const isBaseNodeExpanded = Boolean(baseNodeId && expandedIds.has(baseNodeId));
|
|
46
|
+
// Если корневой узел 1, то базовым уровнем становятся его дочерние элементы на
|
|
47
|
+
// мобильных устройствах
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!isMobile || !baseNodeId || isBaseNodeExpanded) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
onToggle({ id: baseNodeId });
|
|
53
|
+
}, [isMobile, baseNodeId, isBaseNodeExpanded, onToggle]);
|
|
54
|
+
const currentNode = useMemo(() => {
|
|
55
|
+
if (!currentNodeId) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
return flatList.find(({ id }) => id === currentNodeId);
|
|
59
|
+
}, [currentNodeId, flatList]);
|
|
60
|
+
const levelTitle = currentNode?.title;
|
|
61
|
+
useNodeTitleValidation({
|
|
62
|
+
isMobile,
|
|
63
|
+
currentNodeId: currentNode?.id,
|
|
64
|
+
title: levelTitle,
|
|
65
|
+
});
|
|
66
|
+
const displayedList = useMemo(() => {
|
|
67
|
+
if (!isMobile) {
|
|
68
|
+
return flatList;
|
|
69
|
+
}
|
|
70
|
+
if (!currentNodeId) {
|
|
71
|
+
return flatList.filter((item) => item.meta.level === 0);
|
|
72
|
+
}
|
|
73
|
+
return flatList.filter((item) => item.meta.parentId === currentNodeId);
|
|
74
|
+
}, [isMobile, flatList, currentNodeId]);
|
|
75
|
+
// Уровни живут только на мобильной ширине
|
|
76
|
+
const levelKey = getLevelKey(isMobile ? currentNodeId : undefined);
|
|
77
|
+
const { scrollParent, listRef, tailRegistry, isEndReachedWithScroll, virtuosoProps, onTopButtonProps, saveLevelSnapshot, dropLevelSnapshot, } = useListScroll({
|
|
41
78
|
scrollRef,
|
|
42
79
|
isEndReached,
|
|
43
80
|
onLoadMore,
|
|
44
|
-
|
|
81
|
+
displayedList,
|
|
45
82
|
enterAnimation,
|
|
83
|
+
isRootLevel,
|
|
84
|
+
levelKey,
|
|
85
|
+
activeLevelKeys,
|
|
46
86
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
87
|
+
// Смена уровня — не появление строк, анимировать их не нужно
|
|
88
|
+
const prevLevelKeyRef = useRef(levelKey);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (prevLevelKeyRef.current === levelKey) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
prevLevelKeyRef.current = levelKey;
|
|
94
|
+
enterAnimation.reset();
|
|
95
|
+
}, [levelKey, enterAnimation]);
|
|
96
|
+
const prepareNodeChildren = useCallback((listItem) => {
|
|
97
|
+
if (!expandedIdsRef.current.has(listItem.id)) {
|
|
98
|
+
onToggle(listItem);
|
|
99
|
+
}
|
|
100
|
+
const hasChildrenInList = Boolean(listItem.children?.length) ||
|
|
101
|
+
countDirectChildren(flatListRef.current, listItem.id) > 0;
|
|
102
|
+
if (!hasChildrenInList) {
|
|
103
|
+
syncChildrenPlaceholders(listItem.id, true, skeletonCount);
|
|
104
|
+
}
|
|
105
|
+
}, [
|
|
106
|
+
onToggle,
|
|
107
|
+
flatListRef,
|
|
108
|
+
expandedIdsRef,
|
|
109
|
+
syncChildrenPlaceholders,
|
|
110
|
+
skeletonCount,
|
|
111
|
+
]);
|
|
112
|
+
// На мобильной ширине дети узла открываются отдельным уровнем
|
|
113
|
+
const handleEnterNode = useCallback((item) => {
|
|
114
|
+
const listItem = flatListRef.current.find(({ id }) => id === item.id);
|
|
115
|
+
if (!listItem?.meta.hasNested) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
prepareNodeChildren(listItem);
|
|
119
|
+
// Открытие уровня — не появление строк, анимировать их не нужно
|
|
120
|
+
enterAnimation.reset();
|
|
121
|
+
saveLevelSnapshot();
|
|
122
|
+
// Переход внутрь узла показывает уровень с начала
|
|
123
|
+
dropLevelSnapshot(getLevelKey(item.id));
|
|
124
|
+
enterNode(item.id);
|
|
125
|
+
}, [
|
|
126
|
+
flatListRef,
|
|
127
|
+
prepareNodeChildren,
|
|
128
|
+
enterAnimation,
|
|
129
|
+
saveLevelSnapshot,
|
|
130
|
+
dropLevelSnapshot,
|
|
131
|
+
enterNode,
|
|
132
|
+
]);
|
|
133
|
+
const handleToggle = useCallback((item) => {
|
|
134
|
+
if (isMobile) {
|
|
135
|
+
handleEnterNode(item);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
onToggle(item);
|
|
139
|
+
}, [isMobile, handleEnterNode, onToggle]);
|
|
140
|
+
const handleLeaveLevel = useCallback(() => {
|
|
141
|
+
enterAnimation.reset();
|
|
142
|
+
saveLevelSnapshot();
|
|
143
|
+
leaveNode();
|
|
144
|
+
}, [saveLevelSnapshot, leaveNode, enterAnimation]);
|
|
145
|
+
const isNoData = !items?.length;
|
|
146
|
+
const state = useMemo(() => {
|
|
147
|
+
if (!isNoData) {
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
if (isLoading) {
|
|
151
|
+
return 'loading';
|
|
152
|
+
}
|
|
153
|
+
if (isError) {
|
|
154
|
+
return 'error';
|
|
155
|
+
}
|
|
156
|
+
return 'noData';
|
|
157
|
+
}, [isNoData, isLoading, isError]);
|
|
158
|
+
const contentStateProps = useMemo(() => ({
|
|
159
|
+
isLoading: state === 'loading',
|
|
160
|
+
isError: state === 'error',
|
|
161
|
+
loadingTitle: 'Загрузка данных',
|
|
162
|
+
errorState: {
|
|
163
|
+
imgAlt: 'Что-то пошло не так',
|
|
164
|
+
errorList: [errorMsg || ''],
|
|
165
|
+
imgSrc: errorImgSrc ?? imagesMap.defaultErrorImgSrc,
|
|
166
|
+
onRetry,
|
|
167
|
+
},
|
|
168
|
+
}), [state, errorMsg, errorImgSrc, onRetry, imagesMap]);
|
|
169
|
+
// Футер отвечает за корневой список
|
|
63
170
|
const footerContext = useMemo(() => ({
|
|
171
|
+
isLoading: isRootLevel && isLoading,
|
|
172
|
+
isError: isRootLevel && isError,
|
|
173
|
+
isEndReached: isRootLevel && isEndReachedWithScroll,
|
|
174
|
+
endOfScrollMsg,
|
|
175
|
+
onRetry,
|
|
176
|
+
}), [
|
|
177
|
+
isRootLevel,
|
|
64
178
|
isLoading,
|
|
65
179
|
isError,
|
|
66
|
-
|
|
180
|
+
isEndReachedWithScroll,
|
|
67
181
|
endOfScrollMsg,
|
|
68
182
|
onRetry,
|
|
69
|
-
|
|
183
|
+
]);
|
|
184
|
+
const lastRowId = useMemo(() => {
|
|
185
|
+
if (checkHasFooterContent(footerContext)) {
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
return displayedList[displayedList.length - 1]?.id;
|
|
189
|
+
}, [footerContext, displayedList]);
|
|
190
|
+
const levelHeaderProps = useMemo(() => {
|
|
191
|
+
if (!isMobile || !currentNodeId) {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
if (!levelTitle && !hasUpperLevel) {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
title: levelTitle,
|
|
199
|
+
hasBackButton: hasUpperLevel,
|
|
200
|
+
onBack: handleLeaveLevel,
|
|
201
|
+
};
|
|
202
|
+
}, [isMobile, currentNodeId, levelTitle, hasUpperLevel, handleLeaveLevel]);
|
|
70
203
|
return {
|
|
71
|
-
|
|
72
|
-
|
|
204
|
+
displayedList,
|
|
205
|
+
levelKey,
|
|
206
|
+
lastRowId,
|
|
207
|
+
levelHeaderProps,
|
|
208
|
+
onToggle: handleToggle,
|
|
73
209
|
nodePaginationMap,
|
|
74
210
|
registerChildren,
|
|
75
211
|
notifyExpand,
|
|
76
212
|
parentItems,
|
|
77
213
|
acquireParentSlot,
|
|
78
214
|
contentStateProps,
|
|
215
|
+
isNoData,
|
|
216
|
+
state,
|
|
79
217
|
scrollParent,
|
|
218
|
+
listRef,
|
|
80
219
|
virtuosoProps,
|
|
81
220
|
footerContext,
|
|
82
221
|
onTopButtonProps,
|
|
@@ -85,7 +224,6 @@ export const useLogic = ({ initialExpandedLevel, items, onRetry, errorMsg, isErr
|
|
|
85
224
|
// Fallback подставляется один раз: ниже по дереву строка выбирает функцию по
|
|
86
225
|
// типу узла, не проверяя, передал ли потребитель renderParent
|
|
87
226
|
renderParent: renderParent ?? renderItem,
|
|
88
|
-
items,
|
|
89
227
|
onRetry,
|
|
90
228
|
noDataImgSrc,
|
|
91
229
|
enterAnimation,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './checkHasFooterContent';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './checkHasFooterContent';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { InfiniteTreeListData } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Проверяет, есть ли у элемента вложенность: тем же признаком список решает,
|
|
4
|
+
* рисовать ли строке Chevron, а мобильный режим — уводит ли строка внутрь узла
|
|
5
|
+
*/
|
|
6
|
+
export declare const checkHasNested: <TData extends InfiniteTreeListData<TData>>(item: TData) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './checkHasNested';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './checkHasNested';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export type TailRegistry = {
|
|
2
2
|
/**
|
|
3
3
|
* Регистрирует хвост ветки. Тот же `parentId` и `itemId` — обновляет callback.
|
|
4
|
-
* Новый `itemId` сбрасывает `isLoadMoreRequested`
|
|
4
|
+
* Новый `itemId` сбрасывает `isLoadMoreRequested` и сразу проверяет хвост
|
|
5
|
+
* по последнему известному диапазону
|
|
5
6
|
*/
|
|
6
7
|
register: (parentId: string, itemId: string, endReached: () => void) => void;
|
|
7
8
|
/**
|
|
@@ -9,10 +10,14 @@ export type TailRegistry = {
|
|
|
9
10
|
*/
|
|
10
11
|
unregister: (parentId: string, itemId?: string) => void;
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
* `getIndex === -1` пропускает запись
|
|
13
|
+
* Запоминает видимый диапазон и вызывает `endReached` для хвостов, чей индекс
|
|
14
|
+
* в него попадает. `getIndex === -1` пропускает запись
|
|
14
15
|
*/
|
|
15
16
|
checkRange: (endIndex: number, getIndex: (itemId: string) => number) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Забывает запомненный диапазон: он относится к прежнему набору строк
|
|
19
|
+
*/
|
|
20
|
+
forgetRange: () => void;
|
|
16
21
|
};
|
|
17
22
|
/**
|
|
18
23
|
* Реестр хвостов вложенных веток. Живёт на экземпляре списка и переживает
|
|
@@ -4,6 +4,22 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export const createTailRegistry = () => {
|
|
6
6
|
const entries = new Map();
|
|
7
|
+
// Диапазон приходит от виртуализации раньше, чем монтируется строка хвоста:
|
|
8
|
+
// без запоминания диапазона хвост, видимый с первого кадра уровня, не
|
|
9
|
+
// сработал бы вовсе
|
|
10
|
+
let lastEndIndex = null;
|
|
11
|
+
let lastGetIndex = null;
|
|
12
|
+
const checkEntry = (entry) => {
|
|
13
|
+
if (entry.isLoadMoreRequested || lastEndIndex === null || !lastGetIndex) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const index = lastGetIndex(entry.itemId);
|
|
17
|
+
if (index === -1 || lastEndIndex < index) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
entry.isLoadMoreRequested = true;
|
|
21
|
+
entry.endReached();
|
|
22
|
+
};
|
|
7
23
|
return {
|
|
8
24
|
register(parentId, itemId, endReached) {
|
|
9
25
|
const existing = entries.get(parentId);
|
|
@@ -11,7 +27,13 @@ export const createTailRegistry = () => {
|
|
|
11
27
|
existing.endReached = endReached;
|
|
12
28
|
return;
|
|
13
29
|
}
|
|
14
|
-
|
|
30
|
+
const entry = {
|
|
31
|
+
itemId,
|
|
32
|
+
endReached,
|
|
33
|
+
isLoadMoreRequested: false,
|
|
34
|
+
};
|
|
35
|
+
entries.set(parentId, entry);
|
|
36
|
+
checkEntry(entry);
|
|
15
37
|
},
|
|
16
38
|
unregister(parentId, itemId) {
|
|
17
39
|
if (itemId === undefined) {
|
|
@@ -24,17 +46,13 @@ export const createTailRegistry = () => {
|
|
|
24
46
|
}
|
|
25
47
|
},
|
|
26
48
|
checkRange(endIndex, getIndex) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
entry.isLoadMoreRequested = true;
|
|
36
|
-
entry.endReached();
|
|
37
|
-
});
|
|
49
|
+
lastEndIndex = endIndex;
|
|
50
|
+
lastGetIndex = getIndex;
|
|
51
|
+
entries.forEach(checkEntry);
|
|
52
|
+
},
|
|
53
|
+
forgetRange() {
|
|
54
|
+
lastEndIndex = null;
|
|
55
|
+
lastGetIndex = null;
|
|
38
56
|
},
|
|
39
57
|
};
|
|
40
58
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { checkHasNested } from '../checkHasNested';
|
|
1
2
|
/**
|
|
2
3
|
* Проверяет, подгружаются ли дочерние элементы узла отдельно.
|
|
3
4
|
*/
|
|
@@ -15,7 +16,7 @@ export const flattenTree = (items, expandedIds, parentPath = [], level = 0, pare
|
|
|
15
16
|
const flattenedItem = {
|
|
16
17
|
...item,
|
|
17
18
|
meta: {
|
|
18
|
-
hasNested:
|
|
19
|
+
hasNested: checkHasNested(item),
|
|
19
20
|
isChildrenAsync,
|
|
20
21
|
level,
|
|
21
22
|
path,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getLevelKey';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getLevelKey';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export * from './checkHasFooterContent';
|
|
2
|
+
export * from './checkHasNested';
|
|
1
3
|
export * from './checkHasSkeletonPlaceholders';
|
|
2
4
|
export * from './checkIsChildrenPlaceholder';
|
|
3
5
|
export * from './checkIsChildrenPlaceholderOf';
|
|
@@ -12,6 +14,7 @@ export * from './flattenTree';
|
|
|
12
14
|
export * from './getEnteringChildren';
|
|
13
15
|
export * from './getIdsToKeep';
|
|
14
16
|
export * from './getInitialExpandedIds';
|
|
17
|
+
export * from './getLevelKey';
|
|
15
18
|
export * from './getNestedItems';
|
|
16
19
|
export * from './insertChildren';
|
|
17
20
|
export * from './removeChildren';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export * from './checkHasFooterContent';
|
|
2
|
+
export * from './checkHasNested';
|
|
1
3
|
export * from './checkHasSkeletonPlaceholders';
|
|
2
4
|
export * from './checkIsChildrenPlaceholder';
|
|
3
5
|
export * from './checkIsChildrenPlaceholderOf';
|
|
@@ -12,6 +14,7 @@ export * from './flattenTree';
|
|
|
12
14
|
export * from './getEnteringChildren';
|
|
13
15
|
export * from './getIdsToKeep';
|
|
14
16
|
export * from './getInitialExpandedIds';
|
|
17
|
+
export * from './getLevelKey';
|
|
15
18
|
export * from './getNestedItems';
|
|
16
19
|
export * from './insertChildren';
|
|
17
20
|
export * from './removeChildren';
|
|
@@ -3,10 +3,10 @@ import { MainActions, SecondaryActions, SecondaryVisibleActions, } from '../Page
|
|
|
3
3
|
import { ActionWrapper, SecondaryActionsWrapper, ShowMoreButton, StyledCollapse, StyledMainActions, Wrapper, } from './styles';
|
|
4
4
|
import { useLogic } from './useLogic';
|
|
5
5
|
export const MobilePageActions = (props) => {
|
|
6
|
-
const { disabledAction, isActive, handleToggle, visibleMainActions, hiddenMainActions, isVisibleShowMoreButton, isLoading, } = useLogic(props);
|
|
6
|
+
const { disabledAction, isRenderActionDisabled, isActive, handleToggle, visibleMainActions, hiddenMainActions, isVisibleShowMoreButton, isLoading, } = useLogic(props);
|
|
7
7
|
const { secondary, secondaryVisible, className } = props;
|
|
8
8
|
if (isLoading) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
return (_jsxs(Wrapper, { className: className, role: "presentation", children: [_jsxs(ActionWrapper, { children: [_jsx(StyledMainActions, { actions: visibleMainActions, isDisabled: disabledAction, "$isVisibleShowMoreButton": isVisibleShowMoreButton, size: "large" }), _jsxs(StyledCollapse, { in: isActive, children: [_jsx(MainActions, { isDisabled: disabledAction, actions: hiddenMainActions, size: "large" }), _jsxs(SecondaryActionsWrapper, { children: [secondaryVisible && (_jsx(SecondaryVisibleActions, { actions: secondaryVisible, size: "large" })), secondary && (_jsx(SecondaryActions, { isDisabled: disabledAction, actions: secondary, size: "large" }))] })] })] }), isVisibleShowMoreButton && (_jsx(ShowMoreButton, { onClick: handleToggle, children: isActive ? 'Скрыть другие действия' : 'Показать другие действия' }))] }));
|
|
11
|
+
return (_jsxs(Wrapper, { className: className, role: "presentation", children: [_jsxs(ActionWrapper, { children: [_jsx(StyledMainActions, { actions: visibleMainActions, isDisabled: disabledAction, "$isVisibleShowMoreButton": isVisibleShowMoreButton, size: "large", isRenderActionDisabled: isRenderActionDisabled }), _jsxs(StyledCollapse, { in: isActive, children: [_jsx(MainActions, { isDisabled: disabledAction, actions: hiddenMainActions, size: "large", isRenderActionDisabled: isRenderActionDisabled }), _jsxs(SecondaryActionsWrapper, { children: [secondaryVisible && (_jsx(SecondaryVisibleActions, { actions: secondaryVisible, size: "large", isRenderActionDisabled: true })), secondary && (_jsx(SecondaryActions, { isDisabled: disabledAction, actions: secondary, size: "large" }))] })] })] }), isVisibleShowMoreButton && (_jsx(ShowMoreButton, { onClick: handleToggle, children: isActive ? 'Скрыть другие действия' : 'Показать другие действия' }))] }));
|
|
12
12
|
};
|
|
@@ -3,6 +3,7 @@ import { type MobilePageActionsProps } from '../MobilePageActions';
|
|
|
3
3
|
type UseLogicParams<TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType> = MobilePageActionsProps<TMainActionComponent, TSecondaryActionComponent>;
|
|
4
4
|
export declare const useLogic: <TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType>({ main, secondary, secondaryVisible, isLoading, }: UseLogicParams<TMainActionComponent, TSecondaryActionComponent>) => {
|
|
5
5
|
disabledAction: boolean;
|
|
6
|
+
isRenderActionDisabled: boolean;
|
|
6
7
|
isActive: boolean;
|
|
7
8
|
handleToggle: () => void;
|
|
8
9
|
visibleMainActions: import("../../../ActionGroup").MainAction<TMainActionComponent>[] | undefined;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { useActionsState } from '../../../ActionGroup';
|
|
3
|
+
import { useViewportType } from '../../../useViewportType';
|
|
3
4
|
export const useLogic = ({ main, secondary, secondaryVisible, isLoading, }) => {
|
|
4
5
|
const [isActive, setIsActive] = useState(false);
|
|
5
6
|
const { disabledAction } = useActionsState({ main, secondary });
|
|
7
|
+
const { isMobile } = useViewportType();
|
|
6
8
|
const handleToggle = () => {
|
|
7
9
|
setIsActive(!isActive);
|
|
8
10
|
};
|
|
@@ -10,6 +12,7 @@ export const useLogic = ({ main, secondary, secondaryVisible, isLoading, }) => {
|
|
|
10
12
|
const hiddenMainActions = main?.slice(2);
|
|
11
13
|
return {
|
|
12
14
|
disabledAction,
|
|
15
|
+
isRenderActionDisabled: !isMobile,
|
|
13
16
|
isActive,
|
|
14
17
|
handleToggle,
|
|
15
18
|
visibleMainActions,
|
|
@@ -13,5 +13,5 @@ type PageMainActionsProps<TMainActionComponent extends ElementType> = Omit<MainA
|
|
|
13
13
|
*/
|
|
14
14
|
spacing?: number;
|
|
15
15
|
};
|
|
16
|
-
export declare const MainActions: <TMainActionComponent extends ElementType = ElementType>({ actions, isDisabled, className, size, spacing, }: PageMainActionsProps<TMainActionComponent>) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export declare const MainActions: <TMainActionComponent extends ElementType = ElementType>({ actions, isDisabled, className, size, spacing, isRenderActionDisabled, }: PageMainActionsProps<TMainActionComponent>) => import("react/jsx-runtime").JSX.Element | null;
|
|
17
17
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { MainActions as ActionGroupMainActions, } from '../../../ActionGroup';
|
|
3
3
|
import { Wrapper } from './styles';
|
|
4
|
-
export const MainActions = ({ actions, isDisabled, className, size, spacing = 2, }) => {
|
|
4
|
+
export const MainActions = ({ actions, isDisabled, className, size, spacing = 2, isRenderActionDisabled, }) => {
|
|
5
5
|
if (!actions || (actions && actions.length === 0)) {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
|
-
return (_jsx(Wrapper, { className: className, "$spacing": spacing, children: _jsx(ActionGroupMainActions, { actions: actions ?? [], isDisabled: isDisabled, size: size }) }));
|
|
8
|
+
return (_jsx(Wrapper, { className: className, "$spacing": spacing, children: _jsx(ActionGroupMainActions, { actions: actions ?? [], isDisabled: isDisabled, size: size, isRenderActionDisabled: isRenderActionDisabled }) }));
|
|
9
9
|
};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { buttonClasses } from '@mui/material/Button';
|
|
2
|
+
import { actionGroupClassnames } from '../../../ActionGroup';
|
|
2
3
|
import { styled } from '../../../styled';
|
|
3
4
|
import { tooltipClassnames } from '../../../Tooltip';
|
|
4
5
|
export const Wrapper = styled.div `
|
|
5
6
|
display: flex;
|
|
6
7
|
gap: ${({ theme, $spacing }) => theme.spacing($spacing)};
|
|
7
8
|
|
|
9
|
+
.${actionGroupClassnames.action} {
|
|
10
|
+
flex-grow: 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
9
14
|
flex-wrap: wrap;
|
|
10
15
|
gap: ${({ theme }) => theme.spacing(2)};
|
|
@@ -11,10 +11,10 @@ import { ActionWrapper, CollapsedActionsWrapper, FocusModeButton, MainActionsWra
|
|
|
11
11
|
import { useLogic } from './useLogic';
|
|
12
12
|
const PageActionsInner = (props, ref) => {
|
|
13
13
|
const { secondary, secondaryVisible, main, className, isLoading, size = 'medium', spacing = 2, } = props;
|
|
14
|
-
const { disabledAction, buttonClassnames, isFocusedMode, handleClick, tooltipTitle, collapsedActions, classnames, } = useLogic(props);
|
|
14
|
+
const { disabledAction, isRenderActionDisabled, buttonClassnames, isFocusedMode, handleClick, tooltipTitle, collapsedActions, classnames, } = useLogic(props);
|
|
15
15
|
if (isLoading) {
|
|
16
16
|
return (_jsx(Wrapper, { children: _jsx(PageActionSkeleton, { size: size }) }));
|
|
17
17
|
}
|
|
18
|
-
return (_jsx(Wrapper, { className: className, ref: ref, children: _jsxs(ActionWrapper, { "$spacing": spacing, children: [_jsx(Tooltip, { title: tooltipTitle, enterDelay: 400, enterNextDelay: 400, placement: "bottom-end", children: _jsx(FocusModeButton, { className: buttonClassnames, variant: "outlined", onClick: handleClick, "aria-label": tooltipTitle, color: "grey", children: isFocusedMode ? _jsx(MinimizeOutlineMd, {}) : _jsx(FullSizeOutlineMd, {}) }) }), _jsx(MainActionsWrapper, { "$spacing": spacing, className: classnames, children: _jsx(MainActions, { isDisabled: disabledAction, actions: main, size: size, spacing: spacing }) }), (secondaryVisible || secondary) && (_jsxs(SecondaryVisibleWrapper, { "$spacing": spacing, className: classnames, children: [secondaryVisible && (_jsx(SecondaryVisibleActions, { actions: secondaryVisible, size: size })), secondary && (_jsx(SecondaryActions, { isDisabled: disabledAction, actions: secondary, size: size }))] })), collapsedActions.length > 0 && (_jsx(CollapsedActionsWrapper, { className: classnames, children: _jsx(SecondaryActions, { isDisabled: disabledAction, actions: collapsedActions, size: size }) }))] }) }));
|
|
18
|
+
return (_jsx(Wrapper, { className: className, ref: ref, children: _jsxs(ActionWrapper, { "$spacing": spacing, children: [_jsx(Tooltip, { title: tooltipTitle, enterDelay: 400, enterNextDelay: 400, placement: "bottom-end", children: _jsx(FocusModeButton, { className: buttonClassnames, variant: "outlined", onClick: handleClick, "aria-label": tooltipTitle, color: "grey", children: isFocusedMode ? _jsx(MinimizeOutlineMd, {}) : _jsx(FullSizeOutlineMd, {}) }) }), _jsx(MainActionsWrapper, { "$spacing": spacing, className: classnames, children: _jsx(MainActions, { isDisabled: disabledAction, actions: main, size: size, spacing: spacing, isRenderActionDisabled: isRenderActionDisabled }) }), (secondaryVisible || secondary) && (_jsxs(SecondaryVisibleWrapper, { "$spacing": spacing, className: classnames, children: [secondaryVisible && (_jsx(SecondaryVisibleActions, { actions: secondaryVisible, size: size, isRenderActionDisabled: isRenderActionDisabled })), secondary && (_jsx(SecondaryActions, { isDisabled: disabledAction, actions: secondary, size: size }))] })), collapsedActions.length > 0 && (_jsx(CollapsedActionsWrapper, { className: classnames, children: _jsx(SecondaryActions, { isDisabled: disabledAction, actions: collapsedActions, size: size }) }))] }) }));
|
|
19
19
|
};
|
|
20
20
|
export const PageActions = forwardRefWithGeneric(PageActionsInner);
|
package/components/PageHeader/PageActions/SecondaryVisibleActions/SecondaryVisibleActions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type SecondaryVisibleActionProps } from '../../../ActionGroup';
|
|
2
|
-
export declare const SecondaryVisibleActions: ({ actions, size, }: SecondaryVisibleActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const SecondaryVisibleActions: ({ actions, size, isRenderActionDisabled, }: SecondaryVisibleActionProps) => import("react/jsx-runtime").JSX.Element;
|
package/components/PageHeader/PageActions/SecondaryVisibleActions/SecondaryVisibleActions.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { StyledMobileButton, StyledSecondaryVisibleActions } from './styles';
|
|
3
|
-
export const SecondaryVisibleActions = ({ actions, size = 'medium', }) => {
|
|
4
|
-
return (_jsxs(_Fragment, { children: [actions.map(({ disabledReason, isBlockingOperation, icon, name, ...restActionProps }) => {
|
|
3
|
+
export const SecondaryVisibleActions = ({ actions, size = 'medium', isRenderActionDisabled, }) => {
|
|
4
|
+
return (_jsxs(_Fragment, { children: [actions.map(({ disabledReason, isBlockingOperation, icon, name, renderAction, ...restActionProps }) => {
|
|
5
5
|
return (_jsx(StyledMobileButton, { variant: "outlined", size: size, color: "grey", ...restActionProps, children: name }, name));
|
|
6
|
-
}), _jsx(StyledSecondaryVisibleActions, { actions: actions, size: size })] }));
|
|
6
|
+
}), _jsx(StyledSecondaryVisibleActions, { actions: actions, size: size, isRenderActionDisabled: isRenderActionDisabled })] }));
|
|
7
7
|
};
|
|
@@ -9,6 +9,12 @@ export declare const StyledMobileButton: import("../../../styled").StyledCompone
|
|
|
9
9
|
} & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
10
10
|
theme?: import("@emotion/react").Theme | undefined;
|
|
11
11
|
}, {}, {}>;
|
|
12
|
-
export declare const StyledSecondaryVisibleActions: import("../../../styled").StyledComponent<
|
|
12
|
+
export declare const StyledSecondaryVisibleActions: import("../../../styled").StyledComponent<{
|
|
13
|
+
actions: import("../../../ActionGroup").SecondaryVisibleAction[];
|
|
14
|
+
className?: string | undefined;
|
|
15
|
+
size?: import("../../../Button").ButtonSize | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
isRenderActionDisabled?: boolean | undefined;
|
|
18
|
+
} & {
|
|
13
19
|
theme?: import("@emotion/react").Theme | undefined;
|
|
14
20
|
}, {}, {}>;
|
|
@@ -3,6 +3,7 @@ import { type SecondaryAction } from '../../../ActionGroup';
|
|
|
3
3
|
import type { PageActionsProps } from '../types';
|
|
4
4
|
export declare const useLogic: <TMainActionComponent extends ElementType = ElementType, TSecondaryActionComponent extends ElementType = ElementType>({ main, secondary, secondaryVisible, withCollapseOnLaptop, }: PageActionsProps<TMainActionComponent, TSecondaryActionComponent>) => {
|
|
5
5
|
disabledAction: boolean;
|
|
6
|
+
isRenderActionDisabled: boolean;
|
|
6
7
|
buttonClassnames: string;
|
|
7
8
|
isFocusedMode: boolean;
|
|
8
9
|
handleClick: () => void;
|
|
@@ -2,11 +2,13 @@ import { useContext, useMemo } from 'react';
|
|
|
2
2
|
import { useActionsState } from '../../../ActionGroup';
|
|
3
3
|
import { NextFeatureFlagsContext } from '../../../ConfigProvider/NextFeatureFlagsContext';
|
|
4
4
|
import { DashboardContext } from '../../../DashboardContext';
|
|
5
|
+
import { useViewportType } from '../../../useViewportType';
|
|
5
6
|
import { cn } from '../../../utils/cn';
|
|
6
7
|
import { actionsClassnames, focusModeButtonClassnames } from '../constants';
|
|
7
8
|
export const useLogic = ({ main, secondary, secondaryVisible, withCollapseOnLaptop = false, }) => {
|
|
8
9
|
const { showFocusModeButtonOnDesktop, showFocusModeButtonOnLaptop } = useContext(NextFeatureFlagsContext);
|
|
9
10
|
const { setFocusedMode, isFocusedMode } = useContext(DashboardContext);
|
|
11
|
+
const { isMobile } = useViewportType();
|
|
10
12
|
const { disabledAction } = useActionsState({ main, secondary });
|
|
11
13
|
const buttonClassnames = useMemo(() => cn({
|
|
12
14
|
[focusModeButtonClassnames.isShowOnDesktop]: showFocusModeButtonOnDesktop,
|
|
@@ -58,6 +60,7 @@ export const useLogic = ({ main, secondary, secondaryVisible, withCollapseOnLapt
|
|
|
58
60
|
}, [withCollapseOnLaptop]);
|
|
59
61
|
return {
|
|
60
62
|
disabledAction,
|
|
63
|
+
isRenderActionDisabled: isMobile,
|
|
61
64
|
buttonClassnames,
|
|
62
65
|
isFocusedMode,
|
|
63
66
|
handleClick,
|
package/components/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './Accordion';
|
|
2
|
-
export { ActionGroup, type ActionGroupProps, type MainAction, useMainActions, } from './ActionGroup';
|
|
2
|
+
export { ActionGroup, type ActionElementProps, type ActionGroupProps, type ActionRenderContext, type MainAction, type NestedActionRenderContext, useMainActions, } from './ActionGroup';
|
|
3
3
|
export { AddressAutocomplete, type AddressAutocompleteProps, type AddressAutocompleteValue, } from './AddressAutocomplete';
|
|
4
4
|
export { alertClassnames, Alert, type AlertProps, type AlertSeverity, } from './Alert';
|
|
5
5
|
export { AsyncAutocomplete, type AsyncAutocompleteProps, } from './AsyncAutocomplete';
|