@webitel/ui-sdk 3.2.143 → 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 +5766 -19
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +5766 -19
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +27 -4
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/wt-search-bar/wt-search-bar.vue +68 -28
- package/src/locale/en/en.js +2 -0
- package/src/locale/i18n.js +1 -0
- package/src/locale/ru/ru.js +2 -0
- package/src/locale/ua/ua.js +2 -0
- package/src/mixins/validationMixin/useValidation.js +41 -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
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
<div
|
|
3
3
|
:class="{
|
|
4
4
|
'wt-search-bar--outline': outline,
|
|
5
|
+
'wt-search-bar--invalid': invalid,
|
|
5
6
|
}"
|
|
6
7
|
class="wt-search-bar"
|
|
7
8
|
>
|
|
8
9
|
<div class="wt-search-bar__wrapper">
|
|
10
|
+
<div class="wt-search-bar__search-icon">
|
|
11
|
+
<slot name="search-icon">
|
|
12
|
+
<wt-icon
|
|
13
|
+
icon="search"
|
|
14
|
+
></wt-icon>
|
|
15
|
+
</slot>
|
|
16
|
+
</div>
|
|
9
17
|
<input
|
|
10
18
|
:placeholder="placeholder || $t('webitelUI.searchBar.placeholder')"
|
|
11
19
|
:value="value"
|
|
@@ -14,27 +22,36 @@
|
|
|
14
22
|
@input="handleInput($event.target.value)"
|
|
15
23
|
@keyup="handleKeyup"
|
|
16
24
|
>
|
|
17
|
-
<div class="wt-search-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
<div class="wt-search-bar__icon-controls">
|
|
26
|
+
<wt-icon-btn
|
|
27
|
+
:class="{ 'hidden': !value }"
|
|
28
|
+
class="wt-search-bar__reset-icon-btn"
|
|
29
|
+
icon="close"
|
|
30
|
+
@click="handleInput('')"
|
|
31
|
+
></wt-icon-btn>
|
|
32
|
+
<wt-hint
|
|
33
|
+
v-if="hint"
|
|
34
|
+
>{{ hint }}
|
|
35
|
+
</wt-hint>
|
|
36
|
+
<slot name="additional-actions"></slot>
|
|
23
37
|
</div>
|
|
24
|
-
<wt-icon-btn
|
|
25
|
-
:class="{ 'hidden': !value }"
|
|
26
|
-
class="wt-search-bar__reset-icon-btn"
|
|
27
|
-
icon="close"
|
|
28
|
-
@click="handleInput('')"
|
|
29
|
-
></wt-icon-btn>
|
|
30
38
|
</div>
|
|
31
39
|
</div>
|
|
32
40
|
</template>
|
|
33
41
|
|
|
34
42
|
<script setup>
|
|
43
|
+
import { reactive } from 'vue';
|
|
35
44
|
import debounce from '../../scripts/debounce';
|
|
45
|
+
import { useValidation } from '../../mixins/validationMixin/useValidation';
|
|
36
46
|
|
|
37
47
|
const props = defineProps({
|
|
48
|
+
v: {
|
|
49
|
+
type: Object,
|
|
50
|
+
},
|
|
51
|
+
customValidators: {
|
|
52
|
+
type: Array,
|
|
53
|
+
default: () => [],
|
|
54
|
+
},
|
|
38
55
|
/**
|
|
39
56
|
* Current search-bar value (`v-model`)
|
|
40
57
|
*/
|
|
@@ -52,6 +69,10 @@ const props = defineProps({
|
|
|
52
69
|
type: Boolean,
|
|
53
70
|
default: false,
|
|
54
71
|
},
|
|
72
|
+
hint: {
|
|
73
|
+
type: String,
|
|
74
|
+
description: 'Adds hint icon + tooltip with text, passed as "hint" prop',
|
|
75
|
+
},
|
|
55
76
|
});
|
|
56
77
|
|
|
57
78
|
const emit = defineEmits([
|
|
@@ -60,6 +81,10 @@ const emit = defineEmits([
|
|
|
60
81
|
'enter',
|
|
61
82
|
]);
|
|
62
83
|
|
|
84
|
+
const { v, customValidators } = reactive(props);
|
|
85
|
+
|
|
86
|
+
const { invalid } = useValidation({ v, customValidators });
|
|
87
|
+
|
|
63
88
|
const search = debounce((value) => {
|
|
64
89
|
emit('search', value);
|
|
65
90
|
}, 1000);
|
|
@@ -89,25 +114,35 @@ function handleKeyup(event) {
|
|
|
89
114
|
.wt-search-bar {
|
|
90
115
|
cursor: text;
|
|
91
116
|
|
|
117
|
+
&.wt-search-bar--invalid {
|
|
118
|
+
.wt-search-bar__wrapper {
|
|
119
|
+
border-color: var(--false-color);
|
|
120
|
+
outline: none; // prevent outline overlapping false color
|
|
121
|
+
}
|
|
122
|
+
//deep needed to change color for icons in slot
|
|
123
|
+
:deep .wt-icon__icon {
|
|
124
|
+
fill: var(--false-color);
|
|
125
|
+
}
|
|
126
|
+
.wt-search-bar__input {
|
|
127
|
+
color: var(--false-color);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
92
131
|
.wt-search-bar__wrapper {
|
|
93
|
-
|
|
132
|
+
border: var(--input-border);
|
|
133
|
+
border-color: var(--form-border-color);
|
|
134
|
+
border-radius: var(--border-radius);
|
|
135
|
+
display: flex;
|
|
136
|
+
padding: calc(var(--spacing-xs) - 1px) var(--spacing-xs);
|
|
137
|
+
align-items: center;
|
|
138
|
+
gap: var(--spacing-xs);
|
|
94
139
|
}
|
|
95
140
|
|
|
96
141
|
.wt-search-bar__search-icon {
|
|
97
|
-
|
|
98
|
-
top: 50%;
|
|
99
|
-
left: var(--input-icon-margin);
|
|
100
|
-
transform: translateY(-50%);
|
|
101
|
-
line-height: 0;
|
|
102
|
-
pointer-events: none;
|
|
142
|
+
display: flex;
|
|
103
143
|
}
|
|
104
144
|
|
|
105
145
|
.wt-search-bar__reset-icon-btn {
|
|
106
|
-
position: absolute;
|
|
107
|
-
top: 50%;
|
|
108
|
-
right: var(--input-icon-margin);
|
|
109
|
-
transform: translateY(-50%);
|
|
110
|
-
|
|
111
146
|
.wt-search-bar:not(:focus-within) & {
|
|
112
147
|
pointer-events: none;
|
|
113
148
|
opacity: 0;
|
|
@@ -121,12 +156,11 @@ function handleKeyup(event) {
|
|
|
121
156
|
display: block;
|
|
122
157
|
box-sizing: border-box;
|
|
123
158
|
width: 100%;
|
|
124
|
-
padding:
|
|
159
|
+
padding: 0;
|
|
125
160
|
transition: var(--transition);
|
|
126
161
|
color: var(--form-input-color);
|
|
127
|
-
border:
|
|
128
|
-
|
|
129
|
-
border-radius: var(--border-radius);
|
|
162
|
+
border: none;
|
|
163
|
+
outline: none;
|
|
130
164
|
|
|
131
165
|
&:focus {
|
|
132
166
|
@include wt-placeholder('focus');
|
|
@@ -169,5 +203,11 @@ function handleKeyup(event) {
|
|
|
169
203
|
.wt-search-bar__input::-webkit-search-results-decoration {
|
|
170
204
|
display: none;
|
|
171
205
|
}
|
|
206
|
+
|
|
207
|
+
.wt-search-bar__icon-controls {
|
|
208
|
+
display: flex;
|
|
209
|
+
align-items: center;
|
|
210
|
+
gap: var(--spacing-xs);
|
|
211
|
+
}
|
|
172
212
|
}
|
|
173
213
|
</style>
|
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/i18n.js
CHANGED
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: {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { useI18n } from 'vue-i18n';
|
|
3
|
+
|
|
4
|
+
export function useValidation({ v, customValidators }) {
|
|
5
|
+
const { t } = useI18n();
|
|
6
|
+
const isValidation = computed(() => !!v && !!Object.keys(v).length);
|
|
7
|
+
const invalid = computed(() => isValidation.value && v.$error);
|
|
8
|
+
|
|
9
|
+
const validationText = computed(() => {
|
|
10
|
+
let validationText = '';
|
|
11
|
+
if (isValidation && invalid) {
|
|
12
|
+
if (v.required?.$invalid) validationText = t('validation.required');
|
|
13
|
+
else if (v.numeric?.$invalid) validationText = t('validation.numeric');
|
|
14
|
+
else if (v.email?.$invalid) validationText = t('validation.email');
|
|
15
|
+
else if (v.gatewayHostValidator?.$invalid) validationText = t('validation.gatewayHostValidator');
|
|
16
|
+
else if (v.ipValidator?.$invalid) validationText = t('validation.ipValidator');
|
|
17
|
+
else if (v.macValidator?.$invalid) validationText = t('validation.macValidator');
|
|
18
|
+
else if (v.minValue?.$invalid) validationText = `${t('validation.minValue')} ${v.minValue.$params.min}`;
|
|
19
|
+
else if (v.maxValue?.$invalid) validationText = `${t('validation.maxValue')} ${v.maxValue.$params.max}`;
|
|
20
|
+
else if (v.sipAccountValidator?.$invalid) validationText = t('validation.sipAccountValidator');
|
|
21
|
+
else if (v.minLength?.$invalid) validationText = `${t('validation.minLength')} ${v.minLength.$params.min}`;
|
|
22
|
+
else if (v.url?.$invalid) validationText = `${t('validation.url')}`;
|
|
23
|
+
else if (v.regExpValidator?.$invalid) validationText = `${t('validation.regExpValidator')}`;
|
|
24
|
+
else if (v.sameAs?.$invalid) validationText = `${t('validation.sameAs')}`;
|
|
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')}`;
|
|
28
|
+
}
|
|
29
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
30
|
+
for (const { name, text } of customValidators) {
|
|
31
|
+
if (v[name]?.$invalid) validationText = text;
|
|
32
|
+
}
|
|
33
|
+
return validationText;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
isValidation,
|
|
38
|
+
invalid,
|
|
39
|
+
validationText,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -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;
|