import React$1, { ReactNode } from 'react'; type NativeColTypes = 'string' | 'number' | 'date' | 'dateTime' | 'boolean' | 'singleSelect' | 'actions'; type ColumnType = NativeColTypes | string; type GridRowId = string | number; type GridValidRowModel = Record; interface GridPinnedColumns { left?: string[]; right?: string[]; } type GridColumnPinningState = GridPinnedColumns; declare enum GridPinnedPosition { left = "left", right = "right" } /** * The column pinning API interface that is available in the grid [[apiRef]]. */ interface GridColumnPinningApi { /** * Pins a column to the left or right side of the grid. * @param {string} field The column field to pin. * @param {GridPinnedPosition} side Which side to pin the column. */ pinColumn: (field: string, side: GridPinnedPosition) => void; /** * Unpins a column. * @param {string} field The column field to unpin. */ unpinColumn: (field: string) => void; /** * Returns which columns are pinned. * @returns {GridPinnedColumns} An object containing the pinned columns. */ getPinnedColumns: () => GridPinnedColumns; /** * Changes the pinned columns. * @param {GridPinnedColumns} pinnedColumns An object containing the columns to pin. */ setPinnedColumns: (pinnedColumns: GridPinnedColumns) => void; /** * Returns which side a column is pinned to. * @param {string} field The column field to check. * @returns {string | false} Which side the column is pinned or `false` if not pinned. */ isColumnPinned: (field: string) => GridPinnedPosition | false; } interface GridColumnPinningInternalCache { /** * Stores the fields in their original position, before being pinned. */ orderedFieldsBeforePinningColumns: string[] | null; } type GridActionsCellItemProps = { label: string; icon?: React.ReactElement; } & ({ showInMenu?: false; icon: React.ReactElement; } | { showInMenu: true; }); type ValueType = string | number | boolean; interface OptionInterface { value: ValueType; label: string | number; } type ColumnAlignment = 'left' | 'center' | 'right'; interface GridBaseColDef { /** * The column identifier. It's used to map with [[GridRowModel]] values. */ field: string; /** * The title of the column rendered in the column header cell. */ headerName: string; /** * The hover text or component of the column rendered in the column header cell. */ headerPopupContent?: string | (() => JSX.Element); /** * Get the values to be displayed in the table cell. */ valueGetter?: (row: any, index?: number) => string | number | boolean; /** * The cell which has JSX will be displayed. */ renderCell?: HTMLElement | JSX.Element | Element | ((row: any, index: number) => JSX.Element); /** * The description of the column rendered as tooltip if the column header name is not fully displayed. */ description?: string; /** * The column is visible or not. */ isVisible?: boolean; /** * Type allows to merge this object with a default definition [[GridColDef]]. * @default 'string' */ type?: ColumnType; /** * Allows column to pin. * @default null */ pinned?: GridPinnedPosition | null; /** * Allows column to set width. * @default 'max-content' */ width?: number | string; /** * The column to search or not. */ isSearchable?: boolean; /** * The column to sortable or not. */ isSortable?: boolean; /** * The column to filterable or not. */ isFilterable?: boolean; /** * The column to formatable cells or not. */ isFormattable?: boolean; /** * The column to show options in filter. */ options?: OptionInterface[]; /** * Align the column. */ align?: ColumnAlignment; } interface GridActionsColDef extends GridBaseColDef { /** * Type allows to merge this object with a default definition [[GridColDef]]. * @default 'actions' */ type: 'actions'; /** * Function that returns the actions to be shown. * @param {GridRowParams} params The params for each row. * @returns {React.ReactElement[]} An array of [[GridActionsCell]] elements. */ getActions: () => Array>; } type GridColDef = GridBaseColDef | GridActionsColDef; /** * Available densities. */ type GridDensity = 'compact' | 'standard' | 'comfortable'; type GridSortDirection = 'asc' | 'desc' | null | undefined; interface Logger { debug: (...args: any[]) => void; info: (...args: any[]) => void; warn: (...args: any[]) => void; error: (...args: any[]) => void; } interface FilterFieldProps { condition: string; column: string; type: 'string' | 'number' | 'date' | 'dateTime' | 'boolean' | 'singleSelect'; operator: string; value: any; value2?: any; field?: string; options?: string[] | OptionInterface[]; } type ConditionalFormattingOperator = string; interface GridConditionalFormattingRule { /** * Unique ID for the rule. */ id: string; /** * The field (column) to evaluate condition and apply style to. * (Relies on this key/value; no separate columns array needed.) */ field: string; /** * Operator for the condition (reuses filter operators). */ operator: ConditionalFormattingOperator; /** * Value for condition (e.g. threshold, text). */ value?: any; /** * Second value for operators like 'between'. */ value2?: any; /** * Styles to apply if condition matches. */ style: { textColor?: string; backgroundColor?: string; }; /** * Higher number = higher priority (last in array wins on ties). * Managed by rule order in UI. */ priority: number; } interface GridConditionalFormattingProps { /** * Array of conditional formatting rules. * Rules are evaluated in order for each cell/row. */ conditionalFormatting?: GridConditionalFormattingRule[]; /** * Callback when rules change (e.g. add/edit/delete). */ onConditionalFormattingChange?: (rules: GridConditionalFormattingRule[]) => void; } interface DataGridPropsWithDefaultValues { data: any; rootData: []; filteredAndSortedData: []; defaultPageSize: number; columns: GridColDef[]; density: GridDensity; emptyPlaceholder: string; loading: boolean; page: number; pageSizeOptions: number[]; sortingOrder: GridSortDirection[]; sortField: string; sortFieldType: string; sortBy: GridSortDirection; logger: Logger; showColumnToolbar: boolean; showFilterToolbar: boolean; isShowSerialNumber: boolean; searchKeys: string[]; searchText: string; /** * If `true`, column filters are disabled. * @default false */ disableColumnFilter: boolean; /** * If `true`, the column menu is disabled. * @default false */ disableColumnMenu: boolean; /** * If `true`, the column pinning is disabled. * @default false */ disableColumnPinning: boolean; /** * If `true`, reordering columns is disabled. * @default false */ disableColumnReorder: boolean; /** * If `true`, resizing columns is disabled. * @default false */ disableColumnResize: boolean; /** * If `true`, hiding/showing columns is disabled. * @default false */ disableColumnSelector: boolean; /** * If `true`, the density selector is disabled. * @default false */ disableDensitySelector: boolean; /** * If `true`, sorting with multiple columns is disabled. * @default false */ disableMultipleColumnsSorting: boolean; /** * If `true`, quick search will be disabled. * @default false */ disableSearch: boolean; /** * If `true`, export will be disabled. * @default false */ disableColumnExport: boolean; /** * If `true`, there won't be any footer or pagination. * @default false */ hideFooter: boolean; /** * If `true`, the row count in pagination component in the footer is hidden. * @default false */ hideFooterRowCount: boolean; /** * If `true`, the pagination component in the footer is hidden but row count will be shown. * @default false */ hidePagination: boolean; /** * If `true`, the selected row count in the footer is hidden. * @default false */ pagination: boolean; /** * Pagination can be processed on the server or client-side. * Set it to 'client' if you would like to handle the pagination on the client-side. * Set it to 'server' if you would like to handle the pagination on the server-side. * @default "client" */ filters: FilterFieldProps[]; /** * If `true`, the grid will have checkbox selection. * @default false */ checkboxSelection: boolean; selectedRows: GridRowId[]; paginatedSelectedRows: GridRowId[]; /** * If `true`, the columns will be updated with every props - Use it if the data update is real time. * @default false */ isRealTimeDataUpdate: boolean; /** * Bulk actions to be displayed in the toolbar. * @default [] * @example ['delete'] */ bulkActions: string[] | any[]; /** * Callback fired when a bulk action is clicked. * @param {string} action The action clicked. * @param {GridRowId[]} selectedRows The selected rows. * @param {() => void} resetSelectedRows Function to reset the selected rows. */ onBulkActionClick: (action: string, selectedRows: GridRowId[], resetSelectedRows: () => void) => void; /** * The text to be displayed when the grid is empty. * @default 'No rows' * @example 'No rows' * @example No rows * @example */ noRowsOverlay: ReactNode | string; /** * The custom component to render next to search. */ children: null | ((filteredAndSortedData: any, searchText: string, columns: any) => JSX.Element | ReactNode); /** * Callback fired when the page, page size, sort or sort direction is changed. * @param {number} page The page selected. * @param {number} pageSize The number of rows in a page. * @param {string} sort The field sorted. * @param {string} sortDirection The direction of the sort. * @param {boolean} fetchOnPageChange If `true`, the callback is fired when the page is changed. */ fetchOnPageChange: null | ((page: number, pageSize: number, searchText: string, sort: string, sortDirection: GridSortDirection) => void); /** * for paginated api as the table does not have all the data to calculate the total number of rows */ rowsCount: null | number; /** * * if the export is custom. * */ customExport: null | ((filteredAndSortedData: any, searchText: string, columns: any, conditionalFormatting?: any) => void); /** * Callback fired when filter is changed with filters as arguments. * */ onFilterChange: null | ((filters: FilterFieldProps[]) => void); /** * Conditional formatting rules to apply to cells/rows. * Rules evaluated independently (after filters/sorts). * Multiple rules; later rules override on conflicts based on order/priority. * @default [] */ conditionalFormatting: GridConditionalFormattingRule[]; /** * Callback fired when conditional formatting rules change. */ onConditionalFormattingChange: null | ((rules: GridConditionalFormattingRule[]) => void); /** * custom placeholder for the search field. */ searchPlaceholder: string; } type DataGridProps = Partial & { pagination?: true; }; type DataGridComponent = React$1.ForwardRefExoticComponent & React$1.RefAttributes>; declare const ReactTabulous: DataGridComponent; export { ColumnType, ConditionalFormattingOperator, DataGridProps, DataGridPropsWithDefaultValues, FilterFieldProps, GridActionsColDef, GridBaseColDef, GridColDef, GridColumnPinningApi, GridColumnPinningInternalCache, GridColumnPinningState, GridConditionalFormattingProps, GridConditionalFormattingRule, GridDensity, GridPinnedColumns, GridPinnedPosition, GridRowId, GridSortDirection, GridValidRowModel, Logger, NativeColTypes, ReactTabulous };