UNPKG

@velis/dynamicforms

Version:

Data entry boilerplate components and a RESTful API consumer

66 lines 2.47 kB
import type { APIConsumer } from '../api_consumer/namespace'; import type FormPayload from '../form/definitions/form-payload'; import type DialogDefinition from '../modal/dialog-definition'; import type TableColumn from '../table/definitions/column'; import type RowTypes from '../table/definitions/row-types'; import type Action from './action'; import FilteredActions from './filtered-actions'; export declare namespace ActionsNS { interface ActionHandlerExtraData { dialog?: DialogDefinition; field?: string; oldValue?: any; newValue?: any; event?: Event; column?: TableColumn; rowType?: RowTypes; } type ActionHandler = (action: Action, payload: FormPayload | undefined, extraData: ActionHandlerExtraData) => boolean; interface BreakpointJSON { [key: string]: BreakpointsJSON | boolean | undefined; showLabel?: boolean; showIcon?: boolean; asButton?: boolean; } interface BreakpointsJSON extends BreakpointJSON { [key: string]: BreakpointsJSON | boolean | undefined; xl?: BreakpointJSON; lg?: BreakpointJSON; md?: BreakpointJSON; sm?: BreakpointJSON; xs?: BreakpointJSON; } interface ActionJSON { [key: `action${string}`]: ActionHandler; name?: string; label?: string; icon?: string; displayStyle?: BreakpointsJSON; position?: string; field_name?: string; title?: string; extra_data?: Record<string, any>; } interface ActionsJSON { [key: string]: ActionJSON; payload: APIConsumer.FormPayloadJSON; } interface ErrorsJSON { [key: string]: unknown; } type Handler = (...params: any[]) => Promise<boolean> | boolean; interface IHandlers { [key: string]: Handler; } interface IActionHandler { register: (actionName: string, handler: Handler) => this; call: (action: Action | FilteredActions, context?: any) => Promise<boolean>; recursiveCall: (action: Action | FilteredActions, actionPayload: any, context?: any, f2L?: boolean) => Promise<boolean>; } interface ActionHandlerComposable { registerHandler: (actionName: string, handler: Handler) => void; callHandler: (action: Action | FilteredActions, context?: any) => Promise<boolean>; handler: IActionHandler; } } //# sourceMappingURL=namespace.d.ts.map