import { ActivatedRoute } from '@angular/router'; import { Observable } from 'rxjs'; import { MemoizedSelector, Action } from '@ngrx/store'; import { TemplateRef } from '@angular/core'; import { IAbstractViewComponent } from '../dialog/abstract-view.component.interface'; import { KeyValue } from 'ngrx-forms'; import { IWithIdentifier, DefaultTemplateNames, ActionButtonDefinition, FunctionOrConstant, CssStyle, CssClass, DisplayValue } from '@digitaix/types'; export interface TableSortingState { enabled: boolean; direction: -1 | 0 | 1; } export interface DxTableTemplates { [key: string]: TemplateRef>; } /** * @deprecated */ export declare type FirebaseTableTemplates = DxTableTemplates; export declare type DxTableActionFunction = (row: D, definition: TableState) => R; export declare type DxTableActionType = new (tableId: string, row: D, collectionPath?: string) => Action; /** * @deprecated use ActionButtonDefinition */ export interface DxTableAction { tooltip?: string | DxTableActionFunction; action: DxTableActionType; icon: string | DxTableActionFunction; color?: string | DxTableActionFunction; svg?: boolean | DxTableActionFunction; name?: string; disabled?: boolean | DxTableActionFunction; hide?: boolean | DxTableActionFunction; show?: boolean | DxTableActionFunction; } export declare enum DxTableColumnTypes { DATE = "date", DATETIME = "datetime", CURRENCY = "currency", CURRENCY_RANGE = "currency-range", JSON = "json" } export interface DxTableColumn { name: keyof C & string; /** * column header */ display?: string; type?: DxTableColumnTypes | string; format?: string; /** * @deprecated removed */ templateName?: DxTableColumnTemplates | DefaultTemplateNames | string; /** * @deprecated removed */ action?: new (row: D) => Action; color?: FunctionOrConstant; class?: FunctionOrConstant; style?: FunctionOrConstant; async?: boolean; allowEmpty?: boolean; /** * @deprecated removed */ collectionPath?: string; /** * @deprecated removed */ tableId?: string; toDisplay?: FunctionOrConstant; /** * @deprecated removed */ templateRef?: TemplateRef>; disabledFilter?: boolean; copyToClipboard?: boolean; tooltip?: FunctionOrConstant; tooltipDisabled?: FunctionOrConstant; actionButton?: ActionButtonDefinition<[C]>; } /** * @deprecated */ export declare type FirestoreTableColumn = DxTableColumn; export interface DxTableTemplateContext { id: string; row: any; value: V; display: DxTableColumn['display']; column: DxTableColumn; tableId: string; index: number; } /** * @deprecated */ export declare type FirestoreTableTemplateContext = DxTableTemplateContext; export interface DxTableState { sorting: { __updatedAt: TableSortingState; __createdAt: TableSortingState; [column: string]: TableSortingState; } & { __enabled: boolean; }; pagination: { enabled: boolean; size: number; page: number; pageSizeOptions: number[]; }; filtering: { [column: string]: { enabled: boolean; value: string; }; } & { __enabled: boolean; }; limit: number; expandable: { row: (D & IWithIdentifier) | null; edit: boolean; full: boolean; btn: boolean; }; rowStyles: FunctionOrConstant; rowClasses: FunctionOrConstant; tableSettings: { enabled: boolean; archived: boolean; createdAt: boolean; updatedAt: boolean; dialogEdit: boolean; dialogView: boolean; }; tabs: Array<{ label: string; filter: (row: D) => boolean; tableState?: Partial>; }>; sortable: boolean; currentTab: number | null; importTableData: boolean; exportTableData: boolean; downloadRow: boolean; editRow: boolean; expandRow: boolean; deleteRow: boolean; manuelDelete: boolean; manuelArchive: boolean; addRow: boolean; archiveRow: boolean; restoreRow: boolean; viewRow: boolean; dialogView: boolean; dialogEdit: boolean; dialogAdd: boolean; expandEdit: boolean; deleteMessage: string; expandView: boolean; title: string | null; subtitle: string | null; selectableRows: boolean; showArchived: boolean; showCreatedAt: boolean; showUpdatedAt: boolean; categoriesCollectionPath: string | null; actions: ActionButtonDefinition<[D]>[]; columns: DxTableColumn[]; viewComponent: new (...args: any[]) => IAbstractViewComponent | null; viewComponentId: string; displayedColumns: string[]; collectionPath: string; getCollectionPath: ((route: ActivatedRoute) => Observable) | null; query: any | null; hiddenColumns: string[]; load: Array; getDialogTitle: (document: D) => string; selectedRows: { [index: number]: D; }; getTableData: (tableId: string, collectionPath: string) => MemoizedSelector; formId: string | null; editFormId: string | null; createFormId: string | null; } /** * @deprecated */ export declare type TableState = DxTableState; export interface DxTableStates { [tableId: string]: TableState; } /** * @deprecated */ export declare type FirestoreTableState = DxTableStates; export declare const dxTableInitialState: FirestoreTableState; /** * @deprecated */ export declare const firestoreTableInitialState: DxTableStates; export declare enum DxTableColumnTemplates { ARRAY = "array", PLAIN = "plain", OBJECT = "object", BOOLEAN = "boolean", EMPTY = "empty", EMPTY_LOADING = "emptyLoading", RELATION_LINK = "relationLink", COLOR = "color", BUTTON = "button", RESOLVE_WITH_COLLECTION_PATH = "resolveWithCollectionPath", ACTION_BUTTON = "actionButton" } export interface ICellTemplatesComponent { array: TemplateRef>; plain: TemplateRef>; object: TemplateRef>; boolean: TemplateRef>; empty: TemplateRef>; emptyLoading: TemplateRef>; relationLink: TemplateRef>; relationLinkArray: TemplateRef>; color: TemplateRef>; button: TemplateRef>; resolveWithCollectionPath: TemplateRef>; actionButton: TemplateRef>; }