UNPKG

angular-slickgrid

Version:

Slickgrid components made available in Angular

210 lines (209 loc) 13.2 kB
import { AfterViewInit, ApplicationRef, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, TemplateRef } from '@angular/core'; import { BackendService, BackendServiceApi, BasePaginationComponent, Column, EventSubscription, ExternalResource, Locale, Metrics, Pagination, PaginationMetadata, RxJsFacade, SlickDataView, SlickEventHandler, SlickGrid } from '@slickgrid-universal/common'; import { ExtensionUtility, SlickGroupItemMetadataProvider, BackendUtilityService, CollectionService, ExtensionService, FilterFactory, FilterService, GridEventService, GridService, GridStateService, HeaderGroupingService, PaginationService, ResizerService, SharedService, SortService, TreeDataService } from '@slickgrid-universal/common'; import { EventPubSubService } from '@slickgrid-universal/event-pub-sub'; import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-component'; import { SlickFooterComponent } from '@slickgrid-universal/custom-footer-component'; import { TranslateService } from '@ngx-translate/core'; import type { AngularGridInstance, ExternalTestingDependencies, GridOption } from './../models/index'; import { TranslaterService } from '../services/translater.service'; import { AngularUtilService } from '../services/angularUtil.service'; import { SlickRowDetailView } from '../extensions/slickRowDetailView'; import { ContainerService } from '../services/container.service'; import * as i0 from "@angular/core"; export declare class AngularSlickgridComponent<TData = any> implements AfterViewInit, OnDestroy { protected readonly angularUtilService: AngularUtilService; protected readonly appRef: ApplicationRef; protected readonly cd: ChangeDetectorRef; protected readonly containerService: ContainerService; protected readonly elm: ElementRef; protected readonly translate: TranslateService; protected readonly translaterService: TranslaterService; protected forRootConfig: GridOption; protected _dataset?: TData[] | null; protected _columnDefinitions: Column[]; protected _currentDatasetLength: number; protected _darkMode: boolean; protected _eventHandler: SlickEventHandler; protected _eventPubSubService: EventPubSubService; protected _angularGridInstances: AngularGridInstance | undefined; protected _hideHeaderRowAfterPageLoad: boolean; protected _isAutosizeColsCalled: boolean; protected _isGridInitialized: boolean; protected _isDatasetInitialized: boolean; protected _isDatasetHierarchicalInitialized: boolean; protected _isPaginationInitialized: boolean; protected _isLocalGrid: boolean; protected _paginationOptions: Pagination | undefined; protected _registeredResources: ExternalResource[]; protected _scrollEndCalled: boolean; dataView: SlickDataView; slickGrid: SlickGrid; groupingDefinition: any; groupItemMetadataProvider?: SlickGroupItemMetadataProvider; backendServiceApi?: BackendServiceApi; locales: Locale; metrics?: Metrics; showPagination: boolean; serviceList: any[]; totalItems: number; paginationData?: { gridOptions: GridOption; paginationService: PaginationService; }; subscriptions: EventSubscription[]; slickEmptyWarning?: SlickEmptyWarningComponent; slickFooter?: SlickFooterComponent; slickPagination?: BasePaginationComponent; paginationComponent: BasePaginationComponent | undefined; slickRowDetailView?: SlickRowDetailView; backendUtilityService: BackendUtilityService; collectionService: CollectionService; extensionService: ExtensionService; extensionUtility: ExtensionUtility; filterFactory: FilterFactory; filterService: FilterService; gridEventService: GridEventService; gridService: GridService; gridStateService: GridStateService; headerGroupingService: HeaderGroupingService; paginationService: PaginationService; resizerService: ResizerService; rxjs?: RxJsFacade; sharedService: SharedService; sortService: SortService; treeDataService: TreeDataService; customDataView: any; gridId: string; gridOptions: GridOption; get paginationOptions(): Pagination | undefined; set paginationOptions(newPaginationOptions: Pagination | undefined); get columnDefinitions(): Column[]; set columnDefinitions(columnDefinitions: Column[]); columnDefinitionsChange: EventEmitter<any>; get dataset(): any[]; set dataset(newDataset: any[]); get datasetHierarchical(): any[] | undefined; set datasetHierarchical(newHierarchicalDataset: any[] | undefined); get elementRef(): ElementRef; get backendService(): BackendService | undefined; get eventHandler(): SlickEventHandler; get gridContainerElement(): HTMLElement | null; /** GETTER to know if dataset was initialized or not */ get isDatasetInitialized(): boolean; /** SETTER to change if dataset was initialized or not (stringly used for unit testing purposes) */ set isDatasetInitialized(isInitialized: boolean); set isDatasetHierarchicalInitialized(isInitialized: boolean); get registeredResources(): ExternalResource[]; slickgridHeader?: TemplateRef<any>; slickgridFooter?: TemplateRef<any>; constructor(angularUtilService: AngularUtilService, appRef: ApplicationRef, cd: ChangeDetectorRef, containerService: ContainerService, elm: ElementRef, translate: TranslateService, translaterService: TranslaterService, forRootConfig: GridOption, externalServices: ExternalTestingDependencies); ngAfterViewInit(): void; ngOnDestroy(): void; destroy(shouldEmptyDomElementContainer?: boolean): void; disposeExternalResources(): void; emptyGridContainerElm(): void; /** * Define our internal Post Process callback, it will execute internally after we get back result from the Process backend call * Currently ONLY available with the GraphQL Backend Service. * The behavior is to refresh the Dataset & Pagination without requiring the user to create his own PostProcess every time */ createBackendApiInternalPostProcessCallback(gridOptions: GridOption): void; initialization(eventHandler: SlickEventHandler): void; /** * On a Pagination changed, we will trigger a Grid State changed with the new pagination info * Also if we use Row Selection or the Checkbox Selector with a Backend Service (Odata, GraphQL), we need to reset any selection */ paginationChanged(pagination: PaginationMetadata): void; /** * When dataset changes, we need to refresh the entire grid UI & possibly resize it as well * @param dataset */ refreshGridData(dataset: any[], totalCount?: number): void; setData(data: TData[], shouldAutosizeColumns?: boolean): void; /** * Check if there's any Pagination Presets defined in the Grid Options, * if there are then load them in the paginationOptions object */ protected setPaginationOptionsWhenPresetDefined(gridOptions: GridOption, paginationOptions: Pagination): Pagination; setDarkMode(dark?: boolean): void; /** * Dynamically change or update the column definitions list. * We will re-render the grid so that the new header and data shows up correctly. * If using i18n, we also need to trigger a re-translate of the column headers */ updateColumnDefinitionsList(newColumnDefinitions: Column[]): void; /** * Show the filter row displayed on first row, we can optionally pass false to hide it. * @param showing */ showHeaderRow(showing?: boolean): boolean; /** * Toggle the empty data warning message visibility. * @param showWarning */ displayEmptyDataWarning(showWarning?: boolean): void; /** * Loop through all column definitions and copy the original optional `width` properties optionally provided by the user. * We will use this when doing a resize by cell content, if user provided a `width` it won't override it. */ protected copyColumnWidthsReference(columnDefinitions: Column[]): void; protected bindDifferentHooks(grid: SlickGrid, gridOptions: GridOption, dataView: SlickDataView): void; protected bindBackendCallbackFunctions(gridOptions: GridOption): void; protected addBackendInfiniteScrollCallback(): void; protected bindResizeHook(grid: SlickGrid, options: GridOption): void; protected executeAfterDataviewCreated(_grid: SlickGrid, gridOptions: GridOption): void; /** When data changes in the DataView, we'll refresh the metrics and/or display a warning if the dataset is empty */ protected handleOnItemCountChanged(currentPageRowItemCount: number, totalItemCount: number): void; protected initializePaginationService(paginationOptions: Pagination): void; /** Load the Editor Collection asynchronously and replace the "collection" property when Observable resolves */ protected loadEditorCollectionAsync(column: Column): void; protected insertDynamicPresetColumns(columnId: string, gridPresetColumns: Column[]): void; /** Load any possible Columns Grid Presets */ protected loadColumnPresetsWhenDatasetInitialized(): void; /** Load any possible Filters Grid Presets */ protected loadFilterPresetsWhenDatasetInitialized(): void; /** * local grid, check if we need to show the Pagination * if so then also check if there's any presets and finally initialize the PaginationService * a local grid with Pagination presets will potentially have a different total of items, we'll need to get it from the DataView and update our total */ protected loadLocalGridPagination(dataset?: any[]): void; /** Load any Row Selections into the DataView that were presets by the user */ protected loadRowSelectionPresetWhenExists(): void; hasBackendInfiniteScroll(gridOptions?: GridOption): boolean; protected mergeGridOptions(gridOptions: GridOption): GridOption; /** Add a register of a new external resource, user could also optional dispose all previous resources before pushing any new resources to the resources array list. */ registerExternalResources(resources: ExternalResource[], disposePreviousResources?: boolean): void; resetExternalResources(): void; /** Pre-Register any Resource that don't require SlickGrid to be instantiated (for example RxJS Resource & RowDetail) */ protected preRegisterResources(): void; protected initializeExternalResources(resources: ExternalResource[]): void; protected registerResources(): void; /** Register the RxJS Resource in all necessary services which uses */ protected registerRxJsResource(resource: RxJsFacade): void; /** * Render (or dispose) the Pagination Component, user can optionally provide False (to not show it) which will in term dispose of the Pagination, * also while disposing we can choose to omit the disposable of the Pagination Service (if we are simply toggling the Pagination, we want to keep the Service alive) * @param {Boolean} showPagination - show (new render) or not (dispose) the Pagination * @param {Boolean} shouldDisposePaginationService - when disposing the Pagination, do we also want to dispose of the Pagination Service? (defaults to True) */ protected renderPagination(showPagination?: boolean): void; /** * Takes a flat dataset with parent/child relationship, sort it (via its tree structure) and return the sorted flat array * @param {Array<Object>} flatDatasetInput - flat dataset input * @param {Boolean} forceGridRefresh - optionally force a full grid refresh * @returns {Array<Object>} sort flat parent/child dataset */ protected sortTreeDataset<T>(flatDatasetInput: T[], forceGridRefresh?: boolean): T[]; /** Prepare and load all SlickGrid editors, if an async editor is found then we'll also execute it. */ protected loadSlickGridEditors(columnDefinitions: Column<TData>[]): Column<TData>[]; protected suggestDateParsingWhenHelpful(): void; /** * When the Editor(s) has a "editor.collection" property, we'll load the async collection. * Since this is called after the async call resolves, the pointer will not be the same as the "column" argument passed. */ protected updateEditorCollection<T = any>(column: Column<T>, newCollection: T[]): void; static ɵfac: i0.ɵɵFactoryDeclaration<AngularSlickgridComponent<any>, [null, null, null, null, null, { optional: true; }, { optional: true; }, null, null]>; static ɵcmp: i0.ɵɵComponentDeclaration<AngularSlickgridComponent<any>, "angular-slickgrid", never, { "customDataView": { "alias": "customDataView"; "required": false; }; "gridId": { "alias": "gridId"; "required": false; }; "gridOptions": { "alias": "gridOptions"; "required": false; }; "paginationOptions": { "alias": "paginationOptions"; "required": false; }; "columnDefinitions": { "alias": "columnDefinitions"; "required": false; }; "dataset": { "alias": "dataset"; "required": false; }; "datasetHierarchical": { "alias": "datasetHierarchical"; "required": false; }; }, { "columnDefinitionsChange": "columnDefinitionsChange"; }, ["slickgridHeader", "slickgridFooter"], never, false, never>; }