@westartcom/bread-quasar-fields 0.1.4 → 0.1.5

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.
@@ -57,6 +57,14 @@ export default defineComponent({
57
57
  type: Boolean,
58
58
  required: false,
59
59
  default: true
60
+ },
61
+ validationPattern: {
62
+ type: RegExp,
63
+ required: false
64
+ },
65
+ validationPatternMessage: {
66
+ type: String,
67
+ required: false
60
68
  }
61
69
  },
62
70
 
@@ -91,6 +99,13 @@ export default defineComponent({
91
99
  },
92
100
 
93
101
  internalValue: function(val) {
102
+ if(this.validationPattern) {
103
+ const pattern = new RegExp(this.validationPattern);
104
+ this.internalErrors = [];
105
+ if (!pattern.test(val)) {
106
+ this.internalErrors.push((this.validationPatternMessage) ? this.validationPatternMessage : 'Invalid format');
107
+ }
108
+ }
94
109
  this.validate(val);
95
110
  this.$emit('update:modelValue', val);
96
111
  },
@@ -60,6 +60,14 @@ export default defineComponent({
60
60
  type: Boolean,
61
61
  required: false,
62
62
  default: true
63
+ },
64
+ validationPattern: {
65
+ type: RegExp,
66
+ required: false
67
+ },
68
+ validationPatternMessage: {
69
+ type: String,
70
+ required: false
63
71
  }
64
72
  },
65
73
 
@@ -94,6 +102,13 @@ export default defineComponent({
94
102
  },
95
103
 
96
104
  internalValue: function(val) {
105
+ if(this.validationPattern) {
106
+ const pattern = new RegExp(this.validationPattern);
107
+ this.internalErrors = [];
108
+ if (!pattern.test(val)) {
109
+ this.internalErrors.push((this.validationPatternMessage) ? this.validationPatternMessage : 'Invalid format');
110
+ }
111
+ }
97
112
  this.validate(val);
98
113
  this.$emit('update:modelValue', val);
99
114
  },
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.5",
4
4
  "description": "Quasar compatible fields for bread package",
5
5
  "main": "index.js",
6
6
  "scripts": {