UNPKG

@velis/dynamicforms

Version:

Data entry boilerplate components and a RESTful API consumer

96 lines 2.94 kB
import { APIConsumer } from '../api_consumer/namespace'; export declare namespace DfForm { interface ChoicesJSON { id: any; text: any; icon: any; } interface AJAXJSON { url_reverse: string; placeholder: string; additional_parameters: string; query_field: string; value_field: string; text_field: string; icon_field: string; } type StatementJSON = [string | StatementJSON, number, any | StatementJSON] | null; interface FormFieldJSON { uuid: string; name: string | null; label: string; placeholder: string; alignment: 'left' | 'right' | 'center' | 'decimal'; visibility: { form: number; table: number; }; render_params: DfForm.RenderParamsJSON; read_only: true | any; choices: ChoicesJSON[]; ajax?: AJAXJSON; colspan: number; help_text: string; allow_null: boolean; conditional_visibility?: DfForm.StatementJSON; } interface FormFieldsJSON { [key: string]: FormFieldJSON; } interface FormComponentDefinition extends APIConsumer.TableUXDefinition { detail_url: string; } interface RenderParamsJSON { input_type: string; form_component_name: string; form_component_def?: DfForm.FormComponentDefinition; field_class?: string; pattern?: string; min?: number; max?: number; min_length?: number; max_length?: number; step?: number; size?: number; form_date_format?: string; form_time_format?: string; multiple?: boolean; allow_tags?: boolean; table?: string; table_show_zeroes?: boolean; } type FormLayoutFieldsCollection = { [key: string]: DfForm.FormFieldJSON; }; } export declare namespace FormLayoutNS { interface LayoutInterface { rows: RowInterface[]; fields: DfForm.FormLayoutFieldsCollection; size?: string; header_classes?: string; component_name: string; } interface RowInterface { component_name: string; columns: (ColumnInterface | GroupInterface)[]; } interface ColumnInterface { type: 'column' | 'group'; field: string; component_name: string; colspan?: number; } interface GroupInterface extends ColumnInterface { footer?: string; title?: string; uuid: string; layout: LayoutInterface; } type ColumnOrGroupInterface = GroupInterface | ColumnInterface; } export declare namespace FormLayoutTypeGuards { function isGroupTemplate(col: FormLayoutNS.ColumnOrGroupInterface): col is FormLayoutNS.GroupInterface; function isLayoutTemplate(layout: any): layout is FormLayoutNS.LayoutInterface; } //# sourceMappingURL=namespace.d.ts.map