@carbon/ibm-products
Version:
Carbon for IBM Products
163 lines (162 loc) • 4.89 kB
TypeScript
/**
* Copyright IBM Corp. 2022, 2022
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Dispatch, SetStateAction, MutableRefObject } from 'react';
import { ActiveCellCoordinates, SpreadsheetColumn } from './types';
import { Column, IdType, TableBodyPropGetter, TableBodyProps } from 'react-table';
interface DataSpreadsheetBodyProps {
/**
* Object containing the active cell coordinates
*/
activeCellCoordinates?: ActiveCellCoordinates | null;
/**
*This is the ref of the button input, which is the active cell element
*/
activeCellRef?: MutableRefObject<HTMLElement | undefined>;
/**
* Is the user clicking and holding in the data spreadsheet body
*/
clickAndHoldActive?: boolean;
/**
* All of the spreadsheet columns
*/
columns?: readonly Column<object>[];
/**
* This represents the id of the current cell selection area
*/
currentMatcher?: string;
/**
* Default spreadsheet sizing values
*/
defaultColumn?: SpreadsheetColumn;
/**
* Sets the number of empty rows to be created when there is no data provided
*/
defaultEmptyRowCount?: number;
/**
* Function to set table body prop values
*/
getTableBodyProps: (propGetter?: TableBodyPropGetter<any>) => TableBodyProps;
/**
* Headers provided from useTable hook
*/
headerGroups?: any[];
/**
* The spreadsheet id
*/
id?: number | string;
/**
* Set current columns after drag drop
*/
setCurrentColumns?: Dispatch<SetStateAction<object[]>>;
/**
* The event handler that is called when the active cell changes
*/
onActiveCellChange?: () => void;
/**
* Check if user is using custom component
*/
hasCustomRowHeader?: boolean;
/**
* Component next to numbering rows
*/
renderRowHeader?: (index: number) => any[];
/**
* Component next to numbering rows
*/
renderRowHeaderDirection?: string;
/**
* The event handler that is called to set the rows for the empty spreadsheet
*/
onDataUpdate?: ({ ...args }: {
[x: string]: any;
}) => void;
/**
* The event handler that is called when the selection areas change
*/
onSelectionAreaChange?: ({ ...args }: {
[x: string]: any;
}) => void;
/**
* Prepare row function from react-table
*/
prepareRow?: (...args: any[]) => void;
/**
* All of the spreadsheet row data
*/
rows?: any[];
/**
* The scrollbar width
*/
scrollBarSize?: number;
/**
* Array of selection area data
*/
selectionAreaData?: any[];
/**
* Header reordering is active
*/
selectedHeaderReorderActive?: boolean;
/**
* Set header reordering active or not
*/
setSelectedHeaderReorderActive?: Dispatch<SetStateAction<boolean>>;
/**
* Array of selection areas
*/
selectionAreas?: any[];
/**
* Setter fn for activeCellCoordinates state value
*/
setActiveCellCoordinates?: Dispatch<SetStateAction<ActiveCellCoordinates | null>>;
/**
* Setter fn for active cell inside of selection area
*/
setActiveCellInsideSelectionArea?: Dispatch<SetStateAction<boolean>>;
/**
* Setter fn for clickAndHold state value
*/
setClickAndHoldActive?: Dispatch<SetStateAction<boolean>>;
/**
* Setter fn for column ordering, provided from react-table
*/
setColumnOrder?: (updater: ((columnOrder: Array<IdType<any>>) => Array<IdType<any>>) | Array<IdType<any>>) => void;
/**
* Setter fn for containerHasFocus state value
*/
setContainerHasFocus?: Dispatch<SetStateAction<boolean>>;
/**
* Setter fn for currentMatcher state value
*/
setCurrentMatcher?: Dispatch<SetStateAction<string>>;
/**
* Setter fn for header cell hold active value
*/
setHeaderCellHoldActive?: Dispatch<SetStateAction<boolean>>;
/**
* Setter fn for selectionAreaData state value
*/
setSelectionAreaData?: Dispatch<SetStateAction<object[]>>;
/**
* Setter fn for selectionAreas state value
*/
setSelectionAreas?: Dispatch<SetStateAction<object[]>>;
/**
* The total columns width
*/
totalColumnsWidth?: number;
/**
* The total number of columns to be initially visible, additional columns will be rendered and
* visible via horizontal scrollbar
*/
totalVisibleColumns?: number;
/**
* Prop from react-table used to reorder columns
*/
visibleColumns?: Column<object>[];
}
export declare const DataSpreadsheetBody: React.ForwardRefExoticComponent<DataSpreadsheetBodyProps & React.RefAttributes<HTMLDivElement>>;
export {};