@webitel/ui-datalist 1.0.5 → 1.0.7

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 (29) hide show
  1. package/package.json +4 -3
  2. package/src/filter-presets/components/_shared/preset-filters-preview.vue +2 -11
  3. package/src/filter-presets/components/apply-preset/apply-preset-action.vue +5 -0
  4. package/src/filter-presets/components/save-preset/save-preset-action.vue +31 -4
  5. package/src/filter-presets/components/save-preset/save-preset-popup.vue +5 -1
  6. package/src/filters/classes/FiltersManager.ts +9 -3
  7. package/src/filters/components/dynamic-filter-add-action.vue +2 -3
  8. package/src/filters/components/filter-options/_shared/lookup-filter-preview/lookup-filter-value-preview.vue +21 -0
  9. package/src/filters/components/filter-options/agent/agent-filter-value-preview.vue +4 -20
  10. package/src/filters/components/filter-options/agent/config.js +0 -1
  11. package/src/filters/components/filter-options/contact/contact-filter-value-preview.vue +4 -20
  12. package/src/filters/components/filter-options/created-at/created-at-filter-value-field.vue +97 -0
  13. package/src/filters/components/filter-options/created-at/created-at-filter-value-preview.vue +64 -0
  14. package/src/filters/components/filter-options/gateway/gateway-filter-value-preview.vue +6 -21
  15. package/src/filters/components/filter-options/grantee/grantee-filter-value-preview.vue +6 -21
  16. package/src/filters/components/filter-options/index.ts +45 -0
  17. package/src/filters/components/filter-options/queue/queue-filter-value-preview.vue +4 -20
  18. package/src/filters/components/filter-options/rated-by/rated-by-filter-value-preview.vue +6 -21
  19. package/src/filters/components/filter-options/service-case/config.js +1 -1
  20. package/src/filters/components/filter-options/team/team-filter-value-preview.vue +4 -20
  21. package/src/filters/components/filter-options/user/user-filter-value-preview.vue +6 -21
  22. package/src/filters/components/preview/dynamic-filter-preview-info.vue +1 -0
  23. package/src/filters/components/preview/dynamic-filter-preview.vue +82 -19
  24. package/src/filters/components/search-bar/dynamic-filter-search.vue +123 -0
  25. package/src/filters/components/search-bar/types/DynamicFilterSearch.d.ts +5 -0
  26. package/src/filters/components/table-filters-panel.vue +25 -27
  27. package/src/filters/enums/FilterOption.ts +12 -2
  28. package/src/filters/index.ts +1 -1
  29. package/src/filters/components/dynamic-filter-search.vue +0 -60
@@ -1,25 +1,11 @@
1
1
  <template>
2
2
  <dynamic-filter-panel-wrapper>
3
3
  <template #filters>
4
- <!-- WTF? - /* https://webitel.atlassian.net/browse/WTEL-6308?focusedCommentId=657415 */ -->
5
- <!--TODO-->
6
- <!-- <dynamic-filter-preview-->
7
- <!-- v-if="!hasCreatedAtFromFilter"-->
8
- <!-- :filter="defaultCreatedAtFromFilterDataPreview"-->
9
- <!-- dummy-->
10
- <!-- >-->
11
- <!-- <template #info>-->
12
- <!-- <component-->
13
- <!-- :is="FilterOptionToPreviewComponentMap[FilterOption.CreatedAtFrom]"-->
14
- <!-- :value="defaultCreatedAtFromFilterDataPreview.value"-->
15
- <!-- />-->
16
- <!-- </template>-->
17
- <!-- </dynamic-filter-preview>-->
18
-
19
4
  <dynamic-filter-preview
20
5
  v-for="filter of appliedFilters"
21
6
  :key="filter.name"
22
7
  :filter="filter"
8
+ :filter-options="localizedFilterOptions"
23
9
  disable-click-away
24
10
  @update:filter="emit('filter:update', $event)"
25
11
  @delete:filter="emit('filter:delete', filter)"
@@ -36,6 +22,7 @@
36
22
  <apply-preset-action
37
23
  :namespace="props.presetNamespace"
38
24
  :use-presets-store="props.usePresetsStore"
25
+ :filter-options="props.filterOptions"
39
26
  @apply="emit('preset:apply', $event)"
40
27
  />
41
28
 
@@ -43,6 +30,7 @@
43
30
  v-if="enablePresets"
44
31
  :namespace="props.presetNamespace"
45
32
  :filters-manager="props.filtersManager"
33
+ :filter-options="props.filterOptions"
46
34
  />
47
35
 
48
36
  <wt-icon-action
@@ -80,7 +68,8 @@ type Props = {
80
68
  filterOptions: FilterOption[];
81
69
  /**
82
70
  * @description
83
- * Looks like a anti-pattern, but save-preset.vue component needs filterManager
71
+ * create local filters manager from snapshot
72
+ * inside save-preset.vue
84
73
  */
85
74
  filtersManager: IFiltersManager;
86
75
  /**
@@ -130,7 +119,21 @@ const { t } = useI18n();
130
119
 
131
120
  const appliedFilters = computed(() => {
132
121
  return props.filtersManager.getFiltersList({
133
- include: props.filterOptions,
122
+ include: props.filterOptions.map((opt) => {
123
+ return opt.value || opt;
124
+ }),
125
+ });
126
+ });
127
+
128
+ const localizedFilterOptions = computed(() => {
129
+ return props.filterOptions.map((opt) => {
130
+ const isExtended = typeof opt !== 'string';
131
+
132
+ const name = isExtended
133
+ ? t(`webitelUI.filters.${opt.value}`)
134
+ : t(`webitelUI.filters.${opt}`);
135
+
136
+ return isExtended ? { name, ...opt } : { name, value: opt };
134
137
  });
135
138
  });
136
139
 
@@ -139,16 +142,11 @@ const appliedFilters = computed(() => {
139
142
  * available filters to add, with appliedFilters excluded
140
143
  */
141
144
  const availableFilterOptions = computed(() => {
142
- return props.filterOptions
143
- .filter((opt) => {
144
- return appliedFilters.value.every((filter) => {
145
- return filter.name !== opt;
146
- });
147
- })
148
- .map((opt) => ({
149
- name: t(`webitelUI.filters.${opt}`),
150
- value: opt,
151
- }));
145
+ return localizedFilterOptions.value.filter(({ value: opt }) => {
146
+ return appliedFilters.value.every((filter) => {
147
+ return filter.name !== opt;
148
+ });
149
+ });
152
150
  });
153
151
 
154
152
  const enablePresets = computed(() => !!props.presetNamespace);
@@ -1,3 +1,5 @@
1
+ import type { FilterName } from '../types/Filter';
2
+
1
3
  export const FilterOption = {
2
4
  Agent: 'agent',
3
5
  AmdResult: 'amdResult',
@@ -18,6 +20,7 @@ export const FilterOption = {
18
20
  HasTranscription: 'hasTranscription',
19
21
  User: 'user',
20
22
  Variable: 'variable',
23
+ CreatedAt: 'createdAt',
21
24
  CreatedAtFrom: 'createdAtFrom',
22
25
  CreatedAtTo: 'createdAtTo',
23
26
  Status: 'status',
@@ -38,6 +41,13 @@ export const FilterOption = {
38
41
  ActualReactionTime: 'actualReactionTime',
39
42
  ActualResolutionTime: 'actualResolutionTime',
40
43
  HasAttachment: 'hasAttachment',
41
- } as const;
44
+ } as FilterName;
45
+
46
+ type SimpleFilterOption = (typeof FilterOption)[keyof typeof FilterOption];
47
+
48
+ type ExtendedFilterOption = {
49
+ name: FilterOption;
50
+ notDeletable?: boolean;
51
+ };
42
52
 
43
- export type FilterOption = (typeof FilterOption)[keyof typeof FilterOption];
53
+ export type FilterOption = SimpleFilterOption | ExtendedFilterOption;
@@ -1,6 +1,6 @@
1
1
  import { Filter } from './classes/Filter.ts';
2
2
  import { createFiltersManager } from './classes/FiltersManager';
3
- import DynamicFilterSearchComponent from './components/dynamic-filter-search.vue';
3
+ import DynamicFilterSearchComponent from './components/search-bar/dynamic-filter-search.vue';
4
4
  import TableFiltersPanelComponent from './components/table-filters-panel.vue';
5
5
  import { FilterOption } from './enums/FilterOption';
6
6
  import type {
@@ -1,60 +0,0 @@
1
- <template>
2
- <wt-search-bar
3
- :placeholder="t('reusable.search')"
4
- :search-mode="props.searchMode"
5
- :search-mode-options="searchModeOptions"
6
- :value="model"
7
- @input="model = $event"
8
- @search="handleSearch"
9
- @update:search-mode="onSearchModeChange($event.value)"
10
- >
11
- <template
12
- v-if="props.showTextSearchIcon"
13
- #search-icon
14
- >
15
- <wt-icon icon="stt-search" />
16
- </template>
17
- </wt-search-bar>
18
- </template>
19
-
20
- <script lang="ts" setup>
21
- import { WtSearchBar } from '@webitel/ui-sdk/components';
22
- import { computed } from 'vue';
23
- import { useI18n } from 'vue-i18n';
24
-
25
- type ModelValue = string;
26
- const model = defineModel<ModelValue>();
27
-
28
- const props = defineProps<{
29
- searchMode: string;
30
- searchModeOptions: Record<string, string>;
31
- showTextSearchIcon?: boolean;
32
- }>();
33
-
34
- const emit = defineEmits<{
35
- 'update:search-mode': [string];
36
- 'handle-search': [string];
37
- }>();
38
-
39
- const { t } = useI18n();
40
-
41
- const onSearchModeChange = (value: string) => {
42
- emit('update:search-mode', value);
43
- model.value = '';
44
- };
45
-
46
- const handleSearch = () => {
47
- emit('handle-search', model.value);
48
- };
49
-
50
- const searchModeOptions = computed(() =>
51
- Object.values(props.searchModeOptions).map((mode) => {
52
- return {
53
- value: mode,
54
- text: t(`filters.search.${mode}`),
55
- };
56
- }),
57
- );
58
- </script>
59
-
60
- <style scoped></style>