@webitel/ui-sdk 25.4.54 → 25.4.56
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/CHANGELOG.md +23 -0
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +93 -99
- package/dist/ui-sdk.umd.cjs +1 -1
- package/package.json +1 -1
- package/src/components/wt-context-menu/types/WtContextMenu.d.ts +4 -0
- package/src/components/wt-search-bar/types/WtSearchBar.d.ts +17 -0
- package/src/components/wt-search-bar/wt-search-bar.vue +23 -10
- package/src/locale/en/en.js +7 -7
- package/src/modules/Filters/v2/filter-presets/api/PresetQuery.api.ts +0 -123
- package/src/modules/Filters/v2/filter-presets/components/_shared/input-fields/preset-description-field.vue +0 -33
- package/src/modules/Filters/v2/filter-presets/components/_shared/input-fields/preset-name-field.vue +0 -29
- package/src/modules/Filters/v2/filter-presets/components/_shared/preset-filters-preview.vue +0 -45
- package/src/modules/Filters/v2/filter-presets/components/apply-preset/apply-preset-action.vue +0 -234
- package/src/modules/Filters/v2/filter-presets/components/apply-preset/preset-preview.vue +0 -210
- package/src/modules/Filters/v2/filter-presets/components/save-preset/overwrite-preset-popup.vue +0 -64
- package/src/modules/Filters/v2/filter-presets/components/save-preset/save-preset-action.vue +0 -139
- package/src/modules/Filters/v2/filter-presets/components/save-preset/save-preset-popup.vue +0 -136
- package/src/modules/Filters/v2/filter-presets/index.ts +0 -5
- package/src/modules/Filters/v2/filter-presets/stores/createFilterPresetsStore.ts +0 -17
- package/src/modules/Filters/v2/filter-presets/stores/headers/headers.ts +0 -24
- package/src/modules/Filters/v2/filters/classes/Filter.ts +0 -30
- package/src/modules/Filters/v2/filters/classes/FilterStorage.ts +0 -34
- package/src/modules/Filters/v2/filters/classes/FilterStorageOptions.d.ts +0 -6
- package/src/modules/Filters/v2/filters/classes/FiltersManager.ts +0 -189
- package/src/modules/Filters/v2/filters/components/config/dynamic-filter-config-form-label.vue +0 -50
- package/src/modules/Filters/v2/filters/components/config/dynamic-filter-config-form.vue +0 -140
- package/src/modules/Filters/v2/filters/components/config/dynamic-filter-config-view.vue +0 -40
- package/src/modules/Filters/v2/filters/components/dynamic-filter-add-action.vue +0 -54
- package/src/modules/Filters/v2/filters/components/dynamic-filter-panel-wrapper.vue +0 -57
- package/src/modules/Filters/v2/filters/components/dynamic-filter-search.vue +0 -80
- package/src/modules/Filters/v2/filters/components/filter-options/_shared/composables/booleanFilterToolkit.ts +0 -39
- package/src/modules/Filters/v2/filters/components/filter-options/_shared/composables/useFromToSecToPreviewTime.ts +0 -41
- package/src/modules/Filters/v2/filters/components/filter-options/_shared/date-time-filter/date-time-filter-value-field.vue +0 -56
- package/src/modules/Filters/v2/filters/components/filter-options/_shared/durations/duration-filter-value-field.vue +0 -84
- package/src/modules/Filters/v2/filters/components/filter-options/_shared/has-options/has-option-filter-value-field.vue +0 -38
- package/src/modules/Filters/v2/filters/components/filter-options/_shared/types/BooleanFilter.ts +0 -1
- package/src/modules/Filters/v2/filters/components/filter-options/actual-reaction-time/actual-reaction-time-filter-value-field.vue +0 -18
- package/src/modules/Filters/v2/filters/components/filter-options/actual-reaction-time/actual-reaction-time-filter-value-preview.vue +0 -44
- package/src/modules/Filters/v2/filters/components/filter-options/actual-resolution-time/actual-resolution-time-filter-value-field.vue +0 -18
- package/src/modules/Filters/v2/filters/components/filter-options/actual-resolution-time/actual-resolution-time-filter-value-preview.vue +0 -44
- package/src/modules/Filters/v2/filters/components/filter-options/agent/agent-filter-value-field.vue +0 -58
- package/src/modules/Filters/v2/filters/components/filter-options/agent/agent-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/agent/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/amd-result/amd-result-filter-value-field.vue +0 -52
- package/src/modules/Filters/v2/filters/components/filter-options/amd-result/amd-result-filter-value-preview.vue +0 -18
- package/src/modules/Filters/v2/filters/components/filter-options/assignee/assignee-filter-value-field.vue +0 -74
- package/src/modules/Filters/v2/filters/components/filter-options/assignee/assignee-filter-value-preview.vue +0 -36
- package/src/modules/Filters/v2/filters/components/filter-options/assignee/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/author/author-filter-value-field.vue +0 -56
- package/src/modules/Filters/v2/filters/components/filter-options/author/author-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/author/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/cause/cause-filter-value-field.vue +0 -52
- package/src/modules/Filters/v2/filters/components/filter-options/cause/cause-filter-value-preview.vue +0 -18
- package/src/modules/Filters/v2/filters/components/filter-options/close-reason-groups-case/close-reason-groups-case-filter-value-field.vue +0 -102
- package/src/modules/Filters/v2/filters/components/filter-options/close-reason-groups-case/close-reason-groups-case-filter-value-preview.vue +0 -34
- package/src/modules/Filters/v2/filters/components/filter-options/close-reason-groups-case/config.js +0 -7
- package/src/modules/Filters/v2/filters/components/filter-options/contact/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/contact/contact-filter-value-field.vue +0 -56
- package/src/modules/Filters/v2/filters/components/filter-options/contact/contact-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/contact-group/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/contact-group/contact-group-filter-value-field.vue +0 -74
- package/src/modules/Filters/v2/filters/components/filter-options/contact-group/contact-group-filter-value-preview.vue +0 -38
- package/src/modules/Filters/v2/filters/components/filter-options/created-at-from/created-at-from-filter-value-field.vue +0 -24
- package/src/modules/Filters/v2/filters/components/filter-options/created-at-from/created-at-from-filter-value-preview.vue +0 -15
- package/src/modules/Filters/v2/filters/components/filter-options/created-at-to/created-at-to-filter-value-field.vue +0 -24
- package/src/modules/Filters/v2/filters/components/filter-options/created-at-to/created-at-to-filter-value-preview.vue +0 -15
- package/src/modules/Filters/v2/filters/components/filter-options/direction/direction-filter-value-field.vue +0 -51
- package/src/modules/Filters/v2/filters/components/filter-options/direction/direction-filter-value-preview.vue +0 -17
- package/src/modules/Filters/v2/filters/components/filter-options/gateway/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/gateway/gateway-filter-value-field.vue +0 -56
- package/src/modules/Filters/v2/filters/components/filter-options/gateway/gateway-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/grantee/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/grantee/grantee-filter-value-field.vue +0 -56
- package/src/modules/Filters/v2/filters/components/filter-options/grantee/grantee-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/has-attachment/has-attachment-filter-value-field.vue +0 -43
- package/src/modules/Filters/v2/filters/components/filter-options/has-attachment/has-attachment-filter-value-preview.vue +0 -24
- package/src/modules/Filters/v2/filters/components/filter-options/has-file/has-file-filter-value-field.vue +0 -33
- package/src/modules/Filters/v2/filters/components/filter-options/has-file/has-file-filter-value-preview.vue +0 -15
- package/src/modules/Filters/v2/filters/components/filter-options/has-rating/has-rating-filter-value-field.vue +0 -33
- package/src/modules/Filters/v2/filters/components/filter-options/has-rating/has-rating-filter-value-preview.vue +0 -15
- package/src/modules/Filters/v2/filters/components/filter-options/has-transcription/has-transcription-filter-value-field.vue +0 -33
- package/src/modules/Filters/v2/filters/components/filter-options/has-transcription/has-transcription-filter-value-preview.vue +0 -15
- package/src/modules/Filters/v2/filters/components/filter-options/impacted/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/impacted/impacted-filter-value-field.vue +0 -56
- package/src/modules/Filters/v2/filters/components/filter-options/impacted/impacted-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/index.ts +0 -250
- package/src/modules/Filters/v2/filters/components/filter-options/priority-case/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/priority-case/priority-case-filter-value-field.vue +0 -57
- package/src/modules/Filters/v2/filters/components/filter-options/priority-case/priority-case-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/queue/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/queue/queue-filter-value-field.vue +0 -56
- package/src/modules/Filters/v2/filters/components/filter-options/queue/queue-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/rated-by/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/rated-by/rated-by-filter-value-field.vue +0 -56
- package/src/modules/Filters/v2/filters/components/filter-options/rated-by/rated-by-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/rating/rating-from-to-filter-value-field.vue +0 -101
- package/src/modules/Filters/v2/filters/components/filter-options/rating/rating-from-to-filter-value-preview.vue +0 -39
- package/src/modules/Filters/v2/filters/components/filter-options/reaction-time/reaction-time-filter-value-field.vue +0 -18
- package/src/modules/Filters/v2/filters/components/filter-options/reaction-time/reaction-time-filter-value-preview.vue +0 -44
- package/src/modules/Filters/v2/filters/components/filter-options/reporter/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/reporter/reporter-filter-value-field.vue +0 -56
- package/src/modules/Filters/v2/filters/components/filter-options/reporter/reporter-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/resolution-time/resolution-time-filter-value-field.vue +0 -18
- package/src/modules/Filters/v2/filters/components/filter-options/resolution-time/resolution-time-filter-value-preview.vue +0 -44
- package/src/modules/Filters/v2/filters/components/filter-options/score/score-from-to-filter-value-field.vue +0 -100
- package/src/modules/Filters/v2/filters/components/filter-options/score/score-from-to-filter-value-preview.vue +0 -39
- package/src/modules/Filters/v2/filters/components/filter-options/service-case/config.js +0 -6
- package/src/modules/Filters/v2/filters/components/filter-options/service-case/service-case-filter-value-field.vue +0 -82
- package/src/modules/Filters/v2/filters/components/filter-options/service-case/service-case-filter-value-preview.vue +0 -34
- package/src/modules/Filters/v2/filters/components/filter-options/sla/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/sla/sla-filter-value-field.vue +0 -57
- package/src/modules/Filters/v2/filters/components/filter-options/sla/sla-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/sla-condition/config.js +0 -6
- package/src/modules/Filters/v2/filters/components/filter-options/sla-condition/sla-condition-filter-value-field.vue +0 -98
- package/src/modules/Filters/v2/filters/components/filter-options/sla-condition/sla-condition-filter-value-preview.vue +0 -37
- package/src/modules/Filters/v2/filters/components/filter-options/source-case/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/source-case/source-case-filter-value-field.vue +0 -57
- package/src/modules/Filters/v2/filters/components/filter-options/source-case/source-case-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/status-case/config.js +0 -7
- package/src/modules/Filters/v2/filters/components/filter-options/status-case/status-case-filter-value-field.vue +0 -102
- package/src/modules/Filters/v2/filters/components/filter-options/status-case/status-case-filter-value-preview.vue +0 -37
- package/src/modules/Filters/v2/filters/components/filter-options/tag/tag-filter-value-field.vue +0 -52
- package/src/modules/Filters/v2/filters/components/filter-options/tag/tag-filter-value-preview.vue +0 -38
- package/src/modules/Filters/v2/filters/components/filter-options/talk-duration/TalkDurationFilter.d.ts +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/talk-duration/talk-duration-filter-value-field.vue +0 -19
- package/src/modules/Filters/v2/filters/components/filter-options/talk-duration/talk-duration-filter-value-preview.vue +0 -44
- package/src/modules/Filters/v2/filters/components/filter-options/team/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/team/team-filter-value-field.vue +0 -56
- package/src/modules/Filters/v2/filters/components/filter-options/team/team-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/total-duration/TotalDurationFilter.d.ts +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/total-duration/total-duration-filter-value-field.vue +0 -19
- package/src/modules/Filters/v2/filters/components/filter-options/total-duration/total-duration-filter-value-preview.vue +0 -44
- package/src/modules/Filters/v2/filters/components/filter-options/user/config.js +0 -4
- package/src/modules/Filters/v2/filters/components/filter-options/user/user-filter-value-field.vue +0 -56
- package/src/modules/Filters/v2/filters/components/filter-options/user/user-filter-value-preview.vue +0 -31
- package/src/modules/Filters/v2/filters/components/filter-options/variable/variable-filter-value-field.vue +0 -50
- package/src/modules/Filters/v2/filters/components/filter-options/variable/variable-filter-value-preview.vue +0 -39
- package/src/modules/Filters/v2/filters/components/preview/dynamic-filter-preview-info.vue +0 -35
- package/src/modules/Filters/v2/filters/components/preview/dynamic-filter-preview.vue +0 -76
- package/src/modules/Filters/v2/filters/components/table-filters-panel.vue +0 -87
- package/src/modules/Filters/v2/filters/createTableFiltersStore.ts +0 -81
- package/src/modules/Filters/v2/filters/enums/FilterOption.ts +0 -43
- package/src/modules/Filters/v2/filters/enums/amd-result-options.ts +0 -38
- package/src/modules/Filters/v2/filters/enums/boolean-options.ts +0 -16
- package/src/modules/Filters/v2/filters/enums/direction-options.ts +0 -20
- package/src/modules/Filters/v2/filters/enums/hangup-cause-options.ts +0 -265
- package/src/modules/Filters/v2/filters/enums/tag-options.ts +0 -8
- package/src/modules/Filters/v2/filters/index.ts +0 -29
- package/src/modules/Filters/v2/filters/scripts/utils.ts +0 -31
- package/src/modules/Filters/v2/filters/types/Filter.d.ts +0 -46
- package/src/modules/Filters/v2/filters/types/FilterSearch.d.ts +0 -10
- package/src/modules/Filters/v2/filters/types/FiltersManager.d.ts +0 -76
- package/src/modules/Filters/v2/headers/createTableHeadersStore.ts +0 -140
- package/src/modules/Filters/v2/index.ts +0 -0
- package/src/modules/Filters/v2/pagination/createTablePaginationStore.ts +0 -64
- package/src/modules/Filters/v2/persist/PersistedStorage.types.ts +0 -51
- package/src/modules/Filters/v2/persist/useLocalStoragePersistedStorage.ts +0 -37
- package/src/modules/Filters/v2/persist/usePersistedStorage.ts +0 -151
- package/src/modules/Filters/v2/persist/useRoutePersistedStorage.ts +0 -41
- package/src/modules/Filters/v2/table/createTableStore.store.ts +0 -206
- package/src/modules/Filters/v2/types/tableStore.types.ts +0 -61
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { isEmpty } from '../../../../../scripts';
|
|
2
|
-
import {
|
|
3
|
-
filterLabelToSnapshotKey,
|
|
4
|
-
filterNameFromSnapshotKey,
|
|
5
|
-
filterValuePropFromSnapshotKey,
|
|
6
|
-
filterValueToSnapshotKey,
|
|
7
|
-
} from '../scripts/utils.ts';
|
|
8
|
-
import type {
|
|
9
|
-
FilterConfig,
|
|
10
|
-
FilterData,
|
|
11
|
-
FilterInitParams,
|
|
12
|
-
FilterLabel,
|
|
13
|
-
FilterName,
|
|
14
|
-
FilterValue,
|
|
15
|
-
IFilter,
|
|
16
|
-
} from '../types/Filter';
|
|
17
|
-
import { FiltersManagerConfig, IFiltersManager } from '../types/FiltersManager';
|
|
18
|
-
import { Filter } from './Filter.ts';
|
|
19
|
-
|
|
20
|
-
class FiltersManager implements IFiltersManager {
|
|
21
|
-
filters = new Map<FilterName, IFilter>();
|
|
22
|
-
|
|
23
|
-
constructor(private config?: FiltersManagerConfig) {}
|
|
24
|
-
|
|
25
|
-
hasFilter(name: FilterName): boolean {
|
|
26
|
-
return this.filters.has(name);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
getFilter(name: FilterName): IFilter {
|
|
30
|
-
return this.filters.get(name);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
addFilter(
|
|
34
|
-
filterInitParams: FilterInitParams,
|
|
35
|
-
payload?: object,
|
|
36
|
-
config?: FilterConfig,
|
|
37
|
-
): IFilter {
|
|
38
|
-
const filter = new Filter(filterInitParams, payload, config || this.config);
|
|
39
|
-
this.filters.set(filterInitParams.name, filter);
|
|
40
|
-
return filter;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
updateFilter({
|
|
44
|
-
name,
|
|
45
|
-
value,
|
|
46
|
-
label,
|
|
47
|
-
}: {
|
|
48
|
-
name: FilterName;
|
|
49
|
-
value?: FilterValue;
|
|
50
|
-
label?: FilterLabel;
|
|
51
|
-
}): IFilter {
|
|
52
|
-
const filter = this.filters.get(name);
|
|
53
|
-
filter.set({ value, label });
|
|
54
|
-
return filter;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
deleteFilter(name: FilterName): IFilter {
|
|
58
|
-
const filter = this.filters.get(name);
|
|
59
|
-
this.filters.delete(name);
|
|
60
|
-
return filter;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
getAllValues(): { [name: FilterName]: FilterValue } {
|
|
64
|
-
const filters = [...this.filters.values()].reduce((acc, filter) => {
|
|
65
|
-
acc[filter.name] = filter.value;
|
|
66
|
-
return acc;
|
|
67
|
-
}, {});
|
|
68
|
-
|
|
69
|
-
return filters;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
toString(): string {
|
|
73
|
-
const filtersData = [...this.filters.values()].reduce(
|
|
74
|
-
(acc, { name, label, value }) => {
|
|
75
|
-
if (isEmpty(value) && value == null) return acc;
|
|
76
|
-
|
|
77
|
-
acc[filterValueToSnapshotKey(name)] = value;
|
|
78
|
-
|
|
79
|
-
if (label) {
|
|
80
|
-
acc[filterLabelToSnapshotKey(name)] = label;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return acc;
|
|
84
|
-
},
|
|
85
|
-
{},
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
return JSON.stringify(filtersData);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
fromString(snapshotStr: string): void {
|
|
92
|
-
const snapshot = JSON.parse(snapshotStr);
|
|
93
|
-
|
|
94
|
-
/*
|
|
95
|
-
first, make transition object from snapshot,
|
|
96
|
-
because filter should bw always added with value
|
|
97
|
-
*/
|
|
98
|
-
const filtersData: { FilterName: FilterData } = Object.entries(
|
|
99
|
-
snapshot,
|
|
100
|
-
).reduce(
|
|
101
|
-
(filtersAcc, [snapshotKey, snapshotValue]) => {
|
|
102
|
-
const name = filterNameFromSnapshotKey(snapshotKey);
|
|
103
|
-
const valueProp = filterValuePropFromSnapshotKey(snapshotKey);
|
|
104
|
-
|
|
105
|
-
if (filtersAcc[name]) {
|
|
106
|
-
filtersAcc[name][valueProp] = snapshotValue;
|
|
107
|
-
} else {
|
|
108
|
-
filtersAcc[name] = {
|
|
109
|
-
[valueProp]: snapshotValue,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return filtersAcc;
|
|
114
|
-
},
|
|
115
|
-
{} as { FilterName: FilterData },
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
Object.entries(filtersData).forEach(([name, filterData]) => {
|
|
119
|
-
this.addFilter({ ...filterData, name });
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
getAllKeys(): FilterName[] {
|
|
124
|
-
return [...this.filters.keys()];
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
getFiltersList({
|
|
128
|
-
include,
|
|
129
|
-
exclude,
|
|
130
|
-
}: {
|
|
131
|
-
include?: FilterName[];
|
|
132
|
-
exclude?: FilterName[];
|
|
133
|
-
} = {}): IFilter[] {
|
|
134
|
-
const useInclude = !isEmpty(include);
|
|
135
|
-
const useExclude = !isEmpty(exclude) && !useInclude;
|
|
136
|
-
|
|
137
|
-
if (!useInclude && !useExclude) {
|
|
138
|
-
return [...this.filters.values()];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return [...this.filters.values()].filter(({ name }) => {
|
|
142
|
-
if (useInclude) {
|
|
143
|
-
return include.includes(name);
|
|
144
|
-
} else if (useExclude) {
|
|
145
|
-
return !exclude.includes(name);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return true;
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
reset({
|
|
153
|
-
include,
|
|
154
|
-
exclude,
|
|
155
|
-
}: {
|
|
156
|
-
include?: FilterName[];
|
|
157
|
-
exclude?: FilterName[];
|
|
158
|
-
} = {}): void {
|
|
159
|
-
const useInclude = !isEmpty(include);
|
|
160
|
-
const useExclude = !isEmpty(exclude) && !useInclude;
|
|
161
|
-
|
|
162
|
-
if (!useInclude && !useExclude) {
|
|
163
|
-
this.filters.clear();
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (useInclude) {
|
|
168
|
-
include.forEach((name) => {
|
|
169
|
-
this.filters.delete(name);
|
|
170
|
-
});
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (useExclude) {
|
|
175
|
-
this.filters.forEach((_, filterName) => {
|
|
176
|
-
if (!exclude.includes(filterName)) {
|
|
177
|
-
this.filters.delete(filterName);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export const createFiltersManager = (
|
|
186
|
-
config?: FiltersManagerConfig,
|
|
187
|
-
): IFiltersManager => {
|
|
188
|
-
return new FiltersManager(config);
|
|
189
|
-
};
|
package/src/modules/Filters/v2/filters/components/config/dynamic-filter-config-form-label.vue
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<wt-input
|
|
3
|
-
:value="model"
|
|
4
|
-
:label="t('webitelUI.filters.filterLabel')"
|
|
5
|
-
:v="v$.model"
|
|
6
|
-
@input="model = $event"
|
|
7
|
-
/>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script setup lang="ts">
|
|
11
|
-
import { useVuelidate } from '@vuelidate/core';
|
|
12
|
-
import { maxLength } from '@vuelidate/validators';
|
|
13
|
-
import { computed, watch } from 'vue';
|
|
14
|
-
import { useI18n } from 'vue-i18n';
|
|
15
|
-
|
|
16
|
-
import WtInput from '../../../../../../components/wt-input/wt-input.vue';
|
|
17
|
-
|
|
18
|
-
const MAX_STRING_LENGTH = 50;
|
|
19
|
-
|
|
20
|
-
const model = defineModel<string>();
|
|
21
|
-
|
|
22
|
-
interface Emits {
|
|
23
|
-
'update:invalid': [boolean];
|
|
24
|
-
}
|
|
25
|
-
const emit = defineEmits<Emits>();
|
|
26
|
-
|
|
27
|
-
const { t } = useI18n();
|
|
28
|
-
|
|
29
|
-
const v$ = useVuelidate(
|
|
30
|
-
computed(() => ({
|
|
31
|
-
model: {
|
|
32
|
-
// maybe make maxLength value by props
|
|
33
|
-
maxLength: maxLength(MAX_STRING_LENGTH),
|
|
34
|
-
},
|
|
35
|
-
})),
|
|
36
|
-
{ model },
|
|
37
|
-
{ $autoDirty: true },
|
|
38
|
-
);
|
|
39
|
-
v$.value.$touch();
|
|
40
|
-
|
|
41
|
-
watch(
|
|
42
|
-
() => v$.value.$invalid,
|
|
43
|
-
(invalid) => {
|
|
44
|
-
emit('update:invalid', invalid);
|
|
45
|
-
},
|
|
46
|
-
{ immediate: true },
|
|
47
|
-
);
|
|
48
|
-
</script>
|
|
49
|
-
|
|
50
|
-
<style scoped lang="scss"></style>
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<form class="dynamic-filter-config-form">
|
|
3
|
-
<wt-select
|
|
4
|
-
:clearable="false"
|
|
5
|
-
:disabled="editMode"
|
|
6
|
-
:label="t('webitelUI.filters.filterName')"
|
|
7
|
-
:options="options"
|
|
8
|
-
:value="filterName"
|
|
9
|
-
track-by="value"
|
|
10
|
-
use-value-from-options-by-prop="value"
|
|
11
|
-
@input="onFilterNameUpdate($event)"
|
|
12
|
-
/>
|
|
13
|
-
|
|
14
|
-
<slot
|
|
15
|
-
name="value-input"
|
|
16
|
-
v-bind="{
|
|
17
|
-
filterName,
|
|
18
|
-
filterValue,
|
|
19
|
-
inputLabel: t('webitelUI.filters.filterValue'),
|
|
20
|
-
onValueChange: (v) => (filterValue = v),
|
|
21
|
-
onValueInvalidChange: (v) => (invalid = v),
|
|
22
|
-
}"
|
|
23
|
-
/>
|
|
24
|
-
|
|
25
|
-
<dynamic-filter-config-form-label
|
|
26
|
-
:value="filterLabel"
|
|
27
|
-
@update:model-value="onLabelValueUpdate"
|
|
28
|
-
@update:invalid="(v) => (invalid = v)"
|
|
29
|
-
/>
|
|
30
|
-
|
|
31
|
-
<footer class="dynamic-filter-config-form-footer">
|
|
32
|
-
<wt-button
|
|
33
|
-
:disabled="invalid"
|
|
34
|
-
wide
|
|
35
|
-
@click="submit"
|
|
36
|
-
>
|
|
37
|
-
{{ t('reusable.save') }}
|
|
38
|
-
</wt-button>
|
|
39
|
-
|
|
40
|
-
<wt-button
|
|
41
|
-
color="secondary"
|
|
42
|
-
wide
|
|
43
|
-
@click="emit('cancel')"
|
|
44
|
-
>
|
|
45
|
-
{{ t('reusable.cancel') }}
|
|
46
|
-
</wt-button>
|
|
47
|
-
</footer>
|
|
48
|
-
</form>
|
|
49
|
-
</template>
|
|
50
|
-
|
|
51
|
-
<script lang="ts" setup>
|
|
52
|
-
import deepcopy from 'deep-copy';
|
|
53
|
-
import { ref, watch } from 'vue';
|
|
54
|
-
import { useI18n } from 'vue-i18n';
|
|
55
|
-
|
|
56
|
-
import WtButton from '../../../../../../components/wt-button/wt-button.vue';
|
|
57
|
-
import WtSelect from '../../../../../../components/wt-select/wt-select.vue';
|
|
58
|
-
import type { FilterInitParams, FilterName, IFilter } from '../../types/Filter';
|
|
59
|
-
import DynamicFilterConfigFormLabel from './dynamic-filter-config-form-label.vue';
|
|
60
|
-
|
|
61
|
-
interface FilterNameSelectRepresentation {
|
|
62
|
-
name: string;
|
|
63
|
-
value: FilterName;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
interface AddModeProps {
|
|
67
|
-
options: Array<FilterNameSelectRepresentation>;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
interface EditModeProps {
|
|
71
|
-
filter: IFilter;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
type Props = AddModeProps | EditModeProps;
|
|
75
|
-
|
|
76
|
-
const props = defineProps<Props>();
|
|
77
|
-
|
|
78
|
-
const emit = defineEmits<{
|
|
79
|
-
submit: [FilterInitParams];
|
|
80
|
-
cancel: [];
|
|
81
|
-
}>();
|
|
82
|
-
|
|
83
|
-
const { t } = useI18n();
|
|
84
|
-
|
|
85
|
-
const filterName = ref();
|
|
86
|
-
const filterLabel = ref('');
|
|
87
|
-
const filterValue = ref();
|
|
88
|
-
|
|
89
|
-
const editMode = !!props.filter;
|
|
90
|
-
|
|
91
|
-
const invalid = ref(false);
|
|
92
|
-
|
|
93
|
-
const onLabelValueUpdate = (val: string) => {
|
|
94
|
-
filterLabel.value = val;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const onFilterNameUpdate = (val: string) => {
|
|
98
|
-
filterName.value = val;
|
|
99
|
-
filterValue.value = null;
|
|
100
|
-
invalid.value = false;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const submit = () => {
|
|
104
|
-
emit('submit', {
|
|
105
|
-
name: filterName.value,
|
|
106
|
-
label: filterLabel.value,
|
|
107
|
-
value: filterValue.value,
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
if (props.filter) {
|
|
112
|
-
watch(
|
|
113
|
-
props.filter,
|
|
114
|
-
() => {
|
|
115
|
-
filterName.value = props.filter.name;
|
|
116
|
-
filterValue.value = deepcopy(props.filter.value);
|
|
117
|
-
filterLabel.value = props.filter.label;
|
|
118
|
-
},
|
|
119
|
-
{ immediate: true },
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
</script>
|
|
123
|
-
|
|
124
|
-
<style lang="scss" scoped>
|
|
125
|
-
$form-width: 380px;
|
|
126
|
-
|
|
127
|
-
.dynamic-filter-config-form {
|
|
128
|
-
display: flex;
|
|
129
|
-
flex-direction: column;
|
|
130
|
-
gap: var(--spacing-xs);
|
|
131
|
-
box-sizing: border-box;
|
|
132
|
-
padding: var(--spacing-xs) 0;
|
|
133
|
-
width: $form-width;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.dynamic-filter-config-form-footer {
|
|
137
|
-
display: flex;
|
|
138
|
-
gap: var(--spacing-xs);
|
|
139
|
-
}
|
|
140
|
-
</style>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="dynamic-filter-config-view">
|
|
3
|
-
<wt-tooltip
|
|
4
|
-
:triggers="['click']"
|
|
5
|
-
:disabled="props.disabled"
|
|
6
|
-
:disable-click-away="props.disableClickAway"
|
|
7
|
-
>
|
|
8
|
-
<template #activator="slotScope">
|
|
9
|
-
<slot
|
|
10
|
-
name="activator"
|
|
11
|
-
v-bind="slotScope"
|
|
12
|
-
/>
|
|
13
|
-
</template>
|
|
14
|
-
<template #default="slotScope">
|
|
15
|
-
<slot
|
|
16
|
-
name="content"
|
|
17
|
-
v-bind="slotScope"
|
|
18
|
-
/>
|
|
19
|
-
</template>
|
|
20
|
-
</wt-tooltip>
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script lang="ts" setup>
|
|
25
|
-
/**
|
|
26
|
-
* this component should only be used for config view representation: tooltip/popup/etc,
|
|
27
|
-
* and their styling
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
import WtTooltip from '../../../../../../components/wt-tooltip/wt-tooltip.vue';
|
|
31
|
-
|
|
32
|
-
interface Props {
|
|
33
|
-
disabled?: boolean;
|
|
34
|
-
disableClickAway?: boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const props = defineProps<Props>();
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<style lang="scss" scoped></style>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<dynamic-filter-config-view
|
|
3
|
-
disable-click-away
|
|
4
|
-
class="dynamic-filter-add-action"
|
|
5
|
-
>
|
|
6
|
-
<template #activator>
|
|
7
|
-
<div class="dynamic-filter-add-action-wrapper">
|
|
8
|
-
<p v-if="props.showLabel">
|
|
9
|
-
{{ t('webitelUI.filters.addFilter') }}
|
|
10
|
-
</p>
|
|
11
|
-
<wt-icon-action action="add-filter" />
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<template #content="slotScope">
|
|
16
|
-
<slot
|
|
17
|
-
name="form"
|
|
18
|
-
v-bind="slotScope"
|
|
19
|
-
>
|
|
20
|
-
filter form should be here
|
|
21
|
-
</slot>
|
|
22
|
-
</template>
|
|
23
|
-
</dynamic-filter-config-view>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script lang="ts" setup>
|
|
27
|
-
import { useI18n } from 'vue-i18n';
|
|
28
|
-
|
|
29
|
-
import WtIconAction from '../../../../../components/wt-icon-action/wt-icon-action.vue';
|
|
30
|
-
import DynamicFilterConfigView from './config/dynamic-filter-config-view.vue';
|
|
31
|
-
|
|
32
|
-
interface Props {
|
|
33
|
-
showLabel?: boolean;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const props = defineProps<Props>();
|
|
37
|
-
|
|
38
|
-
const { t } = useI18n();
|
|
39
|
-
</script>
|
|
40
|
-
|
|
41
|
-
<style lang="scss" scoped>
|
|
42
|
-
.dynamic-filter-add-action {
|
|
43
|
-
display: flex;
|
|
44
|
-
|
|
45
|
-
&-wrapper {
|
|
46
|
-
display: flex;
|
|
47
|
-
justify-content: center;
|
|
48
|
-
align-items: center;
|
|
49
|
-
gap: var(--spacing-2xs);
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
width: fit-content;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
</style>
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="dynamic-filter-panel-wrapper"
|
|
4
|
-
:class="`dynamic-filter-panel-wrapper--${props.size}`"
|
|
5
|
-
>
|
|
6
|
-
<div class="dynamic-filter-panel-wrapper__filters">
|
|
7
|
-
<slot name="filters" />
|
|
8
|
-
</div>
|
|
9
|
-
|
|
10
|
-
<div class="dynamic-filter-panel-wrapper__actions">
|
|
11
|
-
<slot name="actions" />
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script setup lang="ts">
|
|
17
|
-
import { ComponentSize } from '../../../../../enums';
|
|
18
|
-
|
|
19
|
-
const props = withDefaults(
|
|
20
|
-
defineProps<{
|
|
21
|
-
size?: ComponentSize;
|
|
22
|
-
}>(),
|
|
23
|
-
{
|
|
24
|
-
size: ComponentSize.MD,
|
|
25
|
-
},
|
|
26
|
-
);
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<style lang="scss" scoped>
|
|
30
|
-
.dynamic-filter-panel-wrapper {
|
|
31
|
-
display: grid;
|
|
32
|
-
grid-gap: var(--spacing-sm);
|
|
33
|
-
grid-template-columns: 1fr auto;
|
|
34
|
-
align-items: center;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.dynamic-filter-panel-wrapper__filters {
|
|
38
|
-
display: flex;
|
|
39
|
-
flex-wrap: wrap;
|
|
40
|
-
align-items: center;
|
|
41
|
-
grid-gap: var(--spacing-sm);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.dynamic-filter-panel-wrapper__actions {
|
|
45
|
-
display: flex;
|
|
46
|
-
grid-gap: var(--spacing-sm);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.dynamic-filter-panel-wrapper {
|
|
50
|
-
&--sm {
|
|
51
|
-
.dynamic-filter-panel-wrapper__filters,
|
|
52
|
-
.dynamic-filter-panel-wrapper__actions {
|
|
53
|
-
grid-gap: var(--spacing-xs);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
</style>
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<wt-search-bar
|
|
3
|
-
:placeholder="t('reusable.search')"
|
|
4
|
-
:search-mode="currentSearchMode"
|
|
5
|
-
:search-mode-options="props.searchModeOptions"
|
|
6
|
-
:hint="currentSearchMode?.hint"
|
|
7
|
-
:value="model"
|
|
8
|
-
:v="validationExists && v$"
|
|
9
|
-
@input="model = $event"
|
|
10
|
-
@search="handleSearch"
|
|
11
|
-
@update:search-mode="onSearchModeChange($event.value)"
|
|
12
|
-
>
|
|
13
|
-
<template
|
|
14
|
-
v-if="props.showTextSearchIcon"
|
|
15
|
-
#search-icon
|
|
16
|
-
>
|
|
17
|
-
<wt-icon icon="stt-search" />
|
|
18
|
-
</template>
|
|
19
|
-
</wt-search-bar>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script lang="ts" setup>
|
|
23
|
-
import { useVuelidate } from '@vuelidate/core';
|
|
24
|
-
import {computed} from 'vue';
|
|
25
|
-
import { useI18n } from 'vue-i18n';
|
|
26
|
-
|
|
27
|
-
import WtSearchBar from '../../../../../components/wt-search-bar/wt-search-bar.vue';
|
|
28
|
-
import {FilterSearch} from '../index';
|
|
29
|
-
|
|
30
|
-
type ModelValue = string;
|
|
31
|
-
const model = defineModel<ModelValue>();
|
|
32
|
-
|
|
33
|
-
type SearchModeOptions = FilterSearch[]
|
|
34
|
-
|
|
35
|
-
const props = defineProps<{
|
|
36
|
-
searchMode: string;
|
|
37
|
-
searchModeOptions: SearchModeOptions;
|
|
38
|
-
showTextSearchIcon?: boolean;
|
|
39
|
-
}>();
|
|
40
|
-
|
|
41
|
-
const emit = defineEmits<{
|
|
42
|
-
'update:search-mode': [string];
|
|
43
|
-
'handle-search': [string];
|
|
44
|
-
}>();
|
|
45
|
-
|
|
46
|
-
const { t } = useI18n();
|
|
47
|
-
|
|
48
|
-
const currentSearchMode = computed(() =>
|
|
49
|
-
props.searchModeOptions.find(({ value }) => value === props.searchMode),
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
const validationExists = computed(() => props.searchModeOptions.find((el) => el.v))
|
|
53
|
-
|
|
54
|
-
const v$ =
|
|
55
|
-
validationExists.value &&
|
|
56
|
-
useVuelidate(
|
|
57
|
-
computed(() => {
|
|
58
|
-
return {
|
|
59
|
-
model: {
|
|
60
|
-
...(currentSearchMode.value?.v || {}),
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}),
|
|
64
|
-
{ model },
|
|
65
|
-
{ $autoDirty: true },
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
if (v$) v$.value.$touch();
|
|
69
|
-
|
|
70
|
-
const onSearchModeChange = (value: string) => {
|
|
71
|
-
emit('update:search-mode', value);
|
|
72
|
-
model.value = '';
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const handleSearch = () => {
|
|
76
|
-
emit('handle-search', model.value);
|
|
77
|
-
};
|
|
78
|
-
</script>
|
|
79
|
-
|
|
80
|
-
<style lang="scss" scoped></style>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useVuelidate } from '@vuelidate/core';
|
|
2
|
-
import { computed, ModelRef, type Reactive, type Ref } from 'vue';
|
|
3
|
-
import { useI18n } from 'vue-i18n';
|
|
4
|
-
|
|
5
|
-
import { BooleanFilterModelValue } from '../types/BooleanFilter';
|
|
6
|
-
|
|
7
|
-
export const usePrettifyBooleanValuePreview = (
|
|
8
|
-
value: Reactive<boolean>,
|
|
9
|
-
): { localeValue: Ref<string> } => {
|
|
10
|
-
const { t } = useI18n();
|
|
11
|
-
|
|
12
|
-
const localeValue = computed(() => {
|
|
13
|
-
return value ? t('vocabulary.yes') : t('vocabulary.no');
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
return { localeValue };
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const useBooleanFilterValueValidation = <
|
|
20
|
-
T extends BooleanFilterModelValue,
|
|
21
|
-
>(
|
|
22
|
-
model: ModelRef<T>,
|
|
23
|
-
) => {
|
|
24
|
-
const v$ = useVuelidate(
|
|
25
|
-
computed(() => ({
|
|
26
|
-
model: {
|
|
27
|
-
required: (v: T) => !(!v && v !== false),
|
|
28
|
-
},
|
|
29
|
-
})),
|
|
30
|
-
{ model },
|
|
31
|
-
{ $autoDirty: true },
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
v$.value.$touch();
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
v$,
|
|
38
|
-
};
|
|
39
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
import { useI18n } from 'vue-i18n';
|
|
3
|
-
|
|
4
|
-
export const useFromToSecToPreviewTime = (value: {
|
|
5
|
-
from?: number | string | null;
|
|
6
|
-
to?: number | string | null;
|
|
7
|
-
}) => {
|
|
8
|
-
const { t } = useI18n();
|
|
9
|
-
|
|
10
|
-
const format = (secsVal: number) => {
|
|
11
|
-
const minutes = Math.floor(secsVal / 60);
|
|
12
|
-
const seconds = secsVal % 60;
|
|
13
|
-
|
|
14
|
-
return `${t('webitelUI.timepicker.min')} ${minutes} ${t('webitelUI.timepicker.sec')} ${seconds}`;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const from = computed(() => {
|
|
18
|
-
const numValue = Number(value.from);
|
|
19
|
-
|
|
20
|
-
if (!numValue && numValue !== 0) {
|
|
21
|
-
return '';
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return format(numValue);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const to = computed(() => {
|
|
28
|
-
const numValue = Number(value.to);
|
|
29
|
-
|
|
30
|
-
if (!numValue && numValue !== 0) {
|
|
31
|
-
return '';
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return format(numValue);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
from,
|
|
39
|
-
to,
|
|
40
|
-
};
|
|
41
|
-
};
|