@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
@@ -29,13 +29,19 @@ interface ITMTreeViewProps {
29
29
  showLoadMoreButton?: boolean;
30
30
  enableVirtualization?: boolean;
31
31
  }
32
- declare const TMTreeView: ({ dataSource, focusedItem, selectedItems, allowMultipleSelection, onDataChanged, calculateItemsForNode, itemRender, onNodeUpdate, onFocusedItemChanged, onSelectionChanged, shouldDelayFocusOnEvent, onItemContextMenu, autoSelectChildren, itemsPerPage, showLoadMoreButton, enableVirtualization }: ITMTreeViewProps) => import("react/jsx-runtime").JSX.Element;
32
+ declare const TMTreeView: ({ dataSource, focusedItem, selectedItems, allowMultipleSelection, onDataChanged, calculateItemsForNode, itemRender, onNodeUpdate, onFocusedItemChanged, onSelectionChanged, shouldDelayFocusOnEvent, onItemContextMenu, autoSelectChildren, itemsPerPage, showLoadMoreButton, enableVirtualization }: ITMTreeViewProps) => React.JSX.Element;
33
33
  export default TMTreeView;
34
- export declare const StyledTreeContainer: 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;
35
- export declare const StyledItemContent: 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;
36
- export declare const StyledTreeNode: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$isSelected"> & {
34
+ export declare const StyledTreeContainer: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
35
+ style?: React.CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
36
+ }> & string;
37
+ export declare const StyledItemContent: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
38
+ style?: React.CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
39
+ }> & string;
40
+ export declare const StyledTreeNode: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
41
+ style?: React.CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
42
+ }, {
37
43
  $isSelected?: boolean;
38
- }, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$isSelected"> & {
39
- $isSelected?: boolean;
40
- }, never>>> & string;
41
- export declare const StyledStickyPaginator: 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;
44
+ }>> & string;
45
+ export declare const StyledStickyPaginator: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
46
+ style?: React.CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
47
+ }> & string;
@@ -4,6 +4,17 @@ import { List } from 'react-window';
4
4
  import styled from 'styled-components';
5
5
  import { IconArrowLeft, IconArrowRight, IconChevronDown, IconChevronRight, SDKUI_Localizator } from '../../helper';
6
6
  import TMButton from './TMButton';
7
+ // Campi in cui frecce, +, - e spazio servono alla digitazione (checkbox e bottoni esclusi)
8
+ const NON_TEXT_INPUT_TYPES = new Set(['checkbox', 'radio', 'button', 'submit', 'reset', 'image', 'file', 'color', 'range']);
9
+ const isEditableElement = (el) => {
10
+ if (el.isContentEditable)
11
+ return true;
12
+ if (el instanceof HTMLTextAreaElement || el instanceof HTMLSelectElement)
13
+ return true;
14
+ if (el instanceof HTMLInputElement)
15
+ return !NON_TEXT_INPUT_TYPES.has(el.type);
16
+ return false;
17
+ };
7
18
  // Componente riga virtualizzata memoizzato
8
19
  const VirtualRowComponent = memo(({ ariaAttributes, index, style, flattenedItems, focusedItemKey, selectedItemKeys, allowMultipleSelection, hasVisibleItems, handleNodeToggle, handleNodeClick, handleCheckboxChange, hasPartialChildSelection, itemRender, onItemContextMenu }) => {
9
20
  const item = flattenedItems[index];
@@ -147,15 +158,26 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
147
158
  return [];
148
159
  return flattenTreeWithDepth(dataSource);
149
160
  }, [enableVirtualization, dataSource, flattenTreeWithDepth]);
161
+ // Chiave dell'ultimo elemento verso cui si è effettivamente scrollato.
162
+ // Evita di ripetere lo scroll quando cambia solo la struttura dell'albero
163
+ // (es. espansione di un nodo) a parità di elemento focalizzato.
164
+ const lastScrolledKeyRef = useRef(undefined);
150
165
  // Scroll verso l'elemento focalizzato quando cambia (navigazione con frecce)
151
166
  useEffect(() => {
152
- if (!focusedItem?.key)
167
+ if (!focusedItem?.key) {
168
+ lastScrolledKeyRef.current = undefined;
169
+ return;
170
+ }
171
+ // Focus invariato: l'effect è stato rieseguito solo perché l'albero è cambiato
172
+ // (espansione/collasso di un nodo). La posizione di scroll non va toccata.
173
+ if (lastScrolledKeyRef.current === focusedItem.key)
153
174
  return;
154
175
  if (enableVirtualization) {
155
176
  // Lista virtualizzata: usa scrollToRow per garantire che l'elemento sia visibile
156
177
  const index = flattenedItems.findIndex(item => item.node.key === focusedItem.key);
157
178
  if (index >= 0 && listRef.current) {
158
179
  listRef.current.scrollToRow({ index, align: 'smart' });
180
+ lastScrolledKeyRef.current = focusedItem.key;
159
181
  }
160
182
  }
161
183
  else {
@@ -164,6 +186,7 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
164
186
  const element = containerRef.current.querySelector(`[data-node-key="${focusedItem.key}"]`);
165
187
  if (element) {
166
188
  element.scrollIntoView({ block: 'nearest', inline: 'nearest' });
189
+ lastScrolledKeyRef.current = focusedItem.key;
167
190
  }
168
191
  }
169
192
  }
@@ -172,6 +195,9 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
172
195
  const handleKeyDown = (event) => {
173
196
  if (!focusedItem)
174
197
  return;
198
+ // Non rubare i tasti ai campi editabili (es. input di un pannello sovrapposto)
199
+ if (event.target instanceof HTMLElement && isEditableElement(event.target))
200
+ return;
175
201
  let newFocusedItem = null;
176
202
  let handled = false;
177
203
  switch (event.key) {
@@ -447,6 +473,12 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
447
473
  return selectedCount > 0 && selectedCount < childKeys.length;
448
474
  }, [flattenTree]);
449
475
  const hasVisibleItems = useCallback((node) => {
476
+ // Nodo già caricato: conta i figli visibili (isExpandible è solo una stima a priori)
477
+ if (node.isLoaded) {
478
+ if (!node.items)
479
+ return false;
480
+ return node.items.filter(o => !o.hidden).length > 0;
481
+ }
450
482
  // If node has explicit isExpandible value, use that
451
483
  if (node.isExpandible !== undefined) {
452
484
  return node.isExpandible;
@@ -1,8 +1,9 @@
1
+ import React from 'react';
1
2
  interface TMUserAvatarProps {
2
3
  displayName: string;
3
4
  nameForColorCalculation: string;
4
5
  tooltipName?: string;
5
6
  returnType?: 'jsx' | 'svg';
6
7
  }
7
- declare const TMUserAvatar: (props: TMUserAvatarProps) => string | import("react/jsx-runtime").JSX.Element;
8
+ declare const TMUserAvatar: (props: TMUserAvatarProps) => string | React.JSX.Element;
8
9
  export default TMUserAvatar;
@@ -1,5 +1,6 @@
1
+ import React from 'react';
1
2
  import { ValidationItem } from '@topconsultnpm/sdk-ts';
2
3
  declare const TMVilViewer: ({ vil }: {
3
4
  vil?: ValidationItem[];
4
- }) => import("react/jsx-runtime").JSX.Element | null;
5
+ }) => React.JSX.Element | null;
5
6
  export default TMVilViewer;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { ITMLayoutContainerProps } from './TMLayout';
2
3
  interface ITMWaitPanelProps {
3
4
  title?: string;
@@ -14,7 +15,7 @@ interface ITMWaitPanelProps {
14
15
  onAbortClick?: (abortController: AbortController | undefined) => void;
15
16
  useHighZIndex?: boolean;
16
17
  }
17
- export declare const TMWaitPanel: (props: ITMWaitPanelProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const TMWaitPanel: (props: ITMWaitPanelProps) => React.JSX.Element;
18
19
  interface ITMLayoutWaitingContainerProps extends ITMLayoutContainerProps {
19
20
  showWaitPanel?: boolean;
20
21
  waitPanelTitle?: string;
@@ -30,5 +31,5 @@ interface ITMLayoutWaitingContainerProps extends ITMLayoutContainerProps {
30
31
  abortController?: AbortController;
31
32
  usePortal?: boolean;
32
33
  }
33
- export declare const TMLayoutWaitingContainer: ({ showWaitPanel, showWaitPanelPrimary, showWaitPanelSecondary, waitPanelTitle, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, isCancelable, abortController, usePortal, gap, onClick, justifyContent, alignItems, children, direction }: ITMLayoutWaitingContainerProps) => import("react/jsx-runtime").JSX.Element;
34
+ export declare const TMLayoutWaitingContainer: ({ showWaitPanel, showWaitPanelPrimary, showWaitPanelSecondary, waitPanelTitle, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, isCancelable, abortController, usePortal, gap, onClick, justifyContent, alignItems, children, direction }: ITMLayoutWaitingContainerProps) => React.JSX.Element;
34
35
  export {};
@@ -34,7 +34,7 @@ const StyledTitle = styled.h2 ` margin: 0; font-size: 1.5em; color: #333; `;
34
34
  const StyledProgressBarContainer = styled.div ` width: 100%; height: 20px; background: #e0e0e0; border-radius: 10px; overflow: hidden; margin: 20px 0; `;
35
35
  const StyledProgressBar = styled.div ` height: 100%; background: #4caf50; transition: width 0.3s ease; `;
36
36
  const StyledProgressText = styled.p ` font-weight: bold; color: #333; margin: 0; `;
37
- const StyledMessage = styled.p ` color: #666; font-size: 0.9em; margin-top: 10px; `;
37
+ const StyledMessage = styled.p ` color: #666; font-size: 0.9em; margin-top: 10px; white-space: pre-line; `;
38
38
  const StyledAbortButton = styled.button ` background: #ff4d4d; color: white; border: none; border-radius: 5px; padding: 10px 20px; font-size: 1em; cursor: pointer; margin-top: 20px; &:hover { background: #ff6666; } `;
39
39
  export const TMWaitPanel = (props) => {
40
40
  const { title, showPrimary, textPrimary, valuePrimary, maxValuePrimary, showSecondary, textSecondary, valueSecondary, maxValueSecondary, isCancelable, abortController, onAbortClick, useHighZIndex } = props;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export interface ITMWaitPanelConfirmProps {
3
+ /** Deve stare sopra l'overlay del pannello: il manager passa il suo z-index + 1. */
4
+ zIndex?: number;
5
+ /** Conferma: l'operazione va interrotta. */
6
+ onYes?: () => void;
7
+ /** Annulla: l'operazione riprende. Usata anche dalla X. */
8
+ onNo?: () => void;
9
+ }
10
+ /** Il ref punta all'overlay, che il manager mostra e nasconde via `style.display`. */
11
+ declare const TMWaitPanelConfirm: React.ForwardRefExoticComponent<ITMWaitPanelConfirmProps & React.RefAttributes<HTMLDivElement>>;
12
+ export default TMWaitPanelConfirm;
@@ -0,0 +1,185 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useRef } from 'react';
3
+ import styled, { keyframes } from 'styled-components';
4
+ import toppy from '../../../assets/Toppy-generico.png';
5
+ import { AppModules, SDK_Globals } from '@topconsultnpm/sdk-ts';
6
+ import { getAppModuleGradient, SDKUI_Localizator } from '../../../helper';
7
+ /** Modale di conferma dell'interruzione, sopra al wait panel: non usa TMMessageBox perche' deve stare sopra gli overlay DevExtreme. */
8
+ /** Gradiente dell'applicazione per la barra del titolo. SDK_Globals.tmSession lancia senza sessione. */
9
+ const getTitleBarGradient = () => {
10
+ let appModuleID = AppModules.SURFER;
11
+ try {
12
+ appModuleID = SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER;
13
+ }
14
+ catch { /* nessuna sessione: resta il default */ }
15
+ return getAppModuleGradient(appModuleID);
16
+ };
17
+ const fadeIn = keyframes `
18
+ from { opacity: 0; }
19
+ to { opacity: 1; }
20
+ `;
21
+ const StyledConfirmOverlay = styled.div `
22
+ display: none;
23
+ position: fixed;
24
+ inset: 0;
25
+ z-index: ${props => props.$zIndex};
26
+ align-items: center;
27
+ justify-content: center;
28
+
29
+ &::before {
30
+ content: '';
31
+ position: absolute;
32
+ inset: 0;
33
+ background-color: rgba(17, 24, 39, 0.35);
34
+ animation: ${fadeIn} 120ms ease-out;
35
+ }
36
+ `;
37
+ const StyledConfirmCard = styled.div `
38
+ position: relative;
39
+ display: flex;
40
+ flex-direction: column;
41
+ width: 420px;
42
+ max-width: calc(100% - 24px);
43
+ max-height: calc(100% - 24px);
44
+ overflow-y: auto;
45
+ box-sizing: border-box;
46
+ background: #ffffff;
47
+ border-radius: 16px;
48
+ box-shadow: 0 18px 48px rgba(16, 24, 40, 0.28);
49
+ overflow: hidden; /* tiene la barra del titolo dentro il raggio della card */
50
+ font-family: inherit;
51
+ `;
52
+ const StyledTitleBar = styled.div `
53
+ display: flex;
54
+ flex-direction: row;
55
+ align-items: center;
56
+ justify-content: space-between;
57
+ gap: 8px;
58
+ padding: 6px 8px 6px 14px;
59
+ background: ${props => props.$gradient};
60
+ color: #ffffff;
61
+ cursor: move;
62
+ user-select: none;
63
+ touch-action: none; /* necessario perche' i pointer event di drag arrivino su touch */
64
+ `;
65
+ const StyledTitle = styled.div `
66
+ font-size: 14px;
67
+ font-weight: 600;
68
+ white-space: nowrap;
69
+ overflow: hidden;
70
+ text-overflow: ellipsis;
71
+ `;
72
+ const StyledCloseButton = styled.button `
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ width: 26px;
77
+ height: 26px;
78
+ flex: 0 0 auto;
79
+ padding: 0;
80
+ border: none;
81
+ border-radius: 6px;
82
+ background: transparent;
83
+ color: inherit;
84
+ cursor: pointer;
85
+
86
+ &:hover { background: rgba(255, 255, 255, 0.18); }
87
+ &:active { background: rgba(255, 255, 255, 0.28); }
88
+ `;
89
+ const StyledBody = styled.div `
90
+ display: flex;
91
+ flex-direction: row;
92
+ align-items: center;
93
+ gap: 16px;
94
+ padding: 20px 24px 0 24px;
95
+ `;
96
+ const StyledToppyClip = styled.div `
97
+ height: 61px;
98
+ width: 68px;
99
+ overflow: hidden;
100
+ flex: 0 0 auto;
101
+ `;
102
+ const StyledToppy = styled.img `
103
+ display: block;
104
+ width: 68px;
105
+ height: 79px;
106
+ user-select: none;
107
+ -webkit-user-drag: none;
108
+ `;
109
+ const StyledQuestion = styled.div `
110
+ flex: 1;
111
+ min-width: 0;
112
+ font-size: 17px;
113
+ font-weight: 600;
114
+ color: #1f2937;
115
+ line-height: 1.3;
116
+ overflow-wrap: anywhere;
117
+ `;
118
+ const StyledFooter = styled.div `
119
+ display: flex;
120
+ flex-direction: row;
121
+ justify-content: flex-end;
122
+ gap: 10px;
123
+ padding: 18px 24px;
124
+ `;
125
+ const StyledButton = styled.button `
126
+ min-width: 92px;
127
+ padding: 9px 18px;
128
+ border-radius: 10px;
129
+ font-size: 13px;
130
+ font-family: inherit;
131
+ cursor: pointer;
132
+ transition: background-color 120ms ease, border-color 120ms ease;
133
+
134
+ border: 1px solid ${props => (props.$primary ? '#b3172f' : '#d5dbe5')};
135
+ background: ${props => (props.$primary ? '#c81e39' : '#ffffff')};
136
+ color: ${props => (props.$primary ? '#ffffff' : '#374151')};
137
+
138
+ &:hover { background: ${props => (props.$primary ? '#b3172f' : '#f3f5f9')}; }
139
+ &:active { transform: translateY(1px); }
140
+ `;
141
+ const IconClose = () => (_jsxs("svg", { width: '15', height: '15', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '2.4', strokeLinecap: 'round', children: [_jsx("line", { x1: '18', y1: '6', x2: '6', y2: '18' }), _jsx("line", { x1: '6', y1: '6', x2: '18', y2: '18' })] }));
142
+ /** Il ref punta all'overlay, che il manager mostra e nasconde via `style.display`. */
143
+ const TMWaitPanelConfirm = forwardRef(({ zIndex = 2147483602, onYes, onNo }, ref) => {
144
+ const cardRef = useRef(null);
145
+ // Scostamento fra il puntatore e l'angolo della card, fissato al primo pointerdown.
146
+ const grabRef = useRef(null);
147
+ const handlePointerDown = (e) => {
148
+ const card = cardRef.current;
149
+ if (!card || e.button !== 0)
150
+ return;
151
+ // Niente drag dalla X: con la pointer capture il click finirebbe sulla barra e non sul bottone.
152
+ if (e.target.closest('button'))
153
+ return;
154
+ // La card nasce centrata dal flex: al primo drag passo a coordinate esplicite.
155
+ const rect = card.getBoundingClientRect();
156
+ card.style.position = 'absolute';
157
+ card.style.margin = '0';
158
+ // Pixel interi: una posizione frazionaria fa ricampionare Toppy e lo sgrana.
159
+ card.style.left = `${Math.round(rect.left)}px`;
160
+ card.style.top = `${Math.round(rect.top)}px`;
161
+ grabRef.current = { dx: e.clientX - rect.left, dy: e.clientY - rect.top };
162
+ e.currentTarget.setPointerCapture(e.pointerId);
163
+ };
164
+ const handlePointerMove = (e) => {
165
+ const grab = grabRef.current;
166
+ const card = cardRef.current;
167
+ if (!grab || !card)
168
+ return;
169
+ // Clamp al viewport: una volta uscita non si riuscirebbe piu' ad afferrarla.
170
+ const maxLeft = Math.max(0, window.innerWidth - card.offsetWidth);
171
+ const maxTop = Math.max(0, window.innerHeight - card.offsetHeight);
172
+ card.style.left = `${Math.round(Math.min(Math.max(0, e.clientX - grab.dx), maxLeft))}px`;
173
+ card.style.top = `${Math.round(Math.min(Math.max(0, e.clientY - grab.dy), maxTop))}px`;
174
+ };
175
+ const handlePointerUp = (e) => {
176
+ if (!grabRef.current)
177
+ return;
178
+ grabRef.current = null;
179
+ if (e.currentTarget.hasPointerCapture(e.pointerId))
180
+ e.currentTarget.releasePointerCapture(e.pointerId);
181
+ };
182
+ return (_jsx(StyledConfirmOverlay, { ref: ref, $zIndex: zIndex, children: _jsxs(StyledConfirmCard, { ref: cardRef, role: 'alertdialog', children: [_jsxs(StyledTitleBar, { $gradient: getTitleBarGradient(), onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onPointerUp: handlePointerUp, onPointerCancel: handlePointerUp, children: [_jsx(StyledTitle, { children: SDKUI_Localizator.Abort }), _jsx(StyledCloseButton, { type: 'button', "aria-label": SDKUI_Localizator.No, onClick: onNo, children: _jsx(IconClose, {}) })] }), _jsxs(StyledBody, { children: [_jsx(StyledToppyClip, { children: _jsx(StyledToppy, { src: toppy, alt: '', draggable: false }) }), _jsx(StyledQuestion, { children: SDKUI_Localizator.Abort_Confirm })] }), _jsxs(StyledFooter, { children: [_jsx(StyledButton, { type: 'button', $primary: true, onClick: onYes, children: SDKUI_Localizator.Yes }), _jsx(StyledButton, { type: 'button', onClick: onNo, children: SDKUI_Localizator.No })] })] }) }));
183
+ });
184
+ TMWaitPanelConfirm.displayName = 'TMWaitPanelConfirm';
185
+ export default TMWaitPanelConfirm;
@@ -0,0 +1,169 @@
1
+ /** Wait panel imperativo ad alte prestazioni. */
2
+ export interface ITMWaitPanelOptions {
3
+ /** Titolo mostrato in alto. */
4
+ title?: string;
5
+ /** Totale degli elementi da elaborare. Puo' essere impostato dopo con `setMax()`. */
6
+ max?: number;
7
+ /** Sottotitolo statico, usato quando non e' valorizzato `subtitleTemplate`. */
8
+ subtitle?: string;
9
+ /** Template del sottotitolo: `{{0}}` = elemento corrente, `{{1}}` = totale. */
10
+ subtitleTemplate?: string;
11
+ /** Mostra il bottone di interruzione (e abilita ESC). */
12
+ cancelable?: boolean;
13
+ /** Mostra la riga "trascorsi / rimanenti". Default: true. */
14
+ showEta?: boolean;
15
+ /** Mostra le tre pill numeriche ok / warning / error, sempre visibili anche a 0. Default: true. */
16
+ showCounters?: boolean;
17
+ /** Riserva la seconda barra, quella dell'operazione di dettaglio */
18
+ showSecondary?: boolean;
19
+ /** Testo iniziale della barra secondaria. */
20
+ secondaryText?: string;
21
+ /** Didascalie fisse sopra le due barre, es. "Documenti" e "File corrente". Omesse: nessuna riga. */
22
+ primaryLabel?: string;
23
+ secondaryLabel?: string;
24
+ /** Invocato quando l'utente interrompe */
25
+ onAbort?: () => void;
26
+ }
27
+ export interface ITMWaitPanelCounters {
28
+ ok: number;
29
+ warning: number;
30
+ error: number;
31
+ }
32
+ export interface ITMWaitPanelUpdate {
33
+ title?: string;
34
+ subtitle?: string;
35
+ value?: number;
36
+ max?: number;
37
+ ok?: number;
38
+ warning?: number;
39
+ error?: number;
40
+ }
41
+ /** Aggiornamento della barra secondaria: i campi omessi restano invariati. */
42
+ export interface ITMWaitPanelSecondaryUpdate {
43
+ value?: number;
44
+ max?: number;
45
+ text?: string;
46
+ }
47
+ export interface ITMWaitPanelHandle {
48
+ /** True quando l'utente ha interrotto l'operazione. */
49
+ readonly aborted: boolean;
50
+ /** AbortController del pannello, da passare alle chiamate annullabili. */
51
+ readonly abortController: AbortController;
52
+ readonly signal: AbortSignal;
53
+ readonly value: number;
54
+ readonly max: number;
55
+ readonly counters: ITMWaitPanelCounters;
56
+ readonly isOpen: boolean;
57
+ /** True mentre e' aperta la richiesta di conferma dell'interruzione. */
58
+ readonly paused: boolean;
59
+ /** Avanza il contatore (default +1). Da attendere con `await`: resta pendente durante la conferma di interruzione. */
60
+ step(delta?: number): Promise<void>;
61
+ /** Come il gate di `step()`, per chi deve attendere la pausa senza avanzare. */
62
+ waitWhilePaused(): Promise<void>;
63
+ setValue(value: number): void;
64
+ setMax(max: number): void;
65
+ setTitle(title: string): void;
66
+ /** Sottotitolo esplicito: sovrascrive `subtitleTemplate`. `undefined` ripristina il template. */
67
+ setSubtitle(subtitle: string | undefined): void;
68
+ /** Incrementa il contatore verde (default +1). */
69
+ ok(delta?: number): void;
70
+ /** Incrementa il contatore giallo (default +1). */
71
+ warning(delta?: number): void;
72
+ /** Incrementa il contatore rosso (default +1). */
73
+ error(delta?: number): void;
74
+ /** Aggiornamento cumulativo: i contatori qui sono valori assoluti, non incrementi. */
75
+ update(patch: ITMWaitPanelUpdate): void;
76
+ /** Aggiorna la barra secondaria. Senza `showSecondary` non ha effetto. */
77
+ setSecondary(patch: ITMWaitPanelSecondaryUpdate): void;
78
+ close(): void;
79
+ }
80
+ declare class TMWaitPanelInstance implements ITMWaitPanelHandle {
81
+ readonly abortController: AbortController;
82
+ private readonly options;
83
+ private readonly container;
84
+ private readonly root;
85
+ private nodes;
86
+ private closed;
87
+ private readonly elapsedLabel;
88
+ private readonly remainingLabel;
89
+ private _paused;
90
+ private pauseGate;
91
+ private resolvePauseGate;
92
+ private pausedTotalMs;
93
+ private pauseStartedAt;
94
+ private readonly startTime;
95
+ private rafId;
96
+ private tickerId;
97
+ private _value;
98
+ private _max;
99
+ private _ok;
100
+ private _warning;
101
+ private _error;
102
+ private _title;
103
+ private _subtitleOverride;
104
+ private _secondaryValue;
105
+ private _secondaryMax;
106
+ private _secondaryText;
107
+ private lastPercentText;
108
+ private lastSubtitleText;
109
+ private lastElapsedText;
110
+ private lastRemainingText;
111
+ private lastOk;
112
+ private lastWarning;
113
+ private lastError;
114
+ private lastTitleText;
115
+ private lastSecondaryPercentText;
116
+ private lastSecondaryText;
117
+ constructor(options: ITMWaitPanelOptions, zIndex: number);
118
+ get aborted(): boolean;
119
+ get signal(): AbortSignal;
120
+ get value(): number;
121
+ get max(): number;
122
+ get counters(): ITMWaitPanelCounters;
123
+ get isOpen(): boolean;
124
+ get paused(): boolean;
125
+ waitWhilePaused: () => Promise<void>;
126
+ step: (delta?: number) => Promise<void>;
127
+ setValue: (value: number) => void;
128
+ setMax: (max: number) => void;
129
+ setTitle: (title: string) => void;
130
+ setSubtitle: (subtitle: string | undefined) => void;
131
+ ok: (delta?: number) => void;
132
+ warning: (delta?: number) => void;
133
+ error: (delta?: number) => void;
134
+ setSecondary: (patch: ITMWaitPanelSecondaryUpdate) => void;
135
+ update: (patch: ITMWaitPanelUpdate) => void;
136
+ close: () => void;
137
+ private handleMount;
138
+ private handleKeyDown;
139
+ /** Interrompi non annulla subito: mette in pausa il loop e chiede conferma. */
140
+ private handleAbort;
141
+ /** Risposta Si: interrompe davvero e lascia ripartire il loop, che uscira' subito. */
142
+ private confirmAbort;
143
+ private pause;
144
+ /** Risposta No, oppure chiusura del pannello: sblocca il loop e riprende. */
145
+ private resume;
146
+ private computeSubtitle;
147
+ /** Programma al massimo un flush per frame. E' l'unico costo pagato da `step()`. */
148
+ private schedule;
149
+ /** Riversa sul DOM lo stato corrente (barra, percentuale, testi, contatori), saltando cio' che non e' cambiato. */
150
+ private flush;
151
+ /** Riversa sul DOM la seconda barra. Invocata solo quando la view l'ha renderizzata. */
152
+ private flushSecondary;
153
+ /** Aggiorna la riga dei tempi: trascorso al netto delle pause e stima del rimanente. */
154
+ private flushEta;
155
+ }
156
+ export declare class TMWaitPanelManager {
157
+ private static _panels;
158
+ /** Apre un wait panel e restituisce l'handle con cui pilotarlo. */
159
+ static show(options?: ITMWaitPanelOptions): ITMWaitPanelHandle;
160
+ /** Pannello aperto piu' recente, se presente. */
161
+ static get current(): ITMWaitPanelHandle | undefined;
162
+ /** True finche' almeno un wait panel e' aperto: flag "operazione massiva in corso" per i refresh periodici. */
163
+ static get isBusy(): boolean;
164
+ /** Chiude tutti i pannelli aperti (rete di sicurezza in caso di unmount della pagina). */
165
+ static closeAll(): void;
166
+ /** @internal */
167
+ static _unregister(panel: TMWaitPanelInstance): void;
168
+ }
169
+ export default TMWaitPanelManager;