@webitel/ui-sdk 24.12.102 → 24.12.115

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 (86) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/{plyr.min-ClXVuhkx.js → plyr.min-BRLz1cd6.js} +1 -1
  3. package/dist/ui-sdk.css +1 -1
  4. package/dist/ui-sdk.js +9707 -9471
  5. package/dist/ui-sdk.umd.cjs +19 -19
  6. package/package.json +1 -1
  7. package/src/api/clients/roles/roles.js +1 -1
  8. package/src/components/wt-tooltip/wt-tooltip.vue +10 -6
  9. package/src/composables/useAccessControl/v2/createUserAccessControl.ts +16 -6
  10. package/src/composables/useAccessControl/v2/types/CreateUserAccessControl.d.ts +2 -1
  11. package/src/composables/useWtTable/useWtTable.js +19 -20
  12. package/src/css/styleguide/placeholder/_placeholder.scss +0 -2
  13. package/src/enums/index.js +7 -7
  14. package/src/locale/en/en.js +80 -0
  15. package/src/locale/ru/ru.js +97 -0
  16. package/src/locale/ua/ua.js +97 -0
  17. package/src/modules/Filters/v2/filters/classes/FiltersManager.ts +3 -3
  18. package/src/modules/Filters/v2/filters/components/config/dynamic-filter-config-form-label.vue +2 -2
  19. package/src/modules/Filters/v2/filters/components/config/dynamic-filter-config-form.vue +13 -10
  20. package/src/modules/Filters/v2/filters/components/dynamic-filter-add-action.vue +17 -8
  21. package/src/modules/Filters/v2/filters/components/enums/amd-result-options.ts +38 -0
  22. package/src/modules/Filters/v2/filters/components/enums/boolean-options.ts +16 -0
  23. package/src/modules/Filters/v2/filters/components/enums/direction-options.ts +20 -0
  24. package/src/modules/Filters/v2/filters/components/enums/hangup-cause-options.ts +265 -0
  25. package/src/modules/Filters/v2/filters/components/enums/tag-options.ts +8 -0
  26. package/src/modules/Filters/v2/filters/components/preview/dynamic-filter-preview-info.vue +14 -27
  27. package/src/modules/Filters/v2/filters/components/preview/dynamic-filter-preview.vue +15 -6
  28. package/src/modules/Filters/v2/filters/components/values/_shared/durations/duration-filter-value-field.vue +48 -0
  29. package/src/modules/Filters/v2/filters/components/values/_shared/has-options/has-option-filter-value-field.vue +29 -0
  30. package/src/modules/Filters/v2/filters/components/values/agent/agent-filter-value-field.vue +57 -0
  31. package/src/modules/Filters/v2/filters/components/values/agent/agent-filter-value-preview.vue +32 -0
  32. package/src/modules/Filters/v2/filters/components/values/agent/config.js +4 -0
  33. package/src/modules/Filters/v2/filters/components/values/amd-result/amd-result-filter-value-field.vue +52 -0
  34. package/src/modules/Filters/v2/filters/components/values/amd-result/amd-result-filter-value-preview.vue +20 -0
  35. package/src/modules/Filters/v2/filters/components/values/cause/cause-filter-value-field.vue +52 -0
  36. package/src/modules/Filters/v2/filters/components/values/cause/cause-filter-value-preview.vue +19 -0
  37. package/src/modules/Filters/v2/filters/components/values/contact/config.js +4 -0
  38. package/src/modules/Filters/v2/filters/components/values/contact/contact-filter-value-field.vue +56 -0
  39. package/src/modules/Filters/v2/filters/components/values/contact/contact-filter-value-preview.vue +32 -0
  40. package/src/modules/Filters/v2/filters/components/values/created-at-from/created-at-from-filter-value-field.vue +23 -0
  41. package/src/modules/Filters/v2/filters/components/values/created-at-from/created-at-from-filter-value-preview.vue +15 -0
  42. package/src/modules/Filters/v2/filters/components/values/created-at-to/created-at-to-filter-value-field.vue +23 -0
  43. package/src/modules/Filters/v2/filters/components/values/created-at-to/created-at-to-filter-value-preview.vue +15 -0
  44. package/src/modules/Filters/v2/filters/components/values/direction/direction-filter-value-field.vue +51 -0
  45. package/src/modules/Filters/v2/filters/components/values/direction/direction-filter-value-preview.vue +17 -0
  46. package/src/modules/Filters/v2/filters/components/values/gateway/config.js +4 -0
  47. package/src/modules/Filters/v2/filters/components/values/gateway/gateway-filter-value-field.vue +56 -0
  48. package/src/modules/Filters/v2/filters/components/values/gateway/gateway-filter-value-preview.vue +32 -0
  49. package/src/modules/Filters/v2/filters/components/values/grantee/config.js +4 -0
  50. package/src/modules/Filters/v2/filters/components/values/grantee/grantee-filter-value-field.vue +56 -0
  51. package/src/modules/Filters/v2/filters/components/values/grantee/grantee-filter-value-preview.vue +32 -0
  52. package/src/modules/Filters/v2/filters/components/values/has-file/has-file-filter-value-field.vue +43 -0
  53. package/src/modules/Filters/v2/filters/components/values/has-file/has-file-filter-value-preview.vue +22 -0
  54. package/src/modules/Filters/v2/filters/components/values/has-transcription/has-transcription-filter-value-field.vue +43 -0
  55. package/src/modules/Filters/v2/filters/components/values/has-transcription/has-transcription-filter-value-preview.vue +22 -0
  56. package/src/modules/Filters/v2/filters/components/values/index.js +87 -0
  57. package/src/modules/Filters/v2/filters/components/values/queue/config.js +4 -0
  58. package/src/modules/Filters/v2/filters/components/values/queue/queue-filter-value-field.vue +56 -0
  59. package/src/modules/Filters/v2/filters/components/values/queue/queue-filter-value-preview.vue +32 -0
  60. package/src/modules/Filters/v2/filters/components/values/rated/rated-filter-value-field.vue +43 -0
  61. package/src/modules/Filters/v2/filters/components/values/rated/rated-filter-value-preview.vue +22 -0
  62. package/src/modules/Filters/v2/filters/components/values/rated-by/config.js +4 -0
  63. package/src/modules/Filters/v2/filters/components/values/rated-by/rated-by-filter-value-field.vue +56 -0
  64. package/src/modules/Filters/v2/filters/components/values/rated-by/rated-by-filter-value-preview.vue +32 -0
  65. package/src/modules/Filters/v2/filters/components/values/score/score-from-to-filter-value-field.vue +99 -0
  66. package/src/modules/Filters/v2/filters/components/values/score/score-from-to-filter-value-preview.vue +37 -0
  67. package/src/modules/Filters/v2/filters/components/values/tag/tag-filter-value-field.vue +52 -0
  68. package/src/modules/Filters/v2/filters/components/values/tag/tag-filter-value-preview.vue +18 -0
  69. package/src/modules/Filters/v2/filters/components/values/talk-duration/talk-duration-filter-value-field.vue +19 -0
  70. package/src/modules/Filters/v2/filters/components/values/talk-duration/talk-duration-filter-value-preview.vue +44 -0
  71. package/src/modules/Filters/v2/filters/components/values/team/config.js +4 -0
  72. package/src/modules/Filters/v2/filters/components/values/team/team-filter-value-field.vue +56 -0
  73. package/src/modules/Filters/v2/filters/components/values/team/team-filter-value-preview.vue +32 -0
  74. package/src/modules/Filters/v2/filters/components/values/total-duration/total-duration-filter-value-field.vue +19 -0
  75. package/src/modules/Filters/v2/filters/components/values/total-duration/total-duration-filter-value-preview.vue +44 -0
  76. package/src/modules/Filters/v2/filters/components/values/user/config.js +4 -0
  77. package/src/modules/Filters/v2/filters/components/values/user/user-filter-value-field.vue +56 -0
  78. package/src/modules/Filters/v2/filters/components/values/user/user-filter-value-preview.vue +32 -0
  79. package/src/modules/Filters/v2/filters/components/values/variable/variable-filter-value-field.vue +51 -0
  80. package/src/modules/Filters/v2/filters/components/values/variable/variable-filter-value-preview.vue +36 -0
  81. package/src/modules/Filters/v2/filters/types/Filter.d.ts +5 -0
  82. package/src/modules/Filters/v2/table/createTableStore.store.ts +12 -1
  83. package/src/modules/Filters/v2/types/tableStore.types.ts +1 -0
  84. package/src/modules/Filters/v2/filters/components/values/users/config.js +0 -4
  85. package/src/modules/Filters/v2/filters/components/values/users/user-filter-value-field.vue +0 -35
  86. package/src/modules/Filters/v2/filters/components/values/users/user-filter-value-preview.vue +0 -13
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <has-option-filter-value-field
3
+ :value="model"
4
+ :v="v$.model"
5
+ @update:model-value="model = $event"
6
+ />
7
+ </template>
8
+
9
+ <script lang="ts" setup>
10
+ import { useVuelidate } from '@vuelidate/core';
11
+ import { required } from '@vuelidate/validators';
12
+ import { computed, watch } from 'vue';
13
+
14
+ import HasOptionFilterValueField from '../_shared/has-options/has-option-filter-value-field.vue';
15
+
16
+ const model = defineModel<string>();
17
+
18
+ const v$ = useVuelidate(
19
+ computed(() => ({
20
+ model: {
21
+ required,
22
+ },
23
+ })),
24
+ { model },
25
+ { $autoDirty: true },
26
+ );
27
+
28
+ v$.value.$touch();
29
+
30
+ const emit = defineEmits<{
31
+ 'update:invalid': [boolean];
32
+ }>();
33
+
34
+ watch(
35
+ () => v$.value.$invalid,
36
+ (invalid) => {
37
+ emit('update:invalid', invalid);
38
+ },
39
+ { immediate: true },
40
+ );
41
+ </script>
42
+
43
+ <style lang="scss" scoped></style>
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <div>{{ localeValue }}</div>
3
+ </template>
4
+
5
+ <script lang="ts" setup>
6
+ import { computed } from 'vue';
7
+ import { useI18n } from 'vue-i18n';
8
+
9
+ import { BooleanOptions } from '../../enums/boolean-options';
10
+
11
+ const props = defineProps<{
12
+ value: boolean;
13
+ }>();
14
+ const { t } = useI18n();
15
+
16
+ const localeValue = computed(() => {
17
+ const match = BooleanOptions.find((el) => el.value === props.value);
18
+ return match ? t(match.locale) : '';
19
+ });
20
+ </script>
21
+
22
+ <style lang="scss" scoped></style>
@@ -0,0 +1,87 @@
1
+ import AgentFilter from './agent/agent-filter-value-field.vue';
2
+ import AgentFilterPreview from './agent/agent-filter-value-preview.vue';
3
+ import AmdResultFilter from './amd-result/amd-result-filter-value-field.vue';
4
+ import AmdResultFilterPreview from './amd-result/amd-result-filter-value-preview.vue';
5
+ import CauseFilter from './cause/cause-filter-value-field.vue';
6
+ import CauseFilterPreview from './cause/cause-filter-value-preview.vue';
7
+ import ContactFilter from './contact/contact-filter-value-field.vue';
8
+ import ContactFilterPreview from './contact/contact-filter-value-preview.vue';
9
+ import CreatedAtFromFilter from './created-at-from/created-at-from-filter-value-field.vue';
10
+ import CreatedAtFromFilterPreview from './created-at-from/created-at-from-filter-value-preview.vue';
11
+ import CreatedAtToFilter from './created-at-to/created-at-to-filter-value-field.vue';
12
+ import CreatedAtToFilterPreview from './created-at-to/created-at-to-filter-value-preview.vue';
13
+ import DirectionFilter from './direction/direction-filter-value-field.vue';
14
+ import DirectionFilterPreview from './direction/direction-filter-value-preview.vue';
15
+ import GatewayFilter from './gateway/gateway-filter-value-field.vue';
16
+ import GatewayFilterPreview from './gateway/gateway-filter-value-preview.vue';
17
+ import GranteeFilter from './grantee/grantee-filter-value-field.vue';
18
+ import GranteeFilterPreview from './grantee/grantee-filter-value-preview.vue';
19
+ import HasFileFilter from './has-file/has-file-filter-value-field.vue';
20
+ import HasFileFilterPreview from './has-file/has-file-filter-value-preview.vue';
21
+ import HasTranscriptionFilter from './has-transcription/has-transcription-filter-value-field.vue';
22
+ import HasTranscriptionFilterPreview from './has-transcription/has-transcription-filter-value-preview.vue';
23
+ import QueueFilter from './queue/queue-filter-value-field.vue';
24
+ import QueueFilterPreview from './queue/queue-filter-value-preview.vue';
25
+ import RatedFilter from './rated/rated-filter-value-field.vue';
26
+ import RatedFilterPreview from './rated/rated-filter-value-preview.vue';
27
+ import RatedByFilter from './rated-by/rated-by-filter-value-field.vue';
28
+ import RatedByFilterPreview from './rated-by/rated-by-filter-value-preview.vue';
29
+ import ScoreFilter from './score/score-from-to-filter-value-field.vue';
30
+ import ScoreFilterPreview from './score/score-from-to-filter-value-preview.vue';
31
+ import TagFilter from './tag/tag-filter-value-field.vue';
32
+ import TagFilterPreview from './tag/tag-filter-value-preview.vue';
33
+ import TalkDuration from './talk-duration/talk-duration-filter-value-field.vue';
34
+ import TalkDurationPreview from './talk-duration/talk-duration-filter-value-preview.vue';
35
+ import TeamFilter from './team/team-filter-value-field.vue';
36
+ import TeamFilterPreview from './team/team-filter-value-preview.vue';
37
+ import TotalDurationFilter from './total-duration/total-duration-filter-value-field.vue';
38
+ import TotalDurationFilterPreview from './total-duration/total-duration-filter-value-preview.vue';
39
+ import UserFilter from './user/user-filter-value-field.vue';
40
+ import UserFilterPreview from './user/user-filter-value-preview.vue';
41
+ import VariableFilter from './variable/variable-filter-value-field.vue';
42
+ import VariableFilterPreview from './variable/variable-filter-value-preview.vue';
43
+
44
+ export {
45
+ AgentFilter,
46
+ AgentFilterPreview,
47
+ AmdResultFilter,
48
+ AmdResultFilterPreview,
49
+ CauseFilter,
50
+ CauseFilterPreview,
51
+ ContactFilter,
52
+ ContactFilterPreview,
53
+ CreatedAtFromFilter,
54
+ CreatedAtFromFilterPreview,
55
+ CreatedAtToFilter,
56
+ CreatedAtToFilterPreview,
57
+ DirectionFilter,
58
+ DirectionFilterPreview,
59
+ GatewayFilter,
60
+ GatewayFilterPreview,
61
+ GranteeFilter,
62
+ GranteeFilterPreview,
63
+ HasFileFilter,
64
+ HasFileFilterPreview,
65
+ HasTranscriptionFilter,
66
+ HasTranscriptionFilterPreview,
67
+ QueueFilter,
68
+ QueueFilterPreview,
69
+ RatedByFilter,
70
+ RatedByFilterPreview,
71
+ RatedFilter,
72
+ RatedFilterPreview,
73
+ ScoreFilter,
74
+ ScoreFilterPreview,
75
+ TagFilter,
76
+ TagFilterPreview,
77
+ TalkDuration,
78
+ TalkDurationPreview,
79
+ TeamFilter,
80
+ TeamFilterPreview,
81
+ TotalDurationFilter,
82
+ TotalDurationFilterPreview,
83
+ UserFilter,
84
+ UserFilterPreview,
85
+ VariableFilter,
86
+ VariableFilterPreview,
87
+ };
@@ -0,0 +1,4 @@
1
+ import QueuesAPI from '../../../../../../../api/clients/queues/queues.js';
2
+
3
+ export const searchMethod = QueuesAPI.getLookup;
4
+ export const localePath = '';
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <wt-select
3
+ :close-on-select="false"
4
+ :label="t('webitelUI.filters.filterValue')"
5
+ :search-method="searchMethod"
6
+ :value="model"
7
+ :v="v$.model"
8
+ multiple
9
+ use-value-from-options-by-prop="id"
10
+ @input="handleInput"
11
+ />
12
+ </template>
13
+
14
+ <script lang="ts" setup>
15
+ import { useVuelidate } from '@vuelidate/core';
16
+ import { required } from '@vuelidate/validators';
17
+ import { computed, watch } from 'vue';
18
+ import { useI18n } from 'vue-i18n';
19
+
20
+ import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
21
+ import { searchMethod } from './config.js';
22
+
23
+ type ModelValue = number[];
24
+
25
+ const model = defineModel<ModelValue>();
26
+
27
+ const emit = defineEmits<{
28
+ 'update:invalid': [boolean];
29
+ }>();
30
+ const { t } = useI18n();
31
+
32
+ const v$ = useVuelidate(
33
+ computed(() => ({
34
+ model: {
35
+ required,
36
+ },
37
+ })),
38
+ { model },
39
+ { $autoDirty: true },
40
+ );
41
+ v$.value.$touch();
42
+
43
+ watch(
44
+ () => v$.value.$invalid,
45
+ (invalid) => {
46
+ emit('update:invalid', invalid);
47
+ },
48
+ { immediate: true },
49
+ );
50
+
51
+ const handleInput = (value: ModelValue) => {
52
+ model.value = value;
53
+ };
54
+ </script>
55
+
56
+ <style lang="scss" scoped></style>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <ul
3
+ v-if="localValue">
4
+ <li
5
+ v-for="({ name }, index) of localValue"
6
+ :key="index"
7
+ >
8
+ {{ name }}
9
+ </li>
10
+ </ul>
11
+ </template>
12
+
13
+ <script lang="ts" setup>
14
+ import { searchMethod } from './config.js';
15
+ import {ref} from 'vue';
16
+
17
+ const props = defineProps<{
18
+ value: number[];
19
+ }>();
20
+
21
+ const localValue = ref([]);
22
+
23
+ const getLocalValue = async () => {
24
+ const { items } = await searchMethod({id: props.value});
25
+ localValue.value = items;
26
+ };
27
+
28
+ getLocalValue();
29
+ </script>
30
+
31
+ <style lang="scss" scoped>
32
+ </style>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <has-option-filter-value-field
3
+ :value="model"
4
+ :v="v$.model"
5
+ @update:model-value="model = $event"
6
+ />
7
+ </template>
8
+
9
+ <script lang="ts" setup>
10
+ import { useVuelidate } from '@vuelidate/core';
11
+ import { required } from '@vuelidate/validators';
12
+ import { computed, watch } from 'vue';
13
+
14
+ import HasOptionFilterValueField from '../_shared/has-options/has-option-filter-value-field.vue';
15
+
16
+ const model = defineModel<string>();
17
+
18
+ const v$ = useVuelidate(
19
+ computed(() => ({
20
+ model: {
21
+ required,
22
+ },
23
+ })),
24
+ { model },
25
+ { $autoDirty: true },
26
+ );
27
+
28
+ v$.value.$touch();
29
+
30
+ const emit = defineEmits<{
31
+ 'update:invalid': [boolean];
32
+ }>();
33
+
34
+ watch(
35
+ () => v$.value.$invalid,
36
+ (invalid) => {
37
+ emit('update:invalid', invalid);
38
+ },
39
+ { immediate: true },
40
+ );
41
+ </script>
42
+
43
+ <style lang="scss" scoped></style>
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <div>{{ localeValue }}</div>
3
+ </template>
4
+
5
+ <script lang="ts" setup>
6
+ import { computed } from 'vue';
7
+ import { useI18n } from 'vue-i18n';
8
+
9
+ import { BooleanOptions } from '../../enums/boolean-options';
10
+
11
+ const props = defineProps<{
12
+ value: boolean;
13
+ }>();
14
+ const { t } = useI18n();
15
+
16
+ const localeValue = computed(() => {
17
+ const match = BooleanOptions.find((el) => el.value === props.value);
18
+ return match ? t(match.locale) : '';
19
+ });
20
+ </script>
21
+
22
+ <style lang="scss" scoped></style>
@@ -0,0 +1,4 @@
1
+ import UsersAPI from '../../../../../../../api/clients/users/users.js';
2
+
3
+ export const searchMethod = UsersAPI.getLookup;
4
+ export const localePath = '';
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <wt-select
3
+ :close-on-select="false"
4
+ :label="t('webitelUI.filters.filterValue')"
5
+ :search-method="searchMethod"
6
+ :value="model"
7
+ :v="v$.model"
8
+ multiple
9
+ use-value-from-options-by-prop="id"
10
+ @input="handleInput"
11
+ />
12
+ </template>
13
+
14
+ <script lang="ts" setup>
15
+ import { useVuelidate } from '@vuelidate/core';
16
+ import { required } from '@vuelidate/validators';
17
+ import { computed, watch } from 'vue';
18
+ import { useI18n } from 'vue-i18n';
19
+
20
+ import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
21
+ import { searchMethod } from './config.js';
22
+
23
+ type ModelValue = number[];
24
+
25
+ const model = defineModel<ModelValue>();
26
+
27
+ const emit = defineEmits<{
28
+ 'update:invalid': [boolean];
29
+ }>();
30
+ const { t } = useI18n();
31
+
32
+ const v$ = useVuelidate(
33
+ computed(() => ({
34
+ model: {
35
+ required,
36
+ },
37
+ })),
38
+ { model },
39
+ { $autoDirty: true },
40
+ );
41
+ v$.value.$touch();
42
+
43
+ watch(
44
+ () => v$.value.$invalid,
45
+ (invalid) => {
46
+ emit('update:invalid', invalid);
47
+ },
48
+ { immediate: true },
49
+ );
50
+
51
+ const handleInput = (value: ModelValue) => {
52
+ model.value = value;
53
+ };
54
+ </script>
55
+
56
+ <style lang="scss" scoped></style>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <ul
3
+ v-if="localValue">
4
+ <li
5
+ v-for="({ name }, index) of localValue"
6
+ :key="index"
7
+ >
8
+ {{ name }}
9
+ </li>
10
+ </ul>
11
+ </template>
12
+
13
+ <script lang="ts" setup>
14
+ import { searchMethod } from './config.js';
15
+ import {ref} from 'vue';
16
+
17
+ const props = defineProps<{
18
+ value: number[];
19
+ }>();
20
+
21
+ const localValue = ref([]);
22
+
23
+ const getLocalValue = async () => {
24
+ const { items } = await searchMethod({id: props.value});
25
+ localValue.value = items;
26
+ };
27
+
28
+ getLocalValue();
29
+ </script>
30
+
31
+ <style lang="scss" scoped>
32
+ </style>
@@ -0,0 +1,99 @@
1
+ <template>
2
+ <div class="score-from-to-filter-value-field">
3
+ <wt-input
4
+ v-if="model"
5
+ :value="model.from"
6
+ :number-max="props.numberMax"
7
+ :number-min="0"
8
+ :v="v$.model?.from"
9
+ :label="`${t('webitelUI.filters.filterValueFrom')}:`"
10
+ :placeholder="t('webitelUI.filters.filterValue')"
11
+ class="score-from-to-filter-value-field__input"
12
+ name="score-from-to-filter-value-field-from"
13
+ type="number"
14
+ @input="handleInput('from', $event)"
15
+ />
16
+
17
+ <wt-input
18
+ v-if="model"
19
+ :value="model.to"
20
+ :number-max="props.numberMax"
21
+ :number-min="0"
22
+ :v="v$.model?.to"
23
+ :label="`${t('reusable.to').toLowerCase()}:`"
24
+ :placeholder="t('webitelUI.filters.filterValue')"
25
+ class="score-from-to-filter-value-field__input"
26
+ name="score-from-to-filter-value-field-to"
27
+ type="number"
28
+ @input="handleInput('to', $event)"
29
+ />
30
+ </div>
31
+ </template>
32
+
33
+ <script setup lang="ts">
34
+ import { useVuelidate } from '@vuelidate/core';
35
+ import { requiredIf } from '@vuelidate/validators';
36
+ import { computed, watch } from 'vue';
37
+ import { useI18n } from 'vue-i18n';
38
+
39
+ type ModelValue = {
40
+ from: number;
41
+ to: number;
42
+ };
43
+ const model = defineModel<ModelValue>();
44
+ if (!model.value) {
45
+ model.value = {
46
+ from: null,
47
+ to: null,
48
+ };
49
+ }
50
+
51
+ const props = withDefaults(
52
+ defineProps<{
53
+ numberMax: number;
54
+ }>(),
55
+ {
56
+ numberMax: 100,
57
+ },
58
+ );
59
+
60
+ const emit = defineEmits<{
61
+ 'update:invalid': [boolean];
62
+ }>();
63
+
64
+ const { t } = useI18n();
65
+
66
+ const v$ = useVuelidate(
67
+ computed(() => ({
68
+ model: {
69
+ from: { requiredIf: requiredIf(() => !model.value.to) },
70
+ to: { requiredIf: requiredIf(() => !model.value.from) },
71
+ },
72
+ })),
73
+ { model },
74
+ { $autoDirty: true },
75
+ );
76
+ v$.value.$touch();
77
+
78
+ const handleInput = (key: keyof ModelValue, value: number) => {
79
+ const newValue = { ...model.value };
80
+ newValue[key] = value;
81
+ model.value = newValue;
82
+ };
83
+
84
+ watch(
85
+ () => v$.value.$invalid,
86
+ (invalid) => {
87
+ emit('update:invalid', invalid);
88
+ },
89
+ { immediate: true },
90
+ );
91
+ </script>
92
+
93
+ <style lang="scss" scoped>
94
+ .score-from-to-filter-value-field {
95
+ display: flex;
96
+ align-items: center;
97
+ grid-gap: var(--spacing-xs);
98
+ }
99
+ </style>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <div class="score-from-to-filter-value-preview">
3
+ <div v-if="props.value.from">
4
+ <p class="score-from-to-filter-value-preview__title">
5
+ {{t('reusable.from')}}
6
+ </p>
7
+
8
+ <span>{{props.value.from}}</span>
9
+ </div>
10
+
11
+ <div v-if="props.value.to">
12
+ <p class="score-from-to-filter-value-preview__title">
13
+ {{t('reusable.to')}}
14
+ </p>
15
+
16
+ <span>{{props.value.to}}</span>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <script lang="ts" setup>
22
+ import {useI18n} from "vue-i18n";
23
+
24
+ const props = defineProps<{
25
+ value: number[];
26
+ }>();
27
+
28
+ const { t } = useI18n();
29
+ </script>
30
+
31
+ <style lang="scss" scoped>
32
+ .score-from-to-filter-value-preview {
33
+ &__title {
34
+ @extend %typo-subtitle-1;
35
+ }
36
+ }
37
+ </style>
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <wt-select
3
+ :clearable="false"
4
+ :label="t('webitelUI.filters.filterValue')"
5
+ :options="TagOptions"
6
+ :value="model"
7
+ :v="v$.model"
8
+ multiple
9
+ track-by="value"
10
+ use-value-from-options-by-prop="value"
11
+ @input="model = $event"
12
+ />
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ import { useVuelidate } from '@vuelidate/core';
17
+ import { required } from '@vuelidate/validators';
18
+ import { computed, watch } from 'vue';
19
+ import { useI18n } from 'vue-i18n';
20
+
21
+ import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
22
+ import { TagOptions } from '../../enums/tag-options';
23
+
24
+ const model = defineModel<string>();
25
+ const { t } = useI18n();
26
+
27
+ const v$ = useVuelidate(
28
+ computed(() => ({
29
+ model: {
30
+ required,
31
+ },
32
+ })),
33
+ { model },
34
+ { $autoDirty: true },
35
+ );
36
+
37
+ v$.value.$touch();
38
+
39
+ const emit = defineEmits<{
40
+ 'update:invalid': [boolean];
41
+ }>();
42
+
43
+ watch(
44
+ () => v$.value.$invalid,
45
+ (invalid) => {
46
+ emit('update:invalid', invalid);
47
+ },
48
+ { immediate: true },
49
+ );
50
+ </script>
51
+
52
+ <style lang="scss" scoped></style>
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <ul>
3
+ <li
4
+ v-for="(tag, index) of value"
5
+ :key="index"
6
+ >
7
+ {{ tag }}
8
+ </li>
9
+ </ul>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ const props = defineProps<{
14
+ value: number[];
15
+ }>();
16
+ </script>
17
+
18
+ <style lang="scss" scoped></style>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <duration-filter-value-field
3
+ :value="model"
4
+ @update:model-value="model = $event"
5
+ />
6
+ </template>
7
+
8
+ <script lang="ts" setup>
9
+ import DurationFilterValueField from '../_shared/durations/duration-filter-value-field.vue';
10
+
11
+ type ModelValue = {
12
+ from: number;
13
+ to: number;
14
+ };
15
+
16
+ const model = defineModel<ModelValue>();
17
+ </script>
18
+
19
+ <style lang="scss" scoped></style>
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <div class="talk-duration-filter-value-preview">
3
+ <div v-if="props.value.from">
4
+ <p class="talk-duration-filter-value-preview__title">
5
+ {{t('reusable.from')}}
6
+ </p>
7
+
8
+ <span>{{formatTime(props.value.from)}}</span>
9
+ </div>
10
+
11
+ <div v-if="props.value.to">
12
+ <p class="talk-duration-filter-value-preview__title">
13
+ {{t('reusable.to')}}
14
+ </p>
15
+
16
+ <span>{{formatTime(props.value.to)}}</span>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <script lang="ts" setup>
22
+ import {useI18n} from "vue-i18n";
23
+
24
+ const props = defineProps<{
25
+ value: number[];
26
+ }>();
27
+
28
+ const { t } = useI18n();
29
+
30
+ const formatTime = (value) => {
31
+ const minutes = Math.floor(value / 60);
32
+ const seconds = value % 60;
33
+
34
+ return `${t('webitelUI.timepicker.min')} ${minutes} ${t('webitelUI.timepicker.sec')} ${seconds}`;
35
+ }
36
+ </script>
37
+
38
+ <style lang="scss" scoped>
39
+ .duration-filter-value-preview {
40
+ &__title {
41
+ @extend %typo-subtitle-1;
42
+ }
43
+ }
44
+ </style>