easy-forms-core 1.2.11 → 1.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -421,6 +421,23 @@ interface FormSchema {
421
421
  };
422
422
  /** Dirección del layout: vertical (default) u horizontal */
423
423
  direction?: 'vertical' | 'horizontal';
424
+ /** Configuración de persistencia/autosave del formulario */
425
+ persistence?: PersistenceConfig;
426
+ }
427
+ /**
428
+ * Configuración de persistencia del formulario
429
+ */
430
+ interface PersistenceConfig {
431
+ /** Habilitar persistencia */
432
+ enabled?: boolean;
433
+ /** Clave para localStorage */
434
+ key: string;
435
+ /** Intervalo de autosave en ms (default: 1000) */
436
+ autoSave?: boolean;
437
+ /** Debounce para guardar en ms (default: 500) */
438
+ debounce?: number;
439
+ /** Callback cuando se restauran datos */
440
+ onRestore?: (values: Record<string, any>) => void;
424
441
  }
425
442
  /**
426
443
  * Estado del formulario
@@ -508,6 +525,10 @@ declare class EasyForm extends BrowserHTMLElement {
508
525
  */
509
526
  private slotTemplates;
510
527
  private skipPreserveValuesOnNextRender;
528
+ private persistenceConfig;
529
+ private persistenceDebounceTimer;
530
+ private pendingRestoreValues;
531
+ private isRestoringValues;
511
532
  static get observedAttributes(): string[];
512
533
  constructor();
513
534
  /**
@@ -799,6 +820,34 @@ declare class EasyForm extends BrowserHTMLElement {
799
820
  * Configura estilos básicos
800
821
  */
801
822
  private setupStyles;
823
+ /**
824
+ * Inicializa la persistencia del formulario
825
+ */
826
+ private initPersistence;
827
+ /**
828
+ * Restaura los valores desde localStorage
829
+ */
830
+ private restoreFromStorage;
831
+ /**
832
+ * Aplica los valores pendientes de restauración después del render
833
+ */
834
+ private applyPendingRestoreValues;
835
+ /**
836
+ * Actualiza los valores de los inputs del DOM
837
+ */
838
+ private updateInputsWithValues;
839
+ /**
840
+ * Guarda los valores en localStorage
841
+ */
842
+ private saveToStorage;
843
+ /**
844
+ * Programa un guardado debounced
845
+ */
846
+ private scheduleSave;
847
+ /**
848
+ * Limpia los datos de persistencia
849
+ */
850
+ private clearPersistence;
802
851
  }
803
852
 
804
853
  /**
@@ -962,6 +1011,8 @@ declare class StateManager {
962
1011
  * Motor de validaciones
963
1012
  */
964
1013
  declare class ValidationEngine {
1014
+ private conditionEngine;
1015
+ constructor();
965
1016
  /**
966
1017
  * Valida un campo con todas sus validaciones
967
1018
  */
@@ -1019,14 +1070,14 @@ declare class ValidationEngine {
1019
1070
  * Un campo no debe validarse si está oculto por una condición
1020
1071
  */
1021
1072
  private shouldValidateField;
1022
- /**
1023
- * Evalúa una condición simple
1024
- */
1025
- private evaluateCondition;
1026
1073
  /**
1027
1074
  * Valida todos los campos de un formulario
1028
1075
  */
1029
1076
  validateForm(fields: Field[], values: Record<string, any>): Promise<Record<string, string[]>>;
1077
+ /**
1078
+ * Valida un campo array a nivel de array (minItems, maxItems)
1079
+ */
1080
+ private validateArrayField;
1030
1081
  }
1031
1082
 
1032
1083
  /**
@@ -1150,13 +1201,8 @@ declare class MaskEngine {
1150
1201
  };
1151
1202
  }
1152
1203
 
1153
- /**
1154
- * Obtiene los colores con valores por defecto
1155
- */
1156
1204
  declare function getColors(colors?: FormColors): Required<FormColors>;
1157
- /**
1158
- * Genera estilos CSS para un tema específico
1159
- */
1205
+
1160
1206
  declare function getThemeStyles(theme: FormTheme, colors: Required<FormColors>): string;
1161
1207
 
1162
1208
  /**
@@ -1302,4 +1348,4 @@ declare function getAvailableTemplates(): TemplateName[];
1302
1348
  */
1303
1349
  declare function extendTemplate(templateName: string, additionalFields: Field[]): FormSchema;
1304
1350
 
1305
- export { type AccordionSelectField, type ArrayField, AttemptsLock, type AttemptsLockOptions, type BaseField, type BaseValidation, type ChangeEventDetail, type CheckboxField, type ColorpickerField, type ComponentRegistry, ConditionEngine, type ConditionOperator, type CustomComponent, type CustomField, type CustomMask, type CustomValidation, type DateField, EasyForm, type EmailValidation, type ErrorEventDetail, type Field, type FieldCondition, type FieldDependencies, type FieldType, type FileDropField, type FileField, type FormColors, type FormSchema, type FormState, type FormTheme, type GroupField, INJECTION_VALIDATION_MESSAGE, type ImageGridSelectField, type LabelPosition, type MapField, type MaskConfig, MaskEngine, type MaxLengthValidation, type MaxValidation, type MinLengthValidation, type MinValidation, type NoInjectionValidation, type NumberField, type OTPField, PREDEFINED_MASKS, type PasswordField, type PatternValidation, type PredefinedMask, type QuantityField, type RadioField, type RatingField, type RequiredValidation, type RowField, SchemaParser, type SelectField, type SliderField, type SlotContent, StateManager, type Step, type StepChangeEventDetail, type SubmitButtonConfig, type SubmitEventDetail, type SwitchField, type TemplateName, type TextField, type TextareaField, type Validation, ValidationEngine, type ValidationType, type WizardState, attributeValue, containsInjection, createInput, extendTemplate, generateId, getAvailableTemplates, getColors, getCustomComponent, getNestedValue, getPredefinedMask, getTemplate, getThemeStyles, isSafeFromInjection, isValidEmail, parseAttributeValue, registerComponent, registerComponents, sanitizeId, setNestedValue, templates };
1351
+ export { type AccordionSelectField, type ArrayField, AttemptsLock, type AttemptsLockOptions, type BaseField, type BaseValidation, type ChangeEventDetail, type CheckboxField, type ColorpickerField, type ComponentRegistry, ConditionEngine, type ConditionOperator, type CustomComponent, type CustomField, type CustomMask, type CustomValidation, type DateField, EasyForm, type EmailValidation, type ErrorEventDetail, type Field, type FieldCondition, type FieldDependencies, type FieldType, type FileDropField, type FileField, type FormColors, type FormSchema, type FormState, type FormTheme, type GroupField, INJECTION_VALIDATION_MESSAGE, type ImageGridSelectField, type LabelPosition, type MapField, type MaskConfig, MaskEngine, type MaxLengthValidation, type MaxValidation, type MinLengthValidation, type MinValidation, type NoInjectionValidation, type NumberField, type OTPField, PREDEFINED_MASKS, type PasswordField, type PatternValidation, type PersistenceConfig, type PredefinedMask, type QuantityField, type RadioField, type RatingField, type RequiredValidation, type RowField, SchemaParser, type SelectField, type SliderField, type SlotContent, StateManager, type Step, type StepChangeEventDetail, type SubmitButtonConfig, type SubmitEventDetail, type SwitchField, type TemplateName, type TextField, type TextareaField, type Validation, ValidationEngine, type ValidationType, type WizardState, attributeValue, containsInjection, createInput, extendTemplate, generateId, getAvailableTemplates, getColors, getCustomComponent, getNestedValue, getPredefinedMask, getTemplate, getThemeStyles, isSafeFromInjection, isValidEmail, parseAttributeValue, registerComponent, registerComponents, sanitizeId, setNestedValue, templates };