@topconsultnpm/sdkui-react-beta 6.12.37 → 6.12.39
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/lib/components/base/Styled.d.ts +12 -0
- package/lib/components/base/Styled.js +49 -3
- package/lib/components/base/TMFloatingToolbar.d.ts +9 -0
- package/lib/components/base/TMFloatingToolbar.js +99 -0
- package/lib/components/base/TMRightSidebar.d.ts +0 -4
- package/lib/components/base/TMRightSidebar.js +2 -10
- package/lib/components/base/TMShowAllOrMaxItemsButton.d.ts +8 -0
- package/lib/components/base/TMShowAllOrMaxItemsButton.js +14 -0
- package/lib/components/base/TMTreeView.d.ts +27 -0
- package/lib/components/base/TMTreeView.js +199 -0
- package/lib/components/grids/TMBlogs.d.ts +84 -0
- package/lib/components/grids/TMBlogs.js +566 -0
- package/lib/components/grids/TMBlogsUtils.d.ts +83 -0
- package/lib/components/grids/TMBlogsUtils.js +258 -0
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/query/TMBatchUpdateForm.d.ts +12 -0
- package/lib/components/query/TMBatchUpdateForm.js +149 -0
- package/lib/components/query/TMDcmtBlog.d.ts +7 -0
- package/lib/components/query/TMDcmtBlog.js +34 -0
- package/lib/components/query/TMDcmtForm.d.ts +32 -0
- package/lib/components/query/TMDcmtForm.js +544 -0
- package/lib/components/query/TMDcmtIcon.d.ts +10 -0
- package/lib/components/query/TMDcmtIcon.js +52 -0
- package/lib/components/query/TMDcmtPreview.d.ts +26 -0
- package/lib/components/query/TMDcmtPreview.js +200 -0
- package/lib/components/query/TMFileUploader.d.ts +11 -0
- package/lib/components/query/TMFileUploader.js +101 -0
- package/lib/components/query/TMMasterDetailDcmts.d.ts +23 -0
- package/lib/components/query/TMMasterDetailDcmts.js +475 -0
- package/lib/components/query/TMQueryEditor.js +2 -2
- package/lib/components/query/TMQueryResultForm.d.ts +1 -7
- package/lib/components/query/TMQueryResultForm.js +1 -9
- package/lib/components/query/TMWorkflowPopup.d.ts +29 -0
- package/lib/components/query/TMWorkflowPopup.js +131 -0
- package/lib/components/search/TMSearchResult.d.ts +31 -0
- package/lib/components/search/TMSearchResult.js +727 -0
- package/lib/components/search/TMSearchResultsMenuItems.d.ts +6 -0
- package/lib/components/search/TMSearchResultsMenuItems.js +376 -0
- package/lib/helper/Enum_Localizator.d.ts +2 -1
- package/lib/helper/Enum_Localizator.js +20 -1
- package/lib/helper/SDKUI_Localizator.d.ts +24 -0
- package/lib/helper/SDKUI_Localizator.js +240 -0
- package/lib/helper/dcmtsHelper.d.ts +4 -0
- package/lib/helper/dcmtsHelper.js +15 -0
- package/lib/helper/helpers.d.ts +2 -1
- package/lib/helper/helpers.js +74 -1
- package/lib/helper/queryHelper.d.ts +7 -1
- package/lib/helper/queryHelper.js +105 -1
- package/lib/hooks/useDcmtOperations.d.ts +24 -0
- package/lib/hooks/useDcmtOperations.js +387 -0
- package/lib/hooks/useInputDialog.d.ts +5 -0
- package/lib/hooks/useInputDialog.js +73 -0
- package/lib/hooks/usePreventFileDrop.d.ts +3 -0
- package/lib/hooks/usePreventFileDrop.js +37 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/services/platform_services.d.ts +1 -1
- package/lib/ts/types.d.ts +54 -1
- package/lib/ts/types.js +34 -0
- package/package.json +1 -1
@@ -0,0 +1,131 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useMemo, useState } from "react";
|
3
|
+
import { SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
|
4
|
+
import { Menu } from "devextreme-react";
|
5
|
+
import styled from "styled-components";
|
6
|
+
import { SDKUI_Localizator, IconApply, IconCloseOutline, IconUser, IconInfo } from "../../helper";
|
7
|
+
import { TMColors } from "../../utils/theme";
|
8
|
+
import TMButton from "../base/TMButton";
|
9
|
+
import { DeviceType } from "../base/TMDeviceProvider";
|
10
|
+
import TMModal from "../base/TMModal";
|
11
|
+
import { TMExceptionBoxManager } from "../base/TMPopUp";
|
12
|
+
import TMSpinner from "../base/TMSpinner";
|
13
|
+
import TMUserChooser from "../choosers/TMUserChooser";
|
14
|
+
const StyledWorkFlowOperationButtonsContainer = styled.div `
|
15
|
+
display: flex;
|
16
|
+
align-items: center;
|
17
|
+
gap: 15px;
|
18
|
+
margin-left: ${props => props.$isInDcmtForm ? '0' : '50px'};
|
19
|
+
`;
|
20
|
+
const StyledTextArea = styled.textarea `
|
21
|
+
width: 100%;
|
22
|
+
height: 100%;
|
23
|
+
border: 1px solid ${props => props.$isValid ? '#b4b4b4' : TMColors.error};
|
24
|
+
border-radius: 10px;
|
25
|
+
padding: 10px;
|
26
|
+
&:focus{
|
27
|
+
outline: none;
|
28
|
+
border-bottom: 4px solid ${props => props.$isValid ? TMColors.primaryColor : TMColors.error};
|
29
|
+
}
|
30
|
+
`;
|
31
|
+
export const WorkFlowOperationButtons = ({ isInDcmtForm = false, deviceType = DeviceType.DESKTOP, onApprove, onReAssign, onReject, approveDisable = false, reassignDisable = false, rejectDisable = false, infoDisable = false }) => {
|
32
|
+
const operations = useMemo(() => {
|
33
|
+
return ([{
|
34
|
+
id: '1',
|
35
|
+
name: SDKUI_Localizator.Operations,
|
36
|
+
items: [
|
37
|
+
{ id: '1_1', name: SDKUI_Localizator.Approve, icon: '', onClick: onApprove },
|
38
|
+
{ id: '1_2', name: SDKUI_Localizator.Reject, icon: '', onClick: onReject },
|
39
|
+
{ id: '1_3', name: SDKUI_Localizator.Reassign, icon: '', onClick: onReAssign },
|
40
|
+
{ id: '1_4', name: SDKUI_Localizator.MoreInformation, icon: '', onClick: () => alert('TODO') }
|
41
|
+
],
|
42
|
+
}]);
|
43
|
+
}, []);
|
44
|
+
return (deviceType === DeviceType.DESKTOP ?
|
45
|
+
_jsxs(StyledWorkFlowOperationButtonsContainer, { "$isInDcmtForm": isInDcmtForm, children: [_jsx(TMButton, { btnStyle: isInDcmtForm ? 'toolbar' : 'advanced', showTooltip: isInDcmtForm, icon: _jsx(IconApply, {}), caption: SDKUI_Localizator.Approve, disabled: approveDisable, onClick: () => !approveDisable && onApprove && onApprove(), advancedColor: TMColors.success, color: 'success' }), _jsx(TMButton, { btnStyle: isInDcmtForm ? 'toolbar' : 'advanced', showTooltip: isInDcmtForm, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Reject, disabled: rejectDisable, onClick: () => !rejectDisable && onReject && onReject(), advancedColor: TMColors.error, color: 'error' }), _jsx(TMButton, { btnStyle: isInDcmtForm ? 'toolbar' : 'advanced', showTooltip: isInDcmtForm, icon: _jsx(IconUser, { fontSize: 16 }), caption: SDKUI_Localizator.Reassign, disabled: reassignDisable, onClick: () => !reassignDisable && onReAssign && onReAssign(), advancedColor: TMColors.tertiary, color: 'tertiary' }), _jsx(TMButton, { btnStyle: isInDcmtForm ? 'toolbar' : 'advanced', showTooltip: isInDcmtForm, icon: _jsx(IconInfo, { fontSize: 16 }), caption: SDKUI_Localizator.MoreInformation, width: '180px', disabled: infoDisable, onClick: () => alert('TODO!!!'), advancedColor: TMColors.info, color: 'info' })] }) :
|
46
|
+
_jsx(Menu, { elementAttr: { class: 'custom-dx-menu' }, disabled: approveDisable && reassignDisable && rejectDisable && infoDisable, dataSource: operations, displayExpr: "name" }));
|
47
|
+
};
|
48
|
+
export const WorkFlowApproveRejectPopUp = ({ TID = 0, DID = 0, deviceType = DeviceType.DESKTOP, op, onClose, selectedItems = [], onUpdate }) => {
|
49
|
+
const [commentValue, setCommentValue] = useState('');
|
50
|
+
const disable = commentValue.length === 0;
|
51
|
+
const count = () => { return selectedItems.length.toString() + ' Workitem'; };
|
52
|
+
const completeWorkFlowAsync = async () => {
|
53
|
+
try {
|
54
|
+
TMSpinner.show();
|
55
|
+
const workflowEngine = SDK_Globals.tmSession?.NewWorkflowEngine();
|
56
|
+
if (!workflowEngine)
|
57
|
+
throw new Error("Workflow engine is not available");
|
58
|
+
const items = selectedItems.length > 0
|
59
|
+
? selectedItems.map(({ TID, DID }) => ({ TID, DID }))
|
60
|
+
: [{ TID, DID }];
|
61
|
+
for (const { TID, DID } of items) {
|
62
|
+
await workflowEngine.WorkItem_CompleteOrRejectAsync(TID, DID, commentValue, 0);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
catch (e) {
|
66
|
+
TMExceptionBoxManager.show({ exception: e });
|
67
|
+
}
|
68
|
+
finally {
|
69
|
+
onUpdate?.();
|
70
|
+
onClose?.();
|
71
|
+
TMSpinner.hide();
|
72
|
+
}
|
73
|
+
};
|
74
|
+
const rejectWorkFlowAsync = async () => {
|
75
|
+
try {
|
76
|
+
TMSpinner.show();
|
77
|
+
const workflowEngine = SDK_Globals.tmSession?.NewWorkflowEngine();
|
78
|
+
if (!workflowEngine)
|
79
|
+
throw new Error("Workflow engine is not available");
|
80
|
+
const items = selectedItems.length > 0
|
81
|
+
? selectedItems.map(({ TID, DID }) => ({ TID, DID }))
|
82
|
+
: [{ TID, DID }];
|
83
|
+
for (const { TID, DID } of items) {
|
84
|
+
await workflowEngine.WorkItem_CompleteOrRejectAsync(TID, DID, commentValue, 1);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
catch (e) {
|
88
|
+
TMExceptionBoxManager.show({ exception: e });
|
89
|
+
}
|
90
|
+
finally {
|
91
|
+
onUpdate?.();
|
92
|
+
onClose?.();
|
93
|
+
TMSpinner.hide();
|
94
|
+
}
|
95
|
+
};
|
96
|
+
const workflowAction = op === 0 ? 'Approva' : 'Rifiuta';
|
97
|
+
const itemCount = selectedItems.length > 0 ? `(${count()})` : '';
|
98
|
+
const title = `${workflowAction} workflow ${itemCount}`;
|
99
|
+
return (_jsx(TMModal, { toolbar: op === 0 ?
|
100
|
+
_jsx(TMButton, { btnStyle: 'advanced', showTooltip: false, icon: _jsx(IconApply, {}), caption: 'Approva', disabled: false, onClick: completeWorkFlowAsync, advancedColor: TMColors.success }) :
|
101
|
+
_jsx(TMButton, { btnStyle: 'advanced', showTooltip: false, icon: _jsx(IconCloseOutline, {}), caption: 'Rifiuta', disabled: disable, onClick: () => { !disable && rejectWorkFlowAsync(); }, advancedColor: TMColors.error }), onClose: onClose, width: deviceType === DeviceType.MOBILE ? '95%' : '60%', height: '60%', isModal: true, title: title, children: _jsxs("div", { style: { width: '100%', height: '100%', padding: '10px', display: 'flex', flexDirection: 'column', gap: 5 }, children: [_jsxs("p", { style: { color: (op === 1 && disable) ? TMColors.error : 'black' }, children: ["Commento ", op === 1 && disable && _jsx("span", { children: ' (Campo obbligatorio)' }), " "] }), _jsx(StyledTextArea, { "$isValid": op === 0 ? true : !disable, value: commentValue, onChange: (e) => setCommentValue(e.target.value) })] }) }));
|
102
|
+
};
|
103
|
+
export const WorkFlowReAssignPopUp = ({ DID = 0, TID = 0, deviceType = DeviceType.DESKTOP, onClose, selectedItems = [], onUpdate }) => {
|
104
|
+
const [commentValue, setCommentValue] = useState('');
|
105
|
+
const [selectedUserID, setSelectedUserID] = useState();
|
106
|
+
const disable = commentValue.length === 0 || !selectedUserID;
|
107
|
+
const count = () => { return selectedItems.length.toString() + ' Workitem'; };
|
108
|
+
const reAssignWorkFlowAsync = async () => {
|
109
|
+
try {
|
110
|
+
TMSpinner.show();
|
111
|
+
const workflowEngine = SDK_Globals.tmSession?.NewWorkflowEngine();
|
112
|
+
if (!workflowEngine)
|
113
|
+
throw new Error("Workflow engine is not available");
|
114
|
+
const items = selectedItems.length > 0
|
115
|
+
? selectedItems.map(({ TID, DID }) => ({ TID, DID }))
|
116
|
+
: [{ TID, DID }];
|
117
|
+
for (const { TID, DID } of items) {
|
118
|
+
await SDK_Globals.tmSession?.NewWorkflowEngine().WorkItem_ReassignAsync(TID, DID, selectedUserID, commentValue);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
catch (e) {
|
122
|
+
TMExceptionBoxManager.show({ exception: e });
|
123
|
+
}
|
124
|
+
finally {
|
125
|
+
onUpdate?.();
|
126
|
+
onClose?.();
|
127
|
+
TMSpinner.hide();
|
128
|
+
}
|
129
|
+
};
|
130
|
+
return (_jsx(TMModal, { toolbar: _jsx(TMButton, { btnStyle: 'advanced', showTooltip: false, icon: _jsx(IconUser, { fontSize: 16 }), caption: 'Riassegna', disabled: disable, onClick: () => !disable && reAssignWorkFlowAsync(), advancedColor: TMColors.tertiary }), onClose: onClose, width: deviceType === DeviceType.MOBILE ? '95%' : '60%', height: '60%', isModal: true, title: 'Riassegna workflow ' + (selectedItems.length > 0 ? '(' + count() + ')' : ''), children: _jsxs("div", { style: { width: '100%', height: '100%', padding: '10px', display: 'flex', flexDirection: 'column', gap: 5 }, children: [_jsx(TMUserChooser, { value: selectedUserID, onValueChanged: (e) => setSelectedUserID(e) }), _jsxs("p", { style: { color: commentValue.length === 0 ? TMColors.error : 'black' }, children: ["Commento ", commentValue.length === 0 && _jsx("span", { children: ' (Campo obbligatorio)' }), " "] }), _jsx(StyledTextArea, { "$isValid": commentValue.length !== 0, value: commentValue, onChange: (e) => setCommentValue(e.target.value) })] }) }));
|
131
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { SearchResultDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
3
|
+
import { SearchResultContext } from '../../ts';
|
4
|
+
interface ITMSearchResultProps {
|
5
|
+
context?: SearchResultContext;
|
6
|
+
title?: string;
|
7
|
+
searchResults: SearchResultDescriptor[] | undefined;
|
8
|
+
allowFloatingBar?: boolean;
|
9
|
+
isClosable?: boolean;
|
10
|
+
isVisible?: boolean;
|
11
|
+
showDcmtForm?: boolean;
|
12
|
+
showPreview?: boolean;
|
13
|
+
showBoard?: boolean;
|
14
|
+
showSysMetadata?: boolean;
|
15
|
+
showSearchResultSidebar?: boolean;
|
16
|
+
showSelector?: boolean;
|
17
|
+
showToolbarHeader?: boolean;
|
18
|
+
onClose?: () => void;
|
19
|
+
onUpdate?: () => Promise<void>;
|
20
|
+
onSelectedTIDChanged?: (TID: number) => void;
|
21
|
+
onRefreshSearchAsync?: () => Promise<void>;
|
22
|
+
onRefreshAfterAddDcmtToFavs?: () => void;
|
23
|
+
onClosePreview?: () => void;
|
24
|
+
onTaskCreateRequest?: (activityContext: {
|
25
|
+
tid: number;
|
26
|
+
did: number;
|
27
|
+
name: string;
|
28
|
+
} | undefined) => void;
|
29
|
+
}
|
30
|
+
declare const TMSearchResult: React.FC<ITMSearchResultProps>;
|
31
|
+
export default TMSearchResult;
|