@westartcom/bread-quasar-fields 0.1.4 → 0.1.6

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.
@@ -16,6 +16,8 @@
16
16
  :rules="(field.required) ? [val => !!val || $i18n.get('validation.required', { attribute: field.label as string })] : []"
17
17
  :hint="field.description"
18
18
  :errors="internalErrors"
19
+ @keydown="$emit('keydown', $event)"
20
+ @blur="$emit('blur', $event)"
19
21
  outlined>
20
22
  </q-input>
21
23
  </div>
@@ -57,12 +59,22 @@ export default defineComponent({
57
59
  type: Boolean,
58
60
  required: false,
59
61
  default: true
62
+ },
63
+ validationPattern: {
64
+ type: RegExp,
65
+ required: false
66
+ },
67
+ validationPatternMessage: {
68
+ type: String,
69
+ required: false
60
70
  }
61
71
  },
62
72
 
63
73
  emits: [
64
74
  'update:modelValue',
65
- 'update:invalid'
75
+ 'update:invalid',
76
+ 'keydown',
77
+ 'blur',
66
78
  ],
67
79
 
68
80
  data() {
@@ -91,6 +103,13 @@ export default defineComponent({
91
103
  },
92
104
 
93
105
  internalValue: function(val) {
106
+ if(this.validationPattern) {
107
+ const pattern = new RegExp(this.validationPattern);
108
+ this.internalErrors = [];
109
+ if (!pattern.test(val)) {
110
+ this.internalErrors.push((this.validationPatternMessage) ? this.validationPatternMessage : 'Invalid format');
111
+ }
112
+ }
94
113
  this.validate(val);
95
114
  this.$emit('update:modelValue', val);
96
115
  },
@@ -15,6 +15,8 @@
15
15
  :disable="disable"
16
16
  :rules="(field.required) ? [val => !!val || 'Field is required'] : []"
17
17
  :hint="field.description"
18
+ @keydown="$emit('keydown', $event)"
19
+ @blur="$emit('blur', $event)"
18
20
  outlined>
19
21
  </q-input>
20
22
  </div>
@@ -61,7 +63,9 @@ export default defineComponent({
61
63
 
62
64
  emits: [
63
65
  'update:modelValue',
64
- 'update:invalid'
66
+ 'update:invalid',
67
+ 'keydown',
68
+ 'blur',
65
69
  ],
66
70
 
67
71
  data() {
@@ -14,6 +14,8 @@
14
14
  :disable="disable"
15
15
  :rules="(field.required) ? [val => !!val || 'Field is required'] : []"
16
16
  :hint="field.description"
17
+ @keydown="$emit('keydown', $event)"
18
+ @blur="$emit('blur', $event)"
17
19
  outlined>
18
20
  </q-input>
19
21
  </div>
@@ -61,7 +63,9 @@ export default defineComponent({
61
63
 
62
64
  emits: [
63
65
  'update:modelValue',
64
- 'update:invalid'
66
+ 'update:invalid',
67
+ 'keydown',
68
+ 'blur',
65
69
  ],
66
70
 
67
71
  data() {
@@ -15,6 +15,8 @@
15
15
  :disable="disable"
16
16
  :rules="(field.required) ? [val => !!val || 'Field is required'] : []"
17
17
  :hint="field.description"
18
+ @keydown="$emit('keydown', $event)"
19
+ @blur="$emit('blur', $event)"
18
20
  outlined>
19
21
  </q-input>
20
22
  </div>
@@ -60,12 +62,22 @@ export default defineComponent({
60
62
  type: Boolean,
61
63
  required: false,
62
64
  default: true
65
+ },
66
+ validationPattern: {
67
+ type: RegExp,
68
+ required: false
69
+ },
70
+ validationPatternMessage: {
71
+ type: String,
72
+ required: false
63
73
  }
64
74
  },
65
75
 
66
76
  emits: [
67
77
  'update:modelValue',
68
- 'update:invalid'
78
+ 'update:invalid',
79
+ 'keydown',
80
+ 'blur',
69
81
  ],
70
82
 
71
83
  data() {
@@ -94,6 +106,13 @@ export default defineComponent({
94
106
  },
95
107
 
96
108
  internalValue: function(val) {
109
+ if(this.validationPattern) {
110
+ const pattern = new RegExp(this.validationPattern);
111
+ this.internalErrors = [];
112
+ if (!pattern.test(val)) {
113
+ this.internalErrors.push((this.validationPatternMessage) ? this.validationPatternMessage : 'Invalid format');
114
+ }
115
+ }
97
116
  this.validate(val);
98
117
  this.$emit('update:modelValue', val);
99
118
  },
@@ -15,6 +15,8 @@
15
15
  :disable="disable"
16
16
  :rules="(field.required) ? [val => !!val || 'Field is required'] : []"
17
17
  :hint="field.description"
18
+ @keydown="$emit('keydown', $event)"
19
+ @blur="$emit('blur', $event)"
18
20
  outlined>
19
21
  </q-input>
20
22
  </div>
@@ -67,7 +69,9 @@ export default defineComponent({
67
69
 
68
70
  emits: [
69
71
  'update:modelValue',
70
- 'update:invalid'
72
+ 'update:invalid',
73
+ 'keydown',
74
+ 'blur',
71
75
  ],
72
76
 
73
77
  data() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@westartcom/bread-quasar-fields",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Quasar compatible fields for bread package",
5
5
  "main": "index.js",
6
6
  "scripts": {