easy-forms-core 1.0.0 → 1.0.1

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.
@@ -6,6 +6,10 @@ type FieldType = 'text' | 'email' | 'number' | 'password' | 'textarea' | 'select
6
6
  * Tipos de validaciones soportadas
7
7
  */
8
8
  type ValidationType = 'required' | 'email' | 'minLength' | 'maxLength' | 'min' | 'max' | 'pattern' | 'custom';
9
+ /**
10
+ * Operadores de condición
11
+ */
12
+ type ConditionOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual' | 'in' | 'notIn' | 'isEmpty' | 'isNotEmpty' | 'regex';
9
13
  /**
10
14
  * Validación base
11
15
  */
@@ -50,6 +54,47 @@ interface CustomValidation extends BaseValidation {
50
54
  * Unión de todas las validaciones
51
55
  */
52
56
  type Validation = RequiredValidation | EmailValidation | MinLengthValidation | MaxLengthValidation | MinValidation | MaxValidation | PatternValidation | CustomValidation;
57
+ /**
58
+ * Condición individual para campos
59
+ */
60
+ interface FieldCondition {
61
+ field: string;
62
+ operator: ConditionOperator;
63
+ value: any;
64
+ }
65
+ /**
66
+ * Dependencias de un campo
67
+ */
68
+ interface FieldDependencies {
69
+ show?: FieldCondition | FieldCondition[];
70
+ hide?: FieldCondition | FieldCondition[];
71
+ enable?: FieldCondition | FieldCondition[];
72
+ disable?: FieldCondition | FieldCondition[];
73
+ required?: FieldCondition | FieldCondition[];
74
+ optional?: FieldCondition | FieldCondition[];
75
+ }
76
+ /**
77
+ * Tipos de máscaras predefinidas
78
+ */
79
+ type PredefinedMask = 'phone' | 'phone-us' | 'phone-international' | 'date' | 'date-us' | 'date-eu' | 'credit-card' | 'ssn' | 'zip-code' | 'currency' | 'percentage' | 'time' | 'datetime';
80
+ /**
81
+ * Máscara personalizada con patrón
82
+ */
83
+ interface CustomMask {
84
+ pattern: string;
85
+ placeholder?: string;
86
+ transform?: (value: string) => string;
87
+ }
88
+ /**
89
+ * Configuración de máscara
90
+ */
91
+ interface MaskConfig {
92
+ type?: PredefinedMask;
93
+ custom?: CustomMask;
94
+ keepFormat?: boolean;
95
+ showMaskOnFocus?: boolean;
96
+ showMaskOnHover?: boolean;
97
+ }
53
98
  /**
54
99
  * Campo base
55
100
  */
@@ -64,6 +109,12 @@ interface BaseField {
64
109
  disabled?: boolean;
65
110
  hidden?: boolean;
66
111
  description?: string;
112
+ dependencies?: FieldDependencies;
113
+ conditionalValidations?: Array<{
114
+ condition: FieldCondition | FieldCondition[];
115
+ validations: Validation[];
116
+ }>;
117
+ mask?: MaskConfig;
67
118
  }
68
119
  /**
69
120
  * Campo de texto
@@ -285,6 +336,15 @@ declare class EasyForm extends BrowserHTMLElement {
285
336
  * Maneja el cambio de un campo
286
337
  */
287
338
  private handleFieldChange;
339
+ private dependencyRenderTimeout;
340
+ /**
341
+ * Re-renderiza campos dependientes
342
+ */
343
+ private renderDependentFields;
344
+ /**
345
+ * Emite evento de cambio de dependencia
346
+ */
347
+ private emitDependencyChange;
288
348
  /**
289
349
  * Maneja el blur de un campo
290
350
  */