/
githubmirror
/
ydb-embedded-ui
Обзор
Документация
Войти
/
githubmirror
/
ydb-embedded-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/components/TableColumnSetup/TableColumnSetup.tsx
33 строки
1 KB
Hellen
feat(TableColumnSelector): apply settings immediatelly (#2907)
22 сен 2025, 10:10
Не верифицирован
22 сен 2025, 10:10
f7e763d
Код
Авторство
О чём код?
import {Gear} from '@gravity-ui/icons'; import type {TableColumnSetupProps as TableColumnSetupPropsUikit} from '@gravity-ui/uikit'; import {Button, Icon, TableColumnSetup as TableColumnSetupUikit, Text} from '@gravity-ui/uikit'; interface TableColumnSetupProps extends Omit<TableColumnSetupPropsUikit, 'renderSwitcher'> {} export function TableColumnSetup(props: TableColumnSetupProps) { const {items, showStatus, disabled} = props; const renderStatus = () => { if (!showStatus) { return null; } const selected = items.reduce((acc, cur) => (cur.selected ? acc + 1 : acc), 0); const all = items.length; const status = ( <Text color="secondary"> {selected}/{all} </Text> ); return status; }; const renderSwitcher: TableColumnSetupPropsUikit['renderSwitcher'] = (switcherProps) => { return ( <Button disabled={disabled} onClick={switcherProps.onClick}> <Icon data={Gear} /> {renderStatus()} </Button> ); }; return <TableColumnSetupUikit {...props} renderSwitcher={renderSwitcher} hideApplyButton />; }