UNPKG

tuain-ng-forms-lib

Version:

Componentes y Clases Angular para la gestión de formularios TUAIN

164 lines (163 loc) 4.31 kB
export interface IFieldValidation { type: 'regexp' | 'function'; validation: RegExp | ((value: any, field: any) => { valid: boolean; message?: string; }); message?: string; } export interface AttributeChange { name: string; value: any; } export interface ElementAttribute { name: string; propagate: string | null; } export interface TableSorting { columnName: string; direction: string; } export interface EventCallback { callback: (...args: any[]) => any; properties?: Record<string, any> | null; } export interface FieldEditionEvent { code: string; intrinsicValidation: boolean; } export interface FieldCustomEventData { code: string; eventName: string; eventData: any; } export interface FormStateEvent { state: string; } export interface IFormConfig { fieldTypes: Record<string, string>; captureTypes: Record<string, string>; captureTypesWithOptions: string[]; widgets: { byType: Record<string, string>; byCapture: Record<string, string>; }; fieldValidations: Record<string, IFieldValidation>; tableActions: Record<string, string>; defaultRecordsPerPage: number; formStandardErrors: Record<string, string>; tableFieldStyles: Record<string, Record<string, string>>; defaultFieldAttributes?: Record<string, any>; defaultActionAttributes?: Record<string, any>; notLabeledFields?: string[]; arrayFieldTypes?: Record<string, any>; } export interface PieceDefinition { visibleStates?: string[] | string; enabledStates?: string[] | string; disabled?: boolean; visible?: boolean; customAttributes?: Record<string, any>; } export interface FieldDefinition extends PieceDefinition { fieldCode: string; fieldTitle?: string; placeholder?: string; fieldTypeCode: string; captureType?: string; defaultValue?: any; alignment?: string; info?: string; format?: string | { regExp: string; }; serverAction?: boolean; tooltip?: string; required?: boolean; outputOnly?: boolean; minLength?: number; maxLength?: number; errorCode?: string; errorMessage?: string; errorType?: string; editable?: boolean; visibleLabel?: boolean; fieldOptions?: any[]; fieldValue?: any; } export interface ActionDefinition extends PieceDefinition { actionCode: string; actionTitle: string; iconName?: string; fieldRestrictedCode?: string; operatorRestricted?: string; valueRestricted?: any; serverAction?: boolean; newState?: string; position?: string; actionType?: string; actionClass?: string; stateField?: string; actionModes?: string; } export interface TableDefinition extends PieceDefinition { tableCode: string; tableTitle: string; append?: boolean; selectable?: boolean; selectionBackend?: boolean; sortable?: boolean; clientPaging?: boolean; simpleFilter?: boolean; selectionField?: string; fields?: any[]; actions?: any[]; filters?: any[]; } export interface SectionDefinition extends PieceDefinition { sectionCode: string; sectionId?: string; sectionTitle?: string; subsections?: any[]; exclusive?: boolean; exclusiveField?: string; } export interface SubsectionDefinition extends PieceDefinition { subsectionId?: string; subsectionCode: string; subsectionTitle?: string; elements?: { code: string; type: string; }[]; } export interface ColumnDefinition extends PieceDefinition { fieldCode: string; fieldTitle?: string; fieldTypeCode?: string; alignment?: string; visible?: boolean; sortable?: boolean; searchable?: boolean; format?: string; } export interface FormServerResponse { error?: boolean; errorCode?: string; errorFullCode?: string; errorName?: string; errorMessage?: string; errorDetail?: string; currentMode?: string; formSubject?: string; actions?: Partial<ActionDefinition>[]; fields?: Partial<FieldDefinition>[]; recordTables?: any[]; returnedFile?: { file: Blob; name: string; type: string; }; immutableData?: Record<string, any>; extraInfo?: Record<string, any>; }