@topconsultnpm/sdkui-react 6.20.0-dev1.10 → 6.20.0-dev1.101

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 (157) hide show
  1. package/lib/assets/Toppy-help-center.png +0 -0
  2. package/lib/components/NewComponents/ContextMenu/TMContextMenu.d.ts +4 -0
  3. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +441 -0
  4. package/lib/components/NewComponents/ContextMenu/hooks.d.ts +18 -0
  5. package/lib/components/NewComponents/ContextMenu/hooks.js +120 -0
  6. package/lib/components/NewComponents/ContextMenu/index.d.ts +5 -0
  7. package/lib/components/NewComponents/ContextMenu/index.js +3 -0
  8. package/lib/components/NewComponents/ContextMenu/styles.d.ts +35 -0
  9. package/lib/components/NewComponents/ContextMenu/styles.js +428 -0
  10. package/lib/components/NewComponents/ContextMenu/types.d.ts +39 -0
  11. package/lib/components/NewComponents/ContextMenu/types.js +1 -0
  12. package/lib/components/NewComponents/ContextMenu/useLongPress.d.ts +21 -0
  13. package/lib/components/NewComponents/ContextMenu/useLongPress.js +112 -0
  14. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +4 -0
  15. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +821 -0
  16. package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +2 -0
  17. package/lib/components/NewComponents/FloatingMenuBar/index.js +2 -0
  18. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +54 -0
  19. package/lib/components/NewComponents/FloatingMenuBar/styles.js +419 -0
  20. package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +36 -0
  21. package/lib/components/NewComponents/FloatingMenuBar/types.js +1 -0
  22. package/lib/components/base/TMAccordionNew.js +35 -14
  23. package/lib/components/base/TMCustomButton.js +61 -17
  24. package/lib/components/base/TMDataGrid.d.ts +7 -4
  25. package/lib/components/base/TMDataGrid.js +153 -11
  26. package/lib/components/base/TMDropDownMenu.js +19 -18
  27. package/lib/components/base/TMFileManager.d.ts +4 -3
  28. package/lib/components/base/TMFileManager.js +32 -24
  29. package/lib/components/base/TMFileManagerDataGridView.d.ts +3 -2
  30. package/lib/components/base/TMFileManagerDataGridView.js +1 -11
  31. package/lib/components/base/TMFileManagerThumbnailItems.d.ts +7 -1
  32. package/lib/components/base/TMFileManagerThumbnailItems.js +5 -2
  33. package/lib/components/base/TMFileManagerThumbnailsView.d.ts +17 -4
  34. package/lib/components/base/TMFileManagerThumbnailsView.js +18 -6
  35. package/lib/components/base/TMFileManagerUtils.d.ts +0 -12
  36. package/lib/components/base/TMListView.js +33 -15
  37. package/lib/components/base/TMPanel.d.ts +1 -1
  38. package/lib/components/base/TMPanel.js +1 -1
  39. package/lib/components/choosers/TMDistinctValues.js +1 -1
  40. package/lib/components/choosers/TMInvoiceRetrieveFormats.js +1 -1
  41. package/lib/components/choosers/TMMetadataChooser.js +8 -1
  42. package/lib/components/choosers/TMOrderRetrieveFormats.js +1 -1
  43. package/lib/components/choosers/TMUserChooser.d.ts +0 -5
  44. package/lib/components/choosers/TMUserChooser.js +25 -45
  45. package/lib/components/editors/TMDateBox.js +18 -9
  46. package/lib/components/editors/TMMetadataValues.js +23 -5
  47. package/lib/components/editors/TMTextArea.js +18 -30
  48. package/lib/components/editors/TMTextBox.js +6 -3
  49. package/lib/components/features/archive/TMArchive.js +2 -2
  50. package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +15 -0
  51. package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +460 -0
  52. package/lib/components/features/assistant/TMToppySpeechBubble.d.ts +11 -0
  53. package/lib/components/features/assistant/TMToppySpeechBubble.js +126 -0
  54. package/lib/components/features/documents/TMDcmtForm.d.ts +14 -2
  55. package/lib/components/features/documents/TMDcmtForm.js +457 -206
  56. package/lib/components/features/documents/TMDcmtPreview.js +45 -108
  57. package/lib/components/features/documents/TMDcmtTasks.js +9 -9
  58. package/lib/components/features/documents/TMMasterDetailDcmts.js +38 -53
  59. package/lib/components/features/documents/TMRelationViewer.d.ts +1 -1
  60. package/lib/components/features/documents/TMRelationViewer.js +2 -2
  61. package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
  62. package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +2 -2
  63. package/lib/components/features/search/TMSavedQuerySelector.js +72 -67
  64. package/lib/components/features/search/TMSearch.d.ts +3 -0
  65. package/lib/components/features/search/TMSearch.js +50 -11
  66. package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -0
  67. package/lib/components/features/search/TMSearchQueryPanel.js +29 -21
  68. package/lib/components/features/search/TMSearchResult.d.ts +3 -0
  69. package/lib/components/features/search/TMSearchResult.js +208 -250
  70. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +3 -3
  71. package/lib/components/features/search/TMSearchResultsMenuItems.js +205 -169
  72. package/lib/components/features/search/TMSignSettingsForm.js +1 -1
  73. package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
  74. package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
  75. package/lib/components/features/search/TMViewHistoryDcmt.js +2 -2
  76. package/lib/components/features/tasks/TMTaskForm.js +20 -1
  77. package/lib/components/features/tasks/TMTasksAgenda.d.ts +3 -1
  78. package/lib/components/features/tasks/TMTasksAgenda.js +48 -9
  79. package/lib/components/features/tasks/TMTasksCalendar.d.ts +2 -0
  80. package/lib/components/features/tasks/TMTasksCalendar.js +19 -7
  81. package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -2
  82. package/lib/components/features/tasks/TMTasksUtils.js +43 -36
  83. package/lib/components/features/tasks/TMTasksView.js +28 -19
  84. package/lib/components/features/workflow/TMWorkflowPopup.d.ts +33 -2
  85. package/lib/components/features/workflow/TMWorkflowPopup.js +139 -34
  86. package/lib/components/features/workflow/diagram/DiagramItemComponent.d.ts +2 -0
  87. package/lib/components/features/workflow/diagram/DiagramItemComponent.js +12 -7
  88. package/lib/components/features/workflow/diagram/RecipientList.js +3 -2
  89. package/lib/components/features/workflow/diagram/WFDiagram.d.ts +4 -0
  90. package/lib/components/features/workflow/diagram/WFDiagram.js +164 -13
  91. package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
  92. package/lib/components/forms/Login/LoginValidatorService.js +7 -2
  93. package/lib/components/forms/Login/TMLoginForm.js +34 -6
  94. package/lib/components/forms/TMChooserForm.js +1 -1
  95. package/lib/components/grids/TMBlogsPost.js +56 -31
  96. package/lib/components/grids/TMRecentsManager.js +20 -10
  97. package/lib/components/index.d.ts +5 -3
  98. package/lib/components/index.js +5 -3
  99. package/lib/components/query/TMQueryEditor.d.ts +2 -1
  100. package/lib/components/query/TMQueryEditor.js +92 -92
  101. package/lib/components/settings/SettingsAppearance.d.ts +2 -1
  102. package/lib/components/settings/SettingsAppearance.js +99 -30
  103. package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
  104. package/lib/components/viewers/TMDataListItemViewer.js +35 -71
  105. package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +8 -0
  106. package/lib/components/viewers/TMDataUserIdItemViewer.js +39 -0
  107. package/lib/css/tm-sdkui.css +1 -1
  108. package/lib/helper/SDKUI_Globals.d.ts +22 -0
  109. package/lib/helper/SDKUI_Globals.js +10 -1
  110. package/lib/helper/SDKUI_Localizator.d.ts +17 -1
  111. package/lib/helper/SDKUI_Localizator.js +167 -1
  112. package/lib/helper/TMCommandsContextMenu.d.ts +4 -2
  113. package/lib/helper/TMCommandsContextMenu.js +15 -4
  114. package/lib/helper/TMIcons.d.ts +4 -0
  115. package/lib/helper/TMIcons.js +13 -3
  116. package/lib/helper/TMPdfViewer.d.ts +8 -0
  117. package/lib/helper/TMPdfViewer.js +373 -0
  118. package/lib/helper/checkinCheckoutManager.d.ts +31 -1
  119. package/lib/helper/checkinCheckoutManager.js +112 -30
  120. package/lib/helper/devextremeCustomMessages.d.ts +30 -0
  121. package/lib/helper/devextremeCustomMessages.js +30 -0
  122. package/lib/helper/helpers.d.ts +3 -1
  123. package/lib/helper/helpers.js +25 -3
  124. package/lib/helper/index.d.ts +2 -0
  125. package/lib/helper/index.js +2 -0
  126. package/lib/helper/queryHelper.d.ts +1 -1
  127. package/lib/helper/queryHelper.js +33 -3
  128. package/lib/helper/workItemsHelper.d.ts +6 -0
  129. package/lib/helper/workItemsHelper.js +230 -0
  130. package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
  131. package/lib/hooks/useCheckInOutOperations.js +223 -0
  132. package/lib/hooks/useDataListItem.d.ts +12 -0
  133. package/lib/hooks/useDataListItem.js +132 -0
  134. package/lib/hooks/useDataUserIdItem.d.ts +10 -0
  135. package/lib/hooks/useDataUserIdItem.js +96 -0
  136. package/lib/hooks/useSettingsFeedback.d.ts +11 -0
  137. package/lib/hooks/useSettingsFeedback.js +38 -0
  138. package/lib/hooks/useWorkflowApprove.d.ts +4 -0
  139. package/lib/hooks/useWorkflowApprove.js +14 -1
  140. package/lib/index.d.ts +1 -0
  141. package/lib/index.js +3 -2
  142. package/lib/services/platform_services.d.ts +3 -3
  143. package/lib/ts/types.d.ts +61 -1
  144. package/lib/utils/theme.d.ts +1 -1
  145. package/lib/utils/theme.js +1 -1
  146. package/package.json +7 -4
  147. package/lib/components/base/TMContextMenu.d.ts +0 -25
  148. package/lib/components/base/TMContextMenu.js +0 -109
  149. package/lib/components/base/TMContextMenuOLD.d.ts +0 -26
  150. package/lib/components/base/TMContextMenuOLD.js +0 -56
  151. package/lib/components/base/TMFloatingToolbar.d.ts +0 -9
  152. package/lib/components/base/TMFloatingToolbar.js +0 -101
  153. package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +0 -30
  154. package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +0 -482
  155. package/lib/components/features/assistant/ToppySpeechBubble.d.ts +0 -9
  156. package/lib/components/features/assistant/ToppySpeechBubble.js +0 -117
  157. package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
@@ -0,0 +1,96 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef, useCallback } from 'react';
3
+ import { UserListCacheService } from '@topconsultnpm/sdk-ts';
4
+ import { IconWarning, SDKUI_Localizator } from '../helper';
5
+ import { TMColors } from '../utils/theme';
6
+ import { TMUserIcon } from '../components';
7
+ export const useDataUserIdItem = () => {
8
+ const usersCacheRef = useRef(new Map());
9
+ /**
10
+ * Carica tutti gli utenti necessari in parallelo e popola la cache
11
+ * @param userIDs Set di ID degli utenti da caricare
12
+ * @returns Promise che si risolve quando tutti gli utenti sono stati caricati
13
+ */
14
+ const loadUsersAsync = useCallback(async (userIDs) => {
15
+ if (userIDs.size === 0)
16
+ return;
17
+ try {
18
+ const results = await Promise.all(Array.from(userIDs).map(id => UserListCacheService.GetAsync(id).then(user => ({ id, user }))
19
+ .catch(() => ({ id, user: undefined }))));
20
+ const newCache = new Map();
21
+ results.forEach(({ id, user }) => {
22
+ if (user)
23
+ newCache.set(id, user);
24
+ });
25
+ usersCacheRef.current = newCache;
26
+ }
27
+ catch (err) {
28
+ console.error('Error loading Users:', err);
29
+ usersCacheRef.current = new Map();
30
+ }
31
+ }, []);
32
+ /**
33
+ * Recupera un utente dalla cache
34
+ * @param userId ID dell'utente
35
+ * @returns UserDescriptor se trovato, undefined altrimenti
36
+ */
37
+ const getUserItem = useCallback((userId) => {
38
+ return usersCacheRef.current.get(userId);
39
+ }, []);
40
+ /**
41
+ * Svuota completamente la cache
42
+ */
43
+ const clearCache = useCallback(() => {
44
+ usersCacheRef.current = new Map();
45
+ }, []);
46
+ /**
47
+ * Verifica se un utente è presente nella cache
48
+ * @param userId ID dell'utente
49
+ * @returns true se l'utente è in cache, false altrimenti
50
+ */
51
+ const hasUser = useCallback((userId) => {
52
+ return usersCacheRef.current.has(userId);
53
+ }, []);
54
+ /**
55
+ * Helper per ottenere il nome completo dell'utente
56
+ */
57
+ const getCompleteUserName = useCallback((domain, name) => {
58
+ if (!name)
59
+ return undefined;
60
+ if (!domain)
61
+ return name;
62
+ return domain + "\\" + name;
63
+ }, []);
64
+ /**
65
+ * Renderizza un componente UserIdViewer
66
+ * @param userId ID dell'utente
67
+ * @param showIcon Se mostrare l'icona
68
+ * @param noneSelectionText Testo da mostrare quando non c'è selezione
69
+ * @param TMUserIcon Componente per l'icona utente
70
+ * @returns Elemento React per visualizzare l'utente
71
+ */
72
+ const renderUserIdViewer = useCallback((userId, showIcon = false, showTitile = true) => {
73
+ const ud = userId && userId > 0 ? getUserItem(userId) : undefined;
74
+ const getIcon = () => {
75
+ if (!showIcon)
76
+ return null;
77
+ if (!userId)
78
+ return null;
79
+ return ud ? _jsx(TMUserIcon, { ud: ud }) : _jsx("div", { title: showTitile ? SDKUI_Localizator.ValueNotPresent : undefined, children: _jsx(IconWarning, { color: TMColors.warning }) });
80
+ };
81
+ const getDescription = () => {
82
+ if (!userId)
83
+ return undefined;
84
+ return ud ? getCompleteUserName(ud.domain, ud.name) : userId.toString() ?? SDKUI_Localizator.NoneSelection;
85
+ };
86
+ return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '4px' }, children: [getIcon(), _jsx("span", { children: getDescription() })] }));
87
+ }, [getUserItem, getCompleteUserName]);
88
+ return {
89
+ loadUsersAsync,
90
+ getUserItem,
91
+ clearCache,
92
+ hasUser,
93
+ usersCache: usersCacheRef,
94
+ renderUserIdViewer
95
+ };
96
+ };
@@ -0,0 +1,11 @@
1
+ export interface SettingsFeedback {
2
+ showSavedBadge: boolean;
3
+ lastChanged: {
4
+ label: string;
5
+ value: string;
6
+ };
7
+ isWarning: boolean;
8
+ triggerUIUpdate: (label: string, value: any, warning?: boolean) => void;
9
+ closeBadge: () => void;
10
+ }
11
+ export declare const useSettingsFeedback: () => SettingsFeedback;
@@ -0,0 +1,38 @@
1
+ import { useState, useRef } from 'react';
2
+ export const useSettingsFeedback = () => {
3
+ const [, setForceUpdate] = useState(0);
4
+ const [showSavedBadge, setShowSavedBadge] = useState(false);
5
+ const [lastChanged, setLastChanged] = useState({
6
+ label: '',
7
+ value: ''
8
+ });
9
+ const [isWarning, setIsWarning] = useState(false);
10
+ const timeoutRef = useRef(null);
11
+ const triggerUIUpdate = (label, value, warning = false) => {
12
+ setForceUpdate((prev) => prev + 1);
13
+ setShowSavedBadge(true);
14
+ setLastChanged({ label, value: String(value) });
15
+ setIsWarning(warning);
16
+ if (timeoutRef.current) {
17
+ clearTimeout(timeoutRef.current);
18
+ }
19
+ timeoutRef.current = setTimeout(() => {
20
+ setShowSavedBadge(false);
21
+ timeoutRef.current = null;
22
+ }, 4000);
23
+ };
24
+ const closeBadge = () => {
25
+ setShowSavedBadge(false);
26
+ if (timeoutRef.current) {
27
+ clearTimeout(timeoutRef.current);
28
+ timeoutRef.current = null;
29
+ }
30
+ };
31
+ return {
32
+ showSavedBadge,
33
+ lastChanged,
34
+ isWarning,
35
+ triggerUIUpdate,
36
+ closeBadge
37
+ };
38
+ };
@@ -8,4 +8,8 @@ export declare const useWorkflowApprove: () => {
8
8
  isLoading: boolean;
9
9
  refreshWorkflowApprove: () => Promise<void>;
10
10
  totalDcmtsFound: number;
11
+ getWorkItemsByDID: (targetDID: number) => {
12
+ tid: number;
13
+ did: number;
14
+ }[];
11
15
  };
@@ -14,6 +14,19 @@ export const useWorkflowApprove = () => {
14
14
  const calculateTotalDcmtsFound = useCallback((data) => {
15
15
  return data.reduce((sum, item) => sum + (item.dcmtsFound || 0), 0);
16
16
  }, []);
17
+ /**
18
+ * Ottiene tutti i work items che corrispondono a un determinato DID.
19
+ * Restituisce un array di oggetti { tid, did }.
20
+ */
21
+ const getWorkItemsByDID = useCallback((targetDID) => {
22
+ return workflowApproveData
23
+ .flatMap(workflow => workflow.dtdResult?.rows ?? [])
24
+ .filter(dataRow => Number(dataRow?.[1]) === targetDID)
25
+ .map(dataRow => ({
26
+ tid: Number(dataRow[0]),
27
+ did: targetDID
28
+ }));
29
+ }, [workflowApproveData]);
17
30
  /**
18
31
  * Esegue il fetch dei dati dal workflow, aggiorna lo stato globale
19
32
  * e notifica gli altri componenti tramite un evento.
@@ -53,5 +66,5 @@ export const useWorkflowApprove = () => {
53
66
  window.removeEventListener('onWorkflowApproveChange', handleUpdate);
54
67
  };
55
68
  }, [calculateTotalDcmtsFound]);
56
- return { workflowApproveData, isLoading, refreshWorkflowApprove, totalDcmtsFound };
69
+ return { workflowApproveData, isLoading, refreshWorkflowApprove, totalDcmtsFound, getWorkItemsByDID };
57
70
  };
package/lib/index.d.ts CHANGED
@@ -9,4 +9,5 @@ export * from './hooks/useDcmtOperations';
9
9
  export * from './hooks/useResizeObserver';
10
10
  export * from './hooks/useWorkflowApprove';
11
11
  export * from './hooks/useRelatedDocuments';
12
+ export * from './hooks/useSettingsFeedback';
12
13
  export * from './services';
package/lib/index.js CHANGED
@@ -9,7 +9,8 @@ export * from './hooks/useDcmtOperations';
9
9
  export * from './hooks/useResizeObserver';
10
10
  export * from './hooks/useWorkflowApprove';
11
11
  export * from './hooks/useRelatedDocuments';
12
+ export * from './hooks/useSettingsFeedback';
12
13
  export * from './services';
13
14
  import config from 'devextreme/core/config';
14
- // DevExtreme License Key (valid for v25.1 and earlier versions)
15
- config({ licenseKey: 'ewogICJmb3JtYXQiOiAxLAogICJjdXN0b21lcklkIjogIjE1ODg1NDc4LTNjNTItNGUzYy1hNDI1LTU5NjAzMzQ0ZDVjMyIsCiAgIm1heFZlcnNpb25BbGxvd2VkIjogMjUxCn0=.sy0jZ9UWNR//KApWWp2wwKhxX90FmWl/0EHN4i7AnYQReSCtBSB2MlTTMYzYWv4kmD4lKynH4XC85dWwgGLU7RQmchZ916g5iBogVs6CpLeZErO1QJj7OGhLOM2BLfaODN5v9w==' });
15
+ // DevExtreme License Key (valid for v25.2 and earlier versions)
16
+ config({ licenseKey: 'ewogICJmb3JtYXQiOiAxLAogICJjdXN0b21lcklkIjogIjE1ODg1NDc4LTNjNTItNGUzYy1hNDI1LTU5NjAzMzQ0ZDVjMyIsCiAgIm1heFZlcnNpb25BbGxvd2VkIjogMjUyCn0=.ClI5PeQ2vnl48q0hwdwPHM6oDArs6XTeZ9u4JfN6kxaHoKgszVywO996SluAQfPdFhtzWz6OZsyDdenKv28UU2dOF5wppP88hGEJ17PAg+N/OpUkL1L/CMFNXlOIsYd2517GWA==' });
@@ -1,12 +1,12 @@
1
1
  import { JobTypes, ObjectClasses, ProcessDescriptor, DcmtTypeDescriptor } from "@topconsultnpm/sdk-ts";
2
2
  export declare class PlatformObjectService {
3
- static readonly retrieveAllAsync: (objClass: ObjectClasses, refreshCache?: boolean) => Promise<import("@topconsultnpm/sdk-ts").AreaDescriptor[] | import("@topconsultnpm/sdk-ts").NotificationDescriptor[] | import("@topconsultnpm/sdk-ts").RelationDescriptor[] | import("@topconsultnpm/sdk-ts").TaskDescriptor[] | import("@topconsultnpm/sdk-ts").WorkingGroupDescriptor[] | undefined>;
4
- static readonly retrieveAsync: (objClass: ObjectClasses, id: number) => Promise<import("@topconsultnpm/sdk-ts").AreaDescriptor | import("@topconsultnpm/sdk-ts").BasketTypeDescriptor | import("@topconsultnpm/sdk-ts").NotificationDescriptor | import("@topconsultnpm/sdk-ts").RelationDescriptor | import("@topconsultnpm/sdk-ts").TaskDescriptor | import("@topconsultnpm/sdk-ts").WorkingGroupDescriptor | undefined>;
3
+ static readonly retrieveAllAsync: (objClass: ObjectClasses, refreshCache?: boolean) => Promise<import("@topconsultnpm/sdk-ts").TaskDescriptor[] | import("@topconsultnpm/sdk-ts").AreaDescriptor[] | import("@topconsultnpm/sdk-ts").NotificationDescriptor[] | import("@topconsultnpm/sdk-ts").RelationDescriptor[] | import("@topconsultnpm/sdk-ts").WorkingGroupDescriptor[] | undefined>;
4
+ static readonly retrieveAsync: (objClass: ObjectClasses, id: number) => Promise<import("@topconsultnpm/sdk-ts").TaskDescriptor | import("@topconsultnpm/sdk-ts").AreaDescriptor | import("@topconsultnpm/sdk-ts").BasketTypeDescriptor | import("@topconsultnpm/sdk-ts").NotificationDescriptor | import("@topconsultnpm/sdk-ts").RelationDescriptor | import("@topconsultnpm/sdk-ts").WorkingGroupDescriptor | undefined>;
5
5
  private static readonly retrieveAllAdminJobsAsync;
6
6
  static readonly retrieveAllAdminAsync: (objClass: ObjectClasses, jobType?: JobTypes) => Promise<import("@topconsultnpm/sdk-ts").UserDescriptor[] | DcmtTypeDescriptor[] | import("@topconsultnpm/sdk-ts").AreaDescriptor[] | import("@topconsultnpm/sdk-ts").RelationDescriptor[] | import("@topconsultnpm/sdk-ts").FEDistillerJobDescriptor[] | import("@topconsultnpm/sdk-ts").DataListDescriptor[] | import("@topconsultnpm/sdk-ts").DiskDescriptor[] | import("@topconsultnpm/sdk-ts").GroupDescriptor[] | import("@topconsultnpm/sdk-ts").LDAPDescriptor[] | import("@topconsultnpm/sdk-ts").NumeratorDescriptor[] | ProcessDescriptor[] | import("@topconsultnpm/sdk-ts").SAPLoginDescriptor[] | import("@topconsultnpm/sdk-ts").SignCertDescriptor[] | import("@topconsultnpm/sdk-ts").SignServerDescriptor[] | import("@topconsultnpm/sdk-ts").TreeDescriptor[] | import("@topconsultnpm/sdk-ts").TSADescriptor[] | import("@topconsultnpm/sdk-ts").WFDescriptor[] | undefined>;
7
7
  private static readonly loadCacheForJobAsync;
8
8
  private static readonly retrieveAdminJobAsync;
9
- static readonly retrieveAdminAsync: (objClass: ObjectClasses, jobType: JobTypes, id: number) => Promise<import("@topconsultnpm/sdk-ts").UserDescriptor | DcmtTypeDescriptor | import("@topconsultnpm/sdk-ts").MailSenderJobDescriptor | import("@topconsultnpm/sdk-ts").SavedQueryDescriptor | import("@topconsultnpm/sdk-ts").DataListDescriptor | import("@topconsultnpm/sdk-ts").AreaDescriptor | import("@topconsultnpm/sdk-ts").BasketTypeDescriptor | import("@topconsultnpm/sdk-ts").RelationDescriptor | import("@topconsultnpm/sdk-ts").TaskDescriptor | import("@topconsultnpm/sdk-ts").WorkingGroupDescriptor | import("@topconsultnpm/sdk-ts").BarcodeArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").BatchUpdaterJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoDoganaleJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoDoganalePlusJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoFiscaleQueryJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoFiscaleSenderJobDescriptor | import("@topconsultnpm/sdk-ts").CheckSequenceJobDescriptor | import("@topconsultnpm/sdk-ts").COSCheckerJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtConverterJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtDeleterJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtNoteJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtPrinterJobDescriptor | import("@topconsultnpm/sdk-ts").FEAttacherJobDescriptor | import("@topconsultnpm/sdk-ts").FECreatorTxtJobDescriptor | import("@topconsultnpm/sdk-ts").FEDetacherJobDescriptor | import("@topconsultnpm/sdk-ts").FEDistillerJobDescriptor | import("@topconsultnpm/sdk-ts").FESenderWsJobDescriptor | import("@topconsultnpm/sdk-ts").FESplitterJobDescriptor | import("@topconsultnpm/sdk-ts").FEValidatorJobDescriptor | import("@topconsultnpm/sdk-ts").FileArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").FileCheckerJobDescriptor | import("@topconsultnpm/sdk-ts").FileExecJobDescriptor | import("@topconsultnpm/sdk-ts").FileExportJobDescriptor | import("@topconsultnpm/sdk-ts").FileMoverJobDescriptor | import("@topconsultnpm/sdk-ts").LexJobDescriptor | import("@topconsultnpm/sdk-ts").LinkerJobDescriptor | import("@topconsultnpm/sdk-ts").MailArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").MailQueryJobDescriptor | import("@topconsultnpm/sdk-ts").MigrationJobDescriptor | import("@topconsultnpm/sdk-ts").PdDCreatorJobDescriptor | import("@topconsultnpm/sdk-ts").PDFArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").PdVArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").PdVQueryJobDescriptor | import("@topconsultnpm/sdk-ts").PdVSenderJobDescriptor | import("@topconsultnpm/sdk-ts").PeppolQueryJobDescriptor | import("@topconsultnpm/sdk-ts").PeppolSenderJobDescriptor | import("@topconsultnpm/sdk-ts").PostelQueryJobDescriptor | import("@topconsultnpm/sdk-ts").PostelSenderJobDescriptor | import("@topconsultnpm/sdk-ts").ReplicatorJobDescriptor | import("@topconsultnpm/sdk-ts").SAPAlignerJobDescriptor | import("@topconsultnpm/sdk-ts").SAPBarcodeJobDescriptor | import("@topconsultnpm/sdk-ts").SAPDataReaderJobDescriptor | import("@topconsultnpm/sdk-ts").SAPDataWriterJobDescriptor | import("@topconsultnpm/sdk-ts").SignerJobDescriptor | import("@topconsultnpm/sdk-ts").SpoolArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").UpdaterJobDescriptor | import("@topconsultnpm/sdk-ts").DiskDescriptor | import("@topconsultnpm/sdk-ts").GroupDescriptor | import("@topconsultnpm/sdk-ts").LDAPDescriptor | import("@topconsultnpm/sdk-ts").NumeratorDescriptor | ProcessDescriptor | import("@topconsultnpm/sdk-ts").SAPLoginDescriptor | import("@topconsultnpm/sdk-ts").SignCertDescriptor | import("@topconsultnpm/sdk-ts").SignServerDescriptor | import("@topconsultnpm/sdk-ts").TreeDescriptor | import("@topconsultnpm/sdk-ts").TSADescriptor | import("@topconsultnpm/sdk-ts").WFDescriptor | undefined>;
9
+ static readonly retrieveAdminAsync: (objClass: ObjectClasses, jobType: JobTypes, id: number) => Promise<import("@topconsultnpm/sdk-ts").UserDescriptor | import("@topconsultnpm/sdk-ts").WFDescriptor | DcmtTypeDescriptor | import("@topconsultnpm/sdk-ts").MailSenderJobDescriptor | import("@topconsultnpm/sdk-ts").TaskDescriptor | import("@topconsultnpm/sdk-ts").SavedQueryDescriptor | import("@topconsultnpm/sdk-ts").DataListDescriptor | import("@topconsultnpm/sdk-ts").AreaDescriptor | import("@topconsultnpm/sdk-ts").BasketTypeDescriptor | import("@topconsultnpm/sdk-ts").RelationDescriptor | import("@topconsultnpm/sdk-ts").WorkingGroupDescriptor | import("@topconsultnpm/sdk-ts").BarcodeArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").BatchUpdaterJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoDoganaleJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoDoganalePlusJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoFiscaleQueryJobDescriptor | import("@topconsultnpm/sdk-ts").CassettoFiscaleSenderJobDescriptor | import("@topconsultnpm/sdk-ts").CheckSequenceJobDescriptor | import("@topconsultnpm/sdk-ts").COSCheckerJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtConverterJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtDeleterJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtNoteJobDescriptor | import("@topconsultnpm/sdk-ts").DcmtPrinterJobDescriptor | import("@topconsultnpm/sdk-ts").FEAttacherJobDescriptor | import("@topconsultnpm/sdk-ts").FECreatorTxtJobDescriptor | import("@topconsultnpm/sdk-ts").FEDetacherJobDescriptor | import("@topconsultnpm/sdk-ts").FEDistillerJobDescriptor | import("@topconsultnpm/sdk-ts").FESenderWsJobDescriptor | import("@topconsultnpm/sdk-ts").FESplitterJobDescriptor | import("@topconsultnpm/sdk-ts").FEValidatorJobDescriptor | import("@topconsultnpm/sdk-ts").FileArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").FileCheckerJobDescriptor | import("@topconsultnpm/sdk-ts").FileExecJobDescriptor | import("@topconsultnpm/sdk-ts").FileExportJobDescriptor | import("@topconsultnpm/sdk-ts").FileMoverJobDescriptor | import("@topconsultnpm/sdk-ts").LexJobDescriptor | import("@topconsultnpm/sdk-ts").LinkerJobDescriptor | import("@topconsultnpm/sdk-ts").MailArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").MailQueryJobDescriptor | import("@topconsultnpm/sdk-ts").MigrationJobDescriptor | import("@topconsultnpm/sdk-ts").PdDCreatorJobDescriptor | import("@topconsultnpm/sdk-ts").PDFArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").PdVArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").PdVQueryJobDescriptor | import("@topconsultnpm/sdk-ts").PdVSenderJobDescriptor | import("@topconsultnpm/sdk-ts").PeppolQueryJobDescriptor | import("@topconsultnpm/sdk-ts").PeppolSenderJobDescriptor | import("@topconsultnpm/sdk-ts").PostelQueryJobDescriptor | import("@topconsultnpm/sdk-ts").PostelSenderJobDescriptor | import("@topconsultnpm/sdk-ts").ReplicatorJobDescriptor | import("@topconsultnpm/sdk-ts").SAPAlignerJobDescriptor | import("@topconsultnpm/sdk-ts").SAPBarcodeJobDescriptor | import("@topconsultnpm/sdk-ts").SAPDataReaderJobDescriptor | import("@topconsultnpm/sdk-ts").SAPDataWriterJobDescriptor | import("@topconsultnpm/sdk-ts").SignerJobDescriptor | import("@topconsultnpm/sdk-ts").SpoolArchiverJobDescriptor | import("@topconsultnpm/sdk-ts").UpdaterJobDescriptor | import("@topconsultnpm/sdk-ts").DiskDescriptor | import("@topconsultnpm/sdk-ts").GroupDescriptor | import("@topconsultnpm/sdk-ts").LDAPDescriptor | import("@topconsultnpm/sdk-ts").NumeratorDescriptor | ProcessDescriptor | import("@topconsultnpm/sdk-ts").SAPLoginDescriptor | import("@topconsultnpm/sdk-ts").SignCertDescriptor | import("@topconsultnpm/sdk-ts").SignServerDescriptor | import("@topconsultnpm/sdk-ts").TreeDescriptor | import("@topconsultnpm/sdk-ts").TSADescriptor | undefined>;
10
10
  private static readonly updateJobAsync;
11
11
  static readonly updateAsync: (objClass: ObjectClasses, jobType: JobTypes, d: any, ...args: any[]) => Promise<number | undefined>;
12
12
  private static readonly createJobAsync;
package/lib/ts/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from "react";
2
- import { FileFormats, ITopMediaSession, MetadataDescriptor, MetadataValueDescriptor, UserDescriptor, ValidationItem } from "@topconsultnpm/sdk-ts";
2
+ import { DataListItemDescriptor, FileFormats, ITopMediaSession, MetadataDescriptor, MetadataValueDescriptor, UserDescriptor, ValidationItem, WFDescriptor } from "@topconsultnpm/sdk-ts";
3
3
  import { ITMEditorBase } from "../components/base/TMEditorBase";
4
4
  import { IColumnProps } from "devextreme-react/data-grid";
5
5
  export declare enum FormModes {
@@ -310,3 +310,63 @@ export declare enum buildTypes {
310
310
  RTM = "RTM",
311
311
  PATCH = "PATCH"
312
312
  }
313
+ /**
314
+ * Descrive un'istanza di workflow per il contesto WorkflowCtrl.
315
+ * Contiene tutte le informazioni necessarie per recuperare i work items associati.
316
+ */
317
+ export interface WFInstanceDescriptor {
318
+ /** ID dell'istanza */
319
+ instanceId: string | undefined;
320
+ /** Indice della riga nel search result */
321
+ rowIndex: number;
322
+ /** Struttura metadati completa da searchResultToDataSource: { [key: string]: { md: MetadataDescriptor, value: any } } */
323
+ values: any;
324
+ /** TID del documento workflow */
325
+ tid?: number;
326
+ /** DID del documento workflow */
327
+ did?: number;
328
+ /** ID del workflow */
329
+ wfid?: number;
330
+ /** MID del metadato che contiene lo stato del workflow */
331
+ mStatusMID?: number;
332
+ /** DataList ID per visualizzare lo stato */
333
+ mStatusDLID?: number;
334
+ }
335
+ /**
336
+ * Dettaglio di un singolo work item
337
+ */
338
+ export interface WorkItemDetail {
339
+ wid: string;
340
+ tid: number;
341
+ did: number;
342
+ wfid: number;
343
+ approvalVID: number;
344
+ status?: DataListItemDescriptor;
345
+ setID: string;
346
+ response?: string;
347
+ creationTime?: Date;
348
+ completionTime?: Date;
349
+ from?: number;
350
+ to?: number;
351
+ toUser?: UserDescriptor;
352
+ or?: number;
353
+ }
354
+ /**
355
+ * Raggruppamento di work items per setID (e creationTime se lo step si ripete)
356
+ */
357
+ export interface IWorkItemData {
358
+ wid: string;
359
+ tid?: number;
360
+ did?: number;
361
+ category?: any;
362
+ type?: any;
363
+ name?: string;
364
+ description?: string;
365
+ setID: string | undefined;
366
+ creationTime?: Date;
367
+ setStatus?: DataListItemDescriptor;
368
+ setRule?: number;
369
+ details: WorkItemDetail[];
370
+ groupIndex?: number;
371
+ wf?: WFDescriptor;
372
+ }
@@ -57,7 +57,7 @@ declare class FontSize {
57
57
  static defaultFontSizeInPixel: string;
58
58
  }
59
59
  declare class TMMargin {
60
- static defultMargin: string;
60
+ static defaultMargin: string;
61
61
  static smallMargin: string;
62
62
  static largeMargin: string;
63
63
  }
@@ -65,7 +65,7 @@ FontSize.defaultFontSize = '1rem';
65
65
  FontSize.defaultFontSizeInPixel = '13px';
66
66
  class TMMargin {
67
67
  }
68
- TMMargin.defultMargin = '5px';
68
+ TMMargin.defaultMargin = '5px';
69
69
  TMMargin.smallMargin = '3px';
70
70
  TMMargin.largeMargin = '10px';
71
71
  class Gutters {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev1.10",
3
+ "version": "6.20.0-dev1.101",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -9,6 +9,7 @@
9
9
  "tm-build": "npm run clean && tsc && npm run copy-files",
10
10
  "tm-watch": "tsc -w",
11
11
  "tm-publish": "npm publish --tag latest",
12
+ "tm-publish_wl": "npm publish",
12
13
  "storybook": "storybook dev -p 6006",
13
14
  "build-storybook": "storybook build"
14
15
  },
@@ -39,12 +40,14 @@
39
40
  "lib"
40
41
  ],
41
42
  "dependencies": {
42
- "@topconsultnpm/sdk-ts": "6.20.0-dev1.1",
43
+ "@topconsultnpm/sdk-ts": "6.20.0-dev1.6",
43
44
  "buffer": "^6.0.3",
44
- "devextreme": "25.1.7",
45
- "devextreme-react": "25.1.7",
45
+ "devextreme": "25.2.4",
46
+ "devextreme-react": "25.2.4",
46
47
  "exceljs": "^4.4.0",
47
48
  "htmlparser2": "^10.0.0",
49
+ "pdfjs-dist": "5.4.296",
50
+ "react-pdf": "^10.3.0",
48
51
  "react-router-dom": "^6.15.0",
49
52
  "styled-components": "^6.1.1"
50
53
  },
@@ -1,25 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- export interface ITMContextMenuItemProps {
3
- icon?: ReactNode;
4
- text?: any;
5
- items?: ITMContextMenuItemProps[];
6
- disabled?: boolean;
7
- isSelected?: boolean;
8
- id?: string;
9
- onItemClick?: () => void;
10
- onItemMouseOver?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
11
- }
12
- export interface ITMContextMenuProps {
13
- items?: ITMContextMenuItemProps[];
14
- coords?: {
15
- x: number;
16
- y: number;
17
- };
18
- subMenuDir?: 'left' | 'right';
19
- }
20
- declare const TMContextMenu: ({ items, coords, subMenuDir, }: ITMContextMenuProps) => import("react/jsx-runtime").JSX.Element;
21
- export declare const useTMContextMenu: (ref: React.RefObject<HTMLElement>) => (boolean | {
22
- x: number;
23
- y: number;
24
- })[];
25
- export default TMContextMenu;
@@ -1,109 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef, useState } from 'react';
3
- import styled from 'styled-components';
4
- import { IconRight } from '../../helper/TMIcons';
5
- const StyledContextMenuContainer = styled.div `
6
- display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; z-index: 300; position: fixed; top: ${props => `${props.$top}px`}; left: ${props => `${props.$left}px`}; right: ${props => `${props.$right}px`}; bottom: ${props => `${props.$bottom}px`}; width: max-content; height: max-content; background-color: white; box-shadow: 1px 1px 2px #00000040;
7
- `;
8
- const StyledContextMenuItem = styled.div `
9
- cursor: ${props => !props.$disabled ? 'pointer' : 'default'}; display: flex; align-items: center; gap: 5px; transition: ease 100ms; padding: 5px; background-color: ${props => props.$isSelected && '#e9e9e9'}; width: 100%; height: 100%; color: ${props => props.$disabled && '#d0d0d0'}; &:hover { background-color: ${props => !props.$disabled && '#e9e9e9'} ; }
10
- `;
11
- const TMContextMenu = ({ items = [], coords = { x: 0, y: 0 }, subMenuDir = 'right', }) => {
12
- // Coordinates for sub-menus
13
- const [subMenuCoords, setSubMenuCoords] = useState({ x: 0, y: 0 });
14
- // Track which item is currently hovered
15
- const [hoveredItem, setHoveredItem] = useState(null);
16
- // Size of the menu
17
- const [menuSize, setMenuSize] = useState({ x: 0, y: 0 });
18
- // Current direction for submenus
19
- const [currentSubMenuDir, setCurrentSubMenuDir] = useState(subMenuDir);
20
- // Reference to the context menu DOM element
21
- const contextMenuRef = useRef(null);
22
- // Uupdate submenu direction based on incoming props
23
- useEffect(() => setCurrentSubMenuDir(subMenuDir), [subMenuDir]);
24
- // Calculate the size of the context menu and adjust submenu direction
25
- // Run this effect only once when the component mounts
26
- useEffect(() => {
27
- if (contextMenuRef.current) {
28
- setMenuSize({
29
- x: contextMenuRef.current.getBoundingClientRect().width || 0,
30
- y: contextMenuRef.current.getBoundingClientRect().height || 0,
31
- });
32
- }
33
- }, []);
34
- useEffect(() => {
35
- // This effect checks the width on resize
36
- const handleResize = () => {
37
- if (window.innerWidth <= coords.x + menuSize.x) {
38
- // Change direction to left if menu goes beyond right edge
39
- setCurrentSubMenuDir('left');
40
- }
41
- else {
42
- // Default to right if there's space
43
- setCurrentSubMenuDir('right');
44
- }
45
- };
46
- // Attach event listener
47
- window.addEventListener('resize', handleResize);
48
- handleResize(); // Call it initially to set the direction
49
- // Clean up the event listener on unmount
50
- return () => {
51
- window.removeEventListener('resize', handleResize);
52
- };
53
- }, [coords, menuSize.x]); // Only watch coords and the width of menuSize
54
- // Handle mouse over event on items to potentially show submenus
55
- const onItemMouseOver = (item, index) => {
56
- if (!item.disabled && item.items && item.items.length > 0) {
57
- setHoveredItem(index);
58
- const boundingRect = contextMenuRef.current?.getBoundingClientRect();
59
- if (boundingRect) {
60
- // Calculate the sub-menu position based on the current item position
61
- const subMenuX = currentSubMenuDir === 'right' ? boundingRect.right : boundingRect.left - menuSize.x;
62
- const subMenuY = boundingRect.top + index * 30; // Adjust Y coordinate to match item
63
- setSubMenuCoords({ x: subMenuX, y: subMenuY });
64
- }
65
- }
66
- else {
67
- // Clear hover state if the item has no sub-menu
68
- setHoveredItem(null); // If no submenu, clear hover state
69
- }
70
- };
71
- return (_jsx(StyledContextMenuContainer, { ref: contextMenuRef, "$left": currentSubMenuDir === 'right' ? coords.x : 'none', "$top": window.innerHeight > coords.y + menuSize.y ? coords.y : 'none', "$right": currentSubMenuDir === 'left' ? window.innerWidth - coords.x : 'none', "$bottom": window.innerHeight <= coords.y + menuSize.y ? window.innerHeight - coords.y : 'none', children: items.map((item, index) => (_jsxs("div", { style: { width: '100%' }, children: [_jsxs(StyledContextMenuItem, { id: item.id, onMouseOver: () => onItemMouseOver(item, index), onMouseEnter: () => onItemMouseOver(item, index), "$isSelected": item.isSelected, "$disabled": item.disabled, onClick: () => !item.disabled && item.onItemClick && item.onItemClick(), children: [_jsx("div", { style: { transform: 'translateY(3px)' }, children: item.icon }), _jsx("div", { style: { width: '100%' }, children: item.items && item.items.length > 0 ? (_jsxs("div", { style: {
72
- width: '100%',
73
- display: 'flex',
74
- alignItems: 'center',
75
- gap: 5,
76
- justifyContent: 'space-between',
77
- }, children: [item.text, " ", _jsx(IconRight, { style: { transform: 'translateY(1px)' }, fontSize: 10 })] })) : (_jsx("div", { style: { width: '100%' }, children: item.text })) })] }), item.items && item.items.length > 0 && hoveredItem === index && (_jsx(TMContextMenu, { subMenuDir: currentSubMenuDir, coords: subMenuCoords, items: item.items }))] }, index))) }));
78
- };
79
- export const useTMContextMenu = (ref) => {
80
- // Coordinates for the context menu
81
- const [coords, setCoords] = useState({ x: 0, y: 0 });
82
- // State to control visibility of the context menu
83
- const [showContextMenu, setShowContexMenu] = useState(false);
84
- // Effect to hide context menu when clicking outside of the referenced element
85
- useEffect(() => {
86
- const menu = ref.current;
87
- const deSelectAll = (e) => { if (menu && !menu.contains(e.target)) {
88
- setShowContexMenu(false);
89
- } };
90
- window.addEventListener('contextmenu', deSelectAll);
91
- return () => { window.removeEventListener('contextmenu', deSelectAll); };
92
- }, []);
93
- // Effect to hide context menu on left-click anywhere
94
- useEffect(() => {
95
- const handleClick = () => { setShowContexMenu(false); };
96
- window.addEventListener("click", handleClick);
97
- return () => { window.removeEventListener("click", handleClick); };
98
- }, []);
99
- // Effect to show context menu on right-click and prevent default context menu
100
- useEffect(() => {
101
- let menu = ref.current;
102
- if (menu) {
103
- menu?.addEventListener('contextmenu', (e) => { e.preventDefault(); setShowContexMenu(true); setCoords({ x: e.pageX, y: e.pageY }); });
104
- }
105
- return () => menu?.removeEventListener('contextmenu', (e) => { setCoords({ x: e.pageX, y: e.pageY }); });
106
- }, [ref]);
107
- return [coords, showContextMenu];
108
- };
109
- export default TMContextMenu;
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- export declare const useContextMenu: () => {
3
- clicked: boolean;
4
- setClicked: React.Dispatch<React.SetStateAction<boolean>>;
5
- points: {
6
- x: number;
7
- y: number;
8
- };
9
- setPoints: React.Dispatch<React.SetStateAction<{
10
- x: number;
11
- y: number;
12
- }>>;
13
- };
14
- export declare const Container: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
15
- $top: number;
16
- $left: number;
17
- }>> & string;
18
- export declare const MenuOption: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
19
- interface ITMContextMenu {
20
- menuData: any[];
21
- onMenuItemClick?: (item: string) => void;
22
- top: number;
23
- left: number;
24
- }
25
- declare const TMContextMenuOLD: React.FunctionComponent<ITMContextMenu>;
26
- export default TMContextMenuOLD;
@@ -1,56 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
3
- import styled from 'styled-components';
4
- import { Colors, FontSize } from '../../utils/theme';
5
- // #region Hook useContextMenu
6
- export const useContextMenu = () => {
7
- // boolean value to determine if the user has right clicked
8
- const [clicked, setClicked] = useState(false);
9
- // allows us to track the x,y coordinates of the users right click
10
- const [points, setPoints] = useState({ x: 0, y: 0 });
11
- useEffect(() => {
12
- // reset clicked to false on user click
13
- const handleClick = () => {
14
- setClicked(false);
15
- };
16
- // add listener for user click
17
- document.addEventListener("click", handleClick);
18
- // clean up listener function to avoid memory leaks
19
- return () => {
20
- document.removeEventListener("click", handleClick);
21
- };
22
- }, []);
23
- return { clicked, setClicked, points, setPoints };
24
- };
25
- // #endregion
26
- export const Container = styled.div `
27
- position: absolute;
28
- padding: 5px 5px;
29
- background-color: white;
30
- width: max-content;
31
- height: max-content;
32
- border-radius: 2px;
33
- display: flex;
34
- flex-direction: column;
35
- justify-content: flex-start;
36
- align-items: center;
37
- box-shadow: 2px 2px 10px #00000030;
38
- z-index: 2;
39
- top: ${(props) => props.$top || 0}px;
40
- left: ${(props) => props.$left || 0}px;
41
- `;
42
- export const MenuOption = styled.div `
43
- width: 100%;
44
- height: 20px;
45
- padding: 3px;
46
- cursor: pointer;
47
- font-size: ${FontSize.defaultFontSize};
48
-
49
- &:hover {
50
- color: ${Colors.primary};
51
- }
52
- `;
53
- const TMContextMenuOLD = ({ menuData, top, left, onMenuItemClick }) => {
54
- return (_jsx(_Fragment, { children: _jsx(Container, { "$top": top, "$left": left, children: menuData.map((item, index) => (_jsx(MenuOption, { onClick: (e) => onMenuItemClick?.(e.target.innerText), children: item.text }, index))) }) }));
55
- };
56
- export default TMContextMenuOLD;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- interface ITMFloatingToolbarProps {
3
- children: React.ReactNode;
4
- backgroundColor: string | undefined;
5
- initialLeft?: string;
6
- initialTop?: string;
7
- }
8
- declare const TMFloatingToolbar: ({ children, backgroundColor, initialLeft, initialTop }: ITMFloatingToolbarProps) => import("react/jsx-runtime").JSX.Element;
9
- export default TMFloatingToolbar;