Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 20a8e80

Browse files
committed
Netlify Setup
1 parent bcb7d22 commit 20a8e80

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1296
-241
lines changed

README.md

Lines changed: 4 additions & 205 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ Implementing handcrafted forms can be:
1919
1. Costly
2020
2. Time-consuming
2121

22-
Specially if you need to create a very large form, in which the inputs are similar to each other, and they change frequently to meet rapidly changing business and regulatory requirements.
22+
Especially if you need to create a very large form, in which the inputs are similar to each other, and they change frequently to meet rapidly changing business and regulatory requirements.
2323

24-
So, will not be more economical to create the forms dynamically? Based on metadata that describes the business object model?
24+
So, wouldn't it be more economical to create the forms dynamically? Based on metadata that describes the business object model?
2525

2626
That's Vue Dynamic Forms.
2727

2828
## Documentation
2929

3030
Complete documentation and examples available at
3131

32-
- **[API Documentation]()** (soon)
32+
- **[Documentation]()**
3333
- **[Sandbox Demo](https://codesandbox.io/s/vue-dynamic-forms-ftzes)**
3434

3535
## Installation
@@ -74,207 +74,6 @@ export {
7474
}
7575
```
7676

77-
### Form Composition
78-
79-
The dynamic form component is really easy to use, you will only need to add it to your template like this:
80-
81-
```html
82-
<template>
83-
<dynamic-form :id="testForm.id" :fields="testForm.fields" />
84-
<button type="submit" :form="testForm.id">Submit</button>
85-
</template>
86-
```
87-
88-
And then create the fields on your component's data structure, to create the fields you can import the factory function `FormField` from the library core:
89-
90-
```js
91-
import { FormField } from '@asigloo/vue-dynamic-forms';
92-
93-
const yourAwesomeComponent = {
94-
name: 'your-awesome',
95-
data() {
96-
return {
97-
testForm: {
98-
id: 'test-form',
99-
fields: [
100-
new FormField({
101-
type: 'text',
102-
label: 'Name',
103-
name: 'name',
104-
}),
105-
new FormField({
106-
type: 'email',
107-
label: 'Email',
108-
name: 'email',
109-
}),
110-
],
111-
},
112-
};
113-
},
114-
};
115-
116-
export default yourAwesomeComponent;
117-
```
118-
119-
Each `FormField` has a set of properties to customize your input field:
120-
121-
| Property | Type | Default | Description |
122-
| :---------- | :--------------- | :------ | :----------------------------------------------------------------------------------------------------- |
123-
| type | String | text | Define the nature of the field, can be `text|email|url|password|number|radio|checkbox|textarea|select` |
124-
| label | String | null | Defines the text in the input label |
125-
| placeholder | String | null | Defines short hint that describes the expected value of an input field |
126-
| name | String | null | Name property for the field inside of the form data |
127-
| value | any | null | Initial value of the input field |
128-
| disabled | Boolean | false | Whenever the input field is disabled or not |
129-
| customClass | String | null | Allows the user to set custom classes to the input for styling purpouses |
130-
| options | Array of Objects | [] | Options for input type `select` |
131-
| inline | Boolean | false | Specifies if options for `radio|checkbox` should be inline |
132-
| validations | Array of Objects | [] | Array of `FormValidation` objects, specify validations and messages for the input |
133-
134-
### Events and Submit
135-
136-
| Event | Type | Emitter | Description |
137-
| :----------- | :--- | :------------ | :----------------------------------------------------------------------------------------------------------------------------- |
138-
| `submit` | | `DynamicForm` | Emits whenever the submit button has been clicked and the form is valid (no errors), returns all the form values in an Object |
139-
| `form-error` | | `DynamicForm` | Emits whenever the submit button has been clicked and the form is invalid (with errors), returns all errors |
140-
| `change` | | `DynamicForm` | Emits every time there is a value changed on the form, returns all the form values in an Object without the need ob submitting |
141-
142-
A small example of a form without submit button
143-
144-
```html
145-
<template>
146-
<dynamic-form
147-
:id="testForm.id"
148-
:fields="testForm.fields"
149-
@change="valuesChanged"
150-
/>
151-
</template>
152-
```
153-
154-
```js
155-
...
156-
const yourAwesomeComponent = {
157-
name: 'your-awesome',
158-
methods: {
159-
valuesChanged(values) {
160-
this.formData = {
161-
...this.formData,
162-
...values,
163-
};
164-
},
165-
}
166-
}
167-
...
168-
```
169-
170-
### Select input
171-
172-
```js
173-
...
174-
new FormField({
175-
type: 'select',
176-
label: 'Category',
177-
name: 'category',
178-
options: [
179-
{ value: null, text: 'Please select an option' },
180-
{ value: 'arduino', text: 'Arduino' },
181-
{ value: 'transistors', text: 'Transistors' },
182-
],
183-
}),
184-
...
185-
```
186-
187-
### Radio and Checkboxes
188-
189-
```js
190-
...
191-
new FormField({
192-
type: 'checkbox',
193-
label: 'Read the conditions',
194-
name: 'conditions',
195-
inline: false,
196-
}),
197-
new FormField({
198-
type: 'radio',
199-
label: 'Prefered Animal',
200-
name: 'animal',
201-
inline: true,
202-
options: [
203-
{ text: 'Dogs', value: 'dogs' },
204-
{ text: 'Cats', value: 'cats' },
205-
{ text: 'Others', value: 'others' },
206-
],
207-
}),
208-
...
209-
```
210-
211-
### Validation
212-
213-
This library offers a simple validation system using the property `validations` as an array of `FormValidation`objects containing the validation function and the text in case of error.
214-
215-
To use it you need the following code:
216-
217-
```js
218-
import {
219-
FormField,
220-
FormValidation,
221-
required,
222-
email,
223-
pattern,
224-
} from '@asigloo/vue-dynamic-forms';
225-
226-
const yourAwesomeComponent = {
227-
name: 'your-awesome',
228-
data() {
229-
return {
230-
testForm: {
231-
id: 'test-form',
232-
fields: [
233-
new FormField({
234-
type: 'text',
235-
label: 'Name',
236-
name: 'name',
237-
}),
238-
new FormField({
239-
type: 'email',
240-
label: 'Email',
241-
name: 'email',
242-
validations: [
243-
new FormValidation(required, 'This field is required'),
244-
new FormValidation(email, 'Format of email is incorrect'),
245-
],
246-
}),
247-
new FormField({
248-
type: 'password',
249-
label: 'Password',
250-
name: 'password',
251-
validations: [
252-
new FormValidation(required, 'This field is required'),
253-
new FormValidation(
254-
pattern(
255-
'^(?=.*[a-z])(?=.*[A-Z])(?=.*d)(?=.*[#$^+=!*()@%&]).{8,10}$',
256-
),
257-
'Password must contain at least 1 Uppercase, 1 Lowercase, 1 number, 1 special character and min 8 characters max 10',
258-
),
259-
],
260-
}),
261-
],
262-
},
263-
};
264-
},
265-
};
266-
267-
export default yourAwesomeComponent;
268-
```
269-
270-
### Styling themes
271-
272-
The components are unstyled by default, so you can customize them with your own styles. If you want a more "ready to go" solution you can import on of the themes we have included in `src/styles/themes/`
273-
274-
```scss
275-
@import '~@asigloo/vue-dynamic-forms/src/styles/themes/default.scss';
276-
```
277-
27877
## Development
27978

28079
### Project setup
@@ -325,7 +124,7 @@ This are the features I have planned for next versions of this library
325124
- [ ] Form Mixins for fields manipulation (for example, change values of a field depending of other)
326125
- [ ] More complex input types.
327126
- [ ] Nuxt plugin istall
328-
- [ ] Better docs & online examples
127+
- [x] Better docs & online examples
329128
- [ ] Storybook
330129

331130
## License

docs/.vuepress/components/FormComposition.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="form-composition library-example">
3-
<div class="col">
3+
<div class="col" v-if="testForm">
44
<dynamic-form
55
:id="testForm.id"
66
:fields="testForm.fields"

docs/.vuepress/components/ValidationEmail.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export default {
4242
name: 'email',
4343
value: 'awesome_avocad',
4444
validations: [
45-
new FormValidation(required, 'This field is required'),
4645
new FormValidation(email, 'Format of email is incorrect'),
4746
],
4847
}),

docs/.vuepress/components/ValidationPattern.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export default {
4242
name: 'password',
4343
customClass: 'col-12',
4444
validations: [
45-
new FormValidation(required, 'This field is required'),
4645
new FormValidation(
4746
pattern(
4847
'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[#$^+=!*()@%&]).{8,10}$',

docs/.vuepress/dist/404.html

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,36 @@
66
<title>Vue Dynamic Forms</title>
77
<meta name="generator" content="VuePress 1.5.0">
88
<link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:400,600|Roboto Mono" rel="stylesheet" type="text/css">
9-
<link href="//fonts.googleapis.com/css?family=Dosis:300&amp;amp;text=Vue Select" rel="stylesheet" type="text/css">
10-
<link rel="icon" href="/vue-logo.png">
11-
<link rel="apple-touch-icon" href="/icons/apple-touch-icon-152x152.png">
9+
<link href="//fonts.googleapis.com/css?family=Dosis:300&amp;amp;text=Vue Dynamic Forms" rel="stylesheet" type="text/css">
10+
<link rel="icon" href="/icons/favicon.ico">
11+
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
12+
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
13+
<link rel="shortcut icon" href="/icons/favicon.ico">
14+
<link rel="apple-touch-icon" href="/vue-dynamic-forms">
1215
<link rel="mask-icon" href="/icons/safari-pinned-tab.svg" color="#3eaf7c">
13-
<link rel="icon" href="/vue-logo.png" type="image/png">
16+
<link rel="icon" href="/vue-dynamic-forms.png" type="image/png">
1417
<meta name="description" content="Easy way to dynamically create reactive forms in vue based on varying business object model.">
1518
<meta name="theme-color" content="#3eaf7c">
1619
<meta name="apple-mobile-web-app-capable" content="yes">
1720
<meta name="apple-mobile-web-app-status-bar-style" content="black">
1821
<meta name="msapplication-TileImage" content="/icons/msapplication-icon-144x144.png">
1922
<meta name="msapplication-TileColor" content="#000000">
2023
<meta name="title" content="Vue Dynamic Forms">
21-
<meta property="og:image" content="/vue-logo.png">
22-
<meta property="twitter:image" content="/vue-logo.png">
24+
<meta property="og:image" content="/vue-dynamic-forms.png">
25+
<meta property="twitter:image" content="/vue-dynamic-forms.png">
2326
<meta property="og:description" content="">
2427
<meta property="twitter:description" content="Easy way to dynamically create reactive forms in vue based on varying business object model.">
2528
<meta property="twitter:title" content="Vue Dynamic Forms">
2629
<meta property="og:title" content="Vue Dynamic Forms">
2730
<meta property="og:site_name" content="Vue Dynamic Forms">
2831
<meta property="og:url">
29-
<link rel="preload" href="/assets/css/0.styles.5c99f2ec.css" as="style"><link rel="preload" href="/assets/js/app.9c35df7d.js" as="script"><link rel="preload" href="/assets/js/6.cccf78d7.js" as="script"><link rel="prefetch" href="/assets/js/2.9706a1f4.js"><link rel="prefetch" href="/assets/js/3.bc8bd3d2.js"><link rel="prefetch" href="/assets/js/4.82a7bd4f.js"><link rel="prefetch" href="/assets/js/5.48162858.js"><link rel="prefetch" href="/assets/js/7.1cc6bb03.js"><link rel="prefetch" href="/assets/js/8.9b566101.js">
30-
<link rel="stylesheet" href="/assets/css/0.styles.5c99f2ec.css">
32+
<link rel="preload" href="/assets/css/0.styles.65c0f685.css" as="style"><link rel="preload" href="/assets/js/app.bf37675b.js" as="script"><link rel="preload" href="/assets/js/24.9caaa38f.js" as="script"><link rel="prefetch" href="/assets/js/1.7e7c5c5d.js"><link rel="prefetch" href="/assets/js/10.6ee16cde.js"><link rel="prefetch" href="/assets/js/11.c17b2003.js"><link rel="prefetch" href="/assets/js/12.aa251189.js"><link rel="prefetch" href="/assets/js/13.a654d9df.js"><link rel="prefetch" href="/assets/js/14.0d171d16.js"><link rel="prefetch" href="/assets/js/15.80d5cf4e.js"><link rel="prefetch" href="/assets/js/16.ff243276.js"><link rel="prefetch" href="/assets/js/17.87bcdf80.js"><link rel="prefetch" href="/assets/js/18.bbcc2320.js"><link rel="prefetch" href="/assets/js/19.8d40da97.js"><link rel="prefetch" href="/assets/js/20.9c439f6c.js"><link rel="prefetch" href="/assets/js/21.e4840386.js"><link rel="prefetch" href="/assets/js/22.5796a33a.js"><link rel="prefetch" href="/assets/js/23.2275762d.js"><link rel="prefetch" href="/assets/js/25.a9e27a1c.js"><link rel="prefetch" href="/assets/js/26.04e81dc0.js"><link rel="prefetch" href="/assets/js/27.d18cdf7f.js"><link rel="prefetch" href="/assets/js/28.24a44d62.js"><link rel="prefetch" href="/assets/js/29.091badae.js"><link rel="prefetch" href="/assets/js/3.33436937.js"><link rel="prefetch" href="/assets/js/30.7cdf6fd4.js"><link rel="prefetch" href="/assets/js/31.f613f73d.js"><link rel="prefetch" href="/assets/js/32.742a15c1.js"><link rel="prefetch" href="/assets/js/33.67e354ba.js"><link rel="prefetch" href="/assets/js/34.50e93ebd.js"><link rel="prefetch" href="/assets/js/35.54a4af41.js"><link rel="prefetch" href="/assets/js/4.87658e33.js"><link rel="prefetch" href="/assets/js/5.fe875d58.js"><link rel="prefetch" href="/assets/js/6.ccd44ceb.js"><link rel="prefetch" href="/assets/js/7.2030d87f.js"><link rel="prefetch" href="/assets/js/8.fc2f3241.js"><link rel="prefetch" href="/assets/js/9.a5c0609b.js">
33+
<link rel="stylesheet" href="/assets/css/0.styles.65c0f685.css">
3134
</head>
3235
<body>
33-
<div id="app" data-server-rendered="true"><div class="theme-container"><div class="theme-default-content"><h1>404</h1> <blockquote>That's a Four-Oh-Four.</blockquote> <a href="/" class="router-link-active">
36+
<div id="app" data-server-rendered="true"><div class="theme-container"><div class="theme-default-content"><h1>404</h1> <blockquote>There's nothing here.</blockquote> <a href="/" class="router-link-active">
3437
Take me home.
3538
</a></div></div><div class="global-ui"></div></div>
36-
<script src="/assets/js/app.9c35df7d.js" defer></script><script src="/assets/js/6.cccf78d7.js" defer></script>
39+
<script src="/assets/js/app.bf37675b.js" defer></script><script src="/assets/js/24.9caaa38f.js" defer></script>
3740
</body>
3841
</html>

docs/.vuepress/dist/assets/css/0.styles.5c99f2ec.css renamed to docs/.vuepress/dist/assets/css/0.styles.65c0f685.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/.vuepress/dist/assets/js/1.7e7c5c5d.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/.vuepress/dist/assets/js/10.6ee16cde.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/.vuepress/dist/assets/js/11.c17b2003.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/.vuepress/dist/assets/js/12.aa251189.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)