@topconsultnpm/sdkui-react 6.19.0 → 6.20.0-dev1.10
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/base/TMAccordion.js +2 -2
- package/lib/components/editors/TMHtmlEditor.js +1 -1
- package/lib/components/editors/TMMetadataValues.js +16 -2
- package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -7
- package/lib/components/features/documents/TMDcmtBlog.js +29 -2
- package/lib/components/features/documents/TMDcmtForm.js +12 -29
- package/lib/components/features/documents/TMDcmtPreview.js +93 -64
- package/lib/components/features/search/TMSearchResult.js +158 -47
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.js +4 -9
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +16 -16
- package/lib/components/features/search/{TMViewHistoryDcmtForm.d.ts → TMViewHistoryDcmt.d.ts} +3 -3
- package/lib/components/features/search/{TMViewHistoryDcmtForm.js → TMViewHistoryDcmt.js} +83 -13
- package/lib/helper/SDKUI_Globals.d.ts +3 -14
- package/lib/helper/SDKUI_Localizator.d.ts +7 -0
- package/lib/helper/SDKUI_Localizator.js +88 -0
- package/lib/helper/TMUtils.d.ts +3 -1
- package/lib/helper/TMUtils.js +51 -0
- package/lib/helper/checkinCheckoutManager.d.ts +55 -0
- package/lib/helper/checkinCheckoutManager.js +266 -0
- package/lib/helper/helpers.js +6 -1
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/helper/queryHelper.js +13 -1
- package/lib/services/platform_services.d.ts +1 -1
- package/package.json +52 -52
- package/lib/helper/cicoHelper.d.ts +0 -31
- package/lib/helper/cicoHelper.js +0 -155
|
@@ -47,12 +47,12 @@ const StyledGroupTemplate = styled.div `
|
|
|
47
47
|
&::after {
|
|
48
48
|
content: '';
|
|
49
49
|
display: block;
|
|
50
|
-
width:
|
|
50
|
+
width: calc(100% - 35px);
|
|
51
51
|
margin: 0 auto;
|
|
52
52
|
border-bottom: 1px solid #00A99D;
|
|
53
53
|
margin-top: 8px;
|
|
54
54
|
position: absolute;
|
|
55
|
-
left:
|
|
55
|
+
left: 35px;
|
|
56
56
|
bottom: 0;
|
|
57
57
|
}
|
|
58
58
|
`;
|
|
@@ -170,7 +170,7 @@ const TMHtmlEditor = (props) => {
|
|
|
170
170
|
justifyContent: 'flex-end',
|
|
171
171
|
fontSize: 12,
|
|
172
172
|
color: '#6c757d',
|
|
173
|
-
marginTop: 4,
|
|
173
|
+
marginTop: showInfoIcon ? 0 : 4,
|
|
174
174
|
gap: 4,
|
|
175
175
|
}, children: [`${Math.max(charactersRemaining, 0)} ${SDKUI_Localizator.CharactersRemaining}`, showInfoIcon && (_jsx(TMTooltip, { content: 'Markup HTML', children: _jsx("span", { className: "dx-icon-codeblock", style: { fontSize: 22, cursor: 'pointer' }, onClick: () => {
|
|
176
176
|
TMMessageBoxManager.show({
|
|
@@ -10,7 +10,7 @@ import TMTooltip from "../base/TMTooltip";
|
|
|
10
10
|
import TMCheckBox from "./TMCheckBox";
|
|
11
11
|
import TMMetadataEditor, { useMetadataEditableList } from "./TMMetadataEditor";
|
|
12
12
|
import { FormulaHelper } from "./TMFormulaEditor";
|
|
13
|
-
import { DraftsMIDs, DSAttachsMIDs } from "../../ts";
|
|
13
|
+
import { ChronologyMIDs, DraftsMIDs, DSAttachsMIDs } from "../../ts";
|
|
14
14
|
import { TMNothingToShow } from "../features/documents/TMDcmtPreview";
|
|
15
15
|
import TMAccordion from "../base/TMAccordion";
|
|
16
16
|
import TabPanel, { Item } from 'devextreme-react/tab-panel';
|
|
@@ -388,6 +388,20 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
|
|
|
388
388
|
});
|
|
389
389
|
return (_jsxs("div", { style: { width: '100%' }, children: [draftData.length > 0 && _jsx(TMAccordion, { title: SDKUI_Localizator.Draft, children: draftData.map(item => renderMetadataItem(item, isReadOnly)) }), checkOutData.length > 0 && _jsx(TMAccordion, { title: `${SDKUI_Localizator.CheckIn}/${SDKUI_Localizator.CheckOut}`, children: checkOutData.map(item => renderMetadataItem(item, true)) })] }));
|
|
390
390
|
}, [metadataValues, showCheckBoxes, showNullValueCheckBoxes, isReadOnly, dynDataListsToBeRefreshed, validationItems, selectedMID, isOpenDistinctValues, openChooserBySingleClick, metadataValuesOrig]);
|
|
391
|
+
const layoutChronology = useMemo(() => {
|
|
392
|
+
const chronologyData = [];
|
|
393
|
+
metadataValues.forEach(item => {
|
|
394
|
+
switch (item.md?.id) {
|
|
395
|
+
case ChronologyMIDs.Ver:
|
|
396
|
+
case ChronologyMIDs.AuthorID:
|
|
397
|
+
chronologyData.push(item);
|
|
398
|
+
break;
|
|
399
|
+
default:
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
return (_jsx("div", { style: { width: '100%' }, children: chronologyData.length > 0 && chronologyData.map(item => renderMetadataItem(item, isReadOnly)) }));
|
|
404
|
+
}, [metadataValues, showCheckBoxes, showNullValueCheckBoxes, isReadOnly, dynDataListsToBeRefreshed, validationItems, selectedMID, isOpenDistinctValues, openChooserBySingleClick, metadataValuesOrig]);
|
|
391
405
|
const layoutDsAttachs = useMemo(() => {
|
|
392
406
|
const dsAttachsData = [];
|
|
393
407
|
metadataValues.forEach(item => {
|
|
@@ -541,7 +555,7 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
|
|
|
541
555
|
}
|
|
542
556
|
switch (currentDTD?.id) {
|
|
543
557
|
case SystemTIDs.Drafts: return layoutDraft;
|
|
544
|
-
|
|
558
|
+
case SystemTIDs.Chronology: return layoutChronology;
|
|
545
559
|
case SystemTIDs.DSAttachs: return layoutDsAttachs;
|
|
546
560
|
default:
|
|
547
561
|
// Se è presente un layout personalizzato, usalo, altrimenti usa il rendering standard
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { HomeBlogPost, TaskDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
interface ITMDcmtBlogProps {
|
|
4
|
-
blogsDatasource: HomeBlogPost[];
|
|
5
|
-
setBlogsDatasource: (posts: HomeBlogPost[]) => void;
|
|
6
|
-
hasLoadedDataOnce: boolean;
|
|
7
|
-
setHasLoadedDataOnce: (loaded: boolean) => void;
|
|
8
|
-
lastLoadedDid: number | undefined;
|
|
9
|
-
setLastLoadedDid: (did: number | undefined) => void;
|
|
10
4
|
tid: number | undefined;
|
|
11
5
|
did: number | undefined;
|
|
12
|
-
fetchBlogDataAsync: (tid: number | undefined, did: number | undefined) => Promise<void>;
|
|
13
6
|
isVisible?: boolean;
|
|
7
|
+
fetchBlogDataTrigger?: number;
|
|
14
8
|
allTasks?: Array<TaskDescriptor>;
|
|
15
9
|
getAllTasks?: () => Promise<void>;
|
|
16
10
|
deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
@@ -6,13 +6,40 @@ import { TMNothingToShow } from './TMDcmtPreview';
|
|
|
6
6
|
import { IconBoard, SDKUI_Localizator } from '../../../helper';
|
|
7
7
|
import TMBlogCommentForm from '../blog/TMBlogCommentForm';
|
|
8
8
|
import TMBlogsPost from '../../grids/TMBlogsPost';
|
|
9
|
-
|
|
9
|
+
import TMSpinner from '../../base/TMSpinner';
|
|
10
|
+
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
11
|
+
const TMDcmtBlog = ({ tid, did, isVisible, fetchBlogDataTrigger, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
|
|
12
|
+
const [blogsDatasource, setBlogsDatasource] = useState([]);
|
|
13
|
+
const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false); //traccia se *qualsiasi* dato è stato caricato per la prima volta
|
|
14
|
+
const [lastLoadedDid, setLastLoadedDid] = useState(undefined); // `lastLoadedDid` tiene traccia dell'ultimo `did` per cui abbiamo caricato i dati
|
|
10
15
|
// State to manage show comment form selected file
|
|
11
16
|
const [showCommentForm, setShowCommentForm] = useState(false);
|
|
12
17
|
const [externalBlogPost, setExternalBlogPost] = useState(undefined);
|
|
18
|
+
const fetchBlogDataAsync = useCallback(async (tid, did) => {
|
|
19
|
+
try {
|
|
20
|
+
TMSpinner.show({ description: 'Caricamento - Bacheca...' });
|
|
21
|
+
const res = await SDK_Globals.tmSession?.NewSearchEngine().BlogRetrieveAsync(tid, did);
|
|
22
|
+
setBlogsDatasource(res ?? []);
|
|
23
|
+
setHasLoadedDataOnce(true);
|
|
24
|
+
setLastLoadedDid(did);
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
let err = e;
|
|
28
|
+
TMExceptionBoxManager.show({ exception: err });
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
TMSpinner.hide();
|
|
32
|
+
}
|
|
33
|
+
}, []);
|
|
13
34
|
const showCommentFormCallback = useCallback(() => {
|
|
14
35
|
setShowCommentForm(true);
|
|
15
36
|
}, []);
|
|
37
|
+
// useEffect per triggerare il fetch dall'esterno tramite props
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (fetchBlogDataTrigger !== undefined && fetchBlogDataTrigger > 0) {
|
|
40
|
+
fetchBlogDataAsync(tid, did);
|
|
41
|
+
}
|
|
42
|
+
}, [fetchBlogDataTrigger, fetchBlogDataAsync, tid, did]);
|
|
16
43
|
useEffect(() => {
|
|
17
44
|
if (!tid || !did) {
|
|
18
45
|
setBlogsDatasource([]);
|
|
@@ -21,7 +48,7 @@ const TMDcmtBlog = ({ blogsDatasource, setBlogsDatasource, hasLoadedDataOnce, se
|
|
|
21
48
|
}
|
|
22
49
|
// Condizione per eseguire il fetch:
|
|
23
50
|
// 1. Il pannello è visibile
|
|
24
|
-
// 2. E (non abbiamo ancora caricato dati
|
|
51
|
+
// 2. E (non abbiamo ancora caricato dati o il `did` è cambiato rispetto all'ultima volta)
|
|
25
52
|
const shouldFetch = isVisible && (!hasLoadedDataOnce || did !== lastLoadedDid);
|
|
26
53
|
// Esegui la chiamata API solo se il pannello è visibile E i dati non sono già stati caricati
|
|
27
54
|
// O, se vuoi ricaricare ogni volta che diventa visibile (ma è meno efficiente per "pesante")
|
|
@@ -96,10 +96,11 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
96
96
|
const [isInitialLoading, setIsInitialLoading] = useState(true);
|
|
97
97
|
const [isNavigating, setIsNavigating] = useState(false);
|
|
98
98
|
const [dcmtReferences, setDcmtReferences] = useState(undefined);
|
|
99
|
-
//
|
|
100
|
-
const [
|
|
101
|
-
const
|
|
102
|
-
|
|
99
|
+
// Stato per triggerare il refresh del blog dall'esterno
|
|
100
|
+
const [refreshBlogTrigger, setRefreshBlogTrigger] = useState(0);
|
|
101
|
+
const triggerBlogRefresh = useCallback(async () => {
|
|
102
|
+
setRefreshBlogTrigger(prev => prev + 1);
|
|
103
|
+
}, []);
|
|
103
104
|
useEffect(() => {
|
|
104
105
|
if (!allowButtonsRefs)
|
|
105
106
|
setDcmtReferences(undefined);
|
|
@@ -237,11 +238,11 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
237
238
|
// Imposta il layout e customButtonsLayout immediatamente
|
|
238
239
|
setLayout(resLayout);
|
|
239
240
|
if (layoutMode === LayoutModes.Update && customButtonsLayoutResult) {
|
|
240
|
-
|
|
241
|
-
//setCustomButtonsLayout(customButtonsLayoutResult);
|
|
241
|
+
setCustomButtonsLayout(customButtonsLayoutResult);
|
|
242
242
|
}
|
|
243
243
|
// Carica DTD e metadata
|
|
244
244
|
let dtd = await DcmtTypeListCacheService.GetWithNotGrantedAsync(TID, DID, getMetadataResult);
|
|
245
|
+
console.log('GetWithNotGrantedAsync DTD:', dtd);
|
|
245
246
|
setFromDTD(dtd);
|
|
246
247
|
if (layoutMode === LayoutModes.Update || (layoutMode === LayoutModes.Ark && DID)) {
|
|
247
248
|
await setMetadataList(dtd?.metadata ?? [], getMetadataResult);
|
|
@@ -680,13 +681,11 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
680
681
|
text: customButton.title || 'Bottone personalizzato',
|
|
681
682
|
onClick: () => setCustomButton(customButton)
|
|
682
683
|
}));
|
|
683
|
-
//disabilitato per ora
|
|
684
|
-
/*
|
|
685
684
|
items.push({
|
|
686
|
-
icon: svgToString(
|
|
685
|
+
icon: svgToString(_jsx(IconCheck, {})),
|
|
687
686
|
text: SDKUI_Localizator.CustomButtons,
|
|
688
687
|
items: customButtonsItems
|
|
689
|
-
}
|
|
688
|
+
});
|
|
690
689
|
}
|
|
691
690
|
return items;
|
|
692
691
|
}, [
|
|
@@ -1007,28 +1006,12 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1007
1006
|
setShowAll(true);
|
|
1008
1007
|
}
|
|
1009
1008
|
}, [shouldShowAll, showAll]);
|
|
1010
|
-
const fetchBlogDataAsync = useCallback(async (tid, did) => {
|
|
1011
|
-
try {
|
|
1012
|
-
TMSpinner.show({ description: 'Caricamento - Bacheca...' });
|
|
1013
|
-
const res = await SDK_Globals.tmSession?.NewSearchEngine().BlogRetrieveAsync(tid, did);
|
|
1014
|
-
setBlogsDatasource(res ?? []);
|
|
1015
|
-
setHasLoadedDataOnce(true);
|
|
1016
|
-
setLastLoadedDid(did);
|
|
1017
|
-
}
|
|
1018
|
-
catch (e) {
|
|
1019
|
-
let err = e;
|
|
1020
|
-
TMExceptionBoxManager.show({ exception: err });
|
|
1021
|
-
}
|
|
1022
|
-
finally {
|
|
1023
|
-
TMSpinner.hide();
|
|
1024
|
-
}
|
|
1025
|
-
}, []);
|
|
1026
1009
|
const afterTaskSaved = useCallback(async (task, formMode, forceRefresh = false) => {
|
|
1027
1010
|
const shouldRefresh = forceRefresh || (task && task.state === Task_States.Completed) || formMode === FormModes.Create || formMode === FormModes.Duplicate;
|
|
1028
1011
|
if (TID && DID && shouldRefresh) {
|
|
1029
|
-
await
|
|
1012
|
+
await triggerBlogRefresh();
|
|
1030
1013
|
}
|
|
1031
|
-
}, [TID, DID]);
|
|
1014
|
+
}, [TID, DID, triggerBlogRefresh]);
|
|
1032
1015
|
const tmDcmtForm = useMemo(() => {
|
|
1033
1016
|
return _jsx(_Fragment, { children: metadataValuesSource.length > 0 &&
|
|
1034
1017
|
_jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, inputMids: inputMids, layout: layout, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
|
|
@@ -1078,7 +1061,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1078
1061
|
handleUndo,
|
|
1079
1062
|
handleClearForm
|
|
1080
1063
|
]);
|
|
1081
|
-
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, {
|
|
1064
|
+
const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID, allTasks: allTasks, fetchBlogDataTrigger: refreshBlogTrigger, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [TID, DID, allTasks, refreshBlogTrigger]);
|
|
1082
1065
|
const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [], inputMids: inputMids }), [TID, layoutMode, formData, deviceType, inputMids]);
|
|
1083
1066
|
const tmDcmtPreview = useMemo(() => _jsx(TMDcmtPreviewWrapper, { currentDcmt: currentDcmt, dcmtFile: dcmtFile ?? inputFile, deviceType: deviceType, fromDTD: fromDTD, layoutMode: layoutMode, onFileUpload: (file) => {
|
|
1084
1067
|
setDcmtFile(file);
|
|
@@ -136,32 +136,32 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
|
136
136
|
const [blobUrl, setBlobUrl] = useState(undefined);
|
|
137
137
|
const [fileType, setFileType] = useState(undefined);
|
|
138
138
|
const [formattedXml, setFormattedXml] = useState(undefined);
|
|
139
|
-
const [isMobile, setIsMobile] = useState(false);
|
|
140
|
-
useEffect(() => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}, []);
|
|
139
|
+
// const [isMobile, setIsMobile] = useState<boolean>(false);
|
|
140
|
+
// useEffect(() => {
|
|
141
|
+
// const checkIsMobile = () => {
|
|
142
|
+
// const userAgent = navigator.userAgent || navigator.vendor || (window as any).opera;
|
|
143
|
+
// // Only detect actual mobile/tablet devices, NOT desktop browsers
|
|
144
|
+
// const isMobileDevice =
|
|
145
|
+
// // Traditional mobile detection (phones and tablets)
|
|
146
|
+
// /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) ||
|
|
147
|
+
// // Additional Android tablet detection (covers tablets in landscape)
|
|
148
|
+
// /android.*tablet|android.*mobile/i.test(userAgent) ||
|
|
149
|
+
// // Touch-only devices (excludes laptops with touchscreen)
|
|
150
|
+
// (('ontouchstart' in window || navigator.maxTouchPoints > 0) &&
|
|
151
|
+
// !/Windows NT|Macintosh|Linux/.test(userAgent)) ||
|
|
152
|
+
// // Small screen mobile devices only
|
|
153
|
+
// (window.screen.width <= 768 && /Mobi|Android/i.test(userAgent));
|
|
154
|
+
// setIsMobile(isMobileDevice);
|
|
155
|
+
// };
|
|
156
|
+
// checkIsMobile();
|
|
157
|
+
// // Listen for orientation changes (important for tablets)
|
|
158
|
+
// window.addEventListener('orientationchange', checkIsMobile);
|
|
159
|
+
// window.addEventListener('resize', checkIsMobile);
|
|
160
|
+
// return () => {
|
|
161
|
+
// window.removeEventListener('orientationchange', checkIsMobile);
|
|
162
|
+
// window.removeEventListener('resize', checkIsMobile);
|
|
163
|
+
// };
|
|
164
|
+
// }, []);
|
|
165
165
|
useEffect(() => {
|
|
166
166
|
if (fileBlob) {
|
|
167
167
|
setFileType(fileBlob.type);
|
|
@@ -222,44 +222,73 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
|
222
222
|
if (fileBlob.type.includes('image')) {
|
|
223
223
|
return (_jsx(ImageViewer, { fileBlob: fileBlob, alt: '' }));
|
|
224
224
|
}
|
|
225
|
-
//
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
225
|
+
// if (fileType === 'application/pdf' && isMobile) {
|
|
226
|
+
// return (
|
|
227
|
+
// <object
|
|
228
|
+
// key={blobUrl}
|
|
229
|
+
// data={blobUrl}
|
|
230
|
+
// type="application/pdf"
|
|
231
|
+
// width="100%"
|
|
232
|
+
// height="100%"
|
|
233
|
+
// style={{
|
|
234
|
+
// border: 'none',
|
|
235
|
+
// zIndex: 0,
|
|
236
|
+
// pointerEvents: isResizingActive === true ? "none" : "auto"
|
|
237
|
+
// }}
|
|
238
|
+
// >
|
|
239
|
+
// {/* Fallback UI if <object> tag fails to render PDF */}
|
|
240
|
+
// <div style={{
|
|
241
|
+
// padding: '40px',
|
|
242
|
+
// textAlign: 'center',
|
|
243
|
+
// display: 'flex',
|
|
244
|
+
// flexDirection: 'column',
|
|
245
|
+
// alignItems: 'center',
|
|
246
|
+
// justifyContent: 'center',
|
|
247
|
+
// height: '100%',
|
|
248
|
+
// gap: '20px'
|
|
249
|
+
// }}>
|
|
250
|
+
// <IconPreview fontSize={96} />
|
|
251
|
+
// <div>
|
|
252
|
+
// <h3>{SDKUI_Localizator.PDFDocument}</h3>
|
|
253
|
+
// <p>{SDKUI_Localizator.PreviewNotAvailableOnDevice}</p>
|
|
254
|
+
// </div>
|
|
255
|
+
// <div style={{ display: 'flex', gap: '10px', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center' }}>
|
|
256
|
+
// <a
|
|
257
|
+
// href={blobUrl}
|
|
258
|
+
// download="document.pdf"
|
|
259
|
+
// style={{
|
|
260
|
+
// minWidth: '180px',
|
|
261
|
+
// padding: '12px 24px',
|
|
262
|
+
// backgroundColor: TMColors.primaryColor,
|
|
263
|
+
// color: 'white',
|
|
264
|
+
// textDecoration: 'none',
|
|
265
|
+
// borderRadius: '4px',
|
|
266
|
+
// display: 'inline-block'
|
|
267
|
+
// }}
|
|
268
|
+
// >
|
|
269
|
+
// {SDKUI_Localizator.DownloadFile}
|
|
270
|
+
// </a>
|
|
271
|
+
// <a
|
|
272
|
+
// href={blobUrl}
|
|
273
|
+
// target="_blank"
|
|
274
|
+
// rel="noopener noreferrer"
|
|
275
|
+
// style={{
|
|
276
|
+
// minWidth: '180px',
|
|
277
|
+
// padding: '12px 24px',
|
|
278
|
+
// backgroundColor: TMColors.primaryColor,
|
|
279
|
+
// color: 'white',
|
|
280
|
+
// textDecoration: 'none',
|
|
281
|
+
// borderRadius: '4px',
|
|
282
|
+
// display: 'inline-block'
|
|
283
|
+
// }}
|
|
284
|
+
// >
|
|
285
|
+
// {SDKUI_Localizator.OpenInNewTab}
|
|
286
|
+
// </a>
|
|
287
|
+
// </div>
|
|
288
|
+
// </div>
|
|
289
|
+
// </object>
|
|
290
|
+
// );
|
|
291
|
+
// }
|
|
263
292
|
return (_jsx("iframe", { srcDoc: formattedXml ? `<html><body>${formattedXml}</body></html>` : undefined, src: !formattedXml
|
|
264
293
|
? (fileType === 'application/pdf' ? `${blobUrl}#view=FitH&scrollbar=1` : blobUrl)
|
|
265
294
|
: undefined, title: "File Viewer", width: "100%", height: "100%", style: { border: 'none', zIndex: 0, pointerEvents: isResizingActive === true ? "none" : "auto" } }, blobUrl));
|