Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: datagrid typescript declarations #6122

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ export { default as useEditableCell } from './useEditableCell';
export { default as useFiltering } from './useFiltering';
export { getAutoSizedColumnWidth } from './utils/getAutoSizedColumnWidth';
export { useFilterContext } from './Datagrid/addons/Filtering/hooks';

// types/index.ts defines a lot of types. Unclear which ones should be exported,
// but presumably not all of them because some have generic names like "Size".
export type { DataGridState } from './types';
15 changes: 7 additions & 8 deletions packages/ibm-products/src/components/Datagrid/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { RadioButtonProps } from '@carbon/react/lib/components/RadioButton/Radio
import { RadioButtonGroupProps } from '@carbon/react/lib/components/RadioButtonGroup/RadioButtonGroup';
import { CheckboxProps } from '@carbon/react/lib/components/Checkbox';
import { NumberInputProps } from '@carbon/react/lib/components/NumberInput/NumberInput';
import { TableRowProps } from 'react-table';

import React, {
CSSProperties,
Expand All @@ -34,6 +33,7 @@ import {
TableCommonProps,
TableDispatch,
TableInstance,
TableRowProps,
TableState,
TableToggleAllRowsSelectedProps,
UseExpandedRowProps,
Expand Down Expand Up @@ -235,11 +235,10 @@ export interface RowAction {
}
export interface DataGridState<T extends object = any>
extends TableCommonProps,
UsePaginationInstanceProps<T>,
Partial<UsePaginationInstanceProps<T>>,
Omit<TableInstance<T>, 'state' | 'headers' | 'rows' | 'columns'>,
Omit<UseFiltersInstanceProps<T>, 'rows'>,
UseRowSelectInstanceProps<T>,
Pick<UseRowSelectInstanceProps<T>, 'toggleAllRowsSelected'> {
Partial<Pick<UseFiltersInstanceProps<T>, 'setFilter' | 'setAllFilters'>>,
UseRowSelectInstanceProps<T> {
withVirtualScroll?: boolean;
DatagridPagination?: JSXElementConstructor<any>;
isFetching?: boolean;
Expand Down Expand Up @@ -278,7 +277,7 @@ export interface DataGridState<T extends object = any>
emptyStateSize?: 'lg' | 'sm';
emptyStateType?: string;
illustrationTheme?: 'light' | 'dark';
emptyStateAction: {
emptyStateAction?: {
kind?: 'primary' | 'secondary' | 'tertiary';
renderIcon?: CarbonIconType;
onClick?: ButtonProps<any>['onClick'];
Expand All @@ -297,13 +296,13 @@ export interface DataGridState<T extends object = any>
setMouseOverRowIndex?: (arg: any) => void;
hideSelectAll?: boolean;
radio?: boolean;
onAllRowSelect: (rows: DatagridRow[], evt: any) => void;
onAllRowSelect?: (rows: DatagridRow[], evt: any) => void;
selectAllToggle?: {
onSelectAllRows?: (args) => void;
labels?: Labels;
};
allPageRowsLabel?: string | object;
allRowsLabel: string | object;
allRowsLabel?: string | object;
onSelectAllRows?: (val?: boolean) => void;
toolbarBatchActions?: ButtonProps<any>[];
setGlobalFilter?: (filterValue: FilterValue) => void;
Expand Down
Loading