easy-forms-core 1.2.14 → 1.3.0

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
@@ -472,6 +472,8 @@ interface SubmitEventDetail {
472
472
  values: Record<string, any>;
473
473
  isValid: boolean;
474
474
  errors: Record<string, string[]>;
475
+ /** Tiempo restante en segundos cuando se usa complete-time */
476
+ timeRemaining?: number;
475
477
  }
476
478
  /**
477
479
  * Evento de change
@@ -496,6 +498,13 @@ interface StepChangeEventDetail {
496
498
  previousStep: number;
497
499
  totalSteps: number;
498
500
  }
501
+ /**
502
+ * Evento de timeout (cuando expira el tiempo límite)
503
+ */
504
+ interface TimeoutEventDetail {
505
+ originalTime: number;
506
+ expiredAt: Date;
507
+ }
499
508
  /**
500
509
  * Componente personalizado para inyección
501
510
  */
@@ -537,6 +546,10 @@ declare class EasyForm extends BrowserHTMLElement {
537
546
  private persistenceDebounceTimer;
538
547
  private pendingRestoreValues;
539
548
  private isRestoringValues;
549
+ private completeTimeInterval;
550
+ private timeRemaining;
551
+ private timerStarted;
552
+ private timerExpired;
540
553
  static get observedAttributes(): string[];
541
554
  constructor();
542
555
  /**
@@ -683,9 +696,13 @@ declare class EasyForm extends BrowserHTMLElement {
683
696
  */
684
697
  private rerenderArrayField;
685
698
  /**
686
- * Re-renderiza campos dependientes
687
- */
699
+ * Re-renderiza campos dependientes
700
+ */
688
701
  private renderDependentFields;
702
+ /**
703
+ * Obtiene todos los campos que tienen dependencias
704
+ */
705
+ private getAllFieldsWithDependencies;
689
706
  /**
690
707
  * Emite evento de cambio de dependencia
691
708
  */
@@ -824,6 +841,14 @@ declare class EasyForm extends BrowserHTMLElement {
824
841
  * Establece el estado de disabled
825
842
  */
826
843
  set disabled(value: boolean);
844
+ /**
845
+ * Obtiene el tiempo límite en segundos
846
+ */
847
+ get completeTime(): number | null;
848
+ /**
849
+ * Establece el tiempo límite en segundos
850
+ */
851
+ set completeTime(value: number | null);
827
852
  /**
828
853
  * Configura estilos básicos
829
854
  */
@@ -856,6 +881,34 @@ declare class EasyForm extends BrowserHTMLElement {
856
881
  * Limpia los datos de persistencia
857
882
  */
858
883
  private clearPersistence;
884
+ /**
885
+ * Resetea el timer de complete-time
886
+ */
887
+ private resetTimer;
888
+ /**
889
+ * Inicia el timer de complete-time
890
+ */
891
+ private startTimer;
892
+ /**
893
+ * Actualiza la visualización del timer
894
+ */
895
+ private updateTimerDisplay;
896
+ /**
897
+ * Maneja cuando el timer expira
898
+ */
899
+ private handleTimerExpired;
900
+ /**
901
+ * Deshabilita todos los campos del formulario
902
+ */
903
+ private disableAllFields;
904
+ /**
905
+ * Configura el event listener para iniciar el timer en el primer input
906
+ */
907
+ private setupTimerInputListener;
908
+ /**
909
+ * Renderiza el display del timer
910
+ */
911
+ private renderTimerDisplay;
859
912
  }
860
913
 
861
914
  /**
@@ -890,9 +943,10 @@ declare class StateManager {
890
943
  */
891
944
  private getArrayItemOnlyFieldNames;
892
945
  /**
893
- * Encuentra el path completo de un campo dentro de grupos
946
+ * Extrae todos los campos incluyendo arrays (para mapa de dependencias)
947
+ * Retorna campos con su información de container
894
948
  */
895
- private findFieldPath;
949
+ private extractAllFieldsWithArrays;
896
950
  /**
897
951
  * Construye el mapa de dependencias para optimizar re-evaluaciones
898
952
  */
@@ -937,6 +991,10 @@ declare class StateManager {
937
991
  * Invalida el cache de dependencias para campos dependientes
938
992
  */
939
993
  private invalidateDependencyCache;
994
+ /**
995
+ * Agrega el índice de array al path del campo
996
+ */
997
+ private addArrayIndexToPath;
940
998
  /**
941
999
  * Establece un valor sin validar (útil para preservar valores durante re-renderizado)
942
1000
  */
@@ -1147,7 +1205,7 @@ declare class ConditionEngine {
1147
1205
  required: boolean;
1148
1206
  };
1149
1207
  /**
1150
- * Obtiene el valor de un campo (soporta nested paths)
1208
+ * Obtiene el valor de un campo (soporta nested paths y claves con puntos)
1151
1209
  */
1152
1210
  private getFieldValue;
1153
1211
  /**
@@ -1356,4 +1414,43 @@ declare function getAvailableTemplates(): TemplateName[];
1356
1414
  */
1357
1415
  declare function extendTemplate(templateName: string, additionalFields: Field[]): FormSchema;
1358
1416
 
1359
- 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 StepStyle, 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 };
1417
+ interface EasyFormBuilderOptions {
1418
+ fields?: Field[];
1419
+ steps?: Step[];
1420
+ initialData?: Record<string, any>;
1421
+ submitButton?: SubmitButtonConfig;
1422
+ completedIndicator?: boolean | {
1423
+ position?: 'top' | 'bottom';
1424
+ };
1425
+ direction?: 'vertical' | 'horizontal';
1426
+ persistence?: {
1427
+ enabled?: boolean;
1428
+ key: string;
1429
+ autoSave?: boolean;
1430
+ debounce?: number;
1431
+ };
1432
+ stepStyle?: 'default' | 'tabs' | 'buttons' | 'timeline' | 'none';
1433
+ completeTime?: number;
1434
+ }
1435
+ declare class EasyFormBuilder {
1436
+ private options;
1437
+ constructor();
1438
+ fields(fields: Field[]): EasyFormBuilder;
1439
+ steps(steps: Step[]): EasyFormBuilder;
1440
+ initialData(data: Record<string, any>): EasyFormBuilder;
1441
+ submitButton(config: SubmitButtonConfig): EasyFormBuilder;
1442
+ completedIndicator(enabled?: boolean | {
1443
+ position?: 'top' | 'bottom';
1444
+ }): EasyFormBuilder;
1445
+ direction(direction: 'vertical' | 'horizontal'): EasyFormBuilder;
1446
+ persistence(key: string, options?: {
1447
+ autoSave?: boolean;
1448
+ debounce?: number;
1449
+ }): EasyFormBuilder;
1450
+ stepStyle(style: 'default' | 'tabs' | 'buttons' | 'timeline' | 'none'): EasyFormBuilder;
1451
+ withCompleteTime(seconds: number): EasyFormBuilder;
1452
+ build(): FormSchema;
1453
+ }
1454
+ declare function createFormSchema(options?: EasyFormBuilderOptions): FormSchema;
1455
+
1456
+ 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, EasyFormBuilder, 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 StepStyle, type SubmitButtonConfig, type SubmitEventDetail, type SwitchField, type TemplateName, type TextField, type TextareaField, type TimeoutEventDetail, type Validation, ValidationEngine, type ValidationType, type WizardState, attributeValue, containsInjection, createFormSchema, createInput, extendTemplate, generateId, getAvailableTemplates, getColors, getCustomComponent, getNestedValue, getPredefinedMask, getTemplate, getThemeStyles, isSafeFromInjection, isValidEmail, parseAttributeValue, registerComponent, registerComponents, sanitizeId, setNestedValue, templates };