UNPKG

@rxap/material-table-system

Version:

This package provides a set of Angular directives, components, and services to enhance and customize Angular Material tables. It includes features such as row selection, column filtering, expandable rows, table actions, and more. The goal is to simplify c

77 lines (76 loc) 3.65 kB
import { Overlay } from '@angular/cdk/overlay'; import { ChangeDetectorRef, ElementRef, Injector, OnInit, Renderer2, ViewContainerRef } from '@angular/core'; import { MatIconButton } from '@angular/material/button'; import { ThemePalette } from '@angular/material/core'; import { MatSnackBar } from '@angular/material/snack-bar'; import { MatTooltip } from '@angular/material/tooltip'; import { ConfirmDirective } from '@rxap/components'; import { TableDataSourceDirective } from '../table-data-source.directive'; import { TableActionMethodOptions } from './decorators'; import { TableRowActionMethod } from './types'; import * as i0 from "@angular/core"; export declare abstract class AbstractTableRowAction<Data extends Record<string, any>> extends ConfirmDirective implements OnInit { protected readonly renderer: Renderer2; protected readonly cdr: ChangeDetectorRef; protected readonly vcr: ViewContainerRef; protected readonly tableDataSourceDirective: TableDataSourceDirective; protected readonly snackBar: MatSnackBar; protected matButton: MatIconButton | null; protected matTooltip: MatTooltip | null; protected readonly injector: Injector; abstract type: string; errorMessage?: string; successMessage?: string; /** * true - after the action is executed the table datasource is refreshed */ refresh?: boolean; color?: ThemePalette; readonly isHeader: boolean; protected options: TableActionMethodOptions | null; private readonly executingDirective?; private _currentStatus; private readonly actionMethodList; private _actionDisabled; constructor(renderer: Renderer2, overlay: Overlay, elementRef: ElementRef, actionMethodList: Array<TableRowActionMethod<Data>> | TableRowActionMethod<Data>, cdr: ChangeDetectorRef, vcr: ViewContainerRef, tableDataSourceDirective: TableDataSourceDirective, snackBar: MatSnackBar, matButton: MatIconButton | null, matTooltip: MatTooltip | null, injector: Injector); private _hasConfirmDirective; set hasConfirmDirective(value: any); ngOnInit(): void; onConfirmed(): Promise<void>; onClick($event: Event): Promise<void>; execute(): Promise<void>; protected abstract getElementList(): Data[]; /** * Disables the action. If the button is pressed the action is NOT executed * * Hint: the button is set to disabled = true to prevent any conflict with * extern button enable features linke : rxapHasEnablePermission * @protected */ protected setButtonDisabled(): void; /** * Enables the action. If the button is pressed the action is executed * * TODO : find a way to communicate the disabled state between the features * Hint: the button is set to disabled = false to prevent any conflict with * extern button enable features linke : rxapHasEnablePermission * @protected */ protected setButtonEnabled(): void; /** * find all method instance in the actionMethodList member that * do not have a @TableActionMethod decorators * @private */ private findUntypedActionMethod; /** * find all method instance in the actionMethodList member that * do have a @TableActionMethod decorators with the current type * @private */ private findTypedActionMethod; private setStatus; private getTableActionOptions; static ɵfac: i0.ɵɵFactoryDeclaration<AbstractTableRowAction<any>, [null, null, null, null, null, null, null, null, { optional: true; }, { optional: true; }, null]>; static ɵprov: i0.ɵɵInjectableDeclaration<AbstractTableRowAction<any>>; }