@webitel/ui-sdk 24.6.30 → 24.6.32
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.css +1 -1
- package/dist/ui-sdk.js +63 -56
- package/dist/ui-sdk.umd.cjs +6 -6
- package/package.json +1 -1
- package/src/api/clients/users/__tests__/users.spec.js +88 -42
- package/src/components/wt-app-header/wt-app-navigator.vue +1 -1
- package/src/components/wt-app-header/wt-header-actions.vue +1 -1
- package/src/components/wt-button/wt-button.vue +1 -1
- package/src/components/wt-checkbox/wt-checkbox.vue +1 -1
- package/src/components/wt-chip/wt-chip.scss +1 -2
- package/src/components/wt-context-menu/wt-context-menu.vue +1 -1
- package/src/components/wt-datepicker/wt-datepicker.vue +1 -1
- package/src/components/wt-dummy/wt-dummy.vue +1 -1
- package/src/components/wt-expansion-panel/wt-expansion-panel.vue +1 -1
- package/src/components/wt-headline/wt-headline.vue +1 -1
- package/src/components/wt-headline-nav/wt-headline-nav.vue +1 -1
- package/src/components/wt-indicator/wt-indicator.vue +1 -1
- package/src/components/wt-input/wt-input.vue +1 -1
- package/src/components/wt-input-info/wt-input-info.vue +1 -1
- package/src/components/wt-label/wt-label.vue +1 -1
- package/src/components/wt-navigation-bar/wt-navigation-bar.vue +1 -1
- package/src/components/wt-notification/wt-notification.vue +3 -3
- package/src/components/wt-notifications-bar/wt-notifications-bar.vue +1 -1
- package/src/components/wt-pagination/wt-pagination.vue +1 -1
- package/src/components/wt-player/wt-player.vue +1 -1
- package/src/components/wt-popup/wt-popup.vue +1 -1
- package/src/components/wt-radio/wt-radio.vue +1 -1
- package/src/components/wt-search-bar/wt-search-bar.vue +11 -2
- package/src/components/wt-select/_multiselect.scss +1 -2
- package/src/components/wt-switcher/wt-switcher.vue +1 -1
- package/src/components/wt-table/wt-table.vue +1 -1
- package/src/components/wt-table-column-select/wt-table-column-select.vue +1 -1
- package/src/components/wt-tabs/wt-tabs.vue +1 -1
- package/src/components/wt-textarea/wt-textarea.vue +1 -1
- package/src/components/wt-time-input/wt-time-input.vue +1 -1
- package/src/components/wt-tooltip/wt-tooltip.vue +1 -1
- package/src/css/main.scss +0 -1
- package/src/enums/QueueType/QueueType.enum.js +1 -1
- package/src/locale/en/en.js +2 -1
- package/src/locale/es/es.js +2 -1
- package/src/locale/kz/kz.js +2 -1
- package/src/locale/ru/ru.js +2 -1
- package/src/locale/ua/ua.js +2 -1
- package/src/modules/CardStoreModule/store/CardStoreModule.js +2 -1
- package/src/modules/Filters/components/filter-search.vue +80 -0
- package/src/modules/Filters/store/FiltersStoreModule.js +3 -2
- package/src/modules/TableStoreModule/store/TableStoreModule.js +14 -8
- package/src/modules/TableStoreModule/store/__tests__/TableStoreModule.spec.js +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import deepCopy from 'deep-copy';
|
|
2
2
|
import set from 'lodash/set.js';
|
|
3
|
-
import BaseStoreModule
|
|
3
|
+
import BaseStoreModule
|
|
4
|
+
from '../../../store/BaseStoreModules/BaseStoreModule.js';
|
|
4
5
|
|
|
5
6
|
export default class CardStoreModule extends BaseStoreModule {
|
|
6
7
|
state = {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-search-bar
|
|
3
|
+
class="filter-search"
|
|
4
|
+
:search-mode="multisearch && filterName"
|
|
5
|
+
:search-mode-options="multisearch && searchModeOpts"
|
|
6
|
+
:value="localValue"
|
|
7
|
+
@input="localValue = $event"
|
|
8
|
+
@search="setValue({ name: filterName, value: localValue })"
|
|
9
|
+
@update:search-mode="changeMode"
|
|
10
|
+
/>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup>
|
|
14
|
+
import { computed, ref, watch } from 'vue';
|
|
15
|
+
import { useStore } from 'vuex';
|
|
16
|
+
import FilterEvent from '../enums/FilterEvent.enum.js';
|
|
17
|
+
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
namespace: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
multisearch: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false,
|
|
26
|
+
},
|
|
27
|
+
name: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: 'q',
|
|
30
|
+
},
|
|
31
|
+
searchModeOpts: {
|
|
32
|
+
type: Array,
|
|
33
|
+
default: () => [],
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const store = useStore();
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
function getValue(filter) {
|
|
41
|
+
return store.getters[`${props.namespace}/GET_FILTER`](filter);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function setValue(payload) {
|
|
45
|
+
return store.dispatch(`${props.namespace}/SET_FILTER`, payload);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const filterName = ref(props.multisearch ? props.searchModeOpts[0].value : props.name);
|
|
49
|
+
|
|
50
|
+
const filterValue = computed(() => getValue(filterName.value));
|
|
51
|
+
|
|
52
|
+
const localValue = ref(filterValue.value);
|
|
53
|
+
|
|
54
|
+
async function changeMode({ value }) {
|
|
55
|
+
await setValue({ name: filterName.value, value: '' });
|
|
56
|
+
filterName.value = value;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function restoreSearchMode() {
|
|
60
|
+
const mode = props.searchModeOpts.value.find(({ value }) => !!getValue(value));
|
|
61
|
+
if (mode) changeMode({ value: mode.value });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function subscribe(payload) {
|
|
65
|
+
store.dispatch(`${props.namespace}/SUBSCRIBE`, payload);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
subscribe({
|
|
69
|
+
event: FilterEvent.RESTORED,
|
|
70
|
+
callback: restoreSearchMode,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
watch(() => filterValue.value, () => {
|
|
74
|
+
localValue.value = filterValue.value;
|
|
75
|
+
});
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<style scoped lang="scss">
|
|
79
|
+
|
|
80
|
+
</style>
|
|
@@ -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
|
|
|
@@ -104,7 +105,7 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
104
105
|
|
|
105
106
|
return context.dispatch('EMIT', {
|
|
106
107
|
event: FilterEvent.RESTORED,
|
|
107
|
-
payload: context.getters.GET_FILTERS,
|
|
108
|
+
payload: context.getters.GET_FILTERS(),
|
|
108
109
|
});
|
|
109
110
|
},
|
|
110
111
|
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
queryToSortAdapter,
|
|
4
4
|
sortToQueryAdapter,
|
|
5
5
|
} from '../../../scripts/sortQueryAdapters.js';
|
|
6
|
-
import BaseStoreModule
|
|
6
|
+
import BaseStoreModule
|
|
7
|
+
from '../../../store/BaseStoreModules/BaseStoreModule.js';
|
|
7
8
|
import FilterEvent from '../../Filters/enums/FilterEvent.enum.js';
|
|
8
9
|
|
|
9
10
|
export default class TableStoreModule extends BaseStoreModule {
|
|
@@ -66,7 +67,12 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
66
67
|
},
|
|
67
68
|
|
|
68
69
|
// FIXME: maybe move to filters module?
|
|
69
|
-
HANDLE_FILTERS_RESTORE: (context
|
|
70
|
+
HANDLE_FILTERS_RESTORE: async (context, {
|
|
71
|
+
fields,
|
|
72
|
+
sort,
|
|
73
|
+
}) => {
|
|
74
|
+
if (sort) await context.dispatch('HANDLE_SORT_CHANGE', { value: sort });
|
|
75
|
+
if (fields?.length) await context.dispatch('HANDLE_FIELDS_CHANGE', { value: fields });
|
|
70
76
|
return context.dispatch('LOAD_DATA_LIST');
|
|
71
77
|
},
|
|
72
78
|
|
|
@@ -78,7 +84,7 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
78
84
|
await context.dispatch('HANDLE_SORT_CHANGE', payload);
|
|
79
85
|
}
|
|
80
86
|
|
|
81
|
-
if (context.getters.FILTERS.page && payload.value !== 'page') {
|
|
87
|
+
if (context.getters.FILTERS().page && payload.value !== 'page') {
|
|
82
88
|
await context.dispatch('SET_FILTER', {
|
|
83
89
|
name: 'page',
|
|
84
90
|
value: 1,
|
|
@@ -90,19 +96,19 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
90
96
|
},
|
|
91
97
|
|
|
92
98
|
// FIXME: maybe move to filters module?
|
|
93
|
-
HANDLE_FIELDS_CHANGE: (context,
|
|
99
|
+
HANDLE_FIELDS_CHANGE: (context, { value }) => {
|
|
94
100
|
const headers = context.state.headers.map((header) => ({
|
|
95
101
|
...header,
|
|
96
|
-
show:
|
|
102
|
+
show: value.includes(header.value),
|
|
97
103
|
}));
|
|
98
104
|
|
|
99
105
|
context.commit('SET', { path: 'headers', value: headers });
|
|
100
106
|
},
|
|
101
107
|
|
|
102
108
|
// FIXME: maybe move to filters module?
|
|
103
|
-
HANDLE_SORT_CHANGE: (context,
|
|
104
|
-
const nextSort = queryToSortAdapter(
|
|
105
|
-
const field = nextSort ?
|
|
109
|
+
HANDLE_SORT_CHANGE: (context, { value }) => {
|
|
110
|
+
const nextSort = queryToSortAdapter(value?.slice(0, 1) || '');
|
|
111
|
+
const field = nextSort ? value.slice(1) : value;
|
|
106
112
|
|
|
107
113
|
const headers = context.state.headers.map(({
|
|
108
114
|
sort: currentSort,
|
|
@@ -147,14 +147,14 @@ describe('TableStoreModule integration with FiltersStoreModule', () => {
|
|
|
147
147
|
callback: (payload) => store.dispatch('table/ON_FILTER_EVENT', payload),
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
expect(store.getters['table/
|
|
150
|
+
expect(store.getters['table/FILTERS']().page).toBe(12);
|
|
151
151
|
|
|
152
152
|
await store.dispatch('table/filters/SET_FILTER', {
|
|
153
153
|
name: 'vi',
|
|
154
154
|
value: 24,
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
-
expect(store.getters['table/
|
|
157
|
+
expect(store.getters['table/FILTERS']().page).toBe(1);
|
|
158
158
|
|
|
159
159
|
await store.dispatch('table/filters/FLUSH_SUBSCRIBERS');
|
|
160
160
|
});
|