Skip to content

Commit

Permalink
chore: add sticky for old TableColumnSetup
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanVor committed Apr 6, 2024
1 parent a2afc90 commit 839d503
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/components/TableColumnSetup/TableColumnSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import {Gear} from '@gravity-ui/icons';
import type {PopperPlacement} from '../../hooks/private';
import {Button} from '../Button';
import {Icon} from '../Icon';
import {TableColumnSetup as TableColumnSetupComponent} from '../Table/hoc/withTableSettings/TableColumnSetup/TableColumnSetup';
import type {TableColumnConfig} from '../Table/Table';
import type {TableColumnSetupItem as NewTableColumnSetupItem} from '../Table/hoc/withTableSettings/TableColumnSetup/TableColumnSetup';
import {TableColumnSetup as NewTableColumnSetup} from '../Table/hoc/withTableSettings/TableColumnSetup/TableColumnSetup';
import type {TableSetting} from '../Table/hoc/withTableSettings/withTableSettings';
import {block} from '../utils/cn';

Expand All @@ -20,6 +22,7 @@ export interface TableColumnSetupItem {
title: React.ReactNode;
selected?: boolean;
required?: boolean;
sticky?: TableColumnConfig<unknown>['sticky'];
}

type Item = TableColumnSetupItem;
Expand Down Expand Up @@ -88,12 +91,15 @@ export const TableColumnSetup = (props: TableColumnSetupProps) => {
);
};

const items = propsItems.map(({id, title, required, selected}) => ({
id,
title,
isRequired: required,
isSelected: selected,
}));
const items = propsItems.map<NewTableColumnSetupItem>(
({id, title, required, selected, sticky}) => ({
id,
title,
isRequired: required,
isSelected: selected,
sticky,
}),
);

const onUpdate = (newSettings: TableSetting[]) => {
propsOnUpdate(
Expand All @@ -111,7 +117,7 @@ export const TableColumnSetup = (props: TableColumnSetupProps) => {
};

return (
<TableColumnSetupComponent
<NewTableColumnSetup
items={items}
onUpdate={onUpdate}
popupPlacement={popupPlacement}
Expand Down

0 comments on commit 839d503

Please sign in to comment.