@webitel/ui-sdk 24.12.159 → 24.12.161

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.12.159",
3
+ "version": "24.12.161",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -17,7 +17,10 @@
17
17
  @click="sort(col)"
18
18
  >
19
19
  <div class="wt-tree-table-th__content">
20
- <div v-if="key === 0 && selectable">
20
+ <div
21
+ v-if="key === 0 && selectable"
22
+ @click.stop
23
+ >
21
24
  <wt-checkbox
22
25
  :selected="isAllSelected"
23
26
  @change="selectAll"
@@ -90,10 +93,11 @@
90
93
  </template>
91
94
 
92
95
  <script setup lang="ts">
93
- import { computed, withDefaults } from 'vue';
96
+ import {computed, withDefaults} from 'vue';
94
97
 
95
98
  import { useWtTable } from '../../composables/useWtTable/useWtTable';
96
99
  import { getNextSortOrder } from '../../scripts/sortQueryAdapters';
100
+ import { WtCheckbox } from '../index';
97
101
  import type { WtTableHeader } from '../wt-table/types/WtTable.d.ts';
98
102
  import WtTreeTableRow from '../wt-tree-table-row/wt-tree-table-row.vue';
99
103
 
@@ -2,7 +2,6 @@
2
2
  <form class="dynamic-filter-config-form">
3
3
  <wt-select
4
4
  :clearable="false"
5
- :disabled="editMode"
6
5
  :label="t('webitelUI.filters.filterName')"
7
6
  :options="options"
8
7
  :value="filterName"
@@ -86,8 +85,6 @@ const filterName = ref();
86
85
  const filterLabel = ref('');
87
86
  const filterValue = ref();
88
87
 
89
- const editMode = !!props.filter;
90
-
91
88
  const invalid = ref(false);
92
89
 
93
90
  const onLabelValueUpdate = (val: string) => {
@@ -4,6 +4,7 @@
4
4
  v-if="model"
5
5
  :label="t('reusable.from')"
6
6
  :value="model.from"
7
+ :v="v$.model?.from"
7
8
  format="mm:ss"
8
9
  @input="handleInput('from', $event)"
9
10
  />
@@ -11,6 +12,7 @@
11
12
  v-if="model"
12
13
  :label="t('reusable.to')"
13
14
  :value="model.to"
15
+ :v="v$.model?.to"
14
16
  format="mm:ss"
15
17
  @input="handleInput('to', $event)"
16
18
  />
@@ -18,9 +20,11 @@
18
20
  </template>
19
21
 
20
22
  <script lang="ts" setup>
21
- import {useI18n} from "vue-i18n";
23
+ import { useVuelidate } from '@vuelidate/core';
24
+ import { computed, watch } from 'vue';
25
+ import { useI18n } from 'vue-i18n';
22
26
 
23
- const {t} = useI18n();
27
+ const { t } = useI18n();
24
28
 
25
29
  type ModelValue = {
26
30
  from: number;
@@ -29,6 +33,10 @@ type ModelValue = {
29
33
 
30
34
  const model = defineModel<ModelValue>();
31
35
 
36
+ const emit = defineEmits<{
37
+ 'update:invalid': [boolean];
38
+ }>();
39
+
32
40
  if (!model.value) {
33
41
  model.value = {
34
42
  from: 0,
@@ -36,11 +44,39 @@ if (!model.value) {
36
44
  };
37
45
  }
38
46
 
47
+ const isValueEmpty = () => {
48
+ return !!model?.value?.to || !!model?.value?.from;
49
+ };
50
+
51
+ const v$ = useVuelidate(
52
+ computed(() => ({
53
+ model: {
54
+ from: {
55
+ required: isValueEmpty,
56
+ },
57
+ to: {
58
+ required: isValueEmpty,
59
+ },
60
+ },
61
+ })),
62
+ { model },
63
+ { $autoDirty: true },
64
+ );
65
+ v$.value.$touch();
66
+
39
67
  const handleInput = (key: keyof ModelValue, value: number) => {
40
68
  const newValue = { ...model.value };
41
69
  newValue[key] = value;
42
70
  model.value = newValue;
43
71
  };
72
+
73
+ watch(
74
+ () => v$.value.$invalid,
75
+ (invalid) => {
76
+ emit('update:invalid', invalid);
77
+ },
78
+ { immediate: true },
79
+ );
44
80
  </script>
45
81
 
46
82
  <style lang="scss" scoped>
@@ -2,7 +2,7 @@
2
2
  <div class="rating-from-to-filter-value-field">
3
3
  <wt-input
4
4
  v-if="model"
5
- :label="`${t('webitelUI.filters.filterValueFrom')}:`"
5
+ :label="`${t('reusable.from')}:`"
6
6
  :number-min="0"
7
7
  :placeholder="t('webitelUI.filters.filterValue')"
8
8
  :v="v$.model?.from"
@@ -14,7 +14,7 @@
14
14
 
15
15
  <wt-input
16
16
  v-if="model"
17
- :label="`${t('reusable.to').toLowerCase()}:`"
17
+ :label="`${t('reusable.to')}:`"
18
18
  :number-min="0"
19
19
  :placeholder="t('webitelUI.filters.filterValue')"
20
20
  :v="v$.model?.to"
@@ -2,14 +2,18 @@
2
2
  <duration-filter-value-field
3
3
  :model-value="model"
4
4
  @update:model-value="model = $event"
5
+ @update:invalid="emit('update:invalid', $event)"
5
6
  />
6
7
  </template>
7
8
 
8
9
  <script lang="ts" setup>
9
10
  import DurationFilterValueField from '../_shared/durations/duration-filter-value-field.vue';
10
- import type {TalkDurationFilterModelValue} from "./TalkDurationFilter.d.ts";
11
+ import type { TalkDurationFilterModelValue } from './TalkDurationFilter.d.ts';
11
12
 
12
13
  const model = defineModel<TalkDurationFilterModelValue>();
14
+ const emit = defineEmits<{
15
+ 'update:invalid': [boolean];
16
+ }>();
13
17
  </script>
14
18
 
15
19
  <style lang="scss" scoped></style>
@@ -2,15 +2,18 @@
2
2
  <duration-filter-value-field
3
3
  :model-value="model"
4
4
  @update:model-value="model = $event"
5
+ @update:invalid="emit('update:invalid', $event)"
5
6
  />
6
7
  </template>
7
8
 
8
9
  <script lang="ts" setup>
9
10
  import DurationFilterValueField from '../_shared/durations/duration-filter-value-field.vue';
10
- import type {TotalDurationFilterModelValue} from "./TotalDurationFilter";
11
-
11
+ import type { TotalDurationFilterModelValue } from './TotalDurationFilter';
12
12
 
13
13
  const model = defineModel<TotalDurationFilterModelValue>();
14
+ const emit = defineEmits<{
15
+ 'update:invalid': [boolean];
16
+ }>();
14
17
  </script>
15
18
 
16
19
  <style lang="scss" scoped></style>