@topconsultnpm/sdkui-react 6.21.0-dev1.41 → 6.21.0-dev1.42
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.
|
@@ -225,7 +225,8 @@ export const useDcmtOperations = () => {
|
|
|
225
225
|
let file = inputDcmts[0].FILE;
|
|
226
226
|
if (!file) {
|
|
227
227
|
if (isBetaFeaturesEnabled && isScannerLicenseConfigured()) {
|
|
228
|
-
const
|
|
228
|
+
const hasExistingFile = !!inputDcmts[0].FILEEXT;
|
|
229
|
+
const source = await selectFileSource(hasExistingFile);
|
|
229
230
|
if (!source)
|
|
230
231
|
return;
|
|
231
232
|
switch (source) {
|
|
@@ -8,4 +8,4 @@ export declare const useInputAttachmentsDialog: () => {
|
|
|
8
8
|
ConfirmAttachmentsDialog: () => import("react/jsx-runtime").JSX.Element | null;
|
|
9
9
|
};
|
|
10
10
|
export type FileSourceType = 'filesystem' | 'scanner-new' | 'scanner-edit' | undefined;
|
|
11
|
-
export declare const useFileSourceDialog: () => [() => Promise<FileSourceType>, () => JSX.Element];
|
|
11
|
+
export declare const useFileSourceDialog: () => [(hasExistingFile?: boolean) => Promise<FileSourceType>, () => JSX.Element];
|
|
@@ -111,6 +111,7 @@ const fileSourceOptions = [
|
|
|
111
111
|
export const useFileSourceDialog = () => {
|
|
112
112
|
const [promise, setPromise] = useState(null);
|
|
113
113
|
const [open, setOpen] = useState(false);
|
|
114
|
+
const [showEditOption, setShowEditOption] = useState(true);
|
|
114
115
|
const handleClose = () => {
|
|
115
116
|
setOpen(false);
|
|
116
117
|
setPromise(null);
|
|
@@ -125,11 +126,13 @@ export const useFileSourceDialog = () => {
|
|
|
125
126
|
};
|
|
126
127
|
const FileSourceDialog = () => {
|
|
127
128
|
const [source, setSource] = useState('filesystem');
|
|
129
|
+
const options = showEditOption ? fileSourceOptions : fileSourceOptions.filter(o => o.value !== 'scanner-edit');
|
|
128
130
|
return (open ?
|
|
129
|
-
_jsx(TMModal, { title: SDKUI_Localizator.AddOrSubstFile, height: "max-content", width: "320px", onClose: handleCancel, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '5px', padding: '10px', height: '100%' }, children: [_jsx(TMRadioButton, { dataSource:
|
|
131
|
+
_jsx(TMModal, { title: SDKUI_Localizator.AddOrSubstFile, height: "max-content", width: "320px", onClose: handleCancel, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '5px', padding: '10px', height: '100%' }, children: [_jsx(TMRadioButton, { dataSource: options, direction: 'column', value: source, onValueChanged: (newValue) => { setSource(newValue); } }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', gap: '5px', paddingTop: '10px', justifyContent: 'center', alignItems: 'center', height: '50px' }, children: [_jsx(TMButton, { btnStyle: "advanced", showTooltip: false, icon: _jsx(IconApply, {}), caption: "OK", advancedColor: TMColors.tertiary, onClick: () => handleConfirm(source) }), _jsx(TMButton, { btnStyle: "advanced", showTooltip: false, icon: _jsx(IconCloseOutline, {}), caption: SDKUI_Localizator.Cancel, onClick: handleCancel })] })] }) })
|
|
130
132
|
: _jsx(_Fragment, {}));
|
|
131
133
|
};
|
|
132
|
-
const selectFileSource = () => {
|
|
134
|
+
const selectFileSource = (hasExistingFile = true) => {
|
|
135
|
+
setShowEditOption(hasExistingFile);
|
|
133
136
|
return new Promise((resolve) => {
|
|
134
137
|
setOpen(true);
|
|
135
138
|
setPromise({ resolve });
|