@topconsultnpm/sdkui-react 6.20.0-dev1.5 → 6.20.0-dev1.50

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.
Files changed (70) hide show
  1. package/lib/components/NewComponents/ContextMenu/TMContextMenu.d.ts +4 -0
  2. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +302 -0
  3. package/lib/components/NewComponents/ContextMenu/hooks.d.ts +13 -0
  4. package/lib/components/NewComponents/ContextMenu/hooks.js +61 -0
  5. package/lib/components/NewComponents/ContextMenu/index.d.ts +2 -0
  6. package/lib/components/NewComponents/ContextMenu/index.js +1 -0
  7. package/lib/components/NewComponents/ContextMenu/styles.d.ts +31 -0
  8. package/lib/components/NewComponents/ContextMenu/styles.js +336 -0
  9. package/lib/components/NewComponents/ContextMenu/types.d.ts +38 -0
  10. package/lib/components/NewComponents/ContextMenu/types.js +1 -0
  11. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +4 -0
  12. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +686 -0
  13. package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +2 -0
  14. package/lib/components/NewComponents/FloatingMenuBar/index.js +2 -0
  15. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +47 -0
  16. package/lib/components/NewComponents/FloatingMenuBar/styles.js +346 -0
  17. package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +28 -0
  18. package/lib/components/NewComponents/FloatingMenuBar/types.js +1 -0
  19. package/lib/components/base/TMCustomButton.js +61 -17
  20. package/lib/components/base/TMDataGrid.d.ts +7 -4
  21. package/lib/components/base/TMDataGrid.js +112 -11
  22. package/lib/components/choosers/TMMetadataChooser.js +8 -1
  23. package/lib/components/editors/TMMetadataValues.js +23 -5
  24. package/lib/components/features/documents/TMDcmtForm.d.ts +13 -1
  25. package/lib/components/features/documents/TMDcmtForm.js +385 -193
  26. package/lib/components/features/documents/TMDcmtPreview.js +37 -66
  27. package/lib/components/features/documents/TMMasterDetailDcmts.js +1 -1
  28. package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
  29. package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +5 -10
  30. package/lib/components/features/search/TMSearch.js +30 -5
  31. package/lib/components/features/search/TMSearchQueryPanel.js +13 -12
  32. package/lib/components/features/search/TMSearchResult.js +58 -208
  33. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +3 -3
  34. package/lib/components/features/search/TMSearchResultsMenuItems.js +205 -169
  35. package/lib/components/features/search/TMSignSettingsForm.js +1 -1
  36. package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
  37. package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
  38. package/lib/components/features/search/TMViewHistoryDcmt.js +1 -1
  39. package/lib/components/features/tasks/TMTasksView.js +2 -2
  40. package/lib/components/features/workflow/diagram/WFDiagram.js +2 -2
  41. package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
  42. package/lib/components/forms/Login/LoginValidatorService.js +7 -2
  43. package/lib/components/forms/Login/TMLoginForm.js +34 -6
  44. package/lib/components/forms/TMChooserForm.js +1 -1
  45. package/lib/components/index.d.ts +1 -0
  46. package/lib/components/index.js +1 -0
  47. package/lib/css/tm-sdkui.css +1 -1
  48. package/lib/helper/SDKUI_Globals.d.ts +17 -0
  49. package/lib/helper/SDKUI_Globals.js +9 -0
  50. package/lib/helper/SDKUI_Localizator.d.ts +2 -1
  51. package/lib/helper/SDKUI_Localizator.js +11 -1
  52. package/lib/helper/TMIcons.d.ts +1 -0
  53. package/lib/helper/TMIcons.js +3 -0
  54. package/lib/helper/TMPdfViewer.d.ts +8 -0
  55. package/lib/helper/TMPdfViewer.js +187 -0
  56. package/lib/helper/checkinCheckoutManager.d.ts +32 -2
  57. package/lib/helper/checkinCheckoutManager.js +115 -38
  58. package/lib/helper/devextremeCustomMessages.d.ts +30 -0
  59. package/lib/helper/devextremeCustomMessages.js +30 -0
  60. package/lib/helper/helpers.d.ts +2 -1
  61. package/lib/helper/helpers.js +12 -2
  62. package/lib/helper/index.d.ts +1 -0
  63. package/lib/helper/index.js +1 -0
  64. package/lib/helper/queryHelper.js +29 -0
  65. package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
  66. package/lib/hooks/useCheckInOutOperations.js +223 -0
  67. package/lib/hooks/useWorkflowApprove.d.ts +4 -0
  68. package/lib/hooks/useWorkflowApprove.js +14 -1
  69. package/package.json +5 -2
  70. package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
@@ -8,13 +8,14 @@ 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
+ import TMPdfViewer from '../../../helper/TMPdfViewer';
18
19
  const ErrorContent = ({ error, isAbortError, onRetry }) => {
19
20
  if (isAbortError) {
20
21
  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 })] }) }));
@@ -124,10 +125,11 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
124
125
  console.error('Error reopening document:', error);
125
126
  }
126
127
  };
127
- 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(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, {}), showTooltip: false }), items: [
128
- { icon: _jsx(IconCloseCircle, {}), text: SDKUI_Localizator.RemoveFromCache, onClick: () => { removeDcmtsFileCache(cacheKey); setIsFromCache(false); } },
129
- { icon: _jsx(IconClear, {}), text: SDKUI_Localizator.ClearCache, onClick: () => { clearDcmtsFileCache(); setIsFromCache(false); } },
130
- ] }, "btn13") }), _jsx(StyledHeaderIcon, { onClick: reOpenDcmt, "$color": TMColors.primaryColor, children: _jsx(TMTooltip, { content: SDKUI_Localizator.ReopenDocument, children: _jsx(IconRefresh, {}) }) })] }), children: error
128
+ const cacheMenuItems = useMemo(() => [
129
+ { icon: _jsx(IconCloseCircle, {}), name: SDKUI_Localizator.RemoveFromCache, onClick: () => { removeDcmtsFileCache(cacheKey); setIsFromCache(false); } },
130
+ { icon: _jsx(IconClear, {}), name: SDKUI_Localizator.ClearCache, onClick: () => { clearDcmtsFileCache(); setIsFromCache(false); } },
131
+ ], [cacheKey, removeDcmtsFileCache, clearDcmtsFileCache, setIsFromCache]);
132
+ 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
131
133
  ? _jsx(ErrorContent, { error: error, isAbortError: isAbortError, onRetry: reOpenDcmt })
132
134
  : renderedPreview(dcmtData?.tid, dcmtData?.did, dcmtData?.fileExt, dcmtData?.fileSize, dcmtData?.fileCount, extensionHandler(dcmtData?.fileExt), showPreview, isResizingActive, () => { loadDocumentWithCache(); setShowPreview(true); }, dcmtBlob) }) }));
133
135
  };
@@ -136,35 +138,10 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
136
138
  const [blobUrl, setBlobUrl] = useState(undefined);
137
139
  const [fileType, setFileType] = useState(undefined);
138
140
  const [formattedXml, setFormattedXml] = useState(undefined);
139
- const [isMobile, setIsMobile] = useState(false);
140
- useEffect(() => {
141
- const checkIsMobile = () => {
142
- const userAgent = navigator.userAgent || navigator.vendor || window.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
141
  useEffect(() => {
166
142
  if (fileBlob) {
167
- setFileType(fileBlob.type);
143
+ const blobType = fileBlob.type;
144
+ setFileType(blobType);
168
145
  setFormattedXml(undefined);
169
146
  const fileName = fileBlob.name || '';
170
147
  const fileExtension = fileName.split('.').pop()?.toLowerCase() || '';
@@ -222,41 +199,10 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
222
199
  if (fileBlob.type.includes('image')) {
223
200
  return (_jsx(ImageViewer, { fileBlob: fileBlob, alt: '' }));
224
201
  }
225
- if (fileType === 'application/pdf' && isMobile) {
226
- return (_jsx("object", { data: blobUrl, type: "application/pdf", width: "100%", height: "100%", style: {
227
- border: 'none',
228
- zIndex: 0,
229
- pointerEvents: isResizingActive === true ? "none" : "auto"
230
- }, children: _jsxs("div", { style: {
231
- padding: '40px',
232
- textAlign: 'center',
233
- display: 'flex',
234
- flexDirection: 'column',
235
- alignItems: 'center',
236
- justifyContent: 'center',
237
- height: '100%',
238
- gap: '20px'
239
- }, children: [_jsx(IconPreview, { fontSize: 96 }), _jsxs("div", { children: [_jsx("h3", { children: SDKUI_Localizator.PDFDocument }), _jsx("p", { children: SDKUI_Localizator.PreviewNotAvailableOnDevice })] }), _jsxs("div", { style: { display: 'flex', gap: '10px', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center' }, children: [_jsx("a", { href: blobUrl, download: "document.pdf", style: {
240
- minWidth: '180px',
241
- padding: '12px 24px',
242
- backgroundColor: TMColors.primaryColor,
243
- color: 'white',
244
- textDecoration: 'none',
245
- borderRadius: '4px',
246
- display: 'inline-block'
247
- }, children: SDKUI_Localizator.DownloadFile }), _jsx("a", { href: blobUrl, target: "_blank", rel: "noopener noreferrer", style: {
248
- minWidth: '180px',
249
- padding: '12px 24px',
250
- backgroundColor: TMColors.primaryColor,
251
- color: 'white',
252
- textDecoration: 'none',
253
- borderRadius: '4px',
254
- display: 'inline-block'
255
- }, children: SDKUI_Localizator.OpenInNewTab })] })] }) }, blobUrl));
202
+ if (fileType === 'application/pdf') {
203
+ return _jsx(TMPdfViewer, { pdfBlob: fileBlob, isResizingActive: isResizingActive, enableFitToWidth: true });
256
204
  }
257
- return (_jsx("iframe", { srcDoc: formattedXml ? `<html><body>${formattedXml}</body></html>` : undefined, src: !formattedXml
258
- ? (fileType === 'application/pdf' ? `${blobUrl}#view=FitH&scrollbar=1` : blobUrl)
259
- : undefined, title: "File Viewer", width: "100%", height: "100%", style: { border: 'none', zIndex: 0, pointerEvents: isResizingActive === true ? "none" : "auto" } }, blobUrl));
205
+ return (_jsx("iframe", { srcDoc: formattedXml ? `<html><body>${formattedXml}</body></html>` : undefined, src: !formattedXml ? blobUrl : undefined, title: "File Viewer", width: "100%", height: "100%", style: { border: 'none', zIndex: 0, pointerEvents: isResizingActive === true ? "none" : "auto" } }, blobUrl));
260
206
  };
261
207
  const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
262
208
  const containerRef = useRef(null);
@@ -475,3 +421,28 @@ const StyledImage = styled.img.attrs(props => ({
475
421
  pointer-events: none;
476
422
  position: absolute;
477
423
  `;
424
+ const PDFViewerContainer = styled.div `
425
+ width: 100%;
426
+ height: 100%;
427
+ overflow-y: auto;
428
+ overflow-x: hidden;
429
+ background-color: #f5f5f5;
430
+
431
+ .react-pdf__Document {
432
+ display: flex;
433
+ flex-direction: column;
434
+ align-items: center;
435
+ gap: 10px;
436
+ padding: 10px 0;
437
+ }
438
+
439
+ .react-pdf__Page {
440
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
441
+ margin: 0 auto;
442
+ }
443
+
444
+ .react-pdf__Page__canvas {
445
+ max-width: 100%;
446
+ height: auto !important;
447
+ }
448
+ `;
@@ -169,7 +169,7 @@ const TMMasterDetailDcmts = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallba
169
169
  _jsx(TMRelationViewerWrapper, { inputDcmts: inputDcmts, isForMaster: isForMaster, showCurrentDcmtIndicator: showCurrentDcmtIndicator, showZeroDcmts: showZeroDcmts,
170
170
  // customItemRender={customItemRender}
171
171
  allowMultipleSelection: allowMultipleSelection, focusedItem: focusedItem, selectedItems: selectedItems, onFocusedItemChanged: handleFocusedItemChanged, onSelectedItemsChanged: handleSelectedItemsChanged }) }), [inputDcmts, isForMaster, showCurrentDcmtIndicator, showZeroDcmts, allowMultipleSelection, focusedItem, selectedItems, handleFocusedItemChanged, handleSelectedItemsChanged]);
172
- const tmFormOrResult = useMemo(() => _jsx(TMFormOrResultWrapper, { deviceType: deviceType, focusedItem: focusedItem, onTaskCreateRequest: onTaskCreateRequest, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [focusedItem, deviceType, allTasks]);
172
+ const tmFormOrResult = useMemo(() => _jsx(TMFormOrResultWrapper, { deviceType: deviceType, focusedItem: focusedItem, onTaskCreateRequest: onTaskCreateRequest, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [focusedItem, deviceType, allTasks, handleNavigateToWGs, handleNavigateToDossiers]);
173
173
  const initialPanelDimensions = {
174
174
  'tmTreeView': { width: '50%', height: '100%' },
175
175
  'tmFormOrResult': { width: '50%', height: '100%' },
@@ -0,0 +1,8 @@
1
+ import { DcmtInfo } from "../../../ts";
2
+ interface TMDcmtCheckoutInfoFormProps {
3
+ dtdName: string;
4
+ selectedDcmtOrFocused: DcmtInfo;
5
+ onClose: () => void;
6
+ }
7
+ declare const TMDcmtCheckoutInfoForm: (props: TMDcmtCheckoutInfoFormProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default TMDcmtCheckoutInfoForm;
@@ -5,14 +5,14 @@ import { IconBxInfo, IconFileDots, IconFolder, SDKUI_Globals, SDKUI_Localizator
5
5
  import { FormModes } from "../../../ts";
6
6
  import { ResultTypes, ValidationItem } from "@topconsultnpm/sdk-ts";
7
7
  import { SaveFormOptions, useSaveForm } from "../../../hooks/useForm";
8
- import { getCicoDownloadFileName, updateCheckoutItem } from "../../../helper/checkinCheckoutManager";
8
+ import { getCicoDownloadFileName, updateCicoCheckoutStorageItem } from "../../../helper/checkinCheckoutManager";
9
9
  import { TMColors } from "../../../utils/theme";
10
10
  import TMLayoutContainer, { TMLayoutItem } from "../../base/TMLayout";
11
11
  import TMTooltip from "../../base/TMTooltip";
12
12
  import TMTextBox from "../../editors/TMTextBox";
13
13
  import ShowAlert from "../../base/TMAlert";
14
14
  import { TMExceptionBoxManager } from "../../base/TMPopUp";
15
- const TMSearchResultCheckoutInfoForm = (props) => {
15
+ const TMDcmtCheckoutInfoForm = (props) => {
16
16
  const { dtdName, selectedDcmtOrFocused, onClose } = props;
17
17
  const [initialDcmtCheckoutFolder, setInitialDcmtCheckoutFolder] = useState("");
18
18
  const [initialDcmtCheckoutName, setInitialDcmtCheckoutName] = useState("");
@@ -57,13 +57,8 @@ const TMSearchResultCheckoutInfoForm = (props) => {
57
57
  // Check: formData must exist, selectedDcmtOrFocused.TID and selectedDcmtOrFocused.DID must exist, and at least one of checkoutFolder or checkoutName must be filled
58
58
  if (formData && selectedDcmtOrFocused.TID && selectedDcmtOrFocused.DID) {
59
59
  // Create a new draft checkout item with TID, DID, and folder/name values
60
- const newItem = {
61
- TID: selectedDcmtOrFocused.TID.toString(),
62
- DID: selectedDcmtOrFocused.DID.toString(),
63
- checkoutFolder: formData.checkoutFolder ?? "",
64
- checkoutName: formData.checkoutName ?? ""
65
- };
66
- updateCheckoutItem(newItem, "dcmtInfo", "addOrUpdate");
60
+ const newItem = { TID: selectedDcmtOrFocused.TID.toString(), DID: selectedDcmtOrFocused.DID.toString(), checkoutFolder: formData.checkoutFolder ?? "", checkoutName: formData.checkoutName ?? "" };
61
+ updateCicoCheckoutStorageItem(newItem, "dcmtInfo", "addOrUpdate");
67
62
  onClose();
68
63
  ShowAlert({ mode: 'success', title: SDKUI_Localizator.CheckoutInfo, message: SDKUI_Localizator.OperationSuccess, duration: 3000 });
69
64
  }
@@ -131,4 +126,4 @@ const TMSearchResultCheckoutInfoForm = (props) => {
131
126
  e.currentTarget.style.color = TMColors.primary;
132
127
  }, children: SDKUI_Localizator.Cancel })] })] }) }) }) }) });
133
128
  };
134
- export default TMSearchResultCheckoutInfoForm;
129
+ export default TMDcmtCheckoutInfoForm;
@@ -11,8 +11,9 @@ import TMRecentsManager from '../../grids/TMRecentsManager';
11
11
  import { SearchResultContext } from '../../../ts';
12
12
  import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
13
13
  import { StyledMultiViewPanel } from '../../base/Styled';
14
- import { TMPanelManagerProvider, useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
14
+ import { useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
15
15
  import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
16
+ import { TMPanelManagerWithPersistenceProvider } from '../../layout/panelManager/TMPanelManagerWithPersistenceProvider';
16
17
  var TMSearchViews;
17
18
  (function (TMSearchViews) {
18
19
  TMSearchViews[TMSearchViews["Search"] = 0] = "Search";
@@ -141,15 +142,16 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
141
142
  console.error("Error refreshing search:", error);
142
143
  }
143
144
  };
144
- const isMobile = deviceType === DeviceType.TABLET || deviceType === DeviceType.MOBILE;
145
+ const isMobile = deviceType === DeviceType.MOBILE;
146
+ const isTabletOrMobile = deviceType === DeviceType.TABLET || deviceType === DeviceType.MOBILE;
145
147
  // --- JSX WRAPPERS ---
146
- const tmTreeSelectorElement = useMemo(() => _jsx(TMTreeSelectorWrapper, { isMobile: isMobile, onSelectedTIDChanged: (tid) => {
148
+ const tmTreeSelectorElement = useMemo(() => _jsx(TMTreeSelectorWrapper, { isMobile: isTabletOrMobile, onSelectedTIDChanged: (tid) => {
147
149
  setCurrentTID(tid);
148
150
  if (tid && mruTIDs.includes(tid))
149
151
  setCurrentMruTID(tid);
150
152
  else
151
153
  setCurrentMruTID(0);
152
- } }), [isMobile, mruTIDs]);
154
+ } }), [isTabletOrMobile, mruTIDs]);
153
155
  const tmRecentsManagerElement = useMemo(() => _jsx(TMRecentsManagerWrapper, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
154
156
  setCurrentMruTID(tid);
155
157
  setCurrentTID(tid);
@@ -180,6 +182,29 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
180
182
  }, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync) }) }) : _jsx(_Fragment, {}), _jsx(Item, { title: SDKUI_Localizator.AllFemale, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: true, items: allSQDs, manageDefault: false, onItemClick: (sqd) => {
181
183
  onSQDItemClick(sqd, setSQDAsync);
182
184
  }, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] }), [currentSQDMode, currentTID, currentSQD, fromDTD, filteredByTIDSQDs, allSQDs]);
185
+ // Returns the current panelLayout from user settings, falling back to an empty object if not present.
186
+ const getPanelLayoutSetting = () => {
187
+ return SDKUI_Globals.userSettings.searchSettings.panelLayout ?? {};
188
+ };
189
+ // Checks whether a persisted panel layout exists and is not empty.
190
+ const hasSavedLayout = () => {
191
+ const panelLayout = getPanelLayoutSetting();
192
+ return Object.keys(panelLayout).length > 0;
193
+ };
194
+ // Persists the current panel states into user settings. Each panel must contain: visible, width and height.
195
+ const persistPanelStates = (state) => {
196
+ if (!state || Object.keys(state).length === 0)
197
+ return;
198
+ SDKUI_Globals.userSettings.searchSettings.panelLayout = {
199
+ ...state
200
+ };
201
+ };
202
+ // Retrieves the persisted panel layout. Returns undefined on mobile devices.
203
+ const getPersistedPanelStates = () => {
204
+ if (isMobile)
205
+ return undefined;
206
+ return getPanelLayoutSetting();
207
+ };
183
208
  // --- PANEL DEFINITIONS ---
184
209
  const allInitialPanelVisibility = {
185
210
  'TMTreeSelector': true,
@@ -219,7 +244,7 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
219
244
  toolbarOptions: { icon: _jsx(IconSavedQuery, { fontSize: 24 }), visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['TMSavedQuerySelector'] }
220
245
  }
221
246
  ], [tmTreeSelectorElement, showSearchResults, tmRecentsManagerElement, tmSearchQueryPanelElement, tmSavedQuerySelectorElement, fromDTD, mruTIDs]);
222
- return (_jsxs(_Fragment, { children: [showSearchResults ? _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'TMRecentsManager', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true, minPanelSizePx: !isMobile ? 250 : 150 }) }) }) : tmSearchQueryPanelElement, showSearchResults && _jsx(TMSearchResult, { isVisible: isVisible && currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, floatingActionConfig: floatingActionConfig, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, openInOffice: openInOffice, onRefreshSearchAsync: onRefreshSearchAsync, onClose: () => { onlyShowSearchQueryPanel ? setShowSearchResults(false) : setCurrentSearchView(TMSearchViews.Search); }, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, openEditPdf: openEditPdf, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, passToArchiveCallback: passToArchiveCallback, onSelectedTIDChanged: onCurrentTIDChangedCallback, showTodoDcmtForm: showTodoDcmtForm, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers })] }));
247
+ return (_jsxs(_Fragment, { children: [showSearchResults ? _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'TMRecentsManager', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true, minPanelSizePx: !isMobile ? 250 : 150 }) }) }) : tmSearchQueryPanelElement, showSearchResults && _jsx(TMSearchResult, { isVisible: isVisible && currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, floatingActionConfig: floatingActionConfig, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, openInOffice: openInOffice, onRefreshSearchAsync: onRefreshSearchAsync, onClose: () => { onlyShowSearchQueryPanel ? setShowSearchResults(false) : setCurrentSearchView(TMSearchViews.Search); }, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, openEditPdf: openEditPdf, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, passToArchiveCallback: passToArchiveCallback, onSelectedTIDChanged: onCurrentTIDChangedCallback, showTodoDcmtForm: showTodoDcmtForm, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers })] }));
223
248
  };
224
249
  export default TMSearch;
225
250
  const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
@@ -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(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false, onClick: () => setIsQueryPanelActive(true) }), items: [
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 })