@topconsultnpm/sdkui-react 6.20.0-dev1.20 → 6.20.0-dev1.22
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.js +1 -1
- package/lib/components/NewComponents/ContextMenu/types.d.ts +1 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +35 -27
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +5 -4
- package/lib/components/features/documents/TMDcmtForm.js +54 -76
- package/lib/components/features/documents/TMDcmtPreview.js +6 -5
- package/lib/components/features/search/TMSearchQueryPanel.js +13 -12
- package/lib/components/features/search/TMSearchResult.js +35 -11
- package/lib/components/features/search/TMSearchResultsMenuItems.js +0 -1
- package/lib/helper/SDKUI_Globals.d.ts +10 -0
- package/lib/helper/SDKUI_Globals.js +9 -0
- package/package.json +1 -1
|
@@ -173,7 +173,7 @@ const TMContextMenu = ({ items, trigger = 'right', children }) => {
|
|
|
173
173
|
// if (item.disabled) return;
|
|
174
174
|
item.onRightIconClick?.();
|
|
175
175
|
};
|
|
176
|
-
return (_jsxs(S.MenuItem, { "$disabled": item.disabled, "$hasSubmenu": !!item.submenu && item.submenu.length > 0, "$beginGroup": item.beginGroup, onMouseDown: handleClick, onMouseEnter: (e) => !isMobile && handleMouseEnter(item, e, depth + 1), onMouseLeave: () => !isMobile && handleMouseLeave(depth + 1), children: [_jsxs(S.MenuItemContent, { children: [item.icon && _jsx(S.IconWrapper, { children: item.icon }), _jsx(S.MenuItemName, { children: item.name })] }), item.rightIcon && item.onRightIconClick && (_jsx(S.RightIconButton, { onClick: handleRightIconClick, onMouseDown: (e) => e.stopPropagation(), "aria-label": `Action for ${item.name}`, children: item.rightIcon })), item.submenu && item.submenu.length > 0 && (_jsx(S.SubmenuIndicator, { "$isMobile": isMobile, children: isMobile ? '›' : '▸' }))] }, itemKey));
|
|
176
|
+
return (_jsxs(S.MenuItem, { "$disabled": item.disabled, "$hasSubmenu": !!item.submenu && item.submenu.length > 0, "$beginGroup": item.beginGroup, onMouseDown: handleClick, onMouseEnter: (e) => !isMobile && handleMouseEnter(item, e, depth + 1), onMouseLeave: () => !isMobile && handleMouseLeave(depth + 1), title: item.tooltip, children: [_jsxs(S.MenuItemContent, { children: [item.icon && _jsx(S.IconWrapper, { children: item.icon }), _jsx(S.MenuItemName, { children: item.name })] }), item.rightIcon && item.onRightIconClick && (_jsx(S.RightIconButton, { onClick: handleRightIconClick, onMouseDown: (e) => e.stopPropagation(), "aria-label": `Action for ${item.name}`, children: item.rightIcon })), item.submenu && item.submenu.length > 0 && (_jsx(S.SubmenuIndicator, { "$isMobile": isMobile, children: isMobile ? '›' : '▸' }))] }, itemKey));
|
|
177
177
|
});
|
|
178
178
|
};
|
|
179
179
|
const currentMenu = menuState.submenuStack.at(-1) || items;
|
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
3
|
import { ContextMenu } from '../ContextMenu';
|
|
4
|
-
import
|
|
4
|
+
import ShowAlert from '../../base/TMAlert';
|
|
5
5
|
import TMTooltip from '../../base/TMTooltip';
|
|
6
6
|
import * as S from './styles';
|
|
7
|
-
import { IconApply, IconMenuKebab, IconMenuVertical, IconPencil, IconPin } from '../../../helper';
|
|
7
|
+
import { IconApply, IconMenuKebab, IconMenuVertical, IconPencil, IconPin, SDKUI_Globals } from '../../../helper';
|
|
8
8
|
const IconDraggableDots = (props) => (_jsx("svg", { fontSize: 18, viewBox: "0 0 24 24", fill: "currentColor", height: "1em", width: "1em", ...props, children: _jsx("path", { d: "M9 3a2 2 0 11-4 0 2 2 0 014 0zm0 9a2 2 0 11-4 0 2 2 0 014 0zm0 9a2 2 0 11-4 0 2 2 0 014 0zm10-18a2 2 0 11-4 0 2 2 0 014 0zm0 9a2 2 0 11-4 0 2 2 0 014 0zm0 9a2 2 0 11-4 0 2 2 0 014 0z" }) }));
|
|
9
|
-
const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], storageKey = 'floatingMenuBar-config',
|
|
9
|
+
const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], storageKey = 'floatingMenuBar-config', // Kept for backward compatibility but not used
|
|
10
|
+
isConstrained = false, defaultPosition = { x: 100, y: 100 }, maxItems = 8, }) => {
|
|
10
11
|
const loadConfig = () => {
|
|
11
12
|
try {
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const settings = SDKUI_Globals.userSettings.searchSettings.floatingMenuBar;
|
|
14
|
+
// Check if position was actually saved (not just the default class value)
|
|
15
|
+
const hasSavedPosition = settings.position &&
|
|
16
|
+
(settings.position.x !== 100 || settings.position.y !== 100 ||
|
|
17
|
+
(settings.itemIds && settings.itemIds.length > 0));
|
|
18
|
+
return {
|
|
19
|
+
orientation: settings.orientation || 'horizontal',
|
|
20
|
+
pinnedItemIds: new Set(settings.pinnedItemIds || []),
|
|
21
|
+
savedItemIds: settings.itemIds || [],
|
|
22
|
+
position: hasSavedPosition ? settings.position : defaultPosition,
|
|
23
|
+
};
|
|
21
24
|
}
|
|
22
25
|
catch (error) {
|
|
23
26
|
console.error('Failed to load FloatingMenuBar config:', error);
|
|
27
|
+
return {
|
|
28
|
+
orientation: 'horizontal',
|
|
29
|
+
pinnedItemIds: new Set(),
|
|
30
|
+
savedItemIds: [],
|
|
31
|
+
position: defaultPosition,
|
|
32
|
+
};
|
|
24
33
|
}
|
|
25
|
-
return {
|
|
26
|
-
orientation: 'horizontal',
|
|
27
|
-
pinnedItemIds: new Set(),
|
|
28
|
-
savedItemIds: [],
|
|
29
|
-
};
|
|
30
34
|
};
|
|
31
35
|
const initialConfig = loadConfig();
|
|
32
36
|
const [state, setState] = useState({
|
|
33
|
-
position:
|
|
37
|
+
position: initialConfig.position,
|
|
34
38
|
isDragging: false,
|
|
35
39
|
isConfigMode: false,
|
|
36
40
|
orientation: initialConfig.orientation,
|
|
@@ -41,7 +45,6 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], storageKey = '
|
|
|
41
45
|
const dragOffset = useRef({ x: 0, y: 0 });
|
|
42
46
|
const [pinnedItemIds, setPinnedItemIds] = useState(initialConfig.pinnedItemIds);
|
|
43
47
|
const [dragOverIndex, setDragOverIndex] = useState(null);
|
|
44
|
-
const [showMaxItemsNotification, setShowMaxItemsNotification] = useState(false);
|
|
45
48
|
// Use refs to track item IDs without causing re-renders
|
|
46
49
|
const floatingBarItemIds = useRef(new Set());
|
|
47
50
|
const floatingBarItemNames = useRef(new Set());
|
|
@@ -98,8 +101,12 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], storageKey = '
|
|
|
98
101
|
else {
|
|
99
102
|
// Add to floating bar
|
|
100
103
|
if (s.items.length >= maxItems) {
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
ShowAlert({
|
|
105
|
+
mode: 'warning',
|
|
106
|
+
title: 'Limite Massimo Raggiunto',
|
|
107
|
+
message: `Hai raggiunto il massimo di ${maxItems} elementi. Rimuovine uno prima di aggiungerne altri.`,
|
|
108
|
+
duration: 4000,
|
|
109
|
+
});
|
|
103
110
|
return s;
|
|
104
111
|
}
|
|
105
112
|
return { ...s, items: [...s.items, item] };
|
|
@@ -229,20 +236,21 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], storageKey = '
|
|
|
229
236
|
}
|
|
230
237
|
return undefined;
|
|
231
238
|
}, [state.isDragging, handleMouseMove, handleMouseUp]);
|
|
232
|
-
// Save to
|
|
239
|
+
// Save to SDKUI_Globals.userSettings whenever config changes (including position)
|
|
233
240
|
useEffect(() => {
|
|
234
241
|
try {
|
|
235
|
-
|
|
242
|
+
// Replace the entire object to trigger the Proxy
|
|
243
|
+
SDKUI_Globals.userSettings.searchSettings.floatingMenuBar = {
|
|
236
244
|
orientation: state.orientation,
|
|
237
245
|
pinnedItemIds: Array.from(pinnedItemIds),
|
|
238
|
-
itemIds: state.items.map(item => item.id),
|
|
246
|
+
itemIds: state.items.map(item => item.id),
|
|
247
|
+
position: state.position,
|
|
239
248
|
};
|
|
240
|
-
localStorage.setItem(storageKey, JSON.stringify(config));
|
|
241
249
|
}
|
|
242
250
|
catch (error) {
|
|
243
251
|
console.error('Failed to save FloatingMenuBar config:', error);
|
|
244
252
|
}
|
|
245
|
-
}, [state.orientation, state.items,
|
|
253
|
+
}, [state.orientation, state.items, state.position, pinnedItemIds]);
|
|
246
254
|
const toggleConfigMode = () => {
|
|
247
255
|
setState(s => ({ ...s, isConfigMode: !s.isConfigMode }));
|
|
248
256
|
};
|
|
@@ -365,6 +373,6 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], storageKey = '
|
|
|
365
373
|
currentOnClick();
|
|
366
374
|
}
|
|
367
375
|
}, disabled: isDisabled, children: item.icon }) })), state.isConfigMode && (_jsx(S.RemoveButton, { onClick: () => removeItem(item.id), children: "\u00D7" }))] }, item.id));
|
|
368
|
-
}), !state.isConfigMode && contextMenuItems.length > 0 && (_jsx(ContextMenu, { items: enhancedContextMenuItems(), trigger: "left", children: _jsx(S.ContextMenuButton, { children: _jsx(IconMenuVertical, {}) }) }, Array.from(pinnedItemIds).join(','))), _jsx(S.ConfigButton, { onClick: toggleConfigMode, "$isActive": state.isConfigMode, children: state.isConfigMode ? _jsx(IconApply, {}) : _jsx(IconPencil, {}) }), !state.isConfigMode && (_jsx(S.OrientationToggle, { "$orientation": state.orientation, onClick: toggleOrientation, children: _jsx(IconMenuKebab, {}) }))] })
|
|
376
|
+
}), !state.isConfigMode && contextMenuItems.length > 0 && (_jsx(ContextMenu, { items: enhancedContextMenuItems(), trigger: "left", children: _jsx(S.ContextMenuButton, { children: _jsx(IconMenuVertical, {}) }) }, Array.from(pinnedItemIds).join(','))), _jsx(S.ConfigButton, { onClick: toggleConfigMode, "$isActive": state.isConfigMode, children: state.isConfigMode ? _jsx(IconApply, {}) : _jsx(IconPencil, {}) }), !state.isConfigMode && (_jsx(S.OrientationToggle, { "$orientation": state.orientation, onClick: toggleOrientation, children: _jsx(IconMenuKebab, {}) }))] })] }));
|
|
369
377
|
};
|
|
370
378
|
export default TMFloatingMenuBar;
|
|
@@ -187,25 +187,26 @@ export const RemoveButton = styled.button `
|
|
|
187
187
|
width: 20px;
|
|
188
188
|
height: 20px;
|
|
189
189
|
background: #ef4444;
|
|
190
|
-
border:
|
|
190
|
+
border: none;
|
|
191
191
|
border-radius: 50%;
|
|
192
192
|
color: white;
|
|
193
|
-
font-size:
|
|
193
|
+
font-size: 14px;
|
|
194
194
|
font-weight: bold;
|
|
195
|
+
line-height: 1;
|
|
195
196
|
cursor: pointer;
|
|
196
197
|
display: flex;
|
|
197
198
|
align-items: center;
|
|
198
199
|
justify-content: center;
|
|
200
|
+
padding: 0;
|
|
199
201
|
transition: all 0.2s ease;
|
|
200
202
|
z-index: 1;
|
|
201
203
|
|
|
202
204
|
&:hover {
|
|
203
205
|
background: #dc2626;
|
|
204
|
-
transform: scale(1.15);
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
&:active {
|
|
208
|
-
|
|
209
|
+
background: #b91c1c;
|
|
209
210
|
}
|
|
210
211
|
`;
|
|
211
212
|
export const OrientationToggle = styled.button `
|
|
@@ -2,14 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import TMDcmtPreview from './TMDcmtPreview';
|
|
4
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
|
-
import { ContextMenu } from 'devextreme-react';
|
|
6
5
|
import { WorkFlowApproveRejectPopUp, WorkFlowMoreInfoPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
|
|
7
6
|
import { DownloadTypes, FormModes, DcmtOperationTypes } from '../../../ts';
|
|
8
7
|
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
9
8
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
10
9
|
import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
|
|
11
10
|
import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
|
|
12
|
-
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts,
|
|
11
|
+
import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare, IconCheck, IconActivity, TMImageLibrary, IconStar, IconRelation, IconInfo, IconArchiveDoc, IconDelete, IconPair, IconUnpair, IconArchiveMaster, IconArchiveDetail, getDcmtCicoStatus, IconFileDots } from '../../../helper';
|
|
13
12
|
import { hasDetailRelations, hasMasterRelations, isXMLFileExt } from '../../../helper/dcmtsHelper';
|
|
14
13
|
import { Gutters, TMColors } from '../../../utils/theme';
|
|
15
14
|
import { StyledFormButtonsContainer, StyledLoadingContainer, StyledModalContainer, StyledReferenceButton, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
|
|
@@ -46,6 +45,7 @@ import { useCheckInOutOperations } from '../../../hooks/useCheckInOutOperations'
|
|
|
46
45
|
import TMViewHistoryDcmt from '../search/TMViewHistoryDcmt';
|
|
47
46
|
import TMDcmtCheckoutInfoForm from '../search/TMDcmtCheckoutInfoForm';
|
|
48
47
|
import styled from 'styled-components';
|
|
48
|
+
import { ContextMenu } from '../../NewComponents/ContextMenu';
|
|
49
49
|
let abortControllerLocal = new AbortController();
|
|
50
50
|
//#endregion
|
|
51
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, }) => {
|
|
@@ -544,23 +544,20 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
544
544
|
const items = [];
|
|
545
545
|
const operationsItems = [];
|
|
546
546
|
operationsItems.push({
|
|
547
|
-
icon:
|
|
548
|
-
operationType: 'singleRow',
|
|
547
|
+
icon: _jsx(IconDownload, {}),
|
|
549
548
|
disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes,
|
|
550
|
-
|
|
549
|
+
name: SDKUI_Localizator.DownloadFile,
|
|
551
550
|
onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Dcmt, "download", undefined, undefined, true)
|
|
552
551
|
}, {
|
|
553
|
-
icon:
|
|
554
|
-
operationType: 'singleRow',
|
|
552
|
+
icon: _jsx(IconDownload, {}),
|
|
555
553
|
disabled: !isXMLFileExt(currentDcmt?.fileExt),
|
|
556
|
-
|
|
554
|
+
name: SDKUI_Localizator.DownloadXMLAttachments,
|
|
557
555
|
onClick: async () => await downloadDcmtsAsync(getDcmts(), DownloadTypes.Attachment, "download", undefined, openConfirmAttachmentsDialog, true)
|
|
558
556
|
});
|
|
559
557
|
if (layoutMode === LayoutModes.Update && DID) {
|
|
560
558
|
operationsItems.push({
|
|
561
|
-
icon:
|
|
562
|
-
|
|
563
|
-
operationType: 'singleRow',
|
|
559
|
+
icon: _jsx(IconStar, {}),
|
|
560
|
+
name: SDKUI_Localizator.AddTo + ' ' + SDKUI_Localizator.Favorites,
|
|
564
561
|
disabled: false,
|
|
565
562
|
onClick: async () => {
|
|
566
563
|
await runOperationAsync(getDcmts(), DcmtOperationTypes.AddToFavs);
|
|
@@ -569,9 +566,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
569
566
|
}
|
|
570
567
|
if (onTaskCreateRequest && layoutMode === LayoutModes.Update && DID) {
|
|
571
568
|
operationsItems.push({
|
|
572
|
-
icon:
|
|
573
|
-
|
|
574
|
-
operationType: 'singleRow',
|
|
569
|
+
icon: _jsx(IconActivity, {}),
|
|
570
|
+
name: SDKUI_Localizator.CreateContextualTask,
|
|
575
571
|
disabled: false,
|
|
576
572
|
onClick: () => {
|
|
577
573
|
const dcmt = getDcmts()[0];
|
|
@@ -588,52 +584,46 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
588
584
|
}
|
|
589
585
|
if (operationsItems.length > 0) {
|
|
590
586
|
items.push({
|
|
591
|
-
icon:
|
|
592
|
-
|
|
593
|
-
|
|
587
|
+
icon: _jsx(IconCheck, {}),
|
|
588
|
+
name: SDKUI_Localizator.DocumentOperations,
|
|
589
|
+
submenu: operationsItems
|
|
594
590
|
});
|
|
595
591
|
}
|
|
596
592
|
if (fromDTD?.id !== SystemTIDs.Drafts) {
|
|
597
593
|
// Check in/Check out menu
|
|
598
594
|
const { cicoEnabled, checkoutStatus } = getDcmtCicoStatus(formData, allUsers, fromDTD);
|
|
599
595
|
items.push({
|
|
600
|
-
icon:
|
|
601
|
-
|
|
596
|
+
icon: _jsx(IconFileDots, {}),
|
|
597
|
+
name: "Check in/Check out",
|
|
602
598
|
disabled: false,
|
|
603
|
-
|
|
599
|
+
submenu: [
|
|
604
600
|
{
|
|
605
|
-
|
|
606
|
-
text: 'Check out',
|
|
601
|
+
name: 'Check out',
|
|
607
602
|
disabled: !cicoEnabled || checkoutStatus.isCheckedOut,
|
|
608
603
|
onClick: () => handleCheckOutOperationCallback(true),
|
|
609
604
|
},
|
|
610
605
|
{
|
|
611
|
-
|
|
612
|
-
text: 'Check in',
|
|
606
|
+
name: 'Check in',
|
|
613
607
|
onClick: () => handleCheckInOperationCallback(),
|
|
614
608
|
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode'
|
|
615
609
|
},
|
|
616
610
|
{
|
|
617
|
-
|
|
618
|
-
text: SDKUI_Localizator.CancelCheckOut,
|
|
611
|
+
name: SDKUI_Localizator.CancelCheckOut,
|
|
619
612
|
disabled: !cicoEnabled || !checkoutStatus.isCheckedOut || checkoutStatus.mode === 'lockMode',
|
|
620
613
|
onClick: () => handleCheckOutOperationCallback(false),
|
|
621
614
|
},
|
|
622
615
|
{
|
|
623
|
-
|
|
624
|
-
text: SDKUI_Localizator.CheckoutInfo,
|
|
616
|
+
name: SDKUI_Localizator.CheckoutInfo,
|
|
625
617
|
onClick: showCheckoutInformationFormCallback,
|
|
626
618
|
disabled: !checkoutStatus.isCheckedOut
|
|
627
619
|
},
|
|
628
620
|
{
|
|
629
|
-
|
|
630
|
-
text: SDKUI_Localizator.CopyCheckoutPath,
|
|
621
|
+
name: SDKUI_Localizator.CopyCheckoutPath,
|
|
631
622
|
onClick: copyCheckoutPathToClipboardOperationCallback,
|
|
632
623
|
disabled: !checkoutStatus.isCheckedOut
|
|
633
624
|
},
|
|
634
625
|
{
|
|
635
|
-
|
|
636
|
-
text: SDKUI_Localizator.History,
|
|
626
|
+
name: SDKUI_Localizator.History,
|
|
637
627
|
disabled: !cicoEnabled,
|
|
638
628
|
onClick: showHistoryCallback,
|
|
639
629
|
},
|
|
@@ -643,68 +633,57 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
643
633
|
if (allowRelations && layoutMode === LayoutModes.Update && DID) {
|
|
644
634
|
const relationsItems = [
|
|
645
635
|
{
|
|
646
|
-
icon:
|
|
647
|
-
|
|
648
|
-
operationType: 'singleRow',
|
|
636
|
+
icon: _jsx(IconPair, {}),
|
|
637
|
+
name: SDKUI_Localizator.MatchManyDocumentsManyToMany,
|
|
649
638
|
disabled: !hasManyToManyRelation,
|
|
650
639
|
onClick: async () => await pairManyToMany?.(true)
|
|
651
640
|
},
|
|
652
641
|
{
|
|
653
|
-
icon:
|
|
654
|
-
|
|
655
|
-
operationType: 'singleRow',
|
|
642
|
+
icon: _jsx(IconUnpair, {}),
|
|
643
|
+
name: SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
|
|
656
644
|
disabled: !hasManyToManyRelation,
|
|
657
645
|
onClick: async () => await pairManyToMany?.(false)
|
|
658
646
|
},
|
|
659
647
|
{
|
|
660
|
-
icon:
|
|
661
|
-
|
|
662
|
-
operationType: 'singleRow',
|
|
663
|
-
beginGroup: true,
|
|
648
|
+
icon: _jsx(IconArchiveMaster, {}),
|
|
649
|
+
name: SDKUI_Localizator.ArchiveMasterDocument,
|
|
664
650
|
disabled: canArchiveMasterRelation !== true,
|
|
665
651
|
onClick: async () => { if (TID)
|
|
666
652
|
await archiveMasterDocuments?.(TID); }
|
|
667
653
|
},
|
|
668
654
|
{
|
|
669
|
-
icon:
|
|
670
|
-
|
|
671
|
-
operationType: 'singleRow',
|
|
655
|
+
icon: _jsx(IconArchiveDetail, {}),
|
|
656
|
+
name: SDKUI_Localizator.ArchiveDetailDocument,
|
|
672
657
|
disabled: canArchiveDetailRelation !== true,
|
|
673
658
|
onClick: async () => { if (TID)
|
|
674
659
|
await archiveDetailDocuments?.(TID); }
|
|
675
660
|
},
|
|
676
661
|
{
|
|
677
|
-
icon:
|
|
678
|
-
|
|
679
|
-
operationType: 'singleRow',
|
|
680
|
-
visible: true,
|
|
681
|
-
beginGroup: true,
|
|
662
|
+
icon: _jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' }),
|
|
663
|
+
name: SDKUI_Localizator.DcmtsMaster,
|
|
682
664
|
disabled: !currentTIDHasMasterRelations || isMasterDisabled,
|
|
683
665
|
onClick: () => { if (!isMasterDisabled)
|
|
684
666
|
setIsOpenMaster(!isOpenMaster); }
|
|
685
667
|
},
|
|
686
668
|
{
|
|
687
|
-
icon:
|
|
688
|
-
|
|
689
|
-
operationType: 'singleRow',
|
|
669
|
+
icon: _jsx(IconDetailDcmts, {}),
|
|
670
|
+
name: SDKUI_Localizator.DcmtsDetail,
|
|
690
671
|
disabled: !currentTIDHasDetailRelations || isDetailsDisabled,
|
|
691
|
-
visible: true,
|
|
692
672
|
onClick: () => { if (!isDetailsDisabled)
|
|
693
673
|
setIsOpenDetails(!isOpenDetails); }
|
|
694
674
|
}
|
|
695
675
|
];
|
|
696
676
|
items.push({
|
|
697
|
-
icon:
|
|
698
|
-
|
|
699
|
-
|
|
677
|
+
icon: _jsx(IconRelation, {}),
|
|
678
|
+
name: SDKUI_Localizator.Relations,
|
|
679
|
+
submenu: relationsItems
|
|
700
680
|
});
|
|
701
681
|
}
|
|
702
682
|
if (layoutMode === LayoutModes.Update && DID) {
|
|
703
683
|
const fullTextItems = [
|
|
704
684
|
{
|
|
705
|
-
icon:
|
|
706
|
-
|
|
707
|
-
operationType: 'singleRow',
|
|
685
|
+
icon: _jsx(IconInfo, {}),
|
|
686
|
+
name: SDKUI_Localizator.IndexingInformation,
|
|
708
687
|
disabled: false,
|
|
709
688
|
onClick: async () => {
|
|
710
689
|
try {
|
|
@@ -722,18 +701,16 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
722
701
|
}
|
|
723
702
|
},
|
|
724
703
|
{
|
|
725
|
-
icon:
|
|
726
|
-
|
|
727
|
-
operationType: 'singleRow',
|
|
704
|
+
icon: _jsx(IconArchiveDoc, {}),
|
|
705
|
+
name: SDKUI_Localizator.IndexOrReindex,
|
|
728
706
|
disabled: false,
|
|
729
707
|
onClick: async () => {
|
|
730
708
|
await runOperationAsync(getDcmts(), DcmtOperationTypes.FreeSearchReindex);
|
|
731
709
|
}
|
|
732
710
|
},
|
|
733
711
|
{
|
|
734
|
-
icon:
|
|
735
|
-
|
|
736
|
-
operationType: 'singleRow',
|
|
712
|
+
icon: _jsx(IconDelete, {}),
|
|
713
|
+
name: SDKUI_Localizator.IndexingDelete,
|
|
737
714
|
disabled: false,
|
|
738
715
|
onClick: async () => {
|
|
739
716
|
await runOperationAsync(getDcmts(), DcmtOperationTypes.FreeSearchPurge);
|
|
@@ -741,9 +718,9 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
741
718
|
}
|
|
742
719
|
];
|
|
743
720
|
items.push({
|
|
744
|
-
icon:
|
|
745
|
-
|
|
746
|
-
|
|
721
|
+
icon: _jsx(IconSearch, {}),
|
|
722
|
+
name: SDKUI_Localizator.FullTextSearch,
|
|
723
|
+
submenu: fullTextItems
|
|
747
724
|
});
|
|
748
725
|
}
|
|
749
726
|
// Aggiungi submenu "Bottoni personalizzati" se esistono customButtons
|
|
@@ -751,14 +728,14 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
751
728
|
const customButtonsItems = customButtonsLayout.customButtons
|
|
752
729
|
.filter((customButton) => customButton.isForUpdate && customButton.isForUpdate > 0)
|
|
753
730
|
.map((customButton) => ({
|
|
754
|
-
icon:
|
|
755
|
-
|
|
731
|
+
icon: TMImageLibrary({ imageID: customButton.glyphID, showPath: false }),
|
|
732
|
+
name: customButton.title || 'Bottone personalizzato',
|
|
756
733
|
onClick: () => setCustomButton(customButton)
|
|
757
734
|
}));
|
|
758
735
|
items.push({
|
|
759
|
-
icon:
|
|
760
|
-
|
|
761
|
-
|
|
736
|
+
icon: _jsx(IconCheck, {}),
|
|
737
|
+
name: SDKUI_Localizator.CustomButtons,
|
|
738
|
+
submenu: customButtonsItems
|
|
762
739
|
});
|
|
763
740
|
}
|
|
764
741
|
return items;
|
|
@@ -789,8 +766,9 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
|
|
|
789
766
|
openConfirmAttachmentsDialog
|
|
790
767
|
]);
|
|
791
768
|
const isModified = useMemo(() => calcIsModified(formData, formDataOrig), [formData, formDataOrig]);
|
|
792
|
-
const formToolbar = useMemo(() => _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowNavigation && canPrev != undefined && _jsx("p", { style: { textAlign: 'center', padding: '1px 4px', display: 'flex' }, children: `${itemIndex}/${count}` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: isModified, formMode: formMode, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: isModified, formMode: formMode, canNext: canNext, onNext: onNext }), layoutMode === LayoutModes.Update &&
|
|
793
|
-
_jsx(
|
|
769
|
+
const formToolbar = useMemo(() => _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '10px' }, children: [allowNavigation && canPrev != undefined && _jsx("p", { style: { textAlign: 'center', padding: '1px 4px', display: 'flex' }, children: `${itemIndex}/${count}` }), allowNavigation && canPrev != undefined && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', iconColor: 'white', isModified: isModified, formMode: formMode, canPrev: canPrev, onPrev: onPrev }), allowNavigation && canNext != undefined && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', iconColor: 'white', isModified: isModified, formMode: formMode, canNext: canNext, onNext: onNext }), layoutMode === LayoutModes.Update &&
|
|
770
|
+
_jsx(ContextMenu, { items: commandsMenuItems, trigger: "left", children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) }), layoutMode === LayoutModes.Ark &&
|
|
771
|
+
_jsx(TMTooltip, { content: SDKUI_Localizator.PassToSearch, position: 'bottom', children: _jsx(IconSearch, { style: { cursor: 'pointer' }, onClick: handlePassToSearch }) })] }), [allowNavigation, canPrev, canNext, itemIndex, count, isModified, formMode, onPrev, onNext, layoutMode, commandsMenuItems, handlePassToSearch]);
|
|
794
772
|
const handleUndo = useCallback(() => {
|
|
795
773
|
setFormData(structuredClone(formDataOrig));
|
|
796
774
|
}, [formDataOrig]);
|
|
@@ -8,13 +8,13 @@ import { FileExtensionHandler, FormModes } from '../../../ts';
|
|
|
8
8
|
import { TMColors } from '../../../utils/theme';
|
|
9
9
|
import ShowAlert from '../../base/TMAlert';
|
|
10
10
|
import TMButton from '../../base/TMButton';
|
|
11
|
-
import TMDropDownMenu from '../../base/TMDropDownMenu';
|
|
12
11
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
13
12
|
import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
|
|
14
13
|
import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSaveForm';
|
|
15
14
|
import { StyledAnimatedComponentOpacity } from '../../base/Styled';
|
|
16
15
|
import TMPanel from '../../base/TMPanel';
|
|
17
16
|
import TMTooltip from '../../base/TMTooltip';
|
|
17
|
+
import { ContextMenu } from '../../NewComponents/ContextMenu';
|
|
18
18
|
let Document = null;
|
|
19
19
|
let Page = null;
|
|
20
20
|
let pdfjs = null;
|
|
@@ -153,10 +153,11 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
|
|
|
153
153
|
console.error('Error reopening document:', error);
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
const cacheMenuItems = useMemo(() => [
|
|
157
|
+
{ icon: _jsx(IconCloseCircle, {}), name: SDKUI_Localizator.RemoveFromCache, onClick: () => { removeDcmtsFileCache(cacheKey); setIsFromCache(false); } },
|
|
158
|
+
{ icon: _jsx(IconClear, {}), name: SDKUI_Localizator.ClearCache, onClick: () => { clearDcmtsFileCache(); setIsFromCache(false); } },
|
|
159
|
+
], [cacheKey, removeDcmtsFileCache, clearDcmtsFileCache, setIsFromCache]);
|
|
160
|
+
return (_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(TMPanel, { padding: '0', title: titleHandler(), onClose: onClosePanel, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, toolbar: _jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: '10px' }, children: [onPrev && _jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canPrev: canPrev, onPrev: onPrev }), onNext && _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', isModified: false, formMode: FormModes.ReadOnly, canNext: canNext, onNext: onNext }), _jsx(StyledHeaderIcon, { "$color": TMColors.primaryColor, children: _jsx(ContextMenu, { items: cacheMenuItems, trigger: "left", children: _jsx(IconMenuVertical, {}) }) }), _jsx(StyledHeaderIcon, { onClick: reOpenDcmt, "$color": TMColors.primaryColor, children: _jsx(TMTooltip, { content: SDKUI_Localizator.ReopenDocument, children: _jsx(IconRefresh, {}) }) })] }), children: error
|
|
160
161
|
? _jsx(ErrorContent, { error: error, isAbortError: isAbortError, onRetry: reOpenDcmt })
|
|
161
162
|
: renderedPreview(dcmtData?.tid, dcmtData?.did, dcmtData?.fileExt, dcmtData?.fileSize, dcmtData?.fileCount, extensionHandler(dcmtData?.fileExt), showPreview, isResizingActive, () => { loadDocumentWithCache(); setShowPreview(true); }, dcmtBlob) }) }));
|
|
162
163
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { PlatformObjectValidator, WhereItem, SDK_Localizator, OrderByItem, SelectItem, SelectItemVisibilities, SDK_Globals, SavedQueryCacheService, SearchEngine, QueryOperators } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import TMSearchQueryEditor from './TMSearchQueryEditor';
|
|
@@ -11,7 +11,6 @@ import { StyledModalContainer } from '../../base/Styled';
|
|
|
11
11
|
import ShowAlert from '../../base/TMAlert';
|
|
12
12
|
import TMButton from '../../base/TMButton';
|
|
13
13
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
|
14
|
-
import TMDropDownMenu from '../../base/TMDropDownMenu';
|
|
15
14
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
16
15
|
import TMSpinner from '../../base/TMSpinner';
|
|
17
16
|
import TMPanel from '../../base/TMPanel';
|
|
@@ -19,6 +18,7 @@ import TMDistinctValues from '../../choosers/TMDistinctValues';
|
|
|
19
18
|
import { TMMetadataChooserForm } from '../../choosers/TMMetadataChooser';
|
|
20
19
|
import TMQueryEditor from '../../query/TMQueryEditor';
|
|
21
20
|
import TMSavedQueryForm from './TMSavedQueryForm';
|
|
21
|
+
import { ContextMenu } from '../../NewComponents/ContextMenu';
|
|
22
22
|
import { AdvancedMenuButtons } from '../../editors/TMMetadataValues';
|
|
23
23
|
import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
24
24
|
const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, inputMids, onSearchCompleted, onSqdSaved, onBack, onClosePanel, allowMaximize = true, onMaximizePanel, onBackToResult, passToArchiveCallback }) => {
|
|
@@ -299,20 +299,21 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
299
299
|
}
|
|
300
300
|
setQd({ ...qd, orderBy: newOrderBy });
|
|
301
301
|
}, [qd, fromDTD?.metadata, SQD?.masterTID]);
|
|
302
|
+
const contextMenuItems = useMemo(() => [
|
|
303
|
+
...(showBackToResultButton ? [{ icon: _jsx(IconArrowRight, {}), name: "Vai a risultato", onClick: () => { onBackToResult?.(); } }] : []),
|
|
304
|
+
{ icon: _jsx(IconAddCircleOutline, {}), name: SDKUI_Localizator.SavedQueryNew, beginGroup: showBackToResultButton, onClick: () => { openSqdForm(FormModes.Create); } },
|
|
305
|
+
{ icon: _jsx(IconEdit, {}), name: SDKUI_Localizator.SavedQueryUpdate, disabled: (SQD && SQD.id == 1), onClick: () => { openSqdForm(FormModes.Update); } },
|
|
306
|
+
{ icon: showAdvancedSearch ? _jsx(IconEasy, {}) : _jsx(IconAdvanced, {}), beginGroup: true, name: showAdvancedSearch ? SDKUI_Localizator.Search_Easy : SDKUI_Localizator.Search_Advanced, onClick: () => { changeAdvancedSearchAsync(!showAdvancedSearch); } },
|
|
307
|
+
{ icon: _jsx(IconEdit, {}), name: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryWhere}`, beginGroup: true, onClick: () => { setShowFiltersConfig(true); } },
|
|
308
|
+
{ icon: _jsx(IconEdit, {}), name: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QuerySelect}`, onClick: () => { setShowOutputConfig(true); } },
|
|
309
|
+
{ icon: _jsx(IconEdit, {}), name: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryOrderBy}`, onClick: () => { setShowOrderByConfig(true); } },
|
|
310
|
+
{ icon: _jsx(IconMenuCAArchive, { viewBox: '11 11.5 26 27', fontSize: 16, strokeWidth: 2, color: 'black' }), beginGroup: true, name: SDKUI_Localizator.PassToArchive, onClick: handlePassToArchive }
|
|
311
|
+
], [showBackToResultButton, showAdvancedSearch, SQD, onBackToResult, openSqdForm, changeAdvancedSearchAsync, setShowFiltersConfig, setShowOutputConfig, setShowOrderByConfig, handlePassToArchive]);
|
|
302
312
|
const captionText = showAllMdWhere ? SDKUI_Localizator.ShowLess : SDKUI_Localizator.ShowAll;
|
|
303
313
|
let maxItems = getListMaxItems(deviceType ?? DeviceType.DESKTOP);
|
|
304
314
|
const diff = (qd?.where?.length ?? 0) - maxItems;
|
|
305
315
|
return (_jsxs(_Fragment, { children: [_jsxs(TMPanel, { title: fromDTD?.nameLoc ?? SDKUI_Localizator.Search_Metadata, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, onBack: onBack, onActiveChanged: handlePanelActiveChanged, toolbar: _jsx(_Fragment, { children: (SQD && !showSqdForm) ?
|
|
306
|
-
_jsx(
|
|
307
|
-
...(showBackToResultButton ? [{ icon: _jsx(IconArrowRight, {}), text: "Vai a risultato", onClick: () => { onBackToResult?.(); } }] : []),
|
|
308
|
-
{ icon: _jsx(IconAddCircleOutline, {}), beginGroup: true, text: SDKUI_Localizator.SavedQueryNew, onClick: () => { openSqdForm(FormModes.Create); } },
|
|
309
|
-
{ icon: _jsx(IconEdit, {}), text: SDKUI_Localizator.SavedQueryUpdate, disabled: (SQD && SQD.id == 1), onClick: () => { openSqdForm(FormModes.Update); } },
|
|
310
|
-
{ icon: showAdvancedSearch ? _jsx(IconEasy, {}) : _jsx(IconAdvanced, {}), beginGroup: true, text: showAdvancedSearch ? SDKUI_Localizator.Search_Easy : SDKUI_Localizator.Search_Advanced, onClick: () => { changeAdvancedSearchAsync(!showAdvancedSearch); } },
|
|
311
|
-
{ icon: _jsx(IconEdit, {}), beginGroup: true, text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryWhere}`, onClick: () => { setShowFiltersConfig(true); } },
|
|
312
|
-
{ icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QuerySelect}`, onClick: () => { setShowOutputConfig(true); } },
|
|
313
|
-
{ icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryOrderBy}`, onClick: () => { setShowOrderByConfig(true); } },
|
|
314
|
-
{ icon: _jsx(IconMenuCAArchive, { viewBox: '11 11.5 26 27', fontSize: 16, strokeWidth: 2, color: 'black' }), beginGroup: true, text: SDKUI_Localizator.PassToArchive, onClick: handlePassToArchive }
|
|
315
|
-
], onMenuShown: () => setIsQueryPanelActive(true) })
|
|
316
|
+
_jsx(ContextMenu, { items: contextMenuItems, trigger: "left", children: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false, onClick: () => setIsQueryPanelActive(true) }) })
|
|
316
317
|
: _jsx(_Fragment, {}) }), children: [_jsx(ConfirmQueryParamsDialog, {}), SQD
|
|
317
318
|
? _jsxs("div", { onContextMenu: (e) => e.preventDefault(), style: { height: '100%', width: '100%', position: 'relative', display: 'flex', flexDirection: 'column', gap: 5 }, children: [showAdvancedSearch
|
|
318
319
|
? _jsx(TMQueryEditor, { formMode: FormModes.Update, showToolbar: false, inputData: qd, validateSelect: true, showApply: false, onQDChanged: handleQdChanged })
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, TemplateTIDs, DcmtTypeListCacheService,
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, TemplateTIDs, DcmtTypeListCacheService, SystemMIDsAsNumber, RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, AccessLevelsEx, LayoutCacheService, UserListCacheService } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import { getAllFieldSelectedDcmtsOrFocused, getCommandsMenuItems, getSelectedDcmtsOrFocused } from './TMSearchResultsMenuItems';
|
|
6
|
-
import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys,
|
|
6
|
+
import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, deepCompare, generateUniqueColumnKeys, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, IconSearchCheck, IconCheck, svgToString, TMImageLibrary, convertSearchResultDescriptorToFileItems } from '../../../helper';
|
|
7
7
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
|
8
8
|
import { useInputAttachmentsDialog, useInputCvtFormatDialog } from '../../../hooks/useInputDialog';
|
|
9
9
|
import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
|
|
10
|
-
import { DcmtOperationTypes, SearchResultContext
|
|
10
|
+
import { DcmtOperationTypes, SearchResultContext } from '../../../ts';
|
|
11
11
|
import { Gutters, TMColors } from '../../../utils/theme';
|
|
12
12
|
import { StyledModalContainer, StyledMultiViewPanel } from '../../base/Styled';
|
|
13
13
|
import TMButton from '../../base/TMButton';
|
|
@@ -21,7 +21,8 @@ import TMMetadataValues from '../../editors/TMMetadataValues';
|
|
|
21
21
|
import TMDataListItemViewer from '../../viewers/TMDataListItemViewer';
|
|
22
22
|
import TMTidViewer from '../../viewers/TMTidViewer';
|
|
23
23
|
import TMDcmtPreview from '../documents/TMDcmtPreview';
|
|
24
|
-
import
|
|
24
|
+
import TMFloatingMenuBar from '../../NewComponents/FloatingMenuBar/TMFloatingMenuBar';
|
|
25
|
+
import TMContextMenu from '../../NewComponents/ContextMenu/TMContextMenu';
|
|
25
26
|
import { WorkFlowApproveRejectPopUp, WorkFlowMoreInfoPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
|
|
26
27
|
import TMMasterDetailDcmts from '../documents/TMMasterDetailDcmts';
|
|
27
28
|
import TMBatchUpdateForm from '../../features/documents/TMBatchUpdateForm';
|
|
@@ -94,6 +95,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
94
95
|
// State to control whether the export form (for exporting to Excel/CSV/txt and others) should be shown
|
|
95
96
|
const [showExportForm, setShowExportForm] = useState(false);
|
|
96
97
|
const [showSignSettingsForm, setShowSignSettingsForm] = useState(false);
|
|
98
|
+
const floatingBarContainerRef = useRef(null);
|
|
97
99
|
const [confirmFormat, ConfirmFormatDialog] = useInputCvtFormatDialog();
|
|
98
100
|
const { openConfirmAttachmentsDialog, ConfirmAttachmentsDialog } = useInputAttachmentsDialog();
|
|
99
101
|
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync, getDcmtFileAsync } = useDcmtOperations();
|
|
@@ -358,7 +360,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
358
360
|
const customButtonMenuItems = () => {
|
|
359
361
|
const customButtonsItems = customButtonsLayout?.customButtons?.filter((customButton) => customButton.isForSearchResult && customButton.isForSearchResult > 0)
|
|
360
362
|
.map((customButton) => ({
|
|
361
|
-
icon: svgToString(TMImageLibrary({ imageID: customButton.glyphID, showPath:
|
|
363
|
+
icon: svgToString(TMImageLibrary({ imageID: customButton.glyphID, showPath: false })),
|
|
362
364
|
text: customButton.title || 'Bottone personalizzato',
|
|
363
365
|
onClick: () => setCustomButton(customButton)
|
|
364
366
|
}));
|
|
@@ -570,8 +572,6 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
570
572
|
break;
|
|
571
573
|
}
|
|
572
574
|
};
|
|
573
|
-
const searchResutlToolbar = _jsxs(_Fragment, { children: [(dcmtsReturned != dcmtsFound) && _jsx("p", { style: { backgroundColor: `white`, color: TMColors.primaryColor, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${dcmtsReturned}/${dcmtsFound} restituiti` }), context === SearchResultContext.FAVORITES_AND_RECENTS &&
|
|
574
|
-
_jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshSearchAsync }), _jsx(IconMenuVertical, { id: `commands-header-${id}`, color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: `#commands-header-${id}`, showEvent: "click", menuItems: getCommandsMenuItems(isMobile, fromDTD, allUsers, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openSignSettingsForm, handleCheckOutOperationCallback, handleCheckInOperationCallback, showCheckoutInformationFormCallback, showHistoryCallback, copyCheckoutPathToClipboardOperationCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation).concat([customButtonMenuItems()]) })] });
|
|
575
575
|
const handleAddItem = (tid, did) => {
|
|
576
576
|
let newItem = { TID: tid ?? 0, DID: did ?? 0 };
|
|
577
577
|
setSecondaryMasterDcmts((prevItems) => [...prevItems, newItem]);
|
|
@@ -583,14 +583,38 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
|
|
|
583
583
|
await refreshFocusedDataRowAsync(tid, did, true, metadataResult);
|
|
584
584
|
}, [refreshFocusedDataRowAsync]);
|
|
585
585
|
const showToppyForApprove = (isVisible && fromDTD?.templateTID === TemplateTIDs.WF_WIApprView && !isOpenDcmtForm && !isOpenDetails && !isOpenMaster);
|
|
586
|
+
// Convert TMDataGridContextMenuItem to TMContextMenuItemProps for the floating menu bar
|
|
587
|
+
const convertToContextMenuItems = (items) => {
|
|
588
|
+
return items
|
|
589
|
+
.filter(item => item.visible !== false)
|
|
590
|
+
.map(item => ({
|
|
591
|
+
name: item.text,
|
|
592
|
+
icon: item.icon ? _jsx("div", { dangerouslySetInnerHTML: { __html: item.icon } }) : undefined,
|
|
593
|
+
disabled: item.disabled,
|
|
594
|
+
onClick: item.onClick,
|
|
595
|
+
submenu: item.items ? convertToContextMenuItems(item.items) : undefined,
|
|
596
|
+
beginGroup: item.beginGroup,
|
|
597
|
+
}));
|
|
598
|
+
};
|
|
599
|
+
const floatingMenuItems = useMemo(() => {
|
|
600
|
+
const menuItems = getCommandsMenuItems(isMobile, fromDTD, allUsers, selectedItems, focusedItem, context, showFloatingBar, workingGroupContext, showSearch, setShowFloatingBar, openFormHandler, openSharedArchiveHandler, showSharedDcmtsHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler, openExportForm, handleToggleSearch, handleSignApprove, openSignSettingsForm, handleCheckOutOperationCallback, handleCheckInOperationCallback, showCheckoutInformationFormCallback, showHistoryCallback, copyCheckoutPathToClipboardOperationCallback, openWGsCopyMoveForm, openCommentFormCallback, openEditPdf, openAddDocumentForm, passToArchiveCallback, archiveMasterDocuments, archiveDetailDocuments, currentTIDHasMasterRelations, currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation, pairManyToMany, hasManyToManyRelation).concat([customButtonMenuItems()]);
|
|
601
|
+
return convertToContextMenuItems(menuItems);
|
|
602
|
+
}, [
|
|
603
|
+
isMobile, fromDTD, allUsers, selectedItems, focusedItem, context,
|
|
604
|
+
showFloatingBar, workingGroupContext, showSearch, currentTIDHasMasterRelations,
|
|
605
|
+
currentTIDHasDetailRelations, canArchiveMasterRelation, canArchiveDetailRelation,
|
|
606
|
+
hasManyToManyRelation, customButtonsLayout
|
|
607
|
+
]);
|
|
608
|
+
const searchResutlToolbar = _jsxs(_Fragment, { children: [(dcmtsReturned != dcmtsFound) && _jsx("p", { style: { backgroundColor: `white`, color: TMColors.primaryColor, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${dcmtsReturned}/${dcmtsFound} restituiti` }), context === SearchResultContext.FAVORITES_AND_RECENTS &&
|
|
609
|
+
_jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshSearchAsync }), _jsx(TMContextMenu, { items: floatingMenuItems, trigger: "left", children: _jsx(IconMenuVertical, { color: 'white', cursor: 'pointer' }) })] });
|
|
586
610
|
const tmSearchResult = useMemo(() => (!searchResults || searchResults.length <= 0)
|
|
587
611
|
? _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%' }, children: [_jsx(IconBoard, { fontSize: 96 }), _jsx("div", { style: { fontSize: "15px", marginTop: "10px" }, children: SDKUI_Localizator.NoDcmtFound }), openAddDocumentForm && _jsx("div", { style: { marginTop: "10px" }, children: _jsx(TMButton, { fontSize: "15px", icon: _jsx("i", { className: 'dx-icon-share' }), caption: SDKUI_Localizator.Share, onClick: openAddDocumentForm }) })] })
|
|
588
612
|
:
|
|
589
613
|
_jsxs(_Fragment, { children: [_jsxs(TMLayoutItem, { height: '100%', children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: Gutters.getGutters(), separatorActiveColor: 'transparent', separatorColor: 'transparent', min: ['0', '0'], showSeparator: showSelector && deviceType !== DeviceType.MOBILE, start: showSelector ? deviceType !== DeviceType.MOBILE ? ['30%', '70%'] : splitterSize : ['0%', '100%'], children: [showSelector ?
|
|
590
614
|
_jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, disableAccordionIfSingleCategory: disableAccordionIfSingleCategory, selectedTID: selectedSearchResultTID, selectedSearchResult: selectedSearchResult, autoSelectFirst: !isMobile || currentSearchResults.length === 1, onSelectionChanged: onSearchResultSelectionChanged }) })
|
|
591
615
|
:
|
|
592
|
-
_jsx(_Fragment, {}),
|
|
593
|
-
|
|
616
|
+
_jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsxs("div", { ref: floatingBarContainerRef, style: { position: 'relative', height: '100%', width: '100%' }, children: [_jsx(TMSearchResultGrid, { showSearch: showSearch, fromDTD: fromDTD, allUsers: allUsers, inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], lastUpdateSearchTime: lastUpdateSearchTime, openInOffice: openInOffice, onDblClick: () => openFormHandler(LayoutModes.Update), onContextMenuPreparing: onContextMenuPreparing, onSelectionChanged: (items) => { setSelectedItems(items); }, onVisibleItemChanged: setVisibleItems, onFocusedItemChanged: setFocusedItem, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync(inputDcmts, downloadType, downloadMode, onFileOpened, confirmAttachments), showExportForm: showExportForm, onCloseExportForm: onCloseExportForm }), allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE &&
|
|
617
|
+
_jsx(TMFloatingMenuBar, { containerRef: floatingBarContainerRef, contextMenuItems: floatingMenuItems, storageKey: `floatingMenuBar-search-${groupId || 'default'}`, isConstrained: true, defaultPosition: { x: 10, y: window.innerHeight - 215 }, maxItems: 8 })] }) })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), isReject: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onCompleted: onWFOperationCompleted, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) }), showMoreInfoPopup && _jsx(WorkFlowMoreInfoPopUp, { TID: focusedItem?.TID, DID: focusedItem?.DID, deviceType: deviceType, onCompleted: onWFOperationCompleted, onClose: () => setShowMoreInfoPopup(false) }), isOpenBatchUpdate && _jsx(TMBatchUpdateForm, { isModal: true, titleModal: `${SDKUI_Localizator.BatchUpdate} (${getSelectionDcmtInfo().length} documenti selezionati)`, inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => {
|
|
594
618
|
setIsOpenBatchUpdate(false);
|
|
595
619
|
}, onSavedCallbackAsync: async () => {
|
|
596
620
|
setIsOpenBatchUpdate(false);
|
|
@@ -1033,7 +1057,7 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, allUsers, inputFocusedItem,
|
|
|
1033
1057
|
setVisibleItems(visibleRows.map((row) => { return row.data; }));
|
|
1034
1058
|
}, []);
|
|
1035
1059
|
useEffect(() => { onVisibleItemChanged?.(visibleItems); }, [visibleItems]);
|
|
1036
|
-
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsx(TMDataGrid, { id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: Number(focusedItem?.rowIndex ?? 0), showSearchPanel: showSearch, showFilterPanel: true, sorting: { mode: "multiple" }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single' }, pageSize: TMDataGridPageSize.Small, onSelectionChanged: handleSelectionChange, onFocusedRowChanged: handleFocusedRowChange, onRowDblClick: onRowDblClick, onContentReady: onContentReady,
|
|
1060
|
+
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsx(TMDataGrid, { id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: Number(focusedItem?.rowIndex ?? 0), showSearchPanel: showSearch, showFilterPanel: true, sorting: { mode: "multiple" }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single' }, pageSize: TMDataGridPageSize.Small, onSelectionChanged: handleSelectionChange, onFocusedRowChanged: handleFocusedRowChange, onRowDblClick: onRowDblClick, onContentReady: onContentReady, showHeaderColumnChooser: true, onKeyDown: onKeyDown, onContextMenuPreparing: onContextMenuPreparing, counterConfig: { show: true } }), (showExportForm && searchResult && onCloseExportForm) && _jsx(TMDataGridExportForm, { dataColumns: dataColumns, dataSource: dataSource, selectedRowKeys: selectedRowKeys, onCloseExportForm: onCloseExportForm, searchResult: searchResult })] });
|
|
1037
1061
|
};
|
|
1038
1062
|
//#region TMSearchResultSelector
|
|
1039
1063
|
const StyledItemTemplate = styled.div `
|
|
@@ -141,7 +141,6 @@ export const getCommandsMenuItems = (isMobile, dtd, allUsers, selectedItems, foc
|
|
|
141
141
|
text: SDKUI_Localizator.LogDelete,
|
|
142
142
|
operationType: 'multiRow',
|
|
143
143
|
disabled: dtd?.perm?.canLogicalDelete !== AccessLevels.Yes ? true : disabledForMultiRow(selectedItems, focusedItem),
|
|
144
|
-
beginGroup: true,
|
|
145
144
|
onClick: async () => {
|
|
146
145
|
let dcmts = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
147
146
|
await runOperationAsync(dcmts, DcmtOperationTypes.LogDelete, dcmts.length <= MAX_DCMTS_FOR_SELECTION_REFRESH ? onRefreshDataRowsAsync : onRefreshSearchAsync);
|
|
@@ -54,6 +54,16 @@ export declare class SearchSettings {
|
|
|
54
54
|
mruTIDs: number[];
|
|
55
55
|
defaultTree: number;
|
|
56
56
|
previewThreshold: number;
|
|
57
|
+
floatingMenuBar: FloatingMenuBarSettings;
|
|
58
|
+
}
|
|
59
|
+
export declare class FloatingMenuBarSettings {
|
|
60
|
+
orientation: 'horizontal' | 'vertical';
|
|
61
|
+
pinnedItemIds: string[];
|
|
62
|
+
itemIds: string[];
|
|
63
|
+
position: {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
};
|
|
57
67
|
}
|
|
58
68
|
export declare class ArchivingSettings {
|
|
59
69
|
mruTIDs: number[];
|
|
@@ -98,6 +98,15 @@ export class SearchSettings {
|
|
|
98
98
|
this.mruTIDs = [];
|
|
99
99
|
this.defaultTree = -1;
|
|
100
100
|
this.previewThreshold = 500; // KB
|
|
101
|
+
this.floatingMenuBar = new FloatingMenuBarSettings();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export class FloatingMenuBarSettings {
|
|
105
|
+
constructor() {
|
|
106
|
+
this.orientation = 'horizontal';
|
|
107
|
+
this.pinnedItemIds = [];
|
|
108
|
+
this.itemIds = [];
|
|
109
|
+
this.position = { x: 10, y: globalThis.window?.innerHeight ? globalThis.window.innerHeight - 215 : 100 };
|
|
101
110
|
}
|
|
102
111
|
}
|
|
103
112
|
export class ArchivingSettings {
|