Skip to content

Commit cc63658

Browse files
authored
Merge pull request #31 from kevinkosterr/master
Update documentation
2 parents 3499619 + 4bc1341 commit cc63658

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A schema-based form generator component for Vue 3, based on the original
88
[![NPM Version](https://img.shields.io/npm/v/%40kevinkosterr%2Fvue3-form-generator?logo=npm)](https://www.npmjs.com/package/@kevinkosterr/vue3-form-generator)
99
[![GitHub License](https://img.shields.io/github/license/kevinkosterr/vue3-form-generator)](https://github.com/kevinkosterr/vue3-form-generator?tab=MIT-1-ov-file)
1010

11-
You can find documentation on the [documentation page](https://kevinkosterr.github.io/vue3-form-generator-docs).
11+
You can find documentation on the [documentation page](https://kevinkosterr.github.io/vue3-form-generator).
1212

1313
## Building for development
1414
1. Install the dependencies

apps/docs/guide/composables/useFieldProps.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const { field, model } = toRefs(props)
2222
Id of the field, computed based on the `idPrefix` set within the FormGenerator component and `name` property of the
2323
field.
2424

25-
### `formGenerator` <Badge type="info" text="Component"/>
26-
FormGenerator component.
25+
### `formOptions` <Badge type="info" text="Object"/>
26+
An object of global options for the current form.
2727

2828
### `field` <Badge type="info" text="Object"/> <Badge type="danger" text="required"/>
2929
Field object as set in the schema.

apps/docs/guide/composables/useFieldValidate.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,18 @@ Field schema object, as returned by the props
3030

3131
### `validate` <Badge type="info" text="Function"/>
3232
> Validates the field, existing fields typically use this in an `onBlur()`
33+
- Arguments:
34+
- `currentModelValue: any` - the current value of the field.
3335
- Returns: `Promise<string[]>` - an array of error messages, or empty array if no errors have been found.
3436
```javascript
35-
validate().then((validationErrors) => {
37+
validate(currentModelValue.value).then((validationErrors) => {
3638
//...
3739
})
3840
```
41+
42+
### `errors` <Badge type="info" text="string[]" />
43+
> An array of errors that have been found when validating the current value against all validators
44+
45+
::: warning
46+
If you want your component to work properly with validation, you'll have to expose this value.
47+
:::

apps/docs/guide/customization/custom-components.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ const onFieldValueChanged = ({ target }) => {
8585
### Advanced example
8686
For a more advanced example, you can take a look at the [`FieldSelect`](/guide/fields/FieldSelect) ([source](https://github.com/kevinkosterr/vue3-form-generator/blob/69cb6aeb8e8c82926ec3598e7d73be2d1146a3f2/src/fields/core/FieldSelect.vue)) component.
8787

88+
## Compatibility with validation
89+
::: info
90+
If you want your component to be compatible with validation, you'll need to expose the `errors` value that is returned
91+
by [`useFieldValidate`](/guide/composables/useFieldValidate)
92+
:::
93+
8894
## Registering your component
8995
To use your component inside the form generator, your component must be globally available throughout your app. You do this
9096
by simply registering it in your `main.js` file. Names <strong>must</strong> start with `Field`.

0 commit comments

Comments
 (0)