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/README.md
CHANGED
|
@@ -27,6 +27,8 @@ npm install easy-forms-core
|
|
|
27
27
|
pnpm add easy-forms-core
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
**Campo map:** EasyForms no incluye Leaflet. Si usas el tipo `map`, instala e importa Leaflet tú mismo: `npm install leaflet`, luego `import 'leaflet'` y `import 'leaflet/dist/leaflet.css'`. Ver [documentación](https://easyforms.dev/docs/tipos-campos#map).
|
|
31
|
+
|
|
30
32
|
## Uso Básico
|
|
31
33
|
|
|
32
34
|
### HTML Vanilla
|
|
@@ -470,6 +472,7 @@ Puedes sobrescribir cualquier estilo usando las clases CSS del componente. Todas
|
|
|
470
472
|
- Arrays dinámicos
|
|
471
473
|
- **Rows (filas horizontales)** - Agrupa campos en filas
|
|
472
474
|
- **Slots (row)** - Inserta contenido HTML en posiciones concretas del formulario
|
|
475
|
+
- **Campo password** - Opciones `showToggle` (ver/ocultar) y `characterSeparated` (entrada por caracteres, tipo OTP)
|
|
473
476
|
- **Datos iniciales** - Carga valores iniciales desde datos externos
|
|
474
477
|
- Componentes visuales personalizables
|
|
475
478
|
- Eventos de submit, change y error
|
package/dist/easy-form.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
|
* Componente personalizado para inyección
|
|
@@ -493,6 +554,10 @@ declare class EasyForm extends BrowserHTMLElement {
|
|
|
493
554
|
* Renderiza un campo custom
|
|
494
555
|
*/
|
|
495
556
|
private renderCustom;
|
|
557
|
+
/**
|
|
558
|
+
* Obtiene el progreso de campos obligatorios completados
|
|
559
|
+
*/
|
|
560
|
+
private getCompletedRequiredProgress;
|
|
496
561
|
/**
|
|
497
562
|
* Renderiza wizard
|
|
498
563
|
*/
|