@webitel/ui-sdk 24.10.22 → 24.10.24
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/dist/ui-sdk.js +2240 -2240
- package/dist/ui-sdk.umd.cjs +13 -13
- package/package.json +1 -1
- package/src/enums/WebitelApplications/AdminSections.enum.js +1 -0
- package/src/locale/en/en.js +1 -0
- package/src/locale/ru/ru.js +1 -0
- package/src/locale/ua/ua.js +1 -0
- package/src/modules/CSVExport/CSVExport.js +4 -1
- package/src/modules/Filters/components/filter-datetime.vue +40 -0
- package/src/modules/Filters/composables/useTableFilters.js +6 -0
- package/src/modules/Filters/enums/FilterEvent.enum.js +1 -0
- package/src/modules/Filters/store/FiltersStoreModule.js +43 -10
- package/src/modules/TableStoreModule/store/TableStoreModule.js +15 -2
- package/src/modules/Userinfo/classes/ApplicationsAccess.js +4 -0
- package/src/store/new/modules/tableStoreModule/tableStoreModule.js +9 -0
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ const AdminSections = Object.freeze({
|
|
|
19
19
|
PAUSE_CAUSE: 'pause-cause', // scope: lookups
|
|
20
20
|
MEDIA: 'media', // scope: media_file
|
|
21
21
|
SHIFT_TEMPLATES: 'shift-templates', // scope: shift_templates
|
|
22
|
+
PAUSE_TEMPLATES: 'pause-templates', //scope: pause_templates
|
|
22
23
|
|
|
23
24
|
// CONTACT CENTER
|
|
24
25
|
SKILLS: 'skills', // scope: lookups
|
package/src/locale/en/en.js
CHANGED
|
@@ -224,6 +224,7 @@ export default {
|
|
|
224
224
|
[AdminSections.BUCKETS]: 'Buckets',
|
|
225
225
|
[AdminSections.MEDIA]: 'Media files',
|
|
226
226
|
[AdminSections.SHIFT_TEMPLATES]: 'Shift templates',
|
|
227
|
+
[AdminSections.PAUSE_TEMPLATES]: 'Pause templates',
|
|
227
228
|
[AdminSections.BLACKLIST]: 'Lists',
|
|
228
229
|
[AdminSections.CALENDARS]: 'Calendars',
|
|
229
230
|
[AdminSections.REGIONS]: 'Locations',
|
package/src/locale/ru/ru.js
CHANGED
|
@@ -223,6 +223,7 @@ export default {
|
|
|
223
223
|
[AdminSections.BUCKETS]: 'Корзины',
|
|
224
224
|
[AdminSections.MEDIA]: 'Медиафайлы',
|
|
225
225
|
[AdminSections.SHIFT_TEMPLATES]: 'Шаблон смен',
|
|
226
|
+
[AdminSections.PAUSE_TEMPLATES]: 'Шаблон пауз',
|
|
226
227
|
[AdminSections.BLACKLIST]: 'Cписки',
|
|
227
228
|
[AdminSections.CALENDARS]: 'Календари',
|
|
228
229
|
[AdminSections.COMMUNICATIONS]: 'Типы связи',
|
package/src/locale/ua/ua.js
CHANGED
|
@@ -223,6 +223,7 @@ export default {
|
|
|
223
223
|
[AdminSections.BUCKETS]: 'Кошики',
|
|
224
224
|
[AdminSections.MEDIA]: 'Медіафайли',
|
|
225
225
|
[AdminSections.SHIFT_TEMPLATES]: 'Шаблон змін',
|
|
226
|
+
[AdminSections.PAUSE_TEMPLATES]: 'Шаблон пауз',
|
|
226
227
|
[AdminSections.BLACKLIST]: 'Cписки',
|
|
227
228
|
[AdminSections.CALENDARS]: 'Календарі',
|
|
228
229
|
[AdminSections.REGIONS]: 'Розташування',
|
|
@@ -49,7 +49,10 @@ export default class CSVExport {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
save(csv) {
|
|
52
|
-
|
|
52
|
+
// Prepending '\uFEFF' (the BOM) forces these applications to treat the file as UTF-8,
|
|
53
|
+
// ensuring that non-ASCII characters, such as Cyrillic, are displayed correctly.
|
|
54
|
+
const bom = '\uFEFF';
|
|
55
|
+
const blob = new Blob([bom + csv], { type: 'data:text/csv;charset=utf-8' });
|
|
53
56
|
saveAs(blob, `${this.filename}.csv`);
|
|
54
57
|
}
|
|
55
58
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-datepicker
|
|
3
|
+
:label="filterSchema.label"
|
|
4
|
+
:value="value"
|
|
5
|
+
mode="datetime"
|
|
6
|
+
@input="setValue"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
11
|
+
import { computed } from 'vue';
|
|
12
|
+
import { useStore } from 'vuex';
|
|
13
|
+
import getNamespacedState from '../../../store/helpers/getNamespacedState.js';
|
|
14
|
+
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
namespace: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: true,
|
|
19
|
+
},
|
|
20
|
+
filterQuery: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const store = useStore();
|
|
27
|
+
|
|
28
|
+
const filterSchema = computed(() => getNamespacedState(store.state, props.namespace)[props.filterQuery]);
|
|
29
|
+
|
|
30
|
+
const value = computed(() => store.getters[`${props.namespace}/FILTER_${props.filterQuery}`]);
|
|
31
|
+
|
|
32
|
+
const setValue = (value) => {
|
|
33
|
+
const payload = { value, name: props.filterQuery };
|
|
34
|
+
return store.dispatch(`${props.namespace}/SET_FILTER`, payload);
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<style scoped>
|
|
39
|
+
|
|
40
|
+
</style>
|
|
@@ -17,9 +17,15 @@ export const useTableFilters = (namespace) => {
|
|
|
17
17
|
return store.dispatch(`${filtersNamespace}/RESTORE_FILTERS`, payload);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
function resetFilters(payload) {
|
|
21
|
+
return store.dispatch(`${filtersNamespace}/RESET_FILTERS`, payload);
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
return {
|
|
21
25
|
namespace: filtersNamespace,
|
|
26
|
+
|
|
22
27
|
restoreFilters,
|
|
28
|
+
resetFilters,
|
|
23
29
|
|
|
24
30
|
subscribe,
|
|
25
31
|
flushSubscribers,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import mitt from 'mitt';
|
|
2
2
|
import isEmpty from '../../../scripts/isEmpty.js';
|
|
3
|
-
import BaseStoreModule
|
|
3
|
+
import BaseStoreModule
|
|
4
|
+
from '../../../store/BaseStoreModules/BaseStoreModule.js';
|
|
4
5
|
import BaseFilterSchema from '../classes/BaseFilterSchema.js';
|
|
5
6
|
import FilterEvent from '../enums/FilterEvent.enum.js';
|
|
6
7
|
|
|
@@ -117,17 +118,43 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
117
118
|
});
|
|
118
119
|
},
|
|
119
120
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
RESET_FILTER: (context, { name }) => {
|
|
122
|
+
const filter = context.state[name];
|
|
123
|
+
|
|
124
|
+
return context.dispatch('SET_FILTER', {
|
|
125
|
+
name,
|
|
126
|
+
value: filter.defaultValue,
|
|
127
|
+
silent: true,
|
|
128
|
+
});
|
|
129
|
+
},
|
|
124
130
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
});
|
|
131
|
+
RESET_FILTERS: async (context) => {
|
|
132
|
+
await Promise.allSettled(
|
|
133
|
+
context.getters._STATE_FILTER_NAMES.map((name) => {
|
|
134
|
+
return context.dispatch('RESET_FILTER', { name });
|
|
129
135
|
}),
|
|
130
|
-
)
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
// clean up query params
|
|
139
|
+
const router = context.getters.ROUTER;
|
|
140
|
+
const query = Object.entries(router.currentRoute.query)
|
|
141
|
+
.reduce((filteredQuery, [qKey, qValue]) => {
|
|
142
|
+
if (context.state[qKey]) {
|
|
143
|
+
return filteredQuery;
|
|
144
|
+
}
|
|
145
|
+
return { ...filteredQuery, [qKey]: qValue };
|
|
146
|
+
}, {});
|
|
147
|
+
|
|
148
|
+
await router.push({
|
|
149
|
+
...router.currentRoute,
|
|
150
|
+
query,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
return context.dispatch('EMIT', {
|
|
154
|
+
event: FilterEvent.RESET,
|
|
155
|
+
payload: context.getters.GET_FILTERS(),
|
|
156
|
+
});
|
|
157
|
+
},
|
|
131
158
|
|
|
132
159
|
SUBSCRIBE: (context, { event, callback }) => {
|
|
133
160
|
const subscribe = () => context.state._emitter.on(event, callback);
|
|
@@ -174,6 +201,12 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
174
201
|
const stateFilter = new BaseFilterSchema(filter);
|
|
175
202
|
if (stateFilter.requireRouter) this.state._requireRouter = true;
|
|
176
203
|
this.state[filter.name] = stateFilter;
|
|
204
|
+
this.getters[`FILTER_${filter.name}`] = (state, getters) => {
|
|
205
|
+
// if is used as watcher for getter to recompute,
|
|
206
|
+
// because GET_FILTER is function ==> it's not reactive
|
|
207
|
+
if (state[filter.name].value) {}
|
|
208
|
+
return getters.GET_FILTER(filter.name);
|
|
209
|
+
};
|
|
177
210
|
};
|
|
178
211
|
|
|
179
212
|
if (Array.isArray(filter)) filter.forEach((f) => setup(f));
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
queryToSortAdapter,
|
|
3
|
+
sortToQueryAdapter,
|
|
4
|
+
} from '../../../scripts/sortQueryAdapters.js';
|
|
5
|
+
import BaseStoreModule
|
|
6
|
+
from '../../../store/BaseStoreModules/BaseStoreModule.js';
|
|
3
7
|
import FilterEvent from '../../Filters/enums/FilterEvent.enum.js';
|
|
4
8
|
|
|
5
9
|
export default class TableStoreModule extends BaseStoreModule {
|
|
@@ -53,6 +57,8 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
53
57
|
return context.dispatch('HANDLE_FILTERS_RESTORE', payload);
|
|
54
58
|
case FilterEvent.FILTER_SET:
|
|
55
59
|
return context.dispatch('HANDLE_FILTER_SET', payload);
|
|
60
|
+
case FilterEvent.RESET:
|
|
61
|
+
return context.dispatch('HANDLE_FILTER_RESET', payload);
|
|
56
62
|
default:
|
|
57
63
|
throw new Error(`Unknown filter event: ${event}`);
|
|
58
64
|
}
|
|
@@ -65,6 +71,13 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
65
71
|
return context.dispatch('LOAD_DATA_LIST');
|
|
66
72
|
},
|
|
67
73
|
|
|
74
|
+
// FIXME: maybe move to filters module?
|
|
75
|
+
HANDLE_FILTER_RESET: async (context, { fields, sort }) => {
|
|
76
|
+
if (sort) await context.dispatch('HANDLE_SORT_CHANGE', { value: sort });
|
|
77
|
+
if (fields?.length) await context.dispatch('HANDLE_FIELDS_CHANGE', { value: fields });
|
|
78
|
+
return context.dispatch('LOAD_DATA_LIST');
|
|
79
|
+
},
|
|
80
|
+
|
|
68
81
|
// FIXME: maybe move to filters module?
|
|
69
82
|
HANDLE_FILTER_SET: async (context, payload) => {
|
|
70
83
|
if (payload.name === 'fields') {
|
|
@@ -106,6 +106,10 @@ const applicationsAccess = (value = true) => ({
|
|
|
106
106
|
_enabled: value,
|
|
107
107
|
_locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.SHIFT_TEMPLATES}`,
|
|
108
108
|
},
|
|
109
|
+
[AdminSections.PAUSE_TEMPLATES]: {
|
|
110
|
+
_enabled: value,
|
|
111
|
+
_locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.PAUSE_TEMPLATES}`,
|
|
112
|
+
},
|
|
109
113
|
[AdminSections.AGENTS]: {
|
|
110
114
|
_enabled: value,
|
|
111
115
|
_locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.AGENTS}`,
|
|
@@ -54,6 +54,8 @@ const actions = {
|
|
|
54
54
|
return context.dispatch('HANDLE_FILTERS_RESTORE', payload);
|
|
55
55
|
case FilterEvent.FILTER_SET:
|
|
56
56
|
return context.dispatch('HANDLE_FILTER_SET', payload);
|
|
57
|
+
case FilterEvent.RESET:
|
|
58
|
+
return context.dispatch('HANDLE_FILTER_RESET', payload);
|
|
57
59
|
default:
|
|
58
60
|
throw new Error(`Unknown filter event: ${event}`);
|
|
59
61
|
}
|
|
@@ -66,6 +68,13 @@ const actions = {
|
|
|
66
68
|
return context.dispatch('LOAD_DATA_LIST');
|
|
67
69
|
},
|
|
68
70
|
|
|
71
|
+
// FIXME: maybe move to filters module?
|
|
72
|
+
HANDLE_FILTER_RESET: async (context, { fields, sort }) => {
|
|
73
|
+
if (sort) await context.dispatch('HANDLE_SORT_CHANGE', { value: sort });
|
|
74
|
+
if (fields?.length) await context.dispatch('HANDLE_FIELDS_CHANGE', { value: fields });
|
|
75
|
+
return context.dispatch('LOAD_DATA_LIST');
|
|
76
|
+
},
|
|
77
|
+
|
|
69
78
|
// FIXME: maybe move to filters module?
|
|
70
79
|
HANDLE_FILTER_SET: async (context, payload) => {
|
|
71
80
|
if (payload.name === 'fields') {
|