easy-forms-core 1.1.9 → 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 +2 -0
- package/dist/easy-form.d.ts +57 -2
- package/dist/easy-form.js +641 -14
- package/dist/easy-form.js.map +1 -1
- package/dist/index.d.ts +58 -3
- package/dist/index.js +641 -14
- 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
|
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[];
|
|
@@ -205,6 +209,45 @@ interface FileField extends BaseField {
|
|
|
205
209
|
accept?: string;
|
|
206
210
|
multiple?: boolean;
|
|
207
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
|
+
}
|
|
208
251
|
/**
|
|
209
252
|
* Campo array
|
|
210
253
|
*/
|
|
@@ -220,6 +263,8 @@ interface ArrayField extends BaseField {
|
|
|
220
263
|
interface GroupField extends BaseField {
|
|
221
264
|
type: 'group';
|
|
222
265
|
fields: Field[];
|
|
266
|
+
/** Dirección del layout del grupo (override del formulario) */
|
|
267
|
+
direction?: 'vertical' | 'horizontal';
|
|
223
268
|
}
|
|
224
269
|
/**
|
|
225
270
|
* Campo row
|
|
@@ -287,7 +332,7 @@ interface OTPField extends BaseField {
|
|
|
287
332
|
/**
|
|
288
333
|
* Unión de todos los tipos de campos
|
|
289
334
|
*/
|
|
290
|
-
type Field = TextField | PasswordField | 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;
|
|
291
336
|
/**
|
|
292
337
|
* Step para formularios wizard
|
|
293
338
|
*/
|
|
@@ -339,6 +384,12 @@ interface FormSchema {
|
|
|
339
384
|
initialData?: Record<string, any>;
|
|
340
385
|
/** Configuración del botón de submit (también puede definirse vía atributo submit-button) */
|
|
341
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';
|
|
342
393
|
}
|
|
343
394
|
/**
|
|
344
395
|
* Componente personalizado para inyección
|
|
@@ -503,6 +554,10 @@ declare class EasyForm extends BrowserHTMLElement {
|
|
|
503
554
|
* Renderiza un campo custom
|
|
504
555
|
*/
|
|
505
556
|
private renderCustom;
|
|
557
|
+
/**
|
|
558
|
+
* Obtiene el progreso de campos obligatorios completados
|
|
559
|
+
*/
|
|
560
|
+
private getCompletedRequiredProgress;
|
|
506
561
|
/**
|
|
507
562
|
* Renderiza wizard
|
|
508
563
|
*/
|