@topconsultnpm/sdkui-react 6.20.0-dev1.17 → 6.20.0-dev1.19
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/NewComponents/ContextMenu/TMContextMenu.d.ts +4 -0
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +187 -0
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +12 -0
- package/lib/components/NewComponents/ContextMenu/hooks.js +52 -0
- package/lib/components/NewComponents/ContextMenu/index.d.ts +2 -0
- package/lib/components/NewComponents/ContextMenu/index.js +1 -0
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +30 -0
- package/lib/components/NewComponents/ContextMenu/styles.js +337 -0
- package/lib/components/NewComponents/ContextMenu/types.d.ts +26 -0
- package/lib/components/NewComponents/ContextMenu/types.js +1 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +4 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +370 -0
- package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +2 -0
- package/lib/components/NewComponents/FloatingMenuBar/index.js +2 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +38 -0
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +266 -0
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +30 -0
- package/lib/components/NewComponents/FloatingMenuBar/types.js +1 -0
- package/lib/components/NewComponents/Notification/Notification.d.ts +4 -0
- package/lib/components/NewComponents/Notification/Notification.js +60 -0
- package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +8 -0
- package/lib/components/NewComponents/Notification/NotificationContainer.js +33 -0
- package/lib/components/NewComponents/Notification/index.d.ts +2 -0
- package/lib/components/NewComponents/Notification/index.js +2 -0
- package/lib/components/NewComponents/Notification/styles.d.ts +21 -0
- package/lib/components/NewComponents/Notification/styles.js +180 -0
- package/lib/components/NewComponents/Notification/types.d.ts +18 -0
- package/lib/components/NewComponents/Notification/types.js +1 -0
- package/lib/components/editors/TMMetadataValues.js +20 -2
- package/lib/components/features/documents/TMDcmtForm.js +121 -68
- package/lib/components/features/documents/TMDcmtPreview.js +36 -3
- package/lib/helper/checkinCheckoutManager.d.ts +1 -0
- package/lib/helper/checkinCheckoutManager.js +5 -3
- package/lib/helper/queryHelper.js +12 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import TMDcmtPreview from './TMDcmtPreview';
|
|
4
|
-
import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TemplateTIDs, TID_DID, UpdateEngineByID, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
4
|
+
import { AccessLevels, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TemplateTIDs, TID_DID, UpdateEngineByID, UserListCacheService, ValidationItem, WorkflowCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
5
5
|
import { ContextMenu } from 'devextreme-react';
|
|
6
6
|
import { WorkFlowApproveRejectPopUp, WorkFlowMoreInfoPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
|
|
7
7
|
import { DownloadTypes, FormModes, DcmtOperationTypes } from '../../../ts';
|
|
@@ -45,6 +45,7 @@ import ToppyDraggableHelpCenter from '../assistant/ToppyDraggableHelpCenter';
|
|
|
45
45
|
import { useCheckInOutOperations } from '../../../hooks/useCheckInOutOperations';
|
|
46
46
|
import TMViewHistoryDcmt from '../search/TMViewHistoryDcmt';
|
|
47
47
|
import TMDcmtCheckoutInfoForm from '../search/TMDcmtCheckoutInfoForm';
|
|
48
|
+
import styled from 'styled-components';
|
|
48
49
|
let abortControllerLocal = new AbortController();
|
|
49
50
|
//#endregion
|
|
50
51
|
const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, showHeader = true, onSaveRecents, layoutMode = LayoutModes.Update, showBackButton = true, onClose, onSavedAsyncCallback, TID, DID, formMode = FormModes.Update, canNext, canPrev, count, itemIndex, onNext, onPrev, allowNavigation = true, allowRelations = true, isClosable = false, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, showDcmtFormSidebar = true, invokedByTodo = false, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId, onWFOperationCompleted, onTaskCompleted, onTaskCreateRequest, inputFile = null, taskFormDialogComponent, taskMoreInfo, connectorFileSave = undefined, inputMids = [], openS4TViewer = false, onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowButtonsRefs = false, onReferenceClick, }) => {
|
|
@@ -72,6 +73,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
72
73
|
const [layout, setLayout] = useState();
|
|
73
74
|
const [customButtonsLayout, setCustomButtonsLayout] = useState();
|
|
74
75
|
const [customButton, setCustomButton] = useState();
|
|
76
|
+
const [allUsers, setAllUsers] = useState([]);
|
|
75
77
|
const appliedInputMidsRef = useRef(null);
|
|
76
78
|
// Refs per evitare stale closure nei callback
|
|
77
79
|
// I useCallback catturano i valori delle dipendenze al momento della creazione.
|
|
@@ -105,6 +107,13 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
105
107
|
const triggerBlogRefresh = useCallback(async () => {
|
|
106
108
|
setRefreshBlogTrigger(prev => prev + 1);
|
|
107
109
|
}, []);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
const fetchAllUsers = async () => {
|
|
112
|
+
const users = await UserListCacheService.GetAllAsync();
|
|
113
|
+
setAllUsers(users ?? []);
|
|
114
|
+
};
|
|
115
|
+
fetchAllUsers();
|
|
116
|
+
}, []);
|
|
108
117
|
useEffect(() => {
|
|
109
118
|
if (!allowButtonsRefs)
|
|
110
119
|
setDcmtReferences(undefined);
|
|
@@ -584,51 +593,53 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
584
593
|
items: operationsItems
|
|
585
594
|
});
|
|
586
595
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
596
|
+
if (fromDTD?.id !== SystemTIDs.Drafts) {
|
|
597
|
+
// Check in/Check out menu
|
|
598
|
+
const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
|
|
599
|
+
items.push({
|
|
600
|
+
icon: svgToString(_jsx(IconFileDots, {})),
|
|
601
|
+
text: "Check in/Check out",
|
|
602
|
+
disabled: false,
|
|
603
|
+
items: [
|
|
604
|
+
{
|
|
605
|
+
icon: "edit",
|
|
606
|
+
text: 'Check out',
|
|
607
|
+
disabled: !cicoEnabled || checkoutStatus.isCheckedOut,
|
|
608
|
+
onClick: () => handleCheckOutOperationCallback(true),
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
icon: "unlock",
|
|
612
|
+
text: 'Check in',
|
|
613
|
+
onClick: () => handleCheckInOperationCallback(),
|
|
614
|
+
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode'
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
icon: "remove",
|
|
618
|
+
text: SDKUI_Localizator.CancelCheckOut,
|
|
619
|
+
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode',
|
|
620
|
+
onClick: () => handleCheckOutOperationCallback(false),
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
icon: "info",
|
|
624
|
+
text: SDKUI_Localizator.CheckoutInfo,
|
|
625
|
+
onClick: showCheckoutInformationFormCallback,
|
|
626
|
+
disabled: !checkoutStatus.isCheckedOut
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
icon: "copy",
|
|
630
|
+
text: SDKUI_Localizator.CopyCheckoutPath,
|
|
631
|
+
onClick: copyCheckoutPathToClipboardOperationCallback,
|
|
632
|
+
disabled: !checkoutStatus.isCheckedOut
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
icon: "clock",
|
|
636
|
+
text: SDKUI_Localizator.History,
|
|
637
|
+
disabled: !cicoEnabled,
|
|
638
|
+
onClick: showHistoryCallback,
|
|
639
|
+
},
|
|
640
|
+
]
|
|
641
|
+
});
|
|
642
|
+
}
|
|
632
643
|
if (allowRelations && layoutMode === LayoutModes.Update && DID) {
|
|
633
644
|
const relationsItems = [
|
|
634
645
|
{
|
|
@@ -752,6 +763,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
752
763
|
}
|
|
753
764
|
return items;
|
|
754
765
|
}, [
|
|
766
|
+
fromDTD?.id,
|
|
755
767
|
fromDTD?.perm?.canRetrieveFile,
|
|
756
768
|
fromDTD?.description,
|
|
757
769
|
currentDcmt?.fileExt,
|
|
@@ -1094,28 +1106,34 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
1094
1106
|
await triggerBlogRefresh();
|
|
1095
1107
|
}
|
|
1096
1108
|
}, [TID, DID, triggerBlogRefresh]);
|
|
1109
|
+
const checkoutBadge = useMemo(() => {
|
|
1110
|
+
const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
|
|
1111
|
+
if (!cicoEnabled || !checkoutStatus.isCheckedOut)
|
|
1112
|
+
return null;
|
|
1113
|
+
return (_jsx(Ribbon, { "$isMobile": isMobile, children: _jsx(TMTooltip, { content: checkoutStatus.editLockTooltipText, position: "right", children: _jsx("span", { children: checkoutStatus.mode === 'editMode' ? SDKUI_Localizator.CheckOut : 'Locked' }) }) }));
|
|
1114
|
+
}, [formData, fromDTD, isMobile]);
|
|
1097
1115
|
const tmDcmtForm = useMemo(() => {
|
|
1098
|
-
return
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1116
|
+
return _jsxs(_Fragment, { children: [checkoutBadge && _jsx("div", { style: { padding: '10px', display: 'flex', justifyContent: 'center' }, children: checkoutBadge }), metadataValuesSource.length > 0 &&
|
|
1117
|
+
_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) => {
|
|
1118
|
+
setFormData((prevItems) => prevItems.map((item) => {
|
|
1119
|
+
const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
|
|
1120
|
+
return newItem ? { ...item, ...newItem } : item;
|
|
1121
|
+
}));
|
|
1122
|
+
}, onAdvancedMenuClick: (e) => {
|
|
1123
|
+
switch (e.button) {
|
|
1124
|
+
case AdvancedMenuButtons.DistinctValues:
|
|
1125
|
+
setIsOpenDistinctValues(!isOpenDistinctValues);
|
|
1126
|
+
break;
|
|
1127
|
+
case AdvancedMenuButtons.FormulaEditor:
|
|
1128
|
+
setIsOpenFormulaEditor(!isOpenFormulaEditor);
|
|
1129
|
+
break;
|
|
1130
|
+
}
|
|
1131
|
+
} }), _jsxs(StyledFormButtonsContainer, { children: [_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 10 }, children: _jsx("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: layoutMode === LayoutModes.Update ? _jsxs(_Fragment, { children: [_jsx(TMSaveFormButtonSave, { showTooltip: false, btnStyle: 'advanced', advancedColor: '#f09c0a', isModified: isModified, formMode: formMode, errorsCount: validationItems.filter(o => o.ResultType == ResultTypes.ERROR).length, onSaveAsync: handleConfirmAction }), _jsx(TMSaveFormButtonUndo, { btnStyle: 'toolbar', showTooltip: true, color: 'primary', isModified: isModified, formMode: formMode, onUndo: handleUndo })] }) :
|
|
1132
|
+
_jsxs(_Fragment, { children: [_jsx(TMButton, { disabled: archiveBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconBoxArchiveIn, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Archive, advancedColor: TMColors.success, onClick: handleConfirmAction }), _jsx(TMButton, { disabled: !clearFormBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconClear, {}), width: 'auto', showTooltip: false, caption: SDKUI_Localizator.Clear, advancedColor: TMColors.tertiary, onClick: handleClearForm }), DID && _jsx(TMButton, { disabled: undoBtnDisabled, btnStyle: 'advanced', icon: _jsx(IconUndo, {}), width: '150px', showTooltip: false, caption: SDKUI_Localizator.Undo, advancedColor: TMColors.tertiary, onClick: handleUndo })] }) }) }), customButton && _jsx(TMCustomButton, { button: customButton, formData: formData, selectedItems: [], onClose: () => setCustomButton(undefined) }), totalItems > listMaxItems &&
|
|
1133
|
+
!isApprView &&
|
|
1134
|
+
TID !== SystemTIDs.Drafts &&
|
|
1135
|
+
!shouldShowAll &&
|
|
1136
|
+
_jsx(TMShowAllOrMaxItemsButton, { showAll: showAll, dataSourceLength: totalItems, onClick: () => { setShowAll(!showAll); } })] }), _jsx(ConfirmAttachmentsDialog, {})] })] });
|
|
1119
1137
|
}, [
|
|
1120
1138
|
TID,
|
|
1121
1139
|
DID,
|
|
@@ -1517,8 +1535,11 @@ const applyMetadataFilter = (data, showAll, listMaxItems, TID) => {
|
|
|
1517
1535
|
o.mid === SystemMIDsAsNumber.FileSize ||
|
|
1518
1536
|
o.mid === SystemMIDsAsNumber.LastUpdateTime ||
|
|
1519
1537
|
o.mid === SystemMIDsAsNumber.CreationTime;
|
|
1538
|
+
const chronologySystemFilter = (o) => baseFilter(o) ||
|
|
1539
|
+
o.mid === SystemMIDsAsNumber.FileExt ||
|
|
1540
|
+
o.mid === SystemMIDsAsNumber.FileSize;
|
|
1520
1541
|
// Select the appropriate filter based on document type
|
|
1521
|
-
const currentFilter = TID === SystemTIDs.Drafts ? draftFilter : baseFilter;
|
|
1542
|
+
const currentFilter = TID === SystemTIDs.Drafts ? draftFilter : TID === SystemTIDs.Chronology ? chronologySystemFilter : baseFilter;
|
|
1522
1543
|
// Apply filter once
|
|
1523
1544
|
const filteredData = data.filter(currentFilter);
|
|
1524
1545
|
// Return all filtered data or slice to max items
|
|
@@ -1572,3 +1593,35 @@ const TMDcmtPreviewWrapper = ({ currentDcmt, layoutMode, fromDTD, dcmtFile, devi
|
|
|
1572
1593
|
_jsx(TMDcmtPreview, { isVisible: isVisible, onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("tmDcmtPreview") : undefined, dcmtData: currentDcmt, isResizingActive: isResizingActive }) :
|
|
1573
1594
|
_jsx(TMFileUploader, { onFileUpload: onFileUpload, onClose: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('tmDcmtPreview', false) : undefined, isRequired: fromDTD?.archiveConstraint === ArchiveConstraints.ContentCompulsory && dcmtFile === null, defaultBlob: dcmtFile, deviceType: deviceType, isResizingActive: isResizingActive, enableDragDropOverlay: panelVisibility['tmDcmtPreview'] && enableDragDropOverlay }));
|
|
1574
1595
|
};
|
|
1596
|
+
const Ribbon = styled.div `
|
|
1597
|
+
font-size: 0.85rem;
|
|
1598
|
+
font-weight: 600;
|
|
1599
|
+
color: #fff;
|
|
1600
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
|
|
1601
|
+
--f: .4em; /* control the folded part */
|
|
1602
|
+
position: absolute;
|
|
1603
|
+
top: 2px;
|
|
1604
|
+
left: 2px;
|
|
1605
|
+
z-index: 1200;
|
|
1606
|
+
line-height: 1.6;
|
|
1607
|
+
padding-inline: 0.8lh;
|
|
1608
|
+
padding-bottom: var(--f);
|
|
1609
|
+
border-image: conic-gradient(#0008 0 0) 51%/var(--f);
|
|
1610
|
+
clip-path: polygon(100% calc(100% - var(--f)),100% 100%,calc(100% - var(--f)) calc(100% - var(--f)),var(--f) calc(100% - var(--f)), 0 100%,0 calc(100% - var(--f)),999px calc(100% - var(--f) - 999px),calc(100% - 999px) calc(100% - var(--f) - 999px));
|
|
1611
|
+
transform: translate(calc((cos(45deg) - 1)*100%), -100%) rotate(-45deg);
|
|
1612
|
+
transform-origin: 100% 100%;
|
|
1613
|
+
background-color: rgba(217, 148, 13, 0.92);
|
|
1614
|
+
display: inline-block;
|
|
1615
|
+
padding-top: 0.1em;
|
|
1616
|
+
white-space: nowrap;
|
|
1617
|
+
transition: ${props => props.$isMobile ? 'none' : 'all 0.3s ease'};
|
|
1618
|
+
cursor: 'default';
|
|
1619
|
+
|
|
1620
|
+
${props => !props.$isMobile && `
|
|
1621
|
+
&:hover {
|
|
1622
|
+
background-color: #d9940d;
|
|
1623
|
+
font-size: 1.1rem;
|
|
1624
|
+
transform: translate(calc((cos(45deg) - 1)*100%), -100%) rotate(-45deg) scale(1.05);
|
|
1625
|
+
}
|
|
1626
|
+
`}
|
|
1627
|
+
`;
|
|
@@ -15,9 +15,25 @@ import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSa
|
|
|
15
15
|
import { StyledAnimatedComponentOpacity } from '../../base/Styled';
|
|
16
16
|
import TMPanel from '../../base/TMPanel';
|
|
17
17
|
import TMTooltip from '../../base/TMTooltip';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
pdfjs
|
|
18
|
+
let Document = null;
|
|
19
|
+
let Page = null;
|
|
20
|
+
let pdfjs = null;
|
|
21
|
+
let isPdfLibraryLoaded = false;
|
|
22
|
+
const loadPdfLibrary = async () => {
|
|
23
|
+
if (isPdfLibraryLoaded)
|
|
24
|
+
return;
|
|
25
|
+
try {
|
|
26
|
+
const reactPdf = await import('react-pdf');
|
|
27
|
+
Document = reactPdf.Document;
|
|
28
|
+
Page = reactPdf.Page;
|
|
29
|
+
pdfjs = reactPdf.pdfjs;
|
|
30
|
+
pdfjs.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.mjs');
|
|
31
|
+
isPdfLibraryLoaded = true;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error('Failed to load react-pdf library:', error);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
21
37
|
const ErrorContent = ({ error, isAbortError, onRetry }) => {
|
|
22
38
|
if (isAbortError) {
|
|
23
39
|
return (_jsx(StyledAnimatedComponentOpacity, { style: { width: '100%', height: '100%' }, children: _jsxs(StyledPanelStatusContainer, { children: [_jsx(IconCloseOutline, { fontSize: 92, color: TMColors.error }), _jsxs(StyledPreviewNotAvailable, { children: [_jsx("div", { children: error }), _jsx("div", { children: SDKUI_Localizator.PreviewNotAvailable })] }), _jsx(TMButton, { caption: SDKUI_Localizator.TryAgain, onClick: onRetry, showTooltip: false })] }) }));
|
|
@@ -141,6 +157,7 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
|
141
157
|
const [formattedXml, setFormattedXml] = useState(undefined);
|
|
142
158
|
const [isMobile, setIsMobile] = useState(false);
|
|
143
159
|
const [numPages, setNumPages] = useState(0);
|
|
160
|
+
const [pdfLibraryLoading, setPdfLibraryLoading] = useState(false);
|
|
144
161
|
useEffect(() => {
|
|
145
162
|
const checkIsMobile = () => {
|
|
146
163
|
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
@@ -166,6 +183,12 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
|
166
183
|
window.removeEventListener('resize', checkIsMobile);
|
|
167
184
|
};
|
|
168
185
|
}, []);
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
if (isMobile && fileType === 'application/pdf' && !isPdfLibraryLoaded && !pdfLibraryLoading) {
|
|
188
|
+
setPdfLibraryLoading(true);
|
|
189
|
+
loadPdfLibrary().finally(() => setPdfLibraryLoading(false));
|
|
190
|
+
}
|
|
191
|
+
}, [isMobile, fileType, pdfLibraryLoading]);
|
|
169
192
|
useEffect(() => {
|
|
170
193
|
if (fileBlob) {
|
|
171
194
|
setFileType(fileBlob.type);
|
|
@@ -227,6 +250,16 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
|
|
|
227
250
|
return (_jsx(ImageViewer, { fileBlob: fileBlob, alt: '' }));
|
|
228
251
|
}
|
|
229
252
|
if (fileType === 'application/pdf' && isMobile) {
|
|
253
|
+
if (!isPdfLibraryLoaded || pdfLibraryLoading || !Document || !Page) {
|
|
254
|
+
return (_jsxs("div", { style: {
|
|
255
|
+
display: 'flex',
|
|
256
|
+
justifyContent: 'center',
|
|
257
|
+
alignItems: 'center',
|
|
258
|
+
height: '100%',
|
|
259
|
+
flexDirection: 'column',
|
|
260
|
+
gap: '10px'
|
|
261
|
+
}, children: [_jsx(IconPreview, { fontSize: 64 }), _jsxs("div", { children: [SDKUI_Localizator.Loading, "..."] })] }));
|
|
262
|
+
}
|
|
230
263
|
return (_jsx(PDFViewerContainer, { children: _jsx(Document, { file: blobUrl, onLoadSuccess: ({ numPages }) => setNumPages(numPages), loading: _jsxs("div", { style: {
|
|
231
264
|
display: 'flex',
|
|
232
265
|
justifyContent: 'center',
|
|
@@ -241,7 +241,7 @@ export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
|
241
241
|
if (dcmt === undefined || dtd === undefined) {
|
|
242
242
|
return {
|
|
243
243
|
cicoEnabled: false,
|
|
244
|
-
checkoutStatus: { isCheckedOut: false, mode: '', version: 1, icon: null }
|
|
244
|
+
checkoutStatus: { isCheckedOut: false, mode: '', version: 1, icon: null, editLockTooltipText: null }
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
247
|
// ========================================================================
|
|
@@ -312,7 +312,8 @@ export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
|
312
312
|
isCheckedOut: false,
|
|
313
313
|
mode: '',
|
|
314
314
|
version: version,
|
|
315
|
-
icon: null
|
|
315
|
+
icon: null,
|
|
316
|
+
editLockTooltipText: null
|
|
316
317
|
};
|
|
317
318
|
// Verifica se il documento è effettivamente in stato di checkout
|
|
318
319
|
if (userID && checkoutUserId && !isNaN(checkoutUserId) && checkoutUserId > 0) {
|
|
@@ -332,7 +333,8 @@ export const getDcmtCicoStatus = (dcmt, allUsers, dtd) => {
|
|
|
332
333
|
isCheckedOut: true,
|
|
333
334
|
mode: mode,
|
|
334
335
|
icon: icon,
|
|
335
|
-
version: version
|
|
336
|
+
version: version,
|
|
337
|
+
editLockTooltipText: editLockTooltipText
|
|
336
338
|
};
|
|
337
339
|
}
|
|
338
340
|
// ========================================================================
|
|
@@ -328,6 +328,18 @@ export const searchResultToMetadataValues = (tid, dtd, rows, mids, metadata, lay
|
|
|
328
328
|
mvd.customName = SDKUI_Localizator.Author;
|
|
329
329
|
mvd.isReadOnly = true;
|
|
330
330
|
break;
|
|
331
|
+
case ChronologyMIDs.CheckInTime:
|
|
332
|
+
mvd.customName = SDKUI_Localizator.LastUpdateTime;
|
|
333
|
+
mvd.isReadOnly = true;
|
|
334
|
+
break;
|
|
335
|
+
case SystemMIDsAsNumber.FileExt:
|
|
336
|
+
mvd.customName = SDKUI_Localizator.Extension;
|
|
337
|
+
mvd.isReadOnly = true;
|
|
338
|
+
break;
|
|
339
|
+
case SystemMIDsAsNumber.FileSize:
|
|
340
|
+
mvd.customName = SDKUI_Localizator.File_Size;
|
|
341
|
+
mvd.isReadOnly = true;
|
|
342
|
+
break;
|
|
331
343
|
}
|
|
332
344
|
}
|
|
333
345
|
return mvd;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topconsultnpm/sdkui-react",
|
|
3
|
-
"version": "6.20.0-dev1.
|
|
3
|
+
"version": "6.20.0-dev1.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"lib"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@topconsultnpm/sdk-ts": "6.20.0-dev1.
|
|
42
|
+
"@topconsultnpm/sdk-ts": "6.20.0-dev1.2",
|
|
43
43
|
"buffer": "^6.0.3",
|
|
44
44
|
"devextreme": "25.1.7",
|
|
45
45
|
"devextreme-react": "25.1.7",
|