import { type ModelsTableServerPaginatedArgs } from '../interfaces/components/models-table-server-paginated-args.interface'; import { type DataRequestQuery } from '../interfaces/data-request-query.interface'; import { type FilterQueryParameters } from '../interfaces/filter-query-parameters.interface'; import ModelsTableColumn from '../utils/emt/emt-column'; import ModelsTable from './models-table'; /** * Table-component with pagination, sorting and filtering. * * It should be used when pagination, filtering and sorting are done on the server-side. Otherwise, {@link Core.ModelsTable | ModelsTable} should be used. * * This component extends the base models-table component. For the end user, it can be used (nearly) the same: * * ```html * * ``` * * Usage with block context: * * ```html * * * * * * * * ``` * * Here `doQuery` is an action-handler used when user interacts with table by changing page number, page size, global or column filter, sorting etc. * * `itemsCount` and `pagesCount` show how many rows are in the table's page and how many pages are overall. * * ModelsTableServerPaginated yields same components, actions and properties as a ModelsTable does. Check its docs for more info. * * Check own docs for each component to get detailed info. * * ModelsTableServerPaginated has a lot of options you may configure, but there are six required properties called `data`, `columns`, `themeInstance`, `doQuery`, `itemsCount` and `pagesCount`. * * A few things to notice: * * - When using `filterWithSelect` for a column, you must use `predefinedFilterOptions`, because the automatic loading of possible filter values cannot work here. * - There is a new optional field `filteredBy` for columns, which works much like `sortedBy`: if set, this field will be used as query parameter, otherwise it will use the `propertyName`. * - Sorting will not use multipleColumnSorting, it will only sort by one column. * - If you set `sortedBy: false` on a column, sorting will be disabled for this column. * * There are a couple of things which can be configured to adapt to your API: * * ```js * // The time to wait until new data is actually loaded. * // This can be tweaked to avoid making too many server requests. * debounceDataLoadTime: 500, * * // The query parameters to use for server side filtering / querying. * filterQueryParameters: { * globalFilter: 'search', * sort: 'sort', * sortDirection: 'sortDirection', * page: 'page', * pageSize: 'pageSize' * }, * ``` * * This default configuration would try to get the total page count from `model.get('meta.pagesCount')` and the total item count from `model.get('meta.itemsCount')`, and would then go on to build the following query: * * ```js * columns: [ * { * propertyName: 'name', * filteredBy: 'model_name' * } * ] * * // after searching globally for "searchtexthere" * // and in the name column for "filterforname", * // and going to page 2, * // the following query would be built: * ?page=2&pageSize=50&search=searchtexthere&sort=name&sortDirection=ASC&model_name=filterforname * ``` */ export default class ModelsTableServerPaginated extends ModelsTable { /** * The time to wait until new data is actually loaded. * This can be tweaked to avoid making too many server requests. * * @default 500 */ protected get debounceDataLoadTime(): number; protected _filterQueryParameters: { globalFilter: string; sort: string; sortDirection: string; page: string; pageSize: string; }; /** * The query parameters to use for server side filtering / querying. */ protected get filterQueryParameters(): FilterQueryParameters; get filteredContent(): any; /** * For server side filtering, arrangedContent is same as the filtered content */ get arrangedContent(): any; /** * For server side filtering, visibleContent is same as the filtered content */ get visibleContent(): any; get arrangedContentLength(): number; get pagesCount(): number; /** * The index of the last item that is currently being shown. */ get lastIndex(): number; /** * This function actually loads the data from the server */ protected _loadData(): any; /** * Actually set the filter on a query. * This can be overwritten for special case handling. * Note that this will mutate the given query object! */ protected setQueryFilter(query: DataRequestQuery, _: ModelsTableColumn, filterTitle?: string, filter?: string): void; /** * Wrapper for sorting query when single column sorting is used */ protected singleColumnSortingWrapper(query: DataRequestQuery, sortBy: string, sortDirection: string): DataRequestQuery; /** * Wrapper for sorting query when multi columns sorting is used */ protected multipleColumnsSortingWrapper(query: DataRequestQuery, sortProperties: string[]): DataRequestQuery; protected _loadDataOnce(): void; constructor(owner: unknown, args: ModelsTableServerPaginatedArgs); /** * @event sort */ sort(column: ModelsTableColumn): void; /** * @event changeColumnFilter */ changeColumnFilter(newColumnFilterValue: string, column: ModelsTableColumn): void; /** * @event changeGlobalFilter */ changeGlobalFilter(newGlobalFilterValue: string): void; /** * @event changePageSize */ changePageSize(newPageSize: string): void; /** * @event goToPage */ goToPage(pageNumber: number): void; /** * @event clearFilters */ clearFilters(): void; } //# sourceMappingURL=models-table-server-paginated.d.ts.map