easy-forms-core 1.1.8 → 1.1.10
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/README.md +3 -0
- package/dist/easy-form.d.ts +68 -3
- package/dist/easy-form.js +844 -15
- package/dist/easy-form.js.map +1 -1
- package/dist/index.d.ts +69 -4
- package/dist/index.js +844 -15
- package/dist/index.js.map +1 -1
- package/package.json +10 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tipos de campos soportados
|
|
3
3
|
*/
|
|
4
|
-
type FieldType = 'text' | 'email' | 'number' | 'password' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'switch' | 'date' | 'file' | 'array' | 'group' | 'row' | 'custom' | 'quantity' | 'accordion-select' | 'image-grid-select' | 'otp';
|
|
4
|
+
type FieldType = 'text' | 'email' | 'number' | 'password' | 'textarea' | 'select' | 'checkbox' | 'radio' | 'switch' | 'date' | 'file' | 'array' | 'group' | 'row' | 'custom' | 'quantity' | 'accordion-select' | 'image-grid-select' | 'otp' | 'file-drop' | 'map' | 'rating' | 'slider';
|
|
5
5
|
/**
|
|
6
6
|
* Tipos de validaciones soportadas
|
|
7
7
|
*/
|
|
@@ -101,10 +101,14 @@ interface MaskConfig {
|
|
|
101
101
|
/**
|
|
102
102
|
* Campo base
|
|
103
103
|
*/
|
|
104
|
+
/** Posición del label: up (arriba), down (debajo), left (izquierda), right (derecha), none (oculto) */
|
|
105
|
+
type LabelPosition = 'up' | 'down' | 'left' | 'right' | 'none';
|
|
104
106
|
interface BaseField {
|
|
105
107
|
type: FieldType;
|
|
106
108
|
name: string;
|
|
107
109
|
label?: string;
|
|
110
|
+
/** Posición del label (override del atributo label-position del componente) */
|
|
111
|
+
labelPosition?: LabelPosition;
|
|
108
112
|
placeholder?: string;
|
|
109
113
|
defaultValue?: any;
|
|
110
114
|
validations?: Validation[];
|
|
@@ -125,7 +129,17 @@ interface BaseField {
|
|
|
125
129
|
* Campo de texto
|
|
126
130
|
*/
|
|
127
131
|
interface TextField extends BaseField {
|
|
128
|
-
type: 'text' | 'email'
|
|
132
|
+
type: 'text' | 'email';
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Campo password (con opciones de visibilidad y modo carácter separado)
|
|
136
|
+
*/
|
|
137
|
+
interface PasswordField extends BaseField {
|
|
138
|
+
type: 'password';
|
|
139
|
+
/** Mostrar botón para alternar visibilidad del texto */
|
|
140
|
+
showToggle?: boolean;
|
|
141
|
+
/** Modo carácter separado: true = longitud por defecto 6, number = cantidad de cajas */
|
|
142
|
+
characterSeparated?: boolean | number;
|
|
129
143
|
}
|
|
130
144
|
/**
|
|
131
145
|
* Campo numérico
|
|
@@ -195,6 +209,45 @@ interface FileField extends BaseField {
|
|
|
195
209
|
accept?: string;
|
|
196
210
|
multiple?: boolean;
|
|
197
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Campo file-drop (arrastrar y soltar archivos)
|
|
214
|
+
*/
|
|
215
|
+
interface FileDropField extends BaseField {
|
|
216
|
+
type: 'file-drop';
|
|
217
|
+
accept?: string;
|
|
218
|
+
multiple?: boolean;
|
|
219
|
+
maxSize?: number;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Campo map (lat/lng)
|
|
223
|
+
*/
|
|
224
|
+
interface MapField extends BaseField {
|
|
225
|
+
type: 'map';
|
|
226
|
+
center?: {
|
|
227
|
+
lat: number;
|
|
228
|
+
lng: number;
|
|
229
|
+
};
|
|
230
|
+
zoom?: number;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Campo rating
|
|
234
|
+
*/
|
|
235
|
+
interface RatingField extends BaseField {
|
|
236
|
+
type: 'rating';
|
|
237
|
+
max?: number;
|
|
238
|
+
icon?: 'star' | 'heart' | 'thumb';
|
|
239
|
+
half?: boolean;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Campo slider
|
|
243
|
+
*/
|
|
244
|
+
interface SliderField extends BaseField {
|
|
245
|
+
type: 'slider';
|
|
246
|
+
min: number;
|
|
247
|
+
max: number;
|
|
248
|
+
step?: number;
|
|
249
|
+
showValue?: boolean;
|
|
250
|
+
}
|
|
198
251
|
/**
|
|
199
252
|
* Campo array
|
|
200
253
|
*/
|
|
@@ -210,6 +263,8 @@ interface ArrayField extends BaseField {
|
|
|
210
263
|
interface GroupField extends BaseField {
|
|
211
264
|
type: 'group';
|
|
212
265
|
fields: Field[];
|
|
266
|
+
/** Dirección del layout del grupo (override del formulario) */
|
|
267
|
+
direction?: 'vertical' | 'horizontal';
|
|
213
268
|
}
|
|
214
269
|
/**
|
|
215
270
|
* Campo row
|
|
@@ -277,7 +332,7 @@ interface OTPField extends BaseField {
|
|
|
277
332
|
/**
|
|
278
333
|
* Unión de todos los tipos de campos
|
|
279
334
|
*/
|
|
280
|
-
type Field = TextField | NumberField | TextareaField | SelectField | CheckboxField | RadioField | SwitchField | DateField | FileField | ArrayField | GroupField | RowField | CustomField | QuantityField | AccordionSelectField | ImageGridSelectField | OTPField;
|
|
335
|
+
type Field = TextField | PasswordField | NumberField | TextareaField | SelectField | CheckboxField | RadioField | SwitchField | DateField | FileField | FileDropField | MapField | RatingField | SliderField | ArrayField | GroupField | RowField | CustomField | QuantityField | AccordionSelectField | ImageGridSelectField | OTPField;
|
|
281
336
|
/**
|
|
282
337
|
* Step para formularios wizard
|
|
283
338
|
*/
|
|
@@ -329,6 +384,12 @@ interface FormSchema {
|
|
|
329
384
|
initialData?: Record<string, any>;
|
|
330
385
|
/** Configuración del botón de submit (también puede definirse vía atributo submit-button) */
|
|
331
386
|
submitButton?: SubmitButtonConfig;
|
|
387
|
+
/** Barra de progreso de campos obligatorios completados: true | { position?: 'top'|'bottom' } */
|
|
388
|
+
completedIndicator?: boolean | {
|
|
389
|
+
position?: 'top' | 'bottom';
|
|
390
|
+
};
|
|
391
|
+
/** Dirección del layout: vertical (default) u horizontal */
|
|
392
|
+
direction?: 'vertical' | 'horizontal';
|
|
332
393
|
}
|
|
333
394
|
/**
|
|
334
395
|
* Estado del formulario
|
|
@@ -542,6 +603,10 @@ declare class EasyForm extends BrowserHTMLElement {
|
|
|
542
603
|
* Renderiza un campo custom
|
|
543
604
|
*/
|
|
544
605
|
private renderCustom;
|
|
606
|
+
/**
|
|
607
|
+
* Obtiene el progreso de campos obligatorios completados
|
|
608
|
+
*/
|
|
609
|
+
private getCompletedRequiredProgress;
|
|
545
610
|
/**
|
|
546
611
|
* Renderiza wizard
|
|
547
612
|
*/
|
|
@@ -1177,4 +1242,4 @@ declare function getAvailableTemplates(): TemplateName[];
|
|
|
1177
1242
|
*/
|
|
1178
1243
|
declare function extendTemplate(templateName: string, additionalFields: Field[]): FormSchema;
|
|
1179
1244
|
|
|
1180
|
-
export { type AccordionSelectField, type ArrayField, AttemptsLock, type AttemptsLockOptions, type BaseField, type BaseValidation, type ChangeEventDetail, type CheckboxField, 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 FileField, type FormColors, type FormSchema, type FormState, type FormTheme, type GroupField, INJECTION_VALIDATION_MESSAGE, type ImageGridSelectField, type MaskConfig, MaskEngine, type MaxLengthValidation, type MaxValidation, type MinLengthValidation, type MinValidation, type NoInjectionValidation, type NumberField, type OTPField, PREDEFINED_MASKS, type PatternValidation, type PredefinedMask, type QuantityField, type RadioField, type RequiredValidation, type RowField, SchemaParser, type SelectField, 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 };
|
|
1245
|
+
export { type AccordionSelectField, type ArrayField, AttemptsLock, type AttemptsLockOptions, type BaseField, type BaseValidation, type ChangeEventDetail, type CheckboxField, 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, 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 };
|