UNPKG

tuain-ng-forms-lib

Version:

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

239 lines (238 loc) 10.5 kB
import { FormAction } from './action'; import { FieldDescriptor, FieldOption } from './field'; import { RecordTable } from './table/table'; import { RecordFormSection } from './section'; import { RecordFormSubSection } from './subsection'; import { TableRecordData } from './table/row-data'; import { FormStateEvent, IFormConfig } from '../../interfaces/form-config.interface'; interface Transition { name: string; source: string; destination: string; } interface StateFlow { defaultState: string; states: string[]; stateDescriptions: string[]; transitions: Transition[]; } export interface FieldPayload { fieldCode: string; fieldValue: any; editable: boolean; visible: boolean; required: boolean; fieldOptions: string; } export interface TablePayload { tableCode: string; visible: boolean; currentPage: number; requestedPage: number; recordsPerPage: number; currentFilter: any; sortingColumn: string; sortingDirection: string; } export interface FormPayload { fields: FieldPayload[]; tables: TablePayload[]; } export declare class FormStructureAndData { private readonly _stateChange; private _immutableData; private _extraInfo; private _exclusiveSectionsByAttr; protected loadInitialData: boolean; protected subject: string | null; protected stateFlow: StateFlow; protected fields: Record<string, FieldDescriptor>; protected actions: Record<string, FormAction>; protected tables: Record<string, RecordTable>; protected sections: Record<string, RecordFormSection>; protected fieldArray: FieldDescriptor[]; protected actionArray: FormAction[]; protected tableArray: RecordTable[]; protected sectionArray: RecordFormSection[]; customAttributes: Record<string, any>; formConfig: IFormConfig; state: string; name: string; title: string; constructor(); setConfig(formConfig: IFormConfig): void; cleanForm(): void; private normalizeStates; loadDefinition(definitionReceived: any): void; get defaultState(): string; get states(): any[]; get stateDescriptions(): any[]; supportState(state?: string): boolean; getNextStates(): string[]; changeState(newState: string): boolean; get stateChange(): import("rxjs").Observable<FormStateEvent>; setStateFlow(states: any, transitions: any, defaultState?: string, stateDescriptions?: any): void; getImmutableElement(name: string): any; set immutableData(immutableData: any); get immutableData(): any; getExtraInfo(name: string): any; set extraInfo(extraInfo: any); get extraInfo(): any; getCustomAttribute(name: string): any; setCustomAttribute(name: string, value: any): void; setCustomAttributes(attributes: Record<string, any>): FormStructureAndData; get fieldNames(): string[]; getFields(): FieldDescriptor[]; getFieldNames(): string[]; getField(code: string): FieldDescriptor; enableField(code: string): void; disableField(code: string): void; getFieldValue(code: string): any; getFieldOptionText(code: string): any; getFieldOptions(code: string): FieldOption[] | null; setFieldValue(code: string, value: any): any; setFieldError(code: string, errorCode: string, message: string, type?: string): any; setFieldIntrinsicErrorMessage(code: string, message: string): any; setFieldRequired(inputCodes: string[] | string | null, required: boolean): any; setFieldErrorMessage(code: string, message: string): any; setFieldOptions(code: string, optionsArray: any[], idAttribute: string, valueAttribute: string | string[], separator?: string): any; getFieldSet(filter: ((field: FieldDescriptor) => boolean) | null, inputCodes: string[] | string | null, secCode?: string | null, subCode?: string | null): string[]; applyOnFields(processFunc: (field: FieldDescriptor) => void, inputCodes?: string[] | string | null, secCode?: string, subCode?: string): number; applyProcessToAllFields(processFunc: (field: FieldDescriptor) => void): number; enableFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number; showFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number; hideFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number; showLabelFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number; hideLabelFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number; disableFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number; cleanFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number; tagFieldsWithError(message: string, codes?: string[] | string | null, secCode?: string, subCode?: string): number; cleanErrorFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number; tagEmptyRequiredFields(message: string, codes?: any, secCode?: string, subCode?: string): boolean; getRequiredFields(codes?: string[] | string | null, secCode?: string, subCode?: string): string[]; getRequiredEmptyFields(codes?: string[] | string | null, secCode?: string, subCode?: string, onlyVisible?: boolean): string[]; getChangedFields(codes?: string[] | string | null, secCode?: string, subCode?: string): string[]; getFieldsWithValidationIssues(codes?: string[] | string | null, secCode?: string, subCode?: string, onlyVisible?: boolean): string[]; getFieldsValues(inputCodes?: string[] | string | null, secCode?: string, subCode?: string): Record<string, any>; getActions(): FormAction[]; getAction(code: string): FormAction; showActions(codes: string[] | string): void; hideActions(codes: string[] | string): void; enableActions(codes: string[] | string): void; disableActions(codes: string[] | string): void; enableAction(code: string): void; disableAction(code: string): void; showAction(code: string): void; hideAction(code: string): void; getHeaderActions(): FormAction[]; getActionsByAttribute(name: string, value: any): FormAction[]; execOnActions(codes: string[] | string | null, functionName: string): void; getTables(): RecordTable[]; getTable(code: string): RecordTable; getTableRecord(code: string, id: string): TableRecordData; enableTables(codes: string[] | string): void; disableTables(codes: string[] | string): void; showTables(codes: string[] | string): void; hideTables(codes: string[] | string): void; cleanTables(codes: string[] | string): void; showTable(code: string): void; hideTable(code: string): void; cleanTable(code: string): void; execOnTables(codes: string[] | string | null, functionName: string): void; getSections(): RecordFormSection[]; getSectionsTitles(): string[]; numSections(): number; getSectionsByAttribute(name: string, value: any): RecordFormSection[]; get sectionTitles(): string[]; get visibleSections(): RecordFormSection[]; getSection(code: string): RecordFormSection; showSections(codes: string[] | string): void; hideSections(codes: string[] | string): void; showSection(code: string): void; hideSection(code: string): void; activeSection(): string; getSubSection(code: string, subCode: string): RecordFormSubSection; showSubSections(code: string, subCodes: string[] | string): void; showSubSection(code: string, subCode: string): void; hideSubSection(code: string, subCode: string): void; hideSubSections(code: string, subCodes: string[] | string): void; getSectionActions(code: string): FormAction[]; getSectionActionNames(code: string): string[]; activateSection(code: string): void; execOnSections(codes: string[] | string | null, functionName: string): void; execOnSubSections(code: string, subNames: string[] | string | null, functionName: string): void; /** * Métodos propios de gestión del formulario */ cleanData(): void; getPayload(): FormPayload; /** * @deprecated Since v17. Use subject instead. Will be removed in v19. */ get formSubject(): string | null; /** * @deprecated Since v17. Use subject instead. Will be removed in v19. */ set formSubject(subject: string | null); /** * @deprecated Since v17. Use states instead. Will be removed in v19. */ getStates(): any[]; /** * @deprecated Since v17. Use state instead. Will be removed in v19. */ getCurrentState(): string; /** * @deprecated Since v17. Use title instead. Will be removed in v19. */ getTitle(): string; /** * @deprecated Since v17. Use title instead. Will be removed in v19. */ setTitle(title: string): void; /** * @deprecated Since v17. Use supportState instead. Will be removed in v19. */ supportMode(state: string): boolean; /** * @deprecated Since v17. Use enableFields instead. Will be removed in v19. */ enableEditFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number; /** * @deprecated Since v17. Use disableFields instead. Will be removed in v19. */ disableEditFields(codes?: string[] | string | null, secCode?: string, subCode?: string): number; /** * @deprecated Since v17. Use getField instead. Will be removed in v19. */ getFieldObject(code: string): FieldDescriptor | null; /** * @deprecated Since v17. Use getAction instead. Will be removed in v19. */ getActionObject(code: string): FormAction | null; /** * @deprecated Since v17. Use getTable instead. Will be removed in v19. */ getTableObject(code: string): RecordTable | null; /** * @deprecated Since v17. Use getSection instead. Will be removed in v19. */ getSectionObject(code: string): RecordFormSection | null; /** * @deprecated Since v17. Use changeState instead. Will be removed in v19. */ changeFormMode(state: string): boolean; /** * @deprecated Since v17. Use subject instead. Will be removed in v19. */ getFormSubject(): string; /** * @deprecated Since v17. Use subject instead. Will be removed in v19. */ getSubject(): string; /** * @deprecated Since v17. Use subject instead. Will be removed in v19. */ getformSubject(): string; } export {};