@uniquedj95/vform 3.6.0 → 3.6.2
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 +137 -24
- package/dist/components/inputs/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/CheckboxInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/RadioInput.vue.d.ts +2 -10
- package/dist/components/inputs/RadioInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/RepeatInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/TextAreaInput.vue.d.ts.map +1 -1
- package/dist/components/shared/InputLabel.vue.d.ts +1 -0
- package/dist/components/shared/InputLabel.vue.d.ts.map +1 -1
- package/dist/components/shared/SectionTitle.vue.d.ts +2 -2
- package/dist/components/shared/SectionTitle.vue.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +690 -637
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/index.d.ts +26 -35
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/vform.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
A dynamic form builder for Vue.js with Ionic components
|
|
8
8
|
|
|
9
|
-
[](https://github.com/uniquedj95/vform/releases)
|
|
10
10
|
[](https://opensource.org/licenses/MIT)
|
|
11
11
|
[](https://vuejs.org/)
|
|
12
12
|
[](https://www.typescriptlang.org/)
|
|
@@ -103,7 +103,7 @@ npm run demo:update
|
|
|
103
103
|
- **Repeatable Field Groups**: Create dynamic, repeatable sets of form fields.
|
|
104
104
|
- **Advanced Validation**: Built-in validation with support for custom validation functions and step-by-step validation.
|
|
105
105
|
- **Computed Values**: Generate and transform values based on other form fields.
|
|
106
|
-
- **Customizable Styling**:
|
|
106
|
+
- **Customizable Styling**: Complete control over appearance with `className` property support across all input components and sections.
|
|
107
107
|
- **Form Actions**: Customizable buttons with support for additional custom actions.
|
|
108
108
|
- **Rich Text Areas**: Textarea inputs with auto-grow capability and character counting.
|
|
109
109
|
- **Form Field Dependencies**: Create relationships between fields that react to changes.
|
|
@@ -258,18 +258,18 @@ const formSchema: FormSchema = {
|
|
|
258
258
|
|
|
259
259
|
The following input types are supported:
|
|
260
260
|
|
|
261
|
-
| Type | Description
|
|
262
|
-
| --------------- |
|
|
263
|
-
| `TextInput` | Standard text input field
|
|
264
|
-
| `DateInput` | Date picker with customizable format
|
|
265
|
-
| `NumberInput` | Numeric input field
|
|
266
|
-
| `EmailInput` | Input field with email validation
|
|
267
|
-
| `PasswordInput` | Secure password input with toggle visibility
|
|
268
|
-
| `TextAreaInput` | Multi-line text input
|
|
269
|
-
| `SelectInput` | Dropdown selection
|
|
270
|
-
| `CheckboxInput` | Toggle on/off input
|
|
271
|
-
| `RepeatInput` | Repeatable group of fields
|
|
272
|
-
| `FormSection` | Section header with title and subtitle
|
|
261
|
+
| Type | Description |
|
|
262
|
+
| --------------- | --------------------------------------------------------------- |
|
|
263
|
+
| `TextInput` | Standard text input field |
|
|
264
|
+
| `DateInput` | Date picker with customizable format |
|
|
265
|
+
| `NumberInput` | Numeric input field |
|
|
266
|
+
| `EmailInput` | Input field with email validation |
|
|
267
|
+
| `PasswordInput` | Secure password input with toggle visibility |
|
|
268
|
+
| `TextAreaInput` | Multi-line text input |
|
|
269
|
+
| `SelectInput` | Dropdown selection |
|
|
270
|
+
| `CheckboxInput` | Toggle on/off input |
|
|
271
|
+
| `RepeatInput` | Repeatable group of fields |
|
|
272
|
+
| `FormSection` | Section header with title and subtitle (unified with FormField) |
|
|
273
273
|
|
|
274
274
|
#### Common Properties
|
|
275
275
|
|
|
@@ -287,12 +287,13 @@ The following input types are supported:
|
|
|
287
287
|
|
|
288
288
|
#### Layout Properties
|
|
289
289
|
|
|
290
|
-
| Property
|
|
291
|
-
|
|
|
292
|
-
| `grid`
|
|
293
|
-
| `
|
|
294
|
-
| `
|
|
295
|
-
| `
|
|
290
|
+
| Property | Type | Description |
|
|
291
|
+
| ----------- | ---------- | ------------------------------------------------------------- |
|
|
292
|
+
| `grid` | `GridSize` | Specifies responsive grid sizes: `xs`, `sm`, `md`, `lg`, `xl` |
|
|
293
|
+
| `className` | `string` | Custom CSS class for styling input fields and sections |
|
|
294
|
+
| `icon` | `string` | Icon to display within the input field |
|
|
295
|
+
| `prefix` | `string` | Text to display before the input value |
|
|
296
|
+
| `suffix` | `string` | Text to display after the input value |
|
|
296
297
|
|
|
297
298
|
#### Validation and Dynamic Behavior
|
|
298
299
|
|
|
@@ -349,6 +350,84 @@ The following input types are supported:
|
|
|
349
350
|
| ---------- | ------------ | ------------------------------------- |
|
|
350
351
|
| `children` | `FormSchema` | Schema for the repeatable field group |
|
|
351
352
|
|
|
353
|
+
### Custom Styling with className
|
|
354
|
+
|
|
355
|
+
All form input components now support the `className` property for custom styling. This allows you to apply CSS classes to individual input fields and form sections for complete visual customization.
|
|
356
|
+
|
|
357
|
+
#### Usage Examples
|
|
358
|
+
|
|
359
|
+
```typescript
|
|
360
|
+
const formSchema: FormSchema = {
|
|
361
|
+
// Custom styled text input
|
|
362
|
+
customInput: {
|
|
363
|
+
type: 'TextInput',
|
|
364
|
+
label: 'Styled Input',
|
|
365
|
+
className: 'my-custom-input',
|
|
366
|
+
placeholder: 'Enter text here',
|
|
367
|
+
},
|
|
368
|
+
|
|
369
|
+
// Custom styled section
|
|
370
|
+
styledSection: {
|
|
371
|
+
type: 'FormSection',
|
|
372
|
+
title: 'Custom Section',
|
|
373
|
+
subtitle: 'This section has custom styling',
|
|
374
|
+
className: 'my-custom-section',
|
|
375
|
+
},
|
|
376
|
+
|
|
377
|
+
// Custom styled select input
|
|
378
|
+
styledSelect: {
|
|
379
|
+
type: 'SelectInput',
|
|
380
|
+
label: 'Styled Select',
|
|
381
|
+
className: 'my-custom-select',
|
|
382
|
+
options: [
|
|
383
|
+
{ label: 'Option 1', value: '1' },
|
|
384
|
+
{ label: 'Option 2', value: '2' },
|
|
385
|
+
],
|
|
386
|
+
},
|
|
387
|
+
};
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
#### CSS Implementation
|
|
391
|
+
|
|
392
|
+
```css
|
|
393
|
+
/* Custom input styling */
|
|
394
|
+
.my-custom-input {
|
|
395
|
+
--background: #f8f9fa;
|
|
396
|
+
--border-color: #007bff;
|
|
397
|
+
--color: #333;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/* Custom section styling */
|
|
401
|
+
.my-custom-section .form-section-title {
|
|
402
|
+
color: #007bff;
|
|
403
|
+
font-size: 1.5rem;
|
|
404
|
+
font-weight: 600;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.my-custom-section .form-section-subtitle {
|
|
408
|
+
color: #6c757d;
|
|
409
|
+
font-style: italic;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/* Custom select styling */
|
|
413
|
+
.my-custom-select {
|
|
414
|
+
--background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
415
|
+
--color: white;
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
#### Component Support
|
|
420
|
+
|
|
421
|
+
The `className` property is supported across all input components:
|
|
422
|
+
|
|
423
|
+
- **BaseInput**: Applied to `ion-input` element (covers TextInput, EmailInput, NumberInput, PasswordInput, DateInput)
|
|
424
|
+
- **TextAreaInput**: Applied to `ion-textarea` element
|
|
425
|
+
- **SelectInput**: Applied to the wrapper container
|
|
426
|
+
- **CheckboxInput**: Applied to `ion-checkbox` element
|
|
427
|
+
- **RadioInput**: Applied to `ion-radio-group` element
|
|
428
|
+
- **RepeatInput**: Applied to each repeat group wrapper
|
|
429
|
+
- **FormSection**: Applied to the section container
|
|
430
|
+
|
|
352
431
|
## Multi-Step Forms
|
|
353
432
|
|
|
354
433
|
vForm supports multi-step forms with configurable step indicators, validation, and smart navigation. Multi-step forms break complex forms into manageable sections, improving user experience and data collection.
|
|
@@ -734,7 +813,7 @@ To work properly with the multi-step form, your custom component should:
|
|
|
734
813
|
</template>
|
|
735
814
|
|
|
736
815
|
<script setup>
|
|
737
|
-
import { ref
|
|
816
|
+
import { ref } from 'vue';
|
|
738
817
|
|
|
739
818
|
const props = defineProps({
|
|
740
819
|
// Your props here
|
|
@@ -847,11 +926,11 @@ multiStepData: MultiStepFormData = {
|
|
|
847
926
|
|
|
848
927
|
## Form Sections
|
|
849
928
|
|
|
850
|
-
Form sections allow you to organize your forms into logical groups with titles and subtitles, making complex forms more readable and user-friendly. Sections are
|
|
929
|
+
Form sections allow you to organize your forms into logical groups with titles and subtitles, making complex forms more readable and user-friendly. Sections are now fully integrated into the FormField interface, providing a unified approach to form building.
|
|
851
930
|
|
|
852
931
|
### Basic Section Usage
|
|
853
932
|
|
|
854
|
-
To create sections in your form, add `FormSection`
|
|
933
|
+
To create sections in your form, add FormField items with `type: 'FormSection'` to your schema alongside regular form fields:
|
|
855
934
|
|
|
856
935
|
```vue
|
|
857
936
|
<template>
|
|
@@ -932,7 +1011,7 @@ function handleSubmit(formData: FormData, computedData: ComputedData) {
|
|
|
932
1011
|
|
|
933
1012
|
### Section Configuration
|
|
934
1013
|
|
|
935
|
-
Form sections support the following configuration options:
|
|
1014
|
+
Form sections are FormField objects with `type: 'FormSection'` and support the following configuration options:
|
|
936
1015
|
|
|
937
1016
|
| Property | Type | Description | Required |
|
|
938
1017
|
| ----------- | --------------- | ------------------------------------------ | -------- |
|
|
@@ -941,6 +1020,9 @@ Form sections support the following configuration options:
|
|
|
941
1020
|
| `subtitle` | `string` | Optional subtitle for additional context | |
|
|
942
1021
|
| `className` | `string` | Optional CSS class for custom styling | |
|
|
943
1022
|
| `grid` | `GridSize` | Grid layout configuration for the section | |
|
|
1023
|
+
| `label` | `string` | Alternative to `title` for section header | |
|
|
1024
|
+
|
|
1025
|
+
> **Note**: For sections, you can use either `title` or `label` for the section header. The `title` property is recommended for clarity, but `label` is supported for consistency with other form fields.
|
|
944
1026
|
|
|
945
1027
|
#### Grid Configuration
|
|
946
1028
|
|
|
@@ -987,11 +1069,13 @@ You can customize section appearance using the `className` property and your own
|
|
|
987
1069
|
|
|
988
1070
|
#### Important Notes
|
|
989
1071
|
|
|
1072
|
+
- **Unified Interface**: Form sections are now part of the FormField interface, providing a consistent API for all form elements
|
|
990
1073
|
- **Data Handling**: Form sections are display-only components and do not contribute to form data
|
|
991
1074
|
- **Validation**: Sections cannot have validation rules as they don't hold values
|
|
992
1075
|
- **Order**: Sections will appear in the form in the order they're defined in your schema
|
|
993
1076
|
- **Multi-Step Compatibility**: Sections work seamlessly within multi-step forms
|
|
994
1077
|
- **Responsive**: Sections automatically adapt to different screen sizes using Ionic's grid system
|
|
1078
|
+
- **Custom Styling**: Use the `className` property to apply custom CSS classes to sections
|
|
995
1079
|
|
|
996
1080
|
## Form Events
|
|
997
1081
|
|
|
@@ -1161,6 +1245,35 @@ You can reset multiple dependent fields at once using onChange:
|
|
|
1161
1245
|
|
|
1162
1246
|
### Advanced Components
|
|
1163
1247
|
|
|
1248
|
+
#### DateInput
|
|
1249
|
+
|
|
1250
|
+
The DateInput component supports both date-only and date-time inputs, with different format requirements for setting default values:
|
|
1251
|
+
|
|
1252
|
+
- **Date Only Format**: When using DateInput without time selection.
|
|
1253
|
+
|
|
1254
|
+
```js
|
|
1255
|
+
{
|
|
1256
|
+
type: 'DateInput',
|
|
1257
|
+
label: 'Date of Birth',
|
|
1258
|
+
value: '', // Format: YYYY-MM-DD
|
|
1259
|
+
required: true
|
|
1260
|
+
}
|
|
1261
|
+
```
|
|
1262
|
+
|
|
1263
|
+
- **Date Time Format**: When using DateInput with time selection enabled.
|
|
1264
|
+
|
|
1265
|
+
```js
|
|
1266
|
+
{
|
|
1267
|
+
type: 'DateInput',
|
|
1268
|
+
label: 'Appointment Date & Time',
|
|
1269
|
+
value: '', // Format: YYYY-MM-DDTHH:MM:SS
|
|
1270
|
+
enableTime: true,
|
|
1271
|
+
required: true
|
|
1272
|
+
}
|
|
1273
|
+
```
|
|
1274
|
+
|
|
1275
|
+
Setting the `enableTime` property to `true` will render a datetime-local input that allows users to select both date and time.
|
|
1276
|
+
|
|
1164
1277
|
#### SelectInput
|
|
1165
1278
|
|
|
1166
1279
|
The SelectInput component provides various display modes for selection options:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/BaseInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaseInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/BaseInput.vue"],"names":[],"mappings":"AAgCA;AA2EA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAMhE,KAAK,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,UAAU,CAAC;IAAC,IAAI,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC;AAElE,QAAA,MAAM,KAAK,iEAAoE,CAAC;AAwChF,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;CAClC,GAAG,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;AAoKhB,wBAUG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/CheckboxInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheckboxInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/CheckboxInput.vue"],"names":[],"mappings":"AAiBA;AA0DA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKhD,KAAK,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC;AAE3C,QAAA,MAAM,KAAK,iEAAoE,CAAC;AAYhF,iBAAS,OAAO,SAIf;AAsBD,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;CAClC,GAAG,WAAW,CAAC;;;;;;;;;;;;;;;;;;;AAyFhB,wBAUG"}
|
|
@@ -11,19 +11,11 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
|
11
11
|
onValueUpdate: () => Promise<void>;
|
|
12
12
|
onReset: typeof onReset;
|
|
13
13
|
getErrors: () => string[];
|
|
14
|
+
isValid: () => Promise<boolean>;
|
|
14
15
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
15
16
|
"update:modelValue": (value: FormField) => any;
|
|
16
17
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
17
18
|
"onUpdate:modelValue"?: ((value: FormField) => any) | undefined;
|
|
18
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
19
|
-
inputRef: import('vue').CreateComponentPublicInstanceWithMixins<import("@ionic/core").JSX.IonRadioGroup & import('@stencil/vue-output-target/runtime').InputProps<any> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, {}, {}, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
20
|
-
P: {};
|
|
21
|
-
B: {};
|
|
22
|
-
D: {};
|
|
23
|
-
C: {};
|
|
24
|
-
M: {};
|
|
25
|
-
Defaults: {};
|
|
26
|
-
}, import("@ionic/core").JSX.IonRadioGroup & import('@stencil/vue-output-target/runtime').InputProps<any> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, {}, {}, {}, {}, {}> | null;
|
|
27
|
-
}, any>;
|
|
19
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
28
20
|
export default _default;
|
|
29
21
|
//# sourceMappingURL=RadioInput.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/RadioInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RadioInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/RadioInput.vue"],"names":[],"mappings":"AA4BA;AAwFA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAU,MAAM,SAAS,CAAC;AAKxD,KAAK,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC;AAE3C,QAAA,MAAM,KAAK,iEAAoE,CAAC;AAehF,iBAAS,OAAO,SAIf;AAuCD,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;CAClC,GAAG,WAAW,CAAC;;;;;;;;;;;AAyJhB,wBAQG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepeatInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/RepeatInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RepeatInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/RepeatInput.vue"],"names":[],"mappings":"AAwDA;AAgLA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAU,MAAM,SAAS,CAAC;AAOhF,UAAU,MAAM;IACd,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,KAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,QAAA,MAAM,KAAK,iEAAoE,CAAC;AA2ChF,iBAAS,OAAO,SAEf;AAED,iBAAS,SAAS,aAEjB;AAED,iBAAe,aAAa,kBAE3B;AAiBD,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;CAClC,GAAG,WAAW,CAAC;;;;;;;;;;;;AA0OhB,wBASG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/SelectInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/SelectInput.vue"],"names":[],"mappings":"AA6DA;AAqeA,OAAO,EAAiB,QAAQ,EAA6C,MAAM,KAAK,CAAC;AAEzF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAU,MAAM,SAAS,CAAC;AAwFxE,iBAAS,OAAO,SAMf;AAkJD,iBAAe,aAAa,CAAC,GAAG,CAAC,EAAE,GAAG,iBAgBrC;;YA0amB,QAAQ,CAAC,UAAU,CAAC;UACtB,QAAQ,CAAC,cAAc,CAAC;;;;;;;;;;;;YADtB,QAAQ,CAAC,UAAU,CAAC;UACtB,QAAQ,CAAC,cAAc,CAAC;;;;;;;;;;;;;;;;;;AAX1C,wBAiBG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAreaInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/TextAreaInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextAreaInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/TextAreaInput.vue"],"names":[],"mappings":"AA8BA;AAkEA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKhD,KAAK,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC;AAE3C,QAAA,MAAM,KAAK,iEAAoE,CAAC;AAiChF,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;CAClC,GAAG,WAAW,CAAC;;;;;;;;;;;;;;;;;;;AA6HhB,wBAUG"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FormField } from '../../types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
model: FormField;
|
|
4
|
+
slotName?: string;
|
|
4
5
|
};
|
|
5
6
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
6
7
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputLabel.vue.d.ts","sourceRoot":"","sources":["../../../src/components/shared/InputLabel.vue"],"names":[],"mappings":"AAMA;
|
|
1
|
+
{"version":3,"file":"InputLabel.vue.d.ts","sourceRoot":"","sources":["../../../src/components/shared/InputLabel.vue"],"names":[],"mappings":"AAMA;AAuBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;;AAyEF,wBAMG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionTitle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/shared/SectionTitle.vue"],"names":[],"mappings":"AAgBA;AAoFA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"SectionTitle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/shared/SectionTitle.vue"],"names":[],"mappings":"AAgBA;AAoFA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErD,UAAU,iBAAiB;IAEzB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;;AAwFD,wBAOG"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=require("@ionic/vue"),Z=require("ionicons/icons"),ye=require("@maskito/vue");function Ce(o){return new Promise(u=>{requestAnimationFrame(async()=>{const n=await o.getInputElement();u(n)})})}const Ve={d:/\d/,a:/[A-Za-z]/,"*":/[A-Za-z0-9]/},Be={d:["1","2","3","4","5","6","7","8","9","0"],a:["A","B","C","x","y","z","D","f"],"*":["A","3","b","8","z","4","D","0"]};function we(o,u){const n=Be[o];return n[u%n.length]}function Se(o){const u=[];let n="",t=0,l=0;for(;t<o.length;){const r=o[t];if(["d","a","*"].includes(r)){let s=1;if(o[t+1]==="{"){const a=o.indexOf("}",t+2);if(a!==-1){const h=o.slice(t+2,a);if(h.includes(",")){const[,d]=h.split(",").map(p=>parseInt(p.trim()));s=d||parseInt(h.split(",")[0])}else s=parseInt(h);t=a}}else{let a=t+1;for(;o[a]===r;)s++,a++;t=a-1}for(let a=0;a<s;a++)u.push(Ve[r]),n+=we(r,l++)}else u.push(r),n+=r;t++}return{mask:u,placeholder:n,elementPredicate:Ce}}function Q(o){return o==null||Array.isArray(o)&&!o.length||typeof o=="object"&&!Object.keys(o).length||!o}function X(o,u,n){return typeof o.condition=="function"?o.condition(u,n):!0}function Y(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return o.map(n=>Y(n));const u={};return Object.entries(o).forEach(([n,t])=>{typeof t=="function"?u[n]=t.bind(u):u[n]=Y(t)}),u}function ee(o,u){return u.findIndex(n=>n.value===o.value||n.label===o.label||n.value===o.label||n.label===o.value)}function $(o,u){const n=ee(o,u);n>=0?u[n].isChecked=!0:u.push({...o,isChecked:!0})}function _e(o,u){const n=ee(o,u);n>=0&&(u[n].isChecked=!1)}function be(o){o.forEach(u=>{u.isChecked=!1})}function xe(o,u){return u?o.filter(n=>JSON.stringify(n).toLowerCase().includes(u.toLowerCase())):o}function ne(o){const u=o.label||"",n=o.required?" *":"";return u+n}function G(o,u){if(o===u)return!0;if(o==null||u==null||typeof o!=typeof u)return!1;if(typeof o!="object")return o===u;if(Array.isArray(o)&&Array.isArray(u))return o.length!==u.length?!1:o.every((l,r)=>G(l,u[r]));if(Array.isArray(o)!==Array.isArray(u))return!1;const n=Object.keys(o),t=Object.keys(u);return n.length!==t.length?!1:n.every(l=>Object.prototype.hasOwnProperty.call(u,l)&&G(o[l],u[l]))}function F(o){return o.type!=="FormSection"}function Ee(o){return o.type==="FormSection"}function te(){const o=e.ref([]);async function u(){console.debug("Validating form inputs");const r=[];for(const s of o.value)if(typeof(s==null?void 0:s.onValueUpdate)=="function"&&await s.onValueUpdate(),typeof(s==null?void 0:s.getErrors)=="function")try{const a=s.getErrors();Array.isArray(a)?r.push(...a):console.warn("getErrors() returned non-array value:",a)}catch(a){console.error("Error calling getErrors on component:",a,s)}else console.warn("Component does not have getErrors function:",s);return r.every(Q)}function n(){o.value.forEach(r=>{typeof(r==null?void 0:r.onReset)=="function"&&r.onReset()})}function t(){const r=[];for(const s of o.value)if(typeof(s==null?void 0:s.getErrors)=="function")try{const a=s.getErrors();Array.isArray(a)?r.push(...a):r.push(String(a))}catch(a){console.error("Error calling getErrors on component:",a,s)}return r}async function l(){for(const r of o.value)typeof(r==null?void 0:r.onValueUpdate)=="function"&&await r.onValueUpdate()}return{dynamicRefs:o,isFormValid:u,resetForm:n,getFormErrors:t,updateFormValues:l}}function le(o){const u=e.computed(()=>Object.entries(o.value).reduce((d,[p,f])=>(F(f)&&f.value!==void 0&&(typeof f.onChange=="function"?d[p]=f.onChange(f.value,o.value):d[p]=f.value),d),{})),n=e.ref({}),t=(d,p,f)=>{const i=o.value[d];if(F(i)&&i.children){const v=i.children[p];if(v&&F(v)&&typeof v.computedValue=="function")return v.computedValue(f,o.value)}return f},l=(d,p,f,i)=>{n.value[d][i]||(n.value[d][i]={}),Object.entries(p.other??{}).forEach(([v,B])=>{var w;!G(B,(w=f.other)==null?void 0:w[v])&&(n.value[d][i][v]=t(d,v,B))})},r=(d,p,f)=>{p.forEach((i,v)=>{const B=f[v]??{other:{}};l(d,i,B,v)})},s=(d,{other:p})=>Object.entries(p??{}).reduce((f,[i,v])=>(f[i]=t(d,i,v),f),{}),a=(d,p,f)=>{n.value[d]||(n.value[d]=[]);const i=p;Array.isArray(f[d])?r(d,i,f[d]):n.value[d]=i.map(v=>s(d,v))},h=(d,p,f)=>{if(!p){delete n.value[d];return}const i=o.value[d];F(i)&&(i.children!==void 0?a(d,p,f):typeof i.computedValue=="function"&&(n.value[d]=i.computedValue(p,o.value)))};return e.watch(u,(d,p={})=>{Object.keys(d).forEach(f=>{G(d[f],p[f])||h(f,d[f],p)}),Object.keys(p).forEach(f=>{!(f in d)&&f in n.value&&delete n.value[f]})},{immediate:!0,deep:!0}),{formData:u,computedData:n}}function ae(o){const u=e.ref(0),n=e.ref({}),t=e.ref({}),l=e.ref({});function r(C){const m={};return C.component||!C.schema||Object.entries(C.schema).forEach(([g,V])=>{F(V)&&(m[g]=V.value)}),m}o.steps.forEach(C=>{n.value[C.id]=r(C),t.value[C.id]={},l.value[C.id]=[]});const s=e.ref(o.steps.map(C=>C.id)),a=e.computed(()=>o.steps.filter(m=>m.condition?m.condition(n.value,t.value):!0));e.watch(a,C=>{const m=C.map(V=>V.id);s.value.filter(V=>!m.includes(V)).forEach(V=>{b(V)}),s.value=m});const h=e.computed(()=>a.value.length>0?u.value>=a.value.length?a.value[a.value.length-1]:a.value[u.value]:o.steps[u.value]),d=e.computed(()=>u.value===0),p=e.computed(()=>u.value===a.value.length-1),f=e.computed(()=>!p.value),i=e.computed(()=>!d.value),v=e.computed(()=>a.value.length),B=e.computed(()=>v.value===0?0:Math.round((u.value+1)/v.value*100));function y(C,m){n.value[C]={...n.value[C],...m}}function w(C,m){t.value[C]={...t.value[C],...m}}function b(C){const m=o.steps.find(g=>g.id===C);m&&(n.value[C]=r(m),t.value[C]={})}async function x(){const C=h.value;if(!C)return!0;const m=[];if(C.validation){const g=await C.validation(n.value[C.id],t.value[C.id]);g&&m.push(...g)}return l.value[C.id]=m,m.length===0}async function R(C){return C<0||C>=a.value.length||C>u.value&&!await x()?!1:(u.value=C,!0)}async function A(){return f.value?R(u.value+1):!1}async function z(){return i.value?R(u.value-1):!1}function T(){u.value=0,l.value={},o.steps.forEach(C=>{b(C.id),l.value[C.id]=[]})}async function O(){let C=!0;for(const m of o.steps)if(m.validation){const g=await m.validation(n.value[m.id],t.value[m.id]);l.value[m.id]=g||[],g&&g.length>0&&(C=!1)}return C}function I(){return{formData:{...n.value},computedData:{...t.value}}}return{currentStepIndex:u,currentStep:h,stepData:n,stepComputedData:t,stepValidationErrors:l,visibleSteps:a,isFirstStep:d,isLastStep:p,canGoNext:f,canGoPrevious:i,totalSteps:v,progressPercentage:B,updateStepData:y,updateStepComputedData:w,clearStepData:b,validateCurrentStep:x,goToStep:R,nextStep:A,previousStep:z,resetForm:T,validateAllSteps:O,getMultiStepFormData:I}}const Ne={class:"step-indicator__container"},Ie=["onClick"],Oe={class:"step-indicator__step-content"},De={class:"step-indicator__step-marker"},Fe={class:"step-indicator__step-info"},Re={class:"step-indicator__step-title"},ze={key:0,class:"step-indicator__step-subtitle"},Te={key:0,class:"step-indicator__progress"},Ae={class:"step-indicator__progress-bar"},$e={class:"step-indicator__progress-text"},Me=e.defineComponent({__name:"StepIndicator",props:{steps:{},activeStepIndex:{},position:{},showProgress:{type:Boolean,default:!0},allowNavigation:{type:Boolean,default:!1}},emits:["step-click"],setup(o,{emit:u}){const n=o,t=u,l=e.computed(()=>n.steps.length===0?0:(n.activeStepIndex+1)/n.steps.length*100);function r(s){n.allowNavigation&&t("step-click",s)}return(s,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["step-indicator",[`step-indicator--${s.position}`,{"step-indicator--clickable":s.allowNavigation}]])},[e.createElementVNode("div",Ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.steps,(h,d)=>(e.openBlock(),e.createElementBlock("div",{key:h.id,class:e.normalizeClass(["step-indicator__step",{"step-indicator__step--active":d===s.activeStepIndex,"step-indicator__step--completed":d<s.activeStepIndex,"step-indicator__step--clickable":s.allowNavigation}]),onClick:p=>r(d)},[e.createElementVNode("div",Oe,[e.createElementVNode("div",De,[e.createElementVNode("span",null,e.toDisplayString(d+1),1)]),e.createElementVNode("div",Fe,[e.createElementVNode("div",Re,e.toDisplayString(h.title),1),h.subtitle?(e.openBlock(),e.createElementBlock("div",ze,e.toDisplayString(h.subtitle),1)):e.createCommentVNode("",!0)])]),d<s.steps.length-1?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["step-indicator__connector",{"step-indicator__connector--completed":d<s.activeStepIndex}])},null,2)):e.createCommentVNode("",!0)],10,Ie))),128))]),s.showProgress&&(s.position==="top"||s.position==="bottom")?(e.openBlock(),e.createElementBlock("div",Te,[e.createElementVNode("div",Ae,[e.createElementVNode("div",{class:"step-indicator__progress-fill",style:e.normalizeStyle({width:`${l.value}%`})},null,4)]),e.createElementVNode("div",$e," Step "+e.toDisplayString(s.activeStepIndex+1)+" of "+e.toDisplayString(s.steps.length),1)])):e.createCommentVNode("",!0)],2))}}),H=(o,u)=>{const n=o.__vccOpts||o;for(const[t,l]of u)n[t]=l;return n},W=H(Me,[["__scopeId","data-v-aca1a6d0"]]),Pe={class:"v-form-container"},Le={key:0,class:"multi-step-form"},Ue={class:"multi-step-form-content"},qe={class:"step-nav-buttons"},je={class:"step-action-buttons"},Ge={class:"step-nav-buttons"},He={key:3,class:"step-progress-bottom"},Ke={class:"step-progress-bar"},We={class:"step-progress-text"},Ze=e.defineComponent({__name:"vForm",props:{schema:{},multiStepConfig:{},showLabels:{type:Boolean,default:!0},showClearButton:{type:Boolean,default:!0},showCancelButton:{type:Boolean,default:!0},buttonPlacement:{default:"start"},submitButtonText:{default:"Submit"},clearButtonText:{default:"Reset"},cancelButtonText:{default:"Cancel"},hideButtons:{type:Boolean,default:!1},customButtons:{}},emits:["submit","multi-step-submit","step-change","clear","cancel"],setup(o,{expose:u,emit:n}){const t=o,l=n,r=e.computed(()=>!!t.multiStepConfig),s=e.ref(t.schema||{}),a=t.multiStepConfig?ae(t.multiStepConfig):null,{dynamicRefs:h,isFormValid:d,resetForm:p}=te(),{formData:f,computedData:i}=le(s),v=e.ref(null),B=e.computed(()=>(a==null?void 0:a.currentStepIndex.value)??0),y=e.computed(()=>a==null?void 0:a.currentStep.value),w=e.computed(()=>(a==null?void 0:a.visibleSteps.value)??[]),b=e.computed(()=>(a==null?void 0:a.isLastStep.value)??!0),x=e.computed(()=>(a==null?void 0:a.canGoNext.value)??!1),R=e.computed(()=>(a==null?void 0:a.canGoPrevious.value)??!1),A=e.computed(()=>!r.value||!a?0:a.progressPercentage.value);e.watch(()=>y.value,c=>{c&&r.value&&(s.value=c.schema||{})},{immediate:!0}),e.watch([f,i],([c,_])=>{r.value&&a&&y.value&&(a.updateStepData(y.value.id,c),a.updateStepComputedData(y.value.id,_))},{deep:!0}),e.watch(()=>t.schema,c=>{if(!r.value&&c){s.value=c;for(const[_,E]of Object.entries(c))F(E)&&"value"in E&&E.value!==void 0&&(s.value[_].value=E.value)}},{deep:!0,immediate:!0});async function z(){var c;if(r.value&&a){if((c=y.value)!=null&&c.component&&v.value&&typeof v.value.validate=="function"&&!await v.value.validate()||!await a.validateAllSteps())return;const E=a.getMultiStepFormData();l("multi-step-submit",E)}else{if(!await d())return;l("submit",f.value,i.value)}}function T(){r.value&&a?a.resetForm():p(),l("clear")}function O(){r.value&&a&&y.value&&a.clearStepData(y.value.id)}function I(){r.value&&a?a.resetForm():p(),l("cancel")}async function C(){var c;if(a){let _=!0;if((c=y.value)!=null&&c.component&&v.value?typeof v.value.validate=="function"&&(_=await v.value.validate()):_=await d(),!_)return;await a.nextStep()&&y.value&&l("step-change",B.value,y.value.id)}}async function m(){a&&await a.previousStep()&&y.value&&l("step-change",B.value,y.value.id)}async function g(c){var _;if(a){if(c>B.value){let D=!0;if((_=y.value)!=null&&_.component&&v.value?typeof v.value.validate=="function"&&(D=await v.value.validate()):D=await d(),!D)return}await a.goToStep(c)&&y.value&&l("step-change",c,y.value.id)}}e.watch(f,async()=>{var c;for(const[_,E]of Object.entries(s.value))if(F(E)&&!X(E,f.value,i.value)){const D=r.value&&y.value&&y.value.schema?y.value.schema[_]:(c=t.schema)==null?void 0:c[_];D&&F(D)&&"value"in D&&(E.value=D.value)}},{deep:!0,immediate:!0});function V(c){r.value&&a&&y.value&&a.updateStepData(y.value.id,c)}function N(c,_,E){return Ee(c)?!0:X(c,_,E)}return u({resetForm:T,isFormValid:d,resolveData:()=>r.value&&a?a.getMultiStepFormData():{formData:f.value,computedData:i.value},nextStep:C,previousStep:m,goToStep:g,getCurrentStep:()=>y.value,getCurrentStepIndex:()=>B.value}),(c,_)=>{var E,D;return e.openBlock(),e.createElementBlock("div",Pe,[r.value?(e.openBlock(),e.createElementBlock("div",Le,[c.multiStepConfig&&c.multiStepConfig.stepPosition==="top"?(e.openBlock(),e.createBlock(W,{key:0,steps:w.value,"active-step-index":B.value,position:c.multiStepConfig.stepPosition||"top","show-progress":c.multiStepConfig.showProgress,"allow-navigation":c.multiStepConfig.allowStepNavigation,onStepClick:g},null,8,["steps","active-step-index","position","show-progress","allow-navigation"])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["multi-step-content",`multi-step-content--${((E=c.multiStepConfig)==null?void 0:E.stepPosition)||"top"}`])},[c.multiStepConfig&&c.multiStepConfig.stepPosition==="left"?(e.openBlock(),e.createBlock(W,{key:0,steps:w.value,"active-step-index":B.value,position:c.multiStepConfig.stepPosition??"top","show-progress":c.multiStepConfig.showProgress,"allow-navigation":c.multiStepConfig.allowStepNavigation,onStepClick:g,class:"multi-step-sidebar"},null,8,["steps","active-step-index","position","show-progress","allow-navigation"])):e.createCommentVNode("",!0),e.createElementVNode("div",Ue,[(D=y.value)!=null&&D.component?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(y.value.component),e.mergeProps({key:0},y.value.componentProps||{},{"onUpdate:data":V,ref_key:"customComponentRef",ref:v}),null,16)):(e.openBlock(),e.createBlock(e.unref(k.IonGrid),{key:1},{default:e.withCtx(()=>[e.createVNode(e.unref(k.IonRow),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.keys(s.value),S=>{var P,L,U,q,j;return e.openBlock(),e.createElementBlock(e.Fragment,{key:S},[N(s.value[S],e.unref(f),e.unref(i))?(e.openBlock(),e.createBlock(e.unref(k.IonCol),{key:0,size:((P=s.value[S].grid)==null?void 0:P.xs)??"12","size-sm":(L=s.value[S].grid)==null?void 0:L.sm,"size-md":(U=s.value[S].grid)==null?void 0:U.md,"size-lg":(q=s.value[S].grid)==null?void 0:q.lg,"size-xl":(j=s.value[S].grid)==null?void 0:j.xl,class:"ion-margin-vertical"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value[S].type),{modelValue:s.value[S],"onUpdate:modelValue":J=>s.value[S]=J,schema:s.value,"form-id":S,ref_for:!0,ref_key:"dynamicRefs",ref:h,"ref-key":S},null,8,["modelValue","onUpdate:modelValue","schema","form-id","ref-key"]))]),_:2},1032,["size","size-sm","size-md","size-lg","size-xl"])):e.createCommentVNode("",!0)],64)}),128))]),_:1})]),_:1})),c.hideButtons?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(k.IonRow),{key:2,class:"multi-step-buttons"},{default:e.withCtx(()=>[e.createVNode(e.unref(k.IonCol),{size:"12",class:"button-container"},{default:e.withCtx(()=>[e.createElementVNode("div",qe,[R.value?(e.openBlock(),e.createBlock(e.unref(k.IonButton),{key:0,onClick:m,fill:"outline"},{default:e.withCtx(()=>_[0]||(_[0]=[e.createTextVNode(" Previous ")])),_:1,__:[0]})):e.createCommentVNode("",!0)]),e.createElementVNode("div",je,[c.showCancelButton?(e.openBlock(),e.createBlock(e.unref(k.IonButton),{key:0,onClick:I,fill:"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.cancelButtonText??"Cancel"),1)]),_:1})):e.createCommentVNode("",!0),c.showClearButton?(e.openBlock(),e.createBlock(e.unref(k.IonButton),{key:1,onClick:O,fill:"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.clearButtonText??"Reset"),1)]),_:1})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.customButtons,S=>(e.openBlock(),e.createBlock(e.unref(k.IonButton),{key:S.label,onClick:S.action,color:S.color??"primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S.label),1)]),_:2},1032,["onClick","color"]))),128))]),e.createElementVNode("div",Ge,[x.value?(e.openBlock(),e.createBlock(e.unref(k.IonButton),{key:0,onClick:C},{default:e.withCtx(()=>_[1]||(_[1]=[e.createTextVNode(" Next ")])),_:1,__:[1]})):e.createCommentVNode("",!0),b.value?(e.openBlock(),e.createBlock(e.unref(k.IonButton),{key:1,onClick:z},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.submitButtonText??"Submit"),1)]),_:1})):e.createCommentVNode("",!0)])]),_:1})]),_:1})),c.multiStepConfig&&(c.multiStepConfig.stepPosition==="left"||c.multiStepConfig.stepPosition==="right")&&c.multiStepConfig.showProgress?(e.openBlock(),e.createElementBlock("div",He,[e.createElementVNode("div",Ke,[e.createElementVNode("div",{class:"step-progress-fill",style:e.normalizeStyle({width:`${A.value}%`})},null,4)]),e.createElementVNode("div",We," Step "+e.toDisplayString(B.value+1)+" of "+e.toDisplayString(w.value.length),1)])):e.createCommentVNode("",!0)]),c.multiStepConfig&&c.multiStepConfig.stepPosition==="right"?(e.openBlock(),e.createBlock(W,{key:1,steps:w.value,"active-step-index":B.value,position:c.multiStepConfig.stepPosition,"show-progress":c.multiStepConfig.showProgress,"allow-navigation":c.multiStepConfig.allowStepNavigation,onStepClick:g,class:"multi-step-sidebar"},null,8,["steps","active-step-index","position","show-progress","allow-navigation"])):e.createCommentVNode("",!0)],2),c.multiStepConfig&&c.multiStepConfig.stepPosition==="bottom"?(e.openBlock(),e.createBlock(W,{key:1,steps:w.value,"active-step-index":B.value,position:c.multiStepConfig.stepPosition,"show-progress":c.multiStepConfig.showProgress,"allow-navigation":c.multiStepConfig.allowStepNavigation,onStepClick:g},null,8,["steps","active-step-index","position","show-progress","allow-navigation"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createBlock(e.unref(k.IonGrid),{key:1},{default:e.withCtx(()=>[e.createVNode(e.unref(k.IonRow),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.keys(s.value),S=>{var P,L,U,q,j;return e.openBlock(),e.createElementBlock(e.Fragment,{key:S},[N(s.value[S],e.unref(f),e.unref(i))?(e.openBlock(),e.createBlock(e.unref(k.IonCol),{key:0,size:((P=s.value[S].grid)==null?void 0:P.xs)??"12","size-sm":(L=s.value[S].grid)==null?void 0:L.sm,"size-md":(U=s.value[S].grid)==null?void 0:U.md,"size-lg":(q=s.value[S].grid)==null?void 0:q.lg,"size-xl":(j=s.value[S].grid)==null?void 0:j.xl,class:"ion-margin-vertical"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value[S].type),{modelValue:s.value[S],"onUpdate:modelValue":J=>s.value[S]=J,schema:s.value,"form-id":S,ref_for:!0,ref_key:"dynamicRefs",ref:h,"ref-key":S,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","schema","form-id","ref-key"]))]),_:2},1032,["size","size-sm","size-md","size-lg","size-xl"])):e.createCommentVNode("",!0)],64)}),128))]),_:1}),c.hideButtons?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(k.IonRow),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(k.IonCol),{size:"12",style:e.normalizeStyle([{display:"flex"},{justifyContent:c.buttonPlacement}])},{default:e.withCtx(()=>[c.showCancelButton?(e.openBlock(),e.createBlock(e.unref(k.IonButton),{key:0,onClick:I},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.cancelButtonText??"Cancel"),1)]),_:1})):e.createCommentVNode("",!0),c.showClearButton?(e.openBlock(),e.createBlock(e.unref(k.IonButton),{key:1,onClick:T},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.clearButtonText??"Reset"),1)]),_:1})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.customButtons,S=>(e.openBlock(),e.createBlock(e.unref(k.IonButton),{key:S.label,onClick:S.action,color:S.color??"primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S.label),1)]),_:2},1032,["onClick","color"]))),128)),e.createVNode(e.unref(k.IonButton),{onClick:z},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.submitButtonText??"Submit"),1)]),_:1})]),_:1},8,["style"])]),_:1}))]),_:1}))])}}}),re=H(Ze,[["__scopeId","data-v-a0ab63bd"]]);function Je(o){return{applyValidationState:async t=>{var l,r,s,a,h;(l=o.value)==null||l.$el.classList.remove("ion-invalid"),(r=o.value)==null||r.$el.classList.remove("ion-valid"),t?(s=o.value)==null||s.$el.classList.add("ion-valid"):(a=o.value)==null||a.$el.classList.add("ion-invalid"),(h=o.value)==null||h.$el.classList.add("ion-touched")},resetValidationState:()=>{var t,l;(t=o.value)==null||t.$el.classList.remove("ion-touched"),(l=o.value)==null||l.$el.classList.remove("ion-invalid")}}}function M(o,u,n,t,l){const{applyValidationState:r,resetValidationState:s}=Je(o);async function a(){if(u.value.required&&!n.value)return u.value.error="This field is required",!1;if(l){const i=await l(n.value);if(typeof i=="string")return u.value.error=i,!1;if(i===!1)return!1}if(u.value.validation){const i=await u.value.validation(n.value,t==null?void 0:t.value);if(i&&i.length)return u.value.error=i.join(),!1}return!0}async function h(){const i=await a();i&&(u.value.error="",u.value.value=n.value),await r(i)}function d(){s(),u.value.error=""}function p(i=""){n.value=i,u.value.error="",u.value.value=i}function f(){return u.value.error?[u.value.error]:[]}return{isValid:a,onValueUpdate:h,onFocus:d,onReset:p,getErrors:f,applyValidationState:r,resetValidationState:s}}function Qe(o){const u=e.computed(()=>!!o.value.label),n=e.computed(()=>!!o.value.required),t=e.computed(()=>o.value.label||"");return{showLabel:u,showRequired:n,labelText:t}}const oe=e.defineComponent({__name:"InputLabel",props:{model:{}},setup(o){const u=o,{showLabel:n,showRequired:t,labelText:l}=Qe(e.toRef(u,"model"));return(r,s)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(k.IonLabel),{key:0,slot:"label",class:"input-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l))+" ",1),e.unref(t)?(e.openBlock(),e.createBlock(e.unref(k.IonText),{key:0,color:"danger"},{default:e.withCtx(()=>s[0]||(s[0]=[e.createTextVNode("*")])),_:1,__:[0]})):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0)}}),K=e.defineComponent({__name:"BaseInput",props:e.mergeModels({schema:{},type:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const n=o,t=e.useModel(o,"modelValue"),l=e.ref(null),r=e.ref(t.value.value),s=e.computed(()=>n.schema),{isValid:a,onValueUpdate:h,onFocus:d,onReset:p,getErrors:f}=M(l,t,r,s),i=e.computed(()=>{if(t.value.pattern)return Se(t.value.pattern)});return e.watch(()=>t.value.value,v=>r.value=v),u({onValueUpdate:h,onReset:p,getErrors:f,isValid:a}),(v,B)=>{var w;const y=e.resolveDirective("maskito");return e.withDirectives((e.openBlock(),e.createBlock(e.unref(k.IonInput),{ref_key:"inputRef",ref:l,modelValue:r.value,"onUpdate:modelValue":B[0]||(B[0]=b=>r.value=b),"clear-input":!0,fill:t.value.fill??"solid","label-placement":t.value.labelPlacement??"stacked",type:v.type??"text",required:t.value.required,"error-text":t.value.error,autofocus:t.value.autoFocus,placeholder:((w=i.value)==null?void 0:w.placeholder)??t.value.placeholder,disabled:t.value.disabled,counter:t.value.counter,min:t.value.min,max:t.value.max,"max-length":t.value.maxLength,"min-length":t.value.minLength,pattern:t.value.pattern,style:{width:"100%"},onIonFocus:e.unref(d),onIonChange:e.unref(h),onIonBlur:e.unref(h)},{default:e.withCtx(()=>[e.createVNode(oe,{model:t.value},null,8,["model"]),t.value.prefix?(e.openBlock(),e.createBlock(e.unref(k.IonLabel),{key:0,slot:"start"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.prefix),1)]),_:1})):e.createCommentVNode("",!0),t.value.suffix?(e.openBlock(),e.createBlock(e.unref(k.IonLabel),{key:1,slot:"end"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.suffix),1)]),_:1})):e.createCommentVNode("",!0),v.type==="password"?(e.openBlock(),e.createBlock(e.unref(k.IonInputPasswordToggle),{key:2,slot:"end"})):e.createCommentVNode("",!0)]),_:1},8,["modelValue","fill","label-placement","type","required","error-text","autofocus","placeholder","disabled","counter","min","max","max-length","min-length","pattern","onIonFocus","onIonChange","onIonBlur"])),[[y,i.value]])}}}),ue=e.defineComponent({__name:"TextInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const n=e.useModel(o,"modelValue"),t=e.ref(null);return u({onReset:()=>{var l;return(l=t.value)==null?void 0:l.onReset()},onValueUpdate:()=>{var l;return(l=t.value)==null?void 0:l.onValueUpdate()},getErrors:()=>{var l,r;return((r=(l=t.value)==null?void 0:l.getErrors)==null?void 0:r.call(l))??[]}}),(l,r)=>(e.openBlock(),e.createBlock(K,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"text",schema:l.schema,ref_key:"inputRef",ref:t},null,8,["modelValue","schema"]))}}),se=e.defineComponent({__name:"DateInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const n=e.useModel(o,"modelValue"),t=e.ref(null);return u({onValueUpdate:()=>{var l;return(l=t.value)==null?void 0:l.onValueUpdate()},onReset:()=>{var l;return(l=t.value)==null?void 0:l.onReset()},getErrors:()=>{var l,r;return((r=(l=t.value)==null?void 0:l.getErrors)==null?void 0:r.call(l))??[]}}),(l,r)=>(e.openBlock(),e.createBlock(K,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:n.value.enableTime?"datetime-local":"date",schema:l.schema,ref_key:"inputRef",ref:t},null,8,["modelValue","type","schema"]))}}),ie=e.defineComponent({__name:"NumberInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const n=e.useModel(o,"modelValue"),t=e.ref(null);return u({onReset:()=>{var l;return(l=t.value)==null?void 0:l.onReset()},onValueUpdate:()=>{var l;return(l=t.value)==null?void 0:l.onValueUpdate()},getErrors:()=>{var l,r;return((r=(l=t.value)==null?void 0:l.getErrors)==null?void 0:r.call(l))??[]}}),(l,r)=>(e.openBlock(),e.createBlock(K,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"number",schema:l.schema,ref_key:"inputRef",ref:t},null,8,["modelValue","schema"]))}}),ce=e.defineComponent({__name:"EmailInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const n=e.useModel(o,"modelValue"),t=e.ref(null);return u({onReset:()=>{var l;return(l=t.value)==null?void 0:l.onReset()},onValueUpdate:()=>{var l;return(l=t.value)==null?void 0:l.onValueUpdate()},getErrors:()=>{var l,r;return((r=(l=t.value)==null?void 0:l.getErrors)==null?void 0:r.call(l))??[]}}),(l,r)=>(e.openBlock(),e.createBlock(K,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"email",schema:l.schema,ref_key:"inputRef",ref:t},null,8,["modelValue","schema"]))}}),de=e.defineComponent({__name:"PasswordInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const n=e.useModel(o,"modelValue"),t=e.ref(null);return u({onReset:()=>{var l;return(l=t.value)==null?void 0:l.onReset()},onValueUpdate:()=>{var l;return(l=t.value)==null?void 0:l.onValueUpdate()},getErrors:()=>{var l,r;return((r=(l=t.value)==null?void 0:l.getErrors)==null?void 0:r.call(l))??[]}}),(l,r)=>(e.openBlock(),e.createBlock(K,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"password",schema:l.schema,ref_key:"inputRef",ref:t},null,8,["modelValue","schema"]))}}),Xe=e.defineComponent({__name:"SelectInput",props:e.mergeModels({schema:Object,type:String,formId:String},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const n=o,t=e.useModel(o,"modelValue"),l=e.ref(null),r=e.ref(null),s=e.ref(!1),a=e.ref([]),h=e.ref(""),d=e.ref(1),p=e.computed(()=>t.value.interface??"popover"),f=e.computed(()=>t.value.optionsPlacement==="top"?"top":"bottom"),i=e.computed(()=>a.value.filter(m=>!!m.isChecked)),v=e.computed(()=>!h.value&&Q(i.value)&&!s.value?t.value.placeholder??"Select an option":"");e.watch([h,()=>t.value.options],I,{immediate:!0,deep:!0}),e.watch(()=>t.value.value,C,{immediate:!0,deep:!0}),e.watch(()=>!t.value.dependsOn||!n.schema?null:(Array.isArray(t.value.dependsOn)?t.value.dependsOn:[t.value.dependsOn]).map(g=>{const V=n.schema[g];return F(V)?V.value:void 0}),async(m,g)=>{m&&g&&!G(m,g)&&(B(),a.value=[],await I())},{deep:!0});function B(){t.value.error="",h.value="",d.value=1,t.value.value=t.value.multiple?[]:"",be(a.value)}function y(m){const g=a.value.findIndex(V=>V.value===m.value&&V.isChecked);if(g>=0){if(Array.isArray(t.value.value)){const V=ee(m,t.value.value);V>=0&&t.value.value.splice(V,1)}a.value[g].isChecked=!1}else t.value.multiple||B(),$(m,a.value);O(),h.value=""}function w(){switch(p.value){case"action-sheet":b();break;case"alert":x();break;case"popover":default:s.value=!0;break}}async function b(){if(await I(),t.value.multiple){s.value=!0;return}await(await k.actionSheetController.create({header:t.value.label||"Select an option",buttons:[...a.value.map(g=>({text:g.label,cssClass:g.isChecked?"selected-option":"",handler:()=>(y(g),!1)})),{text:"Cancel",role:"cancel"}]})).present()}async function x(){await I();const m=a.value.map(V=>({label:V.label,type:t.value.multiple?"checkbox":"radio",value:V,checked:V.isChecked}));await(await k.alertController.create({header:t.value.label||"Select an option",inputs:m,buttons:[{text:"Cancel",role:"cancel"},{text:"OK",handler:V=>{if(t.value.multiple)a.value.forEach(N=>_e(N,a.value)),V.forEach(N=>{const c=a.value.find(_=>_.value===N.value);c&&$(c,a.value)});else{B();const N=a.value.find(c=>c.value===V.value);N&&$(N,a.value)}O()}}]})).present()}async function R(){if(t.value.required&&Q(i.value))return"This field is required";if(t.value.validation){const m=await t.value.validation(i.value,n==null?void 0:n.schema);if(m&&m.length)return m.join()}return!0}const{onFocus:A,applyValidationState:z}=M(l,t,e.computed(()=>t.value.multiple?i.value:i.value[0]),e.computed(()=>n==null?void 0:n.schema),R);function T(m){var g;m.target===((g=l.value)==null?void 0:g.$el)&&(A(),p.value==="popover"&&(s.value=!0))}async function O(m){var V;if((V=m==null?void 0:m.relatedTarget)!=null&&V.closest(".suggestions-list"))return;s.value=!1;const g=await R();g===!0?(t.value.error="",t.value.value=t.value.multiple?i.value:i.value[0]):t.value.error=typeof g=="string"?g:"Validation failed",await z(g===!0)}async function I(){const m=[];if(typeof t.value.options=="function"){let g={};if(t.value.dependsOn&&n.schema){const V=Array.isArray(t.value.dependsOn)?t.value.dependsOn:[t.value.dependsOn];let N=!0;if(g=V.reduce((c,_)=>{const E=n.schema[_];return c[_]=F(E)?E.value:void 0,(c[_]===void 0||c[_]===null||c[_]==="")&&(N=!1),c},{}),N){const c=await t.value.options(h.value,g);m.push(...c.filter(_=>!!_.label))}}else{const V=await t.value.options(h.value,{});m.push(...V.filter(N=>!!N.label))}}else Array.isArray(t.value.options)&&m.push(...xe(t.value.options,h.value));i.value.forEach(g=>$(g,m)),a.value=m}async function C(){const m=t.value.value;if(m){if(a.value.length===0&&await I(),Array.isArray(m))m.forEach(g=>$(g,a.value));else if(typeof m=="object")$(m,a.value);else{const g=a.value.find(V=>V.value===m);$(g||{value:m,label:m},a.value)}O()}}return e.onMounted(async()=>{await I(),await C()}),u({onValueUpdate:O,onReset:B,getErrors:()=>t.value.error?[t.value.error]:[]}),(m,g)=>(e.openBlock(),e.createElementBlock("div",{class:"autocomplete-container",onFocusout:O,ref_key:"containerRef",ref:r},[e.createVNode(e.unref(k.IonInput),{ref_key:"inputRef",ref:l,modelValue:h.value,"onUpdate:modelValue":g[0]||(g[0]=V=>h.value=V),fill:t.value.fill??"solid","label-placement":t.value.labelPlacement??"stacked",type:o.type??"text",required:t.value.required,"error-text":t.value.error,autofocus:t.value.autoFocus,placeholder:v.value,disabled:t.value.disabled,counter:t.value.counter,debounce:300,onIonFocus:T,onClick:w,style:{width:"100%"}},{default:e.withCtx(()=>[e.createVNode(oe,{model:t.value},null,8,["model"]),t.value.multiple?(e.openBlock(),e.createBlock(e.unref(k.IonLabel),{key:0,style:{width:"fit-content"},slot:"start"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(V,N)=>(e.openBlock(),e.createBlock(e.unref(k.IonChip),{key:N},{default:e.withCtx(()=>[e.createVNode(e.unref(k.IonLabel),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(V.label),1)]),_:2},1024)]),_:2},1024))),128))]),_:1})):(e.openBlock(),e.createBlock(e.unref(k.IonLabel),{key:1,slot:"start",class:"ion-no-wrap"},{default:e.withCtx(()=>{var V;return[e.createTextVNode(e.toDisplayString(((V=i.value[0])==null?void 0:V.label)??""),1)]}),_:1})),e.createVNode(e.unref(k.IonIcon),{slot:"end",icon:e.unref(Z.chevronDown)},null,8,["icon"]),i.value.length>0||h.value?(e.openBlock(),e.createBlock(e.unref(k.IonIcon),{key:2,slot:"end",icon:e.unref(Z.close),onClick:B,style:{"z-index":"999999"}},null,8,["icon"])):e.createCommentVNode("",!0)]),_:1},8,["modelValue","fill","label-placement","type","required","error-text","autofocus","placeholder","disabled","counter"]),s.value&&a.value.length>0&&p.value==="popover"?(e.openBlock(),e.createBlock(e.unref(k.IonList),{key:0,class:e.normalizeClass(["suggestions-list",f.value])},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,V=>(e.openBlock(),e.createBlock(e.unref(k.IonItem),{button:"",key:V.label,onClick:N=>y(V),lines:t.value.showOptionsSeparator?"none":"full"},{default:e.withCtx(()=>[t.value.multiple?(e.openBlock(),e.createBlock(e.unref(k.IonCheckbox),{key:0,slot:"start",checked:V.isChecked},null,8,["checked"])):e.createCommentVNode("",!0),e.createVNode(e.unref(k.IonLabel),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(V.label),1)]),_:2},1024)]),_:2},1032,["onClick","lines"]))),128))]),_:1},8,["class"])):e.createCommentVNode("",!0)],544))}}),pe=H(Xe,[["__scopeId","data-v-74ee432d"]]),fe=e.defineComponent({__name:"TextAreaInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const n=o,t=e.useModel(o,"modelValue"),l=e.ref(null),r=e.ref(t.value.value),s=e.computed(()=>n.schema),{onValueUpdate:a,onFocus:h,onReset:d,getErrors:p}=M(l,t,r,s);return e.watch(()=>t.value.value,f=>r.value=f),u({onReset:d,onValueUpdate:a,getErrors:p}),(f,i)=>(e.openBlock(),e.createBlock(e.unref(k.IonTextarea),{ref_key:"inputRef",ref:l,modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=v=>r.value=v),"clear-input":!0,fill:t.value.fill??"solid","label-placement":t.value.labelPlacement??"stacked",required:t.value.required,"error-text":t.value.error,autofocus:t.value.autoFocus,placeholder:t.value.placeholder,disabled:t.value.disabled,counter:t.value.counter,min:t.value.min,max:t.value.max,rows:t.value.rows,cols:t.value.cols,"auto-grow":t.value.autoGrow,"max-length":t.value.maxLength,"min-length":t.value.minLength,pattern:t.value.pattern,onIonFocus:e.unref(h),onIonChange:e.unref(a),onIonBlur:e.unref(a),style:{width:"100%"}},{default:e.withCtx(()=>[e.createVNode(oe,{model:t.value},null,8,["model"])]),_:1},8,["modelValue","fill","label-placement","required","error-text","autofocus","placeholder","disabled","counter","min","max","rows","cols","auto-grow","max-length","min-length","pattern","onIonFocus","onIonChange","onIonBlur"]))}}),Ye={class:"ion-margin-end",style:{"flex-grow":"1"}},et={style:{display:"flex","justify-content":"flex-end"}},tt=e.defineComponent({__name:"RepeatInput",props:e.mergeModels({schema:{},data:{},computedData:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const n=e.useModel(o,"modelValue"),t=e.ref([]),{dynamicRefs:l,resetForm:r,getFormErrors:s,updateFormValues:a}=te(),h=e.computed(()=>t.value.map((B,y)=>({label:`Set ${y+1}`,value:y,other:Object.entries(B).reduce((w,[b,x])=>(F(x)&&(w[b]=x.value),w),{})})));e.watch(h,B=>{n.value.value=B},{deep:!0,immediate:!0}),e.onMounted(d);function d(){n.value.children&&t.value.push(Y(n.value.children))}function p(B){t.value.splice(B,1)}function f(){r()}function i(){return s()}async function v(){await a()}return u({onValueUpdate:v,onReset:f,getErrors:i}),(B,y)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(w,b)=>(e.openBlock(),e.createElementBlock("div",{class:"repeat-input-wrapper",key:b},[e.createElementVNode("div",Ye,[e.createVNode(e.unref(k.IonRow),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.keys(w),x=>{var R,A,z,T,O;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(X)(w[x],B.data,B.computedData)?(e.openBlock(),e.createBlock(e.unref(k.IonCol),{key:`${b}-${x}`,size:((R=w[x].grid)==null?void 0:R.xs)??"12","size-sm":(A=w[x].grid)==null?void 0:A.sm,"size-md":(z=w[x].grid)==null?void 0:z.md,"size-lg":(T=w[x].grid)==null?void 0:T.lg,"size-xl":(O=w[x].grid)==null?void 0:O.xl,class:"ion-margin-bottom"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(w[x].type),{modelValue:w[x],"onUpdate:modelValue":I=>w[x]=I,schema:w,"ref-key":`${b}-${x}`,ref_for:!0,ref_key:"dynamicRefs",ref:l,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","schema","ref-key"]))]),_:2},1032,["size","size-sm","size-md","size-lg","size-xl"])):e.createCommentVNode("",!0)],64)}),256))]),_:2},1024)]),e.createElementVNode("div",et,[b===t.value.length-1?(e.openBlock(),e.createBlock(e.unref(k.IonButton),{key:0,onClick:d,color:"primary"},{default:e.withCtx(()=>[e.createVNode(e.unref(k.IonIcon),{slot:"icon-only",icon:e.unref(Z.add)},null,8,["icon"])]),_:1})):e.createCommentVNode("",!0),t.value.length>1?(e.openBlock(),e.createBlock(e.unref(k.IonButton),{key:1,onClick:x=>p(b),color:"warning"},{default:e.withCtx(()=>[e.createVNode(e.unref(k.IonIcon),{slot:"icon-only",icon:e.unref(Z.remove)},null,8,["icon"])]),_:2},1032,["onClick"])):e.createCommentVNode("",!0)])]))),128))}}),me=H(tt,[["__scopeId","data-v-c3c3598f"]]),ve=e.defineComponent({__name:"CheckboxInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const n=o,t=e.useModel(o,"modelValue"),l=e.ref(null),r=e.ref(t.value.value),s=e.computed(()=>n.schema),a=e.computed(()=>ne(t.value)),{onValueUpdate:h,onFocus:d,getErrors:p}=M(l,t,r,s);function f(){r.value=!1,t.value.error="",t.value.value=!1}return e.watch(()=>t.value.value,i=>r.value=i),u({onValueUpdate:h,onReset:f,getErrors:p}),(i,v)=>(e.openBlock(),e.createBlock(e.unref(k.IonCheckbox),{modelValue:r.value,"onUpdate:modelValue":v[0]||(v[0]=B=>r.value=B),ref_key:"inputRef",ref:l,required:t.value.required,"error-text":t.value.error,disabled:t.value.disabled,onIonFocus:e.unref(d),onIonChange:e.unref(h),onIonBlur:e.unref(h),style:{width:"100%"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value),1)]),_:1},8,["modelValue","required","error-text","disabled","onIonFocus","onIonChange","onIonBlur"]))}}),he=e.defineComponent({__name:"RadioInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const n=o,t=e.useModel(o,"modelValue"),l=e.ref(null),r=e.ref(t.value.value),s=e.computed(()=>n.schema),a=e.ref([]),h=e.computed(()=>ne(t.value)),{onValueUpdate:d,onFocus:p,getErrors:f}=M(l,t,r,s);function i(){t.value.error="",r.value=void 0,t.value.value=void 0}function v(y,w){return y.value===w.value}async function B(){typeof t.value.options=="function"?a.value=await t.value.options():a.value=t.value.options}return e.watch(()=>t.value.value,y=>r.value=y),u({onValueUpdate:d,onReset:i,getErrors:f}),e.onMounted(B),(y,w)=>(e.openBlock(),e.createBlock(e.unref(k.IonRadioGroup),{modelValue:r.value,"onUpdate:modelValue":w[0]||(w[0]=b=>r.value=b),ref_key:"inputRef",ref:l,required:t.value.required,"helper-text":h.value,"error-text":t.value.error,disabled:t.value.disabled,compareWith:v,"allow-empty-selection":!t.value.required,onIonFocus:e.unref(p),onIonChange:e.unref(d),onIonBlur:e.unref(d),style:{width:"100%"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,b=>(e.openBlock(),e.createBlock(e.unref(k.IonItem),{key:b.value,lines:t.value.showOptionsSeparator?"none":"full"},{default:e.withCtx(()=>[e.createVNode(e.unref(k.IonRadio),{value:b,disabled:t.value.disabled,"label-placement":"end",justify:"start"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(b.label),1)]),_:2},1032,["value","disabled"])]),_:2},1032,["lines"]))),128))]),_:1},8,["modelValue","required","helper-text","error-text","disabled","allow-empty-selection","onIonFocus","onIonChange","onIonBlur"]))}}),ot={class:"form-section-header"},nt={class:"form-section-title"},lt={key:0,class:"form-section-subtitle"},at=e.defineComponent({__name:"SectionTitle",props:{modelValue:{},schema:{},formId:{},refKey:{}},setup(o){const n=o.modelValue;return(t,l)=>{var r,s,a,h,d;return e.openBlock(),e.createBlock(e.unref(k.IonCol),{size:((r=e.unref(n).grid)==null?void 0:r.xs)??"12","size-sm":(s=e.unref(n).grid)==null?void 0:s.sm,"size-md":(a=e.unref(n).grid)==null?void 0:a.md,"size-lg":(h=e.unref(n).grid)==null?void 0:h.lg,"size-xl":(d=e.unref(n).grid)==null?void 0:d.xl,class:e.normalizeClass(["form-section-container",e.unref(n).className])},{default:e.withCtx(()=>[e.createElementVNode("div",ot,[e.createElementVNode("h3",nt,e.toDisplayString(e.unref(n).title),1),e.unref(n).subtitle?(e.openBlock(),e.createElementBlock("p",lt,e.toDisplayString(e.unref(n).subtitle),1)):e.createCommentVNode("",!0)])]),_:1},8,["size","size-sm","size-md","size-lg","size-xl","class"])}}}),ge=H(at,[["__scopeId","data-v-cf5d6e04"]]);function rt(o,u,n){const t=e.ref({}),l=e.ref({});function r(p,f,i){l.value[p]=i,f.forEach(v=>{var B;(B=t.value)[v]??(B[v]=[]),t.value[v].includes(p)||t.value[v].push(p)}),d(p)}function s(p){return Object.entries(t.value).filter(([,i])=>i.includes(p)).map(([i])=>i).reduce((i,v)=>(i[v]=u.value[v]??n.value[v],i),{})}function a(p,f){return p?Array.isArray(p)?p.some(i=>f.some(v=>h(i,v.value))):f.some(i=>h(p,i.value)):!1}function h(p,f){return typeof p=="object"&&p!==null?p.value===f:String(p)===String(f)}async function d(p,f){if(!l.value[p])return;const i=s(p),v=Object.keys(i);if(!(v.length===0||!v.every(y=>i[y]!==void 0&&i[y]!==null)))try{const y=l.value[p],w=await y(f,i);if(!o.value[p])return;const b=o.value[p];if(!F(b))return;b.options=w;const x=b.value;if(!x)return;a(x,w)||(b.value=b.multiple?[]:"")}catch(y){console.error(`Error loading options for ${p}:`,y)}}return e.watch([u,n],()=>{Object.entries(t.value).forEach(([p,f])=>{(u.value[p]!==void 0||n.value[p]!==void 0)&&f.forEach(i=>{d(i)})})},{deep:!0,immediate:!0}),{registerDependency:r,updateOptions:d}}const ke={install(o){o.component("VForm",re),o.component("TextInput",ue),o.component("DateInput",se),o.component("NumberInput",ie),o.component("EmailInput",ce),o.component("PasswordInput",de),o.component("SelectInput",pe),o.component("TextAreaInput",fe),o.component("RepeatInput",me),o.component("CheckboxInput",ve),o.component("RadioInput",he),o.component("FormSection",ge),o.directive("maskito",ye.maskito)}};exports.CheckboxInput=ve;exports.DateInput=se;exports.EmailInput=ce;exports.FormBuilder=re;exports.FormSection=ge;exports.NumberInput=ie;exports.PasswordInput=de;exports.RadioInput=he;exports.RepeatInput=me;exports.SelectInput=pe;exports.TextAreaInput=fe;exports.TextInput=ue;exports.VForm=ke;exports.default=ke;exports.useDataTransformation=le;exports.useDependentOptions=rt;exports.useFormValidation=te;exports.useInputValidation=M;exports.useMultiStepForm=ae;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),h=require("@ionic/vue"),Z=require("ionicons/icons"),ke=require("@maskito/vue");function ye(o){return new Promise(u=>{requestAnimationFrame(async()=>{const l=await o.getInputElement();u(l)})})}const Ce={d:/\d/,a:/[A-Za-z]/,"*":/[A-Za-z0-9]/},Ve={d:["1","2","3","4","5","6","7","8","9","0"],a:["A","B","C","x","y","z","D","f"],"*":["A","3","b","8","z","4","D","0"]};function Be(o,u){const l=Ve[o];return l[u%l.length]}function we(o){const u=[];let l="",t=0,n=0;for(;t<o.length;){const r=o[t];if(["d","a","*"].includes(r)){let s=1;if(o[t+1]==="{"){const a=o.indexOf("}",t+2);if(a!==-1){const g=o.slice(t+2,a);if(g.includes(",")){const[,p]=g.split(",").map(d=>parseInt(d.trim()));s=p||parseInt(g.split(",")[0])}else s=parseInt(g);t=a}}else{let a=t+1;for(;o[a]===r;)s++,a++;t=a-1}for(let a=0;a<s;a++)u.push(Ce[r]),l+=Be(r,n++)}else u.push(r),l+=r;t++}return{mask:u,placeholder:l,elementPredicate:ye}}function X(o){return o==null||Array.isArray(o)&&!o.length||typeof o=="object"&&!Object.keys(o).length||!o}function Y(o,u,l){return typeof o.condition=="function"?o.condition(u,l):!0}function ee(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return o.map(l=>ee(l));const u={};return Object.entries(o).forEach(([l,t])=>{typeof t=="function"?u[l]=t.bind(u):u[l]=ee(t)}),u}function te(o,u){return u.findIndex(l=>l.value===o.value||l.label===o.label||l.value===o.label||l.label===o.value)}function $(o,u){const l=te(o,u);l>=0?u[l].isChecked=!0:u.push({...o,isChecked:!0})}function Se(o,u){const l=te(o,u);l>=0&&(u[l].isChecked=!1)}function _e(o){o.forEach(u=>{u.isChecked=!1})}function be(o,u){return u?o.filter(l=>JSON.stringify(l).toLowerCase().includes(u.toLowerCase())):o}function xe(o){const u=o.label||"",l=o.required?" *":"";return u+l}function G(o,u){if(o===u)return!0;if(o==null||u==null||typeof o!=typeof u)return!1;if(typeof o!="object")return o===u;if(Array.isArray(o)&&Array.isArray(u))return o.length!==u.length?!1:o.every((n,r)=>G(n,u[r]));if(Array.isArray(o)!==Array.isArray(u))return!1;const l=Object.keys(o),t=Object.keys(u);return l.length!==t.length?!1:l.every(n=>Object.prototype.hasOwnProperty.call(u,n)&&G(o[n],u[n]))}function D(o){return o.type!=="FormSection"}function Ne(o){return o.type==="FormSection"}function oe(){const o=e.ref([]);async function u(){console.debug("Validating form inputs");const r=[];for(const s of o.value)if(typeof(s==null?void 0:s.onValueUpdate)=="function"&&await s.onValueUpdate(),typeof(s==null?void 0:s.getErrors)=="function")try{const a=s.getErrors();Array.isArray(a)?r.push(...a):console.warn("getErrors() returned non-array value:",a)}catch(a){console.error("Error calling getErrors on component:",a,s)}else console.warn("Component does not have getErrors function:",s);return r.every(X)}function l(){o.value.forEach(r=>{typeof(r==null?void 0:r.onReset)=="function"&&r.onReset()})}function t(){const r=[];for(const s of o.value)if(typeof(s==null?void 0:s.getErrors)=="function")try{const a=s.getErrors();Array.isArray(a)?r.push(...a):r.push(String(a))}catch(a){console.error("Error calling getErrors on component:",a,s)}return r}async function n(){for(const r of o.value)typeof(r==null?void 0:r.onValueUpdate)=="function"&&await r.onValueUpdate()}return{dynamicRefs:o,isFormValid:u,resetForm:l,getFormErrors:t,updateFormValues:n}}function le(o){const u=e.computed(()=>Object.entries(o.value).reduce((p,[d,f])=>(D(f)&&f.value!==void 0&&(typeof f.onChange=="function"?p[d]=f.onChange(f.value,o.value):p[d]=f.value),p),{})),l=e.ref({}),t=(p,d,f)=>{const i=o.value[p];if(D(i)&&i.children){const v=i.children[d];if(v&&D(v)&&typeof v.computedValue=="function")return v.computedValue(f,o.value)}return f},n=(p,d,f,i)=>{l.value[p][i]||(l.value[p][i]={}),Object.entries(d.other??{}).forEach(([v,B])=>{var w;!G(B,(w=f.other)==null?void 0:w[v])&&(l.value[p][i][v]=t(p,v,B))})},r=(p,d,f)=>{d.forEach((i,v)=>{const B=f[v]??{other:{}};n(p,i,B,v)})},s=(p,{other:d})=>Object.entries(d??{}).reduce((f,[i,v])=>(f[i]=t(p,i,v),f),{}),a=(p,d,f)=>{l.value[p]||(l.value[p]=[]);const i=d;Array.isArray(f[p])?r(p,i,f[p]):l.value[p]=i.map(v=>s(p,v))},g=(p,d,f)=>{if(!d){delete l.value[p];return}const i=o.value[p];D(i)&&(i.children!==void 0?a(p,d,f):typeof i.computedValue=="function"&&(l.value[p]=i.computedValue(d,o.value)))};return e.watch(u,(p,d={})=>{Object.keys(p).forEach(f=>{G(p[f],d[f])||g(f,p[f],d)}),Object.keys(d).forEach(f=>{!(f in p)&&f in l.value&&delete l.value[f]})},{immediate:!0,deep:!0}),{formData:u,computedData:l}}function ne(o){const u=e.ref(0),l=e.ref({}),t=e.ref({}),n=e.ref({});function r(C){const m={};return C.component||!C.schema||Object.entries(C.schema).forEach(([k,V])=>{D(V)&&(m[k]=V.value)}),m}o.steps.forEach(C=>{l.value[C.id]=r(C),t.value[C.id]={},n.value[C.id]=[]});const s=e.ref(o.steps.map(C=>C.id)),a=e.computed(()=>o.steps.filter(m=>m.condition?m.condition(l.value,t.value):!0));e.watch(a,C=>{const m=C.map(V=>V.id);s.value.filter(V=>!m.includes(V)).forEach(V=>{b(V)}),s.value=m});const g=e.computed(()=>a.value.length>0?u.value>=a.value.length?a.value[a.value.length-1]:a.value[u.value]:o.steps[u.value]),p=e.computed(()=>u.value===0),d=e.computed(()=>u.value===a.value.length-1),f=e.computed(()=>!d.value),i=e.computed(()=>!p.value),v=e.computed(()=>a.value.length),B=e.computed(()=>v.value===0?0:Math.round((u.value+1)/v.value*100));function y(C,m){l.value[C]={...l.value[C],...m}}function w(C,m){t.value[C]={...t.value[C],...m}}function b(C){const m=o.steps.find(k=>k.id===C);m&&(l.value[C]=r(m),t.value[C]={})}async function x(){const C=g.value;if(!C)return!0;const m=[];if(C.validation){const k=await C.validation(l.value[C.id],t.value[C.id]);k&&m.push(...k)}return n.value[C.id]=m,m.length===0}async function F(C){return C<0||C>=a.value.length||C>u.value&&!await x()?!1:(u.value=C,!0)}async function A(){return f.value?F(u.value+1):!1}async function R(){return i.value?F(u.value-1):!1}function T(){u.value=0,n.value={},o.steps.forEach(C=>{b(C.id),n.value[C.id]=[]})}async function O(){let C=!0;for(const m of o.steps)if(m.validation){const k=await m.validation(l.value[m.id],t.value[m.id]);n.value[m.id]=k||[],k&&k.length>0&&(C=!1)}return C}function I(){return{formData:{...l.value},computedData:{...t.value}}}return{currentStepIndex:u,currentStep:g,stepData:l,stepComputedData:t,stepValidationErrors:n,visibleSteps:a,isFirstStep:p,isLastStep:d,canGoNext:f,canGoPrevious:i,totalSteps:v,progressPercentage:B,updateStepData:y,updateStepComputedData:w,clearStepData:b,validateCurrentStep:x,goToStep:F,nextStep:A,previousStep:R,resetForm:T,validateAllSteps:O,getMultiStepFormData:I}}const Ee={class:"step-indicator__container"},Ie=["onClick"],Oe={class:"step-indicator__step-content"},ze={class:"step-indicator__step-marker"},De={class:"step-indicator__step-info"},Fe={class:"step-indicator__step-title"},Re={key:0,class:"step-indicator__step-subtitle"},Te={key:0,class:"step-indicator__progress"},Ae={class:"step-indicator__progress-bar"},$e={class:"step-indicator__progress-text"},Me=e.defineComponent({__name:"StepIndicator",props:{steps:{},activeStepIndex:{},position:{},showProgress:{type:Boolean,default:!0},allowNavigation:{type:Boolean,default:!1}},emits:["step-click"],setup(o,{emit:u}){const l=o,t=u,n=e.computed(()=>l.steps.length===0?0:(l.activeStepIndex+1)/l.steps.length*100);function r(s){l.allowNavigation&&t("step-click",s)}return(s,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["step-indicator",[`step-indicator--${s.position}`,{"step-indicator--clickable":s.allowNavigation}]])},[e.createElementVNode("div",Ee,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.steps,(g,p)=>(e.openBlock(),e.createElementBlock("div",{key:g.id,class:e.normalizeClass(["step-indicator__step",{"step-indicator__step--active":p===s.activeStepIndex,"step-indicator__step--completed":p<s.activeStepIndex,"step-indicator__step--clickable":s.allowNavigation}]),onClick:d=>r(p)},[e.createElementVNode("div",Oe,[e.createElementVNode("div",ze,[e.createElementVNode("span",null,e.toDisplayString(p+1),1)]),e.createElementVNode("div",De,[e.createElementVNode("div",Fe,e.toDisplayString(g.title),1),g.subtitle?(e.openBlock(),e.createElementBlock("div",Re,e.toDisplayString(g.subtitle),1)):e.createCommentVNode("",!0)])]),p<s.steps.length-1?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["step-indicator__connector",{"step-indicator__connector--completed":p<s.activeStepIndex}])},null,2)):e.createCommentVNode("",!0)],10,Ie))),128))]),s.showProgress&&(s.position==="top"||s.position==="bottom")?(e.openBlock(),e.createElementBlock("div",Te,[e.createElementVNode("div",Ae,[e.createElementVNode("div",{class:"step-indicator__progress-fill",style:e.normalizeStyle({width:`${n.value}%`})},null,4)]),e.createElementVNode("div",$e," Step "+e.toDisplayString(s.activeStepIndex+1)+" of "+e.toDisplayString(s.steps.length),1)])):e.createCommentVNode("",!0)],2))}}),H=(o,u)=>{const l=o.__vccOpts||o;for(const[t,n]of u)l[t]=n;return l},W=H(Me,[["__scopeId","data-v-aca1a6d0"]]),Pe={class:"v-form-container"},Le={key:0,class:"multi-step-form"},Ue={class:"multi-step-form-content"},qe={class:"step-nav-buttons"},je={class:"step-action-buttons"},Ge={class:"step-nav-buttons"},He={key:3,class:"step-progress-bottom"},Ke={class:"step-progress-bar"},We={class:"step-progress-text"},Ze=e.defineComponent({__name:"vForm",props:{schema:{},multiStepConfig:{},showLabels:{type:Boolean,default:!0},showClearButton:{type:Boolean,default:!0},showCancelButton:{type:Boolean,default:!0},buttonPlacement:{default:"start"},submitButtonText:{default:"Submit"},clearButtonText:{default:"Reset"},cancelButtonText:{default:"Cancel"},hideButtons:{type:Boolean,default:!1},customButtons:{}},emits:["submit","multi-step-submit","step-change","clear","cancel"],setup(o,{expose:u,emit:l}){const t=o,n=l,r=e.computed(()=>!!t.multiStepConfig),s=e.ref(t.schema||{}),a=t.multiStepConfig?ne(t.multiStepConfig):null,{dynamicRefs:g,isFormValid:p,resetForm:d}=oe(),{formData:f,computedData:i}=le(s),v=e.ref(null),B=e.computed(()=>(a==null?void 0:a.currentStepIndex.value)??0),y=e.computed(()=>a==null?void 0:a.currentStep.value),w=e.computed(()=>(a==null?void 0:a.visibleSteps.value)??[]),b=e.computed(()=>(a==null?void 0:a.isLastStep.value)??!0),x=e.computed(()=>(a==null?void 0:a.canGoNext.value)??!1),F=e.computed(()=>(a==null?void 0:a.canGoPrevious.value)??!1),A=e.computed(()=>!r.value||!a?0:a.progressPercentage.value);e.watch(()=>y.value,c=>{c&&r.value&&(s.value=c.schema||{})},{immediate:!0}),e.watch([f,i],([c,_])=>{r.value&&a&&y.value&&(a.updateStepData(y.value.id,c),a.updateStepComputedData(y.value.id,_))},{deep:!0}),e.watch(()=>t.schema,c=>{if(!r.value&&c){s.value=c;for(const[_,N]of Object.entries(c))D(N)&&"value"in N&&N.value!==void 0&&(s.value[_].value=N.value)}},{deep:!0,immediate:!0});async function R(){var c;if(r.value&&a){if((c=y.value)!=null&&c.component&&v.value&&typeof v.value.validate=="function"&&!await v.value.validate()||!await a.validateAllSteps())return;const N=a.getMultiStepFormData();n("multi-step-submit",N)}else{if(!await p())return;n("submit",f.value,i.value)}}function T(){r.value&&a?a.resetForm():d(),n("clear")}function O(){r.value&&a&&y.value&&a.clearStepData(y.value.id)}function I(){r.value&&a?a.resetForm():d(),n("cancel")}async function C(){var c;if(a){let _=!0;if((c=y.value)!=null&&c.component&&v.value?typeof v.value.validate=="function"&&(_=await v.value.validate()):_=await p(),!_)return;await a.nextStep()&&y.value&&n("step-change",B.value,y.value.id)}}async function m(){a&&await a.previousStep()&&y.value&&n("step-change",B.value,y.value.id)}async function k(c){var _;if(a){if(c>B.value){let z=!0;if((_=y.value)!=null&&_.component&&v.value?typeof v.value.validate=="function"&&(z=await v.value.validate()):z=await p(),!z)return}await a.goToStep(c)&&y.value&&n("step-change",c,y.value.id)}}e.watch(f,async()=>{var c;for(const[_,N]of Object.entries(s.value))if(D(N)&&!Y(N,f.value,i.value)){const z=r.value&&y.value&&y.value.schema?y.value.schema[_]:(c=t.schema)==null?void 0:c[_];z&&D(z)&&"value"in z&&(N.value=z.value)}},{deep:!0,immediate:!0});function V(c){r.value&&a&&y.value&&a.updateStepData(y.value.id,c)}function E(c,_,N){return Ne(c)?!0:Y(c,_,N)}return u({resetForm:T,isFormValid:p,resolveData:()=>r.value&&a?a.getMultiStepFormData():{formData:f.value,computedData:i.value},nextStep:C,previousStep:m,goToStep:k,getCurrentStep:()=>y.value,getCurrentStepIndex:()=>B.value}),(c,_)=>{var N,z;return e.openBlock(),e.createElementBlock("div",Pe,[r.value?(e.openBlock(),e.createElementBlock("div",Le,[c.multiStepConfig&&c.multiStepConfig.stepPosition==="top"?(e.openBlock(),e.createBlock(W,{key:0,steps:w.value,"active-step-index":B.value,position:c.multiStepConfig.stepPosition||"top","show-progress":c.multiStepConfig.showProgress,"allow-navigation":c.multiStepConfig.allowStepNavigation,onStepClick:k},null,8,["steps","active-step-index","position","show-progress","allow-navigation"])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["multi-step-content",`multi-step-content--${((N=c.multiStepConfig)==null?void 0:N.stepPosition)||"top"}`])},[c.multiStepConfig&&c.multiStepConfig.stepPosition==="left"?(e.openBlock(),e.createBlock(W,{key:0,steps:w.value,"active-step-index":B.value,position:c.multiStepConfig.stepPosition??"top","show-progress":c.multiStepConfig.showProgress,"allow-navigation":c.multiStepConfig.allowStepNavigation,onStepClick:k,class:"multi-step-sidebar"},null,8,["steps","active-step-index","position","show-progress","allow-navigation"])):e.createCommentVNode("",!0),e.createElementVNode("div",Ue,[(z=y.value)!=null&&z.component?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(y.value.component),e.mergeProps({key:0},y.value.componentProps||{},{"onUpdate:data":V,ref_key:"customComponentRef",ref:v}),null,16)):(e.openBlock(),e.createBlock(e.unref(h.IonGrid),{key:1},{default:e.withCtx(()=>[e.createVNode(e.unref(h.IonRow),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.keys(s.value),S=>{var P,L,U,q,j;return e.openBlock(),e.createElementBlock(e.Fragment,{key:S},[E(s.value[S],e.unref(f),e.unref(i))?(e.openBlock(),e.createBlock(e.unref(h.IonCol),{key:0,size:((P=s.value[S].grid)==null?void 0:P.xs)??"12","size-sm":(L=s.value[S].grid)==null?void 0:L.sm,"size-md":(U=s.value[S].grid)==null?void 0:U.md,"size-lg":(q=s.value[S].grid)==null?void 0:q.lg,"size-xl":(j=s.value[S].grid)==null?void 0:j.xl,class:"ion-margin-vertical"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value[S].type),{modelValue:s.value[S],"onUpdate:modelValue":Q=>s.value[S]=Q,schema:s.value,"form-id":S,ref_for:!0,ref_key:"dynamicRefs",ref:g,"ref-key":S},null,8,["modelValue","onUpdate:modelValue","schema","form-id","ref-key"]))]),_:2},1032,["size","size-sm","size-md","size-lg","size-xl"])):e.createCommentVNode("",!0)],64)}),128))]),_:1})]),_:1})),c.hideButtons?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(h.IonRow),{key:2,class:"multi-step-buttons"},{default:e.withCtx(()=>[e.createVNode(e.unref(h.IonCol),{size:"12",class:"button-container"},{default:e.withCtx(()=>[e.createElementVNode("div",qe,[F.value?(e.openBlock(),e.createBlock(e.unref(h.IonButton),{key:0,onClick:m,fill:"outline"},{default:e.withCtx(()=>_[0]||(_[0]=[e.createTextVNode(" Previous ")])),_:1,__:[0]})):e.createCommentVNode("",!0)]),e.createElementVNode("div",je,[c.showCancelButton?(e.openBlock(),e.createBlock(e.unref(h.IonButton),{key:0,onClick:I,fill:"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.cancelButtonText??"Cancel"),1)]),_:1})):e.createCommentVNode("",!0),c.showClearButton?(e.openBlock(),e.createBlock(e.unref(h.IonButton),{key:1,onClick:O,fill:"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.clearButtonText??"Reset"),1)]),_:1})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.customButtons,S=>(e.openBlock(),e.createBlock(e.unref(h.IonButton),{key:S.label,onClick:S.action,color:S.color??"primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S.label),1)]),_:2},1032,["onClick","color"]))),128))]),e.createElementVNode("div",Ge,[x.value?(e.openBlock(),e.createBlock(e.unref(h.IonButton),{key:0,onClick:C},{default:e.withCtx(()=>_[1]||(_[1]=[e.createTextVNode(" Next ")])),_:1,__:[1]})):e.createCommentVNode("",!0),b.value?(e.openBlock(),e.createBlock(e.unref(h.IonButton),{key:1,onClick:R},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.submitButtonText??"Submit"),1)]),_:1})):e.createCommentVNode("",!0)])]),_:1})]),_:1})),c.multiStepConfig&&(c.multiStepConfig.stepPosition==="left"||c.multiStepConfig.stepPosition==="right")&&c.multiStepConfig.showProgress?(e.openBlock(),e.createElementBlock("div",He,[e.createElementVNode("div",Ke,[e.createElementVNode("div",{class:"step-progress-fill",style:e.normalizeStyle({width:`${A.value}%`})},null,4)]),e.createElementVNode("div",We," Step "+e.toDisplayString(B.value+1)+" of "+e.toDisplayString(w.value.length),1)])):e.createCommentVNode("",!0)]),c.multiStepConfig&&c.multiStepConfig.stepPosition==="right"?(e.openBlock(),e.createBlock(W,{key:1,steps:w.value,"active-step-index":B.value,position:c.multiStepConfig.stepPosition,"show-progress":c.multiStepConfig.showProgress,"allow-navigation":c.multiStepConfig.allowStepNavigation,onStepClick:k,class:"multi-step-sidebar"},null,8,["steps","active-step-index","position","show-progress","allow-navigation"])):e.createCommentVNode("",!0)],2),c.multiStepConfig&&c.multiStepConfig.stepPosition==="bottom"?(e.openBlock(),e.createBlock(W,{key:1,steps:w.value,"active-step-index":B.value,position:c.multiStepConfig.stepPosition,"show-progress":c.multiStepConfig.showProgress,"allow-navigation":c.multiStepConfig.allowStepNavigation,onStepClick:k},null,8,["steps","active-step-index","position","show-progress","allow-navigation"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createBlock(e.unref(h.IonGrid),{key:1},{default:e.withCtx(()=>[e.createVNode(e.unref(h.IonRow),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.keys(s.value),S=>{var P,L,U,q,j;return e.openBlock(),e.createElementBlock(e.Fragment,{key:S},[E(s.value[S],e.unref(f),e.unref(i))?(e.openBlock(),e.createBlock(e.unref(h.IonCol),{key:0,size:((P=s.value[S].grid)==null?void 0:P.xs)??"12","size-sm":(L=s.value[S].grid)==null?void 0:L.sm,"size-md":(U=s.value[S].grid)==null?void 0:U.md,"size-lg":(q=s.value[S].grid)==null?void 0:q.lg,"size-xl":(j=s.value[S].grid)==null?void 0:j.xl,class:"ion-margin-vertical"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value[S].type),{modelValue:s.value[S],"onUpdate:modelValue":Q=>s.value[S]=Q,schema:s.value,"form-id":S,ref_for:!0,ref_key:"dynamicRefs",ref:g,"ref-key":S,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","schema","form-id","ref-key"]))]),_:2},1032,["size","size-sm","size-md","size-lg","size-xl"])):e.createCommentVNode("",!0)],64)}),128))]),_:1}),c.hideButtons?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(h.IonRow),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(h.IonCol),{size:"12",style:e.normalizeStyle([{display:"flex"},{justifyContent:c.buttonPlacement}])},{default:e.withCtx(()=>[c.showCancelButton?(e.openBlock(),e.createBlock(e.unref(h.IonButton),{key:0,onClick:I},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.cancelButtonText??"Cancel"),1)]),_:1})):e.createCommentVNode("",!0),c.showClearButton?(e.openBlock(),e.createBlock(e.unref(h.IonButton),{key:1,onClick:T},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.clearButtonText??"Reset"),1)]),_:1})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.customButtons,S=>(e.openBlock(),e.createBlock(e.unref(h.IonButton),{key:S.label,onClick:S.action,color:S.color??"primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S.label),1)]),_:2},1032,["onClick","color"]))),128)),e.createVNode(e.unref(h.IonButton),{onClick:R},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.submitButtonText??"Submit"),1)]),_:1})]),_:1},8,["style"])]),_:1}))]),_:1}))])}}}),ae=H(Ze,[["__scopeId","data-v-a0ab63bd"]]);function Je(o){return{applyValidationState:async t=>{var n,r,s,a,g;(n=o.value)==null||n.$el.classList.remove("ion-invalid"),(r=o.value)==null||r.$el.classList.remove("ion-valid"),t?(s=o.value)==null||s.$el.classList.add("ion-valid"):(a=o.value)==null||a.$el.classList.add("ion-invalid"),(g=o.value)==null||g.$el.classList.add("ion-touched")},resetValidationState:()=>{var t,n;(t=o.value)==null||t.$el.classList.remove("ion-touched"),(n=o.value)==null||n.$el.classList.remove("ion-invalid")}}}function M(o,u,l,t,n){const{applyValidationState:r,resetValidationState:s}=Je(o);async function a(){if(u.value.required&&!l.value)return u.value.error="This field is required",!1;if(n){const i=await n(l.value);if(typeof i=="string")return u.value.error=i,!1;if(i===!1)return!1}if(u.value.validation){const i=await u.value.validation(l.value,t==null?void 0:t.value);if(i&&i.length)return u.value.error=i.join(),!1}return!0}async function g(){const i=await a();i&&(u.value.error="",u.value.value=l.value),await r(i)}function p(){s(),u.value.error=""}function d(i=""){l.value=i,u.value.error="",u.value.value=i}function f(){return u.value.error?[u.value.error]:[]}return{isValid:a,onValueUpdate:g,onFocus:p,onReset:d,getErrors:f,applyValidationState:r,resetValidationState:s}}function Qe(o){const u=e.computed(()=>!!o.value.label),l=e.computed(()=>!!o.value.required),t=e.computed(()=>o.value.label||"");return{showLabel:u,showRequired:l,labelText:t}}const J=e.defineComponent({__name:"InputLabel",props:{model:{},slotName:{}},setup(o){const u=o,{showLabel:l,showRequired:t,labelText:n}=Qe(e.toRef(u,"model"));return(r,s)=>e.unref(l)?(e.openBlock(),e.createBlock(e.unref(h.IonLabel),{key:0,slot:r.slotName,class:"input-label"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n))+" ",1),e.unref(t)?(e.openBlock(),e.createBlock(e.unref(h.IonText),{key:0,color:"danger"},{default:e.withCtx(()=>s[0]||(s[0]=[e.createTextVNode("*")])),_:1,__:[0]})):e.createCommentVNode("",!0)]),_:1},8,["slot"])):e.createCommentVNode("",!0)}}),K=e.defineComponent({__name:"BaseInput",props:e.mergeModels({schema:{},type:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const l=o,t=e.useModel(o,"modelValue"),n=e.ref(null),r=e.ref(t.value.value),s=e.computed(()=>l.schema),{isValid:a,onValueUpdate:g,onFocus:p,onReset:d,getErrors:f}=M(n,t,r,s),i=e.computed(()=>{if(t.value.pattern)return we(t.value.pattern)});return e.watch(()=>t.value.value,v=>r.value=v),u({onValueUpdate:g,onReset:d,getErrors:f,isValid:a}),(v,B)=>{var w;const y=e.resolveDirective("maskito");return e.withDirectives((e.openBlock(),e.createBlock(e.unref(h.IonInput),{ref_key:"inputRef",ref:n,modelValue:r.value,"onUpdate:modelValue":B[0]||(B[0]=b=>r.value=b),class:e.normalizeClass(t.value.className),"clear-input":!0,fill:t.value.fill??"solid","label-placement":t.value.labelPlacement??"stacked",type:v.type??"text",required:t.value.required,"error-text":t.value.error,autofocus:t.value.autoFocus,placeholder:((w=i.value)==null?void 0:w.placeholder)??t.value.placeholder,disabled:t.value.disabled,counter:t.value.counter,min:t.value.min,max:t.value.max,"max-length":t.value.maxLength,"min-length":t.value.minLength,pattern:t.value.pattern,style:{width:"100%"},onIonFocus:e.unref(p),onIonChange:e.unref(g),onIonBlur:e.unref(g)},{default:e.withCtx(()=>[e.createVNode(J,{model:t.value,"slot-name":"label"},null,8,["model"]),t.value.prefix?(e.openBlock(),e.createBlock(e.unref(h.IonLabel),{key:0,slot:"start"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.prefix),1)]),_:1})):e.createCommentVNode("",!0),t.value.suffix?(e.openBlock(),e.createBlock(e.unref(h.IonLabel),{key:1,slot:"end"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.suffix),1)]),_:1})):e.createCommentVNode("",!0),v.type==="password"?(e.openBlock(),e.createBlock(e.unref(h.IonInputPasswordToggle),{key:2,slot:"end"})):e.createCommentVNode("",!0)]),_:1},8,["modelValue","class","fill","label-placement","type","required","error-text","autofocus","placeholder","disabled","counter","min","max","max-length","min-length","pattern","onIonFocus","onIonChange","onIonBlur"])),[[y,i.value]])}}}),re=e.defineComponent({__name:"TextInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const l=e.useModel(o,"modelValue"),t=e.ref(null);return u({onReset:()=>{var n;return(n=t.value)==null?void 0:n.onReset()},onValueUpdate:()=>{var n;return(n=t.value)==null?void 0:n.onValueUpdate()},getErrors:()=>{var n,r;return((r=(n=t.value)==null?void 0:n.getErrors)==null?void 0:r.call(n))??[]}}),(n,r)=>(e.openBlock(),e.createBlock(K,{modelValue:l.value,"onUpdate:modelValue":r[0]||(r[0]=s=>l.value=s),type:"text",schema:n.schema,ref_key:"inputRef",ref:t},null,8,["modelValue","schema"]))}}),ue=e.defineComponent({__name:"DateInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const l=e.useModel(o,"modelValue"),t=e.ref(null);return u({onValueUpdate:()=>{var n;return(n=t.value)==null?void 0:n.onValueUpdate()},onReset:()=>{var n;return(n=t.value)==null?void 0:n.onReset()},getErrors:()=>{var n,r;return((r=(n=t.value)==null?void 0:n.getErrors)==null?void 0:r.call(n))??[]}}),(n,r)=>(e.openBlock(),e.createBlock(K,{modelValue:l.value,"onUpdate:modelValue":r[0]||(r[0]=s=>l.value=s),type:l.value.enableTime?"datetime-local":"date",schema:n.schema,ref_key:"inputRef",ref:t},null,8,["modelValue","type","schema"]))}}),se=e.defineComponent({__name:"NumberInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const l=e.useModel(o,"modelValue"),t=e.ref(null);return u({onReset:()=>{var n;return(n=t.value)==null?void 0:n.onReset()},onValueUpdate:()=>{var n;return(n=t.value)==null?void 0:n.onValueUpdate()},getErrors:()=>{var n,r;return((r=(n=t.value)==null?void 0:n.getErrors)==null?void 0:r.call(n))??[]}}),(n,r)=>(e.openBlock(),e.createBlock(K,{modelValue:l.value,"onUpdate:modelValue":r[0]||(r[0]=s=>l.value=s),type:"number",schema:n.schema,ref_key:"inputRef",ref:t},null,8,["modelValue","schema"]))}}),ie=e.defineComponent({__name:"EmailInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const l=e.useModel(o,"modelValue"),t=e.ref(null);return u({onReset:()=>{var n;return(n=t.value)==null?void 0:n.onReset()},onValueUpdate:()=>{var n;return(n=t.value)==null?void 0:n.onValueUpdate()},getErrors:()=>{var n,r;return((r=(n=t.value)==null?void 0:n.getErrors)==null?void 0:r.call(n))??[]}}),(n,r)=>(e.openBlock(),e.createBlock(K,{modelValue:l.value,"onUpdate:modelValue":r[0]||(r[0]=s=>l.value=s),type:"email",schema:n.schema,ref_key:"inputRef",ref:t},null,8,["modelValue","schema"]))}}),ce=e.defineComponent({__name:"PasswordInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const l=e.useModel(o,"modelValue"),t=e.ref(null);return u({onReset:()=>{var n;return(n=t.value)==null?void 0:n.onReset()},onValueUpdate:()=>{var n;return(n=t.value)==null?void 0:n.onValueUpdate()},getErrors:()=>{var n,r;return((r=(n=t.value)==null?void 0:n.getErrors)==null?void 0:r.call(n))??[]}}),(n,r)=>(e.openBlock(),e.createBlock(K,{modelValue:l.value,"onUpdate:modelValue":r[0]||(r[0]=s=>l.value=s),type:"password",schema:n.schema,ref_key:"inputRef",ref:t},null,8,["modelValue","schema"]))}}),Xe=e.defineComponent({__name:"SelectInput",props:e.mergeModels({schema:Object,type:String,formId:String},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const l=o,t=e.useModel(o,"modelValue"),n=e.ref(null),r=e.ref(null),s=e.ref(!1),a=e.ref([]),g=e.ref(""),p=e.ref(1),d=e.computed(()=>t.value.interface??"popover"),f=e.computed(()=>t.value.optionsPlacement==="top"?"top":"bottom"),i=e.computed(()=>a.value.filter(m=>!!m.isChecked)),v=e.computed(()=>!g.value&&X(i.value)&&!s.value?t.value.placeholder??"Select an option":"");e.watch([g,()=>t.value.options],I,{immediate:!0,deep:!0}),e.watch(()=>t.value.value,C,{immediate:!0,deep:!0}),e.watch(()=>!t.value.dependsOn||!l.schema?null:(Array.isArray(t.value.dependsOn)?t.value.dependsOn:[t.value.dependsOn]).map(k=>{const V=l.schema[k];return D(V)?V.value:void 0}),async(m,k)=>{m&&k&&!G(m,k)&&(B(),a.value=[],await I())},{deep:!0});function B(){t.value.error="",g.value="",p.value=1,t.value.value=t.value.multiple?[]:"",_e(a.value)}function y(m){const k=a.value.findIndex(V=>V.value===m.value&&V.isChecked);if(k>=0){if(Array.isArray(t.value.value)){const V=te(m,t.value.value);V>=0&&t.value.value.splice(V,1)}a.value[k].isChecked=!1}else t.value.multiple||B(),$(m,a.value);O(),g.value=""}function w(){switch(d.value){case"action-sheet":b();break;case"alert":x();break;case"popover":default:s.value=!0;break}}async function b(){if(await I(),t.value.multiple){s.value=!0;return}await(await h.actionSheetController.create({header:t.value.label||"Select an option",buttons:[...a.value.map(k=>({text:k.label,cssClass:k.isChecked?"selected-option":"",handler:()=>(y(k),!1)})),{text:"Cancel",role:"cancel"}]})).present()}async function x(){await I();const m=a.value.map(V=>({label:V.label,type:t.value.multiple?"checkbox":"radio",value:V,checked:V.isChecked}));await(await h.alertController.create({header:t.value.label||"Select an option",inputs:m,buttons:[{text:"Cancel",role:"cancel"},{text:"OK",handler:V=>{if(t.value.multiple)a.value.forEach(E=>Se(E,a.value)),V.forEach(E=>{const c=a.value.find(_=>_.value===E.value);c&&$(c,a.value)});else{B();const E=a.value.find(c=>c.value===V.value);E&&$(E,a.value)}O()}}]})).present()}async function F(){if(t.value.required&&X(i.value))return"This field is required";if(t.value.validation){const m=await t.value.validation(i.value,l==null?void 0:l.schema);if(m&&m.length)return m.join()}return!0}const{onFocus:A,applyValidationState:R}=M(n,t,e.computed(()=>t.value.multiple?i.value:i.value[0]),e.computed(()=>l==null?void 0:l.schema),F);function T(m){var k;m.target===((k=n.value)==null?void 0:k.$el)&&(A(),d.value==="popover"&&(s.value=!0))}async function O(m){var V;if((V=m==null?void 0:m.relatedTarget)!=null&&V.closest(".suggestions-list"))return;s.value=!1;const k=await F();k===!0?(t.value.error="",t.value.value=t.value.multiple?i.value:i.value[0]):t.value.error=typeof k=="string"?k:"Validation failed",await R(k===!0)}async function I(){const m=[];if(typeof t.value.options=="function"){let k={};if(t.value.dependsOn&&l.schema){const V=Array.isArray(t.value.dependsOn)?t.value.dependsOn:[t.value.dependsOn];let E=!0;if(k=V.reduce((c,_)=>{const N=l.schema[_];return c[_]=D(N)?N.value:void 0,(c[_]===void 0||c[_]===null||c[_]==="")&&(E=!1),c},{}),E){const c=await t.value.options(g.value,k);m.push(...c.filter(_=>!!_.label))}}else{const V=await t.value.options(g.value,{});m.push(...V.filter(E=>!!E.label))}}else Array.isArray(t.value.options)&&m.push(...be(t.value.options,g.value));i.value.forEach(k=>$(k,m)),a.value=m}async function C(){const m=t.value.value;if(m){if(a.value.length===0&&await I(),Array.isArray(m))m.forEach(k=>$(k,a.value));else if(typeof m=="object")$(m,a.value);else{const k=a.value.find(V=>V.value===m);$(k||{value:m,label:m},a.value)}O()}}return e.onMounted(async()=>{await I(),await C()}),u({onValueUpdate:O,onReset:B,getErrors:()=>t.value.error?[t.value.error]:[]}),(m,k)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["autocomplete-container",t.value.className]),onFocusout:O,ref_key:"containerRef",ref:r},[e.createVNode(e.unref(h.IonInput),{ref_key:"inputRef",ref:n,modelValue:g.value,"onUpdate:modelValue":k[0]||(k[0]=V=>g.value=V),fill:t.value.fill??"solid","label-placement":t.value.labelPlacement??"stacked",type:o.type??"text",required:t.value.required,"error-text":t.value.error,autofocus:t.value.autoFocus,placeholder:v.value,disabled:t.value.disabled,counter:t.value.counter,debounce:300,onIonFocus:T,onClick:w,style:{width:"100%"}},{default:e.withCtx(()=>[e.createVNode(J,{model:t.value,"slot-name":"label"},null,8,["model"]),t.value.multiple?(e.openBlock(),e.createBlock(e.unref(h.IonLabel),{key:0,style:{width:"fit-content"},slot:"start"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(V,E)=>(e.openBlock(),e.createBlock(e.unref(h.IonChip),{key:E},{default:e.withCtx(()=>[e.createVNode(e.unref(h.IonLabel),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(V.label),1)]),_:2},1024)]),_:2},1024))),128))]),_:1})):(e.openBlock(),e.createBlock(e.unref(h.IonLabel),{key:1,slot:"start",class:"ion-no-wrap"},{default:e.withCtx(()=>{var V;return[e.createTextVNode(e.toDisplayString(((V=i.value[0])==null?void 0:V.label)??""),1)]}),_:1})),e.createVNode(e.unref(h.IonIcon),{slot:"end",icon:e.unref(Z.chevronDown)},null,8,["icon"]),i.value.length>0||g.value?(e.openBlock(),e.createBlock(e.unref(h.IonIcon),{key:2,slot:"end",icon:e.unref(Z.close),onClick:B,style:{"z-index":"999999"}},null,8,["icon"])):e.createCommentVNode("",!0)]),_:1},8,["modelValue","fill","label-placement","type","required","error-text","autofocus","placeholder","disabled","counter"]),s.value&&a.value.length>0&&d.value==="popover"?(e.openBlock(),e.createBlock(e.unref(h.IonList),{key:0,class:e.normalizeClass(["suggestions-list",f.value])},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,V=>(e.openBlock(),e.createBlock(e.unref(h.IonItem),{button:"",key:V.label,onClick:E=>y(V),lines:t.value.showOptionsSeparator?"none":"full"},{default:e.withCtx(()=>[t.value.multiple?(e.openBlock(),e.createBlock(e.unref(h.IonCheckbox),{key:0,slot:"start",checked:V.isChecked},null,8,["checked"])):e.createCommentVNode("",!0),e.createVNode(e.unref(h.IonLabel),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(V.label),1)]),_:2},1024)]),_:2},1032,["onClick","lines"]))),128))]),_:1},8,["class"])):e.createCommentVNode("",!0)],34))}}),de=H(Xe,[["__scopeId","data-v-9525dee8"]]),pe=e.defineComponent({__name:"TextAreaInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const l=o,t=e.useModel(o,"modelValue"),n=e.ref(null),r=e.ref(t.value.value),s=e.computed(()=>l.schema),{onValueUpdate:a,onFocus:g,onReset:p,getErrors:d}=M(n,t,r,s);return e.watch(()=>t.value.value,f=>r.value=f),u({onReset:p,onValueUpdate:a,getErrors:d}),(f,i)=>(e.openBlock(),e.createBlock(e.unref(h.IonTextarea),{ref_key:"inputRef",ref:n,modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=v=>r.value=v),class:e.normalizeClass(t.value.className),"clear-input":!0,fill:t.value.fill??"solid","label-placement":t.value.labelPlacement??"stacked",required:t.value.required,"error-text":t.value.error,autofocus:t.value.autoFocus,placeholder:t.value.placeholder,disabled:t.value.disabled,counter:t.value.counter,min:t.value.min,max:t.value.max,rows:t.value.rows,cols:t.value.cols,"auto-grow":t.value.autoGrow,"max-length":t.value.maxLength,"min-length":t.value.minLength,pattern:t.value.pattern,onIonFocus:e.unref(g),onIonChange:e.unref(a),onIonBlur:e.unref(a),style:{width:"100%"}},{default:e.withCtx(()=>[e.createVNode(J,{model:t.value,"slot-name":"label"},null,8,["model"])]),_:1},8,["modelValue","class","fill","label-placement","required","error-text","autofocus","placeholder","disabled","counter","min","max","rows","cols","auto-grow","max-length","min-length","pattern","onIonFocus","onIonChange","onIonBlur"]))}}),Ye={class:"button-container"},et=e.defineComponent({__name:"RepeatInput",props:e.mergeModels({schema:{},data:{},computedData:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const l=e.useModel(o,"modelValue"),t=e.ref([]),{dynamicRefs:n,resetForm:r,getFormErrors:s,updateFormValues:a}=oe(),g=e.computed(()=>t.value.map((B,y)=>({label:`Set ${y+1}`,value:y,other:Object.entries(B).reduce((w,[b,x])=>(D(x)&&(w[b]=x.value),w),{})})));e.watch(g,B=>{l.value.value=B},{deep:!0,immediate:!0}),e.onMounted(p);function p(){l.value.children&&t.value.push(ee(l.value.children))}function d(B){t.value.splice(B,1)}function f(){r()}function i(){return s()}async function v(){await a()}return u({onValueUpdate:v,onReset:f,getErrors:i}),(B,y)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(w,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["repeat-input-wrapper",l.value.className]),key:b},[e.createVNode(e.unref(h.IonRow),{class:"repeat-row"},{default:e.withCtx(()=>[e.createVNode(e.unref(h.IonCol),{size:"11",class:"form-fields-column"},{default:e.withCtx(()=>[e.createVNode(e.unref(h.IonRow),{class:"fields-row"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.keys(w),x=>{var F,A,R,T,O;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(Y)(w[x],B.data,B.computedData)?(e.openBlock(),e.createBlock(e.unref(h.IonCol),{key:`${b}-${x}`,size:((F=w[x].grid)==null?void 0:F.xs)??"12","size-sm":(A=w[x].grid)==null?void 0:A.sm,"size-md":(R=w[x].grid)==null?void 0:R.md,"size-lg":(T=w[x].grid)==null?void 0:T.lg,"size-xl":(O=w[x].grid)==null?void 0:O.xl,class:"ion-margin-bottom"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(w[x].type),{modelValue:w[x],"onUpdate:modelValue":I=>w[x]=I,schema:w,"ref-key":`${b}-${x}`,ref_for:!0,ref_key:"dynamicRefs",ref:n,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","schema","ref-key"]))]),_:2},1032,["size","size-sm","size-md","size-lg","size-xl"])):e.createCommentVNode("",!0)],64)}),256))]),_:2},1024)]),_:2},1024),e.createVNode(e.unref(h.IonCol),{size:"1",class:"button-column"},{default:e.withCtx(()=>[e.createElementVNode("div",Ye,[b===t.value.length-1?(e.openBlock(),e.createBlock(e.unref(h.IonButton),{key:0,onClick:p,color:"primary",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(h.IonIcon),{slot:"icon-only",icon:e.unref(Z.add)},null,8,["icon"])]),_:1})):e.createCommentVNode("",!0),t.value.length>1?(e.openBlock(),e.createBlock(e.unref(h.IonButton),{key:1,onClick:x=>d(b),color:"warning",size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(h.IonIcon),{slot:"icon-only",icon:e.unref(Z.remove)},null,8,["icon"])]),_:2},1032,["onClick"])):e.createCommentVNode("",!0)])]),_:2},1024)]),_:2},1024)],2))),128))}}),fe=H(et,[["__scopeId","data-v-0eb7594d"]]),me=e.defineComponent({__name:"CheckboxInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const l=o,t=e.useModel(o,"modelValue"),n=e.ref(null),r=e.ref(t.value.value),s=e.computed(()=>l.schema),a=e.computed(()=>xe(t.value)),{onValueUpdate:g,onFocus:p,getErrors:d}=M(n,t,r,s);function f(){r.value=!1,t.value.error="",t.value.value=!1}return e.watch(()=>t.value.value,i=>r.value=i),u({onValueUpdate:g,onReset:f,getErrors:d}),(i,v)=>(e.openBlock(),e.createBlock(e.unref(h.IonCheckbox),{modelValue:r.value,"onUpdate:modelValue":v[0]||(v[0]=B=>r.value=B),ref_key:"inputRef",ref:n,justify:"start",class:e.normalizeClass(t.value.className),required:t.value.required,"error-text":t.value.error,disabled:t.value.disabled,onIonFocus:e.unref(p),onIonChange:e.unref(g),onIonBlur:e.unref(g),style:{width:"100%"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value),1)]),_:1},8,["modelValue","class","required","error-text","disabled","onIonFocus","onIonChange","onIonBlur"]))}}),ve=e.defineComponent({__name:"RadioInput",props:e.mergeModels({schema:{}},{modelValue:{type:Object,default:{}},modelModifiers:{}}),emits:["update:modelValue"],setup(o,{expose:u}){const l=o,t=e.useModel(o,"modelValue"),n=e.ref(null),r=e.ref(t.value.value),s=e.computed(()=>l.schema),a=e.ref([]),{onValueUpdate:g,onFocus:p,getErrors:d,isValid:f}=M(n,t,r,s);function i(){t.value.error="",r.value=void 0,t.value.value=void 0}function v(y,w){return y.value===w.value}async function B(){typeof t.value.options=="function"?a.value=await t.value.options():a.value=t.value.options}return e.watch(()=>t.value.value,y=>r.value=y),u({onValueUpdate:g,onReset:i,getErrors:d,isValid:f}),e.onMounted(B),(y,w)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(J,{model:t.value},null,8,["model"]),w[1]||(w[1]=e.createElementVNode("br",null,null,-1)),t.value.error?(e.openBlock(),e.createBlock(e.unref(h.IonNote),{key:0,color:"danger"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.value.error),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(h.IonItem),null,{default:e.withCtx(()=>[e.createVNode(e.unref(h.IonRadioGroup),{modelValue:r.value,"onUpdate:modelValue":w[0]||(w[0]=b=>r.value=b),class:e.normalizeClass(t.value.className),required:t.value.required,disabled:t.value.disabled,compareWith:v,"allow-empty-selection":!t.value.required,onIonFocus:e.unref(p),onIonChange:e.unref(g),onIonBlur:e.unref(g),style:{width:"100%"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,b=>(e.openBlock(),e.createBlock(e.unref(h.IonItem),{key:b.value,lines:t.value.showOptionsSeparator?"none":"full"},{default:e.withCtx(()=>[e.createVNode(e.unref(h.IonRadio),{value:b,disabled:t.value.disabled,"label-placement":"end",justify:"start"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(b.label),1)]),_:2},1032,["value","disabled"])]),_:2},1032,["lines"]))),128))]),_:1},8,["modelValue","class","required","disabled","allow-empty-selection","onIonFocus","onIonChange","onIonBlur"])]),_:1})],64))}}),tt={class:"form-section-header"},ot={class:"form-section-title"},lt={key:0,class:"form-section-subtitle"},nt=e.defineComponent({__name:"SectionTitle",props:{modelValue:{},schema:{},formId:{},refKey:{}},setup(o){const l=o.modelValue;return(t,n)=>{var r,s,a,g,p;return e.openBlock(),e.createBlock(e.unref(h.IonCol),{size:((r=e.unref(l).grid)==null?void 0:r.xs)??"12","size-sm":(s=e.unref(l).grid)==null?void 0:s.sm,"size-md":(a=e.unref(l).grid)==null?void 0:a.md,"size-lg":(g=e.unref(l).grid)==null?void 0:g.lg,"size-xl":(p=e.unref(l).grid)==null?void 0:p.xl,class:e.normalizeClass(["form-section-container",e.unref(l).className])},{default:e.withCtx(()=>[e.createElementVNode("div",tt,[e.createElementVNode("h3",ot,e.toDisplayString(e.unref(l).title),1),e.unref(l).subtitle?(e.openBlock(),e.createElementBlock("p",lt,e.toDisplayString(e.unref(l).subtitle),1)):e.createCommentVNode("",!0)])]),_:1},8,["size","size-sm","size-md","size-lg","size-xl","class"])}}}),he=H(nt,[["__scopeId","data-v-e0bf7af0"]]);function at(o,u,l){const t=e.ref({}),n=e.ref({});function r(d,f,i){n.value[d]=i,f.forEach(v=>{var B;(B=t.value)[v]??(B[v]=[]),t.value[v].includes(d)||t.value[v].push(d)}),p(d)}function s(d){return Object.entries(t.value).filter(([,i])=>i.includes(d)).map(([i])=>i).reduce((i,v)=>(i[v]=u.value[v]??l.value[v],i),{})}function a(d,f){return d?Array.isArray(d)?d.some(i=>f.some(v=>g(i,v.value))):f.some(i=>g(d,i.value)):!1}function g(d,f){return typeof d=="object"&&d!==null?d.value===f:String(d)===String(f)}async function p(d,f){if(!n.value[d])return;const i=s(d),v=Object.keys(i);if(!(v.length===0||!v.every(y=>i[y]!==void 0&&i[y]!==null)))try{const y=n.value[d],w=await y(f,i);if(!o.value[d])return;const b=o.value[d];if(!D(b))return;b.options=w;const x=b.value;if(!x)return;a(x,w)||(b.value=b.multiple?[]:"")}catch(y){console.error(`Error loading options for ${d}:`,y)}}return e.watch([u,l],()=>{Object.entries(t.value).forEach(([d,f])=>{(u.value[d]!==void 0||l.value[d]!==void 0)&&f.forEach(i=>{p(i)})})},{deep:!0,immediate:!0}),{registerDependency:r,updateOptions:p}}const ge={install(o){o.component("VForm",ae),o.component("TextInput",re),o.component("DateInput",ue),o.component("NumberInput",se),o.component("EmailInput",ie),o.component("PasswordInput",ce),o.component("SelectInput",de),o.component("TextAreaInput",pe),o.component("RepeatInput",fe),o.component("CheckboxInput",me),o.component("RadioInput",ve),o.component("FormSection",he),o.directive("maskito",ke.maskito)}};exports.CheckboxInput=me;exports.DateInput=ue;exports.EmailInput=ie;exports.FormBuilder=ae;exports.FormSection=he;exports.NumberInput=se;exports.PasswordInput=ce;exports.RadioInput=ve;exports.RepeatInput=fe;exports.SelectInput=de;exports.TextAreaInput=pe;exports.TextInput=re;exports.VForm=ge;exports.default=ge;exports.useDataTransformation=le;exports.useDependentOptions=at;exports.useFormValidation=oe;exports.useInputValidation=M;exports.useMultiStepForm=ne;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|