Skip to content

Commit 88f2c8e

Browse files
authored
Vuejs container updates (#45)
* update package version * create base vue package and update packages dependency * add vue package to pipelines * make sure plugins can be loaded into the vue component * fix linter and format code
1 parent f8fff61 commit 88f2c8e

File tree

11 files changed

+67
-49
lines changed

11 files changed

+67
-49
lines changed

.github/workflows/ci.yml

+13
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,16 @@ jobs:
9898
- name: Build tabs package
9999
working-directory: ./packages/tabs
100100
run: npm run build
101+
102+
#vue
103+
- name: Install tabs dependencies
104+
working-directory: ./packages/vue
105+
run: npm install
106+
107+
- name: Lint tabs package
108+
working-directory: ./packages/vue
109+
run: npm run lint
110+
111+
- name: Build tabs package
112+
working-directory: ./packages/vue
113+
run: npm run build

packages/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@forms.js/core",
3-
"version": "1.0.20",
3+
"version": "1.0.21",
44
"description": "Javascript form generator that streamlines web forms",
55
"module": "lib/index.js",
66
"type": "module",

packages/daterange/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"typescript": "^5.1.6"
5252
},
5353
"dependencies": {
54-
"@forms.js/core": "^1.0.20",
54+
"@forms.js/core": "^1.0.21",
5555
"filepond": "^4.30.4",
5656
"flatpickr": "^4.6.13",
5757
"install": "^0.13.0",

packages/list-field/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"typescript": "^5.1.6"
5252
},
5353
"dependencies": {
54-
"@forms.js/core": "^1.0.20",
54+
"@forms.js/core": "^1.0.21",
5555
"filepond": "^4.30.4",
5656
"flatpickr": "^4.6.13",
5757
"install": "^0.13.0",

packages/rating/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"typescript": "^5.1.6"
5252
},
5353
"dependencies": {
54-
"@forms.js/core": "^1.0.20",
54+
"@forms.js/core": "^1.0.21",
5555
"filepond": "^4.30.4",
5656
"flatpickr": "^4.6.13",
5757
"install": "^0.13.0",

packages/ritchtext/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"typescript": "^5.1.6"
5151
},
5252
"dependencies": {
53-
"@forms.js/core": "^1.0.20",
53+
"@forms.js/core": "^1.0.21",
5454
"filepond": "^4.30.4",
5555
"flatpickr": "^4.6.13",
5656
"install": "^0.13.0",

packages/tabs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"typescript": "^5.1.6"
5252
},
5353
"dependencies": {
54-
"@forms.js/core": "^1.0.20",
54+
"@forms.js/core": "^1.0.21",
5555
"filepond": "^4.30.4",
5656
"flatpickr": "^4.6.13",
5757
"install": "^0.13.0",

packages/vue/package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vue/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"typescript": "^5.1.6"
5252
},
5353
"dependencies": {
54-
"@forms.js/core": "^1.0.20",
54+
"@forms.js/core": "^1.0.21",
5555
"install": "^0.13.0",
5656
"npm": "^10.1.0",
5757
"vue": "^3.4.18"

packages/vue/src/form.ts

+41-38
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,49 @@ import { Form as FormConstructor, PluginSettings, usePlugin } from '@forms.js/co
33
import { PropType, defineComponent, h } from 'vue';
44

55
const Form = defineComponent({
6-
props: {
7-
options: {
8-
type: Object as PropType<FormOptions>,
9-
required: true
10-
}
6+
props: {
7+
options: {
8+
type: Object as PropType<FormOptions>,
9+
required: true,
1110
},
12-
13-
data() {
14-
return {
15-
formInstance: null as FormConstructor | null
16-
}
11+
plugins: {
12+
type: Array as PropType<PluginSettings[]> | object as PropType<PluginSettings>,
13+
default: [],
14+
required: false,
1715
},
16+
},
1817

19-
methods: {
20-
getForm(): FormConstructor | null {
21-
return this.formInstance as FormConstructor | null;
22-
},
23-
usePlugin(pluginSettings: PluginSettings | PluginSettings[]) {
24-
usePlugin(pluginSettings);
25-
}
26-
},
18+
data() {
19+
return {
20+
formInstance: null as FormConstructor | null,
21+
};
22+
},
2723

28-
render() {
29-
return h('div', {
30-
attrs: { 'data-formsjs-id': this.$props.options.id }
31-
})
24+
methods: {
25+
getForm(): FormConstructor | null {
26+
return this.formInstance as FormConstructor | null;
3227
},
33-
34-
mounted() {
35-
this.formInstance = new FormConstructor(this.$el as HTMLElement, this.$props.options);
36-
},
37-
38-
beforeUnmount() {
39-
const form = this.getForm();
40-
form.destroy();
41-
},
42-
43-
watch: {
44-
// check for option changes and rerender form
45-
},
46-
})
47-
48-
export default Form
28+
},
29+
30+
render() {
31+
return h('div', {
32+
attrs: { 'data-formsjs-id': this.$props.options.id },
33+
});
34+
},
35+
36+
mounted() {
37+
usePlugin(this.$props.plugins);
38+
this.formInstance = new FormConstructor(this.$el as HTMLElement, this.$props.options);
39+
},
40+
41+
beforeUnmount() {
42+
const form = this.getForm();
43+
form?.destroy();
44+
},
45+
46+
watch: {
47+
// check for option changes and rerender form
48+
},
49+
});
50+
51+
export default Form;

packages/vue/src/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
import Form from './form.js';
12

3+
export default Form;

0 commit comments

Comments
 (0)