@webitel/ui-sdk 24.10.46 → 24.10.48
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/img/sprite/index.js +331 -161
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +7018 -6481
- package/dist/ui-sdk.umd.cjs +17 -17
- package/package.json +3 -3
- package/src/api/clients/agents/agentChats.js +41 -0
- package/src/api/clients/index.js +2 -0
- package/src/components/index.js +12 -4
- package/src/components/wt-action-bar/__tests__/wt-action-bar.spec.js +9 -0
- package/src/components/wt-action-bar/wt-action-bar.vue +78 -0
- package/src/components/wt-copy-action/wt-copy-action.vue +7 -14
- package/src/components/wt-empty/__tests__/wt-empty.spec.js +9 -0
- package/src/components/wt-empty/wt-empty.vue +140 -0
- package/src/components/wt-icon-action/wt-icon-action.vue +19 -7
- package/src/components/wt-image/__tests__/wt-image.spec.js +9 -0
- package/src/components/wt-image/wt-image.vue +124 -0
- package/src/components/wt-table/wt-table.vue +1 -1
- package/src/enums/IconAction/IconAction.enum.js +15 -0
- package/src/modules/ObjectPermissions/components/permissions-tab.vue +6 -0
- package/src/modules/TableComponent/composables/useTableEmpty.js +20 -0
- package/src/scripts/caseConverters.js +22 -32
- package/src/store/new/modules/tableStoreModule/tableStoreModule.js +30 -3
|
@@ -16,15 +16,15 @@ export const kebabToSnake = (str) =>
|
|
|
16
16
|
export const snakeToKebab = (str) =>
|
|
17
17
|
str.replace(/([-_][a-z])/g, (group) => group.replace('_', '-'));
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
const convertObject = ({ self, converter }) => (obj, skipKeys) => {
|
|
20
20
|
if (!obj) return obj;
|
|
21
21
|
const newObj = {};
|
|
22
22
|
if (Array.isArray(obj)) {
|
|
23
23
|
return obj.map((value) => {
|
|
24
24
|
if (typeof value === 'object') {
|
|
25
|
-
return
|
|
25
|
+
return self(value, skipKeys);
|
|
26
26
|
}
|
|
27
|
-
if (typeof value === 'string') return
|
|
27
|
+
if (typeof value === 'string') return converter(value);
|
|
28
28
|
return value; // number
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -32,13 +32,13 @@ export const objSnakeToCamel = (obj, skipKeys = []) => {
|
|
|
32
32
|
if (skipKeys.includes(oldKey)) {
|
|
33
33
|
newObj[oldKey] = obj[oldKey];
|
|
34
34
|
} else {
|
|
35
|
-
const newKey =
|
|
35
|
+
const newKey = converter(oldKey);
|
|
36
36
|
let value = obj[oldKey];
|
|
37
37
|
if (
|
|
38
38
|
Array.isArray(value) ||
|
|
39
39
|
(value !== null && value !== undefined && value.constructor === Object)
|
|
40
40
|
) {
|
|
41
|
-
value =
|
|
41
|
+
value = self(value, skipKeys);
|
|
42
42
|
}
|
|
43
43
|
newObj[newKey] = value;
|
|
44
44
|
}
|
|
@@ -47,33 +47,23 @@ export const objSnakeToCamel = (obj, skipKeys = []) => {
|
|
|
47
47
|
return newObj;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
+
export const objSnakeToCamel = (obj, skipKeys = []) => {
|
|
51
|
+
return convertObject({
|
|
52
|
+
self: objSnakeToCamel,
|
|
53
|
+
converter: snakeToCamel,
|
|
54
|
+
})(obj, skipKeys);
|
|
55
|
+
};
|
|
56
|
+
|
|
50
57
|
export const objCamelToSnake = (obj, skipKeys = []) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return objCamelToSnake(value, skipKeys);
|
|
57
|
-
}
|
|
58
|
-
if (typeof value === 'string') return camelToSnake(value);
|
|
59
|
-
return value; // number
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
Object.keys(obj).forEach((oldKey) => {
|
|
63
|
-
if (skipKeys.includes(oldKey)) {
|
|
64
|
-
newObj[oldKey] = obj[oldKey];
|
|
65
|
-
} else {
|
|
66
|
-
const newKey = camelToSnake(oldKey);
|
|
67
|
-
let value = obj[oldKey];
|
|
68
|
-
if (
|
|
69
|
-
Array.isArray(value) ||
|
|
70
|
-
(value !== null && value !== undefined && value.constructor === Object)
|
|
71
|
-
) {
|
|
72
|
-
value = objCamelToSnake(value, skipKeys);
|
|
73
|
-
}
|
|
74
|
-
newObj[newKey] = value;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
58
|
+
return convertObject({
|
|
59
|
+
self: objCamelToSnake,
|
|
60
|
+
converter: camelToSnake,
|
|
61
|
+
})(obj, skipKeys);
|
|
62
|
+
};
|
|
77
63
|
|
|
78
|
-
|
|
64
|
+
export const objCamelToKebab = (obj, skipKeys = []) => {
|
|
65
|
+
return convertObject({
|
|
66
|
+
self: objCamelToKebab,
|
|
67
|
+
converter: camelToKebab,
|
|
68
|
+
})(obj, skipKeys);
|
|
79
69
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import FilterEvent from '../../../../modules/Filters/enums/FilterEvent.enum.js';
|
|
2
|
+
import isEmpty from '../../../../scripts/isEmpty.js';
|
|
2
3
|
import {
|
|
3
4
|
queryToSortAdapter,
|
|
4
5
|
sortToQueryAdapter,
|
|
@@ -17,7 +18,7 @@ const getters = {
|
|
|
17
18
|
PARENT_ID: () => null, // override me
|
|
18
19
|
|
|
19
20
|
// FIXME: maybe move to filters module?
|
|
20
|
-
FILTERS: (state, getters) => getters['filters/GET_FILTERS'],
|
|
21
|
+
FILTERS: (state, getters) => () => getters['filters/GET_FILTERS'](),
|
|
21
22
|
|
|
22
23
|
REQUIRED_FIELDS: () => ['id'], // override me
|
|
23
24
|
|
|
@@ -30,7 +31,33 @@ const getters = {
|
|
|
30
31
|
return [...new Set([...getters.REQUIRED_FIELDS, ...fields])];
|
|
31
32
|
},
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
EMPTY_STATE: (state, getters) => {
|
|
35
|
+
if (state.isLoading) {
|
|
36
|
+
return { value: false };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (state.error) {
|
|
40
|
+
return { value: true, cause: 'error' };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!state.dataList.length) {
|
|
44
|
+
const filters = getters.FILTERS();
|
|
45
|
+
const uncheckedFilters = ['page', 'size', 'sort', 'fields'];
|
|
46
|
+
const filtersApplied = Object.entries(filters).some(
|
|
47
|
+
([filterValue, filterName]) =>
|
|
48
|
+
!isEmpty(filterValue) && !uncheckedFilters.includes(filterName),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
if (filtersApplied) {
|
|
52
|
+
return { value: true, cause: 'filters' };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return { value: true, cause: 'empty' };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return { value: false };
|
|
59
|
+
},
|
|
60
|
+
|
|
34
61
|
GET_LIST_PARAMS: (state, getters) => (overrides) => {
|
|
35
62
|
const filters = getters.FILTERS();
|
|
36
63
|
const fields = getters.FIELDS;
|
|
@@ -148,7 +175,7 @@ const actions = {
|
|
|
148
175
|
} finally {
|
|
149
176
|
setTimeout(() => {
|
|
150
177
|
context.commit('SET', { path: 'isLoading', value: false });
|
|
151
|
-
}, 100);
|
|
178
|
+
}, 100); // why 1s? https://ux.stackexchange.com/a/104782
|
|
152
179
|
}
|
|
153
180
|
},
|
|
154
181
|
|