@topconsultnpm/sdkui-react 6.22.0-dev3.3 → 6.22.0-dev3.31

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 (173) hide show
  1. package/lib/components/NewComponents/ContextMenu/styles.d.ts +45 -43
  2. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +67 -60
  3. package/lib/components/base/Styled.d.ts +93 -77
  4. package/lib/components/base/Styled.js +7 -5
  5. package/lib/components/base/TMAlert.js +6 -8
  6. package/lib/components/base/TMAreaManager.js +53 -55
  7. package/lib/components/base/TMCounterBar.d.ts +2 -2
  8. package/lib/components/base/TMCounterContainer.d.ts +2 -1
  9. package/lib/components/base/TMCustomButton.d.ts +1 -1
  10. package/lib/components/base/TMCustomButton.js +40 -48
  11. package/lib/components/base/TMDataGrid.js +2 -2
  12. package/lib/components/base/TMDataGridExportForm.d.ts +2 -1
  13. package/lib/components/base/TMFileManager.d.ts +2 -1
  14. package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -1
  15. package/lib/components/base/TMFileManagerThumbnailItems.d.ts +1 -1
  16. package/lib/components/base/TMFileManagerThumbnailsView.d.ts +1 -1
  17. package/lib/components/base/TMFileManagerUtils.d.ts +4 -6
  18. package/lib/components/base/TMLayout.d.ts +4 -4
  19. package/lib/components/base/TMList.d.ts +2 -1
  20. package/lib/components/base/TMListView.d.ts +1 -1
  21. package/lib/components/base/TMPanel.js +2 -2
  22. package/lib/components/base/TMSpinner.d.ts +4 -2
  23. package/lib/components/base/TMSpinner.js +9 -7
  24. package/lib/components/base/TMTab.d.ts +4 -3
  25. package/lib/components/base/TMTabControl.d.ts +106 -0
  26. package/lib/components/base/TMTabControl.js +664 -0
  27. package/lib/components/base/TMTooltip.d.ts +1 -1
  28. package/lib/components/base/TMTreeView.d.ts +14 -8
  29. package/lib/components/base/TMTreeView.js +33 -1
  30. package/lib/components/base/TMUserAvatar.d.ts +2 -1
  31. package/lib/components/base/TMVilViewer.d.ts +2 -1
  32. package/lib/components/base/TMWaitPanel.d.ts +3 -2
  33. package/lib/components/base/TMWaitPanel.js +1 -1
  34. package/lib/components/base/waitPanel/TMWaitPanelConfirm.d.ts +12 -0
  35. package/lib/components/base/waitPanel/TMWaitPanelConfirm.js +185 -0
  36. package/lib/components/base/waitPanel/TMWaitPanelManager.d.ts +169 -0
  37. package/lib/components/base/waitPanel/TMWaitPanelManager.js +320 -0
  38. package/lib/components/base/waitPanel/TMWaitPanelView.d.ts +53 -0
  39. package/lib/components/base/waitPanel/TMWaitPanelView.js +274 -0
  40. package/lib/components/base/waitPanel/index.d.ts +1 -0
  41. package/lib/components/base/waitPanel/index.js +1 -0
  42. package/lib/components/choosers/TMDynDataListItemChooser.d.ts +1 -1
  43. package/lib/components/choosers/TMInvoiceRetrieveFormats.d.ts +2 -1
  44. package/lib/components/choosers/TMOrderRetrieveFormats.d.ts +2 -1
  45. package/lib/components/choosers/TMPathChooser.js +17 -34
  46. package/lib/components/choosers/TMQuickSearchInfo.d.ts +2 -1
  47. package/lib/components/choosers/TMRelationChooser.d.ts +3 -3
  48. package/lib/components/choosers/TMUserChooser.d.ts +2 -2
  49. package/lib/components/editors/TMEditorStyled.d.ts +20 -42
  50. package/lib/components/editors/TMFormulaEditor.d.ts +1 -1
  51. package/lib/components/editors/TMHtmlContentDisplay.d.ts +2 -1
  52. package/lib/components/editors/TMHtmlEditor.d.ts +2 -1
  53. package/lib/components/editors/TMMetadataValues.js +5 -5
  54. package/lib/components/editors/TMTreeDropDown.d.ts +1 -1
  55. package/lib/components/features/archive/TMArchive.js +7 -2
  56. package/lib/components/features/assistant/TMHelpOnLineChat.d.ts +28 -0
  57. package/lib/components/features/assistant/TMHelpOnLineChat.js +888 -0
  58. package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +1 -1
  59. package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +2 -2
  60. package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -1
  61. package/lib/components/features/documents/TMBatchUpdateForm.js +3 -4
  62. package/lib/components/features/documents/TMCopyToFolderForm.js +50 -42
  63. package/lib/components/features/documents/TMDcmtForm.js +51 -62
  64. package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +1 -1
  65. package/lib/components/features/documents/TMDcmtIcon.d.ts +2 -3
  66. package/lib/components/features/documents/TMDcmtIcon.js +3 -5
  67. package/lib/components/features/documents/TMDcmtPreview.d.ts +8 -6
  68. package/lib/components/features/documents/TMDcmtPreview.js +5 -3
  69. package/lib/components/features/documents/TMDcmtTasks.d.ts +2 -1
  70. package/lib/components/features/documents/TMDragDropOverlay.d.ts +1 -1
  71. package/lib/components/features/documents/TMFileUploader.js +26 -26
  72. package/lib/components/features/documents/TMMasterDetailDcmts.d.ts +2 -0
  73. package/lib/components/features/documents/TMMasterDetailDcmts.js +54 -129
  74. package/lib/components/features/documents/TMMasterInfoFields.d.ts +2 -1
  75. package/lib/components/features/documents/TMMasterInfoFields.js +3 -2
  76. package/lib/components/features/documents/TMMergeToPdfForm.d.ts +2 -1
  77. package/lib/components/features/documents/TMMergeToPdfForm.js +56 -54
  78. package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.d.ts +2 -1
  79. package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.js +2 -5
  80. package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.d.ts +5 -5
  81. package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.js +3 -3
  82. package/lib/components/features/documents/TMRelationViewer.d.ts +16 -9
  83. package/lib/components/features/documents/TMRelationViewer.js +238 -166
  84. package/lib/components/features/documents/relationTreeState.d.ts +32 -0
  85. package/lib/components/features/documents/relationTreeState.js +89 -0
  86. package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +2 -1
  87. package/lib/components/features/search/TMMetadataOutputForm.d.ts +2 -1
  88. package/lib/components/features/search/TMMetadataSorterForm.d.ts +2 -1
  89. package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
  90. package/lib/components/features/search/TMSearch.d.ts +1 -1
  91. package/lib/components/features/search/TMSearch.js +68 -9
  92. package/lib/components/features/search/TMSearchQueryPanel.d.ts +9 -3
  93. package/lib/components/features/search/TMSearchResult.d.ts +5 -0
  94. package/lib/components/features/search/TMSearchResult.js +19 -12
  95. package/lib/components/features/search/TMSearchResultFloatingActionButton.d.ts +1 -1
  96. package/lib/components/features/search/TMSignatureInfoContent.d.ts +2 -1
  97. package/lib/components/features/search/TMTreeSelector.js +38 -36
  98. package/lib/components/features/search/TMViewHistoryDcmt.d.ts +2 -1
  99. package/lib/components/features/search/TMViewHistoryDcmt.js +14 -25
  100. package/lib/components/features/tasks/TMTaskForm.d.ts +1 -1
  101. package/lib/components/features/tasks/TMTaskFormUtils.d.ts +10 -10
  102. package/lib/components/features/tasks/TMTasksAgenda.d.ts +1 -1
  103. package/lib/components/features/tasks/TMTasksCalendar.d.ts +1 -1
  104. package/lib/components/features/tasks/TMTasksHeader.d.ts +1 -1
  105. package/lib/components/features/tasks/TMTasksPanelContent.d.ts +1 -1
  106. package/lib/components/features/tasks/TMTasksUtilsView.d.ts +5 -5
  107. package/lib/components/features/tasks/TMTasksView.d.ts +1 -1
  108. package/lib/components/features/tasks/TMTasksView.js +96 -101
  109. package/lib/components/features/wg/TMWGsCopyMoveForm.d.ts +3 -2
  110. package/lib/components/features/wg/TMWGsCopyMoveForm.js +91 -91
  111. package/lib/components/features/workflow/TMWorkflowPopup.d.ts +8 -7
  112. package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.d.ts +3 -1
  113. package/lib/components/forms/Login/ChangePasswordInputs.d.ts +3 -1
  114. package/lib/components/forms/Login/Chooser.d.ts +2 -2
  115. package/lib/components/forms/TMChooserForm.d.ts +2 -1
  116. package/lib/components/forms/TMResultDialog.js +1 -1
  117. package/lib/components/forms/TMSaveForm.d.ts +4 -4
  118. package/lib/components/grids/TMBlogAttachments.d.ts +2 -1
  119. package/lib/components/grids/TMBlogHeader.d.ts +1 -1
  120. package/lib/components/grids/TMBlogsPost.d.ts +1 -1
  121. package/lib/components/grids/TMBlogsPost.js +92 -96
  122. package/lib/components/grids/TMBlogsPostUtils.d.ts +9 -9
  123. package/lib/components/grids/TMValidationItemsList.d.ts +2 -1
  124. package/lib/components/index.d.ts +6 -0
  125. package/lib/components/index.js +5 -0
  126. package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +2 -1
  127. package/lib/components/layout/panelManager/TMPanelManagerContext.d.ts +2 -2
  128. package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +5 -6
  129. package/lib/components/layout/panelManager/TMPanelManagerWithPersistenceProvider.d.ts +2 -2
  130. package/lib/components/layout/panelManager/TMPanelWrapper.d.ts +2 -2
  131. package/lib/components/pages/TMPage.d.ts +1 -1
  132. package/lib/components/pages/TMPage.js +29 -31
  133. package/lib/components/query/TMQueryEditor.d.ts +17 -10
  134. package/lib/components/query/TMQueryEditor.js +2 -1
  135. package/lib/components/settings/SettingsAppearance.d.ts +2 -1
  136. package/lib/components/sidebar/TMAboutApp.d.ts +2 -1
  137. package/lib/components/sidebar/TMCommandsPanel.d.ts +4 -4
  138. package/lib/components/sidebar/TMHeader.d.ts +4 -3
  139. package/lib/components/sidebar/TMHeader.js +2 -2
  140. package/lib/components/viewers/TMDataListItemViewer.d.ts +3 -2
  141. package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +3 -2
  142. package/lib/components/viewers/TMMidViewer.d.ts +2 -2
  143. package/lib/components/viewers/TMTidViewer.d.ts +2 -2
  144. package/lib/helper/Enum_Localizator.js +1 -0
  145. package/lib/helper/SDKUI_Localizator.d.ts +24 -0
  146. package/lib/helper/SDKUI_Localizator.js +240 -0
  147. package/lib/helper/TMAppUpdatedModal.d.ts +2 -1
  148. package/lib/helper/TMAppUpdatedModal.js +93 -93
  149. package/lib/helper/TMCommandsContextMenu.d.ts +1 -1
  150. package/lib/helper/TMIcons.d.ts +280 -280
  151. package/lib/helper/TMPdfViewer.d.ts +2 -1
  152. package/lib/helper/TMToppyMessage.d.ts +2 -2
  153. package/lib/helper/TMUtils.d.ts +10 -4
  154. package/lib/helper/ZipManager.d.ts +1 -1
  155. package/lib/helper/ZipManager.js +2 -1
  156. package/lib/helper/dcmtsHelper.d.ts +2 -0
  157. package/lib/helper/dcmtsHelper.js +3 -1
  158. package/lib/helper/helpers.d.ts +1 -1
  159. package/lib/hooks/useCheckInOutOperations.d.ts +0 -6
  160. package/lib/hooks/useCheckInOutOperations.js +14 -34
  161. package/lib/hooks/useDcmtOperations.d.ts +3 -12
  162. package/lib/hooks/useDcmtOperations.js +187 -179
  163. package/lib/hooks/useDocumentOperations.d.ts +1 -0
  164. package/lib/hooks/useDocumentOperations.js +14 -25
  165. package/lib/hooks/useInputDialog.d.ts +2 -1
  166. package/lib/hooks/useMultiMasterDetailDcmts.d.ts +0 -15
  167. package/lib/hooks/useMultiMasterDetailDcmts.js +65 -67
  168. package/lib/hooks/usePreventFileDrop.js +9 -0
  169. package/lib/hooks/useWorkflowApprove.js +33 -17
  170. package/lib/services/caseflow/CaseFlowService.d.ts +36 -6
  171. package/lib/services/caseflow/CaseFlowService.js +55 -14
  172. package/lib/services/platform_services.d.ts +3 -2
  173. package/package.json +71 -71
@@ -0,0 +1,32 @@
1
+ import type { RelationTreeItem } from './TMRelationViewer';
2
+ /**
3
+ * Conserva lo stato di un albero delle correlazioni (nodi espansi e fuoco) attraverso
4
+ * un refresh che ricarica i dati da zero. I nodi non sono confrontabili per `key`, che
5
+ * contiene un GUID rigenerato ad ogni caricamento: si usa un percorso costruito sui campi.
6
+ */
7
+ export interface RelationTreeState {
8
+ /** Documenti di input a cui lo stato si riferisce: non va applicato ad altri */
9
+ inputKey: string;
10
+ expandedPaths: string[];
11
+ /**
12
+ * Documenti espansi che avevano già i figli caricati. Quelli espansi ma vuoti
13
+ * (es. il root) non vanno ricaricati: mostrerebbero più di quanto c'era prima.
14
+ */
15
+ loadedPaths: string[];
16
+ focusedPath?: string;
17
+ }
18
+ /** Carica i figli di un documento durante il ripristino. */
19
+ export type LoadChildrenFn = (node: RelationTreeItem) => Promise<RelationTreeItem[]>;
20
+ /**
21
+ * Fotografa lo stato dell'albero.
22
+ * `previousFocusedPath` viene usato quando il fuoco è già stato azzerato dall'esterno.
23
+ */
24
+ export declare const collectRelationTreeState: (nodes: RelationTreeItem[], inputKey: string, focusedKey: string | undefined, previousFocusedPath?: string) => RelationTreeState;
25
+ /**
26
+ * Riapplica lo stato all'albero appena caricato. I nodi che non compaiono nello stato,
27
+ * o che non esistono più (es. documento cancellato), restano chiusi: il confronto per
28
+ * percorso è tollerante per costruzione.
29
+ */
30
+ export declare const applyRelationTreeState: (nodes: RelationTreeItem[], state: RelationTreeState, loadChildren: LoadChildrenFn, isAborted: () => boolean) => Promise<RelationTreeItem[]>;
31
+ /** Cerca un nodo per percorso, per rimettere il fuoco dov'era. */
32
+ export declare const findRelationNodeByPath: (nodes: RelationTreeItem[], path: string) => RelationTreeItem | null;
@@ -0,0 +1,89 @@
1
+ /** I nodi generati (messaggi informativi, separatori) non hanno identità stabile. */
2
+ const hasStableIdentity = (node) => !node.isInfoMessage && !node.isSeparator;
3
+ const getNodeIdentity = (node) => node.isDcmt
4
+ ? `d:${node.tid ?? ''}:${node.did ?? ''}:${node.relationId ?? ''}`
5
+ : `c:${node.tid ?? ''}:${node.relationId ?? ''}:${node.name ?? ''}`;
6
+ /** Il percorso include i padri: lo stesso documento può comparire sotto padri diversi. */
7
+ const getNodePath = (node, parentPath) => {
8
+ const identity = getNodeIdentity(node);
9
+ return parentPath ? `${parentPath}>${identity}` : identity;
10
+ };
11
+ /**
12
+ * Fotografa lo stato dell'albero.
13
+ * `previousFocusedPath` viene usato quando il fuoco è già stato azzerato dall'esterno.
14
+ */
15
+ export const collectRelationTreeState = (nodes, inputKey, focusedKey, previousFocusedPath) => {
16
+ const expandedPaths = [];
17
+ const loadedPaths = [];
18
+ let focusedPath;
19
+ const collect = (items, parentPath) => {
20
+ for (const node of items) {
21
+ if (!hasStableIdentity(node))
22
+ continue;
23
+ const path = getNodePath(node, parentPath);
24
+ if (node.expanded)
25
+ expandedPaths.push(path);
26
+ if (node.expanded && node.isDcmt && node.items)
27
+ loadedPaths.push(path);
28
+ // Entro la stessa istanza montata la key è univoca
29
+ if (focusedKey && node.key === focusedKey)
30
+ focusedPath = path;
31
+ if (node.items)
32
+ collect(node.items, path);
33
+ }
34
+ };
35
+ collect(nodes, '');
36
+ return { inputKey, expandedPaths, loadedPaths, focusedPath: focusedPath ?? previousFocusedPath };
37
+ };
38
+ /**
39
+ * Riapplica lo stato all'albero appena caricato. I nodi che non compaiono nello stato,
40
+ * o che non esistono più (es. documento cancellato), restano chiusi: il confronto per
41
+ * percorso è tollerante per costruzione.
42
+ */
43
+ export const applyRelationTreeState = async (nodes, state, loadChildren, isAborted) => {
44
+ const expandedPaths = new Set(state.expandedPaths);
45
+ const loadedPaths = new Set(state.loadedPaths);
46
+ const apply = async (items, parentPath) => {
47
+ const result = [];
48
+ for (const node of items) {
49
+ if (!hasStableIdentity(node)) {
50
+ result.push(node);
51
+ continue;
52
+ }
53
+ const path = getNodePath(node, parentPath);
54
+ const wasExpanded = expandedPaths.has(path);
55
+ let children = node.items;
56
+ let isLoaded = node.isLoaded;
57
+ let itemsCount = node.itemsCount;
58
+ // I figli dei documenti sono lazy: vanno ricaricati se l'utente li aveva aperti
59
+ if (wasExpanded && node.isDcmt && !children && loadedPaths.has(path) && !isAborted()) {
60
+ children = await loadChildren(node);
61
+ isLoaded = true;
62
+ itemsCount = children.length;
63
+ }
64
+ const updatedItems = children ? await apply(children, path) : children;
65
+ result.push({ ...node, expanded: wasExpanded, items: updatedItems, isLoaded, itemsCount });
66
+ }
67
+ return result;
68
+ };
69
+ return await apply(nodes, '');
70
+ };
71
+ /** Cerca un nodo per percorso, per rimettere il fuoco dov'era. */
72
+ export const findRelationNodeByPath = (nodes, path) => {
73
+ const find = (items, parentPath) => {
74
+ for (const node of items) {
75
+ if (!hasStableIdentity(node))
76
+ continue;
77
+ const currentPath = getNodePath(node, parentPath);
78
+ if (currentPath === path)
79
+ return node;
80
+ if (node.items) {
81
+ const found = find(node.items, currentPath);
82
+ if (found)
83
+ return found;
84
+ }
85
+ }
86
+ return null;
87
+ };
88
+ return find(nodes, '');
89
+ };
@@ -1,8 +1,9 @@
1
+ import React from "react";
1
2
  import { DcmtInfo } from "../../../ts";
2
3
  interface TMDcmtCheckoutInfoFormProps {
3
4
  dtdName: string;
4
5
  selectedDcmtOrFocused: DcmtInfo;
5
6
  onClose: () => void;
6
7
  }
7
- declare const TMDcmtCheckoutInfoForm: (props: TMDcmtCheckoutInfoFormProps) => import("react/jsx-runtime").JSX.Element;
8
+ declare const TMDcmtCheckoutInfoForm: (props: TMDcmtCheckoutInfoFormProps) => React.JSX.Element;
8
9
  export default TMDcmtCheckoutInfoForm;
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { MetadataDescriptor, QueryDescriptor, SelectItem } from "@topconsultnpm/sdk-ts";
2
3
  interface TMMetadataOutputFormProps {
3
4
  /** QueryDescriptor da cui estrarre i metadati disponibili */
@@ -13,5 +14,5 @@ interface TMMetadataOutputFormProps {
13
14
  /** Callback chiamata quando l'utente conferma la selezione dei SelectItem */
14
15
  onChoose?: (selectItems: SelectItem[] | undefined) => void;
15
16
  }
16
- declare const TMMetadataOutputForm: (props: TMMetadataOutputFormProps) => import("react/jsx-runtime").JSX.Element;
17
+ declare const TMMetadataOutputForm: (props: TMMetadataOutputFormProps) => React.JSX.Element;
17
18
  export default TMMetadataOutputForm;
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { MetadataDescriptor, OrderByItem, QueryDescriptor } from "@topconsultnpm/sdk-ts";
2
3
  interface TMMetadataSorterFormProps {
3
4
  /** QueryDescriptor da cui estrarre i metadati disponibili */
@@ -13,5 +14,5 @@ interface TMMetadataSorterFormProps {
13
14
  /** Callback chiamata quando l'utente conferma la selezione degli OrderByItem */
14
15
  onChoose?: (orderByItems: OrderByItem[] | undefined) => void;
15
16
  }
16
- declare const TMMetadataSorterForm: (props: TMMetadataSorterFormProps) => import("react/jsx-runtime").JSX.Element;
17
+ declare const TMMetadataSorterForm: (props: TMMetadataSorterFormProps) => React.JSX.Element;
17
18
  export default TMMetadataSorterForm;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { SavedQueryDescriptor } from '@topconsultnpm/sdk-ts';
3
- export declare const getTooltipBySqd: (sqd: SavedQueryDescriptor | undefined) => import("react/jsx-runtime").JSX.Element | null;
3
+ export declare const getTooltipBySqd: (sqd: SavedQueryDescriptor | undefined) => React.JSX.Element | null;
4
4
  interface ITMSavedQuerySelectorProps {
5
5
  height?: string;
6
6
  items?: SavedQueryDescriptor[];
@@ -12,5 +12,5 @@ interface ITMSavedQuerySelectorProps {
12
12
  refreshFavoriteSavedQueries?: (sqd: SavedQueryDescriptor) => void;
13
13
  onRefreshData?: () => void;
14
14
  }
15
- declare const TMSavedQuerySelector: React.MemoExoticComponent<({ items, selectedId, allowShowSearch, height, manageDefault, onItemClick, onDeleted, refreshFavoriteSavedQueries, onRefreshData }: ITMSavedQuerySelectorProps) => import("react/jsx-runtime").JSX.Element>;
15
+ declare const TMSavedQuerySelector: React.MemoExoticComponent<({ items, selectedId, allowShowSearch, height, manageDefault, onItemClick, onDeleted, refreshFavoriteSavedQueries, onRefreshData }: ITMSavedQuerySelectorProps) => React.JSX.Element>;
16
16
  export default TMSavedQuerySelector;
@@ -46,5 +46,5 @@ interface ITMSearchProps {
46
46
  fetchRemoteCertificates?: (email: string) => Promise<IntesiCertificateData[]>;
47
47
  graphometricManager?: IGraphometricManagerProp;
48
48
  }
49
- declare const TMSearch: React.FunctionComponent<ITMSearchProps>;
49
+ declare const TMSearch: (props: ITMSearchProps) => React.JSX.Element;
50
50
  export default TMSearch;
@@ -1,12 +1,12 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useMemo, useState } from 'react';
2
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { SavedQueryCacheService, DcmtTypeListCacheService, SDK_Localizator, LayoutModes } from '@topconsultnpm/sdk-ts';
4
4
  import TMSavedQuerySelector from './TMSavedQuerySelector';
5
5
  import TMTreeSelector from './TMTreeSelector';
6
- import { TabPanel, Item } from 'devextreme-react/tab-panel';
7
6
  import TMSearchQueryPanel, { refreshLastSearch } from './TMSearchQueryPanel';
8
7
  import { getSysAllDcmtsSQD, SYS_ALL_DCMTS_SQD_ID, IconFilter, IconRecentlyViewed, IconSavedQuery, IconTree, mergeSearchResultsAppend, removeMruTid, SDKUI_Globals, SDKUI_Localizator, updateMruTids } from '../../../helper';
9
8
  import TMSearchResult from './TMSearchResult';
9
+ import TMTabControl, { TMTabPanel, useTMTabs } from '../../base/TMTabControl';
10
10
  import TMRecentsManager from '../../grids/TMRecentsManager';
11
11
  import { SearchResultContext } from '../../../ts';
12
12
  import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
@@ -20,7 +20,7 @@ var TMSearchViews;
20
20
  TMSearchViews[TMSearchViews["Search"] = 0] = "Search";
21
21
  TMSearchViews[TMSearchViews["Result"] = 1] = "Result";
22
22
  })(TMSearchViews || (TMSearchViews = {}));
23
- 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, editPdfForm = false, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, openFileUploaderPdfEditor, showTodoDcmtForm, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, passToArchiveCallback, onCurrentTIDChangedCallback, onlyShowSearchQueryPanel, onReferenceClick, refreshFavoriteSavedQueries, inputDID, formAutoOpen, fetchRemoteCertificates, graphometricManager }) => {
23
+ const TMSearchInstance = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, openInOffice, isVisible, inputTID, inputSqdID, inputMids, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm, editPdfForm = false, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, openFileUploaderPdfEditor, showTodoDcmtForm, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, passToArchiveCallback, onCurrentTIDChangedCallback, onlyShowSearchQueryPanel, onReferenceClick, refreshFavoriteSavedQueries, inputDID, formAutoOpen, fetchRemoteCertificates, graphometricManager, onSelectedNameChanged }) => {
24
24
  const [allSQDs, setAllSQDs] = useState([]);
25
25
  const [filteredByTIDSQDs, setFilteredByTIDSQDs] = useState([]);
26
26
  const [currentSQD, setCurrentSQD] = useState();
@@ -34,6 +34,20 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
34
34
  const [lastQdSearched, setLastQdSearched] = useState();
35
35
  const [showSearchResults, setShowSearchResults] = useState(!onlyShowSearchQueryPanel);
36
36
  const [maxDcmtsToBeReturned, setMaxDcmtsToBeReturned] = useState(SDKUI_Globals.userSettings.searchSettings?.maxDcmtsToBeReturned ?? 1000);
37
+ // Il titolo del tab e' il nome del tipo documento dell'ultima scelta dell'utente, sia questa fatta
38
+ // dall'albero, dalle scorciatoie o da una ricerca rapida (di cui conta il tipo documento, non il nome).
39
+ // La callback sta in un ref cosi non entra nelle dipendenze di effetti e memo.
40
+ const selectedNameRef = useRef(onSelectedNameChanged);
41
+ selectedNameRef.current = onSelectedNameChanged;
42
+ // Il nome del tipo documento scelto arriva dal descrittore, che qui e' gia' in cache
43
+ const notifySelectedTIDAsync = useCallback(async (tid) => {
44
+ if (!tid || !selectedNameRef.current)
45
+ return;
46
+ const dtd = await DcmtTypeListCacheService.GetAsync(tid);
47
+ const name = dtd?.nameLoc ?? dtd?.name;
48
+ if (name)
49
+ selectedNameRef.current(name);
50
+ }, []);
37
51
  const deviceType = useDeviceType();
38
52
  useEffect(() => {
39
53
  if (onCurrentTIDChangedCallback) {
@@ -47,6 +61,7 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
47
61
  useEffect(() => {
48
62
  if (!inputTID)
49
63
  return;
64
+ notifySelectedTIDAsync(inputTID);
50
65
  setCurrentTID(inputTID);
51
66
  setCurrentSearchView(TMSearchViews.Search);
52
67
  }, [inputTID]);
@@ -54,6 +69,7 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
54
69
  const loadSqd = async () => {
55
70
  try {
56
71
  const resultSqd = await SavedQueryCacheService.GetAsync(inputSqdID);
72
+ notifySelectedTIDAsync(resultSqd?.masterTID);
57
73
  await setSQDAsync(resultSqd);
58
74
  // Mostra la vista Search per visualizzare i filtri della SavedQuery caricata
59
75
  setCurrentSearchView(TMSearchViews.Search);
@@ -141,12 +157,13 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
141
157
  setCurrentMruTID(0);
142
158
  };
143
159
  const onSQDItemClick = useCallback(async (sqd, setSqdAsync) => {
160
+ notifySelectedTIDAsync(sqd.masterTID);
144
161
  // Forza ricaricamento completo se la query è già selezionata
145
162
  if (sqd.id === currentSQD?.id) {
146
163
  await setSqdAsync(undefined);
147
164
  }
148
165
  await setSqdAsync(sqd);
149
- }, [currentSQD]);
166
+ }, [currentSQD, notifySelectedTIDAsync]);
150
167
  const onSQDDeleted = useCallback(async (sqd, sqdToBeSet, setSqdAsync) => {
151
168
  await loadDataSQDsAsync(true, sqd.masterTID);
152
169
  if (sqdToBeSet)
@@ -230,30 +247,35 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
230
247
  const isTabletOrMobile = deviceType === DeviceType.TABLET || deviceType === DeviceType.MOBILE;
231
248
  // --- JSX WRAPPERS ---
232
249
  const tmTreeSelectorElement = useMemo(() => _jsx(TMTreeSelectorWrapper, { isMobile: isTabletOrMobile, onSelectedTIDChanged: (tid) => {
250
+ notifySelectedTIDAsync(tid);
233
251
  setCurrentTID(tid);
234
252
  if (tid && mruTIDs.includes(tid))
235
253
  setCurrentMruTID(tid);
236
254
  else
237
255
  setCurrentMruTID(0);
238
- } }), [isTabletOrMobile, mruTIDs]);
256
+ } }), [isTabletOrMobile, mruTIDs, notifySelectedTIDAsync]);
239
257
  const tmRecentsManagerElement = useMemo(() => _jsx(TMRecentsManagerWrapper, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
258
+ notifySelectedTIDAsync(tid);
240
259
  setCurrentMruTID(tid);
241
260
  setCurrentTID(tid);
242
261
  }, onDeletedTID: (tid) => {
243
262
  let newMruTIDS = removeMruTid(SDKUI_Globals.userSettings.searchSettings.mruTIDs, tid);
244
263
  SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS;
245
264
  setMruTIDs(newMruTIDS);
246
- } }), [mruTIDs, currentMruTID, deviceType]);
265
+ } }), [mruTIDs, currentMruTID, deviceType, notifySelectedTIDAsync]);
247
266
  const tmSearchQueryPanelElement = useMemo(() => _jsx(TMSearchQueryPanelWrapper, { isSearchViewOnScreen: currentSearchView === TMSearchViews.Search, passToArchiveCallback: passToArchiveCallback, isExpertMode: isExpertMode, showBackToResultButton: searchResult.length > 0, fromDTD: fromDTD, SQD: currentSQD, inputMids: inputMids, maxDcmtsToBeReturned: maxDcmtsToBeReturned, onBackToResult: () => { if (onlyShowSearchQueryPanel)
248
267
  setShowSearchResults(true); setCurrentSearchView(TMSearchViews.Result); }, onSearchCompleted: handleSearchCompleted, onRefreshRequested: refreshSearchQueryPanelAsync, onDcmtTypeReloaded: handleDcmtTypeReloaded, onSqdSaved: async (newSqd) => {
249
268
  await loadDataSQDsAsync(true, newSqd.masterTID);
250
269
  await setSQDAsync(newSqd);
251
270
  } }), [fromDTD, showSearchResults, setShowSearchResults, currentSQD, currentSearchView, isExpertMode, mruTIDs, searchResult, passToArchiveCallback, inputMids, maxDcmtsToBeReturned, handleSearchCompleted, refreshSearchQueryPanelAsync, handleDcmtTypeReloaded, onlyShowSearchQueryPanel]);
252
- 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) => {
271
+ // I due tab delle ricerche rapide nell'ordine in cui compaiono: il primo c'e' solo con un tipo
272
+ // documento o una ricerca rapida correnti. currentSQDMode resta la posizione nell'elenco visibile.
273
+ const sqdTabIds = useMemo(() => (currentTID || currentSQD) ? ['byTID', 'all'] : ['all'], [currentTID, currentSQD]);
274
+ const tmSavedQuerySelectorElement = useMemo(() => _jsxs(TMTabControl, { variant: 'module', style: { height: '100%', width: '100%' }, contentStyle: { display: 'flex', flexDirection: 'column', flex: 1, minHeight: 0 }, selectedId: sqdTabIds[currentSQDMode] ?? sqdTabIds[sqdTabIds.length - 1], onSelectedIdChange: (id) => setCurrentSQDMode(sqdTabIds.indexOf(id)), children: [_jsx(TMTabPanel, { id: 'byTID', label: fromDTD?.nameLoc, visible: !!(currentTID || currentSQD), children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: false, items: filteredByTIDSQDs, selectedId: currentSQD?.id, onRefreshData: () => { loadDataSQDsAsync(true); }, onItemClick: (sqd) => {
253
275
  onSQDItemClick(sqd, setSQDAsync);
254
- }, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync), refreshFavoriteSavedQueries: refreshFavoriteSavedQueries }) }) : _jsx(_Fragment, {}), _jsx(Item, { title: SDKUI_Localizator.AllFemale, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: true, items: allSQDs, manageDefault: false, onItemClick: (sqd) => {
276
+ }, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync), refreshFavoriteSavedQueries: refreshFavoriteSavedQueries }) }), _jsx(TMTabPanel, { id: 'all', label: SDKUI_Localizator.AllFemale, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: true, items: allSQDs, manageDefault: false, onItemClick: (sqd) => {
255
277
  onSQDItemClick(sqd, setSQDAsync);
256
- }, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync), refreshFavoriteSavedQueries: refreshFavoriteSavedQueries }) })] }), [currentSQDMode, currentTID, currentSQD, fromDTD, filteredByTIDSQDs, allSQDs]);
278
+ }, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync), refreshFavoriteSavedQueries: refreshFavoriteSavedQueries }) })] }), [currentSQDMode, sqdTabIds, currentTID, currentSQD, fromDTD, filteredByTIDSQDs, allSQDs]);
257
279
  // Returns the current panelLayout from user settings, falling back to an empty object if not present.
258
280
  const getPanelLayoutSetting = () => {
259
281
  return SDKUI_Globals.userSettings.searchSettings.panelLayout ?? {};
@@ -347,6 +369,43 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
347
369
  : _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 }) }) }), showSearchResults && _jsx(TMSearchResult, { isVisible: isVisible && currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, floatingActionConfig: floatingActionConfig, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, openInOffice: openInOffice, onRefreshSearchAsyncDatagrid: onRefreshSearchAsyncDatagrid, onClose: () => { if (onlyShowSearchQueryPanel)
348
370
  setShowSearchResults(false); setCurrentSearchView(TMSearchViews.Search); }, backCaption: onlyShowSearchQueryPanel ? SDKUI_Localizator.BackToSearch : undefined, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, editPdfForm: editPdfForm, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, openFileUploaderPdfEditor: openFileUploaderPdfEditor, passToArchiveCallback: passToArchiveCallback, onSelectedTIDChanged: onCurrentTIDChangedCallback, showTodoDcmtForm: showTodoDcmtForm, showToppyDraggableHelpCenter: showToppyDraggableHelpCenter, toppyHelpCenterUsePortal: toppyHelpCenterUsePortal, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, inputDID: inputDID, formAutoOpen: formAutoOpen, fetchRemoteCertificates: fetchRemoteCertificates, graphometricManager: graphometricManager })] }));
349
371
  };
372
+ const ENABLE_SEARCH_TABS = false;
373
+ // Ogni tab e' un TMSearch completo e indipendente: TMTabControl li tiene tutti montati, cosi piu ricerche
374
+ // restano vive insieme, ognuna con i suoi tipi documento, i suoi filtri e i suoi risultati.
375
+ const TMSearch = (props) => {
376
+ const { isVisible, inputTID, inputSqdID, inputDID, onlyShowSearchQueryPanel, onCurrentTIDChangedCallback } = props;
377
+ const tabs = useTMTabs({ label: SDKUI_Localizator.Search });
378
+ // Tab attivo leggibile senza rilanciare l'effetto qui sotto a ogni cambio tab
379
+ const activeIdRef = useRef(tabs.activeId);
380
+ activeIdRef.current = tabs.activeId;
381
+ // Titoli correnti leggibili dalla callback senza rigenerarla a ogni rinomina
382
+ const itemsRef = useRef(tabs.items);
383
+ itemsRef.current = tabs.items;
384
+ // Il titolo del tab e' il nome appena selezionato; se un altro tab ha gia' quel titolo si numera
385
+ // tra parentesi a partire da 2: NomeTipoDocumento, NomeTipoDocumento (2), NomeTipoDocumento (3)...
386
+ const setTabTitle = useCallback((id, name) => {
387
+ const used = new Set(itemsRef.current.filter(t => t.id !== id).map(t => t.label));
388
+ let label = name;
389
+ for (let i = 2; used.has(label); i++)
390
+ label = `${name} (${i})`;
391
+ tabs.rename(id, label);
392
+ }, [tabs.rename]);
393
+ // Una richiesta dall'esterno (tipo documento, ricerca rapida, documento) riguarda il tab a video in
394
+ // quel momento: gli altri restano sulla ricerca che stanno svolgendo.
395
+ const [inputsTabId, setInputsTabId] = useState(tabs.activeId);
396
+ useEffect(() => { setInputsTabId(activeIdRef.current); }, [inputTID, inputSqdID, inputDID]);
397
+ // Nella modalita a solo pannello di ricerca (es. abbinamento molti a molti) i tab non servono,
398
+ // cosi come non servono finche' i tab non vengono rilasciati
399
+ if (!ENABLE_SEARCH_TABS || onlyShowSearchQueryPanel)
400
+ return _jsx(TMSearchInstance, { ...props });
401
+ return (_jsx(TMTabControl, { ...tabs.controlProps, contentAnimation: 'none', onTabRename: undefined, variant: 'module', style: { height: '100%', width: '100%' }, contentStyle: { display: 'flex', flex: 1, minHeight: 0, position: 'relative' }, children: tabs.items.map(t => {
402
+ const isActiveTab = t.id === tabs.activeId;
403
+ const hasInputs = t.id === inputsTabId;
404
+ return (_jsx(TMTabPanel, { id: t.id, label: t.label, children: _jsx(TMSearchInstance, { ...props, isVisible: isVisible && isActiveTab, inputTID: hasInputs ? inputTID : undefined, inputSqdID: hasInputs ? inputSqdID : undefined, inputDID: hasInputs ? inputDID : undefined,
405
+ // Il tipo documento corrente lo comunica solo il tab a video
406
+ onCurrentTIDChangedCallback: isActiveTab ? onCurrentTIDChangedCallback : undefined, onSelectedNameChanged: (name) => setTabTitle(t.id, name) }) }, t.id));
407
+ }) }));
408
+ };
350
409
  export default TMSearch;
351
410
  const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
352
411
  const { setPanelVisibilityById, toggleMaximize, countVisibleLeafPanels } = useTMPanelManagerContext();
@@ -29,6 +29,12 @@ interface ITMSearchQueryPanelProps {
29
29
  declare const TMSearchQueryPanel: React.FunctionComponent<ITMSearchQueryPanelProps>;
30
30
  export default TMSearchQueryPanel;
31
31
  export declare const refreshLastSearch: (qd: QueryDescriptor | undefined) => Promise<SearchResultDescriptor[] | undefined>;
32
- export declare const StyledToppyTextContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
33
- export declare const StyledToppyText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, never>>> & string;
34
- export declare const StyledToppyImage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never>>> & string;
32
+ export declare const StyledToppyTextContainer: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
33
+ style?: React.CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
34
+ }> & string;
35
+ export declare const StyledToppyText: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "style"> & {
36
+ style?: React.CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
37
+ }> & string;
38
+ export declare const StyledToppyImage: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "style"> & {
39
+ style?: React.CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
40
+ }> & string;
@@ -23,6 +23,11 @@ interface ITMSearchResultProps {
23
23
  openDcmtFormAsModal?: boolean;
24
24
  showSearchResultSidebar?: boolean;
25
25
  showDcmtFormSidebar?: boolean;
26
+ /** Mostra accanto alla griglia il selettore dei tipi documento trovati:
27
+ * su desktop sono affiancati (30/70),
28
+ * su mobile si naviga a step tra selettore e risultati.
29
+ * Se il risultato ha un solo tipo documento il selettore resta chiuso
30
+ * e lo spazio va tutto alla griglia, riapribile dal menu "Altro" */
26
31
  showSelector?: boolean;
27
32
  showToolbarHeader?: boolean;
28
33
  showBackButton?: boolean;
@@ -16,11 +16,10 @@ import TMAccordionNew from '../../base/TMAccordionNew';
16
16
  import TMButton from '../../base/TMButton';
17
17
  import TMDataGrid, { TMDataGridPageSize } from '../../base/TMDataGrid';
18
18
  import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
19
- import { TMLayoutItem, TMSplitterLayout } from '../../base/TMLayout';
19
+ import TMLayoutContainer, { TMLayoutItem, TMSplitterLayout } from '../../base/TMLayout';
20
20
  import { ButtonNames, TMExceptionBoxManager, TMMessageBoxManager } from '../../base/TMPopUp';
21
21
  import TMSpinner from '../../base/TMSpinner';
22
22
  import { StyledMultiViewPanel } from '../../base/Styled';
23
- import { TMLayoutWaitingContainer } from '../../base/TMWaitPanel';
24
23
  import TMMetadataValues from '../../editors/TMMetadataValues';
25
24
  import TMTidViewer from '../../viewers/TMTidViewer';
26
25
  import { useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
@@ -34,7 +33,6 @@ import TMDcmtPreview from '../documents/TMDcmtPreview';
34
33
  import { WorkFlowOperationButtons } from '../workflow/TMWorkflowPopup';
35
34
  // Local
36
35
  import TMSearchResultFloatingActionButton from './TMSearchResultFloatingActionButton';
37
- let abortControllerLocal = new AbortController();
38
36
  //#region Helper Methods
39
37
  export const getSearchResultCountersSingleCategory = (searchResults) => {
40
38
  // let totDcmtTypes = searchResults.length;
@@ -362,6 +360,7 @@ handleNavigateToWGs, handleNavigateToDossiers, fetchRemoteCertificates, graphome
362
360
  allowRelations,
363
361
  showTodoDcmtForm,
364
362
  graphometricManager,
363
+ showSelector,
365
364
  },
366
365
  tasks: {
367
366
  allTasks: allTasks,
@@ -396,7 +395,7 @@ handleNavigateToWGs, handleNavigateToDossiers, fetchRemoteCertificates, graphome
396
395
  openTaskFormHandler,
397
396
  },
398
397
  });
399
- const { isOpenDcmtForm, isDcmtFormModal, openFormHandler, dcmtFormLayoutMode, onDcmtFormOpenChange, showSearchTMDatagrid, showDcmtTypesSelection, showExportForm, updateBatchUpdateForm, closeDcmtFormHandler, handleSignApprove, checkoutInfo: { showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, }, dcmtOperations: { abortController, showWaitPanel, showPrimary, waitPanelTitle, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync, }, relatedDocumentsInfo: { isOpenDetails, isOpenMaster, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, }, toppyOperations: { showApprovePopup, showRejectPopup, showReAssignPopup, showMoreInfoPopup, updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup } } = features;
398
+ const { isOpenDcmtForm, isDcmtFormModal, openFormHandler, dcmtFormLayoutMode, onDcmtFormOpenChange, showSearchTMDatagrid, showDcmtTypesSelection, showExportForm, updateBatchUpdateForm, closeDcmtFormHandler, handleSignApprove, dcmtOperations: { downloadDcmtsAsync, runOperationAsync, }, relatedDocumentsInfo: { isOpenDetails, isOpenMaster, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, }, toppyOperations: { showApprovePopup, showRejectPopup, showReAssignPopup, showMoreInfoPopup, updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup } } = features;
400
399
  // ----- Azioni della colonna di riga (showActionsColumn) -----------------------------------------
401
400
  // Le voci di operationItems agiscono sui documenti selezionati o, in mancanza, su quello a fuoco:
402
401
  // non accettano una riga come argomento. Il click sull'icona quindi azzera la selezione e porta il
@@ -621,11 +620,11 @@ handleNavigateToWGs, handleNavigateToDossiers, fetchRemoteCertificates, graphome
621
620
  }, [currentMetadataValues]);
622
621
  const getTitleHeader = () => {
623
622
  let counters = (showSelector && disableAccordionIfSingleCategory && searchResults.length > 1) ? getSearchResultCountersSingleCategory(searchResults) : "";
624
- if (title)
625
- return title + counters;
626
623
  // Nome del tipo documento selezionato, accodato al titolo
627
624
  const selectedDcmtTypeName = selectedSearchResult?.fromName ?? (searchResults?.length === 1 ? searchResults[0]?.fromName : undefined);
628
625
  const withSelectedDcmtTypeName = (baseTitle) => selectedDcmtTypeName ? `${baseTitle} - ${selectedDcmtTypeName}` : baseTitle;
626
+ if (title)
627
+ return withSelectedDcmtTypeName(title) + counters;
629
628
  let titleHeader = withSelectedDcmtTypeName('Ricerca per metadati');
630
629
  switch (context) {
631
630
  case SearchResultContext.MASTER_DETAIL:
@@ -770,7 +769,7 @@ handleNavigateToWGs, handleNavigateToDossiers, fetchRemoteCertificates, graphome
770
769
  const tmSearchResult = useMemo(() => (!searchResults || searchResults.length <= 0)
771
770
  ? _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%' }, children: [_jsx(IconBoard, { fontSize: 96 }), showNoDcmtFoundMessage && _jsx("div", { style: { fontSize: "15px", marginTop: "10px" }, children: SDKUI_Localizator.NoDcmtFound }), openAddDocumentForm && _jsx("div", { style: { marginTop: "10px" }, children: _jsx(TMButton, { fontSize: "15px", icon: _jsx("i", { className: 'dx-icon-share' }), caption: SDKUI_Localizator.Share, onClick: openAddDocumentForm }) })] })
772
771
  :
773
- _jsxs(_Fragment, { children: [_jsxs(TMLayoutItem, { height: '100%', children: [_jsxs("div", { ref: floatingBarContainerRef, style: { position: 'relative', height: '100%', width: '100%' }, children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: Gutters.getGutters(), separatorActiveColor: 'transparent', separatorColor: 'transparent', min: ['0', '0'], showSeparator: showSelector && !isSteppedLayout && !isSelectorCollapsed, start: splitterSizes, children: [showSelector ?
772
+ _jsxs(_Fragment, { children: [_jsxs(TMLayoutItem, { height: '100%', children: [_jsxs("div", { ref: floatingBarContainerRef, style: { position: 'relative', height: '100%', width: '100%' }, children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: isSteppedLayout ? 'hidden' : 'visible', separatorSize: Gutters.getGutters(), separatorActiveColor: 'transparent', separatorColor: 'transparent', min: ['0', '0'], showSeparator: showSelector && !isSteppedLayout && !isSelectorCollapsed, start: splitterSizes, children: [showSelector ?
774
773
  _jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, disableAccordionIfSingleCategory: disableAccordionIfSingleCategory, selectedTID: selectedSearchResultTID, selectedSearchResult: selectedSearchResult, autoSelectFirst: !isMobile || hasSingleDcmtType, onSelectionChanged: onSearchResultSelectionChanged }) })
775
774
  :
776
775
  _jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsx(TMSearchResultGrid, { openInOffice: openInOffice, fromDTD: fromDTD, operationItems: operationItems, allUsers: allUsers, inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, showExportForm: showExportForm, onFocusedItemChanged: handleFocusedItemChangedFromGrid, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync({ inputDcmts, downloadType, downloadMode, onFileDownloaded: onFileOpened, confirmAttachments }), lastUpdateSearchTime: lastUpdateSearchTime, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], onSelectionChanged: (items) => { setSelectedItems(items); }, onDblClick: () => openFormHandler(LayoutModes.Update), showSearchTMDatagrid: showSearchTMDatagrid, onVisibleItemChanged: setVisibleItems, updateDataColumnsFromDataGrid: updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid: updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid: updateSelectedRowKeysFromDataGrid, disableAutoFocus: autoFocusFirstRow === false && isFirstAutoFocusRef.current, dcmtsReturned: dcmtsReturned, dcmtsFound: dcmtsFound, showCounterConfig: showCounterConfig, counterConfig: counterConfig, showActionsColumn: showActionsColumn, compactPager: compactPager, onRowActionRequest: requestRowAction }) })] }), renderFloatingBar] }), _jsx(TMToppyDraggableHelpCenter, { usePortal: toppyHelpCenterUsePortal, isVisible: isToppyHelpCenterVisible, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { dtd: fromDTD, deviceType: deviceType, onApprove: () => {
@@ -986,10 +985,10 @@ handleNavigateToWGs, handleNavigateToDossiers, fetchRemoteCertificates, graphome
986
985
  gap: Gutters.getGutters(),
987
986
  width: '100%',
988
987
  height: '100%',
989
- }, children: _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(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showCicoWaitPanel, showWaitPanelPrimary: showCicoPrimaryProgress, waitPanelTitle: cicoWaitPanelTitle, waitPanelTextPrimary: cicoPrimaryProgressText, waitPanelValuePrimary: cicoPrimaryProgressValue, waitPanelMaxValuePrimary: cicoPrimaryProgressMax, isCancelable: true, abortController: abortControllerLocal, children: (groupId && groupId.length > 0) ? panelManagerContent
990
- // Senza le prop di persistenza il provider si comporta come quello base:
991
- // i contesti che non ricordano il layout restano come prima
992
- : _jsx(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmSearchResult', isPersistenceEnabled: isLayoutPersisted && hasSearchResultPanelLayout(), persistPanelStates: isLayoutPersisted ? (state) => saveSearchResultPanelLayout(state, disabledLayoutPanelIds) : undefined, persistedPanelStates: isLayoutPersisted ? getSearchResultPanelLayout() : undefined, children: panelManagerContent }) }) }) }), renderDcmtOperations] }));
988
+ }, children: _jsx(TMLayoutContainer, { direction: 'vertical', children: (groupId && groupId.length > 0) ? panelManagerContent
989
+ // Senza le prop di persistenza il provider si comporta come quello base:
990
+ // i contesti che non ricordano il layout restano come prima
991
+ : _jsx(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmSearchResult', isPersistenceEnabled: isLayoutPersisted && hasSearchResultPanelLayout(), persistPanelStates: isLayoutPersisted ? (state) => saveSearchResultPanelLayout(state, disabledLayoutPanelIds) : undefined, persistedPanelStates: isLayoutPersisted ? getSearchResultPanelLayout() : undefined, children: panelManagerContent }) }) }), renderDcmtOperations] }));
993
992
  };
994
993
  export default TMSearchResult;
995
994
  /** Cerca una voce di operazione per id, anche dentro i sottomenu */
@@ -1392,6 +1391,14 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
1392
1391
  let newDataSource = searchResultDescriptorToSimpleArray(searchResult);
1393
1392
  setDataSource(newDataSource);
1394
1393
  }, [lastUpdateSearchTime]);
1394
+ const gridSorting = useMemo(() => ({ mode: 'multiple' }), []);
1395
+ const gridSelection = useMemo(() => ({ mode: allowMultipleSelection ? 'multiple' : 'single' }), [allowMultipleSelection]);
1396
+ const useNativeScrollbar = SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar === 1;
1397
+ const gridScrolling = useMemo(() => ({
1398
+ columnRenderingMode: 'virtual',
1399
+ rowRenderingMode: 'standard',
1400
+ useNative: useNativeScrollbar
1401
+ }), [useNativeScrollbar]);
1395
1402
  // Handles selection change in the data grid
1396
1403
  const handleSelectionChange = useCallback((e) => {
1397
1404
  if (onSelectionChanged === undefined)
@@ -1506,7 +1513,7 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
1506
1513
  const gridCounterConfig = showCounterConfig
1507
1514
  ? { ...counterConfig, show: true, items: counterConfig?.items ?? defaultCounterItems }
1508
1515
  : { show: false };
1509
- return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [!isDataGridReady && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%', gap: '10px' }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsx("div", { children: SDKUI_Localizator.Loading })] })), isDataGridReady && _jsx(TMDataGrid, { ref: dataGridRef, id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, customizeColumns: customizeColumns, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: disableAutoFocus ? undefined : Number(focusedItem?.rowIndex ?? 0), showSearchPanel: showSearchTMDatagrid, showFilterPanel: true, sorting: { mode: "multiple" }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single' }, pageSize: pageSize, compactPager: compactPager, onSelectionChanged: handleSelectionChange, onFocusedRowChanged: handleFocusedRowChange, onRowDblClick: onRowDblClick, onContentReady: onContentReady, showHeaderColumnChooser: true, onKeyDown: onKeyDown, customContextMenuItems: operationItems, counterConfig: gridCounterConfig })] });
1516
+ return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [!isDataGridReady && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%', gap: '10px' }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsx("div", { children: SDKUI_Localizator.Loading })] })), isDataGridReady && _jsx(TMDataGrid, { ref: dataGridRef, id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, customizeColumns: customizeColumns, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: disableAutoFocus ? undefined : Number(focusedItem?.rowIndex ?? 0), showSearchPanel: showSearchTMDatagrid, showFilterPanel: true, sorting: gridSorting, selection: gridSelection, scrolling: gridScrolling, pageSize: pageSize, compactPager: compactPager, onSelectionChanged: handleSelectionChange, onFocusedRowChanged: handleFocusedRowChange, onRowDblClick: onRowDblClick, onContentReady: onContentReady, showHeaderColumnChooser: true, onKeyDown: onKeyDown, customContextMenuItems: operationItems, counterConfig: gridCounterConfig })] });
1510
1517
  };
1511
1518
  //#region TMSearchResultSelector
1512
1519
  const StyledItemTemplate = styled.div `
@@ -12,5 +12,5 @@ interface TMSearchResultFloatingActionButtonProps {
12
12
  selectedDcmtsOrFocused: Array<DcmtInfo>;
13
13
  config: TMSearchResultFloatingActionConfig;
14
14
  }
15
- export declare const TMSearchResultFloatingActionButton: (props: TMSearchResultFloatingActionButtonProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const TMSearchResultFloatingActionButton: (props: TMSearchResultFloatingActionButtonProps) => React.JSX.Element;
16
16
  export default TMSearchResultFloatingActionButton;
@@ -1,8 +1,9 @@
1
+ import React from "react";
1
2
  import { DcmtInfo, IGraphometricManagerProp } from "../../../ts";
2
3
  interface TMSignatureInfoContentProps {
3
4
  inputDcmt: DcmtInfo;
4
5
  graphometricManager?: IGraphometricManagerProp;
5
6
  onClose?: () => void;
6
7
  }
7
- declare const TMSignatureInfoContent: (props: TMSignatureInfoContentProps) => import("react/jsx-runtime").JSX.Element;
8
+ declare const TMSignatureInfoContent: (props: TMSignatureInfoContentProps) => React.JSX.Element;
8
9
  export default TMSignatureInfoContent;