import * as React from 'react'; import { Data, Model } from '@singularsystems/neo-core'; import { DataViewContext } from '../../React/DataView'; import { IButtonOptions } from '@singularsystems/neo-core/dist/Components/ButtonOptions'; import { ItemCallback } from '../PropTypes'; export type GridSection = "header" | "body" | "footer"; export type BorderType = "standard" | "borderless" | "bordered"; export declare class GridContextParams { currentItem: T; section: GridSection; doneStaticSetup: boolean; inFirstRowInGroup: boolean; columnCount: number; expandProperty?: Model.IPropertyInstance; hideExpandButton?: boolean; expandAll?: boolean; hasSummaries: boolean; dataView: Data.DataViewBase; get inBody(): boolean; } export declare const GridContext: React.Context>; export interface IGridProps extends Omit, "children"> { /** * Datasource of the Grid. Usually a neo List, but can be a js array. This is not required if the grid is nested in * a DataViewProvider like a Pager or DataScroller */ items?: T[] | Data.DataViewBase; /** True if the add new button should be shown in the footer. Requires the datasource to be a neo List. */ showAddButton?: boolean; /** Add new button options. Will cause add new button to be shown. */ addButton?: IButtonOptions; /** Function used to filter items out of the datasource. */ filterPredicate?: (item: T, index: number) => boolean; /** * The unique key of the items being displayed. This is only necessary if the items dont have an entityIdentifier * property (non ModelBase items). */ keyProperty?: keyof T; /** * Set to false if you don't want to allow sorting. */ allowSort?: boolean; /** * Set to true expand all child rows. All expand buttons will be hidden. */ expandAll?: boolean; /** * Set to true collapse all child rows. All expand buttons will be hidden. */ collapseAll?: boolean; /** * Initial sort column. */ initialSort?: keyof T | (keyof T)[]; initialSortAscending?: boolean | boolean[]; children: ItemCallback; /** @deprecated Use `borderType` instead. */ isBordered?: boolean; /** @deprecated Use `borderType` instead. */ isBorderless?: boolean; /** * Specifies the bootstrap border type. This can also be specified globally in Misc.Settings.grid.borderType. * - Standard = Only horizontal borders. * - Bordered = All borders. * - Borderless = No borders. */ borderType?: BorderType; /** * When specified, every alternating row will receive a slightly darker background color. * Note, this will not work correctly if your grid has child rows. See the neo react demo pages for a solution. */ isStriped?: boolean; /** When specified, a background color will be applied on a row if it is being hovered over. */ showHover?: boolean; /** When specified, the table size will be reduced (by reducing the padding sizes in each cell by half). */ isSmallTable?: boolean; /** Additional footer row(s) to display below the main footer row. */ footerContent?: (data: T[]) => React.ReactNode; /** * Additional content to show next to the add new button. * * Set `showAddButton = false` if you don't want the default button. */ footerButtons?: () => React.ReactNode; /** * Will cause the header to stick to the top of the screen / scroll element when scrolling. * Note: if your app has a fixed header, you need to specify this in the global neo settings. */ stickyHeader?: boolean; /** * When true, the index parameter passed to the render function will be set. * This has performance implications, as each row needs to be re-rendered on sorting or insertion of items. */ enableRowIndexes?: boolean; } export default class Grid extends React.Component> { static contextType: React.Context>; context: React.ContextType; private gridContext; private prevItems?; private headerItem; private domRef; private stickyHeaderHelper?; constructor(props: IGridProps); componentDidMount(): void; componentWillUnmount(): void; render(): React.JSX.Element; private setInitialSort; }