@tak-ps/vue-tabler 3.12.0 → 3.13.1

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/CHANGELOG.md CHANGED
@@ -10,6 +10,14 @@
10
10
 
11
11
  ## Version History
12
12
 
13
+ ### v3.13.1
14
+
15
+ - :bug: Fix Syntax
16
+
17
+ ### v3.13.0
18
+
19
+ - :tada: Add support for `integer` type in JSON Schema
20
+
13
21
  ### v3.12.0
14
22
 
15
23
  - :tada: Add support for `number` type in JSON Schema
@@ -21,9 +21,9 @@
21
21
  v-model='data[key]'
22
22
  />
23
23
  </template>
24
- <template v-else-if='schema.properties[key].type === "number"'>
24
+ <template v-else-if='schema.properties[key].type === "number" || schema.properties[key].type === "integer"'>
25
25
  <TablerInput
26
- type='number'
26
+ type='schema.properties[key].type'
27
27
  :label='key'
28
28
  :disabled='disabled'
29
29
  :required='schema.properties[key].required || false'
@@ -3,12 +3,12 @@
3
3
  <TablerLabel :label='label || placeholder' :description='description' :required='required'><slot/></TablerLabel>
4
4
  <div class='col-12'>
5
5
  <template v-if='!rows || rows <= 1'>
6
- <input :disabled='disabled' :value='modelValue' @input='event => current = event.target.value' :type='type' :class='{
6
+ <input :disabled='disabled' :value='modelValue' @input='event => current = event.target.value' :type='computed_type' :class='{
7
7
  "is-invalid": error
8
8
  }' class="form-control" :placeholder='label||placeholder||""'/>
9
9
  </template>
10
10
  <template v-else>
11
- <textarea style='white-space: pre;' :disabled='disabled' :rows='rows' :value='modelValue' @input='event => current = event.target.value' :type='type' :class='{
11
+ <textarea style='white-space: pre;' :disabled='disabled' :rows='rows' :value='modelValue' @input='event => current = event.target.value' :type='computed_type' :class='{
12
12
  "is-invalid": error
13
13
  }' class="form-control" :placeholder='label||placeholder||""'/>
14
14
  </template>
@@ -57,9 +57,15 @@ export default {
57
57
  current: ''
58
58
  }
59
59
  },
60
+ computed: {
61
+ computed_type: function() {
62
+ if (this.type === 'integer') return 'number';
63
+ return this.type;
64
+ }
65
+ },
60
66
  watch: {
61
67
  current: function() {
62
- if (typeof this.modelValue === 'number') {
68
+ if (typeof this.modelValue === 'number' || this.type === 'number') {
63
69
  const current = Number(this.current);
64
70
 
65
71
  if (isNaN(current)) {
@@ -69,6 +75,16 @@ export default {
69
75
  } else {
70
76
  this.$emit('update:modelValue', current);
71
77
  }
78
+ } else if (this.type === 'integer') {
79
+ const current = parseInt(this.current);
80
+
81
+ if (isNaN(current)) {
82
+ this.error = 'Must be an integer!';
83
+ } else if (current === this.modelValue) {
84
+ return;
85
+ } else {
86
+ this.$emit('update:modelValue', current);
87
+ }
72
88
  } else {
73
89
  if (this.current === this.modelValue) return;
74
90
  this.$emit('update:modelValue', this.current);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/vue-tabler",
3
3
  "type": "module",
4
- "version": "3.12.0",
4
+ "version": "3.13.1",
5
5
  "lib": "lib.js",
6
6
  "module": "lib.js",
7
7
  "description": "Tabler UI components for Vue3",