@uniquedj95/vform 1.7.0 → 2.0.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 +404 -59
- package/dist/components/inputs/BaseInput.vue.d.ts +24 -21
- package/dist/components/inputs/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/CheckboxInput.vue.d.ts +23 -15
- package/dist/components/inputs/CheckboxInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/DateInput.vue.d.ts +23 -15
- package/dist/components/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/EmailInput.vue.d.ts +56 -15
- package/dist/components/inputs/EmailInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/NumberInput.vue.d.ts +56 -15
- package/dist/components/inputs/NumberInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/PasswordInput.vue.d.ts +56 -15
- package/dist/components/inputs/PasswordInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/RepeatInput.vue.d.ts +19 -31
- package/dist/components/inputs/RepeatInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/SelectInput.vue.d.ts +25 -21
- package/dist/components/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/TextAreaInput.vue.d.ts +23 -15
- package/dist/components/inputs/TextAreaInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/TextInput.vue.d.ts +56 -15
- package/dist/components/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/components/vForm.vue.d.ts +10 -44
- package/dist/components/vForm.vue.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +4312 -4012
- package/dist/index.umd.js +1 -1
- package/dist/types/index.d.ts +139 -9
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/vform.css +1 -0
- package/package.json +9 -9
- package/dist/style.css +0 -1
package/README.md
CHANGED
@@ -1,5 +1,41 @@
|
|
1
|
+
<div align="center">
|
2
|
+
|
1
3
|
# vForm
|
2
4
|
|
5
|
+
<img src="https://img.icons8.com/color/96/000000/form.png" alt="vForm Logo"/>
|
6
|
+
|
7
|
+
A dynamic form builder for Vue.js with Ionic components
|
8
|
+
|
9
|
+
[](https://github.com/uniquedj95/vform/releases)
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
11
|
+
[](https://vuejs.org/)
|
12
|
+
[](https://www.typescriptlang.org/)
|
13
|
+
[](https://www.npmjs.com/package/@uniquedj95/vform)
|
14
|
+
[](https://ionicframework.com/)
|
15
|
+
[](https://bundlephobia.com/package/@uniquedj95/vform)
|
16
|
+
[](https://github.com/uniquedj95/vform/pulls)
|
17
|
+
</div>
|
18
|
+
|
19
|
+
## Table of Contents
|
20
|
+
- [Overview](#overview)
|
21
|
+
- [Features](#features)
|
22
|
+
- [Installation](#installation)
|
23
|
+
- [Usage](#usage)
|
24
|
+
- [Schema Structure](#schema-structure)
|
25
|
+
- [Example Schema](#example-schema)
|
26
|
+
- [Field Configuration Options](#field-configuration-options)
|
27
|
+
- [Form Events](#form-events)
|
28
|
+
- [Form Methods](#form-methods)
|
29
|
+
- [Form Props](#form-props)
|
30
|
+
- [Advanced Components](#advanced-components)
|
31
|
+
- [SelectInput](#selectinput)
|
32
|
+
- [Custom Buttons](#custom-buttons)
|
33
|
+
- [RepeatInput](#repeatinput)
|
34
|
+
- [Option Descriptions](#option-descriptions)
|
35
|
+
- [Date Pattern Formatting](#date-pattern-formatting)
|
36
|
+
- [Issue Reporting and Feedback](#issue-reporting-and-feedback)
|
37
|
+
- [Contributors](#contributors)
|
38
|
+
|
3
39
|
## Overview
|
4
40
|
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.
|
5
41
|
|
@@ -7,20 +43,44 @@ vForm is a Vue.js component that dynamically generates forms based on a provided
|
|
7
43
|
- **Dynamic Form Generation**: Create forms dynamically based on a schema definition.
|
8
44
|
- **Conditional Field Rendering**: Fields can be shown or hidden based on other form values.
|
9
45
|
- **Responsive Grid Layout**: Utilizes Ionic Grid for a responsive design that works across different screen sizes.
|
10
|
-
- **Enhanced Date Input Field**: Custom date formatting and handling.
|
11
|
-
- **
|
12
|
-
- **
|
13
|
-
- **
|
46
|
+
- **Enhanced Date Input Field**: Custom date formatting and handling with integrated date picker.
|
47
|
+
- **Multiple Selection Interfaces**: Three different interfaces for select inputs (popover, action sheet, alert).
|
48
|
+
- **Repeatable Field Groups**: Create dynamic, repeatable sets of form fields.
|
49
|
+
- **Advanced Validation**: Built-in validation with support for custom validation functions.
|
50
|
+
- **Computed Values**: Generate and transform values based on other form fields.
|
51
|
+
- **Customizable Styling**: Control appearance with flexible styling options.
|
52
|
+
- **Form Actions**: Customizable buttons with support for additional custom actions.
|
53
|
+
- **Rich Text Areas**: Textarea inputs with auto-grow capability and character counting.
|
54
|
+
- **Form Field Dependencies**: Create relationships between fields that react to changes.
|
55
|
+
- **Option Descriptions**: Add helpful descriptions to select and checkbox options.
|
14
56
|
|
15
57
|
## Installation
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
58
|
+
|
59
|
+
1. Install the package using your preferred package manager:
|
60
|
+
|
61
|
+
Using NPM:
|
62
|
+
```sh
|
63
|
+
npm install @uniquedj95/vform
|
64
|
+
```
|
65
|
+
|
66
|
+
Using Yarn:
|
67
|
+
```sh
|
68
|
+
yarn add @uniquedj95/vform
|
69
|
+
```
|
70
|
+
|
71
|
+
2. Make sure you have the required peer dependencies:
|
72
|
+
- Vue 3.5+
|
73
|
+
- Ionic Vue (for UI components)
|
74
|
+
|
75
|
+
```sh
|
76
|
+
npm install @ionic/vue ionicons
|
77
|
+
```
|
78
|
+
|
79
|
+
or
|
80
|
+
|
81
|
+
```sh
|
82
|
+
yarn add @ionic/vue ionicons
|
83
|
+
```
|
24
84
|
|
25
85
|
## Usage
|
26
86
|
1. Register `VForm` component in your Vue.js application:
|
@@ -33,7 +93,7 @@ vForm is a Vue.js component that dynamically generates forms based on a provided
|
|
33
93
|
import { VForm } from '@uniquedj95/vform';
|
34
94
|
|
35
95
|
/* Import CSS styles and other components here */
|
36
|
-
import '@uniquedj95/vform/
|
96
|
+
import '@uniquedj95/vform/vform.css'
|
37
97
|
|
38
98
|
const app = createApp(App)
|
39
99
|
.use(IonicVue)
|
@@ -74,58 +134,308 @@ vForm is a Vue.js component that dynamically generates forms based on a provided
|
|
74
134
|
```
|
75
135
|
|
76
136
|
## Schema Structure
|
77
|
-
The schema object should define the structure of the form. Each key in the schema represents a form field with its configuration
|
137
|
+
The schema object should define the structure of the form. Each key in the schema represents a form field with its configuration.
|
138
|
+
|
139
|
+
### Example Schema
|
140
|
+
```typescript
|
141
|
+
const formSchema: FormSchema = {
|
142
|
+
firstName: {
|
143
|
+
type: 'TextInput',
|
144
|
+
label: 'First Name',
|
145
|
+
required: true,
|
146
|
+
grid: { xs: '12', md: '6' }
|
147
|
+
},
|
148
|
+
lastName: {
|
149
|
+
type: 'TextInput',
|
150
|
+
label: 'Last Name',
|
151
|
+
required: true,
|
152
|
+
grid: { xs: '12', md: '6' }
|
153
|
+
},
|
154
|
+
birthDate: {
|
155
|
+
type: 'DateInput',
|
156
|
+
label: 'Date of Birth',
|
157
|
+
required: true,
|
158
|
+
pattern: 'DD/MMM/YYYY'
|
159
|
+
},
|
160
|
+
email: {
|
161
|
+
type: 'EmailInput',
|
162
|
+
label: 'Email Address',
|
163
|
+
required: true,
|
164
|
+
validation: (value) => {
|
165
|
+
if (!value.includes('@')) {
|
166
|
+
return ['Invalid email format'];
|
167
|
+
}
|
168
|
+
return null;
|
169
|
+
}
|
170
|
+
},
|
171
|
+
category: {
|
172
|
+
type: 'SelectInput',
|
173
|
+
label: 'Category',
|
174
|
+
options: [
|
175
|
+
{ label: 'Option 1', value: '1' },
|
176
|
+
{ label: 'Option 2', value: '2', description: { text: 'With an explanation', color: 'secondary', show: 'always' } }
|
177
|
+
]
|
178
|
+
},
|
179
|
+
notes: {
|
180
|
+
type: 'TextAreaInput',
|
181
|
+
label: 'Notes',
|
182
|
+
rows: 4,
|
183
|
+
autoGrow: true
|
184
|
+
}
|
185
|
+
};
|
186
|
+
```
|
78
187
|
|
79
188
|
### Field Configuration Options
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
189
|
+
|
190
|
+
#### Input Types
|
191
|
+
The following input types are supported:
|
192
|
+
|
193
|
+
| Type | Description |
|
194
|
+
|------|-------------|
|
195
|
+
| `TextInput` | Standard text input field |
|
196
|
+
| `DateInput` | Date picker with customizable format |
|
197
|
+
| `NumberInput` | Numeric input field |
|
198
|
+
| `EmailInput` | Input field with email validation |
|
199
|
+
| `PasswordInput` | Secure password input with toggle visibility |
|
200
|
+
| `TextAreaInput` | Multi-line text input |
|
201
|
+
| `SelectInput` | Dropdown selection |
|
202
|
+
| `CheckboxInput` | Toggle on/off input |
|
203
|
+
| `RepeatInput` | Repeatable group of fields |
|
204
|
+
|
205
|
+
#### Common Properties
|
206
|
+
|
207
|
+
| Property | Type | Description | Applies To |
|
208
|
+
|----------|------|-------------|------------|
|
209
|
+
| `label` | `string` | The label displayed for the form field | All |
|
210
|
+
| `placeholder` | `string` | Placeholder text for the input field | Text-based inputs |
|
211
|
+
| `required` | `boolean` | Determines if the field is required for form submission | All |
|
212
|
+
| `disabled` | `boolean` | Disables the input field if set to `true` | All |
|
213
|
+
| `hidden` | `boolean` | Hides the field completely if set to `true` | All |
|
214
|
+
| `autoFocus` | `boolean` | Automatically focuses the input field on form load | All |
|
215
|
+
| `error` | `string` | Custom error message for the field | All |
|
216
|
+
| `fill` | `"solid" \| "outline"` | Defines the fill style of the input field | All |
|
217
|
+
| `labelPlacement` | `"stacked" \| "start" \| "end" \| "fixed" \| "floating"` | Determines the position of the label | All |
|
218
|
+
|
219
|
+
#### Layout Properties
|
220
|
+
|
221
|
+
| Property | Type | Description |
|
222
|
+
|----------|------|-------------|
|
223
|
+
| `grid` | `GridSize` | Specifies responsive grid sizes: `xs`, `sm`, `md`, `lg`, `xl` |
|
224
|
+
| `icon` | `string` | Icon to display within the input field |
|
225
|
+
| `prefix` | `string` | Text to display before the input value |
|
226
|
+
| `suffix` | `string` | Text to display after the input value |
|
227
|
+
|
228
|
+
#### Validation and Dynamic Behavior
|
229
|
+
|
230
|
+
| Property | Type | Description |
|
231
|
+
|----------|------|-------------|
|
232
|
+
| `validation` | `FormValidator` | Custom validation function: `(value: FormValue, schema?: FormSchema) => Promise<Array<string> \| null> \| Array<string> \| null>` |
|
233
|
+
| `condition` | `Function` | Function to determine if field should be rendered: `(data: FormData, computedData: ComputedData) => boolean` |
|
234
|
+
| `computedValue` | `ComputedValueHandler` | Function to compute derived values: `(value: FormValue, schema: FormSchema) => Promise<any> \| any` |
|
235
|
+
| `onChange` | `Function` | Function triggered on field value changes: `(value: FormValue) => FormValue` |
|
236
|
+
|
237
|
+
#### Text Input Properties
|
238
|
+
|
239
|
+
| Property | Type | Description | Applies To |
|
240
|
+
|----------|------|-------------|------------|
|
241
|
+
| `minLength` | `number` | Minimum text length | Text-based inputs |
|
242
|
+
| `maxLength` | `number` | Maximum text length | Text-based inputs |
|
243
|
+
| `pattern` | `string` | Regular expression pattern for validation | Text-based inputs |
|
244
|
+
|
245
|
+
#### Number Input Properties
|
246
|
+
|
247
|
+
| Property | Type | Description |
|
248
|
+
|----------|------|-------------|
|
249
|
+
| `min` | `number \| string` | Minimum value |
|
250
|
+
| `max` | `number \| string` | Maximum value |
|
251
|
+
|
252
|
+
#### TextArea Properties
|
253
|
+
|
254
|
+
| Property | Type | Description |
|
255
|
+
|----------|------|-------------|
|
256
|
+
| `rows` | `number` | Number of visible text lines |
|
257
|
+
| `cols` | `number` | Visible width in characters |
|
258
|
+
| `autoGrow` | `boolean` | Automatic height adjustment based on content |
|
259
|
+
| `counter` | `boolean` | Show character counter |
|
260
|
+
|
261
|
+
#### Date Input Properties
|
262
|
+
|
263
|
+
| Property | Type | Description |
|
264
|
+
|----------|------|-------------|
|
265
|
+
| `pattern` | `string` | Date format pattern (e.g., "DD/MMM/YYYY") |
|
266
|
+
| `enableTime` | `boolean` | Enable time picker alongside date selection |
|
267
|
+
|
268
|
+
#### Select Input Properties
|
269
|
+
|
270
|
+
| Property | Type | Description |
|
271
|
+
|----------|------|-------------|
|
272
|
+
| `options` | `FormOptions` | Array of options or function returning options |
|
273
|
+
| `multiple` | `boolean` | Allow multiple selections |
|
274
|
+
| `interface` | `"popover" \| "action-sheet" \| "alert"` | How select options are displayed |
|
275
|
+
| `optionsPlacement` | `"top" \| "bottom"` | Position of popover options list |
|
276
|
+
|
277
|
+
#### RepeatInput Properties
|
278
|
+
|
279
|
+
| Property | Type | Description |
|
280
|
+
|----------|------|-------------|
|
281
|
+
| `children` | `FormSchema` | Schema for the repeatable field group |
|
111
282
|
|
112
283
|
### Form Events
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
284
|
+
|
285
|
+
| Event | Description | Signature |
|
286
|
+
|-------|-------------|-----------|
|
287
|
+
| `submit` | Emitted when the form is submitted successfully after validation | `(formData: FormData, computedFormData: ComputedData) => void` |
|
288
|
+
| `clear` | Emitted when the form fields are cleared to their initial state | `() => void` |
|
289
|
+
| `cancel` | Emitted when the form submission is canceled, resetting fields | `() => void` |
|
290
|
+
|
291
|
+
### Form Methods
|
292
|
+
|
293
|
+
When accessing the VForm via a template ref, you can utilize these methods:
|
294
|
+
|
295
|
+
| Method | Description | Return Type |
|
296
|
+
|--------|-------------|-------------|
|
297
|
+
| `resetForm()` | Resets all form fields to their initial state | `void` |
|
298
|
+
| `isFormValid()` | Validates all form fields and returns validation state | `Promise<boolean>` |
|
299
|
+
| `resolveData()` | Returns the current form data and computed data | `{ formData: FormData, computedData: ComputedData }` |
|
300
|
+
|
301
|
+
### Advanced Components
|
302
|
+
|
303
|
+
#### SelectInput
|
304
|
+
The SelectInput component provides various display modes for selection options:
|
305
|
+
|
306
|
+
- **Popover Interface**: Default presentation that displays options in a dropdown.
|
307
|
+
```js
|
308
|
+
{
|
309
|
+
type: 'SelectInput',
|
310
|
+
label: 'Choose an option',
|
311
|
+
interface: 'popover', // default
|
312
|
+
optionsPlacement: 'bottom', // 'top' or 'bottom'
|
313
|
+
options: [...]
|
314
|
+
}
|
315
|
+
```
|
316
|
+
|
317
|
+
- **Action Sheet Interface**: Opens a sheet from the bottom of the screen with options.
|
318
|
+
```js
|
319
|
+
{
|
320
|
+
type: 'SelectInput',
|
321
|
+
label: 'Choose an option',
|
322
|
+
interface: 'action-sheet',
|
323
|
+
options: [...]
|
324
|
+
}
|
325
|
+
```
|
326
|
+
|
327
|
+
- **Alert Interface**: Displays options in a modal dialog.
|
328
|
+
```js
|
329
|
+
{
|
330
|
+
type: 'SelectInput',
|
331
|
+
label: 'Choose an option',
|
332
|
+
interface: 'alert',
|
333
|
+
options: [...]
|
334
|
+
}
|
335
|
+
```
|
336
|
+
|
337
|
+
#### Custom Buttons
|
338
|
+
You can add custom action buttons to the form with the `customButtons` prop:
|
339
|
+
|
340
|
+
```js
|
341
|
+
const customButtons = [
|
342
|
+
{
|
343
|
+
label: 'Save Draft',
|
344
|
+
icon: 'save',
|
345
|
+
fill: 'outline',
|
346
|
+
color: 'secondary',
|
347
|
+
action: () => saveDraft()
|
348
|
+
}
|
349
|
+
];
|
350
|
+
```
|
351
|
+
|
352
|
+
#### RepeatInput
|
353
|
+
The RepeatInput component allows for creating repeatable groups of fields:
|
354
|
+
|
355
|
+
```js
|
356
|
+
{
|
357
|
+
type: 'RepeatInput',
|
358
|
+
label: 'Add Items',
|
359
|
+
children: {
|
360
|
+
name: {
|
361
|
+
type: 'TextInput',
|
362
|
+
label: 'Item Name',
|
363
|
+
required: true
|
364
|
+
},
|
365
|
+
quantity: {
|
366
|
+
type: 'NumberInput',
|
367
|
+
label: 'Quantity',
|
368
|
+
required: true
|
369
|
+
}
|
370
|
+
}
|
371
|
+
}
|
372
|
+
```
|
373
|
+
|
374
|
+
Each repeated set includes add and remove buttons, allowing the user to dynamically create or delete instances of the field group.
|
375
|
+
|
376
|
+
#### Option Descriptions
|
377
|
+
When using SelectInput or CheckboxInput, you can add descriptions to options:
|
378
|
+
|
379
|
+
```js
|
380
|
+
{
|
381
|
+
type: 'SelectInput',
|
382
|
+
label: 'Subscription Plan',
|
383
|
+
options: [
|
384
|
+
{
|
385
|
+
label: 'Basic',
|
386
|
+
value: 'basic',
|
387
|
+
description: {
|
388
|
+
text: 'Free plan with limited features',
|
389
|
+
color: 'secondary', // 'primary', 'warning', 'danger', 'secondary', 'light'
|
390
|
+
show: 'always' // or 'onChecked' to show only when selected
|
391
|
+
}
|
392
|
+
},
|
393
|
+
{
|
394
|
+
label: 'Premium',
|
395
|
+
value: 'premium',
|
396
|
+
description: {
|
397
|
+
text: 'Full access to all features',
|
398
|
+
color: 'primary',
|
399
|
+
show: 'always'
|
400
|
+
}
|
401
|
+
}
|
402
|
+
]
|
403
|
+
}
|
404
|
+
```
|
405
|
+
|
406
|
+
#### Date Pattern Formatting
|
407
|
+
The DateInput component supports various date pattern formats:
|
408
|
+
|
409
|
+
| Pattern | Description | Example |
|
410
|
+
|---------|-------------|---------|
|
411
|
+
| DD | Day of the month, two digits with leading zeros | 01 to 31 |
|
412
|
+
| D | Day of the month without leading zeros | 1 to 31 |
|
413
|
+
| MMM | Month name, abbreviated | Jan, Feb, Mar, etc. |
|
414
|
+
| MMMM | Month name, full | January, February, etc. |
|
415
|
+
| MM | Month as a number, with leading zeros | 01 to 12 |
|
416
|
+
| M | Month as a number, without leading zeros | 1 to 12 |
|
417
|
+
| YYYY | Year, four digits | 2025 |
|
418
|
+
| YY | Year, two digits | 25 |
|
419
|
+
| HH | Hour, two digits with leading zeros (24-hour) | 00 to 23 |
|
420
|
+
| mm | Minutes, two digits with leading zeros | 00 to 59 |
|
421
|
+
| ss | Seconds, two digits with leading zeros | 00 to 59 |
|
422
|
+
|
423
|
+
Example: `DD/MMM/YYYY HH:mm:ss` would format as `07/Jun/2025 14:30:00`
|
119
424
|
|
120
425
|
### Form Props
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
426
|
+
|
427
|
+
| Property | Type | Description | Default |
|
428
|
+
|----------|------|-------------|---------|
|
429
|
+
| `schema` | `FormSchema` | The schema object defining the form structure and field configurations | *Required* |
|
430
|
+
| `showLabels` | `boolean` | Determines if labels are displayed for each field | `true` |
|
431
|
+
| `showClearButton` | `boolean` | Controls the visibility of the clear/reset button | `true` |
|
432
|
+
| `showCancelButton` | `boolean` | Controls the visibility of the cancel button | `true` |
|
433
|
+
| `buttonPlacement` | `'start' \| 'middle' \| 'end'` | Specifies the alignment of action buttons within the form | `'start'` |
|
434
|
+
| `submitButtonText` | `string` | Custom text for the submit button | `"Submit"` |
|
435
|
+
| `clearButtonText` | `string` | Custom text for the clear/reset button | `"Reset"` |
|
436
|
+
| `cancelButtonText` | `string` | Custom text for the cancel button | `"Cancel"` |
|
437
|
+
| `hideButtons` | `boolean` | When true, hides all action buttons | `false` |
|
438
|
+
| `customButtons` | `Array<CustomButton>` | Array of custom buttons to add to the form | `[]` |
|
129
439
|
|
130
440
|
## Issue Reporting and Feedback
|
131
441
|
If you encounter any issues or have suggestions for improvements, please feel free to report them on the [GitHub Issues page](https://github.com/uniquedj95/vform/issues). Your feedback is invaluable in helping us enhance this project.
|
@@ -139,3 +449,38 @@ I welcome contributions from the community! If you'd like to contribute, please
|
|
139
449
|
|
140
450
|
Thank you to all the [contributors](https://github.com/uniquedj95/vform/graphs/contributors) who have helped make vForm better!
|
141
451
|
|
452
|
+
## TypeScript Support
|
453
|
+
|
454
|
+
vForm is built with TypeScript and provides complete type definitions for all components and interfaces. Import the types to get full IntelliSense support in your IDE:
|
455
|
+
|
456
|
+
```typescript
|
457
|
+
import {
|
458
|
+
FormSchema,
|
459
|
+
FormData,
|
460
|
+
ComputedData,
|
461
|
+
FormField,
|
462
|
+
Option,
|
463
|
+
InputType,
|
464
|
+
FormValidator,
|
465
|
+
ComputedValueHandler,
|
466
|
+
FormOptions,
|
467
|
+
GridSize,
|
468
|
+
CustomButton
|
469
|
+
} from "@uniquedj95/vform";
|
470
|
+
```
|
471
|
+
|
472
|
+
When defining your form schema, you can use these types for proper type checking:
|
473
|
+
|
474
|
+
```typescript
|
475
|
+
import { reactive } from "vue";
|
476
|
+
import { FormSchema } from "@uniquedj95/vform";
|
477
|
+
|
478
|
+
const myFormSchema = reactive<FormSchema>({
|
479
|
+
// Your form fields here with proper type checking
|
480
|
+
});
|
481
|
+
```
|
482
|
+
|
483
|
+
## License
|
484
|
+
|
485
|
+
vForm is licensed under the MIT License. See the LICENSE file for more information.
|
486
|
+
|
@@ -1,28 +1,31 @@
|
|
1
|
-
import { FormSchema, BaseFieldTypes } from 'types';
|
2
|
-
|
3
|
-
|
1
|
+
import { FormField, FormSchema, BaseFieldTypes } from 'types';
|
2
|
+
type __VLS_Props = {
|
3
|
+
schema?: FormSchema;
|
4
|
+
type?: BaseFieldTypes;
|
5
|
+
};
|
6
|
+
declare const model: import('vue').ModelRef<FormField, string, FormField, FormField>;
|
4
7
|
declare function onReset(): void;
|
5
8
|
declare function onValueUpdate(): Promise<void>;
|
6
|
-
|
7
|
-
modelValue
|
8
|
-
|
9
|
-
|
10
|
-
};
|
11
|
-
type: {
|
12
|
-
type: PropType<BaseFieldTypes>;
|
13
|
-
};
|
14
|
-
}>, {
|
9
|
+
type __VLS_PublicProps = {
|
10
|
+
modelValue?: typeof model['value'];
|
11
|
+
} & __VLS_Props;
|
12
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
15
13
|
onValueUpdate: typeof onValueUpdate;
|
16
14
|
onReset: typeof onReset;
|
17
15
|
getErrors: () => string | undefined;
|
18
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
19
|
-
modelValue:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
17
|
+
"update:modelValue": (value: FormField) => any;
|
18
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
19
|
+
"onUpdate:modelValue"?: ((value: FormField) => any) | undefined;
|
20
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
21
|
+
inputRef: import('vue').CreateComponentPublicInstanceWithMixins<import("@ionic/core").JSX.IonInput & import('@stencil/vue-output-target/runtime').InputProps<string | number | null | undefined> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, {}, {}, string, {}, any, import('vue').ComponentProvideOptions, {
|
22
|
+
P: {};
|
23
|
+
B: {};
|
24
|
+
D: {};
|
25
|
+
C: {};
|
26
|
+
M: {};
|
27
|
+
Defaults: {};
|
28
|
+
}, import("@ionic/core").JSX.IonInput & import('@stencil/vue-output-target/runtime').InputProps<string | number | null | undefined> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, {}, {}, {}, {}, {}> | null;
|
29
|
+
}, any>;
|
27
30
|
export default _default;
|
28
31
|
//# sourceMappingURL=BaseInput.vue.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"BaseInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/BaseInput.vue"],"names":[],"mappings":"AAgCA;
|
1
|
+
{"version":3,"file":"BaseInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/BaseInput.vue"],"names":[],"mappings":"AAgCA;AAgGA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG9D,KAAK,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,UAAU,CAAC;IAAC,IAAI,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC;AAElE,QAAA,MAAM,KAAK,iEAAoE,CAAC;AAMhF,iBAAS,OAAO,SAIf;AAiBD,iBAAe,aAAa,kBAa3B;AAuBD,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;CAClC,GAAG,WAAW,CAAC;;;;;;;;;;;;;;;;;;;AA8KhB,wBAUG"}
|
@@ -1,22 +1,30 @@
|
|
1
|
-
import { FormSchema } from 'types';
|
2
|
-
|
3
|
-
|
1
|
+
import { FormField, FormSchema } from 'types';
|
2
|
+
type __VLS_Props = {
|
3
|
+
schema?: FormSchema;
|
4
|
+
};
|
5
|
+
declare const model: import('vue').ModelRef<FormField, string, FormField, FormField>;
|
4
6
|
declare function onReset(): void;
|
5
7
|
declare function onValueUpdate(): Promise<void>;
|
6
|
-
|
7
|
-
modelValue
|
8
|
-
|
9
|
-
|
10
|
-
};
|
11
|
-
}>, {
|
8
|
+
type __VLS_PublicProps = {
|
9
|
+
modelValue?: typeof model['value'];
|
10
|
+
} & __VLS_Props;
|
11
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
|
12
12
|
onValueUpdate: typeof onValueUpdate;
|
13
13
|
onReset: typeof onReset;
|
14
14
|
getErrors: () => string | undefined;
|
15
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
16
|
-
modelValue:
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
16
|
+
"update:modelValue": (value: FormField) => any;
|
17
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
18
|
+
"onUpdate:modelValue"?: ((value: FormField) => any) | undefined;
|
19
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
20
|
+
inputRef: import('vue').CreateComponentPublicInstanceWithMixins<import("@ionic/core").JSX.IonCheckbox & import('@stencil/vue-output-target/runtime').InputProps<boolean | undefined> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, false, {}, {}, {}, {}, string, {}, any, import('vue').ComponentProvideOptions, {
|
21
|
+
P: {};
|
22
|
+
B: {};
|
23
|
+
D: {};
|
24
|
+
C: {};
|
25
|
+
M: {};
|
26
|
+
Defaults: {};
|
27
|
+
}, import("@ionic/core").JSX.IonCheckbox & import('@stencil/vue-output-target/runtime').InputProps<boolean | undefined> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, {}, {}, {}, {}, {}> | null;
|
28
|
+
}, any>;
|
21
29
|
export default _default;
|
22
30
|
//# sourceMappingURL=CheckboxInput.vue.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CheckboxInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/CheckboxInput.vue"],"names":[],"mappings":"AAeA;
|
1
|
+
{"version":3,"file":"CheckboxInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/inputs/CheckboxInput.vue"],"names":[],"mappings":"AAeA;AA8EA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG9C,KAAK,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,UAAU,CAAC;CAAE,CAAC;AAE5C,QAAA,MAAM,KAAK,iEAAoE,CAAC;AAMhF,iBAAS,OAAO,SAIf;AAiBD,iBAAe,aAAa,kBAa3B;AAuBD,KAAK,iBAAiB,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC;CAClC,GAAG,WAAW,CAAC;;;;;;;;;;;;;;;;;;;AAgGhB,wBAUG"}
|