Добавлено отображение загрузки в WellTreeSelector

This commit is contained in:
goodmice 2022-08-02 15:26:55 +05:00
parent 5ab2bf237f
commit 8f9383654d

View File

@ -1,9 +1,8 @@
import { Button, Drawer, Tree, TreeProps, Typography } from 'antd' import { Button, Drawer, Skeleton, Tree, TreeProps, Typography } from 'antd'
import { DefaultValueType } from 'rc-tree-select/lib/interface' import { DefaultValueType } from 'rc-tree-select/lib/interface'
import { useState, useEffect, ReactNode, useCallback, memo, Key } from 'react' import { useState, useEffect, ReactNode, useCallback, memo, Key } from 'react'
import { useNavigate, useLocation } from 'react-router-dom' import { useNavigate, useLocation } from 'react-router-dom'
import SkeletonLoader from '@components/SkeletonLoader'
import { WellIcon, WellIconState } from '@components/icons' import { WellIcon, WellIconState } from '@components/icons'
import { invokeWebApiWrapperAsync } from '@components/factory' import { invokeWebApiWrapperAsync } from '@components/factory'
import { DepositService, DepositDto, WellDto } from '@api' import { DepositService, DepositDto, WellDto } from '@api'
@ -165,7 +164,7 @@ export const WellTreeSelector = memo(({ show, ...other }: TreeProps<TreeNodeData
<Button loading={showLoader} onClick={() => setVisible(true)}>{value ?? 'Выберите месторождение'}</Button> <Button loading={showLoader} onClick={() => setVisible(true)}>{value ?? 'Выберите месторождение'}</Button>
<Drawer visible={visible} mask={false} onClose={() => setVisible(false)}> <Drawer visible={visible} mask={false} onClose={() => setVisible(false)}>
<Typography.Title level={3}>Список скважин</Typography.Title> <Typography.Title level={3}>Список скважин</Typography.Title>
<SkeletonLoader loading={showLoader} empty={!wellsTree || wellsTree.length <= 0}> <Skeleton active loading={showLoader}>
<Tree <Tree
{...other} {...other}
showIcon showIcon
@ -175,7 +174,7 @@ export const WellTreeSelector = memo(({ show, ...other }: TreeProps<TreeNodeData
onExpand={setExpanded} onExpand={setExpanded}
expandedKeys={expanded} expandedKeys={expanded}
/> />
</SkeletonLoader> </Skeleton>
</Drawer> </Drawer>
</> </>
) )