UNPKG

@velis/dynamicforms

Version:

Data entry boilerplate components and a RESTful API consumer

68 lines 2.5 kB
import type FilteredActions from '../actions/filtered-actions'; import type { ActionsNS } from '../actions/namespace'; import type FormPayload from '../form/definitions/form-payload'; import type FormLayout from '../form/definitions/layout'; import type { FormLayoutNS } from '../form/namespace'; import type { DfTable } from '../table/namespace'; export declare namespace APIConsumer { type PKValueType = NonNullable<any>; interface Titles { table: string; new: string; edit: string; } interface UXDefinition { primary_key_name: string; titles: Titles; dialog: FormLayoutNS.LayoutInterface; actions: ActionsNS.ActionsJSON; record: FormPayloadJSON; } interface TableUXDefinition extends UXDefinition { columns: DfTable.ColumnJSON[]; rows: DfTable.RowsData; ordering_parameter: string; ordering_style: unknown; responsive_table_layouts: DfTable.ResponsiveTableLayoutsDefinition; filter: unknown; record: FormPayloadJSON; row_select: boolean; } interface FormUXDefinition extends UXDefinition { record: FormPayloadJSON; } type FormPayloadJSON = { [key: string]: any; } | null; type FormDefinition = { title: string; pkName: string; pkValue: PKValueType; layout: FormLayout; payload: FormPayload; loading: boolean; actions: FilteredActions; actionHandlers?: ActionsNS.IHandlers; errors: ActionsNS.ErrorsJSON; }; interface ConsumerLogicBaseInterface { pkName: string; setDialogHandlers(handlers?: ActionsNS.IHandlers): void; setOrdering(parameter: string, style: any | null, counter: number): void; reload(filter: boolean): Promise<void>; deleteRow(tableRow: FormPayload): Promise<void>; dialogForm(pk: APIConsumer.PKValueType): Promise<any>; title(which: 'table' | 'new' | 'edit'): string; tableDefinition: Record<string, unknown>; formDefinition: APIConsumer.FormDefinition; filter(filterData: Object | null): Promise<void>; reload(filter?: boolean): Promise<void>; } interface ConsumerLogicAPIInterface extends ConsumerLogicBaseInterface { fetch(): any; fetchNewRows(url: string): any; } interface ConsumerLogicArrayInterface extends ConsumerLogicBaseInterface { } } //# sourceMappingURL=namespace.d.ts.map