@topconsultnpm/sdkui-react 6.20.0-dev1.99 → 6.20.0-dev2.2

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 (92) hide show
  1. package/lib/assets/headergradient.svg +87 -0
  2. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +56 -18
  3. package/lib/components/NewComponents/ContextMenu/styles.js +13 -34
  4. package/lib/components/NewComponents/ContextMenu/types.d.ts +8 -2
  5. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +315 -271
  6. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +4 -0
  7. package/lib/components/NewComponents/FloatingMenuBar/styles.js +6 -2
  8. package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +7 -4
  9. package/lib/components/base/TMButton.js +6 -0
  10. package/lib/components/base/TMClosableList.js +4 -0
  11. package/lib/components/base/TMDropDownMenu.js +2 -0
  12. package/lib/components/base/TMListView.js +1 -1
  13. package/lib/components/base/TMPanel.d.ts +1 -1
  14. package/lib/components/base/TMPanel.js +9 -5
  15. package/lib/components/base/TMPopUp.js +6 -0
  16. package/lib/components/base/TMToolbarCard.js +2 -0
  17. package/lib/components/base/TMTreeView.d.ts +2 -1
  18. package/lib/components/base/TMTreeView.js +33 -26
  19. package/lib/components/choosers/TMDataListItemChooser.d.ts +2 -0
  20. package/lib/components/choosers/TMDataListItemChooser.js +8 -2
  21. package/lib/components/choosers/TMDcmtTypeChooser.d.ts +1 -0
  22. package/lib/components/choosers/TMDcmtTypeChooser.js +11 -3
  23. package/lib/components/choosers/TMDistinctValues.js +2 -2
  24. package/lib/components/choosers/TMDynDataListItemChooser.d.ts +2 -0
  25. package/lib/components/choosers/TMDynDataListItemChooser.js +8 -2
  26. package/lib/components/choosers/TMMetadataChooser.d.ts +2 -0
  27. package/lib/components/choosers/TMMetadataChooser.js +11 -3
  28. package/lib/components/choosers/TMUserChooser.d.ts +2 -0
  29. package/lib/components/choosers/TMUserChooser.js +8 -2
  30. package/lib/components/editors/TMCheckBox.js +2 -0
  31. package/lib/components/editors/TMDateBox.js +18 -9
  32. package/lib/components/editors/TMEditorStyled.js +7 -0
  33. package/lib/components/editors/TMLocalizedTextBox.d.ts +3 -1
  34. package/lib/components/editors/TMLocalizedTextBox.js +16 -14
  35. package/lib/components/editors/TMMetadataEditor.d.ts +1 -0
  36. package/lib/components/editors/TMMetadataEditor.js +4 -4
  37. package/lib/components/editors/TMMetadataTextBox.d.ts +9 -0
  38. package/lib/components/editors/TMMetadataTextBox.js +92 -0
  39. package/lib/components/editors/TMMetadataValues.d.ts +2 -0
  40. package/lib/components/editors/TMMetadataValues.js +3 -3
  41. package/lib/components/editors/TMRadioButton.js +2 -0
  42. package/lib/components/editors/TMTextBox.d.ts +1 -1
  43. package/lib/components/editors/TMTextBox.js +23 -1
  44. package/lib/components/editors/TMTextExpression.js +6 -91
  45. package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +2 -0
  46. package/lib/components/features/documents/TMDcmtBlog.js +1 -1
  47. package/lib/components/features/documents/TMDcmtForm.js +120 -87
  48. package/lib/components/features/documents/TMDcmtPreview.js +91 -42
  49. package/lib/components/features/search/TMSearch.js +5 -1
  50. package/lib/components/features/search/TMSearchQueryEditor.d.ts +1 -0
  51. package/lib/components/features/search/TMSearchQueryEditor.js +10 -10
  52. package/lib/components/features/search/TMSearchQueryPanel.js +24 -10
  53. package/lib/components/features/search/TMSearchResult.js +168 -8
  54. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
  55. package/lib/components/features/search/TMSearchResultsMenuItems.js +24 -4
  56. package/lib/components/features/search/TMViewHistoryDcmt.js +45 -50
  57. package/lib/components/features/tasks/TMTaskForm.js +55 -24
  58. package/lib/components/features/tasks/TMTasksUtils.js +14 -1
  59. package/lib/components/features/workflow/TMWorkflowPopup.js +5 -4
  60. package/lib/components/features/workflow/diagram/DiagramItemComponent.js +2 -0
  61. package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
  62. package/lib/components/features/workflow/diagram/WFDiagram.js +1 -1
  63. package/lib/components/forms/Login/TMLoginForm.js +1 -1
  64. package/lib/components/grids/TMValidationItemsList.js +6 -0
  65. package/lib/components/index.d.ts +1 -0
  66. package/lib/components/index.js +1 -0
  67. package/lib/components/layout/panelManager/TMPanelManagerContext.js +13 -5
  68. package/lib/components/query/TMQueryEditor.d.ts +4 -0
  69. package/lib/components/query/TMQueryEditor.js +14 -10
  70. package/lib/components/sidebar/TMHeader.js +11 -7
  71. package/lib/components/sidebar/TMSidebar.d.ts +0 -1
  72. package/lib/components/sidebar/TMSidebar.js +16 -44
  73. package/lib/components/sidebar/TMSidebarItem.js +36 -17
  74. package/lib/helper/SDKUI_Globals.d.ts +3 -0
  75. package/lib/helper/SDKUI_Globals.js +6 -3
  76. package/lib/helper/SDKUI_Localizator.d.ts +4 -16
  77. package/lib/helper/SDKUI_Localizator.js +37 -157
  78. package/lib/helper/TMIcons.d.ts +1 -0
  79. package/lib/helper/TMIcons.js +3 -0
  80. package/lib/helper/TMToppyMessage.js +4 -0
  81. package/lib/helper/TMUtils.d.ts +2 -1
  82. package/lib/helper/TMUtils.js +13 -1
  83. package/lib/helper/helpers.d.ts +27 -1
  84. package/lib/helper/helpers.js +107 -1
  85. package/lib/helper/queryHelper.d.ts +1 -1
  86. package/lib/helper/queryHelper.js +24 -1
  87. package/lib/hooks/useFloatingBarPinnedItems.d.ts +11 -0
  88. package/lib/hooks/useFloatingBarPinnedItems.js +54 -0
  89. package/lib/hooks/useMetadataExpression.d.ts +19 -0
  90. package/lib/hooks/useMetadataExpression.js +99 -0
  91. package/lib/ts/types.d.ts +3 -0
  92. package/package.json +55 -55
@@ -8,7 +8,7 @@ import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
8
8
  import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
9
9
  import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
10
10
  import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
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, getExceptionMessage, isApprovalWorkflowView, getDcmtCicoStatus, IconFileDots, IconCustom, buildWorkItemsFromWFCtrl } from '../../../helper';
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, getExceptionMessage, isApprovalWorkflowView, getDcmtCicoStatus, IconFileDots, IconCustom, buildWorkItemsFromWFCtrl, IconLock } from '../../../helper';
12
12
  import { hasDetailRelations, hasMasterRelations, isXMLFileExt } from '../../../helper/dcmtsHelper';
13
13
  import { Gutters, TMColors } from '../../../utils/theme';
14
14
  import { StyledFormButtonsContainer, StyledLoadingContainer, StyledModalContainer, StyledReferenceButton, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
@@ -38,7 +38,7 @@ import WFDiagram from '../workflow/diagram/WFDiagram';
38
38
  import TMTooltip from '../../base/TMTooltip';
39
39
  import TMDcmtTasks from './TMDcmtTasks';
40
40
  import TMToppyMessage from '../../../helper/TMToppyMessage';
41
- import { getTaskAssignedToMe } from '../tasks/TMTasksUtils';
41
+ import { getTaskAssignedByMe, getTaskAssignedToMe } from '../tasks/TMTasksUtils';
42
42
  import TMCustomButton from '../../base/TMCustomButton';
43
43
  import { useCheckInOutOperations } from '../../../hooks/useCheckInOutOperations';
44
44
  import TMViewHistoryDcmt from '../search/TMViewHistoryDcmt';
@@ -62,6 +62,7 @@ export var InvocationContext;
62
62
  // Aggiungi qui altri contesti futuri secondo necessità
63
63
  })(InvocationContext || (InvocationContext = {}));
64
64
  let abortControllerLocal = new AbortController();
65
+ ;
65
66
  //#endregion
66
67
  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, invocationContext = InvocationContext.Default, titleModal, isModal = false, widthModal = "100%", heightModal = "100%", groupId, onWFOperationCompleted, onTaskCompleted, onTaskCreateRequest, inputFile = null, taskFormDialogComponent, moreInfoTasks, connectorFileSave = undefined, inputMids = [], openS4TViewer = false, onOpenS4TViewerRequest, s4TViewerDialogComponent, enableDragDropOverlay = false, passToSearch, isSharedDcmt = false, sharedSourceTID, sharedSourceDID, allowButtonsRefs = false, onReferenceClick, }) => {
67
68
  const { showHistory, showHistoryCallback, hideHistoryCallback, showCheckoutInformationForm, commentFormState, hideCommentFormCallback, showCheckoutInformationFormCallback, hideCheckoutInformationFormCallback, copyCheckoutPathToClipboardCallback, handleCheckOutCallback, handleCheckInCallback, refreshPreviewTrigger, showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, } = useCheckInOutOperations();
@@ -121,6 +122,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
121
122
  // Stato per triggerare il refresh del blog dall'esterno
122
123
  const [refreshBlogTrigger, setRefreshBlogTrigger] = useState(0);
123
124
  const [wfError, setWfError] = useState(null);
125
+ const [metadataDcmtOrigin, setMetadataDcmtOrigin] = useState(null);
124
126
  const triggerBlogRefresh = useCallback(async () => {
125
127
  setRefreshBlogTrigger(prev => prev + 1);
126
128
  }, []);
@@ -188,10 +190,11 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
188
190
  return;
189
191
  TMSpinner.show({ description: 'Loading Metadata...' });
190
192
  let res = getMetadataResult ?? await SDK_Globals.tmSession?.NewSearchEngine().GetMetadataAsync(TID, did, true);
193
+ const origin = { fromName: res?.fromName, fromTID: res?.fromTID };
191
194
  let dtd = res?.dtdResult;
192
195
  let rows = dtd.rows ? dtd.rows[0] : [];
193
196
  let mids = res?.selectMIDs;
194
- let metadataList = searchResultToMetadataValues(TID, dtd, rows, mids, mdList, layoutMode);
197
+ let metadataList = searchResultToMetadataValues(TID, dtd, rows, mids, mdList, layoutMode, origin.fromTID?.toString() !== TID?.toString());
195
198
  if (archived) {
196
199
  // Usa setFormData con funzione callback per accedere allo stato precedente
197
200
  // invece di dipendere da formDataOrig nell'array di dipendenze
@@ -217,6 +220,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
217
220
  });
218
221
  return;
219
222
  }
223
+ setMetadataDcmtOrigin(origin);
220
224
  setFormDataOrig(structuredClone(metadataList));
221
225
  setFormData(structuredClone(metadataList));
222
226
  // Sincronizza il ref con i dati caricati per evitare stale closure in handleSave
@@ -278,7 +282,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
278
282
  }
279
283
  else {
280
284
  const renderedMetadata = dtd?.metadata?.filter((metadata) => handleArchiveVisibility(metadata)) ?? [];
281
- const metadataList = searchResultToMetadataValues(dtd?.id, undefined, [], [], renderedMetadata, layoutMode);
285
+ const metadataList = searchResultToMetadataValues(dtd?.id, undefined, [], [], renderedMetadata, layoutMode, metadataDcmtOrigin?.fromTID?.toString() !== TID?.toString());
282
286
  setFormDataOrig(structuredClone(metadataList));
283
287
  setFormData(structuredClone(metadataList));
284
288
  formDataOrigRef.current = structuredClone(metadataList);
@@ -293,7 +297,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
293
297
  setIsInitialLoading(false);
294
298
  setIsNavigating(false);
295
299
  }
296
- }, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs]);
300
+ }, [TID, DID, layoutMode, inputFile, setMetadataList, handleReset, allowButtonsRefs, metadataDcmtOrigin?.fromTID]);
297
301
  const createChange = useCallback((mid, metadataType, modifiedValue) => {
298
302
  return { mid, metadataType, modifiedValue };
299
303
  }, []);
@@ -1212,7 +1216,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1212
1216
  }, [formData, fromDTD, isMobile]);
1213
1217
  const tmDcmtForm = useMemo(() => {
1214
1218
  return _jsxs(_Fragment, { children: [checkoutBadge && _jsx("div", { style: { padding: '10px', display: 'flex', justifyContent: 'center' }, children: checkoutBadge }), metadataValuesSource.length > 0 &&
1215
- _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, inputMids: inputMids, layout: layout, onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
1219
+ _jsxs(StyledToolbarCardContainer, { children: [_jsx(TMMetadataValues, { TID: TID, metadataValues: metadataValuesSource, metadataValuesOrig: metadataValuesSourceOrig, isExpertMode: isExpertMode, isOpenDistinctValues: isOpenDistinctValues, openChooserBySingleClick: !isOpenDistinctValues, selectedMID: focusedMetadataValue?.mid, isReadOnly: formMode === FormModes.ReadOnly, layoutMode: layoutMode, deviceType: deviceType, validationItems: validationItems, inputMids: inputMids, layout: layout, isReadOnlyOrigin: metadataDcmtOrigin?.fromTID?.toString() !== TID?.toString(), onFocusedItemChanged: (item) => { (item?.mid !== focusedMetadataValue?.mid) && setFocusedMetadataValue(item); }, onValueChanged: (newItems) => {
1216
1220
  setFormData((prevItems) => prevItems.map((item) => {
1217
1221
  const newItem = newItems.find((newItem) => newItem.tid === item.tid && newItem.mid === item.mid);
1218
1222
  return newItem ? { ...item, ...newItem } : item;
@@ -1257,7 +1261,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1257
1261
  showAll,
1258
1262
  handleConfirmAction,
1259
1263
  handleUndo,
1260
- handleClearForm
1264
+ handleClearForm,
1265
+ metadataDcmtOrigin
1261
1266
  ]);
1262
1267
  const tmBlog = useMemo(() => _jsx(TMDcmtBlog, { tid: TID, did: DID, allTasks: allTasks, fetchBlogDataTrigger: refreshBlogTrigger, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers }), [TID, DID, allTasks, refreshBlogTrigger, handleNavigateToWGs, handleNavigateToDossiers]);
1263
1268
  const tmSysMetadata = useMemo(() => _jsx(TMMetadataValues, { layoutMode: layoutMode, openChooserBySingleClick: !isOpenDistinctValues, TID: TID, isReadOnly: true, deviceType: deviceType, metadataValues: formData.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: formData.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [], inputMids: inputMids }), [TID, layoutMode, formData, deviceType, inputMids]);
@@ -1353,89 +1358,117 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1353
1358
  'tmWF': false,
1354
1359
  'tmDcmtTasks': false,
1355
1360
  };
1356
- const initialPanels = useMemo(() => [
1357
- {
1358
- id: 'tmDcmtForm',
1359
- name: SDK_Localizator.Metadatas,
1360
- contentOptions: {
1361
- component: tmDcmtForm,
1362
- isClosable: isClosable,
1363
- panelContainer: {
1364
- showHeader: showHeader,
1365
- title: fromDTD?.nameLoc,
1366
- allowMaximize: !isMobile,
1367
- onBack: showBackButton ? (isClosable && deviceType !== DeviceType.MOBILE) ? undefined : handleClose : undefined,
1368
- onClose: isClosable ? () => { } : undefined,
1369
- toolbar: allowNavigation ? formToolbar : _jsx(_Fragment, {})
1361
+ const getDcmtTasksCounter = (TID, DID, allTasks) => {
1362
+ if (!TID || !DID || !allTasks || allTasks.length === 0) {
1363
+ return {
1364
+ assignedToMe: 0,
1365
+ assignedByMe: 0
1366
+ };
1367
+ }
1368
+ try {
1369
+ const assignedToMe = getTaskAssignedToMe(allTasks).filter(task => task.iD1?.toString() === TID.toString() && task.iD2?.toString() === DID.toString() && task.state !== Task_States.Completed).length ?? 0;
1370
+ const assignedByMe = getTaskAssignedByMe(allTasks).filter(task => task.iD1?.toString() === TID.toString() && task.iD2?.toString() === DID.toString() && task.state !== Task_States.Completed).length ?? 0;
1371
+ return {
1372
+ assignedToMe,
1373
+ assignedByMe
1374
+ };
1375
+ }
1376
+ catch (error) {
1377
+ return {
1378
+ assignedToMe: 0,
1379
+ assignedByMe: 0
1380
+ };
1381
+ }
1382
+ };
1383
+ const initialPanels = useMemo(() => {
1384
+ const { assignedToMe, assignedByMe } = getDcmtTasksCounter(TID, DID, allTasks);
1385
+ let titleDcmtFormPanel = fromDTD?.nameLoc ?? "";
1386
+ // Caso: Il documento proviene da un'origine esterna
1387
+ if (metadataDcmtOrigin?.fromTID?.toString() !== TID?.toString()) {
1388
+ titleDcmtFormPanel = (_jsxs("div", { style: { display: 'inline-flex', alignItems: 'center', gap: '4px' }, children: [_jsx(TMTooltip, { content: _jsxs("div", { style: { textAlign: 'left' }, children: [_jsx("p", { children: "Questo documento proviene da un'altra origine e non pu\u00F2 essere modificato." }), _jsx("hr", {}), _jsxs("p", { children: [_jsx("strong", { children: "TID corrente:" }), " ", TID?.toString()] }), _jsxs("p", { children: [_jsx("strong", { children: "Nome corrente:" }), " ", fromDTD?.nameLoc] }), _jsx("hr", {}), _jsxs("p", { children: [_jsx("strong", { children: "TID origine:" }), " ", metadataDcmtOrigin?.fromTID?.toString()] }), _jsxs("p", { children: [_jsx("strong", { children: "Nome origine:" }), " ", metadataDcmtOrigin?.fromName] })] }), children: _jsx(IconLock, { fontSize: 16, style: { alignSelf: 'center' } }) }), metadataDcmtOrigin?.fromName] }));
1389
+ }
1390
+ const panels = [
1391
+ {
1392
+ id: 'tmDcmtForm',
1393
+ name: SDK_Localizator.Metadatas,
1394
+ contentOptions: {
1395
+ component: tmDcmtForm,
1396
+ isClosable: isClosable,
1397
+ panelContainer: {
1398
+ showHeader: showHeader,
1399
+ title: titleDcmtFormPanel,
1400
+ allowMaximize: !isMobile,
1401
+ onBack: showBackButton ? (isClosable && deviceType !== DeviceType.MOBILE) ? undefined : handleClose : undefined,
1402
+ onClose: isClosable ? () => { } : undefined,
1403
+ toolbar: allowNavigation ? formToolbar : _jsx(_Fragment, {})
1404
+ },
1370
1405
  },
1406
+ toolbarOptions: {
1407
+ icon: _jsx(IconPreview, { fontSize: 24 }),
1408
+ visible: true,
1409
+ orderNumber: 1,
1410
+ isActive: allInitialPanelVisibility['tmDcmtForm']
1411
+ }
1371
1412
  },
1372
- toolbarOptions: {
1373
- icon: _jsx(IconPreview, { fontSize: 24 }),
1374
- visible: true,
1375
- orderNumber: 1,
1376
- isActive: allInitialPanelVisibility['tmDcmtForm']
1377
- }
1378
- },
1379
- {
1380
- id: 'tmBlog',
1381
- name: SDKUI_Localizator.BlogCase,
1382
- contentOptions: { component: tmBlog, panelContainer: { title: SDKUI_Localizator.BlogCase, allowMaximize: !isMobile } },
1383
- toolbarOptions: {
1384
- icon: _jsx(IconBoard, { fontSize: 24 }),
1385
- visible: true,
1386
- disabled: isBoardDisabled,
1387
- orderNumber: 2,
1388
- isActive: allInitialPanelVisibility['tmBlog']
1389
- }
1390
- },
1391
- {
1392
- id: 'tmSysMetadata',
1393
- name: SDKUI_Localizator.MetadataSystem,
1394
- contentOptions: { component: tmSysMetadata, panelContainer: { title: SDKUI_Localizator.MetadataSystem, allowMaximize: !isMobile } },
1395
- toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: true, disabled: isSysMetadataDisabled, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
1396
- },
1397
- {
1398
- id: 'tmDcmtPreview',
1399
- name: SDKUI_Localizator.PreviewDocument,
1400
- contentOptions: { component: tmDcmtPreview },
1401
- toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), disabled: isPreviewDisabled, visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
1402
- },
1403
- {
1404
- id: 'tmWF',
1405
- name: "Workflow",
1406
- contentOptions: {
1407
- component: tmWF,
1408
- panelContainer: {
1409
- title: "Workflow", allowMaximize: !isMobile
1413
+ {
1414
+ id: 'tmBlog',
1415
+ name: SDKUI_Localizator.BlogCase,
1416
+ contentOptions: { component: tmBlog, panelContainer: { title: SDKUI_Localizator.BlogCase, allowMaximize: !isMobile } },
1417
+ toolbarOptions: {
1418
+ icon: _jsx(IconBoard, { fontSize: 24 }),
1419
+ visible: true,
1420
+ disabled: isBoardDisabled,
1421
+ orderNumber: 2,
1422
+ isActive: allInitialPanelVisibility['tmBlog']
1410
1423
  }
1411
1424
  },
1412
- toolbarOptions: {
1413
- icon: _jsx(IconWorkflow, { fontSize: 24 }),
1414
- visible: true,
1415
- disabled: isWFDisabled,
1416
- orderNumber: 5,
1417
- isActive: allInitialPanelVisibility['tmWF']
1418
- }
1419
- },
1420
- {
1421
- id: 'tmDcmtTasks',
1422
- name: SDKUI_Localizator.Widget_Activities,
1423
- contentOptions: {
1424
- component: tmDcmtTasks,
1425
+ {
1426
+ id: 'tmSysMetadata',
1427
+ name: SDKUI_Localizator.MetadataSystem,
1428
+ contentOptions: { component: tmSysMetadata, panelContainer: { title: SDKUI_Localizator.MetadataSystem, allowMaximize: !isMobile } },
1429
+ toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: true, disabled: isSysMetadataDisabled, orderNumber: 3, isActive: allInitialPanelVisibility['tmSysMetadata'] }
1425
1430
  },
1426
- toolbarOptions: {
1427
- icon: _jsx(IconActivity, { fontSize: 24 }),
1428
- visible: layoutMode !== LayoutModes.Ark,
1429
- orderNumber: 6,
1430
- isActive: allInitialPanelVisibility['tmDcmtTasks'],
1431
- count: (TID && DID && allTasks && allTasks.length > 0) ?
1432
- getTaskAssignedToMe(allTasks).filter(task => task.iD1?.toString() === TID.toString()
1433
- && task.iD2?.toString() === DID.toString()
1434
- && task.state !== Task_States.Completed).length ?? 0
1435
- : 0
1436
- }
1437
- },
1438
- ], [fromDTD, showBackButton, tmDcmtForm, tmBlog, tmSysMetadata, tmDcmtPreview, tmWF, tmDcmtTasks, isPreviewDisabled, isSysMetadataDisabled, isBoardDisabled, isWFDisabled, inputFile, isClosable, allTasks, DID, TID]);
1431
+ {
1432
+ id: 'tmDcmtPreview',
1433
+ name: SDKUI_Localizator.PreviewDocument,
1434
+ contentOptions: { component: tmDcmtPreview },
1435
+ toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), disabled: isPreviewDisabled, visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['tmDcmtPreview'] }
1436
+ },
1437
+ {
1438
+ id: 'tmWF',
1439
+ name: "Workflow",
1440
+ contentOptions: {
1441
+ component: tmWF,
1442
+ panelContainer: {
1443
+ title: "Workflow", allowMaximize: !isMobile
1444
+ }
1445
+ },
1446
+ toolbarOptions: {
1447
+ icon: _jsx(IconWorkflow, { fontSize: 24 }),
1448
+ visible: true,
1449
+ disabled: isWFDisabled,
1450
+ orderNumber: 5,
1451
+ isActive: allInitialPanelVisibility['tmWF']
1452
+ }
1453
+ },
1454
+ {
1455
+ id: 'tmDcmtTasks',
1456
+ name: SDKUI_Localizator.Widget_Activities,
1457
+ contentOptions: {
1458
+ component: tmDcmtTasks,
1459
+ },
1460
+ toolbarOptions: {
1461
+ icon: _jsx(IconActivity, { fontSize: 24 }),
1462
+ visible: layoutMode !== LayoutModes.Ark,
1463
+ orderNumber: 6,
1464
+ isActive: allInitialPanelVisibility['tmDcmtTasks'],
1465
+ count: assignedToMe + assignedByMe,
1466
+ tooltip: _jsx("div", { children: assignedToMe + assignedByMe === 0 ? (SDKUI_Localizator.Widget_Activities) : (_jsxs("div", { children: [_jsx("div", { style: { textAlign: 'center', fontWeight: 'bold' }, children: SDKUI_Localizator.Widget_Activities }), _jsxs("div", { style: { textAlign: 'left' }, children: [_jsxs("div", { children: [SDKUI_Localizator.AssignedToMe, ": ", assignedToMe] }), _jsxs("div", { children: [SDKUI_Localizator.AssignedByMe, ": ", assignedByMe] })] })] })) })
1467
+ }
1468
+ },
1469
+ ];
1470
+ return panels;
1471
+ }, [fromDTD, showBackButton, tmDcmtForm, tmBlog, tmSysMetadata, tmDcmtPreview, tmWF, tmDcmtTasks, isPreviewDisabled, isSysMetadataDisabled, isBoardDisabled, isWFDisabled, inputFile, isClosable, allTasks, DID, TID, metadataDcmtOrigin?.fromTID]);
1439
1472
  // Retrieves the current document form setting based on the normalized TID
1440
1473
  const getCurrentDcmtFormSetting = () => {
1441
1474
  const settings = SDKUI_Globals.userSettings.dcmtFormSettings;
@@ -1530,8 +1563,8 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
1530
1563
  }, [onReferenceClick]);
1531
1564
  // Mapping for objClass specific label/action. Easy to extend for future objClass types.
1532
1565
  const referenceActionMap = useMemo(() => ({
1533
- [ObjectClasses.Dossier]: { label: 'Vai a pratica' },
1534
- [ObjectClasses.WorkingGroup]: { label: 'Vai a gruppo di lavoro' },
1566
+ [ObjectClasses.Dossier]: { label: SDKUI_Localizator.GoToDossier },
1567
+ [ObjectClasses.WorkingGroup]: { label: SDKUI_Localizator.GoToWorkgroup },
1535
1568
  // add other ObjectClasses here as needed
1536
1569
  }), []);
1537
1570
  const renderDcmtForm = () => {
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useRef, useState } from 'react';
3
3
  import styled from 'styled-components';
4
- import { RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, FileFormats } from '@topconsultnpm/sdk-ts';
5
- import { extensionHandler, sleep, getExceptionMessage, formatBytes, IconMenuVertical, IconCloseCircle, IconClear, IconCloseOutline, IconPreview, SDKUI_Globals, IconZoomOutLinear, IconZoomInLinear, IconPrintOutline, SDKUI_Localizator, IconRefresh } from '../../../helper';
4
+ import { RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, FileFormats, SDK_Globals } from '@topconsultnpm/sdk-ts';
5
+ import { extensionHandler, sleep, getExceptionMessage, formatBytes, IconMenuVertical, IconCloseCircle, IconClear, IconCloseOutline, IconPreview, SDKUI_Globals, IconZoomOutLinear, IconZoomInLinear, IconPrintOutline, SDKUI_Localizator, IconRefresh, IconCache, dcmtsFileCachePreview, CACHE_SIZE_LIMIT } from '../../../helper';
6
6
  import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
7
7
  import { FileExtensionHandler, FormModes } from '../../../ts';
8
8
  import { TMColors } from '../../../utils/theme';
@@ -29,7 +29,15 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
29
29
  const [error, setError] = useState('');
30
30
  const [isAbortError, setIsAbortError] = useState(false);
31
31
  const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, getDcmtFileAsync, clearDcmtsFileCache, removeDcmtsFileCache, isDcmtFileInCache } = useDcmtOperations();
32
- const cacheKey = dcmtData ? `${dcmtData.tid}-${dcmtData.did}` : '00';
32
+ const isBasketMode = !!(dcmtData?.btid !== undefined && dcmtData?.bid !== undefined && dcmtData?.bfid !== undefined);
33
+ const getCacheKey = () => {
34
+ if (!dcmtData)
35
+ return '00';
36
+ if (isBasketMode)
37
+ return `basket-${dcmtData.btid}-${dcmtData.bid}-${dcmtData.bfid}`;
38
+ return `${dcmtData.tid}-${dcmtData.did}`;
39
+ };
40
+ const cacheKey = getCacheKey();
33
41
  const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false);
34
42
  const [lastLoadedDid, setLastLoadedDid] = useState(undefined);
35
43
  useEffect(() => {
@@ -41,10 +49,10 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
41
49
  setShowPreview(false);
42
50
  return;
43
51
  }
44
- const currentCacheKey = `${dcmtData.tid}-${dcmtData.did}`;
52
+ const currentCacheKey = isBasketMode ? `basket-${dcmtData.btid}-${dcmtData.bid}-${dcmtData.bfid}` : `${dcmtData.tid}-${dcmtData.did}`;
45
53
  const shouldFetch = isVisible && (!hasLoadedDataOnce || currentCacheKey !== lastLoadedDid);
46
54
  if (isDcmtFileInCache(currentCacheKey)) {
47
- loadDocumentWithCache();
55
+ isBasketMode ? loadBasketFile() : loadDocumentWithCache();
48
56
  setShowPreview(true);
49
57
  return;
50
58
  }
@@ -52,7 +60,11 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
52
60
  setDcmtBlob(undefined);
53
61
  setError('');
54
62
  setIsAbortError(false);
55
- if ((extensionHandler(dcmtData.fileExt) !== FileExtensionHandler.NONE) && ((dcmtData.fileSize ?? 0) <= (SDKUI_Globals.userSettings.searchSettings.previewThreshold * 1024))) {
63
+ if (isBasketMode) {
64
+ loadBasketFile();
65
+ setShowPreview(true);
66
+ }
67
+ else if ((extensionHandler(dcmtData.fileExt) !== FileExtensionHandler.NONE) && ((dcmtData.fileSize ?? 0) <= (SDKUI_Globals.userSettings.searchSettings.previewThreshold * 1024))) {
56
68
  loadDocumentWithCache();
57
69
  setShowPreview(true);
58
70
  }
@@ -63,6 +75,46 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
63
75
  setLastLoadedDid(currentCacheKey);
64
76
  }
65
77
  }, [dcmtData?.did, isVisible, hasLoadedDataOnce, lastLoadedDid]);
78
+ const loadBasketFile = async () => {
79
+ try {
80
+ // Check cache first
81
+ if (dcmtsFileCachePreview.has(cacheKey)) {
82
+ setDcmtBlob(dcmtsFileCachePreview.get(cacheKey));
83
+ setIsFromCache(true);
84
+ setError('');
85
+ setIsAbortError(false);
86
+ return;
87
+ }
88
+ await sleep(300);
89
+ const basketEngine = SDK_Globals.tmSession?.NewBasketEngine();
90
+ const file = await basketEngine?.RetrieveFileAsync(dcmtData?.btid, dcmtData?.bid, dcmtData?.bfid, abortController.signal);
91
+ // Store in cache
92
+ if (file) {
93
+ if (dcmtsFileCachePreview.size >= CACHE_SIZE_LIMIT) {
94
+ const oldestKey = dcmtsFileCachePreview.keys().next().value;
95
+ dcmtsFileCachePreview.delete(oldestKey);
96
+ }
97
+ dcmtsFileCachePreview.set(cacheKey, file);
98
+ }
99
+ setDcmtBlob(file);
100
+ setIsFromCache(false);
101
+ setError('');
102
+ setIsAbortError(false);
103
+ }
104
+ catch (ex) {
105
+ const err = ex;
106
+ if (err.name === 'CanceledError') {
107
+ setError('Operazione annullata.');
108
+ setIsAbortError(true);
109
+ ShowAlert({ message: err.message, mode: 'warning', duration: 3000, title: 'Abort' });
110
+ }
111
+ else {
112
+ setError(getExceptionMessage(ex));
113
+ setIsAbortError(false);
114
+ TMExceptionBoxManager.show({ exception: ex });
115
+ }
116
+ }
117
+ };
66
118
  const loadDocumentWithCache = async () => {
67
119
  const rfo = new RetrieveFileOptions();
68
120
  rfo.retrieveReason = DcmtOpers.None;
@@ -94,7 +146,7 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
94
146
  };
95
147
  const titleHandler = () => {
96
148
  let title = 'Anteprima ';
97
- if (!dcmtData?.did)
149
+ if (!dcmtData?.did && !isBasketMode)
98
150
  return title;
99
151
  let extensionInfo;
100
152
  if (dcmtData.fileExt !== null) {
@@ -107,8 +159,9 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
107
159
  extensionInfo = '';
108
160
  title += extensionInfo;
109
161
  title += dcmtData.fileSize && dcmtData.fileSize > 0 ? formatBytes(dcmtData.fileSize) + ')' : '';
110
- if ((isDcmtFileInCache(cacheKey) && isFromCache)) {
111
- title += ' | da cache';
162
+ const isCached = isDcmtFileInCache(cacheKey) && isFromCache;
163
+ if (isCached) {
164
+ return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '3px' }, children: [title, _jsx(TMTooltip, { content: "da cache", children: _jsx(IconCache, { fontSize: 13 }) })] }));
112
165
  }
113
166
  return title;
114
167
  };
@@ -119,7 +172,7 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
119
172
  setIsAbortError(false);
120
173
  setDcmtBlob(undefined);
121
174
  try {
122
- await loadDocumentWithCache();
175
+ isBasketMode ? await loadBasketFile() : await loadDocumentWithCache();
123
176
  }
124
177
  catch (error) {
125
178
  console.error('Error reopening document:', error);
@@ -131,7 +184,7 @@ const TMDcmtPreview = ({ dcmtData, isResizingActive, isVisible, canNext, canPrev
131
184
  ], [cacheKey, removeDcmtsFileCache, clearDcmtsFileCache, setIsFromCache]);
132
185
  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
133
186
  ? _jsx(ErrorContent, { error: error, isAbortError: isAbortError, onRetry: reOpenDcmt })
134
- : renderedPreview(dcmtData?.tid, dcmtData?.did, dcmtData?.fileExt, dcmtData?.fileSize, dcmtData?.fileCount, extensionHandler(dcmtData?.fileExt), showPreview, isResizingActive, () => { loadDocumentWithCache(); setShowPreview(true); }, dcmtBlob) }) }));
187
+ : renderedPreview(dcmtData?.tid, dcmtData?.did, dcmtData?.fileExt, dcmtData?.fileSize, dcmtData?.fileCount, extensionHandler(dcmtData?.fileExt), showPreview, isResizingActive, () => { isBasketMode ? loadBasketFile() : loadDocumentWithCache(); setShowPreview(true); }, dcmtBlob, isBasketMode) }) }));
135
188
  };
136
189
  export default TMDcmtPreview;
137
190
  export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
@@ -340,32 +393,28 @@ const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
340
393
  const doc = iframe.contentWindow?.document;
341
394
  if (!doc)
342
395
  return;
343
- doc.open();
344
- doc.write(`
345
- <html>
346
- <head>
347
- <title>Print Image</title>
348
- <style>
349
- body, html {
350
- margin: 0;
351
- padding: 0;
352
- height: 100%;
353
- display: flex;
354
- justify-content: center;
355
- align-items: center;
356
- }
357
- img {
358
- max-width: 100%;
359
- max-height: 100%;
360
- }
361
- </style>
362
- </head>
363
- <body>
364
- <img src="${dataUrl}" onload="setTimeout(() => { window.print(); window.close(); }, 100);" />
365
- </body>
366
- </html>
367
- `);
368
- doc.close();
396
+ doc.documentElement.innerHTML = `
397
+ <head>
398
+ <title>Print Image</title>
399
+ <style>
400
+ body, html {
401
+ margin: 0;
402
+ padding: 0;
403
+ height: 100%;
404
+ display: flex;
405
+ justify-content: center;
406
+ align-items: center;
407
+ }
408
+ img {
409
+ max-width: 100%;
410
+ max-height: 100%;
411
+ }
412
+ </style>
413
+ </head>
414
+ <body>
415
+ <img src="${dataUrl}" onload="setTimeout(() => { window.print(); window.close(); }, 100);" />
416
+ </body>
417
+ `;
369
418
  iframe.contentWindow?.addEventListener('afterprint', () => {
370
419
  document.body.removeChild(iframe);
371
420
  });
@@ -385,13 +434,13 @@ const ImageViewer = ({ fileBlob, alt = 'Image', className }) => {
385
434
  export const TMNothingToShow = ({ text = '', secondText, fileExt, icon = _jsx(IconPreview, { fontSize: 96 }) }) => {
386
435
  return (_jsx(StyledAnimatedComponentOpacity, { style: { width: '100%', height: '100%' }, children: _jsxs(StyledPanelStatusContainer, { children: [icon, _jsxs(StyledPreviewNotAvailable, { children: [text && _jsx("div", { children: text }), _jsxs("div", { children: [" ", secondText ?? SDKUI_Localizator.PreviewNotAvailable, fileExt && _jsx("b", { children: ` (*.${fileExt})` })] })] })] }) }));
387
436
  };
388
- const renderedPreview = (tid, did, fileExt, fileSize, fileCount, extHandler, showPreview, isResizingActive, onDownloadShowPreviewClick, dcmtBlob) => {
389
- if (!did)
437
+ const renderedPreview = (tid, did, fileExt, fileSize, fileCount, extHandler, showPreview, isResizingActive, onDownloadShowPreviewClick, dcmtBlob, isBasketMode) => {
438
+ if (!isBasketMode && !did)
390
439
  return _jsx(TMNothingToShow, { text: `${SDKUI_Localizator.NoDcmtSelected}.` });
391
- if (fileCount == 0) {
440
+ if (!isBasketMode && fileCount == 0) {
392
441
  return _jsx(TMNothingToShow, { text: SDKUI_Localizator.MetadataOnlyDocument });
393
442
  }
394
- if (fileExt && extHandler === FileExtensionHandler.NONE) {
443
+ if (!isBasketMode && fileExt && extHandler === FileExtensionHandler.NONE) {
395
444
  return _jsx(TMNothingToShow, { fileExt: fileExt });
396
445
  }
397
446
  if (showPreview) {
@@ -404,7 +453,7 @@ const StyledPreviewContainer = styled.div `display: flex; justify-content: cente
404
453
  export const StyledHeaderIcon = styled.div ` color: ${props => props.$color}; cursor: pointer; display: flex; align-items: center; justify-content: center; &:hover{ color: white ; transition: 200ms ease; } `;
405
454
  export const StyledPanelStatusContainer = styled.div ` width: 100%; height: 100%; padding: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; `;
406
455
  const StyledPreviewNotAvailable = styled.div ` display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; `;
407
- const ImageContainer = styled.div ` width: calc(100% - 20px); height: 100%; left:10px; position: absolute; top:50px; overflow: hidden; background: #f5f5f5; touch-action: none; user-select: none; cursor: ${({ $cursor }) => $cursor ?? 'default'}; `;
456
+ const ImageContainer = styled.div ` width: calc(100% - 20px); height: 100%; left:10px; position: absolute; top:50px; overflow: hidden; background: #f5f5f5; touch-action: none; user-select: none; -webkit-touch-callout: none; -webkit-user-select: none; cursor: ${({ $cursor }) => $cursor ?? 'default'}; `;
408
457
  const TopToolbar = styled.div ` position: absolute; top: 0; width: 100%; height: 40px; background-color: #e4e4e4; display: flex; justify-content: center; align-items: center; z-index: 10; `;
409
458
  const ToolbarCenter = styled.div ` display: flex; align-items: center; gap: 12px;`;
410
459
  const ToolbarIconButton = styled.button ` background: #f0f0f0; border: none; color: #313131; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; height: 32px; width: 32px; padding: 0; border-radius: 50px; &:hover{ background-color: #c4c4c4; } &:disabled { color: #c2c2c2; cursor: not-allowed; } `;
@@ -133,8 +133,12 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
133
133
  setCurrentMruTID(0);
134
134
  };
135
135
  const onSQDItemClick = useCallback(async (sqd, setSqdAsync) => {
136
+ // Forza ricaricamento completo se la query è già selezionata
137
+ if (sqd.id === currentSQD?.id) {
138
+ await setSqdAsync(undefined);
139
+ }
136
140
  await setSqdAsync(sqd);
137
- }, []);
141
+ }, [currentSQD]);
138
142
  const onSQDDeleted = useCallback(async (sqd, sqdToBeSet, setSqdAsync) => {
139
143
  await loadDataSQDsAsync(true, sqd.masterTID);
140
144
  if (sqdToBeSet)
@@ -10,6 +10,7 @@ interface ITMSearchQueryEditorProps {
10
10
  onQdChanged?: (qd: QueryDescriptor) => void;
11
11
  onAdvancedMenuClick?: (e: AdvancedMenuClickEventArgs) => void;
12
12
  onFocusedMetadataChanged?: (tid_mid: TID_MID | undefined) => void;
13
+ updateIsModalOpen?: (isOpen: boolean) => void;
13
14
  }
14
15
  declare const _default: React.NamedExoticComponent<ITMSearchQueryEditorProps>;
15
16
  export default _default;