import { AfterViewInit, ChangeDetectorRef, ElementRef, EmbeddedViewRef, EventEmitter, OnInit, QueryList, TemplateRef, ViewContainerRef, ViewRef } from '@angular/core'; import { UIColumnHandler } from '../../ul-lib.service'; import { Sort, PageEvent } from '../../Models/TableModels'; import { SearchRequest } from '../../Models/search-request'; import { Subscription } from 'rxjs/internal/Subscription'; import { ListItem } from '../../ul-lib.service'; import { UIBasicFilterComponent } from '../uibasic-filter/uibasic-filter.component'; import { UIBasicTableColumnComponent } from '../uibasic-table-column-component/uibasic-table-column-component.component'; import { UINestedTableRowComponent } from '../uinested-table-row/uinested-table-row.component'; import { BehaviorSubject, Observable } from 'rxjs'; import { UIAdvancedFilterComponent } from '../uiadvanced-filter/uiadvanced-filter.component'; import { UIModalViewComponent } from '../uimodal-view/uimodal-view.component'; import { IFilterItem } from '../../Models/FilterItemModel'; import { UlTableRowDirective } from '../../Directives/ul-table-row.directive'; import { RowViewDirective } from '../../Directives/row-view.directive'; import { ULHeaderCellDirective } from '../../Directives/ul-header-cell.directive'; import * as i0 from "@angular/core"; export interface TableCacheContext { $implicit: T; $index: number; selectedExpandRow?: T; rowSelected: boolean; rowTriggered: boolean; nestedComponent: UINestedTableRowComponent | undefined; columns: UIColumnHandler[]; cell?: UIColumnHandler; isDataRow: boolean; } export interface TableRenderCache { dataRow: EmbeddedViewRef> | undefined; nestedRow: EmbeddedViewRef> | undefined; context: TableCacheContext; } export declare class UIBasicTableComponent implements OnInit, AfterViewInit { private cd; vcr: ViewContainerRef; dataSourceView: BehaviorSubject; ItemsCount: number; PageCount: BehaviorSubject; PgIndex: number; isLoading: boolean; isInitialized: boolean; DataDelegate: (sr: SearchRequest) => void; SelectedExpandRow: BehaviorSubject; SelectedExpandRowItem: BehaviorSubject; SavedSort: BehaviorSubject; private SavedFilter; private savedSubscription; columnBuilder: UIColumnHandler[] | undefined; private refreshSubscription; refreshCache: BehaviorSubject; private _renderCache; availablePages: BehaviorSubject; defaultSort: Sort | undefined; pageSizeOptions: number[]; PageSize: number; trackBy?: (row: T | undefined) => any; dataSource: any; columns: BehaviorSubject; searchRequest: SearchRequest; headerClass: string; containerClass: string; class: string; footerClass: string; showFilter: boolean; nestedClickEnabled?: string; refreshTrigger?: Observable; triggerHandle?: (source: T, tableSource: BehaviorSubject) => void; disablePaging?: string; expandRowIndex?: number; isReactive?: string; pageRange: number; filterContainer: string; autoScroll?: string; hideRefresh?: string; rowAction: EventEmitter; fltr?: UIBasicFilterComponent; rowOutlet: RowViewDirective; defaultRow: UlTableRowDirective; nestedContainer: TemplateRef; defaultTemplate: TemplateRef; filterModal?: UIModalViewComponent; currentTable?: ElementRef; columnComponents?: QueryList; nestedRow?: UINestedTableRowComponent; advancedFilter?: UIAdvancedFilterComponent; rowDef?: QueryList; headerDef?: ULHeaderCellDirective; displayStyle: string; constructor(cd: ChangeDetectorRef, vcr: ViewContainerRef); ngOnInit(): void; closeModal(): void; clearFilter(): void; clearSort(): void; getRowDef(): UlTableRowDirective; onRefreshClick(ev: any): void; handleFilter(filterItems: IFilterItem[]): void; setFilter(filterItems: IFilterItem[]): void; /** * Used to configure columns for target table using either [ContentChildren] 'columnComponents' or [Input] 'columns'. * @source */ configureColumns(): void; private getDataSource; /** * Used to determine if a column is sortable for header row. * @source * @param dataKey - DataKey for target column * @returns If target column has sortable enabled. */ isSortableByDataKey(dataKey: string): boolean; /** * Used to open nested row if the a nestedRow definition was provided. * @source * @param r - Target Row that was clicked. */ ExpandRowClicked(r: T): void; /** * Compare RowID or DataRow to determine if a row matched the selected row. * @param rowTarget - Target Data Row to compare with selected row. * @source */ compareRowId(rowTarget: T): boolean; /** * Toggle selected/nested row based on raw data row. * @param r - Data Row * @source */ ToggleSelectedRow(r: T | undefined): void; /** * Close Nested Row if opened * @source */ CloseNestedRow(): void; /** * Checks previous sortDirection and loops between the options each time its clicked. 'asc' | 'desc' | '' * @source * @returns - SortDirection to switch based on function logic. */ private GetSortSwitcher; /** * Constructs array for key/value relationship for pageOption selection. * @source * @returns Gets a list of page options from 'pageSizeOptions' in key/value format. */ GetPageOptionsList(): ListItem[]; /** * Sets new Page size and refresh table. * @source * @param PageSelection - Value from basicInputField select change event. */ UpdatePageSize(PageSelection: any): void; pageChangeSelected(ev: any): void; /** * Takes in EventEmitter from UIBasicFilter to reconfigure filters and refresh table with new filters. * @source * @param selectedFilters - Filters that have been set by UIBasicFilter */ GetFilters(selectedFilters: any[]): void; /** * * Sets new savedSort then refresh table. * @source * @param dataKey - Target column */ SortClicked(dataKey: string): void; forceClearRows(): void; ngAfterViewInit(): void; /** * Pre-configures some handling for staging subscription, sorting and searchRequest. * @source * @param subFunction - Use as function to carry over the SearchRequest object and build data. * @returns - Delegate with searchRequest */ GetDelegate(subFunction: (req: SearchRequest) => Promise): (sr: SearchRequest) => void; forceRefresh(): void; /** * Used to sort data when there is no searchRequest available for dataSource. Sorts using raw data no new GET request. * @source * @param sState - Target Sort Direction */ localSort(sState: Sort): void; /** * Uses page information and datasource count to determine the page index, count and range. * @source * * @returns - Gets page index description. */ GetPageCountDescription(): string; /** * Sets target sort direction and performs GET using searchRequest and calling the observable to refresh table. * @source * @param sState - Sort Direction */ sortDataTable(sState: Sort): void; /** * Refreshes table with current searchRequest. * @source */ refresh(): void; /** * Builds data after completion of observable and determines how to build the data based on return Object information. * @source * @param res - Result data table data (Any[]|Any) * @param searchRequestUpdate - Search Request */ BuildDelegate(res: any, searchRequestUpdate: SearchRequest): void; /** * This is meant to filter, sort and refresh the table. * @source * @param filterSelection - Array of filter selection * @param dataList - dataSource to filter. */ ProcessFilters(filterSelection: ListItem[], dataList: T[]): void; /** * Get observable datasource subscription for obtaining data to populate table. * @source * @returns - Gets delegate for subscribing to dataSource observable and receiving data. */ GetDelegateFromServiceParam(): (sr: SearchRequest) => void; /** * Gets Max page index * @source * @param n - Target page index * @returns - Max page index */ getMaxPage(n: number): number; /** * Gets Min page index * @source * @param n - Target page index * @returns - Min page index */ getMinPage(n: number): number; scrollToTable(): void; /** * Selects new page and refresh table. * @source * @param PageNumber - Target Page Number */ generatePageEvent(PageNumber: number): void; /** * Sets page information based on page event and refresh page. * @source * @param e - Target Page Event */ refreshPage(e: PageEvent): void; /** * Builds table with raw data passed in 'inData'. * @source * @param inData - Raw datasource data */ BuildData(inData?: T[]): void; /** * Compare 1 dataRow with another. * @source * @param dataItem - DataRow * @param _dataItem - Comparable DataRow */ compareTrackBy(dataItem: T, _dataItem?: T): Boolean; /** * Insert Row in RowOutlet Container. * @source * @param row - Cached Table Render row (Contains views) * @param targetIndex - Index to insert view */ insertRowInContainer(row: TableRenderCache, targetIndex?: number): ViewRef[]; /** * Get an array of the ViewRefs inside of the rowOutlet viewContainerRef * @source */ getViewRefs(): ViewRef[]; /** * Delete row viewRefs from the viewContainer * @source * @param views - Array of views to Delete from rowOutlet ViewContainer */ deleteByViews(views: ViewRef[]): void; /** * Delete row from container based on TableRenderCache * @source * @param row - Table Row Render Cache */ deleteRowInContainer(row: TableRenderCache): void; /** * Apply Expanded row action to reveal or close a selected row * @source * @param targetDataRow - Row data that corresponds with the target viewRef seleceted */ private applyExpandRow; /** * Update Cell Values and refreshes the rows with new values that correspond to correct View Row * @source * @param rows - Dataset from the DatasourceView to use to apply new Data */ private updateValues; /** * This will trigger a target row to expand its nested row * @source * @param expandRowData - Target row from DataSourceView * @param views - Uses a source of ViewRefs to perform action */ private expandRow; /** * This function takes in a array of columns based on your column definitions to re-organize the columns or hide/show some columns. * @source * @param columnNames - Array of dataKey/display in the order that you desire for your table */ reshuffleColumns(columnNames?: string[]): void; private performMoves; /** * Applies Delete/Insert/Merge actions to the rendered rows to ultimately output a view that matches the DatasourceView exactly. * @source * @param rows - Dataset from the DatasourceView to use to apply new Data */ private renderUpdate; /** * Subscribes to DatasourceView observable and ExpandRow handle. Initializes rendering for all table rows. * @source */ renderRows(): void; /** * Builds table on refresh and on init. * @source * @param inSource - Raw datasource data */ private build; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵcmp: i0.ɵɵComponentDeclaration, "ul-table", never, { "defaultSort": { "alias": "defaultSort"; "required": false; }; "pageSizeOptions": { "alias": "pageSizeOptions"; "required": false; }; "PageSize": { "alias": "PageSize"; "required": false; }; "trackBy": { "alias": "trackBy"; "required": false; }; "dataSource": { "alias": "dataSource"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "searchRequest": { "alias": "searchRequest"; "required": false; }; "headerClass": { "alias": "headerClass"; "required": false; }; "containerClass": { "alias": "containerClass"; "required": false; }; "class": { "alias": "class"; "required": false; }; "footerClass": { "alias": "footerClass"; "required": false; }; "showFilter": { "alias": "showFilter"; "required": false; }; "nestedClickEnabled": { "alias": "nestedClickEnabled"; "required": false; }; "refreshTrigger": { "alias": "refreshTrigger"; "required": false; }; "triggerHandle": { "alias": "triggerHandle"; "required": false; }; "disablePaging": { "alias": "disablePaging"; "required": false; }; "expandRowIndex": { "alias": "expandRowIndex"; "required": false; }; "isReactive": { "alias": "isReactive"; "required": false; }; "pageRange": { "alias": "pageRange"; "required": false; }; "filterContainer": { "alias": "filterContainer"; "required": false; }; "autoScroll": { "alias": "autoScroll"; "required": false; }; "hideRefresh": { "alias": "hideRefresh"; "required": false; }; }, { "rowAction": "rowAction"; }, ["nestedRow", "advancedFilter", "headerDef", "columnComponents", "rowDef"], ["[search]", "[empty]"], true, never>; }