@topconsultnpm/sdkui-react 6.21.0-dev1.46 → 6.21.0-dev1.47
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.
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { IconFolderOpen, IconScanner, SDKUI_Localizator, formatBytes, IconClear, extensionHandler, IconCloseOutline, IconMenuVertical, TMCommandsContextMenu, IconEdit, isPdfEditorAvailable, SDKUI_Globals } from '../../../helper';
|
|
5
|
-
import { useBetaFeatures } from '../../../hooks/useBetaFeatures';
|
|
6
5
|
import usePreventFileDrop from '../../../hooks/usePreventFileDrop';
|
|
7
6
|
import { FileExtensionHandler } from '../../../ts';
|
|
8
7
|
import { TMColors } from '../../../utils/theme';
|
|
@@ -24,7 +23,6 @@ const isScannerLicenseConfigured = () => {
|
|
|
24
23
|
}
|
|
25
24
|
};
|
|
26
25
|
const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onFileUpload, openFileUploaderPdfEditor, onScanRequest, isRequired = false, defaultBlob = null, isResizingActive, showTMPanel = true, enableDragDropOverlay = false, showScannerIcon = true }) => {
|
|
27
|
-
const isBetaFeaturesEnabled = useBetaFeatures();
|
|
28
26
|
const [dragOver, setDragOver] = useState(false);
|
|
29
27
|
const [uploadedFile, setUploadedFile] = useState(defaultBlob);
|
|
30
28
|
const [fileName, setFileName] = useState('');
|
|
@@ -99,7 +97,7 @@ const TMFileUploader = ({ fromDTD, deviceType = DeviceType.DESKTOP, onClose, onF
|
|
|
99
97
|
document.getElementById('fileInput')?.click();
|
|
100
98
|
}, []);
|
|
101
99
|
let content = !uploadedFile ?
|
|
102
|
-
_jsxs("div", { style: { display: 'flex', gap: 10, width: '100%', height: '100%' }, children: [_jsx(HiddenInput, { id: "fileInput", type: "file", onChange: handleInputChange }), _jsxs(UploadContainer, { ref: uploaderRef, tabIndex: 0, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, style: { backgroundColor: dragOver ? '#76b1e6' : 'white' }, onDoubleClick: browseHandler, "$isRequired": isRequired, children: [_jsxs("div", { style: { display: 'flex', gap: '10px', flexDirection: 'column', position: 'absolute', right: 5, top: 5 }, children: [_jsx(TMButton, { btnStyle: 'icon', caption: 'Sfoglia', color: isRequired && !uploadedFile ? 'error' : 'primary', onClick: browseHandler, icon: _jsx(IconFolderOpen, { fontSize: 22 }) }),
|
|
100
|
+
_jsxs("div", { style: { display: 'flex', gap: 10, width: '100%', height: '100%' }, children: [_jsx(HiddenInput, { id: "fileInput", type: "file", onChange: handleInputChange }), _jsxs(UploadContainer, { ref: uploaderRef, tabIndex: 0, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, style: { backgroundColor: dragOver ? '#76b1e6' : 'white' }, onDoubleClick: browseHandler, "$isRequired": isRequired, children: [_jsxs("div", { style: { display: 'flex', gap: '10px', flexDirection: 'column', position: 'absolute', right: 5, top: 5 }, children: [_jsx(TMButton, { btnStyle: 'icon', caption: 'Sfoglia', color: isRequired && !uploadedFile ? 'error' : 'primary', onClick: browseHandler, icon: _jsx(IconFolderOpen, { fontSize: 22 }) }), showScannerIcon && isScannerLicenseConfigured() && onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { onScanRequest((file) => { onFileUpload?.(file); }); }, icon: _jsx(IconScanner, { fontSize: 22 }) }), showScannerIcon && isScannerLicenseConfigured() && !onScanRequest && _jsx(TMButton, { btnStyle: 'icon', caption: 'Scanner', color: 'primary', onClick: () => { ShowAlert({ message: 'Funzionalità scanner non disponibile in questo contesto.', mode: 'info', duration: 3000, title: 'Scanner' }); }, icon: _jsx(IconScanner, { fontSize: 22 }) })] }), _jsx("p", { style: { fontSize: '1.2rem', fontWeight: 'bold' }, children: deviceType === DeviceType.MOBILE ? 'Clicca per sfogliare il tuo file' : 'Trascina il tuo file o fai doppio click per sfogliarlo' }), isRequired && _jsxs("p", { style: { fontWeight: 'bold' }, children: [" ", SDKUI_Localizator.RequiredField, " "] })] })] }) :
|
|
103
101
|
_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 10, width: '100%', height: '100%' }, children: [_jsxs("div", { style: { backgroundColor: 'white', padding: '5px 10px', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'space-between', color: TMColors.primaryColor }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 5 }, children: [_jsx("p", { children: "File name:" }), _jsxs("div", { style: { fontWeight: 'bold' }, children: [fileName, " ", _jsxs("span", { children: [" ", ` (${formatBytes(fileSize)})`, " "] })] })] }), uploadedFile && _jsx(TMButton, { btnStyle: 'icon', color: 'error', caption: 'Pulisci', onClick: () => clearFile(true), icon: _jsx(IconClear, { fontSize: 22 }) })] }), extensionHandler(fileExt) === FileExtensionHandler.READY_TO_SHOW ? _jsx(TMFileViewer, { fileBlob: uploadedFile, isResizingActive: isResizingActive }) :
|
|
104
102
|
_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})` })] }) })] });
|
|
105
103
|
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] }));
|
|
@@ -7,7 +7,6 @@ import { DcmtOperationTypes, DownloadTypes, FileExtensionHandler } from '../ts';
|
|
|
7
7
|
import { useFileDialog, useFileSourceDialog } from './useInputDialog';
|
|
8
8
|
import { isXMLFileExt } from '../helper/dcmtsHelper';
|
|
9
9
|
import { ShowConfirm } from '../components/base/TMConfirm';
|
|
10
|
-
import { useBetaFeatures } from './useBetaFeatures';
|
|
11
10
|
const isScannerLicenseConfigured = () => {
|
|
12
11
|
try {
|
|
13
12
|
const scannerLicense = SDKUI_Globals.userSettings.advancedSettings.scannerLicense;
|
|
@@ -42,7 +41,6 @@ export const useDcmtOperations = () => {
|
|
|
42
41
|
const [waitPanelValueSecondary, setWaitPanelValueSecondary] = useState(0);
|
|
43
42
|
const [waitPanelMaxValueSecondary, setWaitPanelMaxValueSecondary] = useState(0);
|
|
44
43
|
const { OpenFileDialog } = useFileDialog();
|
|
45
|
-
const isBetaFeaturesEnabled = useBetaFeatures();
|
|
46
44
|
const [selectFileSource, FileSourceDialog] = useFileSourceDialog();
|
|
47
45
|
const _downloadDcmtsAsync = async (inputDcmts, downloadMode = "download", onFileDownloaded, skipConfirmation = false) => {
|
|
48
46
|
if (inputDcmts === undefined)
|
|
@@ -224,7 +222,7 @@ export const useDcmtOperations = () => {
|
|
|
224
222
|
return;
|
|
225
223
|
let file = inputDcmts[0].FILE;
|
|
226
224
|
if (!file) {
|
|
227
|
-
if (
|
|
225
|
+
if (isScannerLicenseConfigured()) {
|
|
228
226
|
const hasExistingFile = !!inputDcmts[0].FILEEXT;
|
|
229
227
|
const source = await selectFileSource(hasExistingFile);
|
|
230
228
|
if (!source)
|
|
@@ -556,7 +554,7 @@ export const useDcmtOperations = () => {
|
|
|
556
554
|
TMResultManager.show(result, operationTitle, "TID", "DID");
|
|
557
555
|
};
|
|
558
556
|
// Per SubstituteFile con beta features e scanner, non mostrare conferma
|
|
559
|
-
if (dcmtOperationType === DcmtOperationTypes.SubstituteFile &&
|
|
557
|
+
if (dcmtOperationType === DcmtOperationTypes.SubstituteFile && isScannerLicenseConfigured()) {
|
|
560
558
|
await doOperationAsync();
|
|
561
559
|
}
|
|
562
560
|
else {
|