@webitel/ui-sdk 3.2.144 → 3.2.145
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/dist/ui-sdk.common.js +2 -2
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.umd.js +2 -2
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +2 -2
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/locale/en/en.js +2 -0
- package/src/locale/ru/ru.js +2 -0
- package/src/locale/ua/ua.js +2 -0
- package/src/mixins/validationMixin/useValidation.js +2 -0
- package/src/mixins/validationMixin/validationMixin.js +2 -0
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue +7 -2
- package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +3 -1
- package/src/validators/decimalValidator.js +9 -0
package/package.json
CHANGED
package/src/locale/en/en.js
CHANGED
|
@@ -247,6 +247,8 @@ export default {
|
|
|
247
247
|
url: 'Should look like url',
|
|
248
248
|
regExpValidator: 'This regular expression is not valid',
|
|
249
249
|
domainValidator: 'Incorrect domain',
|
|
250
|
+
decimalValidator: 'Decimal precision should be no more than { count } places',
|
|
251
|
+
integer: 'The field should contain only whole numbers',
|
|
250
252
|
},
|
|
251
253
|
webitelUI: {
|
|
252
254
|
searchBar: {
|
package/src/locale/ru/ru.js
CHANGED
|
@@ -245,6 +245,8 @@ export default {
|
|
|
245
245
|
url: 'Необходимо ввести корректный url-адрес',
|
|
246
246
|
regExpValidator: 'Не правильное регулярное выражение',
|
|
247
247
|
domainValidator: 'Неправильный домен',
|
|
248
|
+
decimalValidator: 'Количество десятичных знаков не должно быть больше { count }',
|
|
249
|
+
integer: 'Поле должно содержать только целые числа',
|
|
248
250
|
},
|
|
249
251
|
webitelUI: {
|
|
250
252
|
searchBar: {
|
package/src/locale/ua/ua.js
CHANGED
|
@@ -245,6 +245,8 @@ export default {
|
|
|
245
245
|
url: 'Необхідно ввести правильну url-адресу',
|
|
246
246
|
regExpValidator: 'Не правильний регулярний вираз',
|
|
247
247
|
domainValidator: 'Невірний домен',
|
|
248
|
+
decimalValidator: 'Кількість десяткових знаків не повинна бути більше { count }',
|
|
249
|
+
integer: 'Поле повинно містити лише цілі числа',
|
|
248
250
|
},
|
|
249
251
|
webitelUI: {
|
|
250
252
|
searchBar: {
|
|
@@ -23,6 +23,8 @@ export function useValidation({ v, customValidators }) {
|
|
|
23
23
|
else if (v.regExpValidator?.$invalid) validationText = `${t('validation.regExpValidator')}`;
|
|
24
24
|
else if (v.sameAs?.$invalid) validationText = `${t('validation.sameAs')}`;
|
|
25
25
|
else if (v.domainValidator?.$invalid) validationText = `${t('validation.domainValidator')}`;
|
|
26
|
+
else if (v.decimalValidator?.$invalid) validationText = `${t('validation.decimalValidator')} ${v.decimalValidator.$params.count}`;
|
|
27
|
+
else if (v.integer?.$invalid) validationText = `${t('validation.integer')}`;
|
|
26
28
|
}
|
|
27
29
|
// eslint-disable-next-line no-restricted-syntax
|
|
28
30
|
for (const { name, text } of customValidators) {
|
|
@@ -33,6 +33,8 @@ export default {
|
|
|
33
33
|
else if (this.v.regExpValidator?.$invalid) validationText = `${this.$t('validation.regExpValidator')}`;
|
|
34
34
|
else if (this.v.sameAs?.$invalid) validationText = `${this.$t('validation.sameAs')}`;
|
|
35
35
|
else if (this.v.domainValidator?.$invalid) validationText = `${this.$t('validation.domainValidator')}`;
|
|
36
|
+
else if (this.v.decimalValidator?.$invalid) validationText = `${this.$t('validation.decimalValidator')} ${this.v.decimalValidator.$params.count}`;
|
|
37
|
+
else if (this.v.integer?.$invalid) validationText = `${this.$t('validation.integer')}`;
|
|
36
38
|
}
|
|
37
39
|
// eslint-disable-next-line no-restricted-syntax
|
|
38
40
|
for (const { name, text } of this.customValidators) {
|
package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
type="number"
|
|
15
15
|
@input="emit('update:option', { name: option.name, score: $event })"
|
|
16
16
|
></wt-input>
|
|
17
|
-
<wt-tooltip>
|
|
17
|
+
<wt-tooltip class="audit-form-question-options-write-row__tooltip">
|
|
18
18
|
<template v-slot:activator>
|
|
19
19
|
<wt-icon-btn
|
|
20
20
|
:disabled="first"
|
|
@@ -34,6 +34,7 @@ import { computed, onMounted, toRefs } from 'vue';
|
|
|
34
34
|
import WtTooltip from '../../../../../components/wt-tooltip/wt-tooltip.vue';
|
|
35
35
|
import WtIconBtn from '../../../../../components/wt-icon-btn/wt-icon-btn.vue';
|
|
36
36
|
import WtInput from '../../../../../components/wt-input/wt-input.vue';
|
|
37
|
+
import decimalValidator from '../../../../../validators/decimalValidator';
|
|
37
38
|
|
|
38
39
|
const props = defineProps({
|
|
39
40
|
option: {
|
|
@@ -63,6 +64,7 @@ const v$ = useVuelidate(
|
|
|
63
64
|
required,
|
|
64
65
|
minValue: minValue(0),
|
|
65
66
|
maxValue: maxValue(10),
|
|
67
|
+
decimalValidator: decimalValidator(2),
|
|
66
68
|
},
|
|
67
69
|
},
|
|
68
70
|
})),
|
|
@@ -77,8 +79,11 @@ onMounted(() => v$.value.$touch());
|
|
|
77
79
|
<style lang="scss" scoped>
|
|
78
80
|
.audit-form-question-options-write-row {
|
|
79
81
|
display: grid;
|
|
80
|
-
align-items: center;
|
|
81
82
|
grid-template-columns: 3fr 1fr 24px;
|
|
82
83
|
gap: var(--spacing-sm);
|
|
84
|
+
|
|
85
|
+
&__tooltip {
|
|
86
|
+
padding-top: var(--spacing-md);
|
|
87
|
+
}
|
|
83
88
|
}
|
|
84
89
|
</style>
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
|
|
44
44
|
<script setup>
|
|
45
45
|
import { useVuelidate } from '@vuelidate/core';
|
|
46
|
-
import { maxValue, minValue, required } from '@vuelidate/validators';
|
|
46
|
+
import { maxValue, minValue, required, integer } from '@vuelidate/validators';
|
|
47
47
|
import { computed, onMounted, toRefs } from 'vue';
|
|
48
48
|
import isEmpty from '../../../../../scripts/isEmpty';
|
|
49
49
|
import updateObject from '../../../../../scripts/updateObject';
|
|
@@ -81,11 +81,13 @@ const v$ = useVuelidate(
|
|
|
81
81
|
minValue: minValue(0),
|
|
82
82
|
maxValue: maxValue(9),
|
|
83
83
|
required,
|
|
84
|
+
integer,
|
|
84
85
|
},
|
|
85
86
|
max: {
|
|
86
87
|
minValue: minValue(1),
|
|
87
88
|
maxValue: maxValue(10),
|
|
88
89
|
required,
|
|
90
|
+
integer,
|
|
89
91
|
},
|
|
90
92
|
},
|
|
91
93
|
})),
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* [WTEL-3791] */
|
|
2
|
+
/* Check value is an integer or has n* decimal places */
|
|
3
|
+
import { helpers } from '@vuelidate/validators';
|
|
4
|
+
|
|
5
|
+
const decimalValidator = (count) => helpers.withParams(
|
|
6
|
+
{ count },
|
|
7
|
+
(value) => value % 1 == 0 || value.toString().split('.')[1].length <= count);
|
|
8
|
+
|
|
9
|
+
export default decimalValidator;
|