@tak-ps/vue-tabler 3.11.2 → 3.13.0

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.0
14
+
15
+ - :tada: Add support for `integer` type in JSON Schema
16
+
17
+ ### v3.12.0
18
+
19
+ - :tada: Add support for `number` type in JSON Schema
20
+
13
21
  ### v3.11.2
14
22
 
15
23
  - :bug: Syntax
@@ -21,6 +21,16 @@
21
21
  v-model='data[key]'
22
22
  />
23
23
  </template>
24
+ <template v-else-if='schema.properties[key].type === "number" || schema.properties[key].type === "integer"'>
25
+ <TablerInput
26
+ type='schema.properties[key].type'
27
+ :label='key'
28
+ :disabled='disabled'
29
+ :required='schema.properties[key].required || false'
30
+ :description='schema.properties[key].description || ""'
31
+ v-model='data[key]'
32
+ />
33
+ </template>
24
34
  <template v-else-if='schema.properties[key].type === "boolean"'>
25
35
  <TablerToggle
26
36
  :label='key'
@@ -3,10 +3,7 @@
3
3
  <TablerLabel :label='label' :description='description' :required='required'><slot/></TablerLabel>
4
4
  <div class='col-12'>
5
5
  <div class="row g-2">
6
- <div :key='color' v-for='color in [
7
- "dark", "white", "blue", "azure", "indigo", "purple", "pink", "red", "orange", "yellow", "lime"
8
- ]'
9
- class="col-auto">
6
+ <div :key='color' v-for='color in Object.keys(colours)' class='col-auto'>
10
7
  <label class="form-colorinput">
11
8
  <input :disabled='disabled' v-model='current' :value='color' type="radio" class="form-colorinput-input">
12
9
  <span class="form-colorinput-color bg-dark" :class='[
@@ -23,7 +20,7 @@
23
20
  import TablerLabel from '../internal/Label.vue';
24
21
 
25
22
  export default {
26
- name: 'TablerEnum',
23
+ name: 'TablerColour',
27
24
  props: {
28
25
  modelValue: {
29
26
  type: String,
@@ -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
+ 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.11.2",
4
+ "version": "3.13.0",
5
5
  "lib": "lib.js",
6
6
  "module": "lib.js",
7
7
  "description": "Tabler UI components for Vue3",