UNPKG

@eclipse-scout/core

Version:
160 lines 9.33 kB
/// <reference types="jquery" /> import { BookmarkTableRowIdentifierDo, Event, EventHandler, Form, InitModelOf, LimitedResultInfoContributionDo, ObjectOrModel, Page, PageWithTableEventMap, PageWithTableModel, PropertyChangeEvent, SearchFormTableControl, Table, TableAllRowsDeletedEvent, TableControl, TableReloadEvent, TableReloadReason, TableRow, TableRowActionEvent, TableRowOrderChangedEvent, TableRowsDeletedEvent, TableRowsInsertedEvent, TableRowsUpdatedEvent } from '../../../index'; export declare class PageWithTable extends Page implements PageWithTableModel { model: PageWithTableModel; eventMap: PageWithTableEventMap; alwaysCreateChildPage: boolean; protected _tableRowDeleteHandler: EventHandler<TableRowsDeletedEvent | TableAllRowsDeletedEvent>; protected _tableRowInsertHandler: EventHandler<TableRowsInsertedEvent>; protected _tableRowUpdateHandler: EventHandler<TableRowsUpdatedEvent>; protected _tableRowActionHandler: EventHandler<TableRowActionEvent>; protected _tableRowOrderChangeHandler: EventHandler<TableRowOrderChangedEvent>; protected _tableDataLoadHandler: EventHandler<TableReloadEvent>; protected _tableControlsChangeHandler: EventHandler<PropertyChangeEvent<TableControl[]>>; protected _searchFormTableControlSearchHandler: EventHandler<Event<SearchFormTableControl>>; protected _searchFormTableControlResetHandler: EventHandler<Event<SearchFormTableControl>>; constructor(); protected _init(model: InitModelOf<this>): void; setAlwaysCreateChildPage(alwaysCreateChildPage: boolean): void; protected _initDetailTable(table: Table): void; protected _initDetailTableUiPreferences(table: Table): void; protected _destroyDetailTable(table: Table): void; protected _onTableRowsDeleted(event: TableRowsDeletedEvent | TableAllRowsDeletedEvent): void; protected _onTableRowsInserted(event: TableRowsInsertedEvent): void; protected _onTableRowsUpdated(event: TableRowsUpdatedEvent): void; protected _onTableRowAction(event: TableRowActionEvent): void; protected _onTableRowOrderChanged(event: TableRowOrderChangedEvent): void; protected _onTableReload(event: TableReloadEvent): void; protected _onTableControlsChange(e: PropertyChangeEvent<TableControl[]>): void; /** * Adds search and reset listener to the given {@link SearchFormTableControl}. */ protected _addSearchFormTableControlListeners(searchFormTableControl: SearchFormTableControl): void; /** * Removes search and reset listener from the given {@link SearchFormTableControl}. */ protected _removeSearchFormTableControlListeners(searchFormTableControl: SearchFormTableControl): void; protected _onSearchFormTableControlSearch(e: Event<SearchFormTableControl>): void; protected _onSearchFormTableControlReset(e: Event<SearchFormTableControl>): void; protected _createChildPageInternal(row: TableRow): Page; /** * @deprecated use {@link _createChildPage} instead */ createChildPage(row: TableRow): Page; /** * Override this method to create a {@link Page} for the given {@link TableRow}. * * By default, no page is created unless {@link alwaysCreateChildPage} is set to true. * In that case, an {@link AutoLeafPageWithNodes} is created. */ protected _createChildPage(row: TableRow): Page; createDefaultChildPage(row: TableRow): Page; loadChildren(): JQuery.Promise<any>; protected _createSearchFilter(): any; /** * Returns the {@link SearchFormTableControl} for the given {@link Table}, or `null` if no {@link SearchFormTableControl} is present. */ protected _findSearchFormTableControl(table: Table): SearchFormTableControl; /** * Returns the {@link SearchFormTableControl} for this page, or `null` if no {@link SearchFormTableControl} is present. */ getSearchFormTableControl(): SearchFormTableControl; /** * Returns the search form for this page, or `null` if no search form is present. */ getSearchForm(): Form; /** * Returns the exported data of the {@link #getSearchForm search form}, or `undefined` if no search form is present. */ getSearchFilter(): any; /** * Imports the given data into the {@link #getSearchForm search form}. If no search form is present, nothing happens. * * @param markAsSaved * If this optional parameter is set to `true`, the form state after the import is marked as the saved state, * i.e. pressing the reset button will revert the form to the new state. Otherwise, the saved state will not be * altered and pressing the reset button will revert the form to whatever was previously the saved state. */ setSearchFilter(searchFilter: any, markAsSaved?: boolean): void; /** * Resets the {@link #getSearchForm search form} to its saved state. If no search form is present, nothing happens. */ resetSearchFilter(): void; /** * Adds a {@link MaxRowCountContributionDo} to the given request. * Typically, this method should be used before sending a request in {@link _loadTableData} to attach the row limit constraints (if existing). * The contribution is only added if there is a row limit. Otherwise, the request remains untouched. * @example * protected override _loadTableData(searchFilter: MyRestrictionDo): JQuery.Promise<MyResponseDo> { * const request = scout.create(MyRequestDo, { * ... * restriction: searchFilter * }); * return ajax.postDataObject(url, this._withMaxRowCountContribution(request)); * } * @param dataObject The {@link DoEntity} to which the contribution should be added. * @returns the resulting request with the added contribution. */ protected _withMaxRowCountContribution<T>(dataObject: T): T; /** * see Java: AbstractPageWithTable#loadChildren that's where the table is reloaded and the tree is rebuilt, called by AbstractTree#P_UIFacade */ loadTableData(reloadReason?: TableReloadReason): JQuery.Promise<any>; /** * Get info needed to restore the selection after table data was loaded. * - {@link RestoreSelectionInfo.restoreSelection} is `true` if a child page of this page is currently selected. * - {@link RestoreSelectionInfo.selectedRowKey} is the row key (see {@link TableRow.getKeyValues}) of the row corresponding to the direct child page of this page that is currently selected or a parent of the currently selected page. */ protected _getRestoreSelectionInfo(): RestoreSelectionInfo; /** * Restores the selection by the given {@link RestoreSelectionInfo}. If there is no selected page for the current outline, the following page will be selected: * 1. The page corresponding to the selected row of the detail table of this page. * 2. The page corresponding to the row found by the given former selected row key (@see {@link RestoreSelectionInfo}). * 3. This page. */ protected _restoreSelection(restoreSelectionInfo?: RestoreSelectionInfo): void; /** * Override this method to load table data (rows to be added to table). * * This is an asynchronous operation working with a Promise. If table data load is successful, * {@link _onLoadTableDataDone} will be called. If a failure occurs while loading table data, * {@link _onLoadTableDataFail} will be called. * * To return static data, use a resolved promise: `return $.resolvedPromise({...});` * * @param searchFilter The search filter as exported by the search form or null. */ protected _loadTableData(searchFilter: any): JQuery.Promise<any>; /** * This method is called when table data load is successful. It should transform the table data * object to table rows and add them to the table. * * @param tableData data loaded by {@link _loadTableData} * @param restoreSelectionInfo information needed to restore the selection after table data was loaded */ protected _onLoadTableDataDone(tableData: any, restoreSelectionInfo?: RestoreSelectionInfo): void; protected _readLimitedResultInfo(numRows: number, limitedResultInfoDo?: LimitedResultInfoContributionDo): void; protected _getLimitedResultInfoDo(tableData: any): LimitedResultInfoContributionDo; protected _onLoadTableDataFail(error: any, restoreSelectionInfo?: RestoreSelectionInfo): void; protected _onLoadTableDataAlways(restoreSelectionInfo?: RestoreSelectionInfo): void; /** * This method converts the loaded table data, which can be any object, into table rows. * You must override this method unless tableData is already an array of table rows. */ protected _transformTableDataToTableRows(tableData: any): ObjectOrModel<TableRow>[]; getTableRowIdentifier(row: TableRow, allowObjectFallback?: boolean): BookmarkTableRowIdentifierDo; } /** * Object containing the info needed to restore the selection after table data was loaded. */ export type RestoreSelectionInfo = { /** * Whether the selection should be restored or not. */ restoreSelection: boolean; /** * Former selected row key. */ selectedRowKey: any[]; }; //# sourceMappingURL=PageWithTable.d.ts.map