@webitel/ui-datalist 1.0.9 → 1.0.12
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 +7 -5
- package/src/index.ts +1 -1
- package/src/{filter-presets → modules/filter-presets}/components/_shared/preset-filters-preview.vue +16 -7
- package/src/{filter-presets → modules/filter-presets}/components/apply-preset/apply-preset-action.vue +9 -11
- package/src/{filter-presets → modules/filter-presets}/components/apply-preset/preset-preview.vue +13 -7
- package/src/{filter-presets → modules/filter-presets}/components/save-preset/save-preset-action.vue +8 -6
- package/src/{filter-presets → modules/filter-presets}/components/save-preset/save-preset-popup.vue +6 -1
- package/src/{filter-presets → modules/filter-presets}/stores/createFilterPresetsStore.ts +1 -1
- package/src/{filters/types/Filter.d.ts → modules/filters/classes/Filter.ts} +20 -3
- package/src/{filters → modules/filters}/classes/FiltersManager.ts +72 -5
- package/src/modules/filters/components/config/dynamic-filter-config-form-value-input.vue +27 -0
- package/src/{filters → modules/filters}/components/config/dynamic-filter-config-form.vue +46 -23
- package/src/{filters → modules/filters}/components/dynamic-filter-add-action.vue +4 -6
- package/src/{filters → modules/filters}/components/preview/dynamic-filter-preview.vue +32 -27
- package/src/{filters → modules/filters}/components/search-bar/dynamic-filter-search.vue +2 -2
- package/src/{filters → modules/filters}/components/search-bar/types/DynamicFilterSearch.d.ts +2 -2
- package/src/{filters → modules/filters}/components/table-filters-panel.vue +37 -44
- package/src/modules/filters/composables/useFilterConfigsToolkit.ts +136 -0
- package/src/{filters → modules/filters}/createTableFiltersStore.ts +4 -2
- package/src/{filters → modules/filters}/index.ts +12 -13
- package/src/modules/filters/modules/filterConfig/classes/FilterConfig.ts +109 -0
- package/src/modules/filters/modules/filterConfig/components/_custom/Readme.md +9 -0
- package/src/modules/filters/modules/filterConfig/components/_custom/index.ts +69 -0
- package/src/modules/filters/modules/filterConfig/components/_custom/type-extension-filter-value-field.vue +61 -0
- package/src/modules/filters/modules/filterConfig/components/_custom/type-extension-filter-value-preview.vue +18 -0
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/_shared/has-options/has-option-filter-value-field.vue +1 -1
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/amd-result/amd-result-filter-value-field.vue +1 -1
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/call-direction/call-direction-filter-value-field.vue +2 -2
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-assignee/case-assignee-filter-value-field.vue +7 -2
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-assignee/case-assignee-filter-value-preview.vue +1 -1
- package/src/modules/filters/modules/filterConfig/components/case-assignee/index.ts +30 -0
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/contact-group/contact-group-filter-value-preview.vue +1 -1
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/hangup-cause/hangup-cause-filter-value-field.vue +1 -1
- package/src/modules/filters/modules/filterConfig/components/has-attachment/has-attachment-filter-value-preview.vue +15 -0
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/has-file/has-file-filter-value-field.vue +3 -2
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/has-file/has-file-filter-value-preview.vue +1 -1
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/has-rating/has-rating-filter-value-field.vue +3 -2
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/has-rating/has-rating-filter-value-preview.vue +1 -1
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/has-transcription/has-transcription-filter-value-field.vue +3 -2
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/has-transcription/has-transcription-filter-value-preview.vue +1 -1
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/index.ts +10 -14
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/tag/tag-filter-value-field.vue +2 -2
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/tag/tag-filter-value-preview.vue +2 -2
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/talk-duration/talk-duration-filter-value-preview.vue +1 -1
- package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/total-duration/total-duration-filter-value-preview.vue +1 -1
- package/src/{filters/components/filter-options/_shared → modules/filters/modules/filterConfig}/composables/booleanFilterToolkit.ts +2 -1
- package/src/{filters → modules/filters/modules/filterConfig}/enums/FilterOption.ts +10 -10
- package/src/{filters/enums/amd-result-options.ts → modules/filters/modules/filterConfig/enums/options/AMDResultOptions.ts} +1 -1
- package/src/{filters/enums/boolean-options.ts → modules/filters/modules/filterConfig/enums/options/BooleanFilterOptions.ts} +2 -1
- package/src/{filters/enums/direction-options.ts → modules/filters/modules/filterConfig/enums/options/CallDirectionFilterOptions.ts} +1 -1
- package/src/modules/filters/modules/filterConfig/enums/options/CallHistoryTagFilterOptions.ts +8 -0
- package/src/{filters/enums/hangup-cause-options.ts → modules/filters/modules/filterConfig/enums/options/HangupCauseFilterOptions.ts} +1 -1
- package/src/{filters → modules/filters}/scripts/utils.ts +1 -1
- package/src/filters/classes/Filter.ts +0 -30
- package/src/filters/classes/FilterStorage.ts +0 -34
- package/src/filters/classes/FilterStorageOptions.d.ts +0 -6
- package/src/filters/components/filter-options/_shared/types/BooleanFilter.ts +0 -1
- package/src/filters/components/filter-options/contact/config.js +0 -3
- package/src/filters/components/filter-options/has-attachment/has-attachment-filter-value-preview.vue +0 -24
- package/src/filters/enums/tag-options.ts +0 -8
- package/src/filters/types/FiltersManager.d.ts +0 -76
- /package/src/{filter-presets/api/PresetQuery.api.ts → modules/filter-presets/api/PresetQuery.ts} +0 -0
- /package/src/{filter-presets → modules/filter-presets}/components/_shared/input-fields/preset-description-field.vue +0 -0
- /package/src/{filter-presets → modules/filter-presets}/components/_shared/input-fields/preset-name-field.vue +0 -0
- /package/src/{filter-presets → modules/filter-presets}/components/save-preset/overwrite-preset-popup.vue +0 -0
- /package/src/{filter-presets → modules/filter-presets}/index.ts +0 -0
- /package/src/{filter-presets → modules/filter-presets}/stores/headers/headers.ts +0 -0
- /package/src/{filters → modules/filters}/components/config/dynamic-filter-config-form-label.vue +0 -0
- /package/src/{filters → modules/filters}/components/config/dynamic-filter-config-view.vue +0 -0
- /package/src/{filters → modules/filters}/components/dynamic-filter-panel-wrapper.vue +0 -0
- /package/src/{filters → modules/filters}/components/preview/dynamic-filter-preview-info.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/_shared/date-time-filter/date-time-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/_shared/durations/duration-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/_shared/lookup-filter-preview/lookup-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/agent/agent-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/agent/agent-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/agent/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/amd-result/amd-result-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/call-direction/call-direction-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-actual-reaction-time/case-actual-reaction-time-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-actual-reaction-time/case-actual-reaction-time-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-actual-resolution-time/case-actual-resolution-time-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-actual-resolution-time/case-actual-resolution-time-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-author/case-author-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-author/case-author-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-author/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-close-reason-groups/case-close-reason-groups-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-close-reason-groups/case-close-reason-groups-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-close-reason-groups/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-impacted/case-impacted-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-impacted/case-impacted-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options/case-assignee → modules/filters/modules/filterConfig/components/case-impacted}/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-priority/case-priority-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-priority/case-priority-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-priority/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-reaction-time/case-reaction-time-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-reaction-time/case-reaction-time-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-reporter/case-reporter-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-reporter/case-reporter-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options/case-impacted → modules/filters/modules/filterConfig/components/case-reporter}/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-resolution-time/case-resolution-time-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-resolution-time/case-resolution-time-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-service/case-service-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-service/case-service-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-service/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-sla/case-sla-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-sla/case-sla-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-sla/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-sla-condition/case-sla-condition-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-sla-condition/case-sla-condition-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-sla-condition/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-source/case-source-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-source/case-source-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-source/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-status/case-status-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-status/case-status-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/case-status/config.js +0 -0
- /package/src/{filters/components/filter-options/case-reporter → modules/filters/modules/filterConfig/components/contact}/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/contact/contact-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/contact/contact-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/contact-group/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/contact-group/contact-group-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/created-at/created-at-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/created-at/created-at-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/created-at-from/created-at-from-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/created-at-from/created-at-from-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/created-at-to/created-at-to-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/created-at-to/created-at-to-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/gateway/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/gateway/gateway-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/gateway/gateway-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/grantee/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/grantee/grantee-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/grantee/grantee-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/hangup-cause/hangup-cause-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/has-attachment/has-attachment-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/queue/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/queue/queue-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/queue/queue-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/rated-by/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/rated-by/rated-by-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/rated-by/rated-by-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/rating/rating-from-to-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/rating/rating-from-to-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/score/score-from-to-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/score/score-from-to-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/talk-duration/TalkDurationFilter.d.ts +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/talk-duration/talk-duration-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/team/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/team/team-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/team/team-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/total-duration/TotalDurationFilter.d.ts +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/total-duration/total-duration-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/user/config.js +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/user/user-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/user/user-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/variable/variable-filter-value-field.vue +0 -0
- /package/src/{filters/components/filter-options → modules/filters/modules/filterConfig/components}/variable/variable-filter-value-preview.vue +0 -0
- /package/src/{filters/components/filter-options/_shared → modules/filters/modules/filterConfig}/composables/useFromToSecToPreviewTime.ts +0 -0
- /package/src/{headers → modules/headers}/createTableHeadersStore.ts +0 -0
- /package/src/{pagination → modules/pagination}/createTablePaginationStore.ts +0 -0
- /package/src/{persist → modules/persist}/PersistedStorage.types.ts +0 -0
- /package/src/{persist → modules/persist}/useLocalStoragePersistedStorage.ts +0 -0
- /package/src/{persist → modules/persist}/usePersistedStorage.ts +0 -0
- /package/src/{persist → modules/persist}/useRoutePersistedStorage.ts +0 -0
- /package/src/{table → modules/table}/createTableStore.store.ts +0 -0
- /package/src/{types → modules/types}/tableStore.types.ts +0 -0
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
>
|
|
8
8
|
<template #activator>
|
|
9
9
|
<wt-chip color="primary">
|
|
10
|
-
{{ filter.label ||
|
|
10
|
+
{{ filter.label || filterConfig.label }}
|
|
11
11
|
<wt-icon-btn
|
|
12
12
|
v-if="!filterConfig.notDeletable && !readonly"
|
|
13
|
+
color="on-primary"
|
|
13
14
|
icon="close--filled"
|
|
14
15
|
size="sm"
|
|
15
|
-
color="on-primary"
|
|
16
16
|
@mousedown.stop="deleteFilter"
|
|
17
17
|
/>
|
|
18
18
|
</wt-chip>
|
|
@@ -21,20 +21,21 @@
|
|
|
21
21
|
<template #default>
|
|
22
22
|
<dynamic-filter-preview-info>
|
|
23
23
|
<template #header>
|
|
24
|
-
{{
|
|
24
|
+
{{ filterConfig.label }}
|
|
25
25
|
</template>
|
|
26
26
|
|
|
27
27
|
<template #default>
|
|
28
28
|
<slot name="info">
|
|
29
29
|
<wt-loader
|
|
30
|
-
v-if="!
|
|
30
|
+
v-if="!isRenderPreview"
|
|
31
31
|
size="sm"
|
|
32
32
|
/>
|
|
33
33
|
<component
|
|
34
|
-
:is="
|
|
34
|
+
:is="filterConfig.valuePreviewComponent"
|
|
35
35
|
v-else
|
|
36
36
|
:value="localValue"
|
|
37
37
|
:filter="props.filter"
|
|
38
|
+
:filter-config="filterConfig"
|
|
38
39
|
/>
|
|
39
40
|
</slot>
|
|
40
41
|
</template>
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
>
|
|
51
52
|
<dynamic-filter-config-form
|
|
52
53
|
:filter="props.filter"
|
|
53
|
-
:
|
|
54
|
+
:filter-config="filterConfig"
|
|
54
55
|
@cancel="() => tooltipSlotScope.hide()"
|
|
55
56
|
@submit="
|
|
56
57
|
(payload) => submit(payload, { hide: tooltipSlotScope.hide })
|
|
@@ -68,27 +69,25 @@ import {
|
|
|
68
69
|
WtLoader,
|
|
69
70
|
WtTooltip,
|
|
70
71
|
} from '@webitel/ui-sdk/components';
|
|
71
|
-
import { computed,
|
|
72
|
+
import { computed,ref } from 'vue';
|
|
72
73
|
import { useI18n } from 'vue-i18n';
|
|
73
74
|
|
|
74
|
-
import
|
|
75
|
-
import
|
|
76
|
-
import DynamicFilterConfigForm from '../config/dynamic-filter-config-form.vue';
|
|
77
|
-
import DynamicFilterConfigView from '../config/dynamic-filter-config-view.vue';
|
|
75
|
+
import {FilterData, IFilter} from "../../classes/Filter";
|
|
76
|
+
import {TFilterConfig} from "../../modules/filterConfig/classes/FilterConfig";
|
|
78
77
|
import {
|
|
79
78
|
FilterOptionToPreviewApiSearchMethodMap,
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
} from '../../modules/filterConfig/components';
|
|
80
|
+
import DynamicFilterConfigForm from '../config/dynamic-filter-config-form.vue';
|
|
81
|
+
import DynamicFilterConfigView from '../config/dynamic-filter-config-view.vue';
|
|
82
82
|
import DynamicFilterPreviewInfo from './dynamic-filter-preview-info.vue';
|
|
83
83
|
|
|
84
84
|
interface Props {
|
|
85
85
|
filter: IFilter;
|
|
86
86
|
/**
|
|
87
87
|
* @description
|
|
88
|
-
*
|
|
89
|
-
* pass filter options configs
|
|
88
|
+
* this filter config
|
|
90
89
|
*/
|
|
91
|
-
|
|
90
|
+
filterConfig: TFilterConfig;
|
|
92
91
|
readonly?: boolean;
|
|
93
92
|
}
|
|
94
93
|
|
|
@@ -101,15 +100,6 @@ const emit = defineEmits<{
|
|
|
101
100
|
'delete:filter': [IFilter];
|
|
102
101
|
}>();
|
|
103
102
|
|
|
104
|
-
const filterConfig = computed(() => {
|
|
105
|
-
const thisFilterOption =
|
|
106
|
-
props.filterOptions?.find((option) => {
|
|
107
|
-
return option.value === props.filter.name;
|
|
108
|
-
}) || {};
|
|
109
|
-
|
|
110
|
-
return thisFilterOption;
|
|
111
|
-
});
|
|
112
|
-
|
|
113
103
|
const localValue = ref();
|
|
114
104
|
|
|
115
105
|
/**
|
|
@@ -123,16 +113,31 @@ const fillLocalValue = async (filter = props.filter) => {
|
|
|
123
113
|
const filterName = props.filter.name;
|
|
124
114
|
const filterValue = filter.value;
|
|
125
115
|
|
|
126
|
-
|
|
116
|
+
let valueSearchMethod;
|
|
117
|
+
|
|
118
|
+
if (props.filterConfig.searchRecords) {
|
|
119
|
+
/* arrow fn here preserves filterConfig class "this" */
|
|
120
|
+
valueSearchMethod = (...params) => props.filterConfig.searchRecords(...params)
|
|
121
|
+
} else {
|
|
122
|
+
valueSearchMethod = /* compat */ FilterOptionToPreviewApiSearchMethodMap[filterName];
|
|
123
|
+
}
|
|
127
124
|
|
|
128
125
|
if (valueSearchMethod) {
|
|
129
|
-
const { items } = await valueSearchMethod({ id: filterValue }
|
|
126
|
+
const { items } = await valueSearchMethod({ id: filterValue }, {
|
|
127
|
+
filterValue,
|
|
128
|
+
filterName,
|
|
129
|
+
filterConfig: props.filterConfig,
|
|
130
|
+
});
|
|
130
131
|
localValue.value = items;
|
|
131
132
|
} else {
|
|
132
133
|
localValue.value = filterValue;
|
|
133
134
|
}
|
|
134
135
|
};
|
|
135
136
|
|
|
137
|
+
// [https://webitel.atlassian.net/browse/WTEL-6732]
|
|
138
|
+
// if type filter is boolean and value = false, need display preview
|
|
139
|
+
const isRenderPreview = computed(() => localValue.value === false || localValue.value);
|
|
140
|
+
|
|
136
141
|
const submit = (filter: IFilter, { hide }) => {
|
|
137
142
|
emit('update:filter', filter);
|
|
138
143
|
fillLocalValue(filter);
|
|
@@ -15,9 +15,9 @@ import { WtSearchBar } from '@webitel/ui-sdk/components';
|
|
|
15
15
|
import {computed, type Ref, ref,watch} from 'vue';
|
|
16
16
|
import { useI18n } from 'vue-i18n';
|
|
17
17
|
|
|
18
|
-
import {FilterInitParams, FilterName} from "../../types/Filter";
|
|
19
|
-
import {IFiltersManager} from "../../types/FiltersManager";
|
|
20
18
|
import type { DynamicFilterSearchSearchModeOption } from './types/DynamicFilterSearch';
|
|
19
|
+
import {FilterInitParams, FilterName} from "../../classes/Filter";
|
|
20
|
+
import {IFiltersManager} from "../../classes/FiltersManager";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @description
|
package/src/{filters → modules/filters}/components/search-bar/types/DynamicFilterSearch.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WtSearchBarSearchModeOption } from '
|
|
2
|
-
import { FilterName } from '../../../
|
|
1
|
+
import { WtSearchBarSearchModeOption } from '../../../../../../../../src/components/wt-search-bar/types/WtSearchBar';
|
|
2
|
+
import { FilterName } from '../../../classes/Filter';
|
|
3
3
|
|
|
4
4
|
export type DynamicFilterSearchSearchModeOption =
|
|
5
5
|
WtSearchBarSearchModeOption<FilterName>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
<dynamic-filter-panel-wrapper>
|
|
3
3
|
<template #filters>
|
|
4
4
|
<dynamic-filter-preview
|
|
5
|
-
v-for="filter of
|
|
5
|
+
v-for="({ filter, filterConfig }) of appliedFilterToFilterConfigMappings"
|
|
6
6
|
:key="filter.name"
|
|
7
7
|
:filter="filter"
|
|
8
|
-
:filter-
|
|
8
|
+
:filter-config="filterConfig"
|
|
9
9
|
disable-click-away
|
|
10
10
|
@update:filter="emit('filter:update', $event)"
|
|
11
11
|
@delete:filter="emit('filter:delete', filter)"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
<dynamic-filter-add-action
|
|
15
15
|
:show-label="!appliedFilters.length"
|
|
16
|
-
:filter-
|
|
16
|
+
:filter-configs="unAppliedFiltersConfigs"
|
|
17
17
|
@add:filter="emit('filter:add', $event)"
|
|
18
18
|
/>
|
|
19
19
|
</template>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<apply-preset-action
|
|
23
23
|
:namespace="props.presetNamespace"
|
|
24
24
|
:use-presets-store="props.usePresetsStore"
|
|
25
|
-
:filter-
|
|
25
|
+
:filter-configs="filterConfigs"
|
|
26
26
|
@apply="emit('preset:apply', $event)"
|
|
27
27
|
/>
|
|
28
28
|
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
v-if="enablePresets"
|
|
31
31
|
:namespace="props.presetNamespace"
|
|
32
32
|
:filters-manager="props.filtersManager"
|
|
33
|
-
:
|
|
33
|
+
:filters-included="filtersIncluded"
|
|
34
|
+
:filter-configs="filterConfigs"
|
|
34
35
|
/>
|
|
35
36
|
|
|
36
37
|
<wt-icon-action
|
|
@@ -49,13 +50,15 @@
|
|
|
49
50
|
<script lang="ts" setup>
|
|
50
51
|
import { WtIconAction } from '@webitel/ui-sdk/components';
|
|
51
52
|
import { Store } from 'pinia';
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
53
|
+
import {computed} from 'vue';
|
|
54
|
+
import {WebitelProtoDataField} from "webitel-sdk";
|
|
54
55
|
|
|
55
56
|
import { ApplyPresetAction, SavePresetAction } from '../../filter-presets';
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
57
|
+
import {FilterData, IFilter} from "../classes/Filter";
|
|
58
|
+
import {IFiltersManager} from "../classes/FiltersManager";
|
|
59
|
+
import {useFilterConfigsToolkit} from "../composables/useFilterConfigsToolkit";
|
|
60
|
+
import {TFilterConfig} from "../modules/filterConfig/classes/FilterConfig";
|
|
61
|
+
import { FilterOption } from '../modules/filterConfig/enums/FilterOption';
|
|
59
62
|
import DynamicFilterAddAction from './dynamic-filter-add-action.vue';
|
|
60
63
|
import DynamicFilterPanelWrapper from './dynamic-filter-panel-wrapper.vue';
|
|
61
64
|
import DynamicFilterPreview from './preview/dynamic-filter-preview.vue';
|
|
@@ -65,13 +68,25 @@ type Props = {
|
|
|
65
68
|
* @description
|
|
66
69
|
* available filter options to set
|
|
67
70
|
*/
|
|
68
|
-
filterOptions: FilterOption[];
|
|
71
|
+
filterOptions: (FilterOption | TFilterConfig)[];
|
|
69
72
|
/**
|
|
70
73
|
* @description
|
|
71
74
|
* create local filters manager from snapshot
|
|
72
75
|
* inside save-preset.vue
|
|
73
76
|
*/
|
|
74
77
|
filtersManager: IFiltersManager;
|
|
78
|
+
/**
|
|
79
|
+
* @author @dlohvinov
|
|
80
|
+
*
|
|
81
|
+
* @implements
|
|
82
|
+
* [WTEL-6702](https://webitel.atlassian.net/browse/WTEL-6702)
|
|
83
|
+
*
|
|
84
|
+
* @description
|
|
85
|
+
* Decided to pass fields as a prop instead of converting them to
|
|
86
|
+
* Props.filterOptions, because this functionality can be expanded to many
|
|
87
|
+
* filter panels
|
|
88
|
+
*/
|
|
89
|
+
filterableExtensionFields?: WebitelProtoDataField[];
|
|
75
90
|
/**
|
|
76
91
|
* @description
|
|
77
92
|
* QueryPreset "section" field
|
|
@@ -89,7 +104,7 @@ type Props = {
|
|
|
89
104
|
*
|
|
90
105
|
* TODO: https://github.com/webitel/webitel-ui-sdk/pull/551
|
|
91
106
|
*/
|
|
92
|
-
usePresetsStore
|
|
107
|
+
usePresetsStore?: Store;
|
|
93
108
|
};
|
|
94
109
|
|
|
95
110
|
const props = defineProps<Props>();
|
|
@@ -115,38 +130,16 @@ const emit = defineEmits<{
|
|
|
115
130
|
hide: [];
|
|
116
131
|
}>();
|
|
117
132
|
|
|
118
|
-
const {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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 };
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* @description
|
|
142
|
-
* available filters to add, with appliedFilters excluded
|
|
143
|
-
*/
|
|
144
|
-
const availableFilterOptions = computed(() => {
|
|
145
|
-
return localizedFilterOptions.value.filter(({ value: opt }) => {
|
|
146
|
-
return appliedFilters.value.every((filter) => {
|
|
147
|
-
return filter.name !== opt;
|
|
148
|
-
});
|
|
149
|
-
});
|
|
133
|
+
const {
|
|
134
|
+
filterConfigs,
|
|
135
|
+
filtersIncluded,
|
|
136
|
+
appliedFilters,
|
|
137
|
+
appliedFilterToFilterConfigMappings,
|
|
138
|
+
unAppliedFiltersConfigs,
|
|
139
|
+
} = useFilterConfigsToolkit({
|
|
140
|
+
filterOptions: props.filterOptions,
|
|
141
|
+
filtersManager: props.filtersManager,
|
|
142
|
+
filterableExtensionFields: props.filterableExtensionFields,
|
|
150
143
|
});
|
|
151
144
|
|
|
152
145
|
const enablePresets = computed(() => !!props.presetNamespace);
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { computed, ComputedRef } from 'vue';
|
|
2
|
+
import { useI18n } from 'vue-i18n';
|
|
3
|
+
import { WebitelProtoDataField } from 'webitel-sdk';
|
|
4
|
+
|
|
5
|
+
import { FilterName, IFilter } from '../classes/Filter';
|
|
6
|
+
import { IFiltersManager } from '../classes/FiltersManager';
|
|
7
|
+
import {
|
|
8
|
+
BaseFilterConfig,
|
|
9
|
+
createFilterConfig,
|
|
10
|
+
FilterConfig,
|
|
11
|
+
} from '../modules/filterConfig/classes/FilterConfig';
|
|
12
|
+
import { createTypeExtensionFilterConfig } from '../modules/filterConfig/components/_custom';
|
|
13
|
+
import { FilterOption } from '../modules/filterConfig/enums/FilterOption';
|
|
14
|
+
|
|
15
|
+
export type FilterConfigToolkit = {
|
|
16
|
+
filterConfigs: ComputedRef<BaseFilterConfig[]>;
|
|
17
|
+
/**
|
|
18
|
+
* @description
|
|
19
|
+
* some filters may be stored in filtersManager,
|
|
20
|
+
* but not included in this filters panel
|
|
21
|
+
*/
|
|
22
|
+
filtersIncluded: ComputedRef<FilterName[]>;
|
|
23
|
+
appliedFilters: ComputedRef<IFilter[]>;
|
|
24
|
+
/**
|
|
25
|
+
* @description
|
|
26
|
+
* available filters to add, with appliedFilters excluded
|
|
27
|
+
*/
|
|
28
|
+
unAppliedFiltersConfigs: ComputedRef<BaseFilterConfig[]>;
|
|
29
|
+
appliedFilterToFilterConfigMappings: ComputedRef<
|
|
30
|
+
Array<{
|
|
31
|
+
filterConfig: BaseFilterConfig;
|
|
32
|
+
filter: IFilter;
|
|
33
|
+
}>
|
|
34
|
+
>;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type FilterConfigToolkitParams = {
|
|
38
|
+
filterOptions: (FilterOption | BaseFilterConfig)[];
|
|
39
|
+
filtersManager: IFiltersManager;
|
|
40
|
+
filterableExtensionFields: WebitelProtoDataField[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const useFilterConfigsToolkit = ({
|
|
44
|
+
filterOptions,
|
|
45
|
+
filtersManager,
|
|
46
|
+
filterableExtensionFields = [],
|
|
47
|
+
}: FilterConfigToolkitParams): FilterConfigToolkit => {
|
|
48
|
+
const { t } = useI18n();
|
|
49
|
+
|
|
50
|
+
const filterConfigs = computed(() => {
|
|
51
|
+
return (
|
|
52
|
+
filterOptions
|
|
53
|
+
/**
|
|
54
|
+
* make filterConfigs from standard filterOptions
|
|
55
|
+
*/
|
|
56
|
+
.map((opt) => {
|
|
57
|
+
if (opt instanceof FilterConfig) {
|
|
58
|
+
return opt;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (typeof opt === 'string') {
|
|
62
|
+
return createFilterConfig({ filterOption: opt });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return new FilterConfig({
|
|
66
|
+
...opt,
|
|
67
|
+
name: opt.name,
|
|
68
|
+
});
|
|
69
|
+
})
|
|
70
|
+
/**
|
|
71
|
+
* localize
|
|
72
|
+
*/
|
|
73
|
+
.map((filterConfig) => {
|
|
74
|
+
if (!filterConfig.label) {
|
|
75
|
+
filterConfig.label = t(`webitelUI.filters.${filterConfig.name}`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return filterConfig;
|
|
79
|
+
})
|
|
80
|
+
/**
|
|
81
|
+
* add filterConfigs for extension fields
|
|
82
|
+
*/
|
|
83
|
+
.concat(
|
|
84
|
+
filterableExtensionFields.map((field: WebitelProtoDataField) => {
|
|
85
|
+
return createTypeExtensionFilterConfig(
|
|
86
|
+
{ name: field.id },
|
|
87
|
+
{ field },
|
|
88
|
+
);
|
|
89
|
+
}),
|
|
90
|
+
)
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const filtersIncluded = computed(() => {
|
|
95
|
+
return filterConfigs.value.map(({ name }) => name);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const appliedFilters = computed(() => {
|
|
99
|
+
return filtersManager.getFiltersList({
|
|
100
|
+
include: filtersIncluded.value,
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const unAppliedFiltersConfigs = computed(() => {
|
|
105
|
+
return filterConfigs.value.filter(({ name }) => {
|
|
106
|
+
return !filtersManager.hasFilter(name);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const appliedFilterToFilterConfigMappings = computed(() => {
|
|
111
|
+
const filterNameToFilterConfigMap = filterConfigs.value.reduce(
|
|
112
|
+
(map, filterConfig) => {
|
|
113
|
+
return {
|
|
114
|
+
...map,
|
|
115
|
+
[filterConfig.name]: filterConfig,
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
{},
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
return appliedFilters.value.map((filter) => {
|
|
122
|
+
return {
|
|
123
|
+
filter,
|
|
124
|
+
filterConfig: filterNameToFilterConfigMap[filter.name],
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
filterConfigs,
|
|
131
|
+
filtersIncluded,
|
|
132
|
+
appliedFilters,
|
|
133
|
+
appliedFilterToFilterConfigMappings,
|
|
134
|
+
unAppliedFiltersConfigs,
|
|
135
|
+
};
|
|
136
|
+
};
|
|
@@ -3,8 +3,10 @@ import { computed, reactive, ref } from 'vue';
|
|
|
3
3
|
|
|
4
4
|
import { PersistedStorageType } from '../persist/PersistedStorage.types.ts';
|
|
5
5
|
import { usePersistedStorage } from '../persist/usePersistedStorage.ts';
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
createFiltersManager,
|
|
8
|
+
FiltersManagerConfig,
|
|
9
|
+
} from './classes/FiltersManager.ts';
|
|
8
10
|
|
|
9
11
|
export const createTableFiltersStore = (
|
|
10
12
|
namespace: string,
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import DynamicFilterSearchComponent from './components/search-bar/dynamic-filter-search.vue';
|
|
4
|
-
import TableFiltersPanelComponent from './components/table-filters-panel.vue';
|
|
5
|
-
import { FilterOption } from './enums/FilterOption';
|
|
6
|
-
import type {
|
|
1
|
+
import {
|
|
2
|
+
Filter,
|
|
7
3
|
FilterConfig,
|
|
8
4
|
FilterInitParams,
|
|
9
|
-
FilterLabel,
|
|
10
|
-
FilterName,
|
|
5
|
+
FilterLabel, FilterName,
|
|
11
6
|
FilterValue,
|
|
12
|
-
IFilter
|
|
13
|
-
} from './
|
|
14
|
-
import
|
|
7
|
+
IFilter
|
|
8
|
+
} from './classes/Filter';
|
|
9
|
+
import {
|
|
10
|
+
createFiltersManager,
|
|
15
11
|
FiltersManagerConfig,
|
|
16
|
-
IFiltersManager
|
|
17
|
-
} from './
|
|
12
|
+
IFiltersManager
|
|
13
|
+
} from './classes/FiltersManager';
|
|
14
|
+
import DynamicFilterSearchComponent from './components/search-bar/dynamic-filter-search.vue';
|
|
15
|
+
import TableFiltersPanelComponent from './components/table-filters-panel.vue';
|
|
16
|
+
import { FilterOption } from './modules/filterConfig/enums/FilterOption';
|
|
18
17
|
|
|
19
18
|
export {
|
|
20
19
|
createFiltersManager,
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { MessageResolver } from 'vue-i18n';
|
|
3
|
+
|
|
4
|
+
import { FilterName, FilterValue } from '../../../classes/Filter';
|
|
5
|
+
import {
|
|
6
|
+
FilterOptionToFilterConfigCreatorMap,
|
|
7
|
+
FilterOptionToPreviewComponentMap,
|
|
8
|
+
FilterOptionToValueComponentMap,
|
|
9
|
+
} from '../components';
|
|
10
|
+
import { FilterOption } from '../enums/FilterOption';
|
|
11
|
+
|
|
12
|
+
export interface BaseFilterConfig {
|
|
13
|
+
name: FilterName;
|
|
14
|
+
valueInputComponent: Component;
|
|
15
|
+
valuePreviewComponent: Component;
|
|
16
|
+
label?: ReturnType<MessageResolver> | string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type FilterConfigBaseParams = {
|
|
20
|
+
name?: FilterName;
|
|
21
|
+
valueInputComponent?: Component;
|
|
22
|
+
valuePreviewComponent?: Component;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export interface IWtSysTypeFilterConfig extends BaseFilterConfig {
|
|
26
|
+
searchRecords: (
|
|
27
|
+
params: FilterConfigSearchMethodParams,
|
|
28
|
+
) => Promise<{ items: unknown[]; next?: boolean }>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type FilterConfigSearchMethodParams = [
|
|
32
|
+
/**
|
|
33
|
+
* @description
|
|
34
|
+
* any request-related data
|
|
35
|
+
*/
|
|
36
|
+
unknown,
|
|
37
|
+
/**
|
|
38
|
+
* @description
|
|
39
|
+
* filter-related data
|
|
40
|
+
*/
|
|
41
|
+
{
|
|
42
|
+
filterName: FilterName;
|
|
43
|
+
filterValue: FilterValue;
|
|
44
|
+
filterConfig: BaseFilterConfig;
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
export type TFilterConfig = IWtSysTypeFilterConfig | BaseFilterConfig;
|
|
49
|
+
|
|
50
|
+
export class FilterConfig implements BaseFilterConfig {
|
|
51
|
+
name: FilterName;
|
|
52
|
+
valueInputComponent: Component;
|
|
53
|
+
valuePreviewComponent: Component;
|
|
54
|
+
label?: ReturnType<MessageResolver> | string;
|
|
55
|
+
|
|
56
|
+
constructor({
|
|
57
|
+
name,
|
|
58
|
+
valueInputComponent,
|
|
59
|
+
valuePreviewComponent,
|
|
60
|
+
}: FilterConfigBaseParams = {}) {
|
|
61
|
+
if (name) this.name = name;
|
|
62
|
+
if (valueInputComponent) this.valueInputComponent = valueInputComponent;
|
|
63
|
+
if (valuePreviewComponent)
|
|
64
|
+
this.valuePreviewComponent = valuePreviewComponent;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @author @dlohvinov
|
|
70
|
+
*
|
|
71
|
+
* @description
|
|
72
|
+
* "abstract" class is used to support default config fields for all WtSysTypeFilterConfig
|
|
73
|
+
* classes in future
|
|
74
|
+
*/
|
|
75
|
+
export abstract class WtSysTypeFilterConfig
|
|
76
|
+
extends FilterConfig
|
|
77
|
+
implements IWtSysTypeFilterConfig
|
|
78
|
+
{
|
|
79
|
+
abstract name;
|
|
80
|
+
abstract searchRecords;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const createFilterConfig = ({
|
|
84
|
+
filterOption,
|
|
85
|
+
}: {
|
|
86
|
+
filterOption: FilterOption;
|
|
87
|
+
}): BaseFilterConfig => {
|
|
88
|
+
const filterConfigClass = FilterOptionToFilterConfigCreatorMap[filterOption];
|
|
89
|
+
|
|
90
|
+
if (filterConfigClass) {
|
|
91
|
+
return filterConfigClass();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// throw new Error(
|
|
95
|
+
// `Filter config class not found for this filter option: ${filterOption}`,
|
|
96
|
+
// );
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @author @dlohvinov
|
|
100
|
+
*
|
|
101
|
+
* @deprecated
|
|
102
|
+
* compat. should be removed with FilterOption to Component maps
|
|
103
|
+
* */
|
|
104
|
+
return new FilterConfig({
|
|
105
|
+
name: filterOption,
|
|
106
|
+
valueInputComponent: FilterOptionToValueComponentMap[filterOption],
|
|
107
|
+
valuePreviewComponent: FilterOptionToPreviewComponentMap[filterOption],
|
|
108
|
+
});
|
|
109
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Filter Options/_custom
|
|
2
|
+
|
|
3
|
+
Зважайте!
|
|
4
|
+
|
|
5
|
+
Тут лежать компоненти для фільтрації ПО кастомних полях: тобто,
|
|
6
|
+
там, де ключем фільтра є назва кастомного поля, а значенням - значення з довідника того поля.
|
|
7
|
+
|
|
8
|
+
Ці компоненти не мають відношення до якихось фільтрів,
|
|
9
|
+
повʼязаних з назвами кастомних полів як велью якихось інших фільтрів.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { sysTypes } from '@webitel/ui-sdk/api/clients/index';
|
|
2
|
+
import { WebitelProtoDataField } from 'webitel-sdk';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
BaseFilterConfig,
|
|
6
|
+
FilterConfig,
|
|
7
|
+
FilterConfigBaseParams,
|
|
8
|
+
IWtSysTypeFilterConfig,
|
|
9
|
+
} from '../../classes/FilterConfig';
|
|
10
|
+
import { CustomFilterOption } from '../../enums/FilterOption';
|
|
11
|
+
import TypeExtensionFilterValueField from './type-extension-filter-value-field.vue';
|
|
12
|
+
import TypeExtensionFilterValuePreview from './type-extension-filter-value-preview.vue';
|
|
13
|
+
|
|
14
|
+
export interface ITypeExtensionFilterConfig extends BaseFilterConfig {
|
|
15
|
+
readonly field: WebitelProtoDataField;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class TypeExtensionFilterConfig
|
|
19
|
+
extends FilterConfig
|
|
20
|
+
implements ITypeExtensionFilterConfig
|
|
21
|
+
{
|
|
22
|
+
readonly field: WebitelProtoDataField;
|
|
23
|
+
|
|
24
|
+
constructor(
|
|
25
|
+
{ name }: FilterConfigBaseParams,
|
|
26
|
+
{ field }: { field: WebitelProtoDataField },
|
|
27
|
+
) {
|
|
28
|
+
super({
|
|
29
|
+
name,
|
|
30
|
+
valueInputComponent: TypeExtensionFilterValueField,
|
|
31
|
+
valuePreviewComponent: TypeExtensionFilterValuePreview,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
this.label = field.name;
|
|
35
|
+
this.field = field;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
class TypeExtensionWtSysTypeFieldFilterConfig
|
|
40
|
+
extends TypeExtensionFilterConfig
|
|
41
|
+
implements IWtSysTypeFilterConfig
|
|
42
|
+
{
|
|
43
|
+
searchRecords(
|
|
44
|
+
{ id: filterValue, ...rest },
|
|
45
|
+
// {
|
|
46
|
+
// filterValue,
|
|
47
|
+
// }: {
|
|
48
|
+
// filterValue: unknown;
|
|
49
|
+
// },
|
|
50
|
+
): Promise<{ items: unknown[]; next?: boolean }> {
|
|
51
|
+
return sysTypes.getLookup({
|
|
52
|
+
...rest,
|
|
53
|
+
...this.field.lookup,
|
|
54
|
+
id: filterValue,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const createTypeExtensionFilterConfig = (
|
|
60
|
+
name: CustomFilterOption,
|
|
61
|
+
{ field }: { field: WebitelProtoDataField },
|
|
62
|
+
) => {
|
|
63
|
+
switch (field.kind) {
|
|
64
|
+
case 'lookup':
|
|
65
|
+
return new TypeExtensionWtSysTypeFieldFilterConfig(name, { field });
|
|
66
|
+
default:
|
|
67
|
+
return new TypeExtensionFilterConfig(name, { field });
|
|
68
|
+
}
|
|
69
|
+
};
|