@webitel/ui-datalist 1.0.0 → 1.0.2

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 (155) hide show
  1. package/Readme.md +19 -0
  2. package/package.json +3 -1
  3. package/src/filter-presets/api/PresetQuery.api.ts +122 -0
  4. package/src/filter-presets/components/_shared/input-fields/preset-description-field.vue +32 -0
  5. package/src/filter-presets/components/_shared/input-fields/preset-name-field.vue +28 -0
  6. package/src/filter-presets/components/_shared/preset-filters-preview.vue +45 -0
  7. package/src/filter-presets/components/apply-preset/apply-preset-action.vue +234 -0
  8. package/src/filter-presets/components/apply-preset/preset-preview.vue +210 -0
  9. package/src/filter-presets/components/save-preset/overwrite-preset-popup.vue +64 -0
  10. package/src/filter-presets/components/save-preset/save-preset-action.vue +139 -0
  11. package/src/filter-presets/components/save-preset/save-preset-popup.vue +136 -0
  12. package/src/filter-presets/index.ts +5 -0
  13. package/src/filter-presets/stores/createFilterPresetsStore.ts +17 -0
  14. package/src/filter-presets/stores/headers/headers.ts +24 -0
  15. package/src/filters/classes/Filter.ts +30 -0
  16. package/src/filters/classes/FilterStorage.ts +34 -0
  17. package/src/filters/classes/FilterStorageOptions.d.ts +6 -0
  18. package/src/filters/classes/FiltersManager.ts +190 -0
  19. package/src/filters/components/config/dynamic-filter-config-form-label.vue +49 -0
  20. package/src/filters/components/config/dynamic-filter-config-form.vue +139 -0
  21. package/src/filters/components/config/dynamic-filter-config-view.vue +40 -0
  22. package/src/filters/components/dynamic-filter-add-action.vue +54 -0
  23. package/src/filters/components/dynamic-filter-panel-wrapper.vue +57 -0
  24. package/src/filters/components/dynamic-filter-search.vue +60 -0
  25. package/src/filters/components/filter-options/_shared/composables/booleanFilterToolkit.ts +39 -0
  26. package/src/filters/components/filter-options/_shared/composables/useFromToSecToPreviewTime.ts +41 -0
  27. package/src/filters/components/filter-options/_shared/date-time-filter/date-time-filter-value-field.vue +56 -0
  28. package/src/filters/components/filter-options/_shared/durations/duration-filter-value-field.vue +84 -0
  29. package/src/filters/components/filter-options/_shared/has-options/has-option-filter-value-field.vue +38 -0
  30. package/src/filters/components/filter-options/_shared/types/BooleanFilter.ts +1 -0
  31. package/src/filters/components/filter-options/actual-reaction-time/actual-reaction-time-filter-value-field.vue +18 -0
  32. package/src/filters/components/filter-options/actual-reaction-time/actual-reaction-time-filter-value-preview.vue +44 -0
  33. package/src/filters/components/filter-options/actual-resolution-time/actual-resolution-time-filter-value-field.vue +18 -0
  34. package/src/filters/components/filter-options/actual-resolution-time/actual-resolution-time-filter-value-preview.vue +44 -0
  35. package/src/filters/components/filter-options/agent/agent-filter-value-field.vue +58 -0
  36. package/src/filters/components/filter-options/agent/agent-filter-value-preview.vue +31 -0
  37. package/src/filters/components/filter-options/agent/config.js +4 -0
  38. package/src/filters/components/filter-options/amd-result/amd-result-filter-value-field.vue +52 -0
  39. package/src/filters/components/filter-options/amd-result/amd-result-filter-value-preview.vue +18 -0
  40. package/src/filters/components/filter-options/assignee/assignee-filter-value-field.vue +73 -0
  41. package/src/filters/components/filter-options/assignee/assignee-filter-value-preview.vue +36 -0
  42. package/src/filters/components/filter-options/assignee/config.js +4 -0
  43. package/src/filters/components/filter-options/author/author-filter-value-field.vue +56 -0
  44. package/src/filters/components/filter-options/author/author-filter-value-preview.vue +31 -0
  45. package/src/filters/components/filter-options/author/config.js +4 -0
  46. package/src/filters/components/filter-options/cause/cause-filter-value-field.vue +52 -0
  47. package/src/filters/components/filter-options/cause/cause-filter-value-preview.vue +18 -0
  48. package/src/filters/components/filter-options/close-reason-groups-case/close-reason-groups-case-filter-value-field.vue +102 -0
  49. package/src/filters/components/filter-options/close-reason-groups-case/close-reason-groups-case-filter-value-preview.vue +34 -0
  50. package/src/filters/components/filter-options/close-reason-groups-case/config.js +7 -0
  51. package/src/filters/components/filter-options/contact/config.js +4 -0
  52. package/src/filters/components/filter-options/contact/contact-filter-value-field.vue +56 -0
  53. package/src/filters/components/filter-options/contact/contact-filter-value-preview.vue +31 -0
  54. package/src/filters/components/filter-options/contact-group/config.js +4 -0
  55. package/src/filters/components/filter-options/contact-group/contact-group-filter-value-field.vue +74 -0
  56. package/src/filters/components/filter-options/contact-group/contact-group-filter-value-preview.vue +38 -0
  57. package/src/filters/components/filter-options/created-at-from/created-at-from-filter-value-field.vue +24 -0
  58. package/src/filters/components/filter-options/created-at-from/created-at-from-filter-value-preview.vue +15 -0
  59. package/src/filters/components/filter-options/created-at-to/created-at-to-filter-value-field.vue +24 -0
  60. package/src/filters/components/filter-options/created-at-to/created-at-to-filter-value-preview.vue +15 -0
  61. package/src/filters/components/filter-options/direction/direction-filter-value-field.vue +51 -0
  62. package/src/filters/components/filter-options/direction/direction-filter-value-preview.vue +17 -0
  63. package/src/filters/components/filter-options/gateway/config.js +4 -0
  64. package/src/filters/components/filter-options/gateway/gateway-filter-value-field.vue +56 -0
  65. package/src/filters/components/filter-options/gateway/gateway-filter-value-preview.vue +31 -0
  66. package/src/filters/components/filter-options/grantee/config.js +4 -0
  67. package/src/filters/components/filter-options/grantee/grantee-filter-value-field.vue +56 -0
  68. package/src/filters/components/filter-options/grantee/grantee-filter-value-preview.vue +31 -0
  69. package/src/filters/components/filter-options/has-attachment/has-attachment-filter-value-field.vue +43 -0
  70. package/src/filters/components/filter-options/has-attachment/has-attachment-filter-value-preview.vue +24 -0
  71. package/src/filters/components/filter-options/has-file/has-file-filter-value-field.vue +33 -0
  72. package/src/filters/components/filter-options/has-file/has-file-filter-value-preview.vue +15 -0
  73. package/src/filters/components/filter-options/has-rating/has-rating-filter-value-field.vue +33 -0
  74. package/src/filters/components/filter-options/has-rating/has-rating-filter-value-preview.vue +15 -0
  75. package/src/filters/components/filter-options/has-transcription/has-transcription-filter-value-field.vue +33 -0
  76. package/src/filters/components/filter-options/has-transcription/has-transcription-filter-value-preview.vue +15 -0
  77. package/src/filters/components/filter-options/impacted/config.js +4 -0
  78. package/src/filters/components/filter-options/impacted/impacted-filter-value-field.vue +56 -0
  79. package/src/filters/components/filter-options/impacted/impacted-filter-value-preview.vue +31 -0
  80. package/src/filters/components/filter-options/index.ts +250 -0
  81. package/src/filters/components/filter-options/priority-case/config.js +4 -0
  82. package/src/filters/components/filter-options/priority-case/priority-case-filter-value-field.vue +57 -0
  83. package/src/filters/components/filter-options/priority-case/priority-case-filter-value-preview.vue +31 -0
  84. package/src/filters/components/filter-options/queue/config.js +4 -0
  85. package/src/filters/components/filter-options/queue/queue-filter-value-field.vue +56 -0
  86. package/src/filters/components/filter-options/queue/queue-filter-value-preview.vue +31 -0
  87. package/src/filters/components/filter-options/rated-by/config.js +4 -0
  88. package/src/filters/components/filter-options/rated-by/rated-by-filter-value-field.vue +56 -0
  89. package/src/filters/components/filter-options/rated-by/rated-by-filter-value-preview.vue +31 -0
  90. package/src/filters/components/filter-options/rating/rating-from-to-filter-value-field.vue +100 -0
  91. package/src/filters/components/filter-options/rating/rating-from-to-filter-value-preview.vue +39 -0
  92. package/src/filters/components/filter-options/reaction-time/reaction-time-filter-value-field.vue +18 -0
  93. package/src/filters/components/filter-options/reaction-time/reaction-time-filter-value-preview.vue +44 -0
  94. package/src/filters/components/filter-options/reporter/config.js +4 -0
  95. package/src/filters/components/filter-options/reporter/reporter-filter-value-field.vue +56 -0
  96. package/src/filters/components/filter-options/reporter/reporter-filter-value-preview.vue +31 -0
  97. package/src/filters/components/filter-options/resolution-time/resolution-time-filter-value-field.vue +18 -0
  98. package/src/filters/components/filter-options/resolution-time/resolution-time-filter-value-preview.vue +44 -0
  99. package/src/filters/components/filter-options/score/score-from-to-filter-value-field.vue +100 -0
  100. package/src/filters/components/filter-options/score/score-from-to-filter-value-preview.vue +39 -0
  101. package/src/filters/components/filter-options/service-case/config.js +6 -0
  102. package/src/filters/components/filter-options/service-case/service-case-filter-value-field.vue +82 -0
  103. package/src/filters/components/filter-options/service-case/service-case-filter-value-preview.vue +34 -0
  104. package/src/filters/components/filter-options/sla/config.js +4 -0
  105. package/src/filters/components/filter-options/sla/sla-filter-value-field.vue +57 -0
  106. package/src/filters/components/filter-options/sla/sla-filter-value-preview.vue +31 -0
  107. package/src/filters/components/filter-options/sla-condition/config.js +6 -0
  108. package/src/filters/components/filter-options/sla-condition/sla-condition-filter-value-field.vue +98 -0
  109. package/src/filters/components/filter-options/sla-condition/sla-condition-filter-value-preview.vue +37 -0
  110. package/src/filters/components/filter-options/source-case/config.js +4 -0
  111. package/src/filters/components/filter-options/source-case/source-case-filter-value-field.vue +57 -0
  112. package/src/filters/components/filter-options/source-case/source-case-filter-value-preview.vue +31 -0
  113. package/src/filters/components/filter-options/status-case/config.js +7 -0
  114. package/src/filters/components/filter-options/status-case/status-case-filter-value-field.vue +102 -0
  115. package/src/filters/components/filter-options/status-case/status-case-filter-value-preview.vue +37 -0
  116. package/src/filters/components/filter-options/tag/tag-filter-value-field.vue +52 -0
  117. package/src/filters/components/filter-options/tag/tag-filter-value-preview.vue +38 -0
  118. package/src/filters/components/filter-options/talk-duration/TalkDurationFilter.d.ts +4 -0
  119. package/src/filters/components/filter-options/talk-duration/talk-duration-filter-value-field.vue +19 -0
  120. package/src/filters/components/filter-options/talk-duration/talk-duration-filter-value-preview.vue +44 -0
  121. package/src/filters/components/filter-options/team/config.js +4 -0
  122. package/src/filters/components/filter-options/team/team-filter-value-field.vue +56 -0
  123. package/src/filters/components/filter-options/team/team-filter-value-preview.vue +31 -0
  124. package/src/filters/components/filter-options/total-duration/TotalDurationFilter.d.ts +4 -0
  125. package/src/filters/components/filter-options/total-duration/total-duration-filter-value-field.vue +19 -0
  126. package/src/filters/components/filter-options/total-duration/total-duration-filter-value-preview.vue +44 -0
  127. package/src/filters/components/filter-options/user/config.js +4 -0
  128. package/src/filters/components/filter-options/user/user-filter-value-field.vue +56 -0
  129. package/src/filters/components/filter-options/user/user-filter-value-preview.vue +31 -0
  130. package/src/filters/components/filter-options/variable/variable-filter-value-field.vue +49 -0
  131. package/src/filters/components/filter-options/variable/variable-filter-value-preview.vue +39 -0
  132. package/src/filters/components/preview/dynamic-filter-preview-info.vue +35 -0
  133. package/src/filters/components/preview/dynamic-filter-preview.vue +76 -0
  134. package/src/filters/components/table-filters-panel.vue +83 -0
  135. package/src/filters/createTableFiltersStore.ts +81 -0
  136. package/src/filters/enums/FilterOption.ts +43 -0
  137. package/src/filters/enums/amd-result-options.ts +38 -0
  138. package/src/filters/enums/boolean-options.ts +16 -0
  139. package/src/filters/enums/direction-options.ts +20 -0
  140. package/src/filters/enums/hangup-cause-options.ts +265 -0
  141. package/src/filters/enums/tag-options.ts +8 -0
  142. package/src/filters/index.ts +27 -0
  143. package/src/filters/scripts/utils.ts +31 -0
  144. package/src/filters/types/Filter.d.ts +46 -0
  145. package/src/filters/types/FiltersManager.d.ts +76 -0
  146. package/src/headers/createTableHeadersStore.ts +140 -0
  147. package/src/index.d.ts +0 -0
  148. package/src/index.ts +3 -0
  149. package/src/pagination/createTablePaginationStore.ts +64 -0
  150. package/src/persist/PersistedStorage.types.ts +51 -0
  151. package/src/persist/useLocalStoragePersistedStorage.ts +37 -0
  152. package/src/persist/usePersistedStorage.ts +151 -0
  153. package/src/persist/useRoutePersistedStorage.ts +41 -0
  154. package/src/table/createTableStore.store.ts +206 -0
  155. package/src/types/tableStore.types.ts +61 -0
@@ -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 { WtSelect } from '@webitel/ui-sdk/src/components/index';
18
+ import { computed, watch } from 'vue';
19
+ import { useI18n } from 'vue-i18n';
20
+
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,31 @@
1
+ <template>
2
+ <ul v-if="localValue">
3
+ <li
4
+ v-for="({ name }, index) of localValue"
5
+ :key="index"
6
+ >
7
+ {{ name }}
8
+ </li>
9
+ </ul>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ import { ref } from 'vue';
14
+
15
+ import { searchMethod } from './config.js';
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></style>
@@ -0,0 +1,4 @@
1
+ import ContactGroupsAPI from '@webitel/ui-sdk/src/api/clients/contactGroups/contactGroups';
2
+
3
+ export const searchMethod = ContactGroupsAPI.getLookup;
4
+ export const localePath = '';
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <wt-select
3
+ :close-on-select="false"
4
+ :label="t('webitelUI.filters.filterValue')"
5
+ :search-method="searchMethod"
6
+ :v="v$.model.list"
7
+ :value="model?.list"
8
+ multiple
9
+ track-by="id"
10
+ use-value-from-options-by-prop="id"
11
+ @input="model.list = $event"
12
+ />
13
+ <wt-checkbox
14
+ :label="t('reusable.showUnassigned')"
15
+ :selected="model?.unassigned"
16
+ :v="v$.model.unassigned"
17
+ @change="model.unassigned = $event"
18
+ />
19
+ </template>
20
+
21
+ <script lang="ts" setup>
22
+ import { useVuelidate } from '@vuelidate/core';
23
+ import { requiredIf } from '@vuelidate/validators';
24
+ import { WtSelect } from '@webitel/ui-sdk/src/components/index';
25
+ import { WtCheckbox } from '@webitel/ui-sdk/src/components/index';
26
+ import { computed, onMounted, watch } from 'vue';
27
+ import { useI18n } from 'vue-i18n';
28
+
29
+ import { searchMethod } from './config.js';
30
+
31
+ type ModelValue = {
32
+ list: string[];
33
+ unassigned: boolean;
34
+ };
35
+
36
+ const model = defineModel<ModelValue>();
37
+
38
+ const emit = defineEmits<{
39
+ 'update:invalid': [boolean];
40
+ }>();
41
+ const { t } = useI18n();
42
+
43
+ const initModel = () => {
44
+ if (!model.value) {
45
+ model.value = {
46
+ list: [],
47
+ unassigned: false,
48
+ };
49
+ }
50
+ };
51
+ onMounted(() => initModel());
52
+
53
+ const v$ = useVuelidate(
54
+ computed(() => ({
55
+ model: {
56
+ list: { required: requiredIf(() => !model.value.unassigned) },
57
+ unassigned: { required: requiredIf(() => !model.value.list.length) },
58
+ },
59
+ })),
60
+ { model },
61
+ { $autoDirty: true },
62
+ );
63
+ v$.value.$touch();
64
+
65
+ watch(
66
+ () => v$.value.$invalid,
67
+ (invalid) => {
68
+ emit('update:invalid', invalid);
69
+ },
70
+ { immediate: true },
71
+ );
72
+ </script>
73
+
74
+ <style lang="scss" scoped></style>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <div>
3
+ <p v-if="props.value.unassigned">{{ t('reusable.unassigned') }}</p>
4
+ <ul v-if="localValue">
5
+ <li
6
+ v-for="({ name }, index) of localValue"
7
+ :key="index"
8
+ >
9
+ {{ name }}
10
+ </li>
11
+ </ul>
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ import { ref } from 'vue';
17
+ import { useI18n } from 'vue-i18n';
18
+
19
+ import { searchMethod } from './config.js';
20
+
21
+ const props = defineProps<{
22
+ value: number[];
23
+ }>();
24
+
25
+ const localValue = ref([]);
26
+ const { t } = useI18n();
27
+
28
+ const getLocalValue = async () => {
29
+ const { items } = await searchMethod({
30
+ id: props.value.list,
31
+ });
32
+ localValue.value = items;
33
+ };
34
+
35
+ getLocalValue();
36
+ </script>
37
+
38
+ <style lang="scss" scoped></style>
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <wt-datepicker
3
+ v-if="model"
4
+ :value="model"
5
+ :label="`${t('webitelUI.filters.filterValue')}`"
6
+ mode="datetime"
7
+ @input="model = $event"
8
+ />
9
+ </template>
10
+
11
+ <script lang="ts" setup>
12
+ import { startOfToday } from 'date-fns';
13
+ import { useI18n } from 'vue-i18n';
14
+
15
+ const model = defineModel<number>();
16
+
17
+ const { t } = useI18n();
18
+
19
+ if (!model.value) {
20
+ model.value = startOfToday().getTime();
21
+ }
22
+ </script>
23
+
24
+ <style lang="scss" scoped></style>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div>{{ date }}</div>
3
+ </template>
4
+
5
+ <script lang="ts" setup>
6
+ import { ref } from 'vue';
7
+
8
+ const props = defineProps<{
9
+ value: number[];
10
+ }>();
11
+
12
+ const date = ref(new Date(+props.value).toLocaleString());
13
+ </script>
14
+
15
+ <style lang="scss" scoped></style>
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <wt-datepicker
3
+ v-if="model"
4
+ :label="`${t('webitelUI.filters.filterValue')}`"
5
+ :value="model"
6
+ mode="datetime"
7
+ @input="model = $event"
8
+ />
9
+ </template>
10
+
11
+ <script lang="ts" setup>
12
+ import { endOfToday } from 'date-fns';
13
+ import { useI18n } from 'vue-i18n';
14
+
15
+ const model = defineModel<number>();
16
+
17
+ const { t } = useI18n();
18
+
19
+ if (!model.value) {
20
+ model.value = endOfToday().getTime();
21
+ }
22
+ </script>
23
+
24
+ <style lang="scss" scoped></style>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div>{{ date }}</div>
3
+ </template>
4
+
5
+ <script lang="ts" setup>
6
+ import { ref } from 'vue';
7
+
8
+ const props = defineProps<{
9
+ value: number[];
10
+ }>();
11
+
12
+ const date = ref(new Date(+props.value).toLocaleString());
13
+ </script>
14
+
15
+ <style lang="scss" scoped></style>
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <wt-select
3
+ :clearable="false"
4
+ :label="t('webitelUI.filters.filterValue')"
5
+ :options="DirectionOptions"
6
+ :value="model"
7
+ :v="v$.model"
8
+ track-by="value"
9
+ use-value-from-options-by-prop="value"
10
+ @input="model = $event"
11
+ />
12
+ </template>
13
+
14
+ <script lang="ts" setup>
15
+ import { useVuelidate } from '@vuelidate/core';
16
+ import { required } from '@vuelidate/validators';
17
+ import { WtSelect } from '@webitel/ui-sdk/src/components/index';
18
+ import { computed, watch } from 'vue';
19
+ import { useI18n } from 'vue-i18n';
20
+
21
+ import { DirectionOptions } from '../../../enums/direction-options';
22
+
23
+ const model = defineModel<string>();
24
+ const { t } = useI18n();
25
+
26
+ const v$ = useVuelidate(
27
+ computed(() => ({
28
+ model: {
29
+ required,
30
+ },
31
+ })),
32
+ { model },
33
+ { $autoDirty: true },
34
+ );
35
+
36
+ v$.value.$touch();
37
+
38
+ const emit = defineEmits<{
39
+ 'update:invalid': [boolean];
40
+ }>();
41
+
42
+ watch(
43
+ () => v$.value.$invalid,
44
+ (invalid) => {
45
+ emit('update:invalid', invalid);
46
+ },
47
+ { immediate: true },
48
+ );
49
+ </script>
50
+
51
+ <style lang="scss" scoped></style>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div>
3
+ {{ t(`calls.direction.${props.value}`) }}
4
+ </div>
5
+ </template>
6
+
7
+ <script lang="ts" setup>
8
+ import { useI18n } from 'vue-i18n';
9
+
10
+ const props = defineProps<{
11
+ value: number[];
12
+ }>();
13
+
14
+ const { t } = useI18n();
15
+ </script>
16
+
17
+ <style lang="scss" scoped></style>
@@ -0,0 +1,4 @@
1
+ import GatewaysAPI from '@webitel/ui-sdk/src/api/clients/gateways/gateways';
2
+
3
+ export const searchMethod = GatewaysAPI.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 { WtSelect } from '@webitel/ui-sdk/src/components/index';
18
+ import { computed, watch } from 'vue';
19
+ import { useI18n } from 'vue-i18n';
20
+
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,31 @@
1
+ <template>
2
+ <ul v-if="localValue">
3
+ <li
4
+ v-for="({ name }, index) of localValue"
5
+ :key="index"
6
+ >
7
+ {{ name }}
8
+ </li>
9
+ </ul>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ import { ref } from 'vue';
14
+
15
+ import { searchMethod } from './config.js';
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></style>
@@ -0,0 +1,4 @@
1
+ import RolesAPI from '@webitel/ui-sdk/src/api/clients/roles/roles';
2
+
3
+ export const searchMethod = RolesAPI.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 { WtSelect } from '@webitel/ui-sdk/src/components/index';
18
+ import { computed, watch } from 'vue';
19
+ import { useI18n } from 'vue-i18n';
20
+
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,31 @@
1
+ <template>
2
+ <ul v-if="localValue">
3
+ <li
4
+ v-for="({ name }, index) of localValue"
5
+ :key="index"
6
+ >
7
+ {{ name }}
8
+ </li>
9
+ </ul>
10
+ </template>
11
+
12
+ <script lang="ts" setup>
13
+ import { ref } from 'vue';
14
+
15
+ import { searchMethod } from './config.js';
16
+
17
+ const props = defineProps<{
18
+ value: number[];
19
+ }>();
20
+
21
+ const localValue = ref([]);
22
+
23
+ const getLocalValue = async () => {
24
+ const { items } = await searchMethod({ ids: props.value });
25
+ localValue.value = items;
26
+ };
27
+
28
+ getLocalValue();
29
+ </script>
30
+
31
+ <style lang="scss" scoped></style>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <has-option-filter-value-field
3
+ :model-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,24 @@
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(
18
+ (el) => el.value === props.value.toString(),
19
+ );
20
+ return match ? t(match.locale) : '';
21
+ });
22
+ </script>
23
+
24
+ <style lang="scss" scoped></style>
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <has-option-filter-value-field
3
+ :model-value="model"
4
+ :v="v$.model"
5
+ @update:model-value="model = $event"
6
+ />
7
+ </template>
8
+
9
+ <script lang="ts" setup>
10
+ import { watch } from 'vue';
11
+
12
+ import { useBooleanFilterValueValidation } from '../_shared/composables/booleanFilterToolkit';
13
+ import HasOptionFilterValueField from '../_shared/has-options/has-option-filter-value-field.vue';
14
+ import { BooleanFilterModelValue } from '../_shared/types/BooleanFilter';
15
+
16
+ const model = defineModel<BooleanFilterModelValue>();
17
+
18
+ const { v$ } = useBooleanFilterValueValidation<BooleanFilterModelValue>(model);
19
+
20
+ const emit = defineEmits<{
21
+ 'update:invalid': [boolean];
22
+ }>();
23
+
24
+ watch(
25
+ () => v$.value.$invalid,
26
+ (invalid) => {
27
+ emit('update:invalid', invalid);
28
+ },
29
+ { immediate: true },
30
+ );
31
+ </script>
32
+
33
+ <style lang="scss" scoped></style>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div>{{ localeValue }}</div>
3
+ </template>
4
+
5
+ <script lang="ts" setup>
6
+ import { usePrettifyBooleanValuePreview } from '../_shared/composables/booleanFilterToolkit';
7
+
8
+ const props = defineProps<{
9
+ value: boolean;
10
+ }>();
11
+
12
+ const { localeValue } = usePrettifyBooleanValuePreview(props.value);
13
+ </script>
14
+
15
+ <style lang="scss" scoped></style>