@webitel/ui-sdk 24.4.36 → 24.4.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "24.4.36",
3
+ "version": "24.4.37",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -344,6 +344,7 @@ export default {
344
344
  score: 'Score',
345
345
  },
346
346
  clearSelection: 'Clear selection',
347
+ scoreInputTooltip: 'Value should be more than {min} and less than {max}',
347
348
  },
348
349
  deleteConfirmationPopup: {
349
350
  title: 'Confirm deletion',
@@ -342,6 +342,7 @@ export default {
342
342
  score: 'Бал',
343
343
  },
344
344
  clearSelection: 'Очистить выбор',
345
+ scoreInputTooltip: 'Значение должно быть не меньше {min} и не больше {max}',
345
346
  },
346
347
  deleteConfirmationPopup: {
347
348
  title: 'Подтвердите удаление',
@@ -342,6 +342,7 @@ export default {
342
342
  score: 'Бал',
343
343
  },
344
344
  clearSelection: 'Очистити вибір',
345
+ scoreInputTooltip: 'Значення повинно бути не менше {min} та не більше {max}',
345
346
  },
346
347
  deleteConfirmationPopup: {
347
348
  title: 'Підтвердіть видалення',
@@ -16,7 +16,7 @@ describe('AuditFormQuestionOptionsWriteRow', () => {
16
16
  option: {},
17
17
  },
18
18
  });
19
- const deleteBtn = wrapper.findComponent({ name: 'wt-icon-btn' });
19
+ const deleteBtn = wrapper.findComponent('.audit-form-question-options-write-row__tooltip .wt-icon-btn');
20
20
  expect(deleteBtn.attributes().icon).toBe('bucket');
21
21
  deleteBtn.vm.$emit('click');
22
22
  expect(wrapper.emitted().delete).toBeTruthy();
@@ -9,10 +9,13 @@
9
9
  />
10
10
  <wt-input
11
11
  :label="$t('webitelUI.auditForm.score', 1)"
12
+ :label-props="{ hint: $t('scorecards.scoreInputTooltip', { min: minScore, max: maxScore}), hintPosition: 'right' }"
12
13
  :value="option.score"
13
14
  :v="v$.option.score"
15
+ :number-min="minScore"
16
+ :number-max="maxScore"
14
17
  type="number"
15
- @input="emit('update:option', { name: option.name, score: $event })"
18
+ @input="changeScore"
16
19
  />
17
20
  <wt-tooltip class="audit-form-question-options-write-row__tooltip">
18
21
  <template #activator>
@@ -55,6 +58,9 @@ const emit = defineEmits([
55
58
  // is needed for useVuelidate, because props.question/props.result isn't reactive
56
59
  const { option } = toRefs(props);
57
60
 
61
+ const minScore = 0;
62
+ const maxScore = 10;
63
+
58
64
  const v$ = useVuelidate(
59
65
  computed(() => (
60
66
  {
@@ -62,8 +68,8 @@ const v$ = useVuelidate(
62
68
  name: { required },
63
69
  score: {
64
70
  required,
65
- minValue: minValue(0),
66
- maxValue: maxValue(10),
71
+ minValue: minValue(minScore),
72
+ maxValue: maxValue(maxScore),
67
73
  decimalValidator: decimalValidator(2),
68
74
  },
69
75
  },
@@ -72,6 +78,12 @@ const v$ = useVuelidate(
72
78
  { $autoDirty: true },
73
79
  );
74
80
 
81
+
82
+ function changeScore(value) {
83
+ const score = value > maxScore ? maxScore : Number(Math.abs(value)); // to prevent -1, 000 or string value because of this task https://webitel.atlassian.net/browse/WTEL-4505
84
+ emit('update:option', { name: props.option.name, score });
85
+ }
86
+
75
87
  // init validation
76
88
  onMounted(() => v$.value.$touch());
77
89
  </script>
@@ -8,8 +8,9 @@
8
8
  :value="question.min"
9
9
  :v="v$.question.min"
10
10
  :number-min="0"
11
- :number-max="19"
11
+ :number-max="9"
12
12
  :label="$t('reusable.from')"
13
+ :label-props="{ hint: $t('scorecards.scoreInputTooltip', { min: '0', max: '9'}), hintPosition: 'right' }"
13
14
  type="number"
14
15
  required
15
16
  @input="updateQuestion({ path: 'min', value: $event })"
@@ -18,8 +19,9 @@
18
19
  :value="question.max"
19
20
  :v="v$.question.max"
20
21
  :number-min="1"
21
- :number-max="20"
22
+ :number-max="10"
22
23
  :label="$t('reusable.to')"
24
+ :label-props="{ hint: $t('scorecards.scoreInputTooltip', { min: '1', max: '10'}), hintPosition: 'right' }"
23
25
  type="number"
24
26
  required
25
27
  @input="updateQuestion({ path: 'max', value: $event })"
@@ -109,7 +111,8 @@ const scoreRange = computed(() => {
109
111
  const isResult = computed(() => !isEmpty(props.result));
110
112
 
111
113
  function updateQuestion({ path, value }) {
112
- emit('change:question', updateObject({ obj: props.question, path, value }));
114
+ const number = value > 10 ? 10 : Number(Math.abs(value)); // to prevent -1, 000 or string value because of this task https://webitel.atlassian.net/browse/WTEL-4505
115
+ emit('change:question', updateObject({ obj: props.question, path, value: number }));
113
116
  }
114
117
 
115
118
  // init validation