@topconsultnpm/sdkui-react 6.19.0-dev2.16 → 6.19.0-dev2.17

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.
@@ -8,6 +8,7 @@ const IframeContainer = styled.div `
8
8
  display: flex;
9
9
  height: 100%;
10
10
  flex-direction: column;
11
+ padding-left: 15px;
11
12
  `;
12
13
  const StyledIframe = styled.iframe `
13
14
  border: none;
@@ -36,7 +37,6 @@ const TMCustomButton = (props) => {
36
37
  const mergedAttributes = { ...attributes, selectedItems: selectedItems };
37
38
  iframeRef.current.contentWindow.postMessage({
38
39
  "options": mergedAttributes,
39
- "selectedItems": selectedItems,
40
40
  "session": SDK_Globals.tmSession
41
41
  }, getTargetOrigin(scriptUrl));
42
42
  }
@@ -58,6 +58,6 @@ const TMCustomButton = (props) => {
58
58
  onClose?.();
59
59
  }
60
60
  }, [isModal, scriptUrl, onClose]);
61
- return isModal ? (_jsx(TMModal, { title: button.title, width: '60%', height: '60%', resizable: true, onClose: onClose, children: _jsxs(IframeContainer, { children: [error && _jsx("div", { children: "Si \u00E8 verificato un errore nel caricamento del contenuto." }), !error && _jsx(StyledIframe, { ref: iframeRef, loading: 'lazy', onLoad: handleLoad, onError: handleError, src: scriptUrl })] }) })) : null;
61
+ return isModal ? (_jsx(TMModal, { title: button.title, width: '60%', height: '70%', resizable: true, onClose: onClose, children: _jsxs(IframeContainer, { children: [error && _jsx("div", { children: "Si \u00E8 verificato un errore nel caricamento del contenuto." }), !error && _jsx(StyledIframe, { ref: iframeRef, loading: 'lazy', onLoad: handleLoad, onError: handleError, src: scriptUrl })] }) })) : null;
62
62
  };
63
63
  export default TMCustomButton;
@@ -64,7 +64,7 @@ const TMDataGridExportForm = (props) => {
64
64
  // Retrieve columns from the search result, or use an empty array if not available
65
65
  const columns = searchResult?.dtdResult?.columns ?? [];
66
66
  // If exportDescriptionsForDataLists is true, build a map of values to labels for the columns; otherwise use an empty Map
67
- const { valueToNameMap, captions } = exportDescriptionsForDataLists ? await buildValueToLabelMapFromDataColumns(columns) : { valueToNameMap: new Map(), captions: new Set() };
67
+ const valueToNameMap = exportDescriptionsForDataLists ? await buildValueToLabelMapFromDataColumns(columns) : new Map();
68
68
  // Create a Set from selectedRowKeys for efficient lookup
69
69
  const selectedSet = new Set(selectedRowKeys);
70
70
  // If exporting only selected rows, filter the dataSource accordingly; otherwise use the full dataSource
@@ -82,8 +82,14 @@ const TMDataGridExportForm = (props) => {
82
82
  const getValue = (col, value) => {
83
83
  // Replace raw value with corresponding label from the map if applicable
84
84
  let result = value;
85
- if (exportDescriptionsForDataLists && col.caption && captions.has(col.caption.toString())) {
86
- result = valueToNameMap.get(value) ?? value;
85
+ if (exportDescriptionsForDataLists && col.dataField && valueToNameMap.size > 0) {
86
+ const mapForField = valueToNameMap.get(col.dataField);
87
+ if (mapForField) {
88
+ result = mapForField.get(value) ?? value;
89
+ }
90
+ else {
91
+ result = value;
92
+ }
87
93
  }
88
94
  // If the column is a datetime type, attempt to format it as a locale date string
89
95
  if (col.dataType === 'datetime' && result) {
@@ -8,7 +8,7 @@ import { DownloadTypes, FormModes } from '../../../ts';
8
8
  import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
9
9
  import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
10
10
  import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
11
- import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, svgToString, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare, IconCheck, IconActivity } from '../../../helper';
11
+ import { genUniqueId, IconShow, SDKUI_Localizator, updateMruTids, IconBoard, IconDcmtTypeSys, IconDetailDcmts, svgToString, IconDownload, calcIsModified, IconMenuVertical, Globalization, getListMaxItems, getSystemMetadata, IconBoxArchiveIn, IconClear, IconUndo, SDKUI_Globals, IconPreview, isTaskMoreInfo, IconWorkflow, IconSearch, deepCompare, IconCheck, IconActivity, TMImageLibrary } from '../../../helper';
12
12
  import { hasDetailRelations, hasMasterRelations, isXMLFileExt } from '../../../helper/dcmtsHelper';
13
13
  import { Gutters, TMColors } from '../../../utils/theme';
14
14
  import { StyledFormButtonsContainer, StyledLoadingContainer, StyledModalContainer, StyledReferenceButton, StyledSpinner, StyledToolbarCardContainer } from '../../base/Styled';
@@ -480,6 +480,7 @@ const TMDcmtForm = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTa
480
480
  const customButtonsItems = customButtonsLayout.customButtons
481
481
  .filter((customButton) => customButton.isForUpdate && customButton.isForUpdate > 0)
482
482
  .map((customButton) => ({
483
+ icon: svgToString(TMImageLibrary({ imageID: customButton.glyphID, showPath: true })),
483
484
  text: customButton.title || 'Bottone personalizzato',
484
485
  onClick: () => setCustomButton(customButton)
485
486
  }));
@@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, MetadataFormats, LayoutModes, TemplateTIDs, DcmtTypeListCacheService, AccessLevels, SystemMIDsAsNumber, RetrieveFileOptions, DcmtOpers, GeneralRetrieveFormats, AccessLevelsEx, ResultTypes, LayoutCacheService } from '@topconsultnpm/sdk-ts';
4
4
  import styled from 'styled-components';
5
5
  import { getCommandsMenuItems, getSelectedDcmtsOrFocused } from './TMSearchResultsMenuItems';
6
- import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, IconDetailDcmts, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, IconDownload, deepCompare, getDataColumnName, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, IconSearchCheck, TMCommandsContextMenu, getExceptionMessage, IconCheck, svgToString } from '../../../helper';
6
+ import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, IconDetailDcmts, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, IconDownload, deepCompare, getDataColumnName, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, IconSearchCheck, TMCommandsContextMenu, getExceptionMessage, IconCheck, svgToString, TMImageLibrary } from '../../../helper';
7
7
  import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
8
8
  import { useInputAttachmentsDialog, useInputCvtFormatDialog } from '../../../hooks/useInputDialog';
9
9
  import { useRelatedDocuments } from '../../../hooks/useRelatedDocuments';
@@ -309,7 +309,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
309
309
  const customButtonMenuItems = () => {
310
310
  const customButtonsItems = customButtonsLayout?.customButtons?.filter((customButton) => customButton.isForSearchResult && customButton.isForSearchResult > 0)
311
311
  .map((customButton) => ({
312
- icon: svgToString(_jsx(IconCheck, {})),
312
+ icon: svgToString(TMImageLibrary({ imageID: customButton.glyphID, showPath: true })),
313
313
  text: customButton.title || 'Bottone personalizzato',
314
314
  onClick: () => setCustomButton(customButton)
315
315
  }));
@@ -595,7 +595,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
595
595
  setShowReAssignPopup(true);
596
596
  }, onMoreInfo: () => {
597
597
  setShowMoreInfoPopup(true);
598
- }, approveDisable: selectedDocs.length === 0, signApproveDisable: disableSignApproveDisable, rejectDisable: selectedDocs.length === 0, reassignDisable: selectedDocs.length === 0, infoDisable: selectedDocs.length !== 1, dtd: fromDTD }) }) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {}), customButton && _jsx(TMCustomButton, { button: customButton, formData: currentMetadataValues, selectedItems: [], onClose: () => setCustomButton(undefined) }), showRelatedDcmtsChooser &&
598
+ }, approveDisable: selectedDocs.length === 0, signApproveDisable: disableSignApproveDisable, rejectDisable: selectedDocs.length === 0, reassignDisable: selectedDocs.length === 0, infoDisable: selectedDocs.length !== 1, dtd: fromDTD }) }) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {}), customButton && _jsx(TMCustomButton, { button: customButton, formData: currentMetadataValues, selectedItems: selectedItems, onClose: () => setCustomButton(undefined) }), showRelatedDcmtsChooser &&
599
599
  _jsx(TMChooserForm, { dataSource: relatedDcmtsChooserDataSource, onChoose: async (selectedRelation) => {
600
600
  try {
601
601
  setShowRelatedDcmtsChooser(false);
@@ -6,10 +6,7 @@ export interface RowData {
6
6
  [key: string]: string | number | null;
7
7
  }
8
8
  export declare const associateColumnsToRows: (columns: Array<DataColumnDescriptor> | undefined, rows: Array<Array<string>> | undefined) => Array<RowData>;
9
- export declare const buildValueToLabelMapFromDataColumns: (columns: Array<DataColumnDescriptor>) => Promise<{
10
- valueToNameMap: Map<string, string>;
11
- captions: Set<string>;
12
- }>;
9
+ export declare const buildValueToLabelMapFromDataColumns: (columns: Array<DataColumnDescriptor>) => Promise<Map<string, Map<string, string>>>;
13
10
  export declare const getAvatarColor: (name: string) => string;
14
11
  export declare const extractInitialsFromName: (name: string) => string;
15
12
  export declare const SIGN4_TOP_WIDGET_ID = "60003";
@@ -119,23 +119,27 @@ export const associateColumnsToRows = (columns, rows) => {
119
119
  };
120
120
  export const buildValueToLabelMapFromDataColumns = async (columns) => {
121
121
  const valueToNameMap = new Map();
122
- const captions = new Set();
123
- for (const col of columns) {
124
- const dataDomain = MetadataDataDomains[(col.extendedProperties?.["DataDomain"] ?? "None")];
122
+ const dataListColumns = columns.filter(col => {
123
+ const dataDomainRaw = col.extendedProperties?.["DataDomain"];
124
+ const dataDomain = MetadataDataDomains[(dataDomainRaw ?? "None")];
125
+ return dataDomain === MetadataDataDomains.DataList;
126
+ });
127
+ for (const col of dataListColumns) {
128
+ const tid = Number(col.extendedProperties?.["TID"]);
129
+ const mid = Number(col.extendedProperties?.["MID"]);
125
130
  const dataListID = Number(col.extendedProperties?.["DataListID"]);
126
- if (dataDomain === MetadataDataDomains.DataList) {
127
- if (col.caption) {
128
- captions.add(col.caption);
129
- }
131
+ if (tid && mid && dataListID) {
132
+ const tid_mid = `${tid}_${mid}`;
133
+ valueToNameMap.set(tid_mid, new Map());
130
134
  const dl = await DataListCacheService.GetAsync(dataListID);
131
135
  dl?.items?.forEach((item) => {
132
136
  if (item?.name !== undefined && item?.value !== undefined) {
133
- valueToNameMap.set(item.value, item.name);
137
+ valueToNameMap.get(tid_mid)?.set(item.value, item.name);
134
138
  }
135
139
  });
136
140
  }
137
141
  }
138
- return { valueToNameMap, captions };
142
+ return valueToNameMap;
139
143
  };
140
144
  export const getAvatarColor = (name) => {
141
145
  const colors = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.19.0-dev2.16",
3
+ "version": "6.19.0-dev2.17",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",