import { TemplateRef } from '@angular/core'; import { Observable } from 'rxjs'; import { PaginationPosition } from '../enums/paginationPosition.enum'; import { TypeFilter } from '../enums/typeFilter.enum'; import { TypeHeaderOptions, TypeOption } from '../enums/typeOption.enum'; import { TypeTable } from '../enums/typeTable.enum'; import { TypeQueryFilter } from '../enums/typeQueryFilter.enum'; import { DataTable } from './data'; import { OptionsTable } from './options/option'; /** * Style in table */ export interface Styles { /** * style in options */ options?: { /** * td styles */ td: { /** * object style value and key */ [key: string]: string; } | any; /** * th styles */ th: { /** * object style value and key */ [key: string]: string; } | any; }; } /** * Filter table */ export interface FilterTable { /** * value to extract data */ value: any | Array; /** * attribute name */ attribute: string; /** * typeFilter */ type?: TypeFilter; /** * The dynamics filters was on charge only * in the first loaded from the table */ dynamic?: boolean; } /** * Arguments to filter table data */ export interface ArgumentTable { /** * value from argument */ value?: any; /** * name of argument */ name?: string; } /** * Scroll table */ export interface Scroll { /** * scroll Table Flag */ scroll: boolean; /** * Max-width scroll */ x?: string; /** * Max height scroll */ y?: string; } /** * sort table */ export interface SortTable { /** * ascend or descend */ type: string | any; /** * attribute name */ attribute: string; } /** * table */ export interface Table { /** * id table */ idTable: string; /** * options body */ options?: Array>; /** * options header */ optionsHeader?: Array>; /** * style table */ styles?: Styles; /** * title table */ title?: string; /** * page size configurations */ pageSizeOptions?: Array; /** * show paginations */ showPagination?: boolean; /** * size page */ size?: number; /** * sort table */ sort?: SortTable; /** * array to default filters */ filters?: Array | (() => Array); /** * Object filter */ filter?: FiltersTable; /** * scroll table */ scroll?: Scroll | any; /** * Show if the row can be clicked or not */ rowSelection?: boolean; /** * type table */ typeTable?: TypeTable; /** * action subscribe to emit */ actionSubscribe?: () => Observable; /** * show - Flag to activate checks box * attribute - set checkbox identifier by default is the uuid * defaultCheckedRows - Map with ids and data */ checksBox?: { show?: boolean; attribute?: string; defaultCheckedRows?: Map; }; /** * set the position to the table pagination */ paginationPosition?: PaginationPosition; /** * set a custom empty state */ emptyState?: EmptyState; /** * drag sorting rows in table */ dragSorting?: DragSorting; } /** * Filter table for QueryType */ export interface FiltersTable { /** * Default array filter */ default?: Array | (() => Array); /** * Query type filter ('rsql', 'spring-search') */ type?: TypeQueryFilter; } /** * poll interval */ export interface PollIntervalTable { /** * enable flag */ enable: boolean; /** * time to retry */ time: number; } /** * variables graph ql */ export interface VariablesQl { /** * endpoint */ endpoint: string; } /** * table monolith */ export interface TableMonolith extends TableEntity { /** * url to get data */ url?: string | ((data: any) => string); } /** * table graphql */ export interface TableGraphQl extends TableEntity { /** * dto */ dto: string; /** * content columns */ content: string; /** * poll interval */ pollInterval?: PollIntervalTable; /** * variables */ variables: VariablesQl; /** * fetch policy */ fetchPolicy?: string; /** * @deprecated attributes function */ attributesFunction?: string | ((forms: any) => string); /** * actual argument to filter data */ argument?: Array | (() => Array); } /** * table micro services */ export interface TableMs extends TableEntity { } /** * table entity */ interface TableEntity extends Table { /** * url get data */ url?: string | ((data: any) => string); /** * set host to given string passed, replaces default environment.url host */ alternativeHost?: string | ((data: any) => string); /** * custom http subscriber */ httpSubscribe?: ({ page, size, sort, filter, component, type, }: { page: any; size: any; sort: any; filter: any; component: any; type: any; }) => Observable; /** * custom map to http subscriber */ mapHttpSubscribe?: ({ response, component }: { response: any; component: any; }) => any; } /** * table list */ export interface TableList extends Table { } /** * empty state */ export interface EmptyState { /** * custom template */ template: TemplateRef | (() => TemplateRef) | any; } /** * drag and drop rows */ export interface DragSorting { /** * flag to active drag and drop by rows */ dragSorting: StandardFlagType; /** * flag to show the order column */ orderColumnShow?: StandardFlagType; /** * function to execute when drag and drop emit * @param {StandardParameters} * @return {Observable} */ sortChange: ({ data, option }: StandardParameters) => Observable; } /** * standar params function */ export interface StandardParameters { /** * */ data: DataTable; /** * */ option: OptionsTable | undefined; } /** * standar flag type */ export declare type StandardFlagType = Observable | (({ data, option }: StandardParameters) => T) | T; /** * all entity tables types */ export declare type TypeTableEntity = TableMs | TableGraphQl | TableMonolith; /** * all table types */ export declare type TypeTables = TableList | TableMs | TableGraphQl | TableMonolith; export {};