@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.
- package/package.json +4 -3
- package/src/filter-presets/components/_shared/preset-filters-preview.vue +2 -11
- package/src/filter-presets/components/apply-preset/apply-preset-action.vue +5 -0
- package/src/filter-presets/components/save-preset/save-preset-action.vue +31 -4
- package/src/filter-presets/components/save-preset/save-preset-popup.vue +5 -1
- package/src/filters/classes/FiltersManager.ts +9 -3
- package/src/filters/components/dynamic-filter-add-action.vue +2 -3
- package/src/filters/components/filter-options/_shared/lookup-filter-preview/lookup-filter-value-preview.vue +21 -0
- package/src/filters/components/filter-options/agent/agent-filter-value-preview.vue +4 -20
- package/src/filters/components/filter-options/agent/config.js +0 -1
- package/src/filters/components/filter-options/contact/contact-filter-value-preview.vue +4 -20
- package/src/filters/components/filter-options/created-at/created-at-filter-value-field.vue +97 -0
- package/src/filters/components/filter-options/created-at/created-at-filter-value-preview.vue +64 -0
- package/src/filters/components/filter-options/gateway/gateway-filter-value-preview.vue +6 -21
- package/src/filters/components/filter-options/grantee/grantee-filter-value-preview.vue +6 -21
- package/src/filters/components/filter-options/index.ts +45 -0
- package/src/filters/components/filter-options/queue/queue-filter-value-preview.vue +4 -20
- package/src/filters/components/filter-options/rated-by/rated-by-filter-value-preview.vue +6 -21
- package/src/filters/components/filter-options/service-case/config.js +1 -1
- package/src/filters/components/filter-options/team/team-filter-value-preview.vue +4 -20
- package/src/filters/components/filter-options/user/user-filter-value-preview.vue +6 -21
- package/src/filters/components/preview/dynamic-filter-preview-info.vue +1 -0
- package/src/filters/components/preview/dynamic-filter-preview.vue +82 -19
- package/src/filters/components/search-bar/dynamic-filter-search.vue +123 -0
- package/src/filters/components/search-bar/types/DynamicFilterSearch.d.ts +5 -0
- package/src/filters/components/table-filters-panel.vue +25 -27
- package/src/filters/enums/FilterOption.ts +12 -2
- package/src/filters/index.ts +1 -1
- package/src/filters/components/dynamic-filter-search.vue +0 -60
|
@@ -7,28 +7,37 @@ import ActualResolutionTimeFilter from './actual-resolution-time/actual-resoluti
|
|
|
7
7
|
import ActualResolutionTimeFilterPreview from './actual-resolution-time/actual-resolution-time-filter-value-preview.vue';
|
|
8
8
|
import AgentFilter from './agent/agent-filter-value-field.vue';
|
|
9
9
|
import AgentFilterPreview from './agent/agent-filter-value-preview.vue';
|
|
10
|
+
import { searchMethod as agentSearchMethod } from './agent/config';
|
|
10
11
|
import AmdResultFilter from './amd-result/amd-result-filter-value-field.vue';
|
|
11
12
|
import AmdResultFilterPreview from './amd-result/amd-result-filter-value-preview.vue';
|
|
12
13
|
import AssigneeFilter from './assignee/assignee-filter-value-field.vue';
|
|
13
14
|
import AssigneeFilterPreview from './assignee/assignee-filter-value-preview.vue';
|
|
15
|
+
import { searchMethod as assigneeSearchMethod } from './assignee/config';
|
|
14
16
|
import AuthorFilter from './author/author-filter-value-field.vue';
|
|
15
17
|
import AuthorFilterPreview from './author/author-filter-value-preview.vue';
|
|
18
|
+
import { searchMethod as authorSearchMethod } from './author/config';
|
|
16
19
|
import CauseFilter from './cause/cause-filter-value-field.vue';
|
|
17
20
|
import CauseFilterPreview from './cause/cause-filter-value-preview.vue';
|
|
18
21
|
import CloseReasonGroupsCaseFilter from './close-reason-groups-case/close-reason-groups-case-filter-value-field.vue';
|
|
19
22
|
import CloseReasonGroupsCaseFilterPreview from './close-reason-groups-case/close-reason-groups-case-filter-value-preview.vue';
|
|
23
|
+
import { searchMethod as contactSearchMethod } from './contact/config';
|
|
20
24
|
import ContactFilter from './contact/contact-filter-value-field.vue';
|
|
21
25
|
import ContactFilterPreview from './contact/contact-filter-value-preview.vue';
|
|
26
|
+
import { searchMethod as contactGroupSearchMethod } from './contact-group/config';
|
|
22
27
|
import ContactGroupFilter from './contact-group/contact-group-filter-value-field.vue';
|
|
23
28
|
import ContactGroupFilterPreview from './contact-group/contact-group-filter-value-preview.vue';
|
|
29
|
+
import CreatedAtFilterValueField from './created-at/created-at-filter-value-field.vue';
|
|
30
|
+
import CreatedAtFilterPreview from './created-at/created-at-filter-value-preview.vue';
|
|
24
31
|
import CreatedAtFromFilter from './created-at-from/created-at-from-filter-value-field.vue';
|
|
25
32
|
import CreatedAtFromFilterPreview from './created-at-from/created-at-from-filter-value-preview.vue';
|
|
26
33
|
import CreatedAtToFilter from './created-at-to/created-at-to-filter-value-field.vue';
|
|
27
34
|
import CreatedAtToFilterPreview from './created-at-to/created-at-to-filter-value-preview.vue';
|
|
28
35
|
import DirectionFilter from './direction/direction-filter-value-field.vue';
|
|
29
36
|
import DirectionFilterPreview from './direction/direction-filter-value-preview.vue';
|
|
37
|
+
import { searchMethod as gatewaySearchMethod } from './gateway/config';
|
|
30
38
|
import GatewayFilter from './gateway/gateway-filter-value-field.vue';
|
|
31
39
|
import GatewayFilterPreview from './gateway/gateway-filter-value-preview.vue';
|
|
40
|
+
import { searchMethod as granteeSearchMethod } from './grantee/config';
|
|
32
41
|
import GranteeFilter from './grantee/grantee-filter-value-field.vue';
|
|
33
42
|
import GranteeFilterPreview from './grantee/grantee-filter-value-preview.vue';
|
|
34
43
|
import HasAttachmentFilter from './has-attachment/has-attachment-filter-value-field.vue';
|
|
@@ -39,30 +48,38 @@ import HasRatingFilterValueField from './has-rating/has-rating-filter-value-fiel
|
|
|
39
48
|
import HasRatingFilterValuePreview from './has-rating/has-rating-filter-value-preview.vue';
|
|
40
49
|
import HasTranscriptionFilter from './has-transcription/has-transcription-filter-value-field.vue';
|
|
41
50
|
import HasTranscriptionFilterPreview from './has-transcription/has-transcription-filter-value-preview.vue';
|
|
51
|
+
import { searchMethod as impactedSearchMethod } from './impacted/config';
|
|
42
52
|
import ImpactedFilter from './impacted/impacted-filter-value-field.vue';
|
|
43
53
|
import ImpactedFilterPreview from './impacted/impacted-filter-value-preview.vue';
|
|
54
|
+
import { searchMethod as priorityCaseSearchMethod } from './priority-case/config';
|
|
44
55
|
import CasePriorityFilter from './priority-case/priority-case-filter-value-field.vue';
|
|
45
56
|
import CasePriorityFilterPreview from './priority-case/priority-case-filter-value-preview.vue';
|
|
57
|
+
import { searchMethod as queueSearchMethod } from './queue/config';
|
|
46
58
|
import QueueFilter from './queue/queue-filter-value-field.vue';
|
|
47
59
|
import QueueFilterPreview from './queue/queue-filter-value-preview.vue';
|
|
60
|
+
import { searchMethod as ratedBySearchMethod } from './rated-by/config';
|
|
48
61
|
import RatedByFilter from './rated-by/rated-by-filter-value-field.vue';
|
|
49
62
|
import RatedByFilterPreview from './rated-by/rated-by-filter-value-preview.vue';
|
|
50
63
|
import RatingFromToFilter from './rating/rating-from-to-filter-value-field.vue';
|
|
51
64
|
import RatingFromToFilterPreview from './rating/rating-from-to-filter-value-preview.vue';
|
|
52
65
|
import ReactionTimeFilter from './reaction-time/reaction-time-filter-value-field.vue';
|
|
53
66
|
import ReactionTimeFilterPreview from './reaction-time/reaction-time-filter-value-preview.vue';
|
|
67
|
+
import { searchMethod as reporterSearchMethod } from './reporter/config';
|
|
54
68
|
import ReporterFilter from './reporter/reporter-filter-value-field.vue';
|
|
55
69
|
import ReporterFilterPreview from './reporter/reporter-filter-value-preview.vue';
|
|
56
70
|
import ResolutionTimeFilter from './resolution-time/resolution-time-filter-value-field.vue';
|
|
57
71
|
import ResolutionTimeFilterPreview from './resolution-time/resolution-time-filter-value-preview.vue';
|
|
58
72
|
import ScoreFilter from './score/score-from-to-filter-value-field.vue';
|
|
59
73
|
import ScoreFilterPreview from './score/score-from-to-filter-value-preview.vue';
|
|
74
|
+
import { searchMethod as serviceCaseSearchMethod } from './service-case/config';
|
|
60
75
|
import CaseServiceFilter from './service-case/service-case-filter-value-field.vue';
|
|
61
76
|
import CaseServiceFilterPreview from './service-case/service-case-filter-value-preview.vue';
|
|
77
|
+
import { searchMethod as slaSearchMethod } from './sla/config';
|
|
62
78
|
import SlaFilter from './sla/sla-filter-value-field.vue';
|
|
63
79
|
import SlaFilterPreview from './sla/sla-filter-value-preview.vue';
|
|
64
80
|
import SlaConditionFilter from './sla-condition/sla-condition-filter-value-field.vue';
|
|
65
81
|
import SlaConditionFilterPreview from './sla-condition/sla-condition-filter-value-preview.vue';
|
|
82
|
+
import { searchMethod as sourceCaseSearchMethod } from './source-case/config';
|
|
66
83
|
import CaseSourceFilter from './source-case/source-case-filter-value-field.vue';
|
|
67
84
|
import CaseSourceFilterPreview from './source-case/source-case-filter-value-preview.vue';
|
|
68
85
|
import CaseStatusFilter from './status-case/status-case-filter-value-field.vue';
|
|
@@ -71,10 +88,12 @@ import TagFilter from './tag/tag-filter-value-field.vue';
|
|
|
71
88
|
import TagFilterPreview from './tag/tag-filter-value-preview.vue';
|
|
72
89
|
import TalkDurationFilter from './talk-duration/talk-duration-filter-value-field.vue';
|
|
73
90
|
import TalkDurationFilterPreview from './talk-duration/talk-duration-filter-value-preview.vue';
|
|
91
|
+
import { searchMethod as teamSearchMethod } from './team/config';
|
|
74
92
|
import TeamFilter from './team/team-filter-value-field.vue';
|
|
75
93
|
import TeamFilterPreview from './team/team-filter-value-preview.vue';
|
|
76
94
|
import TotalDurationFilter from './total-duration/total-duration-filter-value-field.vue';
|
|
77
95
|
import TotalDurationFilterPreview from './total-duration/total-duration-filter-value-preview.vue';
|
|
96
|
+
import { searchMethod as userSearchMethod } from './user/config';
|
|
78
97
|
import UserFilter from './user/user-filter-value-field.vue';
|
|
79
98
|
import UserFilterPreview from './user/user-filter-value-preview.vue';
|
|
80
99
|
import VariableFilter from './variable/variable-filter-value-field.vue';
|
|
@@ -109,6 +128,7 @@ export {
|
|
|
109
128
|
ContactFilterPreview,
|
|
110
129
|
ContactGroupFilter,
|
|
111
130
|
ContactGroupFilterPreview,
|
|
131
|
+
CreatedAtFilterValueField,
|
|
112
132
|
CreatedAtFromFilter,
|
|
113
133
|
CreatedAtFromFilterPreview,
|
|
114
134
|
CreatedAtToFilter,
|
|
@@ -182,6 +202,7 @@ export const FilterOptionToValueComponentMap: Record<FilterOption, Component> =
|
|
|
182
202
|
[FilterOption.HasTranscription]: HasTranscriptionFilter,
|
|
183
203
|
[FilterOption.User]: UserFilter,
|
|
184
204
|
[FilterOption.Variable]: VariableFilter,
|
|
205
|
+
[FilterOption.CreatedAt]: CreatedAtFilterValueField,
|
|
185
206
|
[FilterOption.CreatedAtFrom]: CreatedAtFromFilter,
|
|
186
207
|
[FilterOption.CreatedAtTo]: CreatedAtToFilter,
|
|
187
208
|
[FilterOption.Status]: CaseStatusFilter,
|
|
@@ -208,6 +229,7 @@ export const FilterOptionToPreviewComponentMap: Record<
|
|
|
208
229
|
FilterOption,
|
|
209
230
|
Component
|
|
210
231
|
> = {
|
|
232
|
+
[FilterOption.CreatedAt]: CreatedAtFilterPreview,
|
|
211
233
|
[FilterOption.Agent]: AgentFilterPreview,
|
|
212
234
|
[FilterOption.AmdResult]: AmdResultFilterPreview,
|
|
213
235
|
[FilterOption.Contact]: ContactFilterPreview,
|
|
@@ -248,3 +270,26 @@ export const FilterOptionToPreviewComponentMap: Record<
|
|
|
248
270
|
[FilterOption.ActualResolutionTime]: ActualResolutionTimeFilterPreview,
|
|
249
271
|
[FilterOption.HasAttachment]: HasAttachmentFilterPreview,
|
|
250
272
|
};
|
|
273
|
+
|
|
274
|
+
export const FilterOptionToApiSearchMethodMap: Record<
|
|
275
|
+
FilterOption,
|
|
276
|
+
(unknown) => { items }
|
|
277
|
+
> = {
|
|
278
|
+
[FilterOption.Agent]: agentSearchMethod,
|
|
279
|
+
[FilterOption.Gateway]: gatewaySearchMethod,
|
|
280
|
+
[FilterOption.Grantee]: granteeSearchMethod,
|
|
281
|
+
[FilterOption.Queue]: queueSearchMethod,
|
|
282
|
+
[FilterOption.RatedBy]: ratedBySearchMethod,
|
|
283
|
+
[FilterOption.Reporter]: reporterSearchMethod,
|
|
284
|
+
[FilterOption.Sla]: slaSearchMethod,
|
|
285
|
+
[FilterOption.Service]: serviceCaseSearchMethod,
|
|
286
|
+
[FilterOption.Source]: sourceCaseSearchMethod,
|
|
287
|
+
[FilterOption.User]: userSearchMethod,
|
|
288
|
+
[FilterOption.ContactGroup]: contactGroupSearchMethod,
|
|
289
|
+
[FilterOption.Assignee]: assigneeSearchMethod,
|
|
290
|
+
[FilterOption.Author]: authorSearchMethod,
|
|
291
|
+
[FilterOption.Priority]: priorityCaseSearchMethod,
|
|
292
|
+
[FilterOption.Impacted]: impactedSearchMethod,
|
|
293
|
+
[FilterOption.Contact]: contactSearchMethod,
|
|
294
|
+
[FilterOption.Team]: teamSearchMethod,
|
|
295
|
+
};
|
|
@@ -1,31 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<li
|
|
4
|
-
v-for="({ name }, index) of localValue"
|
|
5
|
-
:key="index"
|
|
6
|
-
>
|
|
7
|
-
{{ name }}
|
|
8
|
-
</li>
|
|
9
|
-
</ul>
|
|
2
|
+
<lookup-filter-value-preview v-bind="props" />
|
|
10
3
|
</template>
|
|
11
4
|
|
|
12
5
|
<script lang="ts" setup>
|
|
13
|
-
import {
|
|
6
|
+
import type { EngineQueue } from 'webitel-sdk';
|
|
14
7
|
|
|
15
|
-
import
|
|
8
|
+
import LookupFilterValuePreview from '../_shared/lookup-filter-preview/lookup-filter-value-preview.vue';
|
|
16
9
|
|
|
17
10
|
const props = defineProps<{
|
|
18
|
-
value:
|
|
11
|
+
value: EngineQueue[];
|
|
19
12
|
}>();
|
|
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
13
|
</script>
|
|
30
14
|
|
|
31
15
|
<style scoped></style>
|
|
@@ -1,31 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<li
|
|
4
|
-
v-for="({ name }, index) of localValue"
|
|
5
|
-
:key="index"
|
|
6
|
-
>
|
|
7
|
-
{{ name }}
|
|
8
|
-
</li>
|
|
9
|
-
</ul>
|
|
2
|
+
<lookup-filter-value-preview v-bind="props" />
|
|
10
3
|
</template>
|
|
11
4
|
|
|
12
5
|
<script lang="ts" setup>
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
import { searchMethod } from './config.js';
|
|
6
|
+
import LookupFilterValuePreview from '../_shared/lookup-filter-preview/lookup-filter-value-preview.vue';
|
|
16
7
|
|
|
17
8
|
const props = defineProps<{
|
|
18
|
-
|
|
9
|
+
/**
|
|
10
|
+
* would be great to use generated type for this
|
|
11
|
+
* */
|
|
12
|
+
value: Record<string, unknown>[];
|
|
19
13
|
}>();
|
|
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
14
|
</script>
|
|
30
15
|
|
|
31
16
|
<style scoped></style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ServiceCatalogsAPI from '@webitel/ui-sdk/api/clients/caseServiceCatalogs/
|
|
1
|
+
import ServiceCatalogsAPI from '@webitel/ui-sdk/api/clients/caseServiceCatalogs/serviceCatalogs';
|
|
2
2
|
import ServicesAPI from '@webitel/ui-sdk/api/clients/caseServices/services';
|
|
3
3
|
|
|
4
4
|
export const searchMethod = ServiceCatalogsAPI.getList;
|
|
@@ -1,31 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<li
|
|
4
|
-
v-for="({ name }, index) of localValue"
|
|
5
|
-
:key="index"
|
|
6
|
-
>
|
|
7
|
-
{{ name }}
|
|
8
|
-
</li>
|
|
9
|
-
</ul>
|
|
2
|
+
<lookup-filter-value-preview v-bind="props" />
|
|
10
3
|
</template>
|
|
11
4
|
|
|
12
5
|
<script lang="ts" setup>
|
|
13
|
-
import {
|
|
6
|
+
import type { EngineAgentTeam } from 'webitel-sdk';
|
|
14
7
|
|
|
15
|
-
import
|
|
8
|
+
import LookupFilterValuePreview from '../_shared/lookup-filter-preview/lookup-filter-value-preview.vue';
|
|
16
9
|
|
|
17
10
|
const props = defineProps<{
|
|
18
|
-
value:
|
|
11
|
+
value: EngineAgentTeam[];
|
|
19
12
|
}>();
|
|
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
13
|
</script>
|
|
30
14
|
|
|
31
15
|
<style scoped></style>
|
|
@@ -1,31 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<li
|
|
4
|
-
v-for="({ name }, index) of localValue"
|
|
5
|
-
:key="index"
|
|
6
|
-
>
|
|
7
|
-
{{ name }}
|
|
8
|
-
</li>
|
|
9
|
-
</ul>
|
|
2
|
+
<lookup-filter-value-preview v-bind="props" />
|
|
10
3
|
</template>
|
|
11
4
|
|
|
12
5
|
<script lang="ts" setup>
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
import { searchMethod } from './config.js';
|
|
6
|
+
import LookupFilterValuePreview from '../_shared/lookup-filter-preview/lookup-filter-value-preview.vue';
|
|
16
7
|
|
|
17
8
|
const props = defineProps<{
|
|
18
|
-
|
|
9
|
+
/**
|
|
10
|
+
* would be great to use generated type for this
|
|
11
|
+
* */
|
|
12
|
+
value: Record<string, unknown>[];
|
|
19
13
|
}>();
|
|
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
14
|
</script>
|
|
30
15
|
|
|
31
16
|
<style scoped></style>
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<dynamic-filter-config-view :disabled="
|
|
2
|
+
<dynamic-filter-config-view :disabled="readonly">
|
|
3
3
|
<template #activator="{ visible: configFormVisible }">
|
|
4
|
-
<wt-tooltip
|
|
4
|
+
<wt-tooltip
|
|
5
|
+
:disabled="configFormVisible"
|
|
6
|
+
@update:visible="!localValue && fillLocalValue()"
|
|
7
|
+
>
|
|
5
8
|
<template #activator>
|
|
6
9
|
<wt-chip color="primary">
|
|
7
10
|
{{ filter.label || t(`webitelUI.filters.${filter.name}`) }}
|
|
8
11
|
<wt-icon-btn
|
|
9
|
-
v-if="!
|
|
12
|
+
v-if="!filterConfig.notDeletable && !readonly"
|
|
10
13
|
icon="close--filled"
|
|
11
14
|
size="sm"
|
|
12
15
|
color="on-primary"
|
|
@@ -23,9 +26,14 @@
|
|
|
23
26
|
|
|
24
27
|
<template #default>
|
|
25
28
|
<slot name="info">
|
|
29
|
+
<wt-loader
|
|
30
|
+
v-if="!localValue"
|
|
31
|
+
size="sm"
|
|
32
|
+
/>
|
|
26
33
|
<component
|
|
27
34
|
:is="FilterOptionToPreviewComponentMap[filter.name]"
|
|
28
|
-
|
|
35
|
+
v-else
|
|
36
|
+
:value="localValue"
|
|
29
37
|
/>
|
|
30
38
|
</slot>
|
|
31
39
|
</template>
|
|
@@ -34,15 +42,18 @@
|
|
|
34
42
|
</wt-tooltip>
|
|
35
43
|
</template>
|
|
36
44
|
|
|
37
|
-
<template #content="
|
|
45
|
+
<template #content="{ tooltipSlotScope }">
|
|
38
46
|
<slot
|
|
39
47
|
name="form"
|
|
40
|
-
v-bind="
|
|
48
|
+
v-bind="{ tooltipSlotScope }"
|
|
41
49
|
>
|
|
42
50
|
<dynamic-filter-config-form
|
|
43
|
-
:filter="filter"
|
|
44
|
-
|
|
45
|
-
@
|
|
51
|
+
:filter="props.filter"
|
|
52
|
+
:options="filterOptions"
|
|
53
|
+
@cancel="() => tooltipSlotScope.hide()"
|
|
54
|
+
@submit="
|
|
55
|
+
(payload) => submit(payload, { hide: tooltipSlotScope.hide })
|
|
56
|
+
"
|
|
46
57
|
/>
|
|
47
58
|
</slot>
|
|
48
59
|
</template>
|
|
@@ -50,20 +61,34 @@
|
|
|
50
61
|
</template>
|
|
51
62
|
|
|
52
63
|
<script lang="ts" setup>
|
|
53
|
-
import {
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
import {
|
|
65
|
+
WtChip,
|
|
66
|
+
WtIconBtn,
|
|
67
|
+
WtLoader,
|
|
68
|
+
WtTooltip,
|
|
69
|
+
} from '@webitel/ui-sdk/components';
|
|
70
|
+
import { computed, ref } from 'vue';
|
|
56
71
|
import { useI18n } from 'vue-i18n';
|
|
57
72
|
|
|
58
|
-
import type {
|
|
73
|
+
import type { FilterOption } from '../../enums/FilterOption';
|
|
74
|
+
import type { FilterData, IFilter } from '../../types/Filter';
|
|
59
75
|
import DynamicFilterConfigForm from '../config/dynamic-filter-config-form.vue';
|
|
60
76
|
import DynamicFilterConfigView from '../config/dynamic-filter-config-view.vue';
|
|
61
|
-
import {
|
|
77
|
+
import {
|
|
78
|
+
FilterOptionToApiSearchMethodMap,
|
|
79
|
+
FilterOptionToPreviewComponentMap,
|
|
80
|
+
} from '../filter-options';
|
|
62
81
|
import DynamicFilterPreviewInfo from './dynamic-filter-preview-info.vue';
|
|
63
82
|
|
|
64
83
|
interface Props {
|
|
65
84
|
filter: IFilter;
|
|
66
|
-
|
|
85
|
+
/**
|
|
86
|
+
* @description
|
|
87
|
+
* is needed for form component to localize selected filter name value and/or
|
|
88
|
+
* pass filter options configs
|
|
89
|
+
*/
|
|
90
|
+
filterOptions: FilterOption[];
|
|
91
|
+
readonly?: boolean;
|
|
67
92
|
}
|
|
68
93
|
|
|
69
94
|
const { t } = useI18n();
|
|
@@ -71,16 +96,50 @@ const { t } = useI18n();
|
|
|
71
96
|
const props = defineProps<Props>();
|
|
72
97
|
|
|
73
98
|
const emit = defineEmits<{
|
|
74
|
-
'update:filter': [
|
|
99
|
+
'update:filter': [FilterData];
|
|
75
100
|
'delete:filter': [IFilter];
|
|
76
101
|
}>();
|
|
77
102
|
|
|
78
|
-
const
|
|
79
|
-
|
|
103
|
+
const filterConfig = computed(() => {
|
|
104
|
+
const thisFilterOption =
|
|
105
|
+
props.filterOptions?.find((option) => {
|
|
106
|
+
return option.value === props.filter.name;
|
|
107
|
+
}) || {};
|
|
108
|
+
|
|
109
|
+
return thisFilterOption;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const localValue = ref();
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @author @dlohvinov
|
|
116
|
+
*
|
|
117
|
+
* @description
|
|
118
|
+
* loading filters preview data -> main preview component
|
|
119
|
+
* instead of tooltip-components to avoid api requests spam
|
|
120
|
+
*/
|
|
121
|
+
const fillLocalValue = async (filter = props.filter) => {
|
|
122
|
+
const filterName = props.filter.name;
|
|
123
|
+
const filterValue = filter.value;
|
|
124
|
+
|
|
125
|
+
const valueSearchMethod = FilterOptionToApiSearchMethodMap[filterName];
|
|
126
|
+
|
|
127
|
+
if (valueSearchMethod) {
|
|
128
|
+
const { items } = await valueSearchMethod({ id: filterValue });
|
|
129
|
+
localValue.value = items;
|
|
130
|
+
} else {
|
|
131
|
+
localValue.value = filterValue;
|
|
132
|
+
}
|
|
80
133
|
};
|
|
81
134
|
|
|
82
|
-
const
|
|
135
|
+
const submit = (filter: IFilter, { hide }) => {
|
|
83
136
|
emit('update:filter', filter);
|
|
137
|
+
fillLocalValue(filter);
|
|
138
|
+
hide();
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const deleteFilter = () => {
|
|
142
|
+
emit('delete:filter', props.filter);
|
|
84
143
|
};
|
|
85
144
|
</script>
|
|
86
145
|
|
|
@@ -91,4 +150,8 @@ const submitFilterChange = (filter: FilterInitParams) => {
|
|
|
91
150
|
align-items: center;
|
|
92
151
|
gap: var(--spacing-2xs);
|
|
93
152
|
}
|
|
153
|
+
|
|
154
|
+
.wt-loader {
|
|
155
|
+
margin: auto;
|
|
156
|
+
}
|
|
94
157
|
</style>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-search-bar
|
|
3
|
+
:placeholder="t('reusable.search')"
|
|
4
|
+
:search-mode="searchMode"
|
|
5
|
+
:search-mode-options="searchModeOptions"
|
|
6
|
+
:value="localSearchValue"
|
|
7
|
+
@input="localSearchValue = $event"
|
|
8
|
+
@search="handleSearch"
|
|
9
|
+
@update:search-mode="updateSearchMode"
|
|
10
|
+
/>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import { WtSearchBar } from '@webitel/ui-sdk/components';
|
|
15
|
+
import {computed, type Ref, ref,watch} from 'vue';
|
|
16
|
+
import { useI18n } from 'vue-i18n';
|
|
17
|
+
|
|
18
|
+
import {FilterInitParams, FilterName} from "../../types/Filter";
|
|
19
|
+
import {IFiltersManager} from "../../types/FiltersManager";
|
|
20
|
+
import type { DynamicFilterSearchSearchModeOption } from './types/DynamicFilterSearch';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @description
|
|
24
|
+
* default search name is used when there are no search modes
|
|
25
|
+
*/
|
|
26
|
+
const defaultSearchName = 'search';
|
|
27
|
+
|
|
28
|
+
const props = defineProps<{
|
|
29
|
+
filtersManager: IFiltersManager;
|
|
30
|
+
searchModeOptions?: DynamicFilterSearchSearchModeOption[];
|
|
31
|
+
isFiltersRestoring?: boolean;
|
|
32
|
+
}>();
|
|
33
|
+
|
|
34
|
+
const emit = defineEmits<{
|
|
35
|
+
'filter:add': [FilterInitParams];
|
|
36
|
+
'filter:update': [FilterInitParams];
|
|
37
|
+
'filter:delete': [{ name: FilterName }];
|
|
38
|
+
}>();
|
|
39
|
+
|
|
40
|
+
const { t } = useI18n();
|
|
41
|
+
|
|
42
|
+
const searchMode: Ref<FilterName> = ref();
|
|
43
|
+
const localSearchValue = ref('');
|
|
44
|
+
|
|
45
|
+
const hasFilter = (filterName = searchMode.value) => {
|
|
46
|
+
return props.filtersManager.filters.has(filterName);
|
|
47
|
+
};
|
|
48
|
+
const addFilter = (filterInitParams: FilterInitParams) => {
|
|
49
|
+
return emit('filter:add', filterInitParams);
|
|
50
|
+
};
|
|
51
|
+
const updateFilter = (filterInitParams: FilterInitParams) => {
|
|
52
|
+
return emit('filter:update', filterInitParams);
|
|
53
|
+
};
|
|
54
|
+
const deleteFilter = ({ name }: { name: FilterName }) => {
|
|
55
|
+
return emit('filter:delete', { name });
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const hasSearchModes = computed(() => {
|
|
59
|
+
return props.searchModeOptions && props.searchModeOptions.length > 0;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
if (hasSearchModes.value) {
|
|
63
|
+
searchMode.value = props.searchModeOptions[0].value;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const currentSearchName = computed(() => {
|
|
67
|
+
if (hasSearchModes.value) {
|
|
68
|
+
return searchMode.value;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return defaultSearchName;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const handleSearch = (value = localSearchValue.value) => {
|
|
75
|
+
if (hasFilter(currentSearchName.value)) {
|
|
76
|
+
updateFilter({
|
|
77
|
+
name: currentSearchName.value,
|
|
78
|
+
value,
|
|
79
|
+
});
|
|
80
|
+
} else {
|
|
81
|
+
addFilter({
|
|
82
|
+
name: currentSearchName.value,
|
|
83
|
+
value,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const updateSearchMode = (nextSearchMode: DynamicFilterSearchSearchModeOption) => {
|
|
89
|
+
if (hasFilter(currentSearchName.value)) {
|
|
90
|
+
deleteFilter({
|
|
91
|
+
name: currentSearchName.value,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
searchMode.value = nextSearchMode.value;
|
|
95
|
+
localSearchValue.value = '';
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @description
|
|
100
|
+
* Restoring search value after filters were restored
|
|
101
|
+
*/
|
|
102
|
+
watch(() => props.isFiltersRestoring,
|
|
103
|
+
(next) => {
|
|
104
|
+
if (next) return;
|
|
105
|
+
|
|
106
|
+
let searchModes = [defaultSearchName];
|
|
107
|
+
if (hasSearchModes.value) {
|
|
108
|
+
searchModes = props.searchModeOptions?.map((option) => option.value);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
for (const mode of searchModes) {
|
|
112
|
+
if (hasFilter(mode)) {
|
|
113
|
+
searchMode.value = mode;
|
|
114
|
+
localSearchValue.value = props.filtersManager.filters.get(mode).value;
|
|
115
|
+
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
);
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<style scoped></style>
|