@topconsultnpm/sdkui-react 6.22.0-dev2.5 → 6.22.0-dev2.50

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 (137) hide show
  1. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +1 -1
  2. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +1 -1
  3. package/lib/components/base/TMDataGrid.d.ts +2 -0
  4. package/lib/components/base/TMDataGrid.js +260 -8
  5. package/lib/components/base/TMEditorBase.d.ts +2 -0
  6. package/lib/components/base/TMFileManager.js +5 -3
  7. package/lib/components/base/TMFileManagerDataGridView.js +11 -2
  8. package/lib/components/base/TMFileManagerThumbnailItems.js +19 -9
  9. package/lib/components/base/TMFileManagerUtils.d.ts +2 -0
  10. package/lib/components/base/TMFileManagerUtils.js +37 -1
  11. package/lib/components/base/TMModal.d.ts +11 -0
  12. package/lib/components/base/TMModal.js +47 -13
  13. package/lib/components/base/TMPanel.d.ts +6 -0
  14. package/lib/components/base/TMPanel.js +221 -108
  15. package/lib/components/base/TMPopUp.js +3 -0
  16. package/lib/components/base/TMTooltip.d.ts +2 -1
  17. package/lib/components/base/TMTooltip.js +24 -8
  18. package/lib/components/base/TMTreeView.js +108 -67
  19. package/lib/components/choosers/TMDcmtTypeChooser.js +4 -3
  20. package/lib/components/choosers/TMDistinctValues.d.ts +9 -7
  21. package/lib/components/choosers/TMDistinctValues.js +149 -142
  22. package/lib/components/choosers/TMMetadataChooser.js +1 -1
  23. package/lib/components/choosers/TMQuickSearchInfo.d.ts +12 -0
  24. package/lib/components/choosers/TMQuickSearchInfo.js +279 -0
  25. package/lib/components/choosers/TMQuickSearchSettingsForm.d.ts +16 -0
  26. package/lib/components/choosers/TMQuickSearchSettingsForm.js +94 -0
  27. package/lib/components/choosers/TMSelectedValuesSummary.d.ts +13 -0
  28. package/lib/components/choosers/TMSelectedValuesSummary.js +91 -0
  29. package/lib/components/editors/TMDropDown.d.ts +3 -0
  30. package/lib/components/editors/TMDropDown.js +197 -5
  31. package/lib/components/editors/TMMetadataEditor.d.ts +5 -1
  32. package/lib/components/editors/TMMetadataEditor.js +8 -3
  33. package/lib/components/editors/TMTextBox.js +2 -2
  34. package/lib/components/features/archive/TMArchive.js +17 -3
  35. package/lib/components/features/documents/TMBatchUpdateForm.js +19 -5
  36. package/lib/components/features/documents/TMDcmtBlog.d.ts +3 -0
  37. package/lib/components/features/documents/TMDcmtBlog.js +4 -4
  38. package/lib/components/features/documents/TMDcmtForm.d.ts +7 -0
  39. package/lib/components/features/documents/TMDcmtForm.js +151 -46
  40. package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +11 -0
  41. package/lib/components/features/documents/TMDcmtFormActionButtons.js +74 -7
  42. package/lib/components/features/documents/TMDcmtIcon.js +5 -3
  43. package/lib/components/features/documents/TMDcmtPreview.js +10 -6
  44. package/lib/components/features/documents/TMMasterDetailDcmts.js +95 -33
  45. package/lib/components/features/documents/TMMasterInfoFields.d.ts +19 -0
  46. package/lib/components/features/documents/TMMasterInfoFields.js +186 -0
  47. package/lib/components/features/documents/TMMergeToPdfForm.d.ts +1 -2
  48. package/lib/components/features/documents/TMMergeToPdfForm.js +30 -5
  49. package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.d.ts +45 -0
  50. package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.js +323 -0
  51. package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.d.ts +370 -0
  52. package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.js +283 -0
  53. package/lib/components/features/documents/TMRelationViewer.d.ts +14 -1
  54. package/lib/components/features/documents/TMRelationViewer.js +69 -20
  55. package/lib/components/features/search/TMSearch.js +77 -11
  56. package/lib/components/features/search/TMSearchQueryEditor.js +5 -3
  57. package/lib/components/features/search/TMSearchQueryPanel.d.ts +4 -0
  58. package/lib/components/features/search/TMSearchQueryPanel.js +141 -67
  59. package/lib/components/features/search/TMSearchResult.d.ts +16 -0
  60. package/lib/components/features/search/TMSearchResult.js +432 -109
  61. package/lib/components/features/search/TMTreeSelector.js +166 -130
  62. package/lib/components/features/workflow/TMWorkflowPopup.d.ts +10 -0
  63. package/lib/components/features/workflow/TMWorkflowPopup.js +8 -4
  64. package/lib/components/grids/TMBlogAttachments.js +13 -2
  65. package/lib/components/grids/TMBlogsPost.d.ts +2 -0
  66. package/lib/components/grids/TMBlogsPost.js +26 -3
  67. package/lib/components/grids/TMBlogsPostUtils.d.ts +1 -0
  68. package/lib/components/grids/TMBlogsPostUtils.js +14 -3
  69. package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +1 -0
  70. package/lib/components/layout/panelManager/TMPanelManagerContainer.js +24 -14
  71. package/lib/components/layout/panelManager/TMPanelManagerContext.js +68 -93
  72. package/lib/components/layout/panelManager/TMPanelWrapper.js +2 -2
  73. package/lib/components/layout/panelManager/types.d.ts +3 -0
  74. package/lib/components/layout/panelManager/utils.js +13 -11
  75. package/lib/components/sidebar/TMHeader.js +30 -20
  76. package/lib/components/viewers/TMMidViewer.js +4 -1
  77. package/lib/components/viewers/TMTidViewer.js +83 -22
  78. package/lib/devextreme-license.d.ts +1 -0
  79. package/lib/devextreme-license.js +3 -0
  80. package/lib/helper/SDKUI_Globals.d.ts +110 -0
  81. package/lib/helper/SDKUI_Globals.js +151 -0
  82. package/lib/helper/SDKUI_Localizator.d.ts +42 -0
  83. package/lib/helper/SDKUI_Localizator.js +420 -0
  84. package/lib/helper/TMAppUpdatedModal.d.ts +1 -0
  85. package/lib/helper/TMAppUpdatedModal.js +134 -0
  86. package/lib/helper/TMIcons.d.ts +1 -0
  87. package/lib/helper/TMIcons.js +3 -0
  88. package/lib/helper/TMUtils.d.ts +7 -0
  89. package/lib/helper/TMUtils.js +15 -1
  90. package/lib/helper/dataGridSearchHelper.d.ts +28 -0
  91. package/lib/helper/dataGridSearchHelper.js +51 -0
  92. package/lib/helper/dcmtsHelper.d.ts +20 -0
  93. package/lib/helper/dcmtsHelper.js +58 -1
  94. package/lib/helper/helpers.d.ts +11 -0
  95. package/lib/helper/helpers.js +25 -1
  96. package/lib/helper/index.d.ts +2 -0
  97. package/lib/helper/index.js +2 -0
  98. package/lib/helper/queryHelper.d.ts +6 -1
  99. package/lib/helper/queryHelper.js +8 -3
  100. package/lib/hooks/tmDistinctValuesGridHelper.d.ts +16 -0
  101. package/lib/hooks/tmDistinctValuesGridHelper.js +31 -0
  102. package/lib/hooks/useArchiveListForm.d.ts +39 -0
  103. package/lib/hooks/useArchiveListForm.js +46 -0
  104. package/lib/hooks/useCaseFlowApprove.d.ts +56 -0
  105. package/lib/hooks/useCaseFlowApprove.js +157 -0
  106. package/lib/hooks/useDataUserIdItem.d.ts +1 -0
  107. package/lib/hooks/useDataUserIdItem.js +1 -0
  108. package/lib/hooks/useDocumentOperations.d.ts +4 -0
  109. package/lib/hooks/useDocumentOperations.js +50 -10
  110. package/lib/hooks/useMultiMasterDetailDcmts.d.ts +113 -0
  111. package/lib/hooks/useMultiMasterDetailDcmts.js +760 -0
  112. package/lib/hooks/useRelatedDocuments.d.ts +1 -0
  113. package/lib/hooks/useRelatedDocuments.js +22 -27
  114. package/lib/hooks/useShowDossiersV5.d.ts +12 -0
  115. package/lib/hooks/useShowDossiersV5.js +37 -0
  116. package/lib/hooks/useTMDistinctValuesMetadataDisplay.d.ts +18 -0
  117. package/lib/hooks/useTMDistinctValuesMetadataDisplay.js +103 -0
  118. package/lib/hooks/useTMDistinctValuesQuickSearch.d.ts +49 -0
  119. package/lib/hooks/useTMDistinctValuesQuickSearch.js +307 -0
  120. package/lib/hooks/useTMDistinctValuesSelection.d.ts +42 -0
  121. package/lib/hooks/useTMDistinctValuesSelection.js +103 -0
  122. package/lib/hooks/useTMDistinctValuesSource.d.ts +29 -0
  123. package/lib/hooks/useTMDistinctValuesSource.js +105 -0
  124. package/lib/index.d.ts +2 -0
  125. package/lib/index.js +5 -2
  126. package/lib/services/caseflow/CaseFlowService.d.ts +236 -0
  127. package/lib/services/caseflow/CaseFlowService.js +693 -0
  128. package/lib/services/caseflow/CaseFlowTemplateCacheService.d.ts +28 -0
  129. package/lib/services/caseflow/CaseFlowTemplateCacheService.js +121 -0
  130. package/lib/services/caseflow/caseFlowNameCache.d.ts +32 -0
  131. package/lib/services/caseflow/caseFlowNameCache.js +116 -0
  132. package/lib/services/caseflow/caseFlowWorkItemUtils.d.ts +61 -0
  133. package/lib/services/caseflow/caseFlowWorkItemUtils.js +113 -0
  134. package/lib/services/index.d.ts +4 -0
  135. package/lib/services/index.js +4 -0
  136. package/lib/services/platform_services.d.ts +1 -1
  137. package/package.json +9 -5
@@ -0,0 +1,134 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useState } from 'react';
3
+ import styled from 'styled-components';
4
+ import { AppModules, SDK_Globals } from '@topconsultnpm/sdk-ts';
5
+ import { useDeviceType, TMModal } from '../components';
6
+ import { calcResponsiveSizes, WHATS_NEWS_LINK_URL } from './helpers';
7
+ import { SDKUI_Globals } from './SDKUI_Globals';
8
+ import { SDKUI_Localizator } from './SDKUI_Localizator';
9
+ import { IconUpdate, IconOpenInNew } from './TMIcons';
10
+ import { getAppModuleButtonColors } from './TMUtils';
11
+ const Content = styled.div `
12
+ display: flex;
13
+ flex-direction: column;
14
+ width: 100%;
15
+ background-color: #ffffff;
16
+ `;
17
+ const Header = styled.div `
18
+ display: flex;
19
+ flex-direction: column;
20
+ align-items: center;
21
+ gap: 14px;
22
+ padding: 32px 30px 26px 30px;
23
+ background-color: ${({ $backgroundColor }) => $backgroundColor};
24
+ color: #ffffff;
25
+ text-align: center;
26
+ `;
27
+ const HeaderIcon = styled.div `
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ width: 68px;
32
+ height: 68px;
33
+ border-radius: 50%;
34
+ background-color: rgba(255, 255, 255, 0.18);
35
+ border: 1px solid rgba(255, 255, 255, 0.35);
36
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
37
+ `;
38
+ const HeaderTitle = styled.h2 `
39
+ margin: 0;
40
+ font-size: 22px;
41
+ font-weight: 600;
42
+ letter-spacing: 0.2px;
43
+ `;
44
+ const VersionBadge = styled.span `
45
+ display: inline-block;
46
+ padding: 4px 12px;
47
+ border-radius: 999px;
48
+ background-color: rgba(255, 255, 255, 0.22);
49
+ border: 1px solid rgba(255, 255, 255, 0.4);
50
+ font-size: 13px;
51
+ font-weight: 600;
52
+ letter-spacing: 0.3px;
53
+ `;
54
+ const Body = styled.div `
55
+ display: flex;
56
+ flex-direction: column;
57
+ gap: 10px;
58
+ padding: 26px 30px 22px 30px;
59
+ text-align: center;
60
+ `;
61
+ const Message = styled.p `
62
+ margin: 0;
63
+ font-size: 15px;
64
+ line-height: 1.6;
65
+ color: #242424;
66
+ `;
67
+ const SubMessage = styled.p `
68
+ margin: 0;
69
+ font-size: 13px;
70
+ line-height: 1.6;
71
+ color: #6b6b6b;
72
+ `;
73
+ const Footer = styled.div `
74
+ display: flex;
75
+ flex-direction: row;
76
+ justify-content: center;
77
+ align-items: center;
78
+ flex-wrap: wrap;
79
+ gap: 12px;
80
+ padding: 0 30px 28px 30px;
81
+ `;
82
+ const BaseButton = styled.button `
83
+ display: inline-flex;
84
+ align-items: center;
85
+ justify-content: center;
86
+ gap: 8px;
87
+ min-width: 150px;
88
+ padding: 10px 18px;
89
+ border-radius: 8px;
90
+ font-size: 14px;
91
+ font-weight: 600;
92
+ cursor: pointer;
93
+ transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
94
+ `;
95
+ const PrimaryButton = styled(BaseButton) `
96
+ border: 1px solid ${({ $base }) => $base};
97
+ background-color: ${({ $base }) => $base};
98
+ color: #ffffff;
99
+
100
+ &:hover {
101
+ background-color: ${({ $hover }) => $hover};
102
+ border-color: ${({ $hover }) => $hover};
103
+ box-shadow: 0 2px 8px ${({ $shadow }) => $shadow};
104
+ }
105
+ `;
106
+ const SecondaryButton = styled(BaseButton) `
107
+ border: 1px solid #d5d5d5;
108
+ background-color: #ffffff;
109
+ color: #444444;
110
+
111
+ &:hover {
112
+ background-color: #f3f3f3;
113
+ border-color: #bdbdbd;
114
+ }
115
+ `;
116
+ export const TMAppUpdatedModal = () => {
117
+ const deviceType = useDeviceType();
118
+ const currentVersion = SDK_Globals.appVersion ?? '';
119
+ const appModuleID = SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER;
120
+ const appModuleColors = useMemo(() => getAppModuleButtonColors(appModuleID), [appModuleID]);
121
+ const [previousVersion] = useState(() => SDKUI_Globals.userSettings.lastSeenAppVersion ?? '');
122
+ const [isOpen, setIsOpen] = useState(() => currentVersion !== '' && previousVersion !== currentVersion);
123
+ useEffect(() => {
124
+ if (!isOpen)
125
+ return;
126
+ SDKUI_Globals.userSettings.lastSeenAppVersion = currentVersion;
127
+ }, [isOpen, currentVersion]);
128
+ const onClose = () => { setIsOpen(false); };
129
+ if (!isOpen)
130
+ return null;
131
+ return (_jsx(TMModal, { width: calcResponsiveSizes(deviceType, '520px', '520px', '95%'), height: 'auto', showHeader: false, resizable: false, onClose: onClose, children: _jsxs(Content, { children: [_jsxs(Header, { "$backgroundColor": appModuleColors.base, children: [_jsx(HeaderIcon, { children: _jsx(IconUpdate, { fontSize: 34 }) }), _jsx(HeaderTitle, { children: SDKUI_Localizator.AppUpdatedTitle }), _jsx(VersionBadge, { children: `${SDK_Globals.appModule} ${currentVersion}` })] }), _jsxs(Body, { children: [_jsx(Message, { children: previousVersion
132
+ ? SDKUI_Localizator.AppUpdatedMessageFromTo.replaceParams(previousVersion, currentVersion)
133
+ : SDKUI_Localizator.AppUpdatedMessage.replaceParams(currentVersion) }), _jsx(SubMessage, { children: SDKUI_Localizator.AppUpdatedSubMessage })] }), _jsxs(Footer, { children: [_jsxs(PrimaryButton, { "$base": appModuleColors.base, "$hover": appModuleColors.hover, "$shadow": appModuleColors.shadow, onClick: () => window.open(WHATS_NEWS_LINK_URL, '_blank', 'noopener,noreferrer'), children: [_jsx(IconOpenInNew, { fontSize: 18 }), SDKUI_Localizator.DiscoverWhatsNew] }), _jsx(SecondaryButton, { onClick: onClose, children: SDKUI_Localizator.Close })] })] }) }));
134
+ };
@@ -271,6 +271,7 @@ export declare function IconWizard4(props: React.SVGProps<SVGSVGElement>): impor
271
271
  export declare function IconNew(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
272
272
  export declare function IconFileOpenOutline(props: Readonly<React.SVGProps<SVGSVGElement>>): import("react/jsx-runtime").JSX.Element;
273
273
  export declare function IconArchiveDetail(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
274
+ export declare function IconArchiveMultipleDetailDocuments(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
274
275
  export declare function IconArchiveMaster(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
275
276
  export declare function IconPair(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
276
277
  export declare function IconUnpair(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -673,6 +673,9 @@ export function IconFileOpenOutline(props) {
673
673
  export function IconArchiveDetail(props) {
674
674
  return (_jsxs("svg", { fontSize: props.fontSize ?? FONTSIZE, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", ...props, children: [" ", _jsx("path", { fill: "currentColor", d: "m20.54 5.23l-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27M12 17.5L6.5 12H10v-2h4v2h3.5zM5.12 5l.81-1h12l.94 1z" }), " "] }));
675
675
  }
676
+ export function IconArchiveMultipleDetailDocuments(props) {
677
+ return (_jsxs("svg", { fontSize: props.fontSize ?? FONTSIZE, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48", width: "1em", height: "1em", ...props, children: [_jsx("path", { fill: "currentColor", d: "M40,35v5H8v-5H4v5c0,2.2,1.8,4,4,4h32c2.2,0,4-1.8,4-4v-5H40z" }), _jsxs("g", { fill: "currentColor", children: [_jsx("polygon", { points: "24,23.4 17,15 31,15" }), _jsx("rect", { x: "22", y: "4", width: "4", height: "14" }), _jsx("path", { d: "M31.5,26.9L30.8,28l3.5,1.9l0.6-1.2c1.6-3,2.6-4.7,3.5-5.2C39.3,23,41,23,44,23v-4C36.3,19,35.6,19.4,31.5,26.9z" }), _jsx("polygon", { points: "38.4,31 29.4,35 28,25" }), _jsx("path", { d: "M16.5,26.9l0.6,1.2L13.6,30L13,28.8c-1.6-3-2.6-4.7-3.5-5.2C8.7,23,7,23,4,23v-4C11.7,19,12.4,19.4,16.5,26.9z" }), _jsx("polygon", { points: "20,25 18.6,35 9.6,31" })] })] }));
678
+ }
676
679
  export function IconArchiveMaster(props) {
677
680
  return (_jsxs("svg", { fontSize: props.fontSize ?? FONTSIZE, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "1em", height: "1em", ...props, children: [" ", _jsx("path", { fill: "currentColor", d: "m20.55 5.22l-1.39-1.68A1.51 1.51 0 0 0 18 3H6c-.47 0-.88.21-1.15.55L3.46 5.22C3.17 5.57 3 6.01 3 6.5V19a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V6.5c0-.49-.17-.93-.45-1.28M12 9.5l5.5 5.5H14v2h-4v-2H6.5zM5.12 5l.82-1h12l.93 1z" }), " "] }));
678
681
  }
@@ -53,11 +53,18 @@ export declare const PDGS_COLORS: {
53
53
  DOSSIER: string;
54
54
  DOCUMENT: string;
55
55
  WORKING_GROUP: string;
56
+ /** Istanza di CaseFlow: viola, per non confonderla ne' con la pratica (arancio) ne' con il gruppo di lavoro (verde). */
57
+ CASEFLOW: string;
56
58
  };
57
59
  export declare const getPdgsIconMap: (fontSize?: number) => Map<PdGs, JSX.Element>;
58
60
  export declare const convertSearchResultDescriptorToFileItems: (documents: Array<SearchResultDescriptor>) => Array<FileItem>;
59
61
  export declare const getAppModuleGradient: (appModuleID: AppModules) => string;
60
62
  export declare const getPanelManagerToolbarColor: (appModuleID: AppModules) => string;
63
+ export declare const getAppModuleButtonColors: (appModuleID: AppModules) => {
64
+ base: string;
65
+ hover: string;
66
+ shadow: string;
67
+ };
61
68
  export declare const getFileManagerFolderColor: (appModuleID: AppModules) => string;
62
69
  type SearchToolbarVisibility = {
63
70
  tmSearchResult: boolean;
@@ -270,6 +270,8 @@ export const PDGS_COLORS = {
270
270
  DOSSIER: '#e65b00',
271
271
  DOCUMENT: '#b38600',
272
272
  WORKING_GROUP: '#009700',
273
+ /** Istanza di CaseFlow: viola, per non confonderla ne' con la pratica (arancio) ne' con il gruppo di lavoro (verde). */
274
+ CASEFLOW: '#6a3fb5',
273
275
  };
274
276
  export const getPdgsIconMap = (fontSize = 20) => {
275
277
  return new Map([
@@ -336,7 +338,7 @@ export const getAppModuleGradient = (appModuleID) => {
336
338
  case AppModules.SURFER:
337
339
  return 'linear-gradient(270deg, #46B5A2 16%, #3BAABC 34%, #3BAABC 34%, #3681AD 54%, #3368A5 72%, #2F549D 88%, #304F99 100%)';
338
340
  case AppModules.DESIGNER:
339
- return 'linear-gradient(270deg, #A06A8E 16%, #885C77 34%, #6F4C5F 54%, #5A3446 72%, #482234 100%);';
341
+ return 'linear-gradient(270deg, #A06A8E 16%, #885C77 34%, #6F4C5F 54%, #5A3446 72%, #482234 100%)';
340
342
  case AppModules.ORCHESTRATOR:
341
343
  return 'linear-gradient(270deg, #46B5A2 16%, #3BAA8A 34%, #2F8F6F 54%, #277A5A 72%, #216948 88%, #1d6f42 100%)';
342
344
  default:
@@ -355,6 +357,18 @@ export const getPanelManagerToolbarColor = (appModuleID) => {
355
357
  return 'transparent linear-gradient(90deg, #CCE0F4 0%, #7EC1E7 14%, #39A6DB 28%, #1E9CD7 35%, #0075BE 78%, #005B97 99%) 0% 0% no-repeat padding-box';
356
358
  }
357
359
  };
360
+ export const getAppModuleButtonColors = (appModuleID) => {
361
+ switch (appModuleID) {
362
+ case AppModules.SURFER:
363
+ return { base: '#2559a5', hover: '#1c4783', shadow: 'rgba(37, 89, 165, 0.35)' };
364
+ case AppModules.DESIGNER:
365
+ return { base: '#482234', hover: '#351826', shadow: 'rgba(72, 34, 52, 0.35)' };
366
+ case AppModules.ORCHESTRATOR:
367
+ return { base: '#1d6f42', hover: '#15532f', shadow: 'rgba(29, 111, 66, 0.35)' };
368
+ default:
369
+ return { base: '#2559a5', hover: '#1c4783', shadow: 'rgba(37, 89, 165, 0.35)' };
370
+ }
371
+ };
358
372
  export const getFileManagerFolderColor = (appModuleID) => {
359
373
  switch (appModuleID) {
360
374
  case AppModules.SURFER:
@@ -0,0 +1,28 @@
1
+ import { MetadataFormats } from '@topconsultnpm/sdk-ts';
2
+ /** Testo mostrato in una colonna per una riga: è quello su cui va cercato ciò che l'utente digita */
3
+ export type SearchTextGetter = (rowData: any) => string;
4
+ /** Testo con cui una data viene mostrata nella griglia: è quello che l'utente vede e quindi quello che cerca */
5
+ export declare const getDateDisplayText: (value: any, format: MetadataFormats | undefined, formatCulture: string | undefined | null) => string;
6
+ /** Testo con cui un numero viene mostrato nella griglia (separatore delle migliaia, valuta, decimali) */
7
+ export declare const getNumberDisplayText: (value: any, format: MetadataFormats | undefined, formatCulture: string) => string;
8
+ /**
9
+ * Dirotta la ricerca della griglia sul testo mostrato, per le colonne indicate (chiave: il `dataField`).
10
+ *
11
+ * La ricerca di DevExtreme lavora sul valore archiviato, quindi non trova nulla dove il testo mostrato è
12
+ * diverso:
13
+ * - **date**, che nei dati sono stringhe ISO: DevExtreme prova a interpretare il testo digitato con il
14
+ * formato della colonna, non riesce (il formato è un formatter personalizzato, non un pattern) e scarta
15
+ * la colonna dalla ricerca — cercando `29/01/2023` non trova nulla;
16
+ * - **numeri formattati**, per lo stesso motivo (separatore delle migliaia, simbolo di valuta);
17
+ * - **liste dati e utenti**, dove viene confrontata la chiave archiviata invece della descrizione
18
+ * visualizzata — cercando `FATTURA` non trova nulla, cercando `TD01` sì.
19
+ *
20
+ * Da passare a `customizeColumns` della griglia. Va fatto lì perché solo lì è disponibile la
21
+ * `calculateFilterExpression` predefinita di DevExtreme, che resta in uso per il filtro di intestazione e
22
+ * per il generatore di filtri: quelli funzionano già correttamente e vanno lasciati intatti.
23
+ *
24
+ * @example
25
+ * const searchTextGetters = useMemo(() => new Map([['TM_1_2', (row) => getDateDisplayText(row?.TM_1_2, format, culture)]]), [...]);
26
+ * const customizeColumns = useMemo(() => customizeSearchByDisplayText(searchTextGetters), [searchTextGetters]);
27
+ */
28
+ export declare const customizeSearchByDisplayText: (searchTextGetters: Map<string, SearchTextGetter>) => (columns: Array<any>) => void;
@@ -0,0 +1,51 @@
1
+ import { formatDateTimeByMetadataFormat, formatNumberByMetadataFormat } from './TMUtils';
2
+ /** Testo con cui una data viene mostrata nella griglia: è quello che l'utente vede e quindi quello che cerca */
3
+ export const getDateDisplayText = (value, format, formatCulture) => {
4
+ if (value === undefined || value === null || value === '')
5
+ return '';
6
+ const date = value instanceof Date ? value : new Date(value);
7
+ return Number.isNaN(date.getTime()) ? '' : formatDateTimeByMetadataFormat(date, format, formatCulture);
8
+ };
9
+ /** Testo con cui un numero viene mostrato nella griglia (separatore delle migliaia, valuta, decimali) */
10
+ export const getNumberDisplayText = (value, format, formatCulture) => {
11
+ if (value === undefined || value === null || value === '')
12
+ return '';
13
+ return formatNumberByMetadataFormat(value, format, formatCulture);
14
+ };
15
+ /**
16
+ * Dirotta la ricerca della griglia sul testo mostrato, per le colonne indicate (chiave: il `dataField`).
17
+ *
18
+ * La ricerca di DevExtreme lavora sul valore archiviato, quindi non trova nulla dove il testo mostrato è
19
+ * diverso:
20
+ * - **date**, che nei dati sono stringhe ISO: DevExtreme prova a interpretare il testo digitato con il
21
+ * formato della colonna, non riesce (il formato è un formatter personalizzato, non un pattern) e scarta
22
+ * la colonna dalla ricerca — cercando `29/01/2023` non trova nulla;
23
+ * - **numeri formattati**, per lo stesso motivo (separatore delle migliaia, simbolo di valuta);
24
+ * - **liste dati e utenti**, dove viene confrontata la chiave archiviata invece della descrizione
25
+ * visualizzata — cercando `FATTURA` non trova nulla, cercando `TD01` sì.
26
+ *
27
+ * Da passare a `customizeColumns` della griglia. Va fatto lì perché solo lì è disponibile la
28
+ * `calculateFilterExpression` predefinita di DevExtreme, che resta in uso per il filtro di intestazione e
29
+ * per il generatore di filtri: quelli funzionano già correttamente e vanno lasciati intatti.
30
+ *
31
+ * @example
32
+ * const searchTextGetters = useMemo(() => new Map([['TM_1_2', (row) => getDateDisplayText(row?.TM_1_2, format, culture)]]), [...]);
33
+ * const customizeColumns = useMemo(() => customizeSearchByDisplayText(searchTextGetters), [searchTextGetters]);
34
+ */
35
+ export const customizeSearchByDisplayText = (searchTextGetters) => (columns) => {
36
+ columns.forEach((column) => {
37
+ const getSearchText = column?.dataField ? searchTextGetters.get(column.dataField) : undefined;
38
+ // customizeColumns viene richiamata a ogni aggiornamento delle colonne: senza il marcatore i wrapper si anniderebbero
39
+ if (!getSearchText || column.tmSearchByDisplayText)
40
+ return;
41
+ const defaultCalculateFilterExpression = column.calculateFilterExpression;
42
+ // Senza questo DevExtreme prova a convertire il testo digitato nel tipo della colonna e, non riuscendo, la scarta
43
+ column.parseValue = (text) => text;
44
+ column.calculateFilterExpression = function (filterValue, selectedFilterOperation, target) {
45
+ if (target === 'search')
46
+ return [getSearchText, 'contains', filterValue];
47
+ return defaultCalculateFilterExpression?.apply(this, arguments);
48
+ };
49
+ column.tmSearchByDisplayText = true;
50
+ });
51
+ };
@@ -1,8 +1,28 @@
1
+ import { DcmtTypeDescriptor, MetadataDataTypes, MetadataDescriptor, MetadataFormats, RelationDescriptor } from "@topconsultnpm/sdk-ts";
1
2
  import { MetadataValueDescriptorEx } from "../ts";
3
+ /** Metadati utente (esclusi quelli di sistema) del tipo documento, in ordine di visualizzazione */
4
+ export declare const getUserMetadataSorted: (dtd: DcmtTypeDescriptor | undefined) => Array<MetadataDescriptor>;
5
+ /** Formatta un valore scalare (non lista dati): date e numeri rispettano Format e FormatCulture del metadato */
6
+ export declare const formatScalarValue: (value: any, dataType: MetadataDataTypes | undefined, format: MetadataFormats | undefined, formatCulture: string | undefined) => string;
2
7
  /** Check if dcmtType (mTID) has configured Detail or Many-to-Many relations */
3
8
  export declare const hasDetailRelations: (mTID: number | undefined) => Promise<boolean>;
4
9
  /** Check if dcmtType (mTID) has configured Master or Many-to-Many relations */
5
10
  export declare const hasMasterRelations: (mTID: number | undefined) => Promise<boolean>;
11
+ export declare const getDcmtMetadataByMid: (dcmt: {
12
+ TID?: number;
13
+ DID?: number;
14
+ } | undefined) => Promise<Map<number, any>>;
15
+ export declare const mapAssociationsFromMetadata: (relation: RelationDescriptor, type: "detail" | "master", metadataByMid: Map<number, any>) => Array<{
16
+ mid: number;
17
+ value: string;
18
+ }>;
19
+ export declare const mapRelationAssociationsToMids: (relation: RelationDescriptor, type: "detail" | "master", dcmt: {
20
+ TID?: number;
21
+ DID?: number;
22
+ } | undefined) => Promise<Array<{
23
+ mid: number;
24
+ value: string;
25
+ }>>;
6
26
  export declare const isXMLFileExt: (fileExt: string | undefined) => boolean;
7
27
  export declare const getButtonAttributes: (args: string | undefined, formData: MetadataValueDescriptorEx[] | undefined, selectedItems: Array<any> | undefined) => Record<string, any> | undefined;
8
28
  export declare const getSelectedItem: (args: string | undefined, formData: MetadataValueDescriptorEx[] | undefined, item: any) => Record<string, any> | undefined;
@@ -1,4 +1,21 @@
1
- import { RelationCacheService, RelationTypes, SDK_Globals } from "@topconsultnpm/sdk-ts";
1
+ import { MetadataDataTypes, RelationCacheService, RelationTypes, SDK_Globals } from "@topconsultnpm/sdk-ts";
2
+ import { formatDateTimeByMetadataFormat, formatNumberByMetadataFormat } from "./TMUtils";
3
+ /** Metadati utente (esclusi quelli di sistema) del tipo documento, in ordine di visualizzazione */
4
+ export const getUserMetadataSorted = (dtd) => {
5
+ return (dtd?.metadata ?? [])
6
+ .filter(md => md.id !== undefined && md.id > 100 && md.isSystem !== 1)
7
+ .sort((a, b) => (a.ordinalPosition ?? 0) - (b.ordinalPosition ?? 0));
8
+ };
9
+ /** Formatta un valore scalare (non lista dati): date e numeri rispettano Format e FormatCulture del metadato */
10
+ export const formatScalarValue = (value, dataType, format, formatCulture) => {
11
+ if (value === undefined || value === null || value === '')
12
+ return '';
13
+ switch (dataType) {
14
+ case MetadataDataTypes.DateTime: return formatDateTimeByMetadataFormat(value instanceof Date ? value : new Date(value), format, formatCulture);
15
+ case MetadataDataTypes.Number: return formatNumberByMetadataFormat(value, format, formatCulture ?? window.navigator.language);
16
+ default: return String(value);
17
+ }
18
+ };
2
19
  /** Check if dcmtType (mTID) has configured Detail or Many-to-Many relations */
3
20
  export const hasDetailRelations = async (mTID) => {
4
21
  let allRelations = await RelationCacheService.GetAllAsync();
@@ -13,6 +30,46 @@ export const hasMasterRelations = async (mTID) => {
13
30
  let rdlManyToMany = allRelations?.filter(o => o.relationType == RelationTypes.ManyToMany && (o.masterTID == mTID || o.detailTID == mTID)) ?? [];
14
31
  return rdlManyToMany.length > 0 || rdlOneToMany.length > 0;
15
32
  };
33
+ // Legge i metadati di un documento
34
+ export const getDcmtMetadataByMid = async (dcmt) => {
35
+ const metadataMap = new Map();
36
+ if (!dcmt?.TID || !dcmt?.DID)
37
+ return metadataMap; // Documento non identificabile: mappa vuota
38
+ const searchEngine = SDK_Globals.tmSession?.NewSearchEngine();
39
+ if (!searchEngine)
40
+ return metadataMap; // Nessuna sessione attiva: mappa vuota
41
+ const allMetadata = await searchEngine.GetMetadataAsync(dcmt.TID, dcmt.DID, false);
42
+ const row = allMetadata?.dtdResult?.rows?.[0]; // Prima (e unica) riga = il documento richiesto
43
+ const mids = allMetadata?.selectMIDs; // MID nello stesso ordine dei valori di riga
44
+ if (row && mids)
45
+ mids.forEach((mid, index) => metadataMap.set(mid, row[index])); // Accoppia mid -> valore per posizione
46
+ return metadataMap;
47
+ };
48
+ // Mappa le associazioni della relazione nei MID di destinazione, usando i metadati sorgente già letti.
49
+ // 'detail' = archivio dettagli dal master (sorgente item1 -> destinazione item2); 'master' = archivio master dal dettaglio (item2 -> item1).
50
+ // Emette una voce per ogni associazione, anche vuota, per coprire tutti i collegamenti.
51
+ export const mapAssociationsFromMetadata = (relation, type, metadataByMid) => {
52
+ if (!relation.associations || relation.associations.length === 0)
53
+ return []; // Relazione senza collegamenti
54
+ return relation.associations.map(assoc => {
55
+ const sourceMid = type === 'detail' ? (assoc.item1 ?? 0) : (assoc.item2 ?? 0); // MID da cui leggere il valore
56
+ const targetMid = type === 'detail' ? (assoc.item2 ?? 0) : (assoc.item1 ?? 0); // MID da valorizzare
57
+ const value = metadataByMid.get(sourceMid); // Valore sorgente (può mancare)
58
+ return { mid: targetMid, value: value !== undefined && value !== null ? value.toString() : '' }; // Assente/null -> stringa vuota
59
+ });
60
+ };
61
+ // Legge il documento sorgente (master per 'detail', dettaglio per 'master') e mappa le associazioni nei MID di destinazione.
62
+ // Per letture ripetute dello stesso documento, riusare la mappa e chiamare direttamente `mapAssociationsFromMetadata`.
63
+ export const mapRelationAssociationsToMids = async (relation, type, dcmt) => {
64
+ if (!relation.associations || relation.associations.length === 0)
65
+ return []; // Relazione senza collegamenti
66
+ if (!dcmt?.TID || !dcmt?.DID)
67
+ return []; // Documento sorgente non identificabile
68
+ const metadataByMid = await getDcmtMetadataByMid(dcmt);
69
+ if (metadataByMid.size === 0)
70
+ return []; // Nessun metadato leggibile: [] come nel flusso originale (niente collegamenti a vuoto)
71
+ return mapAssociationsFromMetadata(relation, type, metadataByMid);
72
+ };
16
73
  export const isXMLFileExt = (fileExt) => {
17
74
  const fileExtension = fileExt?.toLowerCase() ?? '';
18
75
  switch (fileExtension) {
@@ -2,6 +2,15 @@ import { Colors as ColorsType } from "../components/base/TMEditorBase";
2
2
  import { DeviceType } from "../components";
3
3
  import { AppModules, DataColumnDescriptor, DcmtTypeDescriptor, ITopMediaSession, MetadataDescriptor, QueryDescriptor, SearchResultDescriptor, TaskDescriptor } from "@topconsultnpm/sdk-ts";
4
4
  import { FileExtensionHandler, FormModes, moduleTypes } from "../ts";
5
+ import React from "react";
6
+ /**
7
+ * Handler di hover per elementi con stili inline: applica `over` all'ingresso del mouse e `out` all'uscita.
8
+ * Da spandere sull'elemento: `{...hoverStyle({ background: 'red' }, { background: 'transparent' })}`
9
+ */
10
+ export declare const hoverStyle: (over: React.CSSProperties, out: React.CSSProperties) => {
11
+ onMouseEnter: (e: React.MouseEvent<HTMLElement>) => CSSStyleDeclaration & React.CSSProperties;
12
+ onMouseLeave: (e: React.MouseEvent<HTMLElement>) => CSSStyleDeclaration & React.CSSProperties;
13
+ };
5
14
  declare const calcResponsiveSizes: (deviceType: DeviceType | undefined, desktopSize: string, tabletSize: string, mobileSize: string) => string;
6
15
  declare const taskModalSizes: (deviceType: DeviceType | undefined, formMode: FormModes) => {
7
16
  width: string;
@@ -53,6 +62,8 @@ export declare const getSystemMetadata: (withPerm?: boolean) => MetadataDescript
53
62
  export declare function deepCompare(obj1: any, obj2: any): boolean;
54
63
  export declare const extensionHandler: (fileExt: string | undefined) => FileExtensionHandler;
55
64
  export declare const downloadBase64File: (base64Data: string, fileName: string) => void;
65
+ export declare const WHATS_NEWS_FILE_NAME = "what's new";
66
+ export declare const WHATS_NEWS_LINK_URL = "https://www.topconsult.it/it/documentazionetopmedia";
56
67
  export declare const TASK_MORE_INFO_PREFIX_NAME: string;
57
68
  export declare const isTaskMoreInfo: (taskName: string | undefined) => boolean | undefined;
58
69
  export declare const getMoreInfoTasksForDocument: (allTasks: TaskDescriptor[], TID: number | null | undefined, DID: number | null | undefined) => TaskDescriptor[];
@@ -7,6 +7,14 @@ import { buildTypes, FileExtensionHandler, FormModes, moduleTypes } from "../ts"
7
7
  import { SDKUI_Localizator } from "./SDKUI_Localizator";
8
8
  import ReactDOMServer from "react-dom/server";
9
9
  import { DeepCompareHelper } from "./DeepCompareHelper";
10
+ /**
11
+ * Handler di hover per elementi con stili inline: applica `over` all'ingresso del mouse e `out` all'uscita.
12
+ * Da spandere sull'elemento: `{...hoverStyle({ background: 'red' }, { background: 'transparent' })}`
13
+ */
14
+ export const hoverStyle = (over, out) => ({
15
+ onMouseEnter: (e) => Object.assign(e.currentTarget.style, over),
16
+ onMouseLeave: (e) => Object.assign(e.currentTarget.style, out),
17
+ });
10
18
  const calcResponsiveSizes = (deviceType, desktopSize, tabletSize, mobileSize) => {
11
19
  if (deviceType === DeviceType.DESKTOP)
12
20
  return desktopSize;
@@ -605,6 +613,8 @@ export const downloadBase64File = (base64Data, fileName) => {
605
613
  // Libera l'URL del Blob
606
614
  URL.revokeObjectURL(blobUrl);
607
615
  };
616
+ export const WHATS_NEWS_FILE_NAME = "what's new";
617
+ export const WHATS_NEWS_LINK_URL = 'https://www.topconsult.it/it/documentazionetopmedia';
608
618
  export const TASK_MORE_INFO_PREFIX_NAME = `${SDKUI_Localizator.MoreInformation} - `;
609
619
  export const isTaskMoreInfo = (taskName) => taskName?.startsWith(TASK_MORE_INFO_PREFIX_NAME);
610
620
  // Filtra i task di tipo "More Info" non completati associati a un documento specifico.
@@ -813,7 +823,21 @@ export var LandingPages;
813
823
  // #region Exception
814
824
  export function getExceptionMessage(ex) {
815
825
  let msg = ex.isApiException ? ex.response.title : ex.message;
816
- return msg ?? ex.toString();
826
+ if (msg !== undefined && msg !== null)
827
+ return msg;
828
+ let asString = ex.toString();
829
+ if (asString !== '[object Object]')
830
+ return asString;
831
+ if (ex.errorMessage)
832
+ return ex.errorMessage;
833
+ if (ex.title)
834
+ return ex.title;
835
+ try {
836
+ return JSON.stringify(ex) ?? asString;
837
+ }
838
+ catch {
839
+ return asString;
840
+ }
817
841
  }
818
842
  export function getContrastColor(inputColor) {
819
843
  let hex = inputColor;
@@ -5,6 +5,7 @@ export * from './Globalization';
5
5
  export * from './TMIcons';
6
6
  export * from './TMImageLibrary';
7
7
  export * from './helpers';
8
+ export * from './dataGridSearchHelper';
8
9
  export * from './queryHelper';
9
10
  export * from './TMUtils';
10
11
  export * from './TMCommandsContextMenu';
@@ -18,3 +19,4 @@ export * from './devextremeCustomMessages';
18
19
  export * from './ZipManager';
19
20
  export * from './certificateImportHelper';
20
21
  export * from './grafometricSignaturesCache';
22
+ export * from './TMAppUpdatedModal';
@@ -5,6 +5,7 @@ export * from './Globalization';
5
5
  export * from './TMIcons';
6
6
  export * from './TMImageLibrary';
7
7
  export * from './helpers';
8
+ export * from './dataGridSearchHelper';
8
9
  export * from './queryHelper';
9
10
  export * from './TMUtils';
10
11
  export * from './TMCommandsContextMenu';
@@ -18,3 +19,4 @@ export * from './devextremeCustomMessages';
18
19
  export * from './ZipManager';
19
20
  export * from './certificateImportHelper';
20
21
  export * from './grafometricSignaturesCache';
22
+ export * from './TMAppUpdatedModal';
@@ -5,7 +5,10 @@ export type TID_Alias = {
5
5
  alias: string | undefined;
6
6
  };
7
7
  export declare const getTIDsByQd: (qd: QueryDescriptor | undefined) => TID_Alias[];
8
- export declare const getDcmtTypesByQdAsync: (qd: QueryDescriptor) => Promise<import("@topconsultnpm/sdk-ts").DcmtTypeDescriptor[]>;
8
+ /** Restituisce i tipi documento (con metadati) referenziati da qd.
9
+ * Con refreshCache = true i descrittori vengono riletti dal server, così la lista dei metadati
10
+ * recepisce quelli aggiunti o rimossi dopo il popolamento della cache. */
11
+ export declare const getDcmtTypesByQdAsync: (qd: QueryDescriptor, refreshCache?: boolean) => Promise<import("@topconsultnpm/sdk-ts").DcmtTypeDescriptor[]>;
9
12
  export declare const displayMetadataValue: (md: MetadataDescriptor | undefined, value: string | undefined, valueEmptyDescription?: string) => string;
10
13
  export declare const IsParametricQuery: (qd: QueryDescriptor | undefined) => boolean;
11
14
  export declare const addHiddenSelectItem: (select: SelectItem[], tid: number | undefined, mid: SystemMIDsAsNumber) => void;
@@ -14,6 +17,8 @@ export declare function addWhereClausesForConnect(qd: QueryDescriptor): void;
14
17
  export declare function getDefaultOperator(dataDomain: MetadataDataDomains | undefined, dataType: MetadataDataTypes | undefined): QueryOperators.Equal | QueryOperators.Contain | QueryOperators.In;
15
18
  export declare const getQD: (tid: number | undefined, easyOr: boolean, newMaxDcmtsToBeReturned: number) => Promise<QueryDescriptor | undefined>;
16
19
  export declare const getWorkItemSetIDAsync: (vid: number, did: number) => Promise<string | undefined>;
20
+ /** Id assegnato alla ricerca di sistema con tutti i documenti: non è in cache, va ricostruita a runtime con getSysAllDcmtsSQD */
21
+ export declare const SYS_ALL_DCMTS_SQD_ID = 1;
17
22
  export declare const getSysAllDcmtsSQD: (tid: number | undefined, easyOr: boolean) => Promise<SavedQueryDescriptor>;
18
23
  export declare const searchResultToMetadataValues: (tid: number | undefined, dtd: DataTableDescriptor | undefined, rows: string[], mids: number[], metadata: MetadataDescriptor[], layoutMode: LayoutModes, isReadOnlyOrigin?: boolean) => MetadataValueDescriptorEx[];
19
24
  export declare const handleArchiveVisibility: (md: MetadataDescriptor) => boolean;
@@ -15,8 +15,11 @@ export const getTIDsByQd = (qd) => {
15
15
  }
16
16
  return tids;
17
17
  };
18
- export const getDcmtTypesByQdAsync = async (qd) => {
19
- return await DcmtTypeListCacheService.GetFromQdAsync(qd);
18
+ /** Restituisce i tipi documento (con metadati) referenziati da qd.
19
+ * Con refreshCache = true i descrittori vengono riletti dal server, così la lista dei metadati
20
+ * recepisce quelli aggiunti o rimossi dopo il popolamento della cache. */
21
+ export const getDcmtTypesByQdAsync = async (qd, refreshCache = false) => {
22
+ return await DcmtTypeListCacheService.GetFromQdAsync(qd, undefined, false, refreshCache);
20
23
  };
21
24
  export const displayMetadataValue = (md, value, valueEmptyDescription = "") => {
22
25
  if (!value)
@@ -251,9 +254,11 @@ export const getWorkItemSetIDAsync = async (vid, did) => {
251
254
  let result = await SDK_Globals.tmSession?.NewSearchEngine().SearchByIDAsync(qd);
252
255
  return result?.dtdResult?.rows?.[0]?.[0];
253
256
  };
257
+ /** Id assegnato alla ricerca di sistema con tutti i documenti: non è in cache, va ricostruita a runtime con getSysAllDcmtsSQD */
258
+ export const SYS_ALL_DCMTS_SQD_ID = 1;
254
259
  export const getSysAllDcmtsSQD = async (tid, easyOr) => {
255
260
  let sqd = new SavedQueryDescriptor();
256
- sqd.id = 1;
261
+ sqd.id = SYS_ALL_DCMTS_SQD_ID;
257
262
  sqd.masterTID = tid;
258
263
  sqd.isEasyWhere = 1;
259
264
  sqd.name = SDKUI_Localizator.AllDcmts;
@@ -0,0 +1,16 @@
1
+ import { DataColumnDescriptor, DataColumnTypes, MetadataDescriptor, MetadataFormats } from '@topconsultnpm/sdk-ts';
2
+ /**
3
+ * Funzioni condivise dalle due sorgenti di TMDistinctValues (valori distinti e ricerca rapida):
4
+ * stanno fuori dagli hook perché non dipendono da alcuno stato.
5
+ */
6
+ export declare const withRowIndex: <T>(rows: Array<T>) => T[];
7
+ export declare const toGridDataType: (dataType: DataColumnTypes | undefined) => "string" | "number" | "datetime" | "boolean";
8
+ export declare const getMetadataName: (columnMd: MetadataDescriptor | undefined) => string | undefined;
9
+ export declare const getDateDisplayFormat: (format: MetadataFormats | undefined, formatCulture: string | undefined | null) => {
10
+ formatter: (value: string | number | Date) => string;
11
+ };
12
+ /**
13
+ * Risolve il MID della colonna di un risultato di ricerca: la proprietà estesa è la fonte principale,
14
+ * in mancanza resta l'allineamento posizionale tra selectMIDs e colonne del risultato.
15
+ */
16
+ export declare const getColumnMid: (column: DataColumnDescriptor | undefined, selectMIDs: number[] | undefined, columnIndex: number) => number;
@@ -0,0 +1,31 @@
1
+ import { DataColumnTypes, SDK_Globals } from '@topconsultnpm/sdk-ts';
2
+ import { formatDateTimeByMetadataFormat } from '../helper';
3
+ /**
4
+ * Funzioni condivise dalle due sorgenti di TMDistinctValues (valori distinti e ricerca rapida):
5
+ * stanno fuori dagli hook perché non dipendono da alcuno stato.
6
+ */
7
+ // rowIndex è la chiave delle griglie di TMDistinctValues: va riallineato all'ordine finale delle righe
8
+ export const withRowIndex = (rows) => {
9
+ rows.forEach((row, index) => { row.rowIndex = index; });
10
+ return rows;
11
+ };
12
+ export const toGridDataType = (dataType) => {
13
+ switch (dataType) {
14
+ case DataColumnTypes.DateTime: return 'datetime';
15
+ case DataColumnTypes.Bool: return 'boolean';
16
+ case DataColumnTypes.Number: return 'number';
17
+ default: return 'string';
18
+ }
19
+ };
20
+ // Nome del metadato con cui viene intestata la colonna, nella lingua scelta dall'utente
21
+ export const getMetadataName = (columnMd) => (SDK_Globals.useLocalizedName ? columnMd?.nameLoc : columnMd?.name) ?? columnMd?.name ?? columnMd?.nameLoc ?? undefined;
22
+ // Le date vanno mostrate con il formato definito sul metadato, come nel risultato di ricerca
23
+ export const getDateDisplayFormat = (format, formatCulture) => ({
24
+ // La griglia passa al formatter un oggetto Date già istanziato, ma il valore può arrivare anche come stringa
25
+ formatter: (value) => formatDateTimeByMetadataFormat(value instanceof Date ? value : new Date(value), format, formatCulture)
26
+ });
27
+ /**
28
+ * Risolve il MID della colonna di un risultato di ricerca: la proprietà estesa è la fonte principale,
29
+ * in mancanza resta l'allineamento posizionale tra selectMIDs e colonne del risultato.
30
+ */
31
+ export const getColumnMid = (column, selectMIDs, columnIndex) => Number(column?.extendedProperties?.['MID'] ?? 0) || (selectMIDs?.[columnIndex] ?? 0);
@@ -0,0 +1,39 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { MetadataValueDescriptorEx } from '../ts';
3
+ /** Modalità "aggiungi a elenco": il form non archivia a sistema, restituisce i metadati al chiamante (TMMultiMasterDetailDcmts). */
4
+ export interface ArchiveListMode {
5
+ /** true quando si modifica una riga già presente nell'elenco ("Modifica" al posto di "Aggiungi"). */
6
+ isEditingRow: boolean;
7
+ /** Restituisce metadati e file al chiamante, che aggiunge o aggiorna la riga nell'elenco (senza archiviare). */
8
+ onUpsertRow: (metadataValues: Array<MetadataValueDescriptorEx>, file: File | undefined, tid?: number) => void;
9
+ }
10
+ interface UseArchiveListFormParams {
11
+ /** Assente = modalità "aggiungi a elenco" spenta. */
12
+ mode?: ArchiveListMode;
13
+ /** Valori della riga in modifica, con cui pre-compilare il form. */
14
+ editingRowValues?: Array<{
15
+ mid: number;
16
+ value: string;
17
+ }>;
18
+ /** Template vuoto del form. */
19
+ formDataOrig: Array<MetadataValueDescriptorEx>;
20
+ /** Ref ai valori correnti del form (per leggerli al submit senza stale closure). */
21
+ formDataRef: MutableRefObject<Array<MetadataValueDescriptorEx>>;
22
+ /** Ref al file caricato. */
23
+ dcmtFileRef: MutableRefObject<File | null>;
24
+ tid?: number;
25
+ isModal?: boolean;
26
+ /** Id del form, usato come parentId del message box quando è in modale. */
27
+ id?: string;
28
+ /** Svuota il form dopo aver restituito i valori. */
29
+ clearForm: () => void;
30
+ }
31
+ /** Isola la logica della modalità "aggiungi a elenco": valori di riferimento, submit e chiusura del form. */
32
+ export declare const useArchiveListForm: ({ mode, editingRowValues, formDataOrig, formDataRef, dcmtFileRef, tid, isModal, id, clearForm, }: UseArchiveListFormParams) => {
33
+ enabled: boolean;
34
+ isEditingRow: boolean;
35
+ referenceValues: MetadataValueDescriptorEx[];
36
+ submit: () => void;
37
+ requestClose: (isModified: boolean, onClose?: () => void) => boolean;
38
+ };
39
+ export {};