@josercl/form-maker 1.0.0-alpha17 → 1.1.0-beta01

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/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
package/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import FormMakerComponent from './lib/components/FormMaker';
2
- import FormMakerInput from './lib/components/FormMakerInput';
3
- import CheckboxInput from './lib/components/inputs/CheckboxInput';
4
- import FileInput from './lib/components/inputs/FileInput';
5
- import FormMakerInputError from './lib/components/inputs/FormMakerInputError';
6
- import FormMakerInputHelp from './lib/components/inputs/FormMakerInputHelp';
7
- import FormMakerInputLabel from './lib/components/inputs/FormMakerInputLabel';
8
- import RadioInput from './lib/components/inputs/RadioInput';
9
- import SelectInput from './lib/components/inputs/SelectInput';
10
- import TextAreaInput from './lib/components/inputs/TextAreaInput';
11
- import TextInput from './lib/components/inputs/TextInput';
1
+ import FormMakerComponent from './lib/components/FormMaker.vue';
2
+ import FormMakerInput from './lib/components/FormMakerInput.vue';
3
+ import CheckboxInput from './lib/components/inputs/CheckboxInput.vue';
4
+ import FileInput from './lib/components/inputs/FileInput.vue';
5
+ import FormMakerInputError from './lib/components/inputs/FormMakerInputError.vue';
6
+ import FormMakerInputHelp from './lib/components/inputs/FormMakerInputHelp.vue';
7
+ import FormMakerInputLabel from './lib/components/inputs/FormMakerInputLabel.vue';
8
+ import RadioInput from './lib/components/inputs/RadioInput.vue';
9
+ import SelectInput from './lib/components/inputs/SelectInput.vue';
10
+ import TextAreaInput from './lib/components/inputs/TextAreaInput.vue';
11
+ import TextInput from './lib/components/inputs/TextInput.vue';
12
12
 
13
13
  const defaultOptions = {
14
14
  classes: {
@@ -57,7 +57,7 @@
57
57
 
58
58
  <script>
59
59
  import {
60
- computed, inject, provide, toRefs,
60
+ computed, inject, provide, toRefs
61
61
  } from 'vue';
62
62
  // import setupVModel from '../utils';
63
63
 
File without changes
@@ -17,9 +17,7 @@
17
17
  </template>
18
18
 
19
19
  <script>
20
- import {
21
- computed, ref, toRefs, watch,
22
- } from 'vue';
20
+ import { computed, toRefs } from 'vue';
23
21
  import { FormInputMixin } from './FormInputMixin';
24
22
 
25
23
  export default {
@@ -39,14 +37,10 @@ export default {
39
37
 
40
38
  const val = computed(() => props.modelValue);
41
39
 
42
- const selectedOptions = ref([]);
43
-
44
- watch(
45
- val,
46
- newVal => {
47
- selectedOptions.value = (Array.isArray(newVal) ? newVal : [ newVal ]).filter(x => !!x);
48
- },
49
- );
40
+ const selectedOptions = computed(() => {
41
+ const arr = Array.isArray(val.value) ? val.value : [ val.value ];
42
+ return arr.filter(x => !!x);
43
+ });
50
44
 
51
45
  const fieldOptions = computed(() => {
52
46
  if (!isBinary.value) {
@@ -61,16 +55,17 @@ export default {
61
55
  });
62
56
 
63
57
  const handleClick = clickVal => {
64
- if (selectedOptions.value.indexOf(clickVal) === -1) {
65
- selectedOptions.value.push(clickVal);
58
+ let selOptions = [ ...selectedOptions.value ];
59
+ if (selOptions.indexOf(clickVal) === -1) {
60
+ selOptions.push(clickVal);
66
61
  } else {
67
- selectedOptions.value = selectedOptions.value.filter(x => x !== clickVal);
62
+ selOptions = selOptions.filter(x => x !== clickVal);
68
63
  }
69
64
 
70
65
  if (isBinary.value) {
71
- emit('update:modelValue', selectedOptions.value.length > 0);
66
+ emit('update:modelValue', selOptions.length > 0);
72
67
  } else {
73
- emit('update:modelValue', selectedOptions.value);
68
+ emit('update:modelValue', selOptions);
74
69
  }
75
70
  };
76
71
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -13,9 +13,9 @@
13
13
  :label="key"
14
14
  >
15
15
  <option
16
- v-for="(optLabel, value) in opts"
17
- :key="`option_${value}`"
18
- :value="value"
16
+ v-for="(optLabel, optValue) in opts"
17
+ :key="`option_${optValue}`"
18
+ :value="optValue"
19
19
  >
20
20
  {{ optLabel }}
21
21
  </option>
File without changes
File without changes
package/lib/utils.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,47 +1,40 @@
1
1
  {
2
2
  "name": "@josercl/form-maker",
3
- "version": "1.0.0-alpha17",
3
+ "version": "1.1.0-beta01",
4
4
  "description": "Form generator using vue 3",
5
5
  "author": "Jose Carrero <josercl@gmail.com>",
6
6
  "scripts": {
7
- "build:umd": "vue-cli-service build --target lib --formats umd,umd-min --dest umd --filename index --name FormMaker index.js",
8
- "build:common": "vue-cli-service build --target lib --formats commonjs --dest commonjs --filename index --name FormMaker index.js",
9
- "build": "npm run build:umd && npm run build:common",
10
- "build-docs": "vue-cli-service build",
11
- "serve": "vue-cli-service serve",
12
- "lint": "vue-cli-service lint --ext .js,.vue lib/ docs/ index.js"
7
+ "dev": "vite -c docs.config.js dev",
8
+ "build": "vite build",
9
+ "build-docs": "vite -c docs.config.js build",
10
+ "preview": "vite -c docs.config.js preview --port 5050",
11
+ "lint": "eslint --ext .vue,.js lib/ docs/ index.js"
13
12
  },
14
13
  "files": [
15
14
  "index.js",
16
15
  "lib/**",
17
- "umd/*.js",
18
- "umd/*.map",
19
- "commonjs/*.js",
20
- "commonjs/*.map"
16
+ "umd/*.js"
21
17
  ],
22
18
  "homepage": "https://josercl.gitlab.io/form-maker",
23
19
  "dependencies": {
24
- "core-js": "^3.6.5",
25
- "vue": "^3.0.0"
20
+ "vue": "^3.2.31"
26
21
  },
27
22
  "devDependencies": {
23
+ "@babel/core": "^7.17.5",
24
+ "@babel/eslint-parser": "^7.17.0",
28
25
  "@fortawesome/fontawesome-svg-core": "^1.2.32",
29
26
  "@fortawesome/free-brands-svg-icons": "^5.15.1",
30
27
  "@fortawesome/free-regular-svg-icons": "^5.15.1",
31
28
  "@fortawesome/vue-fontawesome": "^3.0.0-2",
32
29
  "@tailwindcss/typography": "^0.2.0",
33
- "@vue/cli-plugin-babel": "~4.5.0",
34
- "@vue/cli-plugin-eslint": "^4.5.8",
35
- "@vue/cli-service": "~4.5.0",
36
- "@vue/compiler-sfc": "^3.0.0",
37
- "@vue/eslint-config-airbnb": "^5.0.2",
38
- "babel-eslint": "^10.1.0",
39
- "eslint": "^6.7.2",
40
- "eslint-plugin-import": "^2.20.2",
41
- "eslint-plugin-vue": "^7.0.0-0",
30
+ "@vitejs/plugin-vue": "^2.2.2",
31
+ "@vue/eslint-config-airbnb": "^6.0.0",
32
+ "eslint": "^8.10.0",
33
+ "eslint-plugin-vue": "^8.5.0",
42
34
  "highlight.js": "^10.2.1",
43
35
  "tailwindcss": "^1.9.6",
44
- "vue-router": "^4.0.0-rc.1"
36
+ "vite": "^2.8.4",
37
+ "vue-router": "^4.0.12"
45
38
  },
46
39
  "keywords": [
47
40
  "vue 3",