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

Commit 649767f

Browse files
authored
Merge pull request #275 from asigloo/feature/264-move-docs-inside-the-project
Feature/264 move docs inside the project
2 parents 6d257eb + c86ede6 commit 649767f

Some content is hidden

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

53 files changed

+35187
-1142
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
node_modules
33
**/node_modules
44
/dist
5-
/docs/.vuepress/dist
5+
/docs/.vitepress/dist
66
/coverage
77
/tests/e2e/videos/
88
/tests/e2e/screenshots/
99
/temp
10+
1011
# local env files
1112
.env.local
1213
.env.*.local

.prettierrc

-7
This file was deleted.

.prettierrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
...require('@asigloo/prettier-config')
3+
}

demos/vue-3/src/main.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { createApp } from 'vue';
2-
import App from './App.vue';
3-
import './styles/main.css';
4-
import router from './router';
1+
import { createApp } from 'vue'
2+
import App from './App.vue'
3+
import './styles/main.css'
4+
import router from './router'
55

6-
/* import { createDynamicForms } from '/@'; */
6+
import { createDynamicForms } from '/@'
77

8-
import { createDynamicForms } from '../../../dist/as-dynamic-forms.es';
8+
/* import { createDynamicForms } from '../../../dist/as-dynamic-forms.es'; */
99

1010
const VueDynamicForms = createDynamicForms({
1111
autoValidate: true,
@@ -15,12 +15,12 @@ const VueDynamicForms = createDynamicForms({
1515
netlify: false,
1616
netlifyHoneypot: null,
1717
},
18-
});
18+
})
1919

20-
export const app = createApp(App);
20+
export const app = createApp(App)
2121

22-
console.log({ app });
22+
console.log({ app })
2323

24-
app.use(VueDynamicForms);
24+
app.use(VueDynamicForms)
2525

26-
app.use(router).mount('#app');
26+
app.use(router).mount('#app')

docs/.vitepress/config.js

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/* import { UserConfig } from 'vitepress'
2+
*/
3+
const { description } = require('../../package')
4+
5+
const config = {
6+
title: 'Vue Dynamic Forms',
7+
description,
8+
lang: 'en-US',
9+
themeConfig: {
10+
repo: 'asigloo/vue-dynamic-forms',
11+
logo: '/logo.svg',
12+
editLinks: true,
13+
editLinkText: 'Edit this page',
14+
lastUpdated: 'Last Updated',
15+
nav: [
16+
{
17+
text: 'Migration Guide',
18+
link: '/v3/guide/migration-guide',
19+
},
20+
],
21+
sidebar: {
22+
'/': [
23+
{
24+
text: 'Guide',
25+
children: [
26+
{
27+
text: 'Introduction',
28+
link: '/guide/',
29+
},
30+
{
31+
text: 'Getting Started',
32+
link: '/guide/getting-started',
33+
},
34+
{
35+
text: 'Usage',
36+
link: '/guide/usage',
37+
},
38+
{
39+
text: 'Validation',
40+
link: '/guide/validation',
41+
},
42+
{
43+
text: 'Models',
44+
link: '/guide/models',
45+
},
46+
],
47+
},
48+
{
49+
text: 'API',
50+
children: [
51+
{
52+
text: 'Fields',
53+
link: '/guide/api/fields',
54+
},
55+
{
56+
text: 'Props',
57+
link: '/guide/api/props',
58+
children: [
59+
{
60+
text: 'Dynamic Form',
61+
link: '/guide/api/props/dynamic-form-props',
62+
},
63+
{
64+
text: 'Dynamic Input',
65+
link: '/guide/api/props/dynamic-input-props',
66+
},
67+
],
68+
},
69+
{
70+
text: 'Events',
71+
link: '/guide/api/events',
72+
},
73+
],
74+
},
75+
{
76+
text: 'Theming',
77+
children: [
78+
{
79+
text: 'Basic theming',
80+
link: '/guide/theming/basic',
81+
},
82+
],
83+
},
84+
{
85+
text: 'Advanced',
86+
children: [
87+
{
88+
text: 'Slots',
89+
link: '/guide/advanced/slots',
90+
},
91+
],
92+
},
93+
],
94+
},
95+
},
96+
}
97+
98+
module.exports = config

docs/.vitepress/dist/logo.png

8.44 KB
Loading

docs/.vitepress/dist/logo.svg

+1
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<template>
2+
<div
3+
class="
4+
w-full
5+
flex
6+
justify-between
7+
container
8+
bg-white
9+
shadow-lg
10+
p-4
11+
rounded-lg
12+
my-8
13+
"
14+
>
15+
<div class="w-1/2">
16+
<dynamic-form :form="form" @change="updateValues" />
17+
</div>
18+
<div class="w-2/5 p-4">
19+
<Console :content="formValues" />
20+
</div>
21+
</div>
22+
</template>
23+
24+
<script lang="ts">
25+
import { reactive } from 'vue'
26+
import { CheckboxField, Validator, required, DynamicForm } from '/@'
27+
28+
export default {
29+
name: 'CheckboxField',
30+
setup() {
31+
const formValues = reactive({})
32+
33+
const form = reactive<DynamicForm>({
34+
id: 'my-awesome-form',
35+
fields: {
36+
awesomeness: CheckboxField({
37+
label: "Check if you're awesome",
38+
}),
39+
required: CheckboxField({
40+
label: 'Required',
41+
customClass: 'w-1/2',
42+
validations: [
43+
Validator({
44+
validator: required,
45+
text: 'This field is required',
46+
}),
47+
],
48+
}),
49+
disabled: CheckboxField({
50+
label: 'Disabled',
51+
customClass: 'w-1/2',
52+
disabled: true,
53+
}),
54+
},
55+
})
56+
57+
function updateValues(values) {
58+
Object.assign(formValues, values)
59+
}
60+
61+
return {
62+
form,
63+
updateValues,
64+
formValues,
65+
}
66+
},
67+
}
68+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<template>
2+
<div class="console bg-marine text-white text-xs p-2 rounded-md relative">
3+
<ul class="absolute top-0 pl-2 mt-0 left-0">
4+
<li class="rounded w-2 h-2 bg-salmon inline-block mr-1"></li>
5+
<li class="rounded w-2 h-2 bg-yellow-300 inline-block mr-1"></li>
6+
<li class="rounded w-2 h-2 bg-green-500 inline-block"></li>
7+
</ul>
8+
<pre data-cy="form-values" class="pt-4" :data-formValues="jsonValues">{{
9+
content
10+
}}</pre>
11+
</div>
12+
</template>
13+
14+
<script lang="ts">
15+
import { computed, defineComponent } from 'vue'
16+
17+
const props = {
18+
content: String,
19+
}
20+
21+
export default defineComponent({
22+
name: 'console',
23+
props,
24+
setup(props) {
25+
const jsonValues = computed(() => JSON.stringify(props.content))
26+
return {
27+
jsonValues,
28+
}
29+
},
30+
})
31+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<template>
2+
<div
3+
class="
4+
w-full
5+
flex
6+
justify-between
7+
container
8+
bg-white
9+
shadow-lg
10+
p-4
11+
rounded-lg
12+
my-8
13+
"
14+
>
15+
<div class="w-1/2">
16+
<dynamic-form :form="form" @change="updateValues">
17+
<template v-slot:avocado="{ control, onChange, onFocus, onBlur }">
18+
<div class="avocado-field">
19+
<input
20+
:id="control.name"
21+
v-if="control"
22+
class="form-control"
23+
v-model="control.value"
24+
:type="control.type"
25+
:name="control.name"
26+
@change="onChange"
27+
@focus="onFocus"
28+
@blur="onBlur"
29+
/>
30+
<i>🥑</i>
31+
</div>
32+
</template>
33+
</dynamic-form>
34+
</div>
35+
<div class="w-2/5 p-4">
36+
<Console :content="formValues" />
37+
</div>
38+
</div>
39+
</template>
40+
41+
<script lang="ts">
42+
import { reactive } from 'vue'
43+
import { CustomField, DynamicForm } from '/@'
44+
45+
export default {
46+
name: 'CustomField',
47+
setup() {
48+
const formValues = reactive({})
49+
50+
const form = reactive<DynamicForm>({
51+
id: 'my-awesome-form',
52+
fields: {
53+
avocado: CustomField({
54+
label: 'My Avocado field',
55+
}),
56+
},
57+
})
58+
59+
function updateValues(values) {
60+
Object.assign(formValues, values)
61+
}
62+
63+
return {
64+
form,
65+
updateValues,
66+
formValues,
67+
}
68+
},
69+
}
70+
</script>
71+
72+
<style lang="scss">
73+
.avocado-field {
74+
position: relative;
75+
76+
.form-control {
77+
border-color: #aec64c;
78+
background-color: #e2eb5d52;
79+
border-radius: 16px;
80+
width: 100%;
81+
}
82+
i {
83+
position: absolute;
84+
top: 7px;
85+
right: 20px;
86+
}
87+
}
88+
</style>

0 commit comments

Comments
 (0)