pui9-components 1.17.3 → 2.0.7

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.
Files changed (43) hide show
  1. package/dist/pui9-components.common.js +75007 -52512
  2. package/dist/pui9-components.css +9 -2
  3. package/package-lock.json +6651 -6827
  4. package/package.json +22 -26
  5. package/src/components/PuiCauDialog.vue +192 -0
  6. package/src/components/PuiCheckbox.vue +25 -4
  7. package/src/components/PuiCodeEditor.vue +2 -1
  8. package/src/components/PuiDateField.vue +653 -614
  9. package/src/components/PuiField.vue +1 -1
  10. package/src/components/PuiFileUpload.vue +275 -0
  11. package/src/components/PuiFileUploadGroup.vue +241 -0
  12. package/src/components/PuiFilter.vue +54 -52
  13. package/src/components/PuiFilterGroup.vue +179 -179
  14. package/src/components/PuiFilterRule.vue +481 -162
  15. package/src/components/PuiFormFooter.vue +5 -38
  16. package/src/components/PuiFormTooltip.vue +50 -0
  17. package/src/components/PuiMasterDetail.vue +18 -11
  18. package/src/components/PuiModalDialog.vue +4 -1
  19. package/src/components/PuiModalDialogForm.vue +5 -1
  20. package/src/components/PuiMultiSelect.vue +383 -280
  21. package/src/components/PuiNumberField.vue +216 -285
  22. package/src/components/PuiRichTextEditor.vue +43 -44
  23. package/src/components/PuiSelect.vue +382 -355
  24. package/src/components/PuiSelectDetailDialog.vue +10 -3
  25. package/src/components/PuiSelectorList.vue +169 -0
  26. package/src/components/PuiSort.vue +98 -0
  27. package/src/components/PuiSpinnerField.vue +101 -121
  28. package/src/components/PuiTextField.vue +374 -258
  29. package/src/index.js +8 -0
  30. package/src/main.js +1 -0
  31. package/src/mixins/PuiFormComponentMixin.js +2 -8
  32. package/src/mixins/PuiSortMixin.js +136 -0
  33. package/src/mixins/PuiUtilsNumberMixin.js +15 -5
  34. package/src/plugins/vuetify.js +2 -1
  35. package/src/utils.js +10 -0
  36. package/dist/demo.html +0 -10
  37. package/dist/pui9-components.common.js.map +0 -1
  38. package/dist/pui9-components.umd.js +0 -86432
  39. package/dist/pui9-components.umd.js.map +0 -1
  40. package/dist/pui9-components.umd.min.js +0 -308
  41. package/dist/pui9-components.umd.min.js.map +0 -1
  42. package/src/mixins/PuiFilterMixin.js +0 -157
  43. package/src/mixins/PuiMultiSelectMixin.js +0 -106
@@ -6,20 +6,7 @@
6
6
  <v-flex xs12>
7
7
  <label v-if="getLabel === '$nbsp;'">&nbsp;</label>
8
8
  <label v-else :class="getLabelRequiredClass">{{ getLabel }}</label>
9
- <v-tooltip top v-if="showTooltip">
10
- <template v-slot:activator="{ on }">
11
- <v-icon class="info-tooltip" size="14" v-on="on">fas fa-info-circle info-tooltip</v-icon>
12
- </template>
13
- <span>
14
- <span v-if="this.description !== ''">
15
- {{ this.description }}
16
- <hr v-if="this.infoTooltipMessages.length > 0" />
17
- </span>
18
- <ul>
19
- <li v-for="(message, index) in this.infoTooltipMessages" :key="index">{{ message }}</li>
20
- </ul>
21
- </span>
22
- </v-tooltip>
9
+ <pui-form-tooltip v-bind="{ tooltipDescription, tooltipIcon }" v-if="showTooltip" ref="tooltip"></pui-form-tooltip>
23
10
  </v-flex>
24
11
  </v-layout>
25
12
  <v-layout>
@@ -29,19 +16,16 @@
29
16
  v-model="internalModel"
30
17
  v-bind="allProps"
31
18
  :class="getEditedClass"
32
- solo
33
- outlined
34
- flat
35
- @blur="updateValueLazy"
36
19
  :rules="getRules"
37
- @keydown="clearMessages"
38
- @keyup="validateNumber"
39
- :messages="internalMessages"
40
- type="number"
20
+ @blur="onBlurText"
41
21
  :placeholder="getPlaceholder"
22
+ :messages="internalMessages"
42
23
  :error-messages="internalErrorMessages"
43
24
  :error="internalError"
44
25
  ref="puiNumberField"
26
+ solo
27
+ outlined
28
+ flat
45
29
  ></v-text-field>
46
30
  <v-text-field
47
31
  :id="`${allProps.id}_internal`"
@@ -49,13 +33,14 @@
49
33
  v-model="visibleModel"
50
34
  v-bind="allProps"
51
35
  :class="getEditedClass"
52
- solo
53
- outlined
54
- flat
36
+ :rules="getRules"
55
37
  @focus="onFocusText"
56
38
  :messages="internalMessages"
57
39
  :error-messages="internalErrorMessages"
58
40
  :error="internalError"
41
+ solo
42
+ outlined
43
+ flat
59
44
  ></v-text-field>
60
45
  </v-flex>
61
46
  </v-layout>
@@ -64,20 +49,7 @@
64
49
  <v-layout>
65
50
  <v-flex :class="labelColumnStyles ? labelColumnStyles : 'xs12 sm6 md4 xl3'">
66
51
  <label :class="getLabelRequiredClass">{{ getLabel }}</label>
67
- <v-tooltip top v-if="showTooltip">
68
- <template v-slot:activator="{ on }">
69
- <v-icon class="info-tooltip" size="14" v-on="on">fas fa-info-circle info-tooltip</v-icon>
70
- </template>
71
- <span>
72
- <span v-if="this.description !== ''">
73
- {{ this.description }}
74
- <hr v-if="this.infoTooltipMessages.length > 0" />
75
- </span>
76
- <ul>
77
- <li v-for="(message, index) in this.infoTooltipMessages" :key="index">{{ message }}</li>
78
- </ul>
79
- </span>
80
- </v-tooltip>
52
+ <pui-form-tooltip v-bind="{ tooltipDescription, tooltipIcon }" v-if="showTooltip" ref="tooltip"></pui-form-tooltip>
81
53
  </v-flex>
82
54
  <v-flex :class="valueColumnStyles ? valueColumnStyles : 'xs12 sm6 md8 xl9'">
83
55
  <v-text-field
@@ -85,19 +57,16 @@
85
57
  v-model="internalModel"
86
58
  v-bind="allProps"
87
59
  :class="getEditedClass"
88
- solo
89
- outlined
90
- flat
91
- @blur="updateValueLazy"
92
60
  :rules="getRules"
93
- @keydown="clearMessages"
94
- @keyup="validateNumber"
95
- :messages="internalMessages"
96
- type="number"
61
+ @blur="onBlurText"
97
62
  :placeholder="getPlaceholder"
63
+ :messages="internalMessages"
98
64
  :error-messages="internalErrorMessages"
99
65
  :error="internalError"
100
66
  ref="puiNumberField"
67
+ solo
68
+ outlined
69
+ flat
101
70
  ></v-text-field>
102
71
  <v-text-field
103
72
  :id="`${allProps.id}_internal`"
@@ -105,13 +74,14 @@
105
74
  v-model="visibleModel"
106
75
  v-bind="allProps"
107
76
  :class="getEditedClass"
108
- solo
109
- outlined
110
- flat
77
+ :rules="getRules"
111
78
  @focus="onFocusText"
112
79
  :messages="internalMessages"
113
80
  :error-messages="internalErrorMessages"
114
81
  :error="internalError"
82
+ solo
83
+ outlined
84
+ flat
115
85
  ></v-text-field>
116
86
  </v-flex>
117
87
  </v-layout>
@@ -128,17 +98,14 @@
128
98
  :class="getMobileClass"
129
99
  class="v-text-field--mobile"
130
100
  :label="getLabel"
131
- flat
132
- @blur="updateValueLazy"
133
- @keydown="clearMessages"
134
- @keyup="validateNumber"
101
+ @blur="onBlurText"
135
102
  :rules="getRules"
136
- :messages="internalMessages"
137
- type="number"
138
103
  :placeholder="getPlaceholder"
104
+ :messages="internalMessages"
139
105
  :error-messages="internalErrorMessages"
140
106
  :error="internalError"
141
107
  ref="puiNumberField"
108
+ flat
142
109
  ></v-text-field>
143
110
  <v-text-field
144
111
  :id="`${allProps.id}_internal`"
@@ -147,12 +114,13 @@
147
114
  v-bind="allProps"
148
115
  :class="getMobileClass"
149
116
  class="v-text-field--mobile"
117
+ :rules="getRules"
150
118
  :label="getLabel"
151
- flat
152
119
  @focus="onFocusText"
153
120
  :messages="internalMessages"
154
121
  :error-messages="internalErrorMessages"
155
122
  :error="internalError"
123
+ flat
156
124
  ></v-text-field>
157
125
  </v-flex>
158
126
  </v-layout>
@@ -166,14 +134,18 @@ import PuiFormComponentMixin from '../mixins/PuiFormComponentMixin';
166
134
  export default {
167
135
  name: 'PuiNumberField',
168
136
  mixins: [PuiUtilsNumberMixin, PuiFormComponentMixin],
137
+ inject: {
138
+ form: {
139
+ default: null
140
+ }
141
+ },
169
142
  data: () => ({
170
143
  internalMessages: [],
171
144
  internalErrorMessages: [],
172
145
  internalDecimals: 999,
173
- internalMax: Number.MAX_SAFE_INTEGER,
174
- internalMin: Number.MIN_SAFE_INTEGER,
175
- infoTooltipMessages: [],
176
- showVisibleModel: true
146
+ showVisibleModel: true,
147
+ firstLoad: true,
148
+ valid: true
177
149
  }),
178
150
  props: {
179
151
  value: {
@@ -182,35 +154,32 @@ export default {
182
154
  },
183
155
  decimals: {
184
156
  type: [String, Number],
185
- default: 999,
157
+ default: 8,
186
158
  required: false
187
159
  },
188
- max: {
160
+ min: {
189
161
  type: [String, Number],
190
- default: () => {
191
- return Number.MAX_SAFE_INTEGER;
192
- },
193
162
  required: false
194
163
  },
195
- min: {
164
+ max: {
196
165
  type: [String, Number],
197
- default: () => {
198
- return Number.MIN_SAFE_INTEGER;
199
- },
200
166
  required: false
201
167
  },
202
168
  tooltip: {
203
- type: [Boolean],
204
- default: false,
169
+ type: Boolean,
170
+ required: false,
171
+ default: false
172
+ },
173
+ tooltipDescription: {
174
+ type: String,
205
175
  required: false
206
176
  },
207
- description: {
208
- type: [String],
209
- default: '',
177
+ tooltipIcon: {
178
+ type: String,
210
179
  required: false
211
180
  },
212
181
  integer: {
213
- type: [Boolean],
182
+ type: Boolean,
214
183
  default: false,
215
184
  required: false
216
185
  },
@@ -239,161 +208,6 @@ export default {
239
208
  required: false
240
209
  }
241
210
  },
242
- methods: {
243
- getInfoTooltip() {
244
- if (this.max < Number.MAX_SAFE_INTEGER) {
245
- this.infoTooltipMessages.push(this.$t('pui9.components.numberField.maxvaluemessage') + ': ' + this.max);
246
- }
247
-
248
- if (this.min > Number.MIN_SAFE_INTEGER) {
249
- this.infoTooltipMessages.push(this.$t('pui9.components.numberField.minvaluemessage') + ': ' + this.min);
250
- }
251
-
252
- if (this.integer) {
253
- this.infoTooltipMessages.push(this.$t('pui9.components.numberField.integermessage'));
254
- }
255
-
256
- if (this.decimals !== 999) {
257
- this.infoTooltipMessages.push(this.$t('pui9.components.numberField.maxdecimalsmessage') + ': ' + this.decimals);
258
- }
259
- },
260
- onFocusText() {
261
- this.showVisibleModel = false;
262
- setTimeout(() => {
263
- this.$refs.puiNumberField.focus();
264
- }, 5);
265
- },
266
- updateValueLazy(val) {
267
- this.showVisibleModel = true;
268
- var valueAsNumber = val.target.valueAsNumber;
269
-
270
- this.validateNumber(val);
271
- this.checkMinMax(valueAsNumber);
272
-
273
- if (!this.internalError) {
274
- this.$emit('input', this.internalModel);
275
- } else {
276
- this.$emit('input', null);
277
- }
278
- },
279
- showWrongNumberMessage() {
280
- var message = this.$t('pui9.components.numberField.wrongnumber');
281
- this.internalError = true;
282
- this.internalErrorMessages = [message];
283
- },
284
- showRequiredMessage() {
285
- var message = this.$t('pui9.error.field_required');
286
- this.internalError = true;
287
- this.internalErrorMessages = [message];
288
- },
289
- validateNumber(evt) {
290
- var val = evt.target.value;
291
- var valNum = evt.target.valueAsNumber;
292
- var wrong = isNaN(valNum);
293
-
294
- if (!wrong) {
295
- this.checkNumber(val);
296
- } else {
297
- if (evt.target.validity.badInput) {
298
- this.showWrongNumberMessage();
299
- } else {
300
- if (this.required) {
301
- this.showRequiredMessage();
302
- }
303
- }
304
- // Con este código conforme pones algo inválido te vacía el campo... Si pones un '.' sin querer te borra todo. Igual con un timeout de unos segundos sí que queda bien.
305
- /* if (!val) {
306
- this.internalModel = Number.NaN;
307
- } */
308
- }
309
- },
310
- checkNumber(val) {
311
- // INTEGERS
312
- if (this.integer) {
313
- var isInt = this.checkInteger(val);
314
- if (isInt) {
315
- this.internalModel = parseInt(val);
316
- } else {
317
- var int = parseInt(val);
318
- if (!isNaN(int)) {
319
- this.internalModel = int;
320
- } else {
321
- this.showWrongNumberMessage();
322
- }
323
- }
324
- } else {
325
- var isFloat = this.checkFloat(val);
326
- if (isFloat) {
327
- this.formatNumber(val);
328
- } else {
329
- this.showWrongNumberMessage();
330
- }
331
- }
332
- },
333
- checkMinMax(value) {
334
- // MAX
335
- if (value > this.internalMax) {
336
- this.internalErrorMessages = [];
337
- this.internalErrorMessages.push(this.$t('pui9.components.numberField.maxvaluemessage') + ' ' + this.internalMax);
338
- this.internalError = true;
339
- }
340
- // MIN
341
- if (value < this.internalMin) {
342
- this.internalErrorMessages = [];
343
- this.internalErrorMessages.push(this.$t('pui9.components.numberField.minvaluemessage') + ' ' + this.internalMin);
344
- this.internalError = true;
345
- }
346
- },
347
- formatNumber(val) {
348
- var fval = parseFloat(val);
349
-
350
- if (val && val.length > 0) {
351
- // DECIMALS
352
- if (val.indexOf('.') !== -1) {
353
- var parts = val.split('.');
354
- var decimalPart = parts[1];
355
- if (decimalPart && decimalPart.length > this.internalDecimals) {
356
- var nfloat = this.truncateDecimal(val, this.internalDecimals);
357
- //if (parseFloat(this.internalModel) !== nfloat) {
358
- this.internalModel = nfloat;
359
- this.internalMessages = [];
360
- this.internalMessages.push(this.$t('pui9.components.numberField.maxdecimalsmessage') + ' ' + this.internalDecimals);
361
- this.internalError = true;
362
- //}
363
- } else {
364
- this.clearMessages();
365
- }
366
- } else {
367
- this.clearMessages();
368
- }
369
- this.checkMinMax(fval);
370
- } else {
371
- this.clearMessages();
372
- }
373
- },
374
- clearMessages() {
375
- this.internalError = false;
376
- this.internalMessages = [];
377
- this.internalErrorMessages = [];
378
- },
379
- initializeModel(value) {
380
- if (this.integer) {
381
- //this.initialValue = parseInt(value);
382
- this.internalModel = parseInt(value);
383
- } else {
384
- //this.initialValue = parseFloat(value);
385
- this.internalModel = parseFloat(value);
386
- }
387
- // check max/min
388
- this.checkMinMax(value);
389
- },
390
- formatAndSetMinMax() {
391
- const mmax = parseFloat(this.max);
392
- const mmin = parseFloat(this.min);
393
- this.internalMax = !isNaN(mmax) ? mmax : this.internalMax;
394
- this.internalMin = !isNaN(mmin) ? mmin : this.internalMin;
395
- }
396
- },
397
211
  computed: {
398
212
  getMobileClass() {
399
213
  return { 'v-text-field--edited': this.isEdited, 'v-text-field--required': this.required };
@@ -406,21 +220,10 @@ export default {
406
220
  },
407
221
  getRules() {
408
222
  const rules = [...this.rules];
409
- var func2 = () => !this.internalError || '';
410
- rules.push(func2);
411
- if (this.required) {
412
- // Si se descomenta el código, cuando el campo es erróneo y presionas alguna tecla antes de mostrar mensaje de campo erróneo se muestra el de campo obligatorio. Así funciona correctamente
413
223
 
414
- /* var func = value => !!value || this.requiredMessage; */
415
- var func3 = () => {
416
- if (this.internalModel === '' || this.internalModel === null || isNaN(this.internalModel)) {
417
- return this.requiredMessage;
418
- }
419
- return true;
420
- };
421
- /* rules.push(func, func2, func3); */
422
- rules.push(func3);
423
- }
224
+ let noErrorsRule = () => !this.internalError;
225
+ rules.push(noErrorsRule);
226
+
424
227
  return rules;
425
228
  },
426
229
  compPlaceholder() {
@@ -429,12 +232,6 @@ export default {
429
232
  }
430
233
  return ' ';
431
234
  },
432
- showTooltip() {
433
- if (!this.tooltip || this.getLabel === '' || this.getLabel === null) {
434
- return false;
435
- }
436
- return (this.infoTooltipMessages.length > 0 || this.description !== '') && this.tooltip;
437
- },
438
235
  thousandSeparator() {
439
236
  return this.$store.getters.thousandSeparator;
440
237
  },
@@ -442,61 +239,195 @@ export default {
442
239
  return this.$store.getters.decimalSeparator;
443
240
  },
444
241
  visibleModel() {
445
- if (this.internalModel === null || this.internalModel === undefined || isNaN(this.internalModel)) return '';
242
+ if (this.internalModel === null || this.internalModel === undefined || isNaN(this.internalModel)) return ' ';
446
243
  const value = this.internalModel.toString();
244
+
447
245
  if (value.includes('.')) {
448
246
  const parts = value.split('.');
449
247
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, this.thousandSeparator);
450
248
  return parts.join(this.decimalSeparator);
451
249
  }
250
+
452
251
  return value.replace(/(\d)(?=(\d{3})+(?!\d))/g, `$1${this.thousandSeparator}`);
252
+ },
253
+ showTooltip() {
254
+ if (this.getLabel === '' || this.getLabel === null) {
255
+ return false;
256
+ }
257
+ return this.tooltipDescription || this.tooltip;
258
+ },
259
+ internalMin() {
260
+ const min = parseFloat(this.min);
261
+ return !isNaN(min) ? min : Number.MIN_SAFE_INTEGER;
262
+ },
263
+ internalMax() {
264
+ const max = parseFloat(this.max);
265
+ return !isNaN(max) ? max : Number.MAX_SAFE_INTEGER;
266
+ }
267
+ },
268
+ watch: {
269
+ value(v) {
270
+ this.setInternalModel(v);
271
+ },
272
+ internalModel(v) {
273
+ this.$emit('input', v);
274
+ },
275
+ internalError() {
276
+ this.valid = !this.internalError;
277
+ },
278
+ min() {
279
+ this.checkValidations(this.internalModel);
280
+ },
281
+ max() {
282
+ this.checkValidations(this.internalModel);
453
283
  }
454
284
  },
455
285
  created() {
286
+ // v-form injected
287
+ this.form && this.form.register(this);
288
+
289
+ this.initialValue = this.value;
456
290
  this.internalDecimals = parseInt(this.decimals);
457
- this.formatAndSetMinMax();
458
- if (this.noLazyModel) {
459
- this.firstLazyLoad = true;
460
- }
461
- if (this.integer) {
462
- this.initialValue = parseInt(this.value);
463
- } else {
464
- this.initialValue = parseFloat(this.value);
291
+ this.setInternalModel(this.value);
292
+ },
293
+ mounted() {
294
+ if (this.tooltip && this.$refs.tooltip) {
295
+ this.setTooltip();
465
296
  }
466
- this.initializeModel(this.value);
467
- this.getInfoTooltip();
468
297
  },
469
- watch: {
470
- value(val) {
471
- if (!this.noLazyModel && !this.firstLazyLoad) {
472
- this.clearMessages();
473
- this.initializeModel(val);
474
- this.firstLazyLoad = true;
298
+ methods: {
299
+ validate() {
300
+ this.checkValidations(this.internalModel);
301
+ return this.valid;
302
+ },
303
+ setTooltip() {
304
+ if (this.max < Number.MAX_SAFE_INTEGER) {
305
+ this.$refs.tooltip.pushMessage(this.$t('pui9.components.numberField.maxvaluemessage') + ': ' + this.max);
306
+ }
307
+
308
+ if (this.min > Number.MIN_SAFE_INTEGER) {
309
+ this.$refs.tooltip.pushMessage(this.$t('pui9.components.numberField.minvaluemessage') + ': ' + this.min);
310
+ }
311
+
312
+ if (this.integer) {
313
+ this.$refs.tooltip.pushMessage(this.$t('pui9.components.numberField.integermessage'));
314
+ }
315
+
316
+ if (this.decimals !== 999) {
317
+ this.$refs.tooltip.pushMessage(this.$t('pui9.components.numberField.maxdecimalsmessage') + ': ' + this.decimals);
318
+ }
319
+ },
320
+ onBlurText() {
321
+ this.showVisibleModel = true;
322
+ },
323
+ onFocusText() {
324
+ this.showVisibleModel = false;
325
+
326
+ setTimeout(() => {
327
+ this.$refs.puiNumberField.focus();
328
+ }, 5);
329
+ },
330
+ setInternalModel(value) {
331
+ if (typeof value == typeof String) {
332
+ value = value.replace(this.decimalSeparator, '.');
333
+ }
334
+
335
+ this.checkValidations(value);
336
+
337
+ if (isNaN(value)) {
338
+ this.internalModel = value;
339
+ } else if (value === null || value === '') {
340
+ this.internalModel = null;
341
+ } else if (this.integer) {
342
+ this.setInteger(value);
343
+ } else {
344
+ this.setFloat(value);
345
+ }
346
+ },
347
+ setInteger(value) {
348
+ this.internalModel = parseInt(value);
349
+ },
350
+ setFloat(value) {
351
+ if (this.internalDecimals) {
352
+ this.internalModel = this.truncateDecimal(parseFloat(value), this.internalDecimals);
353
+ } else {
354
+ this.internalModel = parseFloat(value);
355
+ }
356
+ },
357
+ checkValidations(value) {
358
+ this.clearMessages();
359
+
360
+ if (this.firstLoad) {
361
+ this.firstLoad = false;
362
+ return;
363
+ }
364
+
365
+ value && this.numberTypeValidation(value);
366
+ value && this.minMaxValidation(value);
367
+ value && this.wrongNumberValidation(value);
368
+ this.requiredFieldValidation(value);
369
+ },
370
+ clearMessages() {
371
+ this.internalError = false;
372
+ this.internalMessages = [];
373
+ this.internalErrorMessages = [];
374
+ },
375
+ requiredFieldValidation(value) {
376
+ if (this.required && (value === '' || value === null || value === undefined)) {
377
+ this.showRequiredMessage();
378
+ }
379
+ },
380
+ wrongNumberValidation(value) {
381
+ if (isNaN(value) && value !== '') {
382
+ this.showWrongNumberMessage();
383
+ }
384
+ },
385
+ numberTypeValidation(value) {
386
+ if (this.integer) {
387
+ let isInteger = this.checkInteger(value);
388
+ let parsedValue = parseInt(value);
389
+
390
+ if (!isInteger || isNaN(parsedValue)) {
391
+ this.showWrongNumberMessage();
392
+ }
475
393
  } else {
476
- this.internalModel = val;
477
- if (val) {
478
- this.clearMessages();
479
- this.checkMinMax(val);
394
+ let isFloat = this.checkFloat(value);
395
+ let parsedValue = parseInt(value);
396
+
397
+ if (!isFloat || isNaN(parsedValue)) {
398
+ this.showWrongNumberMessage();
480
399
  }
481
400
  }
482
401
  },
483
- required(val) {
484
- if (!val) {
485
- this.clearMessages();
486
- if (this.internalModel) {
487
- this.checkNumber(this.internalModel);
402
+ decimalsValidation(value) {
403
+ if (value && value.length > 0 && value.indexOf('.') !== -1) {
404
+ let parts = value.split('.');
405
+ let decimalPart = parts[1];
406
+
407
+ if (decimalPart && decimalPart.length > this.internalDecimals) {
408
+ this.internalError = true;
409
+ this.internalMessages.push(this.$t('pui9.components.numberField.maxdecimalsmessage') + ' ' + this.internalDecimals);
488
410
  }
489
411
  }
490
412
  },
491
- min() {
492
- this.clearMessages();
493
- this.formatAndSetMinMax();
494
- this.checkMinMax(this.value);
413
+ minMaxValidation(value) {
414
+ if (value < this.internalMin) {
415
+ this.internalError = true;
416
+ this.internalErrorMessages.push(this.$t('pui9.components.numberField.minvaluemessage') + ' ' + this.internalMin);
417
+ }
418
+
419
+ if (value > this.internalMax) {
420
+ this.internalError = true;
421
+ this.internalErrorMessages.push(this.$t('pui9.components.numberField.maxvaluemessage') + ' ' + this.internalMax);
422
+ }
495
423
  },
496
- max() {
497
- this.clearMessages();
498
- this.formatAndSetMinMax();
499
- this.checkMinMax(this.value);
424
+ showWrongNumberMessage() {
425
+ this.internalError = true;
426
+ this.internalErrorMessages = [this.$t('pui9.components.numberField.wrongnumber')];
427
+ },
428
+ showRequiredMessage() {
429
+ this.internalError = true;
430
+ this.internalErrorMessages = [this.$t('pui9.error.field_required')];
500
431
  }
501
432
  }
502
433
  };