@topconsultnpm/sdkui-react 6.19.0-dev1.9 → 6.19.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 (116) hide show
  1. package/lib/components/base/Styled.d.ts +1 -0
  2. package/lib/components/base/Styled.js +40 -0
  3. package/lib/components/base/TMCustomButton.d.ts +11 -0
  4. package/lib/components/base/TMCustomButton.js +63 -0
  5. package/lib/components/base/TMFileManagerDataGridView.js +4 -1
  6. package/lib/components/base/TMLayout.d.ts +2 -1
  7. package/lib/components/base/TMLayout.js +2 -2
  8. package/lib/components/base/TMPopUp.js +5 -18
  9. package/lib/components/base/TMTreeView.js +3 -2
  10. package/lib/components/editors/TMHtmlEditor.d.ts +5 -0
  11. package/lib/components/editors/TMHtmlEditor.js +72 -12
  12. package/lib/components/editors/TMMetadataValues.js +90 -40
  13. package/lib/components/features/archive/TMArchive.d.ts +10 -0
  14. package/lib/components/features/archive/TMArchive.js +56 -25
  15. package/lib/components/features/blog/TMBlogCommentForm.d.ts +4 -4
  16. package/lib/components/features/blog/TMBlogCommentForm.js +76 -51
  17. package/lib/components/features/documents/TMDcmtBlog.d.ts +15 -0
  18. package/lib/components/features/documents/TMDcmtBlog.js +21 -33
  19. package/lib/components/features/documents/TMDcmtForm.d.ts +17 -3
  20. package/lib/components/features/documents/TMDcmtForm.js +205 -46
  21. package/lib/components/features/documents/TMDcmtTasks.d.ts +13 -0
  22. package/lib/components/features/documents/TMDcmtTasks.js +24 -0
  23. package/lib/components/features/documents/TMDragDropOverlay.js +2 -1
  24. package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +8 -1
  25. package/lib/components/features/documents/TMMasterDetailDcmts.js +6 -6
  26. package/lib/components/features/documents/TMRelationViewer.d.ts +53 -3
  27. package/lib/components/features/documents/TMRelationViewer.js +232 -85
  28. package/lib/components/features/search/TMSearch.d.ts +10 -1
  29. package/lib/components/features/search/TMSearch.js +14 -5
  30. package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -1
  31. package/lib/components/features/search/TMSearchQueryPanel.js +36 -7
  32. package/lib/components/features/search/TMSearchResult.d.ts +10 -1
  33. package/lib/components/features/search/TMSearchResult.js +140 -422
  34. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +2 -2
  35. package/lib/components/features/search/TMSearchResultsMenuItems.js +33 -8
  36. package/lib/components/features/tasks/TMTaskForm.d.ts +38 -0
  37. package/lib/components/features/tasks/TMTaskForm.js +386 -0
  38. package/lib/components/features/tasks/TMTasksAgenda.d.ts +17 -0
  39. package/lib/components/features/tasks/TMTasksAgenda.js +107 -0
  40. package/lib/components/features/tasks/TMTasksCalendar.d.ts +21 -0
  41. package/lib/components/features/tasks/TMTasksCalendar.js +240 -0
  42. package/lib/components/features/tasks/TMTasksHeader.d.ts +14 -0
  43. package/lib/components/features/tasks/TMTasksHeader.js +37 -0
  44. package/lib/components/features/tasks/TMTasksPanelContent.d.ts +20 -0
  45. package/lib/components/features/tasks/TMTasksPanelContent.js +65 -0
  46. package/lib/components/features/tasks/TMTasksUtils.d.ts +132 -0
  47. package/lib/components/features/tasks/TMTasksUtils.js +634 -0
  48. package/lib/components/features/tasks/TMTasksUtilsView.d.ts +39 -0
  49. package/lib/components/features/tasks/TMTasksUtilsView.js +118 -0
  50. package/lib/components/features/tasks/TMTasksView.d.ts +40 -0
  51. package/lib/components/features/tasks/TMTasksView.js +560 -0
  52. package/lib/components/features/workflow/TMWorkflowPopup.d.ts +3 -1
  53. package/lib/components/features/workflow/TMWorkflowPopup.js +19 -6
  54. package/lib/components/features/workflow/diagram/RecipientList.js +4 -3
  55. package/lib/components/forms/Login/Chooser.js +1 -1
  56. package/lib/components/forms/TMChooserForm.d.ts +1 -1
  57. package/lib/components/forms/TMChooserForm.js +2 -2
  58. package/lib/components/grids/TMBlogAttachments.d.ts +42 -0
  59. package/lib/components/grids/TMBlogAttachments.js +43 -0
  60. package/lib/components/grids/TMBlogHeader.d.ts +31 -0
  61. package/lib/components/grids/TMBlogHeader.js +41 -0
  62. package/lib/components/grids/{TMBlogs.d.ts → TMBlogsPost.d.ts} +42 -58
  63. package/lib/components/grids/TMBlogsPost.js +628 -0
  64. package/lib/components/grids/{TMBlogsUtils.d.ts → TMBlogsPostUtils.d.ts} +61 -47
  65. package/lib/components/grids/{TMBlogsUtils.js → TMBlogsPostUtils.js} +146 -124
  66. package/lib/components/index.d.ts +14 -1
  67. package/lib/components/index.js +15 -1
  68. package/lib/components/layout/panelManager/TMPanelManagerContext.js +7 -0
  69. package/lib/components/settings/SettingsAppearance.js +8 -0
  70. package/lib/components/viewers/TMTidViewer.js +20 -2
  71. package/lib/css/tm-sdkui.css +1 -1
  72. package/lib/helper/SDKUI_Globals.d.ts +4 -1
  73. package/lib/helper/SDKUI_Globals.js +10 -1
  74. package/lib/helper/SDKUI_Localizator.d.ts +62 -4
  75. package/lib/helper/SDKUI_Localizator.js +618 -25
  76. package/lib/helper/TMCustomSearchBar.d.ts +8 -0
  77. package/lib/helper/TMCustomSearchBar.js +54 -0
  78. package/lib/helper/TMIcons.d.ts +2 -0
  79. package/lib/helper/TMIcons.js +6 -0
  80. package/lib/helper/TMImageLibrary.d.ts +3 -2
  81. package/lib/helper/TMImageLibrary.js +230 -230
  82. package/lib/helper/TMToppyMessage.d.ts +7 -0
  83. package/lib/helper/TMToppyMessage.js +42 -0
  84. package/lib/helper/TMUtils.d.ts +10 -1
  85. package/lib/helper/TMUtils.js +42 -1
  86. package/lib/helper/dcmtsHelper.d.ts +2 -0
  87. package/lib/helper/dcmtsHelper.js +18 -0
  88. package/lib/helper/helpers.js +1 -0
  89. package/lib/helper/index.d.ts +1 -0
  90. package/lib/helper/index.js +1 -0
  91. package/lib/hooks/useRelatedDocuments.d.ts +72 -0
  92. package/lib/hooks/useRelatedDocuments.js +655 -0
  93. package/lib/index.d.ts +1 -0
  94. package/lib/index.js +1 -0
  95. package/lib/ts/types.d.ts +14 -0
  96. package/lib/ts/types.js +15 -0
  97. package/lib/utils/theme.d.ts +1 -0
  98. package/lib/utils/theme.js +1 -0
  99. package/package.json +7 -7
  100. package/lib/components/grids/TMBlogs.js +0 -721
  101. package/lib/stories/TMButton.stories.d.ts +0 -4
  102. package/lib/stories/TMButton.stories.js +0 -29
  103. package/lib/stories/TMDataGrid.stories.d.ts +0 -9
  104. package/lib/stories/TMDataGrid.stories.js +0 -310
  105. package/lib/stories/TMHtmlContentDisplay.stories.d.ts +0 -6
  106. package/lib/stories/TMHtmlContentDisplay.stories.js +0 -45
  107. package/lib/stories/TMHtmlEditor.stories.d.ts +0 -6
  108. package/lib/stories/TMHtmlEditor.stories.js +0 -49
  109. package/lib/stories/TMIcons.stories.d.ts +0 -4
  110. package/lib/stories/TMIcons.stories.js +0 -13
  111. package/lib/stories/TMSDKUI_Localizator.stories.d.ts +0 -4
  112. package/lib/stories/TMSDKUI_Localizator.stories.js +0 -123
  113. package/lib/stories/TMStoriesUtils.d.ts +0 -1
  114. package/lib/stories/TMStoriesUtils.js +0 -10
  115. package/lib/stories/TMUserAvatar.stories.d.ts +0 -6
  116. package/lib/stories/TMUserAvatar.stories.js +0 -20
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { DcmtTypeDescriptor, SearchResultDescriptor } from "@topconsultnpm/sdk-ts";
2
+ import { DcmtTypeDescriptor, SearchResultDescriptor, DataColumnDescriptor } from "@topconsultnpm/sdk-ts";
3
3
  import { DcmtInfo } from '../../../ts';
4
4
  import { ITMTreeItem } from '../../base/TMTreeView';
5
5
  /**
@@ -17,6 +17,7 @@ export interface RelationTreeItem extends ITMTreeItem {
17
17
  isMaster?: boolean;
18
18
  isCorrelated?: boolean;
19
19
  isLoaded?: boolean;
20
+ isSeparator?: boolean;
20
21
  values?: any;
21
22
  searchResult?: SearchResultDescriptor[];
22
23
  itemsCount?: number;
@@ -49,8 +50,24 @@ export interface TMRelationViewerProps {
49
50
  onSelectedItemsChanged?: (items: RelationTreeItem[]) => void;
50
51
  /** Callback when a document is double-clicked */
51
52
  onDocumentDoubleClick?: (tid: number, did: number, name?: string) => void;
52
- /** Custom item renderer */
53
- customItemRender?: (item: RelationTreeItem | null) => JSX.Element;
53
+ /** Custom item renderer (full control). Return undefined to use default renderer. */
54
+ customItemRender?: (item: RelationTreeItem | null) => JSX.Element | undefined;
55
+ /** Custom document style function */
56
+ customDocumentStyle?: (item: RelationTreeItem) => React.CSSProperties;
57
+ /**
58
+ * Custom content renderer for the main container (when showMainDocument is false).
59
+ * Allows full control over the main container rendering including style and content.
60
+ * This replaces only the main container content, not the detail containers.
61
+ */
62
+ customMainContainerContent?: (item: RelationTreeItem, defaultContent: JSX.Element) => JSX.Element;
63
+ /** Custom document content renderer (partial control - replaces only metadata display) */
64
+ customDocumentContent?: (item: RelationTreeItem, defaultMetadataContent: JSX.Element) => JSX.Element;
65
+ /**
66
+ * Show metadata names before values (default: false).
67
+ * When true, displays "MetadataName: Value", otherwise just "Value".
68
+ * Value rendering respects DataDomain (uses TMDataListItemViewer for lists, TMUserIdViewer for users, etc.)
69
+ */
70
+ showMetadataNames?: boolean;
54
71
  /** Maximum depth level for recursive loading (default: 2) */
55
72
  maxDepthLevel?: number;
56
73
  /**
@@ -58,6 +75,23 @@ export interface TMRelationViewerProps {
58
75
  * If false, when isForMaster=true shows: master docs → detail docs as children (original navigation)
59
76
  */
60
77
  invertMasterNavigation?: boolean;
78
+ /**
79
+ * Additional static items to append at the end of the tree.
80
+ * These items are not loaded dynamically - they must already contain all data.
81
+ * Useful for showing pre-calculated documents (e.g., additional documents in dossiers).
82
+ * Can include a separator item by marking it with `isSeparator: true`.
83
+ */
84
+ additionalStaticItems?: RelationTreeItem[];
85
+ /**
86
+ * If false, hides the main document node and shows detail containers directly under the main container.
87
+ * Default: true (show main document as intermediate node)
88
+ */
89
+ showMainDocument?: boolean;
90
+ /**
91
+ * Custom label for the main container when showMainDocument is false.
92
+ * If not provided, uses the document type name.
93
+ */
94
+ labelMainContainer?: string;
61
95
  }
62
96
  /**
63
97
  * Check if document type has detail relations
@@ -67,5 +101,21 @@ export declare const hasDetailRelations: (mTID: number | undefined) => Promise<b
67
101
  * Check if document type has master relations
68
102
  */
69
103
  export declare const hasMasterRelations: (dTID: number | undefined) => Promise<boolean>;
104
+ /**
105
+ * Get metadata keys excluding system metadata
106
+ */
107
+ export declare const getMetadataKeys: (obj: any) => string[];
108
+ /**
109
+ * Get display value keys for a document (max 5, prioritize SYS_Abstract)
110
+ */
111
+ export declare const getDcmtDisplayValue: (obj: any) => string[];
112
+ /**
113
+ * Get display value formatted by column type
114
+ */
115
+ export declare const getDisplayValueByColumn: (col: DataColumnDescriptor | undefined, value: any) => any;
116
+ /**
117
+ * Convert SearchResultDescriptor to structured data source with metadata
118
+ */
119
+ export declare const searchResultToDataSource: (searchResult: SearchResultDescriptor | undefined, hideSysMetadata?: boolean) => Promise<any[]>;
70
120
  declare const TMRelationViewer: React.FC<TMRelationViewerProps>;
71
121
  export default TMRelationViewer;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import React, { useCallback, useEffect, useState } from 'react';
2
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats, SystemMIDs, MetadataDataDomains, RelationCacheService, RelationTypes } from "@topconsultnpm/sdk-ts";
4
- import { genUniqueId, IconBackhandIndexPointingRight, IconFolder } from '../../../helper';
4
+ import { genUniqueId, IconFolder, IconBackhandIndexPointingRight } from '../../../helper';
5
5
  import { TMColors } from '../../../utils/theme';
6
6
  import { StyledDivHorizontal, StyledBadge } from '../../base/Styled';
7
7
  import TMTreeView from '../../base/TMTreeView';
@@ -9,9 +9,6 @@ import { TMWaitPanel } from '../../base/TMWaitPanel';
9
9
  import { TMUserIdViewer } from '../../choosers/TMUserChooser';
10
10
  import TMDataListItemViewer from '../../viewers/TMDataListItemViewer';
11
11
  import TMDcmtIcon from './TMDcmtIcon';
12
- // ============================================================================
13
- // UTILITY FUNCTIONS
14
- // ============================================================================
15
12
  /**
16
13
  * Check if document type has detail relations
17
14
  */
@@ -47,26 +44,32 @@ const isManyToManyRelation = async (relationID) => {
47
44
  /**
48
45
  * Get metadata keys excluding system metadata
49
46
  */
50
- function getMetadataKeys(obj) {
47
+ export const getMetadataKeys = (obj) => {
51
48
  if (!obj)
52
49
  return [];
53
50
  const keys = Object.keys(obj);
51
+ // Escludi metadati di sistema (MID < 100 che sono uppercase) e altri campi tecnici
54
52
  const sysMIDs = Object.values(SystemMIDs).map(o => o.toUpperCase());
55
53
  return keys.filter(k => obj?.[k].value && !sysMIDs.includes(k)).filter(o => o !== "rowIndex" && o !== "ISLEXPROT");
56
- }
54
+ };
57
55
  /**
58
56
  * Get display value keys for a document (max 5, prioritize SYS_Abstract)
59
57
  */
60
- function getDcmtDisplayValue(obj) {
58
+ export const getDcmtDisplayValue = (obj) => {
59
+ if (!obj)
60
+ return [];
61
+ // Prima cerca SYS_Abstract
62
+ if (obj['SYS_Abstract']?.value) {
63
+ return ['SYS_Abstract'];
64
+ }
65
+ // Altrimenti prendi i primi 5 metadati non di sistema
61
66
  const mdKeys = getMetadataKeys(obj);
62
- if (mdKeys.includes("SYS_Abstract"))
63
- return ["SYS_Abstract"];
64
67
  return mdKeys.slice(0, 5);
65
- }
68
+ };
66
69
  /**
67
70
  * Get display value formatted by column type
68
71
  */
69
- const getDisplayValueByColumn = (col, value) => {
72
+ export const getDisplayValueByColumn = (col, value) => {
70
73
  if (!value)
71
74
  return value;
72
75
  if (!col)
@@ -107,7 +110,7 @@ const getDisplayValueByColumn = (col, value) => {
107
110
  /**
108
111
  * Convert SearchResultDescriptor to structured data source with metadata
109
112
  */
110
- const searchResultToDataSource = async (searchResult, hideSysMetadata) => {
113
+ export const searchResultToDataSource = async (searchResult, hideSysMetadata) => {
111
114
  const rows = searchResult?.dtdResult?.rows ?? [];
112
115
  const tid = searchResult?.fromTID;
113
116
  const dtd = await DcmtTypeListCacheService.GetAsync(tid);
@@ -133,11 +136,12 @@ const searchResultToDataSource = async (searchResult, hideSysMetadata) => {
133
136
  }
134
137
  return output;
135
138
  };
136
- const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndicator = true, allowShowZeroDcmts = true, initialShowZeroDcmts = false, allowedTIDs, allowMultipleSelection = false, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onDocumentDoubleClick, customItemRender, maxDepthLevel = 2, invertMasterNavigation = true, }) => {
139
+ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndicator = true, allowShowZeroDcmts = true, initialShowZeroDcmts = false, allowedTIDs, allowMultipleSelection = false, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onDocumentDoubleClick, customItemRender, customDocumentStyle, customMainContainerContent, customDocumentContent, showMetadataNames = false, maxDepthLevel = 2, invertMasterNavigation = true, additionalStaticItems = [], showMainDocument = true, labelMainContainer, }) => {
137
140
  // State
138
141
  const [dcmtTypes, setDcmtTypes] = useState([]);
139
142
  const [treeData, setTreeData] = useState([]);
140
143
  const [showZeroDcmts, setShowZeroDcmts] = useState(initialShowZeroDcmts);
144
+ const [staticItemsState, setStaticItemsState] = useState([]);
141
145
  // Wait Panel State (only used if allowWaitPanel is true)
142
146
  const [showWaitPanel, setShowWaitPanel] = useState(false);
143
147
  const [waitPanelTextPrimary, setWaitPanelTextPrimary] = useState('');
@@ -146,6 +150,8 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
146
150
  const [abortController] = useState(new AbortController());
147
151
  // Ref to track last loaded input to prevent unnecessary reloads
148
152
  const lastLoadedInputRef = React.useRef('');
153
+ // Ref to track if user has manually expanded/collapsed static items
154
+ const userInteractedWithStaticItemsRef = React.useRef(false);
149
155
  /**
150
156
  * Generate a stable key from inputDcmts to detect real changes
151
157
  */
@@ -386,48 +392,86 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
386
392
  const relatedDocs = isForMaster
387
393
  ? await getMasterDcmtsAsync(dcmt.TID, dcmt.DID, maxDepthLevel)
388
394
  : await getDetailDcmtsAsync(dcmt.TID, dcmt.DID, maxDepthLevel);
389
- // Create document node WITH VALUES
390
- const docNode = {
391
- key: `${isForMaster ? 'detail' : 'master'}-doc-${dcmt.TID}-${dcmt.DID}-${containerGUID}`,
392
- name: docRow?.SYS_Abstract?.value || docRow?.SYS_SUBJECT?.value || `Documento ${isForMaster ? 'Dettaglio' : 'Master'}`,
393
- tid: dcmt.TID,
394
- did: dcmt.DID,
395
- isDcmt: true,
396
- isContainer: false,
397
- expanded: tree.length === 0,
398
- isZero: dcmt.DID === 0,
399
- isMaster: !isForMaster,
400
- isRoot: true,
401
- isLoaded: true,
402
- hidden: false,
403
- values: docRow,
404
- searchResult: result ? [result] : [],
405
- items: relatedDocs,
406
- itemsCount: relatedDocs.length
407
- };
408
- // Create type container with unique key
409
- const typeContainer = {
410
- key: `${isForMaster ? 'detail' : 'master'}-type-${dcmt.TID}-${containerGUID}`,
411
- name: result?.fromName || dtd?.name || `TID: ${dcmt.TID}`,
412
- tid: dcmt.TID,
413
- dtd,
414
- isContainer: true,
415
- isRoot: true,
416
- isLoaded: true,
417
- isZero: false, // Type container is never zero (contains documents)
418
- searchResult: result ? [result] : [],
419
- items: [docNode],
420
- itemsCount: 1,
421
- expanded: tree.length === 0
422
- };
423
- tree.push(typeContainer);
395
+ // Se showMainDocument è false, mostra i container dei dettagli direttamente sotto il container principale
396
+ if (!showMainDocument) {
397
+ // Create type container that contains detail containers directly
398
+ const typeContainer = {
399
+ key: `${isForMaster ? 'detail' : 'master'}-type-${dcmt.TID}-${containerGUID}`,
400
+ name: labelMainContainer || result?.fromName || dtd?.name || `TID: ${dcmt.TID}`,
401
+ tid: dcmt.TID,
402
+ dtd,
403
+ isContainer: true,
404
+ isRoot: true,
405
+ isLoaded: true,
406
+ isZero: false,
407
+ searchResult: result ? [result] : [],
408
+ items: relatedDocs, // Directly show detail containers
409
+ itemsCount: relatedDocs.length,
410
+ expanded: tree.length === 0,
411
+ hidden: false
412
+ };
413
+ tree.push(typeContainer);
414
+ }
415
+ else {
416
+ // MODALITÀ ORIGINALE: mostra il documento master come nodo intermedio
417
+ // Create document node WITH VALUES
418
+ const docNode = {
419
+ key: `${isForMaster ? 'detail' : 'master'}-doc-${dcmt.TID}-${dcmt.DID}-${containerGUID}`,
420
+ name: docRow?.SYS_Abstract?.value || docRow?.SYS_SUBJECT?.value || `Documento ${isForMaster ? 'Dettaglio' : 'Master'}`,
421
+ tid: dcmt.TID,
422
+ did: dcmt.DID,
423
+ isDcmt: true,
424
+ isContainer: false,
425
+ expanded: tree.length === 0,
426
+ isZero: dcmt.DID === 0,
427
+ isMaster: !isForMaster,
428
+ isRoot: true,
429
+ isLoaded: true,
430
+ hidden: false,
431
+ values: docRow,
432
+ searchResult: result ? [result] : [],
433
+ items: relatedDocs,
434
+ itemsCount: relatedDocs.length
435
+ };
436
+ // Create type container with unique key
437
+ const typeContainer = {
438
+ key: `${isForMaster ? 'detail' : 'master'}-type-${dcmt.TID}-${containerGUID}`,
439
+ name: labelMainContainer || result?.fromName || dtd?.name || `TID: ${dcmt.TID}`,
440
+ tid: dcmt.TID,
441
+ dtd,
442
+ isContainer: true,
443
+ isRoot: true,
444
+ isLoaded: true,
445
+ isZero: false, // Type container is never zero (contains documents)
446
+ searchResult: result ? [result] : [],
447
+ items: [docNode],
448
+ itemsCount: 1,
449
+ expanded: tree.length === 0,
450
+ hidden: false
451
+ };
452
+ tree.push(typeContainer);
453
+ }
424
454
  }
425
455
  // Update progress counter
426
456
  processedCount++;
427
457
  setWaitPanelValuePrimary(processedCount);
428
458
  }
429
459
  setTreeData(updateHiddenProperty(tree));
430
- }, [inputDcmts, dcmtTypes, maxDepthLevel, isForMaster, invertMasterNavigation, getDetailDcmtsAsync, getMasterDcmtsAsync, abortController, updateHiddenProperty]);
460
+ }, [inputDcmts, dcmtTypes, maxDepthLevel, isForMaster, invertMasterNavigation, getDetailDcmtsAsync, getMasterDcmtsAsync, abortController, updateHiddenProperty, showMainDocument, labelMainContainer]);
461
+ /**
462
+ * Merge main tree data with additional static items
463
+ */
464
+ const mergedTreeData = useMemo(() => {
465
+ if (!additionalStaticItems || additionalStaticItems.length === 0) {
466
+ return treeData;
467
+ }
468
+ // Use staticItemsState if available (preserves expanded state), otherwise use fresh additionalStaticItems
469
+ const itemsToMerge = staticItemsState.length > 0 ? staticItemsState : additionalStaticItems;
470
+ // Append additional static items at the end
471
+ // NOTE: Do NOT call updateHiddenProperty on static items - they are pre-processed by the parent
472
+ // and may contain custom properties that would be lost by the spread operator
473
+ return [...treeData, ...itemsToMerge];
474
+ }, [treeData, additionalStaticItems, staticItemsState]);
431
475
  /**
432
476
  * Load data when inputs change
433
477
  */
@@ -435,6 +479,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
435
479
  if (!inputDcmts || inputDcmts.length === 0 || dcmtTypes.length === 0) {
436
480
  setTreeData([]);
437
481
  lastLoadedInputRef.current = '';
482
+ userInteractedWithStaticItemsRef.current = false; // Reset interaction flag
438
483
  return;
439
484
  }
440
485
  // Generate current input key
@@ -445,6 +490,8 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
445
490
  }
446
491
  // Mark as loading this key
447
492
  lastLoadedInputRef.current = currentKey;
493
+ // Reset interaction flag when loading new data
494
+ userInteractedWithStaticItemsRef.current = false;
448
495
  setShowWaitPanel(true);
449
496
  setWaitPanelMaxValuePrimary(inputDcmts.length);
450
497
  setWaitPanelValuePrimary(0);
@@ -462,10 +509,51 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
462
509
  useEffect(() => {
463
510
  setTreeData(prevData => updateHiddenProperty(prevData));
464
511
  }, [showZeroDcmts, updateHiddenProperty]);
512
+ /**
513
+ * Sync static items state when additionalStaticItems change
514
+ * IMPORTANT: Only update if user hasn't manually interacted with the tree,
515
+ * to preserve expand/collapse state
516
+ */
517
+ useEffect(() => {
518
+ // If user hasn't interacted yet, sync with incoming additionalStaticItems
519
+ if (!userInteractedWithStaticItemsRef.current) {
520
+ setStaticItemsState(additionalStaticItems || []);
521
+ }
522
+ // If user has interacted, we need to merge the new data with existing state
523
+ // to preserve expanded/collapsed state while updating content
524
+ else if (additionalStaticItems && additionalStaticItems.length > 0) {
525
+ setStaticItemsState(prevState => {
526
+ // Create a map of existing state by key
527
+ const stateMap = new Map(prevState.map(item => [item.key, item]));
528
+ // Merge: use existing state if available (preserves expanded), otherwise use new item
529
+ return additionalStaticItems.map(newItem => {
530
+ const existingItem = stateMap.get(newItem.key);
531
+ if (existingItem) {
532
+ // Preserve expanded state but update content
533
+ return {
534
+ ...newItem,
535
+ expanded: existingItem.expanded,
536
+ items: newItem.items // Always use fresh items from parent
537
+ };
538
+ }
539
+ return newItem;
540
+ });
541
+ });
542
+ }
543
+ }, [additionalStaticItems]);
465
544
  /**
466
545
  * Calculate items for node when expanded (lazy loading)
546
+ * Note: additionalStaticItems are already fully loaded, so skip calculation for them
467
547
  */
468
548
  const calculateItemsForNode = useCallback(async (node) => {
549
+ // Skip calculation for separator (it has no children)
550
+ if (node.isSeparator) {
551
+ return undefined;
552
+ }
553
+ // Skip calculation for additional static items (they're pre-loaded and should not trigger dynamic loading)
554
+ if (node.isStaticItem || node.isAdditionalContainer || node.isAdditional) {
555
+ return node.items;
556
+ }
469
557
  // If it's a document, return existing items
470
558
  if (node.isDcmt)
471
559
  return node.items;
@@ -511,45 +599,92 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
511
599
  };
512
600
  // Container rendering
513
601
  if (item.isContainer || !item.isDcmt) {
514
- return (_jsxs("div", { style: {
515
- display: 'flex',
516
- alignItems: 'center',
517
- gap: '10px',
518
- height: '32px',
519
- padding: '6px 0',
520
- opacity: item.isZero ? 0.4 : 1,
521
- transition: 'opacity 0.2s ease-in-out'
522
- }, children: [_jsx("div", { style: { position: 'relative' }, children: _jsx(IconFolder, { color: item.isManyToMany ? '#ff8f44' : TMColors.iconLight, fontSize: 24 }) }), _jsxs(StyledDivHorizontal, { style: { gap: 5, overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }, children: [_jsx("p", { style: {
602
+ const defaultContainerStyle = {
603
+ display: 'flex',
604
+ alignItems: 'center',
605
+ gap: '10px',
606
+ height: '32px',
607
+ padding: '6px 0',
608
+ opacity: item.isZero ? 0.4 : 1,
609
+ transition: 'opacity 0.2s ease-in-out'
610
+ };
611
+ // Se è il container principale (root) e showMainDocument è false,
612
+ // non mostrare il badge perché conterrebbe il numero di sotto-container, non di documenti
613
+ const shouldShowBadge = !(item.isRoot && !showMainDocument);
614
+ const defaultContent = (_jsxs(_Fragment, { children: [_jsx("div", { style: { position: 'relative' }, children: _jsx(IconFolder, { color: item.isManyToMany ? '#ff8f44' : TMColors.iconLight, fontSize: 24 }) }), _jsxs(StyledDivHorizontal, { style: { gap: 5, overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }, children: [_jsx("p", { style: {
523
615
  whiteSpace: 'nowrap',
524
616
  textOverflow: 'ellipsis',
525
617
  fontSize: '1rem',
526
618
  color: 'inherit'
527
- }, children: item.name }), _jsx(StyledBadge, { "$backgroundColor": TMColors.info, children: item.items?.length ?? 0 })] })] }));
619
+ }, children: item.name }), shouldShowBadge && (_jsx(StyledBadge, { "$backgroundColor": TMColors.info, children: item.items?.length ?? 0 }))] })] }));
620
+ // Se è il container principale (root) e abbiamo un custom renderer, usalo
621
+ const content = (item.isRoot && customMainContainerContent)
622
+ ? customMainContainerContent(item, defaultContent)
623
+ : defaultContent;
624
+ return (_jsx("div", { style: defaultContainerStyle, children: content }));
528
625
  }
529
626
  // Document rendering with full metadata display
530
- return (_jsxs("div", { onDoubleClick: handleDoubleClick, style: {
531
- minWidth: '90px',
532
- width: '100%',
533
- display: 'flex',
534
- marginLeft: '5px',
535
- marginTop: '5px',
536
- marginBottom: '5px',
537
- gap: '15px',
538
- alignItems: 'center',
539
- cursor: 'pointer',
540
- userSelect: 'none',
541
- opacity: item.isZero ? 0.4 : 1,
542
- transition: 'opacity 0.2s ease-in-out'
543
- }, children: [item.did && showCurrentDcmtIndicator && item.did === inputDcmts?.[0].DID ? _jsx(IconBackhandIndexPointingRight, { fontSize: 22, overflow: 'visible' }) : _jsx(_Fragment, {}), item.values && (_jsx(TMDcmtIcon, { tid: item.values?.TID?.value, did: item.values?.DID?.value, fileExtension: item.values?.FILEEXT?.value, fileCount: item.values?.FILECOUNT?.value, isLexProt: item.values?.IsLexProt?.value, isMail: item.values?.ISMAIL?.value, isShared: item.values?.ISSHARED?.value, isSigned: item.values?.ISSIGNED?.value, downloadMode: 'openInNewWindow' })), item.values && (_jsx(StyledDivHorizontal, { style: {
544
- whiteSpace: 'nowrap',
545
- textOverflow: 'ellipsis',
546
- fontSize: '1rem',
547
- }, children: getDcmtDisplayValue(item.values).map((key, index) => {
548
- const md = item.values?.[key]?.md;
549
- const value = item.values?.[key]?.value;
550
- return (_jsxs(StyledDivHorizontal, { children: [index > 0 && _jsx("p", { style: { marginRight: '2px' }, children: ";" }), md?.dataDomain == MetadataDataDomains.DataList ? (_jsx(TMDataListItemViewer, { dataListId: md.dataListID, viewMode: md.dataListViewMode, value: value })) : md?.dataDomain == MetadataDataDomains.UserID ? (_jsx(TMUserIdViewer, { userId: value, showIcon: true, noneSelectionText: '' })) : (_jsx("p", { style: { fontSize: '1rem' }, children: value }))] }, `${key}_${index}`));
551
- }) }))] }));
552
- }, [onDocumentDoubleClick]);
627
+ const defaultDocumentStyle = {
628
+ minWidth: '90px',
629
+ width: '100%',
630
+ display: 'flex',
631
+ marginLeft: '5px',
632
+ marginTop: '5px',
633
+ marginBottom: '5px',
634
+ gap: '15px',
635
+ alignItems: 'center',
636
+ cursor: 'pointer',
637
+ userSelect: 'none',
638
+ opacity: item.isZero ? 0.4 : 1,
639
+ transition: 'opacity 0.2s ease-in-out'
640
+ };
641
+ const documentStyle = customDocumentStyle
642
+ ? { ...defaultDocumentStyle, ...customDocumentStyle(item) }
643
+ : defaultDocumentStyle;
644
+ const defaultMetadataContent = item.values && (_jsx(StyledDivHorizontal, { style: {
645
+ fontSize: '1rem',
646
+ overflow: 'hidden',
647
+ flex: 1,
648
+ minWidth: 0,
649
+ whiteSpace: 'nowrap'
650
+ }, children: getDcmtDisplayValue(item.values).map((key, index) => {
651
+ const md = item.values?.[key]?.md;
652
+ const value = item.values?.[key]?.value;
653
+ const displayValues = getDcmtDisplayValue(item.values);
654
+ const isLast = index === displayValues.length - 1;
655
+ return (_jsxs(StyledDivHorizontal, { style: {
656
+ flexShrink: isLast ? 1 : 0,
657
+ minWidth: isLast ? 0 : 'auto',
658
+ overflow: isLast ? 'hidden' : 'visible'
659
+ }, children: [index > 0 && _jsx("span", { style: { margin: '0 5px', color: '#999' }, children: "\u2022" }), showMetadataNames && (_jsxs("span", { style: { color: '#666', marginRight: '5px' }, children: [md?.name || key, ":"] })), md?.dataDomain === MetadataDataDomains.DataList ? (_jsx(TMDataListItemViewer, { dataListId: md.dataListID, viewMode: md.dataListViewMode, value: value })) : md?.dataDomain === MetadataDataDomains.UserID ? (_jsx(TMUserIdViewer, { userId: value, showIcon: true, noneSelectionText: '' })) : (_jsx("span", { style: {
660
+ fontWeight: 500,
661
+ overflow: isLast ? 'hidden' : 'visible',
662
+ textOverflow: isLast ? 'ellipsis' : 'clip',
663
+ whiteSpace: 'nowrap'
664
+ }, children: value }))] }, `${key}_${index}`));
665
+ }) }));
666
+ const metadataContent = customDocumentContent
667
+ ? customDocumentContent(item, defaultMetadataContent || _jsx(_Fragment, {}))
668
+ : defaultMetadataContent;
669
+ return (_jsxs("div", { onDoubleClick: handleDoubleClick, style: documentStyle, children: [item.did && showCurrentDcmtIndicator && item.did === inputDcmts?.[0].DID ? _jsx(IconBackhandIndexPointingRight, { fontSize: 22, overflow: 'visible' }) : _jsx(_Fragment, {}), item.values && (_jsx(TMDcmtIcon, { tid: item.values?.TID?.value, did: item.values?.DID?.value, fileExtension: item.values?.FILEEXT?.value, fileCount: item.values?.FILECOUNT?.value, isLexProt: item.values?.IsLexProt?.value, isMail: item.values?.ISMAIL?.value, isShared: item.values?.ISSHARED?.value, isSigned: item.values?.ISSIGNED?.value, downloadMode: 'openInNewWindow' })), metadataContent] }));
670
+ }, [onDocumentDoubleClick, showCurrentDcmtIndicator, inputDcmts, customMainContainerContent, customDocumentStyle, customDocumentContent, showMetadataNames, showMainDocument]);
671
+ /**
672
+ * Wrapper renderer that handles custom rendering if provided
673
+ */
674
+ const finalItemRender = useCallback((item) => {
675
+ if (!item)
676
+ return _jsx("span", { children: "-" });
677
+ // If customItemRender is provided, try it first
678
+ if (customItemRender) {
679
+ const customResult = customItemRender(item);
680
+ // If custom renderer returns something (not undefined), use it
681
+ if (customResult !== undefined) {
682
+ return customResult;
683
+ }
684
+ }
685
+ // Otherwise use default renderer
686
+ return defaultItemRender(item);
687
+ }, [customItemRender, defaultItemRender]);
553
688
  /**
554
689
  * Handle focused item changed
555
690
  */
@@ -562,12 +697,24 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
562
697
  const handleSelectedItemsChanged = useCallback((items) => {
563
698
  onSelectedItemsChanged?.(items);
564
699
  }, [onSelectedItemsChanged]);
700
+ /**
701
+ * Handle data changed - separate static items from dynamic tree data
702
+ */
703
+ const handleDataChanged = useCallback((updatedData) => {
704
+ // Separate static items, separator, and dynamic correlations
705
+ const dynamicItems = updatedData.filter(item => !item.isStaticItem && !item.isSeparator);
706
+ const staticItems = updatedData.filter(item => item.isStaticItem);
707
+ setTreeData(dynamicItems);
708
+ setStaticItemsState(staticItems); // Preserve static items state (expanded/collapsed)
709
+ // Mark that user has interacted with the tree (expanded/collapsed nodes)
710
+ userInteractedWithStaticItemsRef.current = true;
711
+ }, []);
565
712
  if (showWaitPanel) {
566
713
  return _jsx("div", { style: { padding: '20px', textAlign: 'center' }, children: _jsx(TMWaitPanel, { title: 'Caricamento documenti dettaglio', showPrimary: true, textPrimary: waitPanelTextPrimary, valuePrimary: waitPanelValuePrimary, maxValuePrimary: waitPanelMaxValuePrimary, isCancelable: true, abortController: abortController, onAbortClick: (abortController) => { setTimeout(() => { abortController?.abort(); }, 1000); } }) });
567
714
  }
568
- if (treeData.length === 0) {
715
+ if (mergedTreeData.length === 0) {
569
716
  return _jsx("div", { style: { padding: '20px', textAlign: 'center', color: '#666' }, children: "Nessuna relazione disponibile." });
570
717
  }
571
- return (_jsx(TMTreeView, { dataSource: treeData, itemRender: customItemRender || defaultItemRender, calculateItemsForNode: calculateItemsForNode, onDataChanged: setTreeData, focusedItem: focusedItem, onFocusedItemChanged: handleFocusedItemChanged, allowMultipleSelection: allowMultipleSelection, selectedItems: selectedItems, onSelectionChanged: handleSelectedItemsChanged }));
718
+ return (_jsx(TMTreeView, { dataSource: mergedTreeData, itemRender: finalItemRender, calculateItemsForNode: calculateItemsForNode, onDataChanged: handleDataChanged, focusedItem: focusedItem, onFocusedItemChanged: handleFocusedItemChanged, allowMultipleSelection: allowMultipleSelection, selectedItems: selectedItems, onSelectionChanged: handleSelectedItemsChanged }));
572
719
  };
573
720
  export default TMRelationViewer;
@@ -1,8 +1,15 @@
1
1
  import React from 'react';
2
- import { DcmtTypeDescriptor, TaskDescriptor } from '@topconsultnpm/sdk-ts';
2
+ import { DcmtTypeDescriptor, TaskDescriptor, ObjectRef, HomeBlogPost } from '@topconsultnpm/sdk-ts';
3
3
  import { DcmtInfo, TaskContext } from '../../../ts';
4
4
  import { TMSearchResultFloatingActionConfig } from './TMSearchResultFloatingActionButton';
5
5
  interface ITMSearchProps {
6
+ allTasks?: Array<TaskDescriptor>;
7
+ getAllTasks?: () => Promise<void>;
8
+ deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
9
+ addTaskCallback?: (task: TaskDescriptor) => Promise<void>;
10
+ editTaskCallback?: (task: TaskDescriptor) => Promise<void>;
11
+ handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
12
+ handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
6
13
  isVisible?: boolean;
7
14
  inputTID?: number;
8
15
  inputSqdID?: number;
@@ -26,6 +33,8 @@ interface ITMSearchProps {
26
33
  value: string;
27
34
  }>, tid?: number) => void;
28
35
  onCurrentTIDChangedCallback?: (tid: number | undefined) => void;
36
+ onlyShowSearchQueryPanel?: boolean;
37
+ onReferenceClick?: (ref: ObjectRef) => void;
29
38
  }
30
39
  declare const TMSearch: React.FunctionComponent<ITMSearchProps>;
31
40
  export default TMSearch;
@@ -18,7 +18,7 @@ var TMSearchViews;
18
18
  TMSearchViews[TMSearchViews["Search"] = 0] = "Search";
19
19
  TMSearchViews[TMSearchViews["Result"] = 1] = "Result";
20
20
  })(TMSearchViews || (TMSearchViews = {}));
21
- const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, inputMids, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm, openEditPdf, openS4TViewer, onOpenS4TViewerRequest, showTodoDcmtForm, passToArchiveCallback, onCurrentTIDChangedCallback }) => {
21
+ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, openInOffice, isVisible, inputTID, inputSqdID, inputMids, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm, openEditPdf, openS4TViewer, onOpenS4TViewerRequest, showTodoDcmtForm, passToArchiveCallback, onCurrentTIDChangedCallback, onlyShowSearchQueryPanel, onReferenceClick }) => {
22
22
  const [allSQDs, setAllSQDs] = useState([]);
23
23
  const [filteredByTIDSQDs, setFilteredByTIDSQDs] = useState([]);
24
24
  const [currentSQD, setCurrentSQD] = useState();
@@ -30,6 +30,7 @@ const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, inputMids, is
30
30
  const [currentSearchView, setCurrentSearchView] = useState(TMSearchViews.Search);
31
31
  const [currentSQDMode, setCurrentSQDMode] = useState(1);
32
32
  const [lastQdSearched, setLastQdSearched] = useState();
33
+ const [showSearchResults, setShowSearchResults] = useState(true);
33
34
  const deviceType = useDeviceType();
34
35
  useEffect(() => {
35
36
  if (onCurrentTIDChangedCallback) {
@@ -76,6 +77,13 @@ const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, inputMids, is
76
77
  });
77
78
  }
78
79
  }, [currentSQD]);
80
+ useEffect(() => {
81
+ if (onlyShowSearchQueryPanel === undefined)
82
+ return;
83
+ if (onlyShowSearchQueryPanel) {
84
+ setShowSearchResults(false);
85
+ }
86
+ }, [onlyShowSearchQueryPanel]);
79
87
  const loadDataSQDsAsync = async (refreshCache, curTID) => {
80
88
  if (refreshCache) {
81
89
  SavedQueryCacheService.RemoveAll();
@@ -162,13 +170,14 @@ const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, inputMids, is
162
170
  SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS;
163
171
  setMruTIDs(newMruTIDS);
164
172
  setCurrentMruTID(fromTID);
173
+ setShowSearchResults(true);
165
174
  }, onSqdSaved: async (newSqd) => {
166
175
  await loadDataSQDsAsync(true, newSqd.masterTID);
167
176
  await setSQDAsync(newSqd);
168
- } }), [fromDTD, currentSQD, isExpertMode, mruTIDs, searchResult, passToArchiveCallback, inputMids]);
177
+ } }), [fromDTD, showSearchResults, setShowSearchResults, currentSQD, isExpertMode, mruTIDs, searchResult, passToArchiveCallback, inputMids]);
169
178
  const tmSavedQuerySelectorElement = useMemo(() => _jsxs(TabPanel, { width: "100%", height: "100%", showNavButtons: true, repaintChangesOnly: true, selectedIndex: currentSQDMode, onSelectedIndexChange: (index) => setCurrentSQDMode(index), children: [(currentTID || currentSQD) ? _jsx(Item, { title: fromDTD?.nameLoc, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: false, items: filteredByTIDSQDs, selectedId: currentSQD?.id, onRefreshData: () => { loadDataSQDsAsync(true); }, onItemClick: (sqd) => {
170
179
  onSQDItemClick(sqd, setSQDAsync);
171
- }, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync) }) }) : _jsx(_Fragment, {}), _jsx(Item, { title: SDKUI_Localizator.Alls2, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: true, items: allSQDs, manageDefault: false, onItemClick: (sqd) => {
180
+ }, 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) => {
172
181
  onSQDItemClick(sqd, setSQDAsync);
173
182
  }, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] }), [currentSQDMode, currentTID, currentSQD, fromDTD, filteredByTIDSQDs, allSQDs]);
174
183
  // --- PANEL DEFINITIONS ---
@@ -209,8 +218,8 @@ const TMSearch = ({ openInOffice, isVisible, inputTID, inputSqdID, inputMids, is
209
218
  contentOptions: { component: tmSavedQuerySelectorElement, panelContainer: { title: SDK_Localizator.SavedQueries } },
210
219
  toolbarOptions: { icon: _jsx(IconSavedQuery, { fontSize: 24 }), visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['TMSavedQuerySelector'] }
211
220
  }
212
- ], [tmTreeSelectorElement, tmRecentsManagerElement, tmSearchQueryPanelElement, tmSavedQuerySelectorElement, fromDTD, mruTIDs]);
213
- return (_jsxs(_Fragment, { children: [_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 }) }) }), _jsx(TMSearchResult, { isVisible: isVisible && currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, floatingActionConfig: floatingActionConfig, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, openInOffice: openInOffice, onRefreshSearchAsync: onRefreshSearchAsync, onClose: () => { setCurrentSearchView(TMSearchViews.Search); }, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, openEditPdf: openEditPdf, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, passToArchiveCallback: passToArchiveCallback, onSelectedTIDChanged: onCurrentTIDChangedCallback, showTodoDcmtForm: showTodoDcmtForm })] }));
221
+ ], [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 }) }) }) : 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 })] }));
214
223
  };
215
224
  export default TMSearch;
216
225
  const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
@@ -19,7 +19,7 @@ interface ITMSearchQueryPanelProps {
19
19
  passToArchiveCallback?: (outputMids: Array<{
20
20
  mid: number;
21
21
  value: string;
22
- }>) => void;
22
+ }>, tid?: number) => void;
23
23
  }
24
24
  declare const TMSearchQueryPanel: React.FunctionComponent<ITMSearchQueryPanelProps>;
25
25
  export default TMSearchQueryPanel;