@astral/ui 4.105.0 → 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/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/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/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/useScrollManagement/useScrollManagement.js +6 -5
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// cspell:ignore виртуализирует
|
|
2
|
-
import { useContext, useEffect,
|
|
2
|
+
import { useContext, useEffect, useRef } from 'react';
|
|
3
3
|
import { InfiniteTreeListContext } from '../../InfiniteTreeListContext';
|
|
4
4
|
/**
|
|
5
5
|
* Логика строки виртуализации: регистрирует хвост ветки в реестре, один раз
|
|
@@ -14,8 +14,7 @@ import { InfiniteTreeListContext } from '../../InfiniteTreeListContext';
|
|
|
14
14
|
* этого нет
|
|
15
15
|
*/
|
|
16
16
|
export const useLogic = ({ item, context, ...itemProps }) => {
|
|
17
|
-
const { renderItem, onToggle, nodePaginationMap, onLoadMore, enterAnimation, tailRegistry, } = useContext(InfiniteTreeListContext);
|
|
18
|
-
const memoizedItemProps = useMemo(() => itemProps, [itemProps.style]);
|
|
17
|
+
const { renderItem, onToggle, nodePaginationMap, onLoadMore, enterAnimation, tailRegistry, lastRowId, } = useContext(InfiniteTreeListContext);
|
|
19
18
|
const { parentId, siblingIndex, level } = item.meta;
|
|
20
19
|
const parentPagination = parentId ? nodePaginationMap[parentId] : undefined;
|
|
21
20
|
const isLastChild = parentPagination?.lastChildId === item.id;
|
|
@@ -48,6 +47,7 @@ export const useLogic = ({ item, context, ...itemProps }) => {
|
|
|
48
47
|
};
|
|
49
48
|
}, [shouldRegister, parentId, item.id, tailRegistry, onLoadMore]);
|
|
50
49
|
const isSpinner = item.placeholderKind === 'spinner';
|
|
50
|
+
const isLastRow = item.id === lastRowId;
|
|
51
51
|
// Уровень вложенности и индекс каскада — динамические значения, поэтому
|
|
52
52
|
// передаются в стили через css vars, а не через styled props
|
|
53
53
|
const cssVars = {
|
|
@@ -58,9 +58,10 @@ export const useLogic = ({ item, context, ...itemProps }) => {
|
|
|
58
58
|
item,
|
|
59
59
|
renderItem,
|
|
60
60
|
onToggle,
|
|
61
|
-
|
|
61
|
+
itemProps,
|
|
62
62
|
cssVars,
|
|
63
63
|
isSpinner,
|
|
64
64
|
hasAddAnimation: !isSpinner && shouldAnimate,
|
|
65
|
+
isLastRow,
|
|
65
66
|
};
|
|
66
67
|
};
|
|
@@ -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
|
};
|
|
@@ -7,13 +7,34 @@ export const OVERSCAN = 30;
|
|
|
7
7
|
* data, поэтому `useLayoutEffect` снимает метку слишком рано
|
|
8
8
|
*/
|
|
9
9
|
export const ENTER_ANIMATION_MOUNT_WINDOW_MS = 100;
|
|
10
|
+
/**
|
|
11
|
+
* Предел, после которого переход между уровнями открывает список принудительно.
|
|
12
|
+
*/
|
|
13
|
+
export const LEVEL_TRANSITION_TIMEOUT_MS = 200;
|
|
10
14
|
export const CHILDREN_SKELETON_COUNT = 3;
|
|
11
15
|
export const CHILDREN_NO_DATA_MSG = 'Нет данных';
|
|
16
|
+
/**
|
|
17
|
+
* Ключ корневого уровня в снимках позиции скролла: у корня нет id узла
|
|
18
|
+
*/
|
|
19
|
+
export const ROOT_LEVEL_KEY = 'root';
|
|
20
|
+
/**
|
|
21
|
+
* Префикс ключа уровня узла: отделяет id узлов от ключа корневого уровня
|
|
22
|
+
*/
|
|
23
|
+
export const NODE_LEVEL_KEY_PREFIX = 'node:';
|
|
12
24
|
export const infiniteTreeListClassnames = {
|
|
25
|
+
root: createUIKitClassname('infinite-tree-list'),
|
|
26
|
+
loading: createUIKitClassname('infinite-tree-list_loading'),
|
|
27
|
+
noData: createUIKitClassname('infinite-tree-list_no-data'),
|
|
28
|
+
error: createUIKitClassname('infinite-tree-list_error'),
|
|
29
|
+
levelHeader: createUIKitClassname('infinite-tree-list__level-header'),
|
|
30
|
+
levelHeaderWithBackButton: createUIKitClassname('infinite-tree-list__level-header_with-back-button'),
|
|
31
|
+
levelHeaderBackButton: createUIKitClassname('infinite-tree-list__level-header-back-button'),
|
|
32
|
+
levelTransition: createUIKitClassname('infinite-tree-list_level-transition'),
|
|
13
33
|
row: createUIKitClassname('infinite-tree-list__row'),
|
|
14
34
|
rowAddAnimation: createUIKitClassname('infinite-tree-list__row_add-animation'),
|
|
15
35
|
rowRemoveAnimation: createUIKitClassname('infinite-tree-list__row_remove-animation'),
|
|
16
36
|
rowSpinner: createUIKitClassname('infinite-tree-list__row_spinner'),
|
|
37
|
+
rowLast: createUIKitClassname('infinite-tree-list__row_last'),
|
|
17
38
|
scrollToTopButton: createUIKitClassname('infinite-tree-list__scroll-to-top-button'),
|
|
18
39
|
visibleScrollToTopButton: createUIKitClassname('infinite-tree-list__scroll-to-top-button_visible'),
|
|
19
40
|
};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,48 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { checkHasNested, getLevelKey } from '../../utils';
|
|
3
|
+
/**
|
|
4
|
+
* Уровень, который список отображает на мобильной ширине: id текущего узла
|
|
5
|
+
* и стек пройденных узлов.
|
|
6
|
+
*/
|
|
7
|
+
export const useLevelNavigation = ({ items, isMobile, checkNodeExists, }) => {
|
|
8
|
+
const [enteredIds, setEnteredIds] = useState([]);
|
|
9
|
+
const baseNodeId = useMemo(() => {
|
|
10
|
+
if (items.length !== 1) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
const [rootItem] = items;
|
|
14
|
+
return checkHasNested(rootItem) ? rootItem.id : undefined;
|
|
15
|
+
}, [items]);
|
|
16
|
+
// Смена ширины в обе стороны возвращает список на базовый уровень
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setEnteredIds([]);
|
|
19
|
+
}, [isMobile]);
|
|
20
|
+
// Узел мог уйти из данных: показывать его уровень и всё, что ниже, нечем
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const lostIndex = enteredIds.findIndex((itemId) => !checkNodeExists(itemId));
|
|
23
|
+
if (lostIndex === -1) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
setEnteredIds(enteredIds.slice(0, lostIndex));
|
|
27
|
+
}, [enteredIds, checkNodeExists]);
|
|
28
|
+
const enterNode = useCallback((itemId) => {
|
|
29
|
+
setEnteredIds((prev) => [...prev, itemId]);
|
|
30
|
+
}, []);
|
|
31
|
+
const leaveNode = useCallback(() => {
|
|
32
|
+
setEnteredIds((prev) => prev.slice(0, -1));
|
|
33
|
+
}, []);
|
|
34
|
+
// Уровни, до которых доберётся возврат
|
|
35
|
+
const activeLevelKeys = useMemo(() => [
|
|
36
|
+
getLevelKey(isMobile ? baseNodeId : undefined),
|
|
37
|
+
...enteredIds.map((itemId) => getLevelKey(itemId)),
|
|
38
|
+
], [isMobile, baseNodeId, enteredIds]);
|
|
39
|
+
return {
|
|
40
|
+
currentNodeId: enteredIds[enteredIds.length - 1] ?? baseNodeId,
|
|
41
|
+
baseNodeId,
|
|
42
|
+
activeLevelKeys,
|
|
43
|
+
hasUpperLevel: enteredIds.length > 0,
|
|
44
|
+
isRootLevel: !isMobile || (enteredIds.length === 0 && baseNodeId === undefined),
|
|
45
|
+
enterNode,
|
|
46
|
+
leaveNode,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
+
};
|
package/components/InfiniteTreeList/hooks/useListScroll/hooks/useLevelSnapshots/useLevelSnapshots.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Память уровней: куда был прокручен уровень и какими он намерил свои строки.
|
|
4
|
+
* Снимки живут, пока до уровня может добраться возврат
|
|
5
|
+
*/
|
|
6
|
+
export const useLevelSnapshots = ({ levelKey, activeLevelKeys, virtuosoRef, }) => {
|
|
7
|
+
// Позиция уровня запоминается смещением скролла внутри списка
|
|
8
|
+
const levelPositionsRef = useRef(new Map());
|
|
9
|
+
// Кеш измеренных высот у `Virtuoso` привязан к индексу строки, а не к её id,
|
|
10
|
+
// поэтому уровни затирают замеры друг друга. Снимок уровня возвращает его
|
|
11
|
+
// собственные высоты: иначе после возврата список ниже настоящего, и каждая
|
|
12
|
+
// строка, домеренная при прокрутке вверх, толкает позицию обратно вниз
|
|
13
|
+
const levelStatesRef = useRef(new Map());
|
|
14
|
+
const rememberLevel = useCallback((offset) => {
|
|
15
|
+
levelPositionsRef.current.set(levelKey, offset);
|
|
16
|
+
virtuosoRef.current?.getState((state) => {
|
|
17
|
+
levelStatesRef.current.set(levelKey, state);
|
|
18
|
+
});
|
|
19
|
+
}, [levelKey, virtuosoRef]);
|
|
20
|
+
const forgetLevel = useCallback((targetLevelKey) => {
|
|
21
|
+
levelPositionsRef.current.delete(targetLevelKey);
|
|
22
|
+
levelStatesRef.current.delete(targetLevelKey);
|
|
23
|
+
}, []);
|
|
24
|
+
const getLevelPosition = useCallback((targetLevelKey) => levelPositionsRef.current.get(targetLevelKey), []);
|
|
25
|
+
// Уровни вне текущего пути возврату недоступны, и их снимки только копятся
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const keptKeys = new Set(activeLevelKeys);
|
|
28
|
+
levelPositionsRef.current.forEach((_, key) => {
|
|
29
|
+
if (keptKeys.has(key)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
levelPositionsRef.current.delete(key);
|
|
33
|
+
levelStatesRef.current.delete(key);
|
|
34
|
+
});
|
|
35
|
+
}, [activeLevelKeys]);
|
|
36
|
+
return {
|
|
37
|
+
rememberLevel,
|
|
38
|
+
forgetLevel,
|
|
39
|
+
getLevelPosition,
|
|
40
|
+
levelState: levelStatesRef.current.get(levelKey),
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,27 @@
|
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
import { infiniteTreeListClassnames } from '../../../../constants';
|
|
3
|
+
/**
|
|
4
|
+
* Кнопка «наверх»: показывается, когда список ушёл от начала, и возвращает
|
|
5
|
+
* его к первой строке
|
|
6
|
+
*/
|
|
7
|
+
export const useScrollToTopButton = ({ scrollRef, virtuosoRef, }) => {
|
|
8
|
+
const buttonRef = useRef(null);
|
|
9
|
+
// Класс переключается мимо рендера: кнопка меняется на каждом кадре скролла
|
|
10
|
+
const updateVisibility = useCallback((range) => {
|
|
11
|
+
buttonRef.current?.classList.toggle(infiniteTreeListClassnames.visibleScrollToTopButton, range.startIndex > 2);
|
|
12
|
+
}, []);
|
|
13
|
+
const handleScrollToTop = useCallback(() => {
|
|
14
|
+
if (scrollRef.current) {
|
|
15
|
+
scrollRef.current.style.scrollBehavior = 'auto';
|
|
16
|
+
}
|
|
17
|
+
virtuosoRef.current?.scrollToIndex(0);
|
|
18
|
+
}, [scrollRef, virtuosoRef]);
|
|
19
|
+
return {
|
|
20
|
+
updateVisibility,
|
|
21
|
+
onTopButtonProps: {
|
|
22
|
+
buttonRef,
|
|
23
|
+
handleScrollToTop,
|
|
24
|
+
scrollRef,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
package/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.d.ts
ADDED
|
@@ -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/components/InfiniteTreeList/hooks/useListScroll/hooks/useTailWatcher/useTailWatcher.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { createTailRegistry } from '../../../../utils';
|
|
3
|
+
/**
|
|
4
|
+
* Хвосты вложенных веток: строки регистрируют себя сами, хук создаёт реестр
|
|
5
|
+
* и на смене видимого диапазона проверяет, попал ли хвост в кадр
|
|
6
|
+
*/
|
|
7
|
+
export const useTailWatcher = ({ displayedList, levelKey, }) => {
|
|
8
|
+
const tailRegistryRef = useRef(null);
|
|
9
|
+
if (!tailRegistryRef.current) {
|
|
10
|
+
tailRegistryRef.current = createTailRegistry();
|
|
11
|
+
}
|
|
12
|
+
const tailRegistry = tailRegistryRef.current;
|
|
13
|
+
const displayedListRef = useRef(displayedList);
|
|
14
|
+
const lastRangeRef = useRef(null);
|
|
15
|
+
const checkTails = useCallback(() => {
|
|
16
|
+
const range = lastRangeRef.current;
|
|
17
|
+
if (!range) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
tailRegistry.checkRange(range.endIndex, (itemId) => displayedListRef.current.findIndex((item) => item.id === itemId));
|
|
21
|
+
}, [tailRegistry]);
|
|
22
|
+
// Диапазон прежнего уровня к новому набору строк не относится
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
lastRangeRef.current = null;
|
|
25
|
+
tailRegistry.forgetRange();
|
|
26
|
+
}, [levelKey, tailRegistry]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
displayedListRef.current = displayedList;
|
|
29
|
+
checkTails();
|
|
30
|
+
}, [displayedList, checkTails]);
|
|
31
|
+
const trackRange = useCallback((range) => {
|
|
32
|
+
lastRangeRef.current = range;
|
|
33
|
+
checkTails();
|
|
34
|
+
}, [checkTails]);
|
|
35
|
+
return {
|
|
36
|
+
tailRegistry,
|
|
37
|
+
trackRange,
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -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;
|