@uniquedj95/vform 3.3.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +219 -39
- package/dist/components/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/shared/StepIndicator.vue.d.ts +18 -0
- package/dist/components/shared/StepIndicator.vue.d.ts.map +1 -0
- package/dist/components/vForm.vue.d.ts +21 -7
- package/dist/components/vForm.vue.d.ts.map +1 -1
- package/dist/composables/useMultiStepForm.d.ts +27 -0
- package/dist/composables/useMultiStepForm.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +1048 -617
- 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 +89 -0
- package/dist/types/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/)
|
@@ -20,13 +20,18 @@ A dynamic form builder for Vue.js with Ionic components
|
|
20
20
|
## Table of Contents
|
21
21
|
|
22
22
|
- [Overview](#overview)
|
23
|
-
- [
|
23
|
+
- [Demo](#demo)
|
24
24
|
- [Features](#features)
|
25
25
|
- [Installation](#installation)
|
26
26
|
- [Usage](#usage)
|
27
27
|
- [Schema Structure](#schema-structure)
|
28
28
|
- [Example Schema](#example-schema)
|
29
29
|
- [Field Configuration Options](#field-configuration-options)
|
30
|
+
- [Multi-Step Forms](#multi-step-forms)
|
31
|
+
- [Basic Multi-Step Setup](#basic-multi-step-setup)
|
32
|
+
- [Step Configuration](#step-configuration)
|
33
|
+
- [Step Indicator Positioning](#step-indicator-positioning)
|
34
|
+
- [Step Validation](#step-validation)
|
30
35
|
- [Form Events](#form-events)
|
31
36
|
- [Form Methods](#form-methods)
|
32
37
|
- [Input Dependencies](#input-dependencies)
|
@@ -37,7 +42,6 @@ A dynamic form builder for Vue.js with Ionic components
|
|
37
42
|
- [Custom Buttons](#custom-buttons)
|
38
43
|
- [RepeatInput](#repeatinput)
|
39
44
|
- [Option Descriptions](#option-descriptions)
|
40
|
-
- [Date Pattern Formatting](#date-pattern-formatting)
|
41
45
|
- [Issue Reporting and Feedback](#issue-reporting-and-feedback)
|
42
46
|
- [Contributors](#contributors)
|
43
47
|
|
@@ -45,7 +49,7 @@ A dynamic form builder for Vue.js with Ionic components
|
|
45
49
|
|
46
50
|
vForm is a Vue.js component that dynamically generates forms based on a provided schema. It leverages Ionic components for a responsive and mobile-friendly design, supporting complex forms with conditional rendering and validation logic. It provides a robust and flexible form-building solution for Vue.js applications, allowing for a high degree of customization and control over the form behavior and appearance.
|
47
51
|
|
48
|
-
##
|
52
|
+
## Demo
|
49
53
|
|
50
54
|
Explore all VForm features with our comprehensive interactive demo:
|
51
55
|
|
@@ -62,6 +66,7 @@ npm run demo:dev
|
|
62
66
|
The demo showcases:
|
63
67
|
|
64
68
|
- **Basic Forms**: All input types and basic functionality
|
69
|
+
- **Multi-Step Forms**: Step indicators, validation, and smart navigation
|
65
70
|
- **Advanced Features**: Masking, computed fields, custom buttons
|
66
71
|
- **Validation Examples**: Custom validators and error handling
|
67
72
|
- **Dependent Fields**: Dynamic field behavior and cascading options
|
@@ -80,14 +85,15 @@ npm run demo:update
|
|
80
85
|
|
81
86
|
## Features
|
82
87
|
|
88
|
+
- **Multi-Step Forms**: Create guided, step-by-step forms with configurable step indicators, validation, and smart navigation.
|
83
89
|
- **Dynamic Form Generation**: Create forms dynamically based on a schema definition.
|
84
90
|
- **Conditional Field Rendering**: Fields can be shown or hidden based on other form values.
|
85
91
|
- **Dependent Options**: Load options for select inputs based on the values of other fields.
|
86
92
|
- **Responsive Grid Layout**: Utilizes Ionic Grid for a responsive design that works across different screen sizes.
|
87
|
-
- **Enhanced Date Input Field**:
|
93
|
+
- **Enhanced Date Input Field**: Built-in date and datetime picker support with Ionic components.
|
88
94
|
- **Multiple Selection Interfaces**: Three different interfaces for select inputs (popover, action sheet, alert).
|
89
95
|
- **Repeatable Field Groups**: Create dynamic, repeatable sets of form fields.
|
90
|
-
- **Advanced Validation**: Built-in validation with support for custom validation functions.
|
96
|
+
- **Advanced Validation**: Built-in validation with support for custom validation functions and step-by-step validation.
|
91
97
|
- **Computed Values**: Generate and transform values based on other form fields.
|
92
98
|
- **Customizable Styling**: Control appearance with flexible styling options.
|
93
99
|
- **Form Actions**: Customizable buttons with support for additional custom actions.
|
@@ -334,7 +340,195 @@ The following input types are supported:
|
|
334
340
|
| ---------- | ------------ | ------------------------------------- |
|
335
341
|
| `children` | `FormSchema` | Schema for the repeatable field group |
|
336
342
|
|
337
|
-
|
343
|
+
## Multi-Step Forms
|
344
|
+
|
345
|
+
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.
|
346
|
+
|
347
|
+
### Basic Multi-Step Setup
|
348
|
+
|
349
|
+
To create a multi-step form, define a `multiStepConfig` prop:
|
350
|
+
|
351
|
+
```vue
|
352
|
+
<template>
|
353
|
+
<v-form
|
354
|
+
:multi-step-config="multiStepConfig"
|
355
|
+
@multi-step-submit="handleSubmit"
|
356
|
+
@step-change="handleStepChange"
|
357
|
+
/>
|
358
|
+
</template>
|
359
|
+
|
360
|
+
<script setup lang="ts">
|
361
|
+
import { reactive } from 'vue';
|
362
|
+
import { FormSchema, MultiStepConfig } from '@uniquedj95/vform';
|
363
|
+
|
364
|
+
const multiStepConfig: MultiStepConfig = {
|
365
|
+
steps: [
|
366
|
+
{
|
367
|
+
id: 'personal',
|
368
|
+
title: 'Personal Information',
|
369
|
+
subtitle: 'Basic details about you',
|
370
|
+
schema: {
|
371
|
+
firstName: {
|
372
|
+
type: 'TextInput',
|
373
|
+
label: 'First Name',
|
374
|
+
required: true,
|
375
|
+
},
|
376
|
+
lastName: {
|
377
|
+
type: 'TextInput',
|
378
|
+
label: 'Last Name',
|
379
|
+
required: true,
|
380
|
+
},
|
381
|
+
},
|
382
|
+
},
|
383
|
+
{
|
384
|
+
id: 'contact',
|
385
|
+
title: 'Contact Details',
|
386
|
+
subtitle: 'How we can reach you',
|
387
|
+
schema: {
|
388
|
+
email: {
|
389
|
+
type: 'EmailInput',
|
390
|
+
label: 'Email',
|
391
|
+
required: true,
|
392
|
+
},
|
393
|
+
phone: {
|
394
|
+
type: 'TextInput',
|
395
|
+
label: 'Phone Number',
|
396
|
+
},
|
397
|
+
},
|
398
|
+
},
|
399
|
+
{
|
400
|
+
id: 'review',
|
401
|
+
title: 'Review & Submit',
|
402
|
+
subtitle: 'Final review of your information',
|
403
|
+
schema: {
|
404
|
+
comments: {
|
405
|
+
type: 'TextAreaInput',
|
406
|
+
label: 'Additional Comments',
|
407
|
+
},
|
408
|
+
},
|
409
|
+
},
|
410
|
+
],
|
411
|
+
stepPosition: 'top',
|
412
|
+
showProgress: true,
|
413
|
+
allowStepNavigation: true,
|
414
|
+
};
|
415
|
+
|
416
|
+
function handleSubmit(allData: MultiStepFormData) {
|
417
|
+
console.log('All form data:', allData);
|
418
|
+
}
|
419
|
+
|
420
|
+
function handleStepChange(stepIndex: number, stepId: string) {
|
421
|
+
console.log(`Moved to step ${stepIndex + 1}: ${stepId}`);
|
422
|
+
}
|
423
|
+
</script>
|
424
|
+
```
|
425
|
+
|
426
|
+
### Step Configuration
|
427
|
+
|
428
|
+
Each step in the multi-step configuration supports the following properties:
|
429
|
+
|
430
|
+
| Property | Type | Description | Required |
|
431
|
+
| ------------ | ------------ | --------------------------------------------- | -------- |
|
432
|
+
| `id` | `string` | Unique identifier for the step | Yes |
|
433
|
+
| `title` | `string` | Display title for the step | Yes |
|
434
|
+
| `subtitle` | `string` | Optional subtitle/description for the step | No |
|
435
|
+
| `schema` | `FormSchema` | Schema object containing fields for this step | Yes |
|
436
|
+
| `validation` | `function` | Custom validation function for the step | No |
|
437
|
+
|
438
|
+
### Step Indicator Positioning
|
439
|
+
|
440
|
+
The step indicator can be positioned in four different locations:
|
441
|
+
|
442
|
+
```typescript
|
443
|
+
const multiStepConfig: MultiStepConfig = {
|
444
|
+
stepPosition: 'top', // Above the form content (default)
|
445
|
+
// stepPosition: 'bottom', // Below the form content
|
446
|
+
// stepPosition: 'left', // Left side of the form content
|
447
|
+
// stepPosition: 'right', // Right side of the form content
|
448
|
+
// ... other config
|
449
|
+
};
|
450
|
+
```
|
451
|
+
|
452
|
+
#### Position Behaviors
|
453
|
+
|
454
|
+
- **Top/Bottom**: Step indicators display horizontally with connecting lines
|
455
|
+
- **Left**: Step indicators display vertically with titles to the right of numbered markers
|
456
|
+
- **Right**: Step indicators display vertically with titles to the left of numbered markers
|
457
|
+
|
458
|
+
### Step Validation
|
459
|
+
|
460
|
+
Multi-step forms include built-in validation that prevents users from proceeding to the next step until the current step is valid:
|
461
|
+
|
462
|
+
- **Next Step**: Validates all fields in the current step before advancing
|
463
|
+
- **Step Navigation**: When clicking step indicators, validates current step if moving forward
|
464
|
+
- **Submit**: Validates all steps before final submission
|
465
|
+
|
466
|
+
```typescript
|
467
|
+
const multiStepConfig: MultiStepConfig = {
|
468
|
+
steps: [
|
469
|
+
{
|
470
|
+
id: 'personal',
|
471
|
+
title: 'Personal Information',
|
472
|
+
schema: {
|
473
|
+
/* fields */
|
474
|
+
},
|
475
|
+
// Optional custom validation for this step
|
476
|
+
validation: async (stepData, computedData) => {
|
477
|
+
const errors: string[] = [];
|
478
|
+
|
479
|
+
// Custom validation logic
|
480
|
+
if (stepData.firstName && stepData.lastName && stepData.firstName === stepData.lastName) {
|
481
|
+
errors.push('First and last name cannot be the same');
|
482
|
+
}
|
483
|
+
|
484
|
+
return errors;
|
485
|
+
},
|
486
|
+
},
|
487
|
+
// ... other steps
|
488
|
+
],
|
489
|
+
// ... other config
|
490
|
+
};
|
491
|
+
```
|
492
|
+
|
493
|
+
### Multi-Step Configuration Options
|
494
|
+
|
495
|
+
| Property | Type | Description | Default |
|
496
|
+
| --------------------- | ---------------------------------------- | --------------------------------------------- | -------- |
|
497
|
+
| `steps` | `FormStep[]` | Array of step configurations | Required |
|
498
|
+
| `stepPosition` | `'top' \| 'bottom' \| 'left' \| 'right'` | Position of the step indicator | `'top'` |
|
499
|
+
| `showProgress` | `boolean` | Show progress bar and step counter | `true` |
|
500
|
+
| `allowStepNavigation` | `boolean` | Allow clicking on step indicators to navigate | `false` |
|
501
|
+
|
502
|
+
### Multi-Step Events
|
503
|
+
|
504
|
+
| Event | Description | Signature |
|
505
|
+
| ------------- | ----------------------------------------- | --------------------------------------------------------------- |
|
506
|
+
| `step-change` | Emitted when user navigates between steps | `(stepIndex: number, stepId: string) => void` |
|
507
|
+
| `submit` | Emitted when multi-step form is submitted | `(allData: FormData, multiStepData: MultiStepFormData) => void` |
|
508
|
+
|
509
|
+
The `submit` event provides both the combined data from all steps and the per-step data structure:
|
510
|
+
|
511
|
+
```typescript
|
512
|
+
// multi-step data structure
|
513
|
+
multiStepData: MultiStepFormData = {
|
514
|
+
steps: {
|
515
|
+
personal: { firstName: 'John', lastName: 'Doe' },
|
516
|
+
contact: { email: 'john@example.com', phone: '...' },
|
517
|
+
review: { comments: '...' },
|
518
|
+
},
|
519
|
+
computedSteps: {
|
520
|
+
/* computed values per step */
|
521
|
+
},
|
522
|
+
allFormData: {
|
523
|
+
/* all form Data raw values */
|
524
|
+
},
|
525
|
+
allComputedData: {
|
526
|
+
/* all form data computed values */
|
527
|
+
},
|
528
|
+
};
|
529
|
+
```
|
530
|
+
|
531
|
+
## Form Events
|
338
532
|
|
339
533
|
| Event | Description | Signature |
|
340
534
|
| -------- | ---------------------------------------------------------------- | -------------------------------------------------------------- |
|
@@ -609,40 +803,21 @@ When using SelectInput or CheckboxInput, you can add descriptions to options:
|
|
609
803
|
}
|
610
804
|
```
|
611
805
|
|
612
|
-
#### Date Pattern Formatting
|
613
|
-
|
614
|
-
The DateInput component supports various date pattern formats:
|
615
|
-
|
616
|
-
| Pattern | Description | Example |
|
617
|
-
| ------- | ----------------------------------------------- | ----------------------- |
|
618
|
-
| DD | Day of the month, two digits with leading zeros | 01 to 31 |
|
619
|
-
| D | Day of the month without leading zeros | 1 to 31 |
|
620
|
-
| MMM | Month name, abbreviated | Jan, Feb, Mar, etc. |
|
621
|
-
| MMMM | Month name, full | January, February, etc. |
|
622
|
-
| MM | Month as a number, with leading zeros | 01 to 12 |
|
623
|
-
| M | Month as a number, without leading zeros | 1 to 12 |
|
624
|
-
| YYYY | Year, four digits | 2025 |
|
625
|
-
| YY | Year, two digits | 25 |
|
626
|
-
| HH | Hour, two digits with leading zeros (24-hour) | 00 to 23 |
|
627
|
-
| mm | Minutes, two digits with leading zeros | 00 to 59 |
|
628
|
-
| ss | Seconds, two digits with leading zeros | 00 to 59 |
|
629
|
-
|
630
|
-
Example: `DD/MMM/YYYY HH:mm:ss` would format as `07/Jun/2025 14:30:00`
|
631
|
-
|
632
806
|
### Form Props
|
633
807
|
|
634
|
-
| Property | Type | Description | Default
|
635
|
-
| ------------------ | ------------------------------ | ---------------------------------------------------------------------- |
|
636
|
-
| `schema` | `FormSchema` | The schema object defining the form structure and field configurations | _Required_
|
637
|
-
| `
|
638
|
-
| `
|
639
|
-
| `
|
640
|
-
| `
|
641
|
-
| `
|
642
|
-
| `
|
643
|
-
| `
|
644
|
-
| `
|
645
|
-
| `
|
808
|
+
| Property | Type | Description | Default |
|
809
|
+
| ------------------ | ------------------------------ | ---------------------------------------------------------------------- | ----------- |
|
810
|
+
| `schema` | `FormSchema` | The schema object defining the form structure and field configurations | _Required_ |
|
811
|
+
| `multiStepConfig` | `MultiStepConfig` | Configuration for multi-step forms (optional) | `undefined` |
|
812
|
+
| `showLabels` | `boolean` | Determines if labels are displayed for each field | `true` |
|
813
|
+
| `showClearButton` | `boolean` | Controls the visibility of the clear/reset button | `true` |
|
814
|
+
| `showCancelButton` | `boolean` | Controls the visibility of the cancel button | `true` |
|
815
|
+
| `buttonPlacement` | `'start' \| 'middle' \| 'end'` | Specifies the alignment of action buttons within the form | `'start'` |
|
816
|
+
| `submitButtonText` | `string` | Custom text for the submit button | `"Submit"` |
|
817
|
+
| `clearButtonText` | `string` | Custom text for the clear/reset button | `"Reset"` |
|
818
|
+
| `cancelButtonText` | `string` | Custom text for the cancel button | `"Cancel"` |
|
819
|
+
| `hideButtons` | `boolean` | When true, hides all action buttons | `false` |
|
820
|
+
| `customButtons` | `Array<CustomButton>` | Array of custom buttons to add to the form | `[]` |
|
646
821
|
|
647
822
|
## Issue Reporting and Feedback
|
648
823
|
|
@@ -676,6 +851,11 @@ import {
|
|
676
851
|
FormOptions,
|
677
852
|
GridSize,
|
678
853
|
CustomButton,
|
854
|
+
// Multi-step types
|
855
|
+
MultiStepConfig,
|
856
|
+
MultiStepFormData,
|
857
|
+
FormStep,
|
858
|
+
StepPosition,
|
679
859
|
} from '@uniquedj95/vform';
|
680
860
|
```
|
681
861
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SelectInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/SelectInput.vue"],"names":[],"mappings":"AAiDA;
|
1
|
+
{"version":3,"file":"SelectInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/SelectInput.vue"],"names":[],"mappings":"AAiDA;AAodA,OAAO,EAAiB,QAAQ,EAA6C,MAAM,KAAK,CAAC;AAEzF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAU,MAAM,SAAS,CAAC;AAoFxE,iBAAS,OAAO,SAMf;AAkJD,iBAAe,aAAa,CAAC,GAAG,CAAC,EAAE,GAAG,iBAgBrC;;YAkamB,QAAQ,CAAC,UAAU,CAAC;UACtB,QAAQ,CAAC,cAAc,CAAC;;;;;;;;;;;;YADtB,QAAQ,CAAC,UAAU,CAAC;UACtB,QAAQ,CAAC,cAAc,CAAC;;;;;;;;;;;;;;;;;;AAX1C,wBAiBG"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { FormStep, StepPosition } from '../../types';
|
2
|
+
interface StepIndicatorProps {
|
3
|
+
steps: FormStep[];
|
4
|
+
activeStepIndex: number;
|
5
|
+
position: StepPosition;
|
6
|
+
showProgress?: boolean;
|
7
|
+
allowNavigation?: boolean;
|
8
|
+
}
|
9
|
+
declare const _default: import('vue').DefineComponent<StepIndicatorProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
10
|
+
"step-click": (stepIndex: number) => any;
|
11
|
+
}, string, import('vue').PublicProps, Readonly<StepIndicatorProps> & Readonly<{
|
12
|
+
"onStep-click"?: ((stepIndex: number) => any) | undefined;
|
13
|
+
}>, {
|
14
|
+
showProgress: boolean;
|
15
|
+
allowNavigation: boolean;
|
16
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
17
|
+
export default _default;
|
18
|
+
//# sourceMappingURL=StepIndicator.vue.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"StepIndicator.vue.d.ts","sourceRoot":"","sources":["../../../src/components/shared/StepIndicator.vue"],"names":[],"mappings":"AAoDA;AA2SA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEtD,UAAU,kBAAkB;IAC1B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,YAAY,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;;;;;;kBAFgB,OAAO;qBACJ,OAAO;;AA6J3B,wBASG"}
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import { FormData, ComputedData, FormSchema, CustomButton } from '../types';
|
1
|
+
import { FormData, ComputedData, FormSchema, CustomButton, MultiStepConfig, MultiStepFormData } from '../types';
|
2
2
|
interface FormProps {
|
3
|
-
schema
|
3
|
+
schema?: FormSchema;
|
4
|
+
multiStepConfig?: MultiStepConfig;
|
4
5
|
showLabels?: boolean;
|
5
6
|
showClearButton?: boolean;
|
6
7
|
showCancelButton?: boolean;
|
@@ -11,21 +12,34 @@ interface FormProps {
|
|
11
12
|
hideButtons?: boolean;
|
12
13
|
customButtons?: Array<CustomButton>;
|
13
14
|
}
|
15
|
+
declare function handleClearAction(): void;
|
16
|
+
declare function handleNextStep(): Promise<void>;
|
17
|
+
declare function handlePreviousStep(): Promise<void>;
|
18
|
+
declare function handleStepClick(stepIndex: number): Promise<void>;
|
14
19
|
declare const _default: import('vue').DefineComponent<FormProps, {
|
15
|
-
resetForm:
|
20
|
+
resetForm: typeof handleClearAction;
|
16
21
|
isFormValid: () => Promise<boolean>;
|
17
|
-
resolveData: () => {
|
22
|
+
resolveData: () => MultiStepFormData | {
|
18
23
|
formData: FormData;
|
19
24
|
computedData: ComputedData;
|
20
25
|
};
|
26
|
+
nextStep: typeof handleNextStep;
|
27
|
+
previousStep: typeof handlePreviousStep;
|
28
|
+
goToStep: typeof handleStepClick;
|
29
|
+
getCurrentStep: () => import('../types').FormStep | undefined;
|
30
|
+
getCurrentStepIndex: () => number;
|
21
31
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
22
32
|
clear: () => any;
|
23
|
-
submit: (formData: FormData, computedFormData: ComputedData) => any;
|
24
33
|
cancel: () => any;
|
34
|
+
submit: (formData: FormData, computedFormData: ComputedData) => any;
|
35
|
+
"multi-step-submit": (data: MultiStepFormData) => any;
|
36
|
+
"step-change": (stepIndex: number, stepId: string) => any;
|
25
37
|
}, string, import('vue').PublicProps, Readonly<FormProps> & Readonly<{
|
26
38
|
onClear?: (() => any) | undefined;
|
27
|
-
onSubmit?: ((formData: FormData, computedFormData: ComputedData) => any) | undefined;
|
28
39
|
onCancel?: (() => any) | undefined;
|
40
|
+
onSubmit?: ((formData: FormData, computedFormData: ComputedData) => any) | undefined;
|
41
|
+
"onMulti-step-submit"?: ((data: MultiStepFormData) => any) | undefined;
|
42
|
+
"onStep-change"?: ((stepIndex: number, stepId: string) => any) | undefined;
|
29
43
|
}>, {
|
30
44
|
showLabels: boolean;
|
31
45
|
showClearButton: boolean;
|
@@ -37,6 +51,6 @@ declare const _default: import('vue').DefineComponent<FormProps, {
|
|
37
51
|
hideButtons: boolean;
|
38
52
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
39
53
|
dynamicRefs: unknown[];
|
40
|
-
},
|
54
|
+
}, HTMLDivElement>;
|
41
55
|
export default _default;
|
42
56
|
//# sourceMappingURL=vForm.vue.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"vForm.vue.d.ts","sourceRoot":"","sources":["../../src/components/vForm.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"vForm.vue.d.ts","sourceRoot":"","sources":["../../src/components/vForm.vue"],"names":[],"mappings":"AAqLA;AA+jBA,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,eAAe,EACf,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAOjB,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;CACrC;AAuGD,iBAAS,iBAAiB,SAOzB;AAiBD,iBAAe,cAAc,kBAe5B;AAED,iBAAe,kBAAkB,kBAOhC;AAED,iBAAe,eAAe,CAAC,SAAS,EAAE,MAAM,iBAiB/C;;;;;;;;;;;;;;;;;;;;;;;;;;gBAnLc,OAAO;qBACF,OAAO;sBACN,OAAO;qBACR,OAAO,GAAG,QAAQ,GAAG,KAAK;sBACzB,MAAM;qBACP,MAAM;sBACL,MAAM;iBACX,OAAO;;;;AA+1BvB,wBAWG"}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { MultiStepConfig, MultiStepFormData, FormData, ComputedData, FormStep } from '../types';
|
2
|
+
export declare function useMultiStepForm(config: MultiStepConfig): {
|
3
|
+
currentStepIndex: import('vue').Ref<number, number>;
|
4
|
+
currentStep: import('vue').ComputedRef<FormStep>;
|
5
|
+
stepData: import('vue').Ref<Record<string, FormData>, Record<string, FormData>>;
|
6
|
+
stepComputedData: import('vue').Ref<Record<string, ComputedData>, Record<string, ComputedData>>;
|
7
|
+
stepValidationErrors: import('vue').Ref<Record<string, string[]>, Record<string, string[]>>;
|
8
|
+
isFirstStep: import('vue').ComputedRef<boolean>;
|
9
|
+
isLastStep: import('vue').ComputedRef<boolean>;
|
10
|
+
canGoNext: import('vue').ComputedRef<boolean>;
|
11
|
+
canGoPrevious: import('vue').ComputedRef<boolean>;
|
12
|
+
totalSteps: import('vue').ComputedRef<number>;
|
13
|
+
progressPercentage: import('vue').ComputedRef<number>;
|
14
|
+
allFormData: import('vue').ComputedRef<FormData>;
|
15
|
+
allComputedData: import('vue').ComputedRef<ComputedData>;
|
16
|
+
updateStepData: (stepId: string, data: FormData) => void;
|
17
|
+
updateStepComputedData: (stepId: string, data: ComputedData) => void;
|
18
|
+
clearStepData: (stepId: string) => void;
|
19
|
+
validateCurrentStep: () => Promise<boolean>;
|
20
|
+
goToStep: (stepIndex: number) => Promise<boolean>;
|
21
|
+
nextStep: () => Promise<boolean>;
|
22
|
+
previousStep: () => Promise<boolean>;
|
23
|
+
resetForm: () => void;
|
24
|
+
validateAllSteps: () => Promise<boolean>;
|
25
|
+
getMultiStepFormData: () => MultiStepFormData;
|
26
|
+
};
|
27
|
+
//# sourceMappingURL=useMultiStepForm.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useMultiStepForm.d.ts","sourceRoot":"","sources":["../../src/composables/useMultiStepForm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEpG,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe;;;;;;;;;;;;;;6BAmDtB,MAAM,QAAQ,QAAQ;qCAId,MAAM,QAAQ,YAAY;4BAInC,MAAM;+BASC,OAAO,CAAC,OAAO,CAAC;0BAqBnB,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;oBAiBjC,OAAO,CAAC,OAAO,CAAC;wBAOZ,OAAO,CAAC,OAAO,CAAC;;4BAgBZ,OAAO,CAAC,OAAO,CAAC;gCAmBlB,iBAAiB;EAuCnD"}
|