@webitel/ui-sdk 24.6.12 → 24.6.14
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
CHANGED
|
@@ -126,12 +126,18 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
126
126
|
},
|
|
127
127
|
|
|
128
128
|
FLUSH_SUBSCRIBERS: (context) => {
|
|
129
|
-
return context.state._emitter.
|
|
129
|
+
return context.state._emitter.all.clear();
|
|
130
130
|
},
|
|
131
131
|
|
|
132
132
|
EMIT: async (context, { event, payload }) => {
|
|
133
133
|
return new Promise(async (resolve, reject) => {
|
|
134
|
-
const
|
|
134
|
+
const wildcardListeners = context.state._emitter.all.get('*');
|
|
135
|
+
const eventListeners = context.state._emitter.all.get(event);
|
|
136
|
+
|
|
137
|
+
const listeners = [
|
|
138
|
+
...(wildcardListeners || []),
|
|
139
|
+
...(eventListeners || []),
|
|
140
|
+
];
|
|
135
141
|
|
|
136
142
|
if (!listeners) {
|
|
137
143
|
console.info(`No listeners for ${event} event`);
|
|
@@ -36,7 +36,7 @@ export const useTableStore = (namespace) => {
|
|
|
36
36
|
return store.dispatch(`${tableNamespace}/DELETE`, payload);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
function sort(
|
|
39
|
+
function sort(header, nextSortOrder) {
|
|
40
40
|
return store.dispatch(`${tableNamespace}/SORT`, {
|
|
41
41
|
header,
|
|
42
42
|
nextSortOrder,
|
|
@@ -101,14 +101,21 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
101
101
|
|
|
102
102
|
// FIXME: maybe move to filters module?
|
|
103
103
|
HANDLE_SORT_CHANGE: (context, payload) => {
|
|
104
|
-
const nextSort = queryToSortAdapter(payload.value
|
|
104
|
+
const nextSort = queryToSortAdapter(payload.value?.slice(0, 1) || '');
|
|
105
105
|
const field = nextSort ? payload.value.slice(1) : payload.value;
|
|
106
106
|
|
|
107
107
|
const headers = context.state.headers.map(({
|
|
108
108
|
sort: currentSort,
|
|
109
109
|
...header
|
|
110
110
|
}) => {
|
|
111
|
-
|
|
111
|
+
let sort;
|
|
112
|
+
|
|
113
|
+
if (field) {
|
|
114
|
+
sort = field === header.field ? nextSort : currentSort;
|
|
115
|
+
} else {
|
|
116
|
+
sort = nextSort; // null
|
|
117
|
+
}
|
|
118
|
+
|
|
112
119
|
return { ...header, sort };
|
|
113
120
|
});
|
|
114
121
|
|
|
@@ -188,7 +195,7 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
188
195
|
await context.dispatch('LOAD_DATA_LIST');
|
|
189
196
|
|
|
190
197
|
/* if no items on current page after DELETE, move to prev page [WTEL-3793] */
|
|
191
|
-
if (!context.
|
|
198
|
+
if (!context.state.dataList.length && context.getters.FILTERS.page > 1) {
|
|
192
199
|
await context.dispatch('SET_FILTER', {
|
|
193
200
|
name: 'page',
|
|
194
201
|
value: context.getters.FILTERS.page - 1,
|