@webitel/ui-sdk 24.10.44 → 24.10.46-1
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 +1 -1
- package/dist/ui-sdk.umd.cjs +1 -1
- package/package.json +2 -2
- package/src/components/wt-copy-action/wt-copy-action.vue +7 -14
- package/src/components/wt-table/wt-table.vue +1 -1
- 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/scripts/caseConverters.js +22 -32
- package/src/store/new/modules/tableStoreModule/__tests__/tableStoreModule.spec.js +12 -4
- package/src/store/new/modules/tableStoreModule/tableStoreModule.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-sdk",
|
|
3
|
-
"version": "24.10.
|
|
3
|
+
"version": "24.10.46-1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
"vite-plugin-static-copy": "^0.17.1",
|
|
144
144
|
"vite-plugin-svg-sprite": "^0.5.1",
|
|
145
145
|
"vite-plugin-vue-docgen": "^0.3.4",
|
|
146
|
-
"vitepress": "
|
|
146
|
+
"vitepress": "1.4.1",
|
|
147
147
|
"vitest": "^1.4.0",
|
|
148
148
|
"vue": "^3.4.15",
|
|
149
149
|
"vuex": "^4.1.0"
|
|
@@ -25,10 +25,7 @@ export default {
|
|
|
25
25
|
},
|
|
26
26
|
tooltips: {
|
|
27
27
|
type: Object,
|
|
28
|
-
default: () => ({
|
|
29
|
-
copy: '',
|
|
30
|
-
copied: '',
|
|
31
|
-
}),
|
|
28
|
+
default: () => ({}),
|
|
32
29
|
},
|
|
33
30
|
},
|
|
34
31
|
data: () => ({
|
|
@@ -44,16 +41,12 @@ export default {
|
|
|
44
41
|
},
|
|
45
42
|
methods: {
|
|
46
43
|
async copy() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, 1500);
|
|
54
|
-
} catch (err) {
|
|
55
|
-
throw err;
|
|
56
|
-
}
|
|
44
|
+
await copy(this.value);
|
|
45
|
+
this.copied = this.value;
|
|
46
|
+
if (copiedIdTimeout) window.clearTimeout(copiedIdTimeout);
|
|
47
|
+
copiedIdTimeout = setTimeout(() => {
|
|
48
|
+
this.copied = null;
|
|
49
|
+
}, 1500);
|
|
57
50
|
},
|
|
58
51
|
},
|
|
59
52
|
};
|
package/src/locale/en/en.js
CHANGED
package/src/locale/ru/ru.js
CHANGED
package/src/locale/ua/ua.js
CHANGED
|
@@ -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,9 +1,13 @@
|
|
|
1
1
|
import { createRouter, createWebHistory } from 'vue-router';
|
|
2
2
|
import { createStore } from 'vuex';
|
|
3
|
-
import FilterEvent
|
|
4
|
-
|
|
3
|
+
import FilterEvent
|
|
4
|
+
from '../../../../../modules/Filters/enums/FilterEvent.enum.js';
|
|
5
|
+
import FiltersStoreModule
|
|
6
|
+
from '../../../../../modules/Filters/store/FiltersStoreModule.js';
|
|
5
7
|
import { SortSymbols } from '../../../../../scripts/sortQueryAdapters.js';
|
|
6
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
createTableStoreModule,
|
|
10
|
+
} from '../../../helpers/createTableStoreModule.js';
|
|
7
11
|
|
|
8
12
|
describe('TableStoreModule', () => {
|
|
9
13
|
it('correctly computes FIELDS getter', () => {
|
|
@@ -15,7 +19,11 @@ describe('TableStoreModule', () => {
|
|
|
15
19
|
|
|
16
20
|
const state = { headers };
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
const tableStore = createTableStoreModule({ state });
|
|
23
|
+
|
|
24
|
+
const store = createStore(tableStore);
|
|
25
|
+
|
|
26
|
+
expect(store.getters.FIELDS).toEqual(['id', 'age']);
|
|
19
27
|
});
|
|
20
28
|
});
|
|
21
29
|
|