@webitel/ui-datalist 1.0.1 → 1.0.3
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 +5 -10
- package/src/filter-presets/api/PresetQuery.api.ts +7 -8
- package/src/filter-presets/components/_shared/input-fields/preset-description-field.vue +2 -3
- package/src/filter-presets/components/_shared/input-fields/preset-name-field.vue +2 -3
- package/src/filter-presets/components/_shared/preset-filters-preview.vue +2 -2
- package/src/filter-presets/components/apply-preset/apply-preset-action.vue +10 -10
- package/src/filter-presets/components/apply-preset/preset-preview.vue +6 -6
- package/src/filter-presets/components/save-preset/overwrite-preset-popup.vue +1 -1
- package/src/filter-presets/components/save-preset/save-preset-action.vue +4 -4
- package/src/filter-presets/components/save-preset/save-preset-popup.vue +1 -1
- package/src/filters/classes/FiltersManager.ts +2 -1
- package/src/filters/components/config/dynamic-filter-config-form-label.vue +2 -3
- package/src/filters/components/config/dynamic-filter-config-form.vue +33 -13
- package/src/filters/components/config/dynamic-filter-config-view.vue +4 -4
- package/src/filters/components/dynamic-filter-add-action.vue +26 -4
- package/src/filters/components/dynamic-filter-panel-wrapper.vue +1 -1
- package/src/filters/components/dynamic-filter-search.vue +2 -3
- package/src/filters/components/filter-options/_shared/has-options/has-option-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/actual-reaction-time/actual-reaction-time-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/actual-resolution-time/actual-resolution-time-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/agent/agent-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/agent/agent-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/agent/config.js +1 -1
- package/src/filters/components/filter-options/amd-result/amd-result-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/amd-result/amd-result-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/assignee/assignee-filter-value-field.vue +2 -3
- package/src/filters/components/filter-options/assignee/assignee-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/assignee/config.js +1 -1
- package/src/filters/components/filter-options/author/author-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/author/author-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/author/config.js +1 -1
- package/src/filters/components/filter-options/cause/cause-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/cause/cause-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/close-reason-groups-case/close-reason-groups-case-filter-value-field.vue +3 -3
- package/src/filters/components/filter-options/close-reason-groups-case/close-reason-groups-case-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/close-reason-groups-case/config.js +2 -2
- package/src/filters/components/filter-options/contact/config.js +1 -1
- package/src/filters/components/filter-options/contact/contact-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/contact/contact-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/contact-group/config.js +1 -1
- package/src/filters/components/filter-options/contact-group/contact-group-filter-value-field.vue +3 -3
- package/src/filters/components/filter-options/contact-group/contact-group-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/created-at-from/created-at-from-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/created-at-from/created-at-from-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/created-at-to/created-at-to-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/created-at-to/created-at-to-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/direction/direction-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/direction/direction-filter-value-preview.vue +2 -2
- package/src/filters/components/filter-options/gateway/config.js +1 -1
- package/src/filters/components/filter-options/gateway/gateway-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/gateway/gateway-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/grantee/config.js +1 -1
- package/src/filters/components/filter-options/grantee/grantee-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/grantee/grantee-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/has-attachment/has-attachment-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/has-attachment/has-attachment-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/has-file/has-file-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/has-file/has-file-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/has-rating/has-rating-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/has-rating/has-rating-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/has-transcription/has-transcription-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/has-transcription/has-transcription-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/impacted/config.js +1 -1
- package/src/filters/components/filter-options/impacted/impacted-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/impacted/impacted-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/priority-case/config.js +1 -1
- package/src/filters/components/filter-options/priority-case/priority-case-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/priority-case/priority-case-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/queue/config.js +1 -1
- package/src/filters/components/filter-options/queue/queue-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/queue/queue-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/rated-by/config.js +1 -1
- package/src/filters/components/filter-options/rated-by/rated-by-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/rated-by/rated-by-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/rating/rating-from-to-filter-value-field.vue +1 -2
- package/src/filters/components/filter-options/reaction-time/reaction-time-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/reporter/config.js +1 -1
- package/src/filters/components/filter-options/reporter/reporter-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/reporter/reporter-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/resolution-time/resolution-time-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/score/score-from-to-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/service-case/config.js +2 -2
- package/src/filters/components/filter-options/service-case/service-case-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/service-case/service-case-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/sla/config.js +1 -1
- package/src/filters/components/filter-options/sla/sla-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/sla/sla-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/sla-condition/config.js +2 -2
- package/src/filters/components/filter-options/sla-condition/sla-condition-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/sla-condition/sla-condition-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/source-case/config.js +1 -1
- package/src/filters/components/filter-options/source-case/source-case-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/source-case/source-case-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/status-case/config.js +2 -2
- package/src/filters/components/filter-options/status-case/status-case-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/status-case/status-case-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/tag/tag-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/tag/tag-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/talk-duration/talk-duration-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/team/config.js +1 -1
- package/src/filters/components/filter-options/team/team-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/team/team-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/total-duration/total-duration-filter-value-field.vue +1 -1
- package/src/filters/components/filter-options/user/config.js +1 -1
- package/src/filters/components/filter-options/user/user-filter-value-field.vue +2 -2
- package/src/filters/components/filter-options/user/user-filter-value-preview.vue +1 -1
- package/src/filters/components/filter-options/variable/variable-filter-value-field.vue +2 -3
- package/src/filters/components/preview/dynamic-filter-preview.vue +25 -7
- package/src/filters/components/table-filters-panel.vue +137 -67
- package/src/filters/index.ts +10 -1
- package/src/filters/types/Filter.d.ts +5 -0
- package/src/headers/createTableHeadersStore.ts +3 -3
- package/src/types/tableStore.types.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import CaseStatusConditionsAPI from '
|
|
2
|
-
import CaseStatusesApi from '
|
|
1
|
+
import CaseStatusConditionsAPI from '@webitel/ui-sdk/api/clients/caseStatusConditions/caseStatusConditions';
|
|
2
|
+
import CaseStatusesApi from '@webitel/ui-sdk/api/clients/caseStatuses/caseStatuses';
|
|
3
3
|
|
|
4
4
|
export const caseStatusesSearchMethod = CaseStatusesApi.getLookup;
|
|
5
5
|
export const caseStatusConditionsSearchMethod =
|
package/src/filters/components/filter-options/status-case/status-case-filter-value-field.vue
CHANGED
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
<script lang="ts" setup>
|
|
32
32
|
import { useVuelidate } from '@vuelidate/core';
|
|
33
33
|
import { required } from '@vuelidate/validators';
|
|
34
|
+
import { WtSelect } from '@webitel/ui-sdk/components';
|
|
34
35
|
import { computed, onMounted, watch } from 'vue';
|
|
35
36
|
import { useI18n } from 'vue-i18n';
|
|
36
37
|
|
|
37
|
-
import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
|
|
38
38
|
import {
|
|
39
39
|
caseStatusConditionsSearchMethod,
|
|
40
40
|
caseStatusesSearchMethod,
|
|
@@ -99,4 +99,4 @@ watch(
|
|
|
99
99
|
);
|
|
100
100
|
</script>
|
|
101
101
|
|
|
102
|
-
<style
|
|
102
|
+
<style scoped></style>
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
<script lang="ts" setup>
|
|
16
16
|
import { useVuelidate } from '@vuelidate/core';
|
|
17
17
|
import { required } from '@vuelidate/validators';
|
|
18
|
+
import { WtSelect } from '@webitel/ui-sdk/components';
|
|
18
19
|
import { computed, watch } from 'vue';
|
|
19
20
|
import { useI18n } from 'vue-i18n';
|
|
20
21
|
|
|
21
|
-
import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
|
|
22
22
|
import { TagOptions } from '../../../enums/tag-options';
|
|
23
23
|
|
|
24
24
|
const model = defineModel<string>();
|
|
@@ -49,4 +49,4 @@ watch(
|
|
|
49
49
|
);
|
|
50
50
|
</script>
|
|
51
51
|
|
|
52
|
-
<style
|
|
52
|
+
<style scoped></style>
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
<script lang="ts" setup>
|
|
15
15
|
import { useVuelidate } from '@vuelidate/core';
|
|
16
16
|
import { required } from '@vuelidate/validators';
|
|
17
|
+
import { WtSelect } from '@webitel/ui-sdk/components';
|
|
17
18
|
import { computed, watch } from 'vue';
|
|
18
19
|
import { useI18n } from 'vue-i18n';
|
|
19
20
|
|
|
20
|
-
import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
|
|
21
21
|
import { searchMethod } from './config.js';
|
|
22
22
|
|
|
23
23
|
type ModelValue = number[];
|
|
@@ -53,4 +53,4 @@ const handleInput = (value: ModelValue) => {
|
|
|
53
53
|
};
|
|
54
54
|
</script>
|
|
55
55
|
|
|
56
|
-
<style
|
|
56
|
+
<style scoped></style>
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
<script lang="ts" setup>
|
|
15
15
|
import { useVuelidate } from '@vuelidate/core';
|
|
16
16
|
import { required } from '@vuelidate/validators';
|
|
17
|
+
import { WtSelect } from '@webitel/ui-sdk/components';
|
|
17
18
|
import { computed, watch } from 'vue';
|
|
18
19
|
import { useI18n } from 'vue-i18n';
|
|
19
20
|
|
|
20
|
-
import WtSelect from '../../../../../../../components/wt-select/wt-select.vue';
|
|
21
21
|
import { searchMethod } from './config.js';
|
|
22
22
|
|
|
23
23
|
type ModelValue = number[];
|
|
@@ -53,4 +53,4 @@ const handleInput = (value: ModelValue) => {
|
|
|
53
53
|
};
|
|
54
54
|
</script>
|
|
55
55
|
|
|
56
|
-
<style
|
|
56
|
+
<style scoped></style>
|
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
<script lang="ts" setup>
|
|
10
10
|
import { useVuelidate } from '@vuelidate/core';
|
|
11
|
+
import variableSearchValidator from '@webitel/ui-sdk/validators/variableSearchValidator/variableSearchValidator';
|
|
11
12
|
import { computed, watch } from 'vue';
|
|
12
13
|
import { useI18n } from 'vue-i18n';
|
|
13
14
|
|
|
14
|
-
import variableSearchValidator from '../../../../../../../validators/variableSearchValidator/variableSearchValidator.js';
|
|
15
|
-
|
|
16
15
|
type ModelValue = string;
|
|
17
16
|
|
|
18
17
|
const model = defineModel<ModelValue>();
|
|
@@ -47,4 +46,4 @@ watch(
|
|
|
47
46
|
);
|
|
48
47
|
</script>
|
|
49
48
|
|
|
50
|
-
<style
|
|
49
|
+
<style scoped></style>
|
|
@@ -21,8 +21,13 @@
|
|
|
21
21
|
{{ t(`webitelUI.filters.${props.filter.name}`) }}
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
|
-
<template>
|
|
25
|
-
<slot name="info"
|
|
24
|
+
<template #default>
|
|
25
|
+
<slot name="info">
|
|
26
|
+
<component
|
|
27
|
+
:is="FilterOptionToPreviewComponentMap[filter.name]"
|
|
28
|
+
:value="filter.value"
|
|
29
|
+
/>
|
|
30
|
+
</slot>
|
|
26
31
|
</template>
|
|
27
32
|
</dynamic-filter-preview-info>
|
|
28
33
|
</template>
|
|
@@ -33,19 +38,27 @@
|
|
|
33
38
|
<slot
|
|
34
39
|
name="form"
|
|
35
40
|
v-bind="slotScope"
|
|
36
|
-
|
|
41
|
+
>
|
|
42
|
+
<dynamic-filter-config-form
|
|
43
|
+
:filter="filter"
|
|
44
|
+
@cancel="() => slotScope.hide()"
|
|
45
|
+
@submit="(payload) => submitFilterChange(payload) && slotScope.hide()"
|
|
46
|
+
/>
|
|
47
|
+
</slot>
|
|
37
48
|
</template>
|
|
38
49
|
</dynamic-filter-config-view>
|
|
39
50
|
</template>
|
|
40
51
|
|
|
41
52
|
<script lang="ts" setup>
|
|
53
|
+
import { WtChip } from '@webitel/ui-sdk/components';
|
|
54
|
+
import { WtIconBtn } from '@webitel/ui-sdk/components';
|
|
55
|
+
import { WtTooltip } from '@webitel/ui-sdk/components';
|
|
42
56
|
import { useI18n } from 'vue-i18n';
|
|
43
57
|
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import WtTooltip from '../../../../../../components/wt-tooltip/wt-tooltip.vue';
|
|
47
|
-
import type { IFilter } from '../../types/Filter';
|
|
58
|
+
import type { FilterInitParams, IFilter } from '../../types/Filter';
|
|
59
|
+
import DynamicFilterConfigForm from '../config/dynamic-filter-config-form.vue';
|
|
48
60
|
import DynamicFilterConfigView from '../config/dynamic-filter-config-view.vue';
|
|
61
|
+
import { FilterOptionToPreviewComponentMap } from '../filter-options';
|
|
49
62
|
import DynamicFilterPreviewInfo from './dynamic-filter-preview-info.vue';
|
|
50
63
|
|
|
51
64
|
interface Props {
|
|
@@ -58,12 +71,17 @@ const { t } = useI18n();
|
|
|
58
71
|
const props = defineProps<Props>();
|
|
59
72
|
|
|
60
73
|
const emit = defineEmits<{
|
|
74
|
+
'update:filter': [IFilter];
|
|
61
75
|
'delete:filter': [IFilter];
|
|
62
76
|
}>();
|
|
63
77
|
|
|
64
78
|
const deleteFilter = () => {
|
|
65
79
|
emit('delete:filter', props.filter);
|
|
66
80
|
};
|
|
81
|
+
|
|
82
|
+
const submitFilterChange = (filter: FilterInitParams) => {
|
|
83
|
+
emit('update:filter', filter);
|
|
84
|
+
};
|
|
67
85
|
</script>
|
|
68
86
|
|
|
69
87
|
<style lang="scss" scoped>
|
|
@@ -1,87 +1,157 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
>
|
|
19
|
-
<component
|
|
20
|
-
:is="getFilterValueComponent(filterName)"
|
|
21
|
-
:key="filterName"
|
|
22
|
-
:model-value="filterValue"
|
|
23
|
-
@update:model-value="onValueChange"
|
|
24
|
-
@undate:invalid="onValueInvalidChange"
|
|
25
|
-
/>
|
|
26
|
-
</template>
|
|
27
|
-
</dynamic-filter-config-form>
|
|
28
|
-
</template>
|
|
29
|
-
</dynamic-filter-add-action>
|
|
2
|
+
<dynamic-filter-panel-wrapper>
|
|
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>-->
|
|
30
18
|
|
|
31
19
|
<dynamic-filter-preview
|
|
32
20
|
v-for="filter of appliedFilters"
|
|
33
21
|
:key="filter.name"
|
|
34
22
|
:filter="filter"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
23
|
+
disable-click-away
|
|
24
|
+
@update:filter="emit('filter:update', $event)"
|
|
25
|
+
@delete:filter="emit('filter:delete', filter)"
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
<dynamic-filter-add-action
|
|
29
|
+
:show-label="!appliedFilters.length"
|
|
30
|
+
:filter-options="availableFilterOptions"
|
|
31
|
+
@add:filter="emit('filter:add', $event)"
|
|
32
|
+
/>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<template #actions>
|
|
36
|
+
<apply-preset-action
|
|
37
|
+
:namespace="props.presetNamespace"
|
|
38
|
+
:use-presets-store="props.usePresetsStore"
|
|
39
|
+
@apply="emit('preset:apply', $event)"
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
<save-preset-action
|
|
43
|
+
v-if="enablePresets"
|
|
44
|
+
:namespace="props.presetNamespace"
|
|
45
|
+
:filters-manager="props.filtersManager"
|
|
46
|
+
/>
|
|
47
|
+
|
|
48
|
+
<wt-icon-action
|
|
49
|
+
action="clear"
|
|
50
|
+
@click="emit('filter:reset-all')"
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
<wt-icon-action
|
|
54
|
+
action="close"
|
|
55
|
+
@click="emit('hide')"
|
|
56
|
+
/>
|
|
57
|
+
</template>
|
|
58
|
+
</dynamic-filter-panel-wrapper>
|
|
64
59
|
</template>
|
|
65
60
|
|
|
66
61
|
<script lang="ts" setup>
|
|
67
|
-
import
|
|
62
|
+
import { WtIconAction } from '@webitel/ui-sdk/components';
|
|
63
|
+
import { Store } from 'pinia';
|
|
64
|
+
import { computed } from 'vue';
|
|
65
|
+
import { useI18n } from 'vue-i18n';
|
|
66
|
+
|
|
67
|
+
import { ApplyPresetAction, SavePresetAction } from '../../filter-presets';
|
|
68
|
+
import { FilterOption } from '../enums/FilterOption';
|
|
69
|
+
import { FilterData, IFilter } from '../types/Filter';
|
|
70
|
+
import { IFiltersManager } from '../types/FiltersManager';
|
|
68
71
|
import DynamicFilterAddAction from './dynamic-filter-add-action.vue';
|
|
72
|
+
import DynamicFilterPanelWrapper from './dynamic-filter-panel-wrapper.vue';
|
|
69
73
|
import DynamicFilterPreview from './preview/dynamic-filter-preview.vue';
|
|
70
74
|
|
|
71
|
-
|
|
75
|
+
type Props = {
|
|
76
|
+
/**
|
|
77
|
+
* @description
|
|
78
|
+
* available filter options to set
|
|
79
|
+
*/
|
|
80
|
+
filterOptions: FilterOption[];
|
|
81
|
+
/**
|
|
82
|
+
* @description
|
|
83
|
+
* Looks like a anti-pattern, but save-preset.vue component needs filterManager
|
|
84
|
+
*/
|
|
85
|
+
filtersManager: IFiltersManager;
|
|
86
|
+
/**
|
|
87
|
+
* @description
|
|
88
|
+
* QueryPreset "section" field
|
|
89
|
+
*/
|
|
90
|
+
presetNamespace?: string;
|
|
91
|
+
/**
|
|
92
|
+
* @author @dlohvinov
|
|
93
|
+
*
|
|
94
|
+
* @description
|
|
95
|
+
* table store for operating with presets as dataList.
|
|
96
|
+
* Seems to me like a bad idea, because apply-preset should not store
|
|
97
|
+
* any data in a specific store – component state should be enough.
|
|
98
|
+
* However as for now, there's no composable implementing this logic,
|
|
99
|
+
* so store is used instead.
|
|
100
|
+
*
|
|
101
|
+
* TODO: https://github.com/webitel/webitel-ui-sdk/pull/551
|
|
102
|
+
*/
|
|
103
|
+
usePresetsStore: Store;
|
|
104
|
+
};
|
|
72
105
|
|
|
73
106
|
const props = defineProps<Props>();
|
|
74
107
|
|
|
108
|
+
/**
|
|
109
|
+
* @author @dlohvinov
|
|
110
|
+
*
|
|
111
|
+
* @description
|
|
112
|
+
* There are 2 reasons to use `add`/`update`/`delete` events
|
|
113
|
+
* instead of mutate `props.filtersManager` directly:
|
|
114
|
+
* 1. It's possible to add some custom logic on those event in parent component/store
|
|
115
|
+
* 2. filtersManager shouldn't be passed here, it seems to me like an anti-pattern
|
|
116
|
+
*/
|
|
75
117
|
const emit = defineEmits<{
|
|
76
|
-
'add
|
|
77
|
-
'update
|
|
78
|
-
'delete
|
|
79
|
-
'reset
|
|
118
|
+
'filter:add': [FilterData];
|
|
119
|
+
'filter:update': [FilterData];
|
|
120
|
+
'filter:delete': [IFilter];
|
|
121
|
+
'filter:reset-all': [];
|
|
122
|
+
/**
|
|
123
|
+
* string == filtersManager.toString() snapshot
|
|
124
|
+
*/
|
|
125
|
+
'preset:apply': [string];
|
|
80
126
|
hide: [];
|
|
81
127
|
}>();
|
|
128
|
+
|
|
129
|
+
const { t } = useI18n();
|
|
130
|
+
|
|
131
|
+
const appliedFilters = computed(() => {
|
|
132
|
+
return props.filtersManager.getFiltersList({
|
|
133
|
+
include: props.filterOptions,
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @description
|
|
139
|
+
* available filters to add, with appliedFilters excluded
|
|
140
|
+
*/
|
|
141
|
+
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
|
+
}));
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const enablePresets = computed(() => !!props.presetNamespace);
|
|
82
155
|
</script>
|
|
83
156
|
|
|
84
|
-
<style
|
|
85
|
-
.table-filters-panel {
|
|
86
|
-
}
|
|
87
|
-
</style>
|
|
157
|
+
<style scoped></style>
|
package/src/filters/index.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Filter } from './classes/Filter.ts';
|
|
2
2
|
import { createFiltersManager } from './classes/FiltersManager';
|
|
3
|
+
import DynamicFilterSearchComponent from './components/dynamic-filter-search.vue';
|
|
4
|
+
import TableFiltersPanelComponent from './components/table-filters-panel.vue';
|
|
5
|
+
import { FilterOption } from './enums/FilterOption';
|
|
3
6
|
import type {
|
|
4
7
|
FilterConfig,
|
|
5
8
|
FilterInitParams,
|
|
@@ -13,7 +16,13 @@ import type {
|
|
|
13
16
|
IFiltersManager,
|
|
14
17
|
} from './types/FiltersManager.d.ts';
|
|
15
18
|
|
|
16
|
-
export {
|
|
19
|
+
export {
|
|
20
|
+
createFiltersManager,
|
|
21
|
+
DynamicFilterSearchComponent,
|
|
22
|
+
Filter,
|
|
23
|
+
FilterOption,
|
|
24
|
+
TableFiltersPanelComponent,
|
|
25
|
+
};
|
|
17
26
|
|
|
18
27
|
export type {
|
|
19
28
|
FilterConfig,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { WtTableHeader } from '@webitel/ui-sdk/components/wt-table/types/WtTable';
|
|
2
|
+
import { sortToQueryAdapter } from '@webitel/ui-sdk/scripts';
|
|
3
|
+
import { SortSymbols } from '@webitel/ui-sdk/scripts/sortQueryAdapters';
|
|
1
4
|
import { defineStore } from 'pinia';
|
|
2
5
|
import { computed, ref } from 'vue';
|
|
3
6
|
|
|
4
|
-
import { WtTableHeader } from '../../../../components/wt-table/types/WtTable';
|
|
5
|
-
import { sortToQueryAdapter } from '../../../../scripts';
|
|
6
|
-
import { SortSymbols } from '../../../../scripts/sortQueryAdapters';
|
|
7
7
|
import { PersistedStorageType } from '../persist/PersistedStorage.types';
|
|
8
8
|
import { usePersistedStorage } from '../persist/usePersistedStorage.ts';
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ApiModule } from '@webitel/ui-sdk/api/types/ApiModule.type.ts';
|
|
1
2
|
import type { Ref } from 'vue';
|
|
2
3
|
|
|
3
|
-
import { ApiModule } from '../../../../api/types/ApiModule.type.ts';
|
|
4
4
|
import { IFiltersManager } from '../filters';
|
|
5
5
|
|
|
6
6
|
export interface useTableStoreParams<Entity> {
|