@webitel/ui-sdk 25.4.64 → 25.4.66
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/CHANGELOG.md +16 -0
- package/dist/img/sprite/index.js +2 -0
- package/dist/img/sprite/table.svg +3 -0
- package/dist/types/api/clients/wtTypes/_shared/utils/sortDynamicFields.d.ts +2 -0
- package/dist/types/api/clients/wtTypes/sysTypes/sysTypes.d.ts +30 -0
- package/dist/types/api/clients/wtTypes/typeExtensions/typeExtensions.d.ts +32 -0
- package/dist/types/api/transformers/skipIf/skipIf.d.ts +1 -0
- package/dist/types/components/on-demand/wt-cc-agent-status-timers/wt-cc-agent-status-timers.vue.d.ts +9 -0
- package/dist/types/components/on-demand/wt-navigation-menu/components/_internals/nav-menu-lvl-1.vue.d.ts +19 -0
- package/dist/types/components/on-demand/wt-navigation-menu/components/_internals/nav-menu-lvl-2.vue.d.ts +7 -0
- package/dist/types/components/on-demand/wt-navigation-menu/components/wt-navigation-menu.vue.d.ts +9 -0
- package/dist/types/components/on-demand/wt-route-transition/wt-route-transition.vue.d.ts +9 -0
- package/dist/types/components/on-demand/wt-save-failed-popup/wt-save-failed-popup.vue.d.ts +10 -0
- package/dist/types/components/on-demand/wt-selection-popup/wt-selection-popup.vue.d.ts +22 -0
- package/dist/types/components/on-demand/wt-start-page/components/start-page-card.vue.d.ts +7 -0
- package/dist/types/components/on-demand/wt-start-page/components/start-page-logo.vue.d.ts +7 -0
- package/dist/types/components/on-demand/wt-start-page/components/wt-start-page.vue.d.ts +11 -0
- package/dist/types/components/on-demand/wt-table-transition/wt-table-transition.vue.d.ts +9 -0
- package/dist/types/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue.d.ts +121 -0
- package/dist/types/components/transitions/cases/wt-replace-transition.vue.d.ts +18 -0
- package/dist/types/components/transitions/wt-expand-transition.vue.d.ts +6 -0
- package/dist/types/components/transitions/wt-transition.vue.d.ts +20 -0
- package/dist/types/components/wt-action-bar/wt-action-bar.vue.d.ts +26 -0
- package/dist/types/components/wt-app-header/wt-app-header.vue.d.ts +9 -0
- package/dist/types/components/wt-app-header/wt-app-navigator.vue.d.ts +11 -0
- package/dist/types/components/wt-app-header/wt-header-actions.vue.d.ts +32 -0
- package/dist/types/components/wt-avatar/wt-avatar.vue.d.ts +15 -0
- package/dist/types/components/wt-badge/wt-badge.vue.d.ts +43 -0
- package/dist/types/components/wt-button/wt-button.vue.d.ts +113 -0
- package/dist/types/components/wt-button-select/wt-button-select.vue.d.ts +19 -0
- package/dist/types/components/wt-checkbox/wt-checkbox.vue.d.ts +57 -0
- package/dist/types/components/wt-chip/wt-chip.vue.d.ts +22 -0
- package/dist/types/components/wt-confirm-dialog/wt-confirm-dialog.vue.d.ts +28 -0
- package/dist/types/components/wt-context-menu/wt-context-menu.vue.d.ts +28 -0
- package/dist/types/components/wt-copy-action/wt-copy-action.vue.d.ts +27 -0
- package/dist/types/components/wt-datepicker/wt-datepicker.vue.d.ts +35 -0
- package/dist/types/components/wt-divider/wt-divider.vue.d.ts +14 -0
- package/dist/types/components/wt-dual-panel/wt-dual-panel.vue.d.ts +20 -0
- package/dist/types/components/wt-dummy/wt-dummy.vue.d.ts +20 -0
- package/dist/types/components/wt-empty/wt-empty.vue.d.ts +55 -0
- package/dist/types/components/wt-error-page/wt-error-page.vue.d.ts +21 -0
- package/dist/types/components/wt-expansion-panel/wt-expansion-panel.vue.d.ts +23 -0
- package/dist/types/components/wt-filters-panel-wrapper/wt-filters-panel-wrapper.vue.d.ts +21 -0
- package/dist/types/components/wt-headline/wt-headline.vue.d.ts +2 -0
- package/dist/types/components/wt-headline-nav/wt-headline-nav.vue.d.ts +7 -0
- package/dist/types/components/wt-hint/wt-hint.vue.d.ts +14 -0
- package/dist/types/components/wt-icon/wt-icon.vue.d.ts +15 -0
- package/dist/types/components/wt-icon-action/wt-icon-action.vue.d.ts +12 -0
- package/dist/types/components/wt-icon-btn/wt-icon-btn.vue.d.ts +11 -0
- package/dist/types/components/wt-image/wt-image.vue.d.ts +34 -0
- package/dist/types/components/wt-indicator/wt-indicator.vue.d.ts +67 -0
- package/dist/types/components/wt-input/wt-input.vue.d.ts +53 -0
- package/dist/types/components/wt-input-info/wt-input-info.vue.d.ts +14 -0
- package/dist/types/components/wt-intersection-observer/wt-intersection-observer.vue.d.ts +10 -0
- package/dist/types/components/wt-item-link/wt-item-link.vue.d.ts +24 -0
- package/dist/types/components/wt-label/wt-label.vue.d.ts +31 -0
- package/dist/types/components/wt-load-bar/wt-load-bar.vue.d.ts +26 -0
- package/dist/types/components/wt-loader/_internals/wt-loader--md.vue.d.ts +2 -0
- package/dist/types/components/wt-loader/_internals/wt-loader--sm.vue.d.ts +16 -0
- package/dist/types/components/wt-loader/wt-loader.vue.d.ts +44 -0
- package/dist/types/components/wt-logo/wt-logo.vue.d.ts +13 -0
- package/dist/types/components/wt-navigation-bar/wt-navigation-bar.vue.d.ts +93 -0
- package/dist/types/components/wt-notification/wt-notification.vue.d.ts +17 -0
- package/dist/types/components/wt-notifications-bar/wt-notifications-bar.vue.d.ts +9 -0
- package/dist/types/components/wt-page-header/wt-page-header.vue.d.ts +31 -0
- package/dist/types/components/wt-page-wrapper/wt-page-wrapper.vue.d.ts +14 -0
- package/dist/types/components/wt-pagination/wt-pagination.vue.d.ts +59 -0
- package/dist/types/components/wt-player/wt-player.vue.d.ts +110 -0
- package/dist/types/components/wt-popup/wt-popup.vue.d.ts +52 -0
- package/dist/types/components/wt-progress-bar/wt-progress-bar.vue.d.ts +38 -0
- package/dist/types/components/wt-radio/wt-radio.vue.d.ts +66 -0
- package/dist/types/components/wt-rounded-action/wt-rounded-action.vue.d.ts +22 -0
- package/dist/types/components/wt-search-bar/wt-search-bar.vue.d.ts +194 -0
- package/dist/types/components/wt-select/wt-select.vue.d.ts +65 -0
- package/dist/types/components/wt-slider/wt-slider.vue.d.ts +75 -0
- package/dist/types/components/wt-status-select/wt-status-select.vue.d.ts +40 -0
- package/dist/types/components/wt-stepper/wt-stepper.vue.d.ts +17 -0
- package/dist/types/components/wt-switcher/wt-switcher.vue.d.ts +53 -0
- package/dist/types/components/wt-table/wt-table.vue.d.ts +132 -0
- package/dist/types/components/wt-table-actions/wt-table-actions.vue.d.ts +30 -0
- package/dist/types/components/wt-table-column-select/wt-table-column-select.vue.d.ts +42 -0
- package/dist/types/components/wt-tabs/wt-tabs.vue.d.ts +40 -0
- package/dist/types/components/wt-tags-input/wt-tags-input.vue.d.ts +54 -0
- package/dist/types/components/wt-textarea/wt-textarea.vue.d.ts +109 -0
- package/dist/types/components/wt-time-input/wt-time-input.vue.d.ts +104 -0
- package/dist/types/components/wt-timepicker/wt-timepicker.vue.d.ts +130 -0
- package/dist/types/components/wt-tooltip/_internals/wt-tooltip-floating.vue.d.ts +15 -0
- package/dist/types/components/wt-tooltip/wt-tooltip.vue.d.ts +32 -0
- package/dist/types/components/wt-tree/types/WtTreeMode.d.ts +5 -0
- package/dist/types/components/wt-tree/wt-tree.vue.d.ts +39 -0
- package/dist/types/components/wt-tree-line/types/wt-tree-nested-icons.d.ts +4 -0
- package/dist/types/components/wt-tree-line/wt-tree-line.vue.d.ts +32 -0
- package/dist/types/components/wt-tree-table/wt-tree-table.vue.d.ts +96 -0
- package/dist/types/components/wt-tree-table-row/wt-tree-table-row.vue.d.ts +90 -0
- package/dist/types/composables/useAccessControl/v2/createUserAccessControl.d.ts +2 -0
- package/dist/types/composables/useWtTable/useWtTable.d.ts +6 -0
- package/dist/types/enums/ComponentSize/ComponentSize.d.ts +12 -0
- package/dist/types/enums/CrudAction/CrudAction.d.ts +7 -0
- package/dist/types/enums/RelativeDatetimeValue/RelativeDatetimeValue.d.ts +7 -0
- package/dist/types/enums/WebitelApplications/AdminSections.d.ts +45 -0
- package/dist/types/enums/WebitelApplications/AuditorSections.d.ts +4 -0
- package/dist/types/enums/WebitelApplications/CrmSections.d.ts +14 -0
- package/dist/types/enums/WebitelApplications/SupervisorSections.d.ts +6 -0
- package/dist/types/enums/WebitelApplications/WtApplication.d.ts +10 -0
- package/dist/types/enums/WtObject/WtObject.d.ts +60 -0
- package/dist/types/enums/WtTypeExtensionFieldKind/WtTypeExtensionFieldKind.d.ts +13 -0
- package/dist/types/enums/index.d.ts +18 -0
- package/dist/types/install.d.ts +14 -0
- package/dist/types/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue.d.ts +8 -0
- package/dist/types/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue.d.ts +8 -0
- package/dist/types/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue.d.ts +12 -0
- package/dist/types/modules/Appearance/components/wt-dark-mode-switcher.vue.d.ts +7 -0
- package/dist/types/modules/AuditForm/components/audit-form-question-read-wrapper.vue.d.ts +16 -0
- package/dist/types/modules/AuditForm/components/audit-form-question-write-wrapper.vue.d.ts +12 -0
- package/dist/types/modules/AuditForm/components/audit-form-question.vue.d.ts +18 -0
- package/dist/types/modules/AuditForm/components/audit-form.vue.d.ts +14 -0
- package/dist/types/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue.d.ts +10 -0
- package/dist/types/modules/AuditForm/components/questions/options/audit-form-question-options.vue.d.ts +12 -0
- package/dist/types/modules/AuditForm/components/questions/score/audit-form-question-score.vue.d.ts +12 -0
- package/dist/types/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue.d.ts +17 -0
- package/dist/types/modules/Filters/components/filter-datetime.vue.d.ts +9 -0
- package/dist/types/modules/Filters/components/filter-pagination.vue.d.ts +9 -0
- package/dist/types/modules/Filters/components/filter-search.vue.d.ts +13 -0
- package/dist/types/modules/Filters/components/filter-select.vue.d.ts +9 -0
- package/dist/types/modules/Filters/components/filter-table-fields.vue.d.ts +12 -0
- package/dist/types/modules/ObjectPermissions/_internals/components/permissions-role-row.vue.d.ts +14 -0
- package/dist/types/modules/ObjectPermissions/_internals/components/permissions-role-select.vue.d.ts +2 -0
- package/dist/types/modules/ObjectPermissions/_internals/components/permissions-tab-role-popup.vue.d.ts +7 -0
- package/dist/types/modules/ObjectPermissions/components/permissions-tab.vue.d.ts +9 -0
- package/dist/types/modules/QueryFilters/components/abstract-api-filter.vue.d.ts +15 -0
- package/dist/types/modules/QueryFilters/components/abstract-enum-filter.vue.d.ts +12 -0
- package/dist/types/modules/QueryFilters/components/filter-datetime.vue.d.ts +21 -0
- package/dist/types/modules/QueryFilters/components/filter-from-to.vue.d.ts +30 -0
- package/dist/types/modules/QueryFilters/components/filter-search.vue.d.ts +16 -0
- package/dist/types/modules/QueryFilters/components/filter-table-fields.vue.d.ts +44 -0
- package/dist/types/modules/Userinfo/v2/api/UserinfoAPI.d.ts +11 -0
- package/dist/types/modules/Userinfo/v2/enums/GlobalActions/GlobalActions.d.ts +31 -0
- package/dist/types/modules/Userinfo/v2/enums/ScopeClass/ScopeClass.d.ts +45 -0
- package/dist/types/modules/Userinfo/v2/enums/index.d.ts +3 -0
- package/dist/types/modules/Userinfo/v2/index.d.ts +1 -0
- package/dist/types/modules/Userinfo/v2/mappings/mappings.d.ts +25 -0
- package/dist/types/modules/Userinfo/v2/scripts/utils.d.ts +9 -0
- package/dist/types/modules/Userinfo/v2/stores/accessStore.d.ts +2 -0
- package/dist/types/modules/Userinfo/v2/stores/userinfoStore.d.ts +25 -0
- package/dist/types/playground.vue.d.ts +2 -0
- package/dist/types/scripts/compareSize.d.ts +41 -0
- package/dist/types/scripts/normalizeDatetime.d.ts +8 -0
- package/dist/types/the-app.vue.d.ts +4 -0
- package/dist/ui-sdk.js +20416 -19021
- package/dist/ui-sdk.umd.cjs +19 -19
- package/package.json +4 -3
- package/src/api/clients/index.js +4 -0
- package/src/api/clients/wtTypes/_shared/utils/sortDynamicFields.ts +21 -0
- package/src/api/clients/wtTypes/sysTypes/sysTypes.ts +58 -0
- package/src/api/clients/wtTypes/typeExtensions/typeExtensions.ts +122 -0
- package/src/assets/icons/sprite/index.js +2 -0
- package/src/assets/icons/sprite/table.svg +3 -0
- package/src/components/index.js +2 -0
- package/src/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue +158 -0
- package/src/enums/WtTypeExtensionFieldKind/WtTypeExtensionFieldKind.ts +16 -0
- package/src/enums/index.js +2 -0
- package/src/enums/index.ts +2 -0
package/package.json
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-sdk",
|
|
3
|
-
"version": "25.4.
|
|
3
|
+
"version": "25.4.66",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "npm run docs:dev",
|
|
7
7
|
"build": "vite build",
|
|
8
8
|
"test:unit": "vitest",
|
|
9
|
-
"
|
|
9
|
+
"build:types": "vue-tsc -p ./tsconfig.build.json",
|
|
10
|
+
"publish-lib": "npm run build && (npm run build:types || true) && npm publish --access public",
|
|
10
11
|
"docs:dev": "vitepress dev docs --port 8080",
|
|
11
12
|
"docs:build": "vitepress build docs",
|
|
12
13
|
"lint:fix": "eslint --fix ./src && prettier --write --check ./src",
|
|
13
14
|
"lint:fix-staged": "npx lint-staged",
|
|
14
15
|
"lint:package": "publint",
|
|
15
16
|
"orval": "orval",
|
|
16
|
-
"tsc": "tsc -p tsconfig.json",
|
|
17
17
|
"utils:link": "npm link",
|
|
18
18
|
"utils:update-node": "nvm install --lts && nvm alias default node",
|
|
19
19
|
"utils:i": "npm install"
|
|
20
20
|
},
|
|
21
21
|
"main": "./dist/ui-sdk.js",
|
|
22
22
|
"type": "module",
|
|
23
|
+
"types": "./dist/types",
|
|
23
24
|
"exports": {
|
|
24
25
|
".": "./dist/ui-sdk.js",
|
|
25
26
|
"./store": "./src/store/new/index",
|
package/src/api/clients/index.js
CHANGED
|
@@ -25,6 +25,8 @@ import skills from './skills/skills.js';
|
|
|
25
25
|
import slas from './slas/slas.js';
|
|
26
26
|
import teams from './teams/teams.js';
|
|
27
27
|
import users from './users/users.js';
|
|
28
|
+
import sysTypes from './wtTypes/sysTypes/sysTypes';
|
|
29
|
+
import typeExtensions from './wtTypes/typeExtensions/typeExtensions';
|
|
28
30
|
import { contactChatMessagesHistory, contacts } from './сontacts/index.js';
|
|
29
31
|
|
|
30
32
|
export {
|
|
@@ -55,6 +57,8 @@ export {
|
|
|
55
57
|
roles,
|
|
56
58
|
skills,
|
|
57
59
|
slas,
|
|
60
|
+
sysTypes,
|
|
58
61
|
teams,
|
|
62
|
+
typeExtensions,
|
|
59
63
|
users,
|
|
60
64
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import deepCopy from 'deep-copy';
|
|
2
|
+
import { WebitelProtoDataStruct } from 'webitel-sdk';
|
|
3
|
+
|
|
4
|
+
export const sortDynamicFields = (
|
|
5
|
+
item: WebitelProtoDataStruct,
|
|
6
|
+
): WebitelProtoDataStruct => {
|
|
7
|
+
const unSortableFields = item.fields.filter((field) => !field.position);
|
|
8
|
+
|
|
9
|
+
const sortableFields = deepCopy(item.fields)
|
|
10
|
+
.filter((field) => field.position)
|
|
11
|
+
.sort((a, b) => {
|
|
12
|
+
return a.position - b.position;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const fields = [...unSortableFields, ...sortableFields];
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
...item,
|
|
19
|
+
fields,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getDefaultGetListResponse,
|
|
3
|
+
getDefaultGetParams,
|
|
4
|
+
getDefaultInstance,
|
|
5
|
+
} from '../../../defaults';
|
|
6
|
+
import applyTransform, {
|
|
7
|
+
camelToSnake,
|
|
8
|
+
generateUrl,
|
|
9
|
+
merge,
|
|
10
|
+
notify,
|
|
11
|
+
sanitize,
|
|
12
|
+
} from '../../../transformers';
|
|
13
|
+
|
|
14
|
+
const instance = getDefaultInstance();
|
|
15
|
+
|
|
16
|
+
const getSysTypeRecordsList = async ({ path, display, primary, ...params }) => {
|
|
17
|
+
const fieldsToSend = ['page', 'size', 'q', 'sort', 'fields', 'id'];
|
|
18
|
+
|
|
19
|
+
const url = applyTransform(params, [
|
|
20
|
+
merge(getDefaultGetParams()),
|
|
21
|
+
(params) => ({ ...params, q: params.search }),
|
|
22
|
+
sanitize(fieldsToSend),
|
|
23
|
+
camelToSnake(),
|
|
24
|
+
generateUrl(path),
|
|
25
|
+
]);
|
|
26
|
+
try {
|
|
27
|
+
const response = await instance.get(url);
|
|
28
|
+
const { data, items, next } = applyTransform(response.data, [
|
|
29
|
+
merge(getDefaultGetListResponse()),
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
// Some endpoints return data, some return items so we need to check for both of them
|
|
34
|
+
items:
|
|
35
|
+
applyTransform(data || items, [
|
|
36
|
+
// transformItemsForSelect({ display, primary }),
|
|
37
|
+
]) ?? [],
|
|
38
|
+
next,
|
|
39
|
+
};
|
|
40
|
+
} catch (err) {
|
|
41
|
+
throw applyTransform(err, [notify]);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const getSysTypeRecordsLookup = (params) =>
|
|
46
|
+
getSysTypeRecordsList({
|
|
47
|
+
...params,
|
|
48
|
+
fields: params.fields || ['id', 'name'],
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const SysTypesApi = {
|
|
52
|
+
getList: getSysTypeRecordsList,
|
|
53
|
+
getLookup: getSysTypeRecordsLookup,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { getSysTypeRecordsList, getSysTypeRecordsLookup };
|
|
57
|
+
|
|
58
|
+
export default SysTypesApi;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ExtensionsApiFactory, WebitelProtoDataStruct } from 'webitel-sdk';
|
|
2
|
+
|
|
3
|
+
import { getDefaultInstance, getDefaultOpenAPIConfig } from '../../../defaults';
|
|
4
|
+
import applyTransform, {
|
|
5
|
+
camelToSnake,
|
|
6
|
+
notify,
|
|
7
|
+
sanitize,
|
|
8
|
+
snakeToCamel,
|
|
9
|
+
} from '../../../transformers';
|
|
10
|
+
import { sortDynamicFields } from '../_shared/utils/sortDynamicFields';
|
|
11
|
+
|
|
12
|
+
const instance = getDefaultInstance();
|
|
13
|
+
const configuration = getDefaultOpenAPIConfig();
|
|
14
|
+
|
|
15
|
+
const typeExtensionsService = ExtensionsApiFactory(configuration, '', instance);
|
|
16
|
+
|
|
17
|
+
const fieldsToSend = ['fields', 'repo', 'path'];
|
|
18
|
+
|
|
19
|
+
const generateIdsFromRepos = (item: WebitelProtoDataStruct) => ({
|
|
20
|
+
...item,
|
|
21
|
+
id: item.repo,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const getTypeExtension = async ({ itemId: typeRepo }) => {
|
|
25
|
+
const createPositionGenerator = () => {
|
|
26
|
+
let position = 1;
|
|
27
|
+
return (item) => (item.readonly ? null : position++);
|
|
28
|
+
};
|
|
29
|
+
const getPosition = createPositionGenerator();
|
|
30
|
+
|
|
31
|
+
const itemResponseHandler = (item) => ({
|
|
32
|
+
...item,
|
|
33
|
+
fields: item.fields.map((field) => ({
|
|
34
|
+
...field,
|
|
35
|
+
position: getPosition(field),
|
|
36
|
+
})),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const response = await typeExtensionsService.locateType(typeRepo);
|
|
41
|
+
|
|
42
|
+
return applyTransform(response.data, [
|
|
43
|
+
snakeToCamel(),
|
|
44
|
+
generateIdsFromRepos,
|
|
45
|
+
itemResponseHandler,
|
|
46
|
+
]);
|
|
47
|
+
} catch {
|
|
48
|
+
return {
|
|
49
|
+
id: typeRepo,
|
|
50
|
+
fields: [],
|
|
51
|
+
isNew: true,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const addTypeExtension = async ({ itemInstance, itemId: typeRepo }) => {
|
|
57
|
+
const item = applyTransform(itemInstance, [
|
|
58
|
+
sortDynamicFields,
|
|
59
|
+
camelToSnake(),
|
|
60
|
+
sanitize(fieldsToSend),
|
|
61
|
+
]);
|
|
62
|
+
try {
|
|
63
|
+
const response = await typeExtensionsService.createType(typeRepo, item);
|
|
64
|
+
return applyTransform(response.data, [
|
|
65
|
+
snakeToCamel(),
|
|
66
|
+
generateIdsFromRepos,
|
|
67
|
+
]);
|
|
68
|
+
} catch (err) {
|
|
69
|
+
throw applyTransform(err, [notify]);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const deleteTypeExtension = async ({ itemId: typeRepo }) => {
|
|
74
|
+
try {
|
|
75
|
+
await typeExtensionsService.deleteType(typeRepo);
|
|
76
|
+
} catch (err) {
|
|
77
|
+
throw applyTransform(err, [notify]);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const updateTypeExtension = async ({ itemInstance, itemId: typeRepo }) => {
|
|
82
|
+
if (!itemInstance.fields.length && itemInstance.isNew) {
|
|
83
|
+
return itemInstance;
|
|
84
|
+
} else if (itemInstance.isNew) {
|
|
85
|
+
return addTypeExtension({ itemInstance, itemId: typeRepo });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (!itemInstance.fields.length && !itemInstance.isNew) {
|
|
89
|
+
return deleteTypeExtension({ itemId: typeRepo });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const item = applyTransform(itemInstance, [
|
|
93
|
+
sortDynamicFields,
|
|
94
|
+
camelToSnake(),
|
|
95
|
+
sanitize(fieldsToSend),
|
|
96
|
+
]);
|
|
97
|
+
try {
|
|
98
|
+
const response = await typeExtensionsService.updateType(typeRepo, item);
|
|
99
|
+
return applyTransform(response.data, [
|
|
100
|
+
snakeToCamel(),
|
|
101
|
+
generateIdsFromRepos,
|
|
102
|
+
]);
|
|
103
|
+
} catch (err) {
|
|
104
|
+
throw applyTransform(err, [notify]);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const WtTypeExtensionApi = {
|
|
109
|
+
getList: getTypeExtension,
|
|
110
|
+
add: addTypeExtension,
|
|
111
|
+
update: updateTypeExtension,
|
|
112
|
+
delete: deleteTypeExtension,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export {
|
|
116
|
+
addTypeExtension,
|
|
117
|
+
deleteTypeExtension,
|
|
118
|
+
getTypeExtension,
|
|
119
|
+
updateTypeExtension,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export default WtTypeExtensionApi;
|
|
@@ -180,6 +180,7 @@ import stopSign from './stop-sign.svg';
|
|
|
180
180
|
import stt from './stt.svg';
|
|
181
181
|
import sttDownload from './stt-download.svg';
|
|
182
182
|
import sttSearch from './stt-search.svg';
|
|
183
|
+
import table from './table.svg';
|
|
183
184
|
import telegramBot from './telegram-bot.svg';
|
|
184
185
|
import tick from './tick.svg';
|
|
185
186
|
import treeCollapse from './tree-collapse.svg';
|
|
@@ -330,6 +331,7 @@ export default objCamelToKebab({
|
|
|
330
331
|
numpad,
|
|
331
332
|
pause,
|
|
332
333
|
play,
|
|
334
|
+
table,
|
|
333
335
|
treeExpand,
|
|
334
336
|
prompter,
|
|
335
337
|
queueMember,
|
package/src/components/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import WtNavigationMenu from './on-demand/wt-navigation-menu/components/wt-navigation-menu.vue';
|
|
2
2
|
import WtSelectionPopup from './on-demand/wt-selection-popup/wt-selection-popup.vue';
|
|
3
3
|
import WtStartPage from './on-demand/wt-start-page/components/wt-start-page.vue';
|
|
4
|
+
import WtTypeExtensionValueInput from './on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue';
|
|
4
5
|
import WtReplaceTransition from './transitions/cases/wt-replace-transition.vue';
|
|
5
6
|
import WtActionBar from './wt-action-bar/wt-action-bar.vue';
|
|
6
7
|
import WtAppHeader from './wt-app-header/wt-app-header.vue';
|
|
@@ -210,6 +211,7 @@ export {
|
|
|
210
211
|
WtTooltip,
|
|
211
212
|
WtTree,
|
|
212
213
|
WtTreeTable,
|
|
214
|
+
WtTypeExtensionValueInput,
|
|
213
215
|
};
|
|
214
216
|
|
|
215
217
|
export default Components;
|
package/src/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-input
|
|
3
|
+
v-if="field.kind === FieldType.Text"
|
|
4
|
+
v-bind="sharedChildrenProps"
|
|
5
|
+
:value="value"
|
|
6
|
+
@input="setValue"
|
|
7
|
+
/>
|
|
8
|
+
<wt-input
|
|
9
|
+
v-else-if="field.kind === FieldType.Number"
|
|
10
|
+
v-bind="sharedChildrenProps"
|
|
11
|
+
:value="value"
|
|
12
|
+
type="number"
|
|
13
|
+
@input="setValue"
|
|
14
|
+
/>
|
|
15
|
+
<wt-switcher
|
|
16
|
+
v-else-if="field.kind === FieldType.Boolean"
|
|
17
|
+
v-bind="sharedChildrenProps"
|
|
18
|
+
:value="value"
|
|
19
|
+
@change="setValue"
|
|
20
|
+
/>
|
|
21
|
+
<slot
|
|
22
|
+
v-else-if="field.kind === FieldType.Select"
|
|
23
|
+
:name="FieldType.Select"
|
|
24
|
+
:default-props="{
|
|
25
|
+
...sharedChildrenProps,
|
|
26
|
+
...selectProps,
|
|
27
|
+
value,
|
|
28
|
+
}"
|
|
29
|
+
>
|
|
30
|
+
<wt-select
|
|
31
|
+
v-bind="sharedChildrenProps"
|
|
32
|
+
:value="value"
|
|
33
|
+
:search-method="loadLookupList(field.lookup)"
|
|
34
|
+
track-by="id"
|
|
35
|
+
clearable
|
|
36
|
+
@input="selectElement"
|
|
37
|
+
/>
|
|
38
|
+
</slot>
|
|
39
|
+
<slot
|
|
40
|
+
v-else-if="field.kind === FieldType.Multiselect"
|
|
41
|
+
:name="FieldType.Multiselect"
|
|
42
|
+
:default-props="{
|
|
43
|
+
...sharedChildrenProps,
|
|
44
|
+
...multiselectProps,
|
|
45
|
+
value,
|
|
46
|
+
}"
|
|
47
|
+
>
|
|
48
|
+
<wt-select
|
|
49
|
+
v-bind="{ ...sharedChildrenProps, ...multiselectProps }"
|
|
50
|
+
:value="value"
|
|
51
|
+
@input="selectElements"
|
|
52
|
+
/>
|
|
53
|
+
</slot>
|
|
54
|
+
<wt-datepicker
|
|
55
|
+
v-else-if="field.kind === FieldType.Calendar"
|
|
56
|
+
v-bind="sharedChildrenProps"
|
|
57
|
+
:value="value * DatetimeConversionModifier"
|
|
58
|
+
mode="datetime"
|
|
59
|
+
@input="setValue(+$event / DatetimeConversionModifier)"
|
|
60
|
+
/>
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
<script lang="ts" setup>
|
|
64
|
+
import { WtDatepicker, WtInput,WtSelect, WtSwitcher } from '@webitel/ui-sdk/components';
|
|
65
|
+
import { computed } from 'vue';
|
|
66
|
+
import { useI18n } from 'vue-i18n';
|
|
67
|
+
import { WebitelProtoDataField } from 'webitel-sdk';
|
|
68
|
+
|
|
69
|
+
import { getSysTypeRecordsLookup } from "../../../api/clients/wtTypes/sysTypes/sysTypes";
|
|
70
|
+
import { WtTypeExtensionFieldKind as FieldType } from '../../../enums';
|
|
71
|
+
|
|
72
|
+
// TODO: move to api file, mb? 🤔
|
|
73
|
+
// Number for convert time from seconds to milliseconds, when send to backend and display on frontend
|
|
74
|
+
const DatetimeConversionModifier = 1000;
|
|
75
|
+
|
|
76
|
+
const model = defineModel<unknown>();
|
|
77
|
+
|
|
78
|
+
const props = defineProps<{
|
|
79
|
+
field: WebitelProtoDataField;
|
|
80
|
+
required?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* TODO: implement validation
|
|
83
|
+
*/
|
|
84
|
+
v?: object;
|
|
85
|
+
}>();
|
|
86
|
+
|
|
87
|
+
const { t } = useI18n();
|
|
88
|
+
|
|
89
|
+
const label = computed(() => {
|
|
90
|
+
return t(props.field?.name || 'vocabulary.labels');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const isRequired = computed(() => {
|
|
94
|
+
return props.required || props.field.required;
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const value = computed(() => {
|
|
98
|
+
return model.value;
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const sharedChildrenProps = computed(() => ({
|
|
102
|
+
label: label.value,
|
|
103
|
+
required: isRequired.value,
|
|
104
|
+
v: props.v,
|
|
105
|
+
}));
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @author @dlohvinov
|
|
109
|
+
*
|
|
110
|
+
* props as computed is needed to pass it either
|
|
111
|
+
* to slot and to default in-slot component
|
|
112
|
+
*/
|
|
113
|
+
const selectProps = computed(() => ({
|
|
114
|
+
clearable: true,
|
|
115
|
+
trackBy: 'id',
|
|
116
|
+
searchMethod: () => loadLookupList(props.field.lookup),
|
|
117
|
+
}));
|
|
118
|
+
|
|
119
|
+
const multiselectProps = computed(() => ({
|
|
120
|
+
...selectProps.value,
|
|
121
|
+
multiple: true,
|
|
122
|
+
}));
|
|
123
|
+
|
|
124
|
+
const setValue = (value) => {
|
|
125
|
+
model.value = value;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const loadLookupList = ({ path, display, primary }) => {
|
|
129
|
+
return (params) => {
|
|
130
|
+
return getSysTypeRecordsLookup({
|
|
131
|
+
...params,
|
|
132
|
+
path,
|
|
133
|
+
display,
|
|
134
|
+
primary,
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const selectElement = (value) => {
|
|
140
|
+
if (Object.values(value).length === 0) {
|
|
141
|
+
return setValue(null);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
setValue({
|
|
145
|
+
id: value.id,
|
|
146
|
+
name: value.name,
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const selectElements = (value) => {
|
|
151
|
+
setValue(
|
|
152
|
+
value.map((item) => ({
|
|
153
|
+
id: item.id,
|
|
154
|
+
name: item.name,
|
|
155
|
+
})),
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name FieldType
|
|
3
|
+
* @description Enumerates (ONLY!) the types of field type.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const WtTypeExtensionFieldKind = {
|
|
7
|
+
Text: 'string',
|
|
8
|
+
Number: 'int32',
|
|
9
|
+
Select: 'lookup',
|
|
10
|
+
Multiselect: 'list',
|
|
11
|
+
Calendar: 'datetime',
|
|
12
|
+
Boolean: 'bool',
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
export type ExtensionFieldType =
|
|
16
|
+
(typeof WtTypeExtensionFieldKind)[keyof typeof WtTypeExtensionFieldKind];
|
package/src/enums/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { SupervisorSections } from './WebitelApplications/SupervisorSections';
|
|
|
14
14
|
import WebitelApplications from './WebitelApplications/WebitelApplications.enum.js';
|
|
15
15
|
import { WtApplication } from './WebitelApplications/WtApplication';
|
|
16
16
|
import { WtObject } from './WtObject/WtObject';
|
|
17
|
+
import { WtTypeExtensionFieldKind } from './WtTypeExtensionFieldKind/WtTypeExtensionFieldKind';
|
|
17
18
|
|
|
18
19
|
export {
|
|
19
20
|
AbstractUserStatus,
|
|
@@ -32,4 +33,5 @@ export {
|
|
|
32
33
|
WebitelApplications,
|
|
33
34
|
WtApplication,
|
|
34
35
|
WtObject,
|
|
36
|
+
WtTypeExtensionFieldKind,
|
|
35
37
|
};
|
package/src/enums/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { SupervisorSections } from './WebitelApplications/SupervisorSections';
|
|
|
14
14
|
import WebitelApplications from './WebitelApplications/WebitelApplications.enum.js';
|
|
15
15
|
import { WtApplication } from './WebitelApplications/WtApplication';
|
|
16
16
|
import { WtObject } from './WtObject/WtObject';
|
|
17
|
+
import { WtTypeExtensionFieldKind } from './WtTypeExtensionFieldKind/WtTypeExtensionFieldKind';
|
|
17
18
|
|
|
18
19
|
export {
|
|
19
20
|
AbstractUserStatus,
|
|
@@ -32,4 +33,5 @@ export {
|
|
|
32
33
|
WebitelApplications,
|
|
33
34
|
WtApplication,
|
|
34
35
|
WtObject,
|
|
36
|
+
WtTypeExtensionFieldKind,
|
|
35
37
|
};
|