@topconsultnpm/sdkui-react 6.20.0-dev3.3 → 6.20.0-dev3.5
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/features/archive/TMArchive.d.ts +1 -0
- package/lib/components/features/archive/TMArchive.js +2 -2
- package/lib/components/features/documents/TMFileUploader.js +4 -6
- package/lib/components/features/search/TMSearchResultsMenuItems.js +3 -8
- package/lib/helper/TMUtils.d.ts +3 -1
- package/lib/helper/TMUtils.js +10 -1
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ interface ITMArchiveProps {
|
|
|
25
25
|
handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
|
|
26
26
|
handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
|
|
27
27
|
openPdfEditor?: (fromDTD?: DcmtTypeDescriptor, file?: File | null, handleFile?: (file: File) => void) => void;
|
|
28
|
+
onScanRequest?: (onFileScanned: (file: File) => void) => void;
|
|
28
29
|
}
|
|
29
30
|
declare const TMArchive: React.FunctionComponent<ITMArchiveProps>;
|
|
30
31
|
export default TMArchive;
|
|
@@ -12,7 +12,7 @@ import TMTreeSelector from '../search/TMTreeSelector';
|
|
|
12
12
|
import TMPanel from '../../base/TMPanel';
|
|
13
13
|
import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
|
|
14
14
|
import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
|
|
15
|
-
const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, connectorFileSave = undefined, onSavedAsyncCallback, inputMids = [], enableDragDropOverlay = false, passToSearch, isSharedArchive = false, inputDID = undefined, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, openPdfEditor }) => {
|
|
15
|
+
const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, connectorFileSave = undefined, onSavedAsyncCallback, inputMids = [], enableDragDropOverlay = false, passToSearch, isSharedArchive = false, inputDID = undefined, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, openPdfEditor, onScanRequest }) => {
|
|
16
16
|
const [currentTID, setCurrentTID] = useState(inputTID ?? 0);
|
|
17
17
|
const [mruTIDs, setMruTIDs] = useState([]);
|
|
18
18
|
const [currentMruTID, setCurrentMruTID] = useState(0);
|
|
@@ -77,7 +77,7 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
|
|
|
77
77
|
if (onDcmtTypeSelect)
|
|
78
78
|
onDcmtTypeSelect(tidToUse);
|
|
79
79
|
passToSearch(tidToUse, outputMids);
|
|
80
|
-
} : undefined, isSharedDcmt: isSharedArchive, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, currentTID, currentTID === inputTID ? inputDID : undefined), openPdfEditor: openPdfEditor }, currentTID)
|
|
80
|
+
} : undefined, isSharedDcmt: isSharedArchive, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, currentTID, currentTID === inputTID ? inputDID : undefined), openPdfEditor: openPdfEditor, onScanRequest: onScanRequest }, currentTID)
|
|
81
81
|
:
|
|
82
82
|
_jsx(TMPanel, { title: 'Archiviazione', allowMaximize: false, children: _jsxs(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: [_jsx(StyledToppyTextContainer, { children: _jsx(StyledToppyText, { children: SDKUI_Localizator.DcmtTypeSelect }) }), _jsx(StyledToppyImage, { src: Logo, alt: 'Toppy' })] }) }), [currentTID, deviceType, mruTIDs, inputFile, currentInputMids, enableDragDropOverlay, isSharedArchive, allTasks]);
|
|
83
83
|
const allInitialPanelVisibility = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import { IconFolderOpen, IconScanner, SDKUI_Localizator, formatBytes, IconClear, extensionHandler, IconCloseOutline, IconMenuVertical, TMCommandsContextMenu, IconEdit } from '../../../helper';
|
|
4
|
+
import { IconFolderOpen, IconScanner, SDKUI_Localizator, formatBytes, IconClear, extensionHandler, IconCloseOutline, IconMenuVertical, TMCommandsContextMenu, IconEdit, isPdfEditorAvailable } from '../../../helper';
|
|
5
5
|
import usePreventFileDrop from '../../../hooks/usePreventFileDrop';
|
|
6
6
|
import { FileExtensionHandler } from '../../../ts';
|
|
7
7
|
import { TMColors } from '../../../utils/theme';
|
|
@@ -12,7 +12,6 @@ import TMTooltip from '../../base/TMTooltip';
|
|
|
12
12
|
import { TMFileViewer, StyledHeaderIcon } from './TMDcmtPreview';
|
|
13
13
|
import TMPanel from '../../base/TMPanel';
|
|
14
14
|
import TMDragDropOverlay from './TMDragDropOverlay';
|
|
15
|
-
import { LicenseModuleStatus, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
16
15
|
const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onFileUpload, openPdfEditor, onScanRequest, isRequired = false, defaultBlob = null, isResizingActive, showTMPanel = true, enableDragDropOverlay = false }) => {
|
|
17
16
|
const [dragOver, setDragOver] = useState(false);
|
|
18
17
|
const [uploadedFile, setUploadedFile] = useState(defaultBlob);
|
|
@@ -90,15 +89,14 @@ const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onF
|
|
|
90
89
|
_jsx("div", { style: { backgroundColor: '#f6dbdb', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.error }, children: _jsxs("div", { children: [" ", 'Anteprima non disponibile.', fileExt && _jsx("b", { children: ` (*.${fileExt})` })] }) })] });
|
|
91
90
|
const innerContent = (_jsxs("div", { style: { width: '100%', height: '100%', padding: '2px', display: 'flex', flexDirection: 'column', gap: 10 }, children: [enableDragDropOverlay && _jsx(TMDragDropOverlay, { handleFile: handleFile, refocusAfterFileInput: refocusAfterFileInput }), content] }));
|
|
92
91
|
const toolbar = useMemo(() => {
|
|
93
|
-
|
|
94
|
-
return (_jsxs(_Fragment, { children: [(isPdfEditorLicensed && fileExt && fileExt.toLowerCase() === 'pdf') && (_jsx(TMCommandsContextMenu, { target: "#TMPanel-FileUploader-Commands-Header", menuItems: [
|
|
92
|
+
return (_jsxs(_Fragment, { children: [(isPdfEditorAvailable(fromDTD, fileExt) && openPdfEditor) && (_jsx(TMCommandsContextMenu, { target: "#TMPanel-FileUploader-Commands-Header", menuItems: [
|
|
95
93
|
{
|
|
96
94
|
icon: _jsx(IconEdit, {}),
|
|
97
95
|
text: 'PDF Editor',
|
|
98
|
-
onClick: () => openPdfEditor
|
|
96
|
+
onClick: () => openPdfEditor(fromDTD, uploadedFile, handleFile)
|
|
99
97
|
}
|
|
100
98
|
], showEvent: "click", children: _jsx(IconMenuVertical, { id: "TMPanel-FileUploader-Commands-Header", color: "white", cursor: "pointer" }) })), deviceType !== DeviceType.MOBILE && (_jsx(StyledHeaderIcon, { onClick: onClose, "$color": "white", children: _jsx(TMTooltip, { content: SDKUI_Localizator.Close, children: _jsx(IconCloseOutline, {}) }) }))] }));
|
|
101
|
-
}, [deviceType, onClose]);
|
|
99
|
+
}, [deviceType, fromDTD, onClose]);
|
|
102
100
|
return showTMPanel ? (_jsx(TMPanel, { ref: fileUploaderPanelRef, panelID: 'file-uploader-panel', title: SDKUI_Localizator.FileUpload, onBack: deviceType === DeviceType.MOBILE ? () => onClose?.() : undefined, toolbar: toolbar, children: innerContent })) : (innerContent);
|
|
103
101
|
};
|
|
104
102
|
const UploadContainer = styled.div `
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { AccessLevels, AccessLevelsEx, AppModules, FileFormats, LayoutModes, SDK_Globals, DcmtTypeListCacheService
|
|
3
|
-
import { IconActivity, IconArchiveDoc, IconBatchUpdate, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconDelete, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconInfo, IconMenuCAArchive, IconPlatform, IconPreview, IconRelation, IconSearch, IconShow, IconStar, IconSubstFile, IconUndo, IconUserGroupOutline, SDKUI_Localizator, searchResultToMetadataValues, IconSignaturePencil, IconArchiveMaster, IconArchiveDetail, IconDetailDcmts,
|
|
2
|
+
import { AccessLevels, AccessLevelsEx, AppModules, FileFormats, LayoutModes, SDK_Globals, DcmtTypeListCacheService } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { IconActivity, IconArchiveDoc, IconBatchUpdate, IconCheckFile, IconCheckIn, IconCircleInfo, IconCloseCircle, IconConvertFilePdf, IconDelete, IconDotsVerticalCircleOutline, IconDownload, IconEdit, IconExportTo, IconFileDots, IconHide, IconInfo, IconMenuCAArchive, IconPlatform, IconPreview, IconRelation, IconSearch, IconShow, IconStar, IconSubstFile, IconUndo, IconUserGroupOutline, SDKUI_Localizator, searchResultToMetadataValues, IconSignaturePencil, IconArchiveMaster, IconArchiveDetail, IconDetailDcmts, IconPair, IconUnpair, IconSharedDcmt, IconShare, IconCopy, IconMoveToFolder, IconPin, isPdfEditorAvailable } from '../../../helper';
|
|
4
4
|
import ShowAlert from '../../base/TMAlert';
|
|
5
5
|
import { TMMessageBoxManager, ButtonNames, TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
6
6
|
import TMSpinner from '../../base/TMSpinner';
|
|
@@ -81,7 +81,6 @@ export const signatureInformationCallback = async (isMobile, inputDcmts) => {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
export const getCommandsMenuItems = (isMobile, dtd, allUsers, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, onRefreshDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, confirmAttachments, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openSignSettingsForm, handleCheckOutOperationCallback, handleCheckInOperationCallback, showCheckoutInformationFormCallback, viewHistoryCallback, copyCheckoutPathToClipboardOperationCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, hasMasterRelation, hasDetailRelation, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToManyDocuments, hasManyToManyRelation, pinnedItemIds, onTogglePin) => {
|
|
84
|
-
const isPdfEditorLicensed = SDK_Globals?.license?.dcmtArchiveLicenses?.[0]?.siX_60007?.status === LicenseModuleStatus.Licensed;
|
|
85
84
|
const addPinIconToItems = (items) => {
|
|
86
85
|
if (isMobile || !onTogglePin)
|
|
87
86
|
return items;
|
|
@@ -102,10 +101,6 @@ export const getCommandsMenuItems = (isMobile, dtd, allUsers, selectedItems, foc
|
|
|
102
101
|
return newItem;
|
|
103
102
|
});
|
|
104
103
|
};
|
|
105
|
-
let pdfEditorAvailable = false;
|
|
106
|
-
if (dtd && dtd.widgets && dtd.widgets.length > 0) {
|
|
107
|
-
pdfEditorAvailable = isPdfEditorEnabled(dtd.widgets);
|
|
108
|
-
}
|
|
109
104
|
const addToFavoriteMenuItem = () => {
|
|
110
105
|
return {
|
|
111
106
|
id: 'fav',
|
|
@@ -735,7 +730,7 @@ export const getCommandsMenuItems = (isMobile, dtd, allUsers, selectedItems, foc
|
|
|
735
730
|
duplicateDocumentMenuItem(),
|
|
736
731
|
batchUpdateMenuItem(),
|
|
737
732
|
passToArchive(),
|
|
738
|
-
...((
|
|
733
|
+
...((isPdfEditorAvailable(dtd, getSelectedDcmtsOrFocused(selectedItems, focusedItem)?.[0]?.FILEEXT) && openEditPdf) ? [pdfEditorMenuItem(openEditPdf)] : []),
|
|
739
734
|
]
|
|
740
735
|
},
|
|
741
736
|
signatureMenuItem(),
|
package/lib/helper/TMUtils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FileItem } from '../components';
|
|
3
|
-
import { AppModules, DataColumnDescriptor, PdGs, SearchResultDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { AppModules, DataColumnDescriptor, DcmtTypeDescriptor, PdGs, SearchResultDescriptor } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
export declare const getFileIcon: (fileExtension: string | undefined, fileCount: number | undefined, tooltipContent?: JSX.Element | string) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare function formatBytes(bytes: number | undefined, decimalPlaces?: number): string;
|
|
6
6
|
export interface RowData {
|
|
@@ -17,6 +17,8 @@ export declare const isWidgetEnabled: (widgetId: string, widgetsString: string)
|
|
|
17
17
|
export declare const isSign4TopEnabled: (widgetsString: string) => boolean;
|
|
18
18
|
export declare const isCreateCertificateEnabled: (widgetsString: string) => boolean;
|
|
19
19
|
export declare const isPdfEditorEnabled: (widgetsString: string) => boolean;
|
|
20
|
+
/** Verifica se l'editor PDF è disponibile: richiede file PDF, licenza attiva e widget abilitato sul tipo documento. */
|
|
21
|
+
export declare const isPdfEditorAvailable: (fromDTD: DcmtTypeDescriptor | undefined, ext: string | undefined) => boolean;
|
|
20
22
|
interface TabItemProps {
|
|
21
23
|
$isSelected: boolean;
|
|
22
24
|
}
|
package/lib/helper/TMUtils.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { TMTooltip } from '../components';
|
|
4
4
|
import { IconCADossier, IconKey, IconMenuCAWorkingGroups } from './TMIcons';
|
|
5
|
-
import { AppModules, DataListCacheService, MetadataDataDomains, PdGs } from '@topconsultnpm/sdk-ts';
|
|
5
|
+
import { AppModules, DataListCacheService, LicenseModuleStatus, MetadataDataDomains, PdGs, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
6
6
|
import { SDKUI_Localizator } from './SDKUI_Localizator';
|
|
7
7
|
const StyledIconFileContainer = styled.div `
|
|
8
8
|
height: 22px;
|
|
@@ -178,6 +178,15 @@ export const isCreateCertificateEnabled = (widgetsString) => {
|
|
|
178
178
|
export const isPdfEditorEnabled = (widgetsString) => {
|
|
179
179
|
return isWidgetEnabled(PDF_EDITOR_ID, widgetsString);
|
|
180
180
|
};
|
|
181
|
+
/** Verifica se l'editor PDF è disponibile: richiede file PDF, licenza attiva e widget abilitato sul tipo documento. */
|
|
182
|
+
export const isPdfEditorAvailable = (fromDTD, ext) => {
|
|
183
|
+
if (fromDTD === undefined || !fromDTD.widgets || !ext)
|
|
184
|
+
return false;
|
|
185
|
+
if (ext.toLowerCase() !== "pdf")
|
|
186
|
+
return false;
|
|
187
|
+
const isPdfEditorLicensed = SDK_Globals?.license?.dcmtArchiveLicenses?.[0]?.siX_60007?.status === LicenseModuleStatus.Licensed;
|
|
188
|
+
return isPdfEditorLicensed && isPdfEditorEnabled(fromDTD.widgets);
|
|
189
|
+
};
|
|
181
190
|
export const StyledTabItem = styled.div `
|
|
182
191
|
display: flex;
|
|
183
192
|
align-items: center;
|