@webitel/ui-sdk 24.12.169 → 24.12.171
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 +321 -314
- package/dist/ui-sdk.umd.cjs +5 -5
- package/package.json +1 -1
- package/src/components/wt-divider/_variables.scss +1 -1
- package/src/components/wt-empty/wt-empty.vue +1 -0
- package/src/components/wt-icon-action/iconMappings.js +2 -0
- package/src/components/wt-icon-action/wt-icon-action.vue +5 -2
- package/src/enums/IconAction/IconAction.enum.js +2 -0
- package/src/locale/en/en.js +3 -1
- package/src/locale/ru/ru.js +2 -0
- package/src/locale/ua/ua.js +3 -1
- package/src/modules/Filters/v2/filters/components/values/close-reason-groups-case/close-reason-groups-case-filter-value-preview.vue +4 -2
- package/src/modules/Filters/v2/filters/components/values/has-attachment/has-attachment-filter-value-preview.vue +1 -1
- package/src/modules/Filters/v2/headers/createTableHeadersStore.ts +128 -126
- package/src/modules/Filters/v2/persist/useLocalStoragePersistedStorage.ts +12 -6
- package/src/modules/Filters/v2/persist/usePersistedStorage.ts +1 -1
package/package.json
CHANGED
|
@@ -13,6 +13,8 @@ export const WtIconActionIconMappings = Object.freeze({
|
|
|
13
13
|
[IconAction.COLUMNS]: 'column-select',
|
|
14
14
|
[IconAction.VARIABLES]: 'variable-select',
|
|
15
15
|
[IconAction.CLOSE]: 'close--filled',
|
|
16
|
+
[IconAction.CANCEL]: 'close',
|
|
16
17
|
[IconAction.CLEAR]: 'clear',
|
|
17
18
|
[IconAction.ADD_FILTER]: 'add-filter',
|
|
19
|
+
[IconAction.SAVE]: 'save',
|
|
18
20
|
});
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
<wt-icon-btn
|
|
5
5
|
:disabled="disabled"
|
|
6
6
|
:icon="iconAction.icon"
|
|
7
|
-
@click="emit('click')"
|
|
7
|
+
@click="emit('click', $event)"
|
|
8
|
+
@mousedown="emit('mousedown', $event)"
|
|
8
9
|
/>
|
|
9
10
|
</template>
|
|
10
11
|
{{ t(iconAction.hint) }}
|
|
@@ -33,6 +34,8 @@ const props = defineProps({
|
|
|
33
34
|
IconAction.HISTORY,
|
|
34
35
|
IconAction.DOWNLOAD,
|
|
35
36
|
IconAction.REFRESH,
|
|
37
|
+
IconAction.SAVE,
|
|
38
|
+
IconAction.CANCEL,
|
|
36
39
|
]).includes(v),
|
|
37
40
|
},
|
|
38
41
|
disabled: {
|
|
@@ -41,7 +44,7 @@ const props = defineProps({
|
|
|
41
44
|
},
|
|
42
45
|
});
|
|
43
46
|
|
|
44
|
-
const emit = defineEmits(['click']);
|
|
47
|
+
const emit = defineEmits(['click', 'mousedown']);
|
|
45
48
|
|
|
46
49
|
const { t } = useI18n();
|
|
47
50
|
|
|
@@ -13,9 +13,11 @@ const IconAction = Object.freeze({
|
|
|
13
13
|
COLLAPSE: 'collapse',
|
|
14
14
|
EXPAND: 'expand',
|
|
15
15
|
CLOSE: 'close',
|
|
16
|
+
CANCEL: 'cancel',
|
|
16
17
|
VARIABLES: 'variables',
|
|
17
18
|
CLEAR: 'clear',
|
|
18
19
|
ADD_FILTER: 'add-filter',
|
|
20
|
+
SAVE: 'save',
|
|
19
21
|
});
|
|
20
22
|
|
|
21
23
|
export default IconAction;
|
package/src/locale/en/en.js
CHANGED
|
@@ -153,7 +153,7 @@ export default {
|
|
|
153
153
|
gateway: 'Gateway | Gateways',
|
|
154
154
|
hangupCause: 'Hangup cause',
|
|
155
155
|
hasOption: 'Has option',
|
|
156
|
-
hasRecording: '
|
|
156
|
+
hasRecording: 'Recording',
|
|
157
157
|
amdResult: 'AMD result',
|
|
158
158
|
ratedBy: 'Rated by',
|
|
159
159
|
talkDuration: 'Talk duration',
|
|
@@ -418,6 +418,8 @@ export default {
|
|
|
418
418
|
[IconAction.CLEAR]: ({ linked }) =>
|
|
419
419
|
linked('webitelUI.tableActions.filterReset'),
|
|
420
420
|
[IconAction.ADD_FILTER]: ({ linked }) => linked('reusable.add'),
|
|
421
|
+
[IconAction.SAVE]: ({ linked }) => linked('reusable.save'),
|
|
422
|
+
[IconAction.CANCEL]: ({ linked }) => linked('reusable.cancel'),
|
|
421
423
|
},
|
|
422
424
|
},
|
|
423
425
|
errorPages: {
|
package/src/locale/ru/ru.js
CHANGED
|
@@ -416,6 +416,8 @@ export default {
|
|
|
416
416
|
[IconAction.CLEAR]: ({ linked }) =>
|
|
417
417
|
linked('webitelUI.tableActions.filterReset'),
|
|
418
418
|
[IconAction.ADD_FILTER]: ({ linked }) => linked('reusable.add'),
|
|
419
|
+
[IconAction.SAVE]: ({ linked }) => linked('reusable.save'),
|
|
420
|
+
[IconAction.CANCEL]: ({ linked }) => linked('reusable.cancel'),
|
|
419
421
|
},
|
|
420
422
|
},
|
|
421
423
|
errorPages: {
|
package/src/locale/ua/ua.js
CHANGED
|
@@ -158,7 +158,7 @@ export default {
|
|
|
158
158
|
talkDuration: 'Тривалість розмови',
|
|
159
159
|
totalDuration: 'Загальна тривалість',
|
|
160
160
|
transcription: 'Транскрипція',
|
|
161
|
-
attachment: '
|
|
161
|
+
attachment: 'Вкладення | Вкладення',
|
|
162
162
|
queue: {
|
|
163
163
|
queue: 'Черга | Черги',
|
|
164
164
|
type: {
|
|
@@ -416,6 +416,8 @@ export default {
|
|
|
416
416
|
[IconAction.CLEAR]: ({ linked }) =>
|
|
417
417
|
linked('webitelUI.tableActions.filterReset'),
|
|
418
418
|
[IconAction.ADD_FILTER]: ({ linked }) => linked('reusable.add'),
|
|
419
|
+
[IconAction.SAVE]: ({ linked }) => linked('reusable.save'),
|
|
420
|
+
[IconAction.CANCEL]: ({ linked }) => linked('reusable.cancel'),
|
|
419
421
|
},
|
|
420
422
|
},
|
|
421
423
|
errorPages: {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script lang="ts" setup>
|
|
14
|
-
import {
|
|
14
|
+
import { caseCloseReasonsSearchMethod } from './config'
|
|
15
15
|
import {ref} from 'vue';
|
|
16
16
|
|
|
17
17
|
const props = defineProps<{
|
|
@@ -21,7 +21,9 @@ const props = defineProps<{
|
|
|
21
21
|
const localValue = ref([]);
|
|
22
22
|
|
|
23
23
|
const getLocalValue = async () => {
|
|
24
|
-
const { items } = await
|
|
24
|
+
const { items } = await caseCloseReasonsSearchMethod({
|
|
25
|
+
parentId: props.value?.selection,
|
|
26
|
+
id: props.value?.conditions });
|
|
25
27
|
localValue.value = items;
|
|
26
28
|
};
|
|
27
29
|
|
|
@@ -14,7 +14,7 @@ const props = defineProps<{
|
|
|
14
14
|
const { t } = useI18n();
|
|
15
15
|
|
|
16
16
|
const localeValue = computed(() => {
|
|
17
|
-
const match = BooleanOptions.find((el) => el.value === props.value);
|
|
17
|
+
const match = BooleanOptions.find((el) => el.value === props.value.toString());
|
|
18
18
|
return match ? t(match.locale) : '';
|
|
19
19
|
});
|
|
20
20
|
</script>
|
|
@@ -1,138 +1,140 @@
|
|
|
1
|
-
import { defineStore } from
|
|
2
|
-
import { computed, ref } from
|
|
1
|
+
import { defineStore } from 'pinia';
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
3
|
|
|
4
|
-
import {WtTableHeader} from
|
|
5
|
-
import { sortToQueryAdapter } from
|
|
6
|
-
import { SortSymbols } from
|
|
7
|
-
import {
|
|
4
|
+
import { WtTableHeader } from '../../../../components/wt-table/types/WtTable';
|
|
5
|
+
import { sortToQueryAdapter } from '../../../../scripts';
|
|
6
|
+
import { SortSymbols } from '../../../../scripts/sortQueryAdapters';
|
|
7
|
+
import { PersistedStorageType } from '../persist/PersistedStorage.types';
|
|
8
|
+
import { usePersistedStorage } from '../persist/usePersistedStorage.ts';
|
|
8
9
|
|
|
9
10
|
export const createTableHeadersStore = (
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
namespace: string,
|
|
12
|
+
{ headers: rawHeaders },
|
|
12
13
|
) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return defineStore(id, () => {
|
|
16
|
-
const headers = ref(rawHeaders);
|
|
17
|
-
|
|
18
|
-
const shownHeaders = computed(() => {
|
|
19
|
-
return headers.value.filter((header) => header.show);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const fields = computed(() => {
|
|
23
|
-
return shownHeaders.value.map((header) => header.field);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const sort = computed(() => {
|
|
27
|
-
const encodeSortQuery = ({ column, order }) =>
|
|
28
|
-
`${sortToQueryAdapter(order)}${column.field}`;
|
|
29
|
-
|
|
30
|
-
const sortedCol = headers.value.find((header) => header.sort);
|
|
31
|
-
|
|
32
|
-
return sortedCol
|
|
33
|
-
? encodeSortQuery({ column: sortedCol, order: sortedCol.sort })
|
|
34
|
-
: null;
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const $reset = () => {
|
|
38
|
-
headers.value = rawHeaders;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const updateShownHeaders = (value) => {
|
|
42
|
-
headers.value = value;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const updateFields = (fields: string[]) => {
|
|
46
|
-
const newHeaders = headers.value.map((header: WtTableHeader) => {
|
|
47
|
-
return {
|
|
48
|
-
...header,
|
|
49
|
-
show: fields.includes(header.field),
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
updateShownHeaders(newHeaders);
|
|
53
|
-
};
|
|
14
|
+
const id = `${namespace}/headers`;
|
|
54
15
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
switch (sort) {
|
|
58
|
-
case SortSymbols.NONE:
|
|
59
|
-
return SortSymbols.ASC;
|
|
60
|
-
case SortSymbols.ASC:
|
|
61
|
-
return SortSymbols.DESC;
|
|
62
|
-
case SortSymbols.DESC:
|
|
63
|
-
return SortSymbols.NONE;
|
|
64
|
-
default:
|
|
65
|
-
return SortSymbols.ASC;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const changeHeadersSort = ({ headers, sortedHeader, order }) => {
|
|
70
|
-
return headers.map((header) => {
|
|
71
|
-
if (header.sort === undefined) return header;
|
|
72
|
-
|
|
73
|
-
// reset all headers by default
|
|
74
|
-
let newSort = null;
|
|
75
|
-
|
|
76
|
-
if (header.field === sortedHeader.field) {
|
|
77
|
-
newSort = order;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return {
|
|
81
|
-
...header,
|
|
82
|
-
sort: newSort,
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const order = getNextSortOrder(column.sort);
|
|
88
|
-
|
|
89
|
-
const newHeaders = changeHeadersSort({
|
|
90
|
-
headers: headers.value,
|
|
91
|
-
sortedHeader: column,
|
|
92
|
-
order,
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
headers.value = newHeaders;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const setupPersistence = async () => {
|
|
99
|
-
const { restore: restoreFields } = usePersistedStorage({
|
|
100
|
-
name: "fields",
|
|
101
|
-
value: fields,
|
|
102
|
-
onStore: (save, { name }) => {
|
|
103
|
-
const value = fields.value.join(',');
|
|
104
|
-
return save({ name, value })
|
|
105
|
-
},
|
|
106
|
-
onRestore: async (restore, name) => {
|
|
107
|
-
const value = await restore(name) as string;
|
|
108
|
-
if (value) {
|
|
109
|
-
return updateFields(value.split(','));
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
});
|
|
16
|
+
return defineStore(id, () => {
|
|
17
|
+
const headers = ref(rawHeaders);
|
|
113
18
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
19
|
+
const shownHeaders = computed(() => {
|
|
20
|
+
return headers.value.filter((header) => header.show);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const fields = computed(() => {
|
|
24
|
+
return shownHeaders.value.map((header) => header.field);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const sort = computed(() => {
|
|
28
|
+
const encodeSortQuery = ({ column, order }) =>
|
|
29
|
+
`${sortToQueryAdapter(order)}${column.field}`;
|
|
30
|
+
|
|
31
|
+
const sortedCol = headers.value.find((header) => header.sort);
|
|
32
|
+
|
|
33
|
+
return sortedCol
|
|
34
|
+
? encodeSortQuery({ column: sortedCol, order: sortedCol.sort })
|
|
35
|
+
: null;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const $reset = () => {
|
|
39
|
+
headers.value = rawHeaders;
|
|
40
|
+
};
|
|
118
41
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
42
|
+
const updateShownHeaders = (value) => {
|
|
43
|
+
headers.value = value;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const updateFields = (fields: string[]) => {
|
|
47
|
+
const newHeaders = headers.value.map((header: WtTableHeader) => {
|
|
48
|
+
return {
|
|
49
|
+
...header,
|
|
50
|
+
show: fields.includes(header.field),
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
updateShownHeaders(newHeaders);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const updateSort = (column) => {
|
|
57
|
+
const getNextSortOrder = (sort) => {
|
|
58
|
+
switch (sort) {
|
|
59
|
+
case SortSymbols.NONE:
|
|
60
|
+
return SortSymbols.ASC;
|
|
61
|
+
case SortSymbols.ASC:
|
|
62
|
+
return SortSymbols.DESC;
|
|
63
|
+
case SortSymbols.DESC:
|
|
64
|
+
return SortSymbols.NONE;
|
|
65
|
+
default:
|
|
66
|
+
return SortSymbols.ASC;
|
|
67
|
+
}
|
|
123
68
|
};
|
|
124
69
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
70
|
+
const changeHeadersSort = ({ headers, sortedHeader, order }) => {
|
|
71
|
+
return headers.map((header) => {
|
|
72
|
+
if (header.sort === undefined) return header;
|
|
73
|
+
|
|
74
|
+
// reset all headers by default
|
|
75
|
+
let newSort = null;
|
|
76
|
+
|
|
77
|
+
if (header.field === sortedHeader.field) {
|
|
78
|
+
newSort = order;
|
|
79
|
+
}
|
|
130
80
|
|
|
131
|
-
|
|
132
|
-
|
|
81
|
+
return {
|
|
82
|
+
...header,
|
|
83
|
+
sort: newSort,
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
};
|
|
133
87
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
88
|
+
const order = getNextSortOrder(column.sort);
|
|
89
|
+
|
|
90
|
+
const newHeaders = changeHeadersSort({
|
|
91
|
+
headers: headers.value,
|
|
92
|
+
sortedHeader: column,
|
|
93
|
+
order,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
headers.value = newHeaders;
|
|
97
|
+
};
|
|
98
|
+
const setupPersistence = async () => {
|
|
99
|
+
const { restore: restoreFields } = usePersistedStorage({
|
|
100
|
+
name: 'fields',
|
|
101
|
+
value: fields,
|
|
102
|
+
storages: [
|
|
103
|
+
PersistedStorageType.LocalStorage,
|
|
104
|
+
PersistedStorageType.Route,
|
|
105
|
+
],
|
|
106
|
+
storagePath: id,
|
|
107
|
+
onStore: (save, { name }) => {
|
|
108
|
+
const value = fields.value.join(',');
|
|
109
|
+
return save({ name, value });
|
|
110
|
+
},
|
|
111
|
+
onRestore: async (restore, name) => {
|
|
112
|
+
const value = (await restore(name)) as string;
|
|
113
|
+
if (value) {
|
|
114
|
+
return updateFields(value.split(','));
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const { restore: restoreSort } = usePersistedStorage({
|
|
120
|
+
name: 'sort',
|
|
121
|
+
value: sort,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
return Promise.allSettled([restoreFields(), restoreSort()]);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
headers,
|
|
129
|
+
shownHeaders,
|
|
130
|
+
fields,
|
|
131
|
+
sort,
|
|
132
|
+
|
|
133
|
+
updateShownHeaders,
|
|
134
|
+
updateSort,
|
|
135
|
+
|
|
136
|
+
setupPersistence,
|
|
137
|
+
$reset,
|
|
138
|
+
};
|
|
139
|
+
});
|
|
138
140
|
};
|
|
@@ -4,28 +4,34 @@ const separator = ';';
|
|
|
4
4
|
|
|
5
5
|
const makePath = (storagePath: string, key: string) => `${storagePath}/${key}`;
|
|
6
6
|
|
|
7
|
-
export const useLocalStoragePersistedStorage = ({
|
|
7
|
+
export const useLocalStoragePersistedStorage = ({
|
|
8
|
+
storagePath = '',
|
|
9
|
+
}: {
|
|
10
|
+
storagePath: string;
|
|
11
|
+
}): StorageLike => {
|
|
8
12
|
const getItem = async (key: string) => {
|
|
9
13
|
const value = localStorage.getItem(makePath(storagePath, key));
|
|
10
14
|
try {
|
|
11
|
-
return value.split(separator);
|
|
15
|
+
return value.split(separator).join();
|
|
12
16
|
} catch {
|
|
13
17
|
return value;
|
|
14
18
|
}
|
|
15
19
|
};
|
|
16
20
|
|
|
17
21
|
const setItem = async (key: string, inputValue: string | string[]) => {
|
|
18
|
-
const value = Array.isArray(inputValue)
|
|
22
|
+
const value = Array.isArray(inputValue)
|
|
23
|
+
? inputValue.join(separator)
|
|
24
|
+
: inputValue;
|
|
19
25
|
localStorage.setItem(makePath(storagePath, key), value);
|
|
20
|
-
}
|
|
26
|
+
};
|
|
21
27
|
|
|
22
28
|
const removeItem = async (key: string) => {
|
|
23
29
|
localStorage.removeItem(makePath(storagePath, key));
|
|
24
|
-
}
|
|
30
|
+
};
|
|
25
31
|
|
|
26
32
|
return {
|
|
27
33
|
getItem,
|
|
28
34
|
setItem,
|
|
29
35
|
removeItem,
|
|
30
36
|
};
|
|
31
|
-
}
|
|
37
|
+
};
|