@topconsultnpm/sdkui-react-beta 6.13.82 → 6.13.85
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/editors/TMHtmlEditor.js +2 -2
- package/lib/components/features/documents/TMDcmtForm.js +2 -2
- package/lib/components/features/documents/TMDcmtIcon.d.ts +5 -1
- package/lib/components/features/documents/TMDcmtIcon.js +14 -2
- package/lib/components/features/search/TMSearchResult.js +2 -2
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +2 -2
- package/lib/components/features/search/TMSearchResultsMenuItems.js +2 -2
- package/lib/components/grids/TMBlogs.js +1 -1
- package/lib/components/grids/TMBlogsUtils.d.ts +2 -2
- package/lib/components/grids/TMBlogsUtils.js +1 -1
- package/lib/helper/SDKUI_Localizator.d.ts +1 -0
- package/lib/helper/SDKUI_Localizator.js +10 -0
- package/lib/hooks/useDcmtOperations.d.ts +2 -2
- package/lib/hooks/useDcmtOperations.js +16 -10
- package/lib/ts/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -129,7 +129,7 @@ const TMHtmlEditor = (props) => {
|
|
|
129
129
|
return (_jsxs("div", { style: { height: hasValidationErrors ? `calc(${height} - 30px)` : "100%", width: width }, onContextMenu: handleContextMenu, children: [_jsx("div", { className: "custom-mentions-wrapper", style: { borderWidth: '1px', borderStyle: 'solid', borderColor: hasValidationErrors ? "red" : "#e0e0e0 #e0e0e0 #616161", width: "100%", height: "100%" }, children: _jsx(HtmlEditor, { ref: editorRef, placeholder: SDKUI_Localizator.TypeAMessage + "...", width: "100%", height: "100%", value: markup, onValueChange: onValueChangeCallback, mentions: mentionsConfig, style: { overflow: 'hidden', outline: "none", fontSize: '1rem' }, children: isEditorEnabled && (toolbarMode === 'compact' ?
|
|
130
130
|
_jsxs(Toolbar, { multiline: false, children: [_jsx(Item, { name: "undo" }), _jsx(Item, { name: "redo" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "bold" }), _jsx(Item, { name: "italic" }), _jsx(Item, { name: "strike" }), _jsx(Item, { name: "underline" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "orderedList" }), _jsx(Item, { name: "bulletList" })] }) :
|
|
131
131
|
_jsxs(Toolbar, { children: [_jsx(Item, { name: "undo" }), _jsx(Item, { name: "redo" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "bold" }), _jsx(Item, { name: "italic" }), _jsx(Item, { name: "strike" }), _jsx(Item, { name: "underline" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "alignLeft" }), _jsx(Item, { name: "alignCenter" }), _jsx(Item, { name: "alignRight" }), _jsx(Item, { name: "alignJustify" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "color" }), _jsx(Item, { name: "background" }), _jsx(Item, { name: "separator" }), _jsx(Item, { name: "link" }), _jsx(Item, { name: "image" }), _jsx(Item, { name: "separator" })] })) }) }), !isPasting && validationItems.length > 0 && (_jsx("div", { style: { width: "100%", height: "30px" }, children: _jsx(TMVilViewer, { vil: validationItems }) })), contextMenuPos &&
|
|
132
|
-
ReactDOM.createPortal(
|
|
132
|
+
ReactDOM.createPortal(_jsxs("div", { style: {
|
|
133
133
|
position: 'fixed',
|
|
134
134
|
top: contextMenuPos.y,
|
|
135
135
|
left: contextMenuPos.x,
|
|
@@ -139,6 +139,6 @@ const TMHtmlEditor = (props) => {
|
|
|
139
139
|
zIndex: 9999,
|
|
140
140
|
padding: '5px 10px',
|
|
141
141
|
cursor: 'pointer'
|
|
142
|
-
}, onClick: handlePaste, children: "
|
|
142
|
+
}, onClick: handlePaste, children: [_jsx("i", { className: 'dx-icon-paste' }), " ", SDKUI_Localizator.PasteFromClipboard] }), document.body)] }));
|
|
143
143
|
};
|
|
144
144
|
export default TMHtmlEditor;
|
|
@@ -156,8 +156,8 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
|
|
|
156
156
|
const isMasterDisabled = layoutMode !== LayoutModes.Update || !DID;
|
|
157
157
|
const getDcmts = () => { return [{ TID: currentDcmt?.tid, DID: currentDcmt?.did, FILEEXT: currentDcmt?.fileExt }]; };
|
|
158
158
|
const commandsMenuItems = [
|
|
159
|
-
{ icon: svgToString(_jsx(IconDownload, {})), operationType: 'singleRow', disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes, text: "Download file", onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Dcmt) },
|
|
160
|
-
{ icon: svgToString(_jsx(IconDownload, {})), operationType: 'singleRow', disabled: !isXMLFileExt(currentDcmt?.fileExt), text: "Download allegati XML", onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Attachment, openConfirmAttachmentsDialog) },
|
|
159
|
+
{ icon: svgToString(_jsx(IconDownload, {})), operationType: 'singleRow', disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes, text: "Download file", onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Dcmt, "download") },
|
|
160
|
+
{ icon: svgToString(_jsx(IconDownload, {})), operationType: 'singleRow', disabled: !isXMLFileExt(currentDcmt?.fileExt), text: "Download allegati XML", onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Attachment, "download", openConfirmAttachmentsDialog) },
|
|
161
161
|
...(allowRelations && currentTIDHasMasterRelations ? [{ icon: svgToString(_jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' })), operationType: 'singleRow', disabled: isMasterDisabled, text: SDKUI_Localizator.DcmtsMaster, onClick: () => { if (!isMasterDisabled)
|
|
162
162
|
setIsOpenMaster(!isOpenMaster); } }] : []),
|
|
163
163
|
...(allowRelations && currentTIDHasDetailRelations ? [{ icon: svgToString(_jsx(IconDetailDcmts, {})), operationType: 'singleRow', disabled: isDetailsDisabled, text: SDKUI_Localizator.DcmtsDetail, onClick: () => { if (!isDetailsDisabled)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
type DownloadModes = "none" | "download" | "openInNewWindow";
|
|
1
2
|
interface ITMDcmtIconProps {
|
|
2
3
|
fileExtension: string | undefined;
|
|
3
4
|
fileCount: number | undefined;
|
|
@@ -5,6 +6,9 @@ interface ITMDcmtIconProps {
|
|
|
5
6
|
isSigned: number | undefined;
|
|
6
7
|
isMail: number | undefined;
|
|
7
8
|
isShared: number | undefined;
|
|
9
|
+
tid?: number;
|
|
10
|
+
did?: number;
|
|
11
|
+
downloadMode?: DownloadModes;
|
|
8
12
|
}
|
|
9
|
-
declare const TMDcmtIcon: ({ fileExtension, fileCount, isLexProt, isSigned, isMail, isShared }: ITMDcmtIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const TMDcmtIcon: ({ fileExtension, fileCount, isLexProt, isSigned, isMail, isShared, tid, did, downloadMode }: ITMDcmtIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
14
|
export default TMDcmtIcon;
|
|
@@ -2,6 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { getFileIcon } from '../../../helper';
|
|
4
4
|
import TMTooltip from '../../base/TMTooltip';
|
|
5
|
+
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
6
|
+
import { DownloadTypes } from '../../../ts';
|
|
5
7
|
const StyledCellRenderDcmtIcon = styled.div `
|
|
6
8
|
display: flex;
|
|
7
9
|
flex-direction: row;
|
|
@@ -10,8 +12,18 @@ const StyledCellRenderDcmtIcon = styled.div `
|
|
|
10
12
|
overflow: visible;
|
|
11
13
|
position: relative;
|
|
12
14
|
`;
|
|
13
|
-
const TMDcmtIcon = ({ fileExtension, fileCount, isLexProt, isSigned, isMail, isShared }) => {
|
|
14
|
-
|
|
15
|
+
const TMDcmtIcon = ({ fileExtension, fileCount, isLexProt, isSigned, isMail, isShared, tid, did, downloadMode = "none" }) => {
|
|
16
|
+
const { downloadDcmtsAsync } = useDcmtOperations();
|
|
17
|
+
const handleClick = async (e) => {
|
|
18
|
+
if (downloadMode !== "none" &&
|
|
19
|
+
tid !== undefined &&
|
|
20
|
+
did !== undefined) {
|
|
21
|
+
e.stopPropagation();
|
|
22
|
+
let dcmt = [{ TID: tid, DID: did, FILEEXT: fileExtension }];
|
|
23
|
+
await downloadDcmtsAsync(dcmt, DownloadTypes.Dcmt, downloadMode);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return (_jsxs(StyledCellRenderDcmtIcon, { style: { cursor: downloadMode !== "none" && tid !== undefined && did !== undefined ? "pointer" : undefined }, onClick: handleClick, children: [getFileIcon(isMail == 2 ? "PEC" : fileExtension, fileCount), isLexProt == 1 && _jsx("div", { style: { position: 'absolute', left: '-7px', top: isShared ? undefined : '2px' }, children: _jsx(TMTooltip, { content: "Protezione LEX", children: _jsx(IconLexProtLock, { color: 'blue', fontSize: 13 }) }) }), isShared == 1 && _jsx("div", { style: { position: 'absolute', top: '-7px', left: '-5px' }, children: _jsx(TMTooltip, { content: "Documento condiviso", children: _jsx(IconShared, { fontSize: 16 }) }) }), isSigned == 1 && _jsx("div", { style: { position: 'absolute', bottom: '-4px', right: '-7px' }, children: _jsx(TMTooltip, { content: "Documento firmato", children: _jsx(IconSignature, { fontSize: 28 }) }) })] }));
|
|
15
27
|
};
|
|
16
28
|
export default TMDcmtIcon;
|
|
17
29
|
function IconLexProtLock(props) {
|
|
@@ -344,7 +344,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
344
344
|
, {
|
|
345
345
|
// allowMultipleSelection={allowMultipleSelection}
|
|
346
346
|
inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], lastUpdateSearchTime: lastUpdateSearchTime, onDblClick: () => openFormHandler(LayoutModes.Update), onContextMenuPreparing: onContextMenuPreparing, onSelectionChanged: (items) => { setSelectedItems(items); }, onVisibleItemChanged: setVisibleItems, onFocusedItemChanged: setFocusedItem }), allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE &&
|
|
347
|
-
_jsxs(TMFloatingToolbar, { backgroundColor: TMColors.primaryColor, initialLeft: '10px', initialTop: 'calc(100% - 75px)', children: [fromDTD?.perm?.canRetrieveFile === AccessLevels.Yes && _jsx(TMButton, { btnStyle: 'icon', caption: "Download file", disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes || !focusedItem?.DID, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt); } }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasDetailRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white' }), caption: SDKUI_Localizator.DcmtsDetail, onClick: () => setIsOpenDetails(true) }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasMasterRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white', transform: 'scale(-1, 1)' }), caption: SDKUI_Localizator.DcmtsMaster, onClick: () => setIsOpenMaster(true) }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-floating-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler) })] })] })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), op: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), op: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: SDKUI_Localizator.BatchUpdate, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
|
|
347
|
+
_jsxs(TMFloatingToolbar, { backgroundColor: TMColors.primaryColor, initialLeft: '10px', initialTop: 'calc(100% - 75px)', children: [fromDTD?.perm?.canRetrieveFile === AccessLevels.Yes && _jsx(TMButton, { btnStyle: 'icon', caption: "Download file", disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes || !focusedItem?.DID, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download"); } }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasDetailRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white' }), caption: SDKUI_Localizator.DcmtsDetail, onClick: () => setIsOpenDetails(true) }), allowRelations && _jsx(TMButton, { btnStyle: 'icon', disabled: !currentTIDHasMasterRelations || !focusedItem?.DID, icon: _jsx(IconDetailDcmts, { color: 'white', transform: 'scale(-1, 1)' }), caption: SDKUI_Localizator.DcmtsMaster, onClick: () => setIsOpenMaster(true) }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-floating-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler) })] })] })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), op: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), op: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: SDKUI_Localizator.BatchUpdate, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
|
|
348
348
|
setIsOpenBatchUpdate(false);
|
|
349
349
|
}, onSavedCallbackAsync: async () => {
|
|
350
350
|
setIsOpenBatchUpdate(false);
|
|
@@ -437,7 +437,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
|
437
437
|
})] }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDcmtForm, children: isOpenDcmtForm && _jsx(TMDcmtForm, { isModal: openDcmtFormAsModal, titleModal: fromDTD?.name ?? '', TID: focusedItem?.TID, DID: focusedItem?.DID, layoutMode: dcmtFormLayoutMode, showPreview: deviceType !== DeviceType.MOBILE, count: visibleItems.length, itemIndex: visibleItems.findIndex(o => o.rowIndex === focusedItem?.rowIndex) + 1, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onClose: () => { setIsOpenDcmtForm(false); }, onSavedAsyncCallback: async (tid, did) => { await refreshFocusedDataRowAsync(tid, did, true); } }) })] }));
|
|
438
438
|
};
|
|
439
439
|
export default TMSearchResult;
|
|
440
|
-
const renderDcmtIcon = (cellData) => _jsx(TMDcmtIcon, { fileExtension: cellData.data.FILEEXT, fileCount: cellData.data.FILECOUNT, isLexProt: cellData.data.IsLexProt, isMail: cellData.data.ISMAIL, isShared: cellData.data.ISSHARED, isSigned: cellData.data.ISSIGNED });
|
|
440
|
+
const renderDcmtIcon = (cellData) => _jsx(TMDcmtIcon, { tid: cellData.data.TID, did: cellData.data.DID, fileExtension: cellData.data.FILEEXT, fileCount: cellData.data.FILECOUNT, isLexProt: cellData.data.IsLexProt, isMail: cellData.data.ISMAIL, isShared: cellData.data.ISSHARED, isSigned: cellData.data.ISSIGNED, downloadMode: 'openInNewWindow' });
|
|
441
441
|
const TMSearchResultGrid = ({ inputFocusedItem, allowMultipleSelection = true, onFocusedItemChanged, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onContextMenuPreparing, onSelectionChanged, onDblClick }) => {
|
|
442
442
|
const [dataSource, setDataSource] = useState();
|
|
443
443
|
const [showFilterPanel, setShowFilterPanel] = useState(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DcmtTypeDescriptor, FileDescriptor, FileFormats, LayoutModes } from '@topconsultnpm/sdk-ts-beta';
|
|
3
3
|
import { TMDataGridContextMenuItem } from '../../base/TMDataGrid';
|
|
4
|
-
import { DcmtInfo, DcmtOperationTypes, DownloadTypes, SearchResultContext } from '../../../ts';
|
|
4
|
+
import { DcmtInfo, DcmtOperationTypes, DownloadModes, DownloadTypes, SearchResultContext } from '../../../ts';
|
|
5
5
|
export declare const getSelectedDcmtsOrFocused: (selectedItems: Array<any>, focusedItem: any, fileFormat?: FileFormats) => DcmtInfo[];
|
|
6
|
-
export declare const getCommandsMenuItems: (dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: (value: boolean) => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void) => Array<TMDataGridContextMenuItem>;
|
|
6
|
+
export declare const getCommandsMenuItems: (dtd: DcmtTypeDescriptor | undefined, selectedItems: Array<any>, focusedItem: any, context: SearchResultContext, showFloatingBar: boolean, setShowFloatingBar: React.Dispatch<React.SetStateAction<boolean>>, openFormHandler: (layoutMode: LayoutModes) => void, downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>, runOperationAsync: (inputDcmts: DcmtInfo[] | undefined, dcmtOperationType: DcmtOperationTypes, actionAfterOperationAsync?: () => Promise<void>) => Promise<void>, onRefreshSearchAsync: (() => Promise<void>) | undefined, onRefreshDataRowsAsync: (() => Promise<void>) | undefined, onRefreshAfterAddDcmtToFavs: (() => void) | undefined, confirmFormat: () => Promise<FileFormats>, confirmAttachments: (list: FileDescriptor[]) => Promise<string[] | undefined>, openTaskFormHandler: (value: boolean) => void, openDetailDcmtsFormHandler: (value: boolean) => void, openMasterDcmtsFormHandler: (value: boolean) => void, openBatchUpdateFormHandler: (value: boolean) => void) => Array<TMDataGridContextMenuItem>;
|
|
@@ -122,13 +122,13 @@ export const getCommandsMenuItems = (dtd, selectedItems, focusedItem, context, s
|
|
|
122
122
|
icon: svgToString(_jsx(IconDownload, {})),
|
|
123
123
|
operationType: 'multiRow',
|
|
124
124
|
disabled: dtd?.perm?.canRetrieveFile !== AccessLevels.Yes ? true : disabledForMultiRow(selectedItems, focusedItem),
|
|
125
|
-
text: "Download file", onClick: () => downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt)
|
|
125
|
+
text: "Download file", onClick: () => downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt, "download")
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
icon: svgToString(_jsx(IconDownload, {})),
|
|
129
129
|
operationType: 'singleRow',
|
|
130
130
|
disabled: !isXMLFileExt(getSelectedDcmtsOrFocused(selectedItems, focusedItem)?.[0]?.FILEEXT) ? true : disabledForSingleRow(selectedItems, focusedItem),
|
|
131
|
-
text: "Download allegati XML", onClick: () => downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Attachment, confirmAttachments)
|
|
131
|
+
text: "Download allegati XML", onClick: () => downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Attachment, "download", confirmAttachments)
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
icon: svgToString(_jsx(IconArchiveDoc, {})),
|
|
@@ -171,7 +171,7 @@ const TMBlogs = (props) => {
|
|
|
171
171
|
if (focusedAttachment === undefined)
|
|
172
172
|
return;
|
|
173
173
|
if (downloadDcmtsAsync)
|
|
174
|
-
downloadDcmtsAsync([{ TID: focusedAttachment.TID, DID: focusedAttachment.DID, fileName: focusedAttachment.fileName }], DownloadTypes.Dcmt);
|
|
174
|
+
downloadDcmtsAsync([{ TID: focusedAttachment.TID, DID: focusedAttachment.DID, fileName: focusedAttachment.fileName }], DownloadTypes.Dcmt, "download");
|
|
175
175
|
};
|
|
176
176
|
const copyInClipboard = (blog) => {
|
|
177
177
|
if (blog === undefined)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BlogPost, BlogPostAttachment, DcmtTypeDescriptor, HomeBlogPost } from "@topconsultnpm/sdk-ts-beta";
|
|
3
3
|
import { FileItem } from '../base/TMFileManager';
|
|
4
|
-
import { DcmtInfo, DownloadTypes } from '../../ts';
|
|
4
|
+
import { DcmtInfo, DownloadModes, DownloadTypes } from '../../ts';
|
|
5
5
|
import { ContextMenuRef } from 'devextreme-react/cjs/context-menu';
|
|
6
6
|
export declare const DRAFT_TYPE_TID = 6;
|
|
7
7
|
export declare const colors: {
|
|
@@ -74,7 +74,7 @@ export declare const AttachmentElement: (attachment: BlogPostAttachment, treeFs:
|
|
|
74
74
|
did: number;
|
|
75
75
|
fileExt: string;
|
|
76
76
|
fileSize: string;
|
|
77
|
-
}> | undefined, dcmtTypeDescriptors: Map<number, DcmtTypeDescriptor>, isSelected: boolean, searchText: string, color: string, downloadDcmtsAsync: (inputDcmts: Array<DcmtInfo> | undefined, downloadType: DownloadTypes) => Promise<void>, handleFocusedAttachment: (attachment: DcmtInfo | undefined) => void, setAnchorEl: (value: React.SetStateAction<HTMLElement | null>) => void, contextMenuRef: React.MutableRefObject<ContextMenuRef<any> | null>) => import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
}> | undefined, dcmtTypeDescriptors: Map<number, DcmtTypeDescriptor>, isSelected: boolean, searchText: string, color: string, downloadDcmtsAsync: (inputDcmts: Array<DcmtInfo> | undefined, downloadType: DownloadTypes, downloadMode: DownloadModes) => Promise<void>, handleFocusedAttachment: (attachment: DcmtInfo | undefined) => void, setAnchorEl: (value: React.SetStateAction<HTMLElement | null>) => void, contextMenuRef: React.MutableRefObject<ContextMenuRef<any> | null>) => import("react/jsx-runtime").JSX.Element;
|
|
78
78
|
export declare const OwnerInitialsBadge: (blogPost: BlogPost | HomeBlogPost) => import("react/jsx-runtime").JSX.Element;
|
|
79
79
|
export declare const IconAndHeaderElement: (blogPost: BlogPost | HomeBlogPost, iconColor: string, isSelected: boolean, headerClickCallback: () => void, searchText: string) => import("react/jsx-runtime").JSX.Element;
|
|
80
80
|
export declare const findFileItemByDraftID: (tree: FileItem | undefined, draftID: number | undefined) => FileItem | null;
|
|
@@ -146,7 +146,7 @@ export const AttachmentElement = (attachment, treeFs, draftLatestInfoMap, archiv
|
|
|
146
146
|
const archiveID = SDK_Globals.tmSession?.SessionDescr?.archiveID;
|
|
147
147
|
const fileName = `${removeFileExtension(name)}_${archiveID}_${attachment.tid}_${attachment.did}.${fileExt}`;
|
|
148
148
|
if (downloadDcmtsAsync)
|
|
149
|
-
downloadDcmtsAsync([{ TID: attachment.tid, DID: attachment.did, fileName }], DownloadTypes.Dcmt);
|
|
149
|
+
downloadDcmtsAsync([{ TID: attachment.tid, DID: attachment.did, fileName }], DownloadTypes.Dcmt, "download");
|
|
150
150
|
};
|
|
151
151
|
const onContextMenu = (e) => {
|
|
152
152
|
const archiveID = SDK_Globals.tmSession?.SessionDescr?.archiveID;
|
|
@@ -289,6 +289,7 @@ export declare class SDKUI_Localizator {
|
|
|
289
289
|
static get PasswordRule_Uppercase(): "Großbuchstaben (A–Z)." | "Uppercase character (A–Z)." | "Letra mayúscula (A–Z)." | "Caractère majuscule (A–Z)." | "Letra maiúscula (A–Z)." | "Lettere maiuscole (A–Z).";
|
|
290
290
|
static get PasswordRule_Number(): "Zahlen (0–9)." | "Number (0–9)." | "Números (0–9)." | "Chiffre (0–9)." | "Numeri (0–9).";
|
|
291
291
|
static get PasswordRule_Special(): "Mindestens ein Sonderzeichen." | "At least one special character." | "Al menos un carácter especial." | "Au moins un caractère spécial." | "Pelo menos um caractere especial." | "Almeno un carattere speciale.";
|
|
292
|
+
static get PasteFromClipboard(): string;
|
|
292
293
|
static get Parameters(): "Parameter" | "Parameters" | "Parámetros" | "Paramètres" | "Parâmetros" | "Parametri";
|
|
293
294
|
static get Perms(): "Berechtigungen" | "Permissions" | "Permisos" | "Autorisations" | "Permissão" | "Permessi";
|
|
294
295
|
static get PhysDelete(): "Physische Stornierung" | "Physical delete" | "Cancelación física" | "Supression" | "Cancelamento física" | "Cancellazione fisica";
|
|
@@ -2841,6 +2841,16 @@ export class SDKUI_Localizator {
|
|
|
2841
2841
|
default: return "Almeno un carattere speciale.";
|
|
2842
2842
|
}
|
|
2843
2843
|
}
|
|
2844
|
+
static get PasteFromClipboard() {
|
|
2845
|
+
switch (this._cultureID) {
|
|
2846
|
+
case CultureIDs.De_DE: return "Aus der Zwischenablage einfügen";
|
|
2847
|
+
case CultureIDs.En_US: return "Paste from clipboard";
|
|
2848
|
+
case CultureIDs.Es_ES: return "Pegar desde el portapapeles";
|
|
2849
|
+
case CultureIDs.Fr_FR: return "Coller depuis le presse-papiers";
|
|
2850
|
+
case CultureIDs.Pt_PT: return "Colar da área de transferência";
|
|
2851
|
+
default: return "Incolla dagli appunti";
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2844
2854
|
static get Parameters() {
|
|
2845
2855
|
switch (this._cultureID) {
|
|
2846
2856
|
case CultureIDs.De_DE: return "Parameter";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RetrieveFileOptions, FileDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
|
2
|
-
import { DcmtInfo, DcmtOperationTypes, DownloadTypes } from '../ts';
|
|
2
|
+
import { DcmtInfo, DcmtOperationTypes, DownloadModes, DownloadTypes } from '../ts';
|
|
3
3
|
export declare function useDcmtOperations(): {
|
|
4
4
|
abortController: AbortController;
|
|
5
5
|
showWaitPanel: boolean;
|
|
@@ -12,7 +12,7 @@ export declare function useDcmtOperations(): {
|
|
|
12
12
|
waitPanelTextSecondary: string;
|
|
13
13
|
waitPanelValueSecondary: number;
|
|
14
14
|
waitPanelMaxValueSecondary: number;
|
|
15
|
-
downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType?: DownloadTypes, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>;
|
|
15
|
+
downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType?: DownloadTypes, downloadMode?: DownloadModes, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>) => Promise<void>;
|
|
16
16
|
getDcmtFileAsync: (inputDcmt: DcmtInfo | undefined, rfo: RetrieveFileOptions, operationTitle: string, keepWaitPanelPrimary: boolean) => Promise<{
|
|
17
17
|
file: File | undefined;
|
|
18
18
|
isFromCache: boolean;
|
|
@@ -19,7 +19,7 @@ export function useDcmtOperations() {
|
|
|
19
19
|
const [waitPanelValueSecondary, setWaitPanelValueSecondary] = useState(0);
|
|
20
20
|
const [waitPanelMaxValueSecondary, setWaitPanelMaxValueSecondary] = useState(0);
|
|
21
21
|
const { OpenFileDialog } = useFileDialog();
|
|
22
|
-
const _downloadDcmtsAsync = async (inputDcmts) => {
|
|
22
|
+
const _downloadDcmtsAsync = async (inputDcmts, downloadMode = "download") => {
|
|
23
23
|
if (inputDcmts === undefined)
|
|
24
24
|
return;
|
|
25
25
|
if (inputDcmts.length <= 0)
|
|
@@ -68,13 +68,19 @@ export function useDcmtOperations() {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
setWaitPanelValuePrimary(i + 1);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
if (downloadMode === "openInNewWindow") {
|
|
72
|
+
const fileURL = window.URL.createObjectURL(file);
|
|
73
|
+
window.open(fileURL, '_blank', 'noopener');
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const fileURL = window.URL.createObjectURL(file);
|
|
77
|
+
const alink2 = document.createElement('a');
|
|
78
|
+
alink2.href = fileURL;
|
|
79
|
+
alink2.download = inputDcmts[i].fileName ?? file?.name;
|
|
80
|
+
alink2.target = "_blank";
|
|
81
|
+
alink2.rel = "noreferrer";
|
|
82
|
+
alink2.click();
|
|
83
|
+
}
|
|
78
84
|
if (dcmtsFileCacheDownload.size >= CACHE_SIZE_LIMIT) {
|
|
79
85
|
const oldestKey = dcmtsFileCacheDownload.keys().next().value;
|
|
80
86
|
dcmtsFileCacheDownload.delete(oldestKey);
|
|
@@ -159,9 +165,9 @@ export function useDcmtOperations() {
|
|
|
159
165
|
TMExceptionBoxManager.show({ exception: err });
|
|
160
166
|
}
|
|
161
167
|
};
|
|
162
|
-
const downloadDcmtsAsync = async (inputDcmts, downloadType = DownloadTypes.Attachment, confirmAttachments) => {
|
|
168
|
+
const downloadDcmtsAsync = async (inputDcmts, downloadType = DownloadTypes.Attachment, downloadMode = "download", confirmAttachments) => {
|
|
163
169
|
switch (downloadType) {
|
|
164
|
-
case DownloadTypes.Dcmt: return await _downloadDcmtsAsync(inputDcmts);
|
|
170
|
+
case DownloadTypes.Dcmt: return await _downloadDcmtsAsync(inputDcmts, downloadMode);
|
|
165
171
|
case DownloadTypes.Attachment: return await _downloadAttachmentsAsync(inputDcmts, confirmAttachments);
|
|
166
172
|
default: return await _downloadDcmtsAsync(inputDcmts);
|
|
167
173
|
}
|
package/lib/ts/types.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export declare enum SearchResultContext {
|
|
|
48
48
|
FREE_SEARCH = "freeSearch",
|
|
49
49
|
MASTER_DETAIL = "masterDetail"
|
|
50
50
|
}
|
|
51
|
+
export type DownloadModes = "none" | "download" | "openInNewWindow";
|
|
51
52
|
export type TID_MID = {
|
|
52
53
|
tid: number | undefined;
|
|
53
54
|
mid: number | undefined;
|