UNPKG

@limetech/lime-elements

Version:
187 lines 5.76 kB
import { EventEmitter } from '../../stencil-public-runtime'; import { Column, TableParams, ColumnSorter, ColumnAggregate, RowData } from './table.types'; import { Layout } from './layout'; import { Languages } from '../date-picker/date.types'; /** * @exampleComponent limel-example-table * @exampleComponent limel-example-table-custom-components * @exampleComponent limel-example-table-header-menu * @exampleComponent limel-example-table-movable-columns * @exampleComponent limel-example-table-sorting-disabled * @exampleComponent limel-example-table-local * @exampleComponent limel-example-table-remote * @exampleComponent limel-example-table-activate-row * @exampleComponent limel-example-table-selectable-rows * @exampleComponent limel-example-table-default-sorted * @exampleComponent limel-example-table-layout-default * @exampleComponent limel-example-table-layout-stretch-last-column * @exampleComponent limel-example-table-layout-stretch-columns * @exampleComponent limel-example-table-layout-low-density * @exampleComponent limel-example-table-interactive-rows */ export declare class Table { /** * Data to be displayed in the table */ data: object[]; /** * Columns used to display the data */ columns: Column[]; /** * Set to either `local` or `remote` to change how the table handles the * loaded data. When in `local` mode, all sorting and pagination will be * done locally with the data given. When in `remote` mode, the consumer * is responsible to give the table new data when a `load` event occurs */ mode: 'local' | 'remote'; /** * Defines the layout of the table, based on how width of the columns are calculated. * * - `default`: makes columns as wide as their contents. * - `stretchLastColumn`: makes columns as wide as their contents, stretch the last column to fill up the remaining table width. * - `stretchColumns`: stretches all columns to fill the available width when possible. * - `lowDensity`: makes columns as wide as their contents, and creates a low density and airy layout. */ layout: Layout; /** * Number of rows per page */ pageSize: number; /** * The number of total rows available for the data */ totalRows: number; /** * The initial sorted columns */ sorting: ColumnSorter[]; /** * Active row in the table */ activeRow: RowData; /** * Set to `true` to enable reordering of the columns by dragging them */ movableColumns: boolean; /** * Set to `true` to trigger loading animation */ loading: boolean; /** * The page to show */ page: number; /** * Emitted when `mode` is `local` the data is sorted */ sort: EventEmitter<ColumnSorter[]>; /** * Emitted when a new page has been set */ changePage: EventEmitter<number>; /** * A message to display when the table has no data */ emptyMessage: string; /** * Column aggregates to be displayed in the table */ aggregates: ColumnAggregate[]; /** * Enables row selection */ selectable: boolean; /** * Selected data. Requires `selectable` to be true. */ selection: object[]; /** * Defines the language for translations. */ language: Languages; /** * Emitted when `mode` is `remote` and the table is loading new data. The * consumer is responsible for giving the table new data */ load: EventEmitter<TableParams>; /** * Emitted when a row is activated */ activate: EventEmitter<object>; /** * Emitted when the columns have been changed */ changeColumns: EventEmitter<Column[]>; /** * Emitted when the row selection has been changed */ select: EventEmitter<object[]>; /** * Emitted when the select all rows state is toggled */ selectAll: EventEmitter<boolean>; private host; private currentLoad; private tabulator; private pool; private columnFactory; private firstRequest; private currentSorting; private tableSelection; private shouldSort; constructor(); componentWillLoad(): void; componentDidLoad(): void; disconnectedCallback(): void; protected totalRowsChanged(): void; protected pageSizeChanged(): void; protected pageChanged(): void; protected activeRowChanged(): void; protected updateData(newData?: RowData[], oldData?: RowData[]): void; protected updateColumns(newColumns: Column[], oldColumns: Column[]): void; protected updateAggregates(newAggregates: ColumnAggregate[], oldAggregates: ColumnAggregate[]): void; protected updateSelection(newSelection: any[]): void; protected updateSelectable(): void; protected updateSorting(newValue: ColumnSorter[], oldValue: ColumnSorter[]): void; private shouldReplaceData; private areEqualIds; private isSameOrder; private areSameColumns; private haveSameAggregateFields; private init; private initTabulatorComponent; private initTableSelection; private setSelection; private updateMaxPage; private getOptions; private getInitialSorting; private getColumnSorter; private getColumnDefinitions; private addColumnAggregator; private getAjaxOptions; private handleAjaxRequesting; private getPaginationOptions; private requestData; private isRemoteMode; private handleDataSorting; private handlePageLoaded; private handleRenderComplete; private onClickRow; private getActiveRows; private getActiveRowsData; private selectAllOnChange; private formatRows; private formatRow; private isActiveRow; private calculatePageCount; private hasAggregation; private getColumnOptions; private handleMoveColumn; private findColumn; render(): any; private renderSelectAll; private renderEmptyMessage; private getTranslation; } //# sourceMappingURL=table.d.ts.map