@topconsultnpm/sdkui-react 6.21.0-dev1.46 → 6.21.0-dev1.48
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: SDKUI_Localizator.ScanFeatureUnavailableInThisContext, 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] }));
|
|
@@ -569,6 +569,7 @@ export declare class SDKUI_Localizator {
|
|
|
569
569
|
static get FormErrorsProceedQuestion(): "Es gibt Fehler im Formular. Wenn Sie fortfahren, werden die Daten nicht gespeichert. Möchten Sie trotzdem fortfahren?" | "There are errors in the form. If you continue, the data will not be saved. Do you want to proceed anyway?" | "Hay errores en el formulario. Si continúas, los datos no se guardarán. ¿Quieres proceder de todos modos?" | "Il y a des erreurs dans le formulaire. Si vous continuez, les données ne seront pas enregistrées. Voulez-vous continuer quand même?" | "Há erros no formulário. Se continuar, os dados não serão salvos. Deseja prosseguir mesmo assim?" | "Ci sono errori nel form. Se continui, i dati non saranno salvati. Vuoi comunque procedere?";
|
|
570
570
|
static get SavedQueryNew(): "Neue Suche speichern" | "Save new search" | "Guardar nueva búsqueda" | "Enregistrer la nouvelle recherche" | "Guardar nova pesquisa" | "Salva nuova ricerca";
|
|
571
571
|
static get SavedQueryUpdate(): "Suche bearbeiten" | "Modify query" | "Modificar búsqueda" | "Modifie la recherche" | "Mudar pesquisa" | "Modifica ricerca";
|
|
572
|
+
static get ScanFeatureUnavailableInThisContext(): "Scanfunktionen sind in diesem Kontext nicht verfugbar." | "Scanning features are not available in this context." | "Las funciones de escaneo no estan disponibles en este contexto." | "Les fonctionnalites de numerisation ne sont pas disponibles dans ce contexte." | "Os recursos de digitalizacao nao estao disponiveis neste contexto." | "Funzionalita di scansione non disponibili in questo contesto.";
|
|
572
573
|
static get Search(): "Auf der Suche nach" | "Search" | "Búsqueda" | "Recherche" | "Pesquisa" | "Ricerca";
|
|
573
574
|
static get SearchAction(): "Search" | "Suche" | "Buscar" | "Chercher" | "Pesquisar" | "Cerca";
|
|
574
575
|
static get Search_Advanced(): "Erweiterte Suche" | "Advanced search" | "Búsqueda avanzada" | "Recherche avancée" | "Pesquisa Avançada" | "Ricerca avanzata";
|
|
@@ -5661,6 +5661,16 @@ export class SDKUI_Localizator {
|
|
|
5661
5661
|
default: return "Modifica ricerca";
|
|
5662
5662
|
}
|
|
5663
5663
|
}
|
|
5664
|
+
static get ScanFeatureUnavailableInThisContext() {
|
|
5665
|
+
switch (this._cultureID) {
|
|
5666
|
+
case CultureIDs.De_DE: return "Scanfunktionen sind in diesem Kontext nicht verfugbar.";
|
|
5667
|
+
case CultureIDs.En_US: return "Scanning features are not available in this context.";
|
|
5668
|
+
case CultureIDs.Es_ES: return "Las funciones de escaneo no estan disponibles en este contexto.";
|
|
5669
|
+
case CultureIDs.Fr_FR: return "Les fonctionnalites de numerisation ne sont pas disponibles dans ce contexte.";
|
|
5670
|
+
case CultureIDs.Pt_PT: return "Os recursos de digitalizacao nao estao disponiveis neste contexto.";
|
|
5671
|
+
default: return "Funzionalita di scansione non disponibili in questo contesto.";
|
|
5672
|
+
}
|
|
5673
|
+
}
|
|
5664
5674
|
static get Search() {
|
|
5665
5675
|
switch (this._cultureID) {
|
|
5666
5676
|
case CultureIDs.De_DE: return "Auf der Suche nach";
|
|
@@ -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)
|
|
@@ -240,7 +238,7 @@ export const useDcmtOperations = () => {
|
|
|
240
238
|
});
|
|
241
239
|
}
|
|
242
240
|
else {
|
|
243
|
-
ShowAlert({ message:
|
|
241
|
+
ShowAlert({ message: SDKUI_Localizator.ScanFeatureUnavailableInThisContext, mode: 'info', duration: 3000, title: 'Scanner' });
|
|
244
242
|
return;
|
|
245
243
|
}
|
|
246
244
|
break;
|
|
@@ -267,7 +265,7 @@ export const useDcmtOperations = () => {
|
|
|
267
265
|
});
|
|
268
266
|
}
|
|
269
267
|
else {
|
|
270
|
-
ShowAlert({ message:
|
|
268
|
+
ShowAlert({ message: SDKUI_Localizator.ScanFeatureUnavailableInThisContext, mode: 'info', duration: 3000, title: 'Scanner' });
|
|
271
269
|
return;
|
|
272
270
|
}
|
|
273
271
|
break;
|
|
@@ -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 {
|