@topconsultnpm/sdkui-react 6.19.0-dev2.41 → 6.19.0-dev2.42

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.
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { SDK_Globals } from '@topconsultnpm/sdk-ts';
2
3
  import { useEffect, useRef, useState, useMemo } from 'react';
3
4
  import TMModal from './TMModal';
4
5
  import styled from 'styled-components';
5
6
  import { TMLayoutWaitingContainer } from '../..';
6
- import { processButtonAttributes } from '../../helper/dcmtsHelper';
7
+ import { processButtonAttributes, processSelectedItems } from '../../helper/dcmtsHelper';
7
8
  const IframeContainer = styled.div `
8
9
  display: flex;
9
10
  height: 100%;
@@ -18,9 +19,8 @@ const TMCustomButton = (props) => {
18
19
  const { button, isModal = true, formData, selectedItems, onClose } = props;
19
20
  const { appName: scriptUrl, arguments: args } = button;
20
21
  const iframeRef = useRef(null);
21
- const attributes = useMemo(() => processButtonAttributes(args, formData, selectedItems), [args, formData, selectedItems]);
22
- const selectedItemsProcessed = []; //da eliminare
23
- //const selectedItemsProcessed = useMemo(() => processSelectedItems(args, formData, selectedItems), [args, formData, selectedItems]);
22
+ const attributes = useMemo(() => processButtonAttributes(args, formData), [args, formData]);
23
+ const selectedItemsProcessed = useMemo(() => processSelectedItems(args, formData, selectedItems), [args, formData, selectedItems]);
24
24
  const RunOnce = button.mode === "RunOnce";
25
25
  const [loading, setLoading] = useState(true);
26
26
  const [error, setError] = useState(false);
@@ -61,7 +61,10 @@ const TMCustomButton = (props) => {
61
61
  const checkIframe = setInterval(() => {
62
62
  if (iframeRef.current?.contentWindow) {
63
63
  clearInterval(checkIframe);
64
- iframeRef.current.contentWindow.postMessage({ "options": item }, targetOrigin);
64
+ iframeRef.current.contentWindow.postMessage({
65
+ "options": item,
66
+ "session": SDK_Globals.tmSession
67
+ }, targetOrigin);
65
68
  // Attendi prima di passare al prossimo
66
69
  setTimeout(() => {
67
70
  setWaitPanelValue(index + 1);
@@ -92,7 +95,11 @@ const TMCustomButton = (props) => {
92
95
  }
93
96
  else if (iframeRef.current?.contentWindow) {
94
97
  // Modalità RunOnce: invia dati all'iframe quando è caricato
95
- iframeRef.current.contentWindow.postMessage({ "options": attributes }, targetOrigin);
98
+ const mergedAttributes = { ...attributes, selectedItems: selectedItemsProcessed };
99
+ iframeRef.current.contentWindow.postMessage({
100
+ "options": mergedAttributes,
101
+ "session": SDK_Globals.tmSession
102
+ }, targetOrigin);
96
103
  //clearTimeout(timeoutIframe);
97
104
  }
98
105
  }, [loading, error, RunOnce]);
@@ -96,6 +96,6 @@ const TMFileManagerDataGridView = (props) => {
96
96
  { dataField: "creationTime", caption: SDKUI_Localizator.CreationTime, dataType: 'datetime', format: 'dd/MM/yyyy HH:mm', cellRender: cellDatetimeRender },
97
97
  ];
98
98
  }, [searchText]);
99
- return _jsx(TMDataGrid, { dataSource: items ?? [], dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onCellDblClick: onCellDblClick, onContextMenuPreparing: onContextMenuPreparing, showSearchPanel: false, noDataText: SDKUI_Localizator.FolderIsEmpty }, items.length);
99
+ return _jsx(TMDataGrid, { dataSource: items ?? [], dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onCellDblClick: onCellDblClick, onContextMenuPreparing: onContextMenuPreparing, showSearchPanel: false, noDataText: SDKUI_Localizator.FolderIsEmpty });
100
100
  };
101
101
  export default TMFileManagerDataGridView;
@@ -11,7 +11,6 @@ interface ITMModal {
11
11
  onClose?: () => void;
12
12
  hidePopup?: boolean;
13
13
  askClosingConfirm?: boolean;
14
- showCloseButton?: boolean;
15
14
  }
16
15
  declare const TMModal: React.FC<ITMModal>;
17
16
  export default TMModal;
@@ -38,7 +38,7 @@ const StyledModalContext = styled.div `
38
38
  overflow: auto;
39
39
  height: 100%;
40
40
  `;
41
- const TMModal = ({ resizable = true, isModal = true, title = '', toolbar, onClose, children, width = '100%', height = '100%', fontSize = FontSize.defaultFontSize, hidePopup = true, askClosingConfirm = false, showCloseButton = true }) => {
41
+ const TMModal = ({ resizable = true, isModal = true, title = '', toolbar, onClose, children, width = '100%', height = '100%', fontSize = FontSize.defaultFontSize, hidePopup = true, askClosingConfirm = false }) => {
42
42
  const [initialWidth, setInitialWidth] = useState(width);
43
43
  const [initialHeight, setInitialHeight] = useState(height);
44
44
  const [showPopup, setShowPopup] = useState(false);
@@ -65,6 +65,6 @@ const TMModal = ({ resizable = true, isModal = true, title = '', toolbar, onClos
65
65
  setShowPopup(false);
66
66
  onClose && onClose();
67
67
  };
68
- return (_jsx(_Fragment, { children: isModal ? (_jsx(Popup, { showCloseButton: showCloseButton, animation: undefined, maxHeight: '95%', maxWidth: '95%', dragEnabled: !isResizing, resizeEnabled: resizable, width: initialWidth, height: initialHeight, title: title, visible: showPopup, onResizeStart: handleResizeStart, onResizeEnd: handleResizeEnd, onHiding: onHiding, children: _jsxs(TMLayoutContainer, { children: [toolbar && (_jsx(TMLayoutItem, { height: "40px", children: _jsx(StyledModalToolbar, { children: toolbar }) })), _jsx(TMLayoutItem, { height: toolbar ? 'calc(100% - 50px)' : 'calc(100% - 10px)', children: _jsx(TMCard, { showBorder: false, padding: false, scrollY: true, children: children }) })] }) })) : (_jsxs(StyledModal, { "$isModal": isModal, className: "temp-modal", "$fontSize": fontSize, "$width": initialWidth, "$height": initialHeight, children: [toolbar ? _jsx(StyledModalToolbar, { children: toolbar }) : _jsx(_Fragment, {}), _jsx(StyledModalContext, { children: children })] })) }));
68
+ return (_jsx(_Fragment, { children: isModal ? (_jsx(Popup, { showCloseButton: true, animation: undefined, maxHeight: '95%', maxWidth: '95%', dragEnabled: !isResizing, resizeEnabled: resizable, width: initialWidth, height: initialHeight, title: title, visible: showPopup, onResizeStart: handleResizeStart, onResizeEnd: handleResizeEnd, onHiding: onHiding, children: _jsxs(TMLayoutContainer, { children: [toolbar && (_jsx(TMLayoutItem, { height: "40px", children: _jsx(StyledModalToolbar, { children: toolbar }) })), _jsx(TMLayoutItem, { height: toolbar ? 'calc(100% - 50px)' : 'calc(100% - 10px)', children: _jsx(TMCard, { showBorder: false, padding: false, scrollY: true, children: children }) })] }) })) : (_jsxs(StyledModal, { "$isModal": isModal, className: "temp-modal", "$fontSize": fontSize, "$width": initialWidth, "$height": initialHeight, children: [toolbar ? _jsx(StyledModalToolbar, { children: toolbar }) : _jsx(_Fragment, {}), _jsx(StyledModalContext, { children: children })] })) }));
69
69
  };
70
70
  export default TMModal;
@@ -6,14 +6,12 @@ interface TMBlogCommentFormProps {
6
6
  participants: Array<UserDescriptor>;
7
7
  onClose: () => void;
8
8
  showAttachmentsSection?: boolean;
9
- removeAndEditAttachment?: boolean;
10
9
  selectedAttachments?: Array<FileItem>;
11
10
  selectedAttachmentDid?: Array<number>;
12
11
  allFileItems?: FileItem;
13
12
  allArchivedDocumentsFileItems?: Array<FileItem>;
14
13
  onFilterCreated?: (predicate: (post: BlogPost) => boolean) => void;
15
14
  refreshCallback?: () => Promise<void>;
16
- isCommentRequired?: boolean;
17
15
  }
18
16
  declare const TMBlogCommentForm: (props: TMBlogCommentFormProps) => import("react/jsx-runtime").JSX.Element;
19
17
  export default TMBlogCommentForm;
@@ -29,7 +29,7 @@ const getNonDirectoryFiles = (items, exclude) => {
29
29
  };
30
30
  const TMBlogCommentForm = (props) => {
31
31
  const maxLength = 1000;
32
- const { participants, selectedAttachments, selectedAttachmentDid, allFileItems, allArchivedDocumentsFileItems = [], onClose, context, showAttachmentsSection = true, removeAndEditAttachment = true, onFilterCreated, refreshCallback, isCommentRequired = false } = props;
32
+ const { participants, selectedAttachments, selectedAttachmentDid, allFileItems, allArchivedDocumentsFileItems = [], onClose, context, showAttachmentsSection = true, onFilterCreated, refreshCallback } = props;
33
33
  // Initialize state with combined array
34
34
  const [dataSource, setDataSource] = useState(() => [...getNonDirectoryFiles(allFileItems?.items || [], []), ...allArchivedDocumentsFileItems]);
35
35
  const [isEditorEnabled, setIsEditorEnabled] = useState(true);
@@ -216,20 +216,8 @@ const TMBlogCommentForm = (props) => {
216
216
  // Update the state with selected draft items
217
217
  setCurrentDraftAttachments(selectedDraftItems);
218
218
  };
219
- return _jsx(TMSaveForm, { id: 1, title: SDKUI_Localizator.AddNewComment, showTitleFormMode: false, showErrorCount: false, customSaveButton: _jsx("i", { className: 'dx-icon-send' }), customTooltipSaveButton: SDKUI_Localizator.Send, showUndoButton: false, hasNavigation: false, skipIsModifiedCheck: true, isModal: true, width: calcResponsiveSizes(deviceType, '800px', '800px', '95%'), height: '550px', formMode: FormModes.Create, validationItems: validationItems, exception: exception, isModified: calcIsModified(formData, formDataOrig), onSaveAsync: onSaveAsync, onClose: onCloseCallback, showCloseButton: isCommentRequired ? false : true, customToolbarElements: _jsx("div", { style: { display: 'flex', gap: '2px' }, children: _jsx(TMButton, { btnStyle: "toolbar", icon: isEditorEnabled ? _jsx("i", { className: 'dx-icon-font' }) : _jsx("i", { className: 'dx-icon-background' }), caption: isEditorEnabled ? SDKUI_Localizator.HideFormattingOptions : SDKUI_Localizator.ShowFormattingOptions, onClick: toggleEditorMode }) }), children: _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsxs("div", { style: { width: "100%", height: showAttachmentsSection ? `calc(100% - 60px)` : '100%' }, children: [isCommentRequired && _jsx("div", { style: {
220
- padding: '10px',
221
- width: '100%',
222
- height: '30px',
223
- backgroundColor: '#e8f5e9',
224
- border: '1px solid #81c784',
225
- borderRadius: '4px',
226
- fontSize: '13px',
227
- marginBottom: '10px',
228
- color: '#2e7d32',
229
- display: 'flex',
230
- alignItems: 'center',
231
- }, children: SDKUI_Localizator.InsertCommentToCompleteOperation }), _jsx("div", { style: { width: "100%", height: isCommentRequired ? `calc(100% - 40px)` : '100%' }, children: _jsx(TMHtmlEditor, { width: '100%', height: '100%', isEditorEnabled: isEditorEnabled, validationItems: validationItems, onValueChanged: onValueChanged, mentionsConfig: mentionsConfig, autoFocus: true, maxLength: maxLength }) })] }), showAttachmentsSection && _jsxs("div", { style: { display: 'flex', alignItems: 'center', height: '60px', marginTop: '10px' }, children: [_jsx("div", { style: {
232
- width: `calc(100% - ${removeAndEditAttachment ? 60 : 0}px)`,
219
+ return _jsx(TMSaveForm, { id: 1, title: SDKUI_Localizator.AddNewComment, showTitleFormMode: false, showErrorCount: false, customSaveButton: _jsx("i", { className: 'dx-icon-send' }), customTooltipSaveButton: SDKUI_Localizator.Send, showUndoButton: false, hasNavigation: false, skipIsModifiedCheck: true, isModal: true, width: calcResponsiveSizes(deviceType, '800px', '800px', '95%'), height: '550px', formMode: FormModes.Create, validationItems: validationItems, exception: exception, isModified: calcIsModified(formData, formDataOrig), onSaveAsync: onSaveAsync, onClose: onCloseCallback, customToolbarElements: _jsx("div", { style: { display: 'flex', gap: '2px' }, children: _jsx(TMButton, { btnStyle: "toolbar", icon: isEditorEnabled ? _jsx("i", { className: 'dx-icon-font' }) : _jsx("i", { className: 'dx-icon-background' }), caption: isEditorEnabled ? SDKUI_Localizator.HideFormattingOptions : SDKUI_Localizator.ShowFormattingOptions, onClick: toggleEditorMode }) }), children: _jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsxs("div", { style: { width: "100%", height: "100%" }, children: [_jsx("div", { style: { width: "100%", height: showAttachmentsSection ? "calc(100% - 60px)" : "100%" }, children: _jsx(TMHtmlEditor, { width: '100%', height: '100%', isEditorEnabled: isEditorEnabled, validationItems: validationItems, onValueChanged: onValueChanged, mentionsConfig: mentionsConfig, autoFocus: true, maxLength: maxLength }) }), showAttachmentsSection && _jsxs("div", { style: { display: 'flex', alignItems: 'center', height: '60px', marginTop: '10px' }, children: [_jsx("div", { style: {
220
+ width: 'calc(100% - 60px)',
233
221
  overflowX: 'auto',
234
222
  whiteSpace: 'nowrap',
235
223
  height: '50px',
@@ -243,7 +231,7 @@ const TMBlogCommentForm = (props) => {
243
231
  const tooltipContent = (_jsxs("div", { style: { textAlign: 'left' }, children: [_jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Name, ":"] }), " ", draft.name ?? '-'] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Author, ":"] }), " ", draft.updaterName ?? '-'] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Version, ":"] }), " ", draft.version] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Size, ":"] }), " ", formatBytes(draft.size ?? 0)] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.CreationTime, ":"] }), " ", Globalization.getDateTimeDisplayValue(draft.creationTime)] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.LastUpdateTime, ":"] }), " ", Globalization.getDateTimeDisplayValue(draft.lastUpdateTime)] })] }));
244
232
  return _jsxs("div", { style: {
245
233
  display: 'inline-flex',
246
- alignItems: 'center',
234
+ alignItems: 'center', // <-- this centers content vertically
247
235
  padding: '4px 8px',
248
236
  margin: '4px',
249
237
  border: '1px solid #ddd',
@@ -270,7 +258,7 @@ const TMBlogCommentForm = (props) => {
270
258
  fontWeight: 'bold',
271
259
  marginRight: '8px',
272
260
  boxShadow: '1px 1px 2px #00000020',
273
- }, children: _jsx(TMTooltip, { content: SDKUI_Localizator.Version, children: draft.version }) })), removeAndEditAttachment && _jsx(TMTooltip, { content: SDKUI_Localizator.RemoveAttachment, children: _jsx("span", { onClick: () => removeAttachment(draft), style: {
261
+ }, children: _jsx(TMTooltip, { content: SDKUI_Localizator.Version, children: draft.version }) })), _jsx(TMTooltip, { content: SDKUI_Localizator.RemoveAttachment, children: _jsx("span", { onClick: () => removeAttachment(draft), style: {
274
262
  display: 'inline-flex',
275
263
  width: '20px',
276
264
  height: '20px',
@@ -282,7 +270,7 @@ const TMBlogCommentForm = (props) => {
282
270
  cursor: 'pointer',
283
271
  boxShadow: '1px 1px 2px #00000020',
284
272
  }, children: _jsx("span", { style: { fontSize: '15px' }, children: "\u00D7" }) }) })] }, draft.did);
285
- })) : (_jsx("div", { style: { color: '#999', width: '100%', textAlign: 'center' }, children: SDKUI_Localizator.NoAttachments })) }), removeAndEditAttachment && _jsx(TMTooltip, { content: SDKUI_Localizator.Attachments + ": " + currentDraftAttachments.length, children: _jsxs("div", { style: { position: 'relative', display: 'inline-block' }, children: [_jsx("i", { className: "dx-icon-attach", style: {
273
+ })) : (_jsx("div", { style: { color: '#999', width: '100%', textAlign: 'center' }, children: SDKUI_Localizator.NoAttachments })) }), _jsx(TMTooltip, { content: SDKUI_Localizator.Attachments + ": " + currentDraftAttachments.length, children: _jsxs("div", { style: { position: 'relative', display: 'inline-block' }, children: [_jsx("i", { className: "dx-icon-attach", style: {
286
274
  width: '50px',
287
275
  height: '50px',
288
276
  marginLeft: '10px',
@@ -11,7 +11,7 @@ import { TMColors } from '../../utils/theme';
11
11
  import TMValidationItemsList from '../grids/TMValidationItemsList';
12
12
  import TMModal from '../base/TMModal';
13
13
  import { DeviceType, useDeviceType } from '../base/TMDeviceProvider';
14
- const TMSaveForm = ({ id, formMode = FormModes.Update, showToolbar = true, skipIsModifiedCheck = false, title, children, isModal, exception, customToolbarElements, hasNavigation, showSaveButton = true, customSaveButton, customTooltipSaveButton, showBackButton, showWarningsCount = true, showErrorCount = true, showUndoButton = true, onClose, onSaveAsync, onNext, onPrev, canNext, canPrev, isModified, onShowList, validationItems = [], onUndo, onCancel, width, height, askClosingConfirm = false, showTitleFormMode = true, showCloseButton = true }) => {
14
+ const TMSaveForm = ({ id, formMode = FormModes.Update, showToolbar = true, skipIsModifiedCheck = false, title, children, isModal, exception, customToolbarElements, hasNavigation, showSaveButton = true, customSaveButton, customTooltipSaveButton, showBackButton, showWarningsCount = true, showErrorCount = true, showUndoButton = true, onClose, onSaveAsync, onNext, onPrev, canNext, canPrev, isModified, onShowList, validationItems = [], onUndo, onCancel, width, height, askClosingConfirm = false, showTitleFormMode = true }) => {
15
15
  const [showList, setShowList] = useState(true);
16
16
  const [showErrorGrid, setShowErrorGrid] = useState(false);
17
17
  const deviceType = useDeviceType();
@@ -110,7 +110,7 @@ const TMSaveForm = ({ id, formMode = FormModes.Update, showToolbar = true, skipI
110
110
  _jsx("div", { style: { width: '100%', height: '100%', marginTop: '50px', display: 'flex', alignItems: 'center', justifyContent: 'center', flexDirection: 'column', color: getColor('error') }, children: 'Si è verificato un errore' })
111
111
  : _jsx(_Fragment, { children: children }) }), showErrorGrid && validationItems.length > 0 ? _jsx(TMCard, { scrollY: true, padding: false, showBorder: false, children: _jsx(TMValidationItemsList, { validationItems: validationItems }) }) : _jsx(_Fragment, {})] }) }), (isModal && onClose) && _jsx("div", { id: "TMSaveFormShowConfirmForClose-" + id })] }));
112
112
  };
113
- return (_jsx(_Fragment, { children: (isModal && onClose) ? _jsx(_Fragment, { children: _jsx(TMModal, { title: `${title}${showTitleFormMode ? ` - ${LocalizeFormModes(formMode)}` : ''}`, onClose: doClose, width: width ?? '100%', height: height ?? '100%', hidePopup: false, askClosingConfirm: askClosingConfirm, showCloseButton: showCloseButton, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block' }, children: renderSaveForm() }) }) })
113
+ return (_jsx(_Fragment, { children: (isModal && onClose) ? _jsx(_Fragment, { children: _jsx(TMModal, { title: `${title}${showTitleFormMode ? ` - ${LocalizeFormModes(formMode)}` : ''}`, onClose: doClose, width: width ?? '100%', height: height ?? '100%', hidePopup: false, askClosingConfirm: askClosingConfirm, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block' }, children: renderSaveForm() }) }) })
114
114
  : renderSaveForm() }));
115
115
  };
116
116
  export default TMSaveForm;
@@ -306,7 +306,6 @@ export declare class SDKUI_Localizator {
306
306
  static get IndexingInformation(): string;
307
307
  static get IndexOrReindex(): string;
308
308
  static get InProgress(): "Laufende" | "In Progress" | "En curso" | "En cours" | "Em andamento" | "In corso";
309
- static get InsertCommentToCompleteOperation(): string;
310
309
  static get InsertYourEmail(): "Geben Sie Ihre E-Mail ein" | "Insert your Email" | "Inserta tu Email" | "Insérez votre e-mail" | "Insira seu e-mail" | "Inserisci la tua email";
311
310
  static get InsertOTP(): "Geben Sie den OTP-Code ein" | "Insert OTP code" | "Insertar código OTP" | "Insérer le code OTP" | "Insira o código OTP" | "Inserisci il codice OTP";
312
311
  static get Interrupt(): "Unterbrechen" | "Interrupt" | "interrumpir" | "Interrompre" | "Interromper" | "Interrompere";
@@ -2989,16 +2989,6 @@ export class SDKUI_Localizator {
2989
2989
  default: return "In corso";
2990
2990
  }
2991
2991
  }
2992
- static get InsertCommentToCompleteOperation() {
2993
- switch (this._cultureID) {
2994
- case CultureIDs.De_DE: return "Geben Sie einen Kommentar ein, um den Vorgang abzuschließen.";
2995
- case CultureIDs.En_US: return "Enter a comment to complete the operation.";
2996
- case CultureIDs.Es_ES: return "Introduzca un comentario para completar la operación.";
2997
- case CultureIDs.Fr_FR: return "Saisissez un commentaire pour terminer l’opération.";
2998
- case CultureIDs.Pt_PT: return "Introduza um comentário para concluir a operação.";
2999
- default: return "Inserisci un commento per completare l’operazione.";
3000
- }
3001
- }
3002
2992
  static get InsertYourEmail() {
3003
2993
  switch (this._cultureID) {
3004
2994
  case CultureIDs.De_DE: return "Geben Sie Ihre E-Mail ein";
@@ -4,4 +4,5 @@ export declare const hasDetailRelations: (mTID: number | undefined) => Promise<b
4
4
  /** Check if dcmtType (mTID) has configured Master or Many-to-Many relations */
5
5
  export declare const hasMasterRelations: (mTID: number | undefined) => Promise<boolean>;
6
6
  export declare const isXMLFileExt: (fileExt: string | undefined) => boolean;
7
- export declare const processButtonAttributes: (args: string | undefined, formData: MetadataValueDescriptorEx[] | undefined, selectedItems: Array<any> | undefined) => Record<string, any> | undefined;
7
+ export declare const processButtonAttributes: (args: string | undefined, formData: MetadataValueDescriptorEx[] | undefined) => (string | null)[] | undefined;
8
+ export declare const processSelectedItems: (args: string | undefined, formData: MetadataValueDescriptorEx[] | undefined, selectedItems: Array<any> | undefined) => any[][];
@@ -1,4 +1,4 @@
1
- import { RelationCacheService, RelationTypes, SDK_Globals } from "@topconsultnpm/sdk-ts";
1
+ import { RelationCacheService, RelationTypes } from "@topconsultnpm/sdk-ts";
2
2
  /** Check if dcmtType (mTID) has configured Detail or Many-to-Many relations */
3
3
  export const hasDetailRelations = async (mTID) => {
4
4
  let allRelations = await RelationCacheService.GetAllAsync();
@@ -24,68 +24,27 @@ export const isXMLFileExt = (fileExt) => {
24
24
  }
25
25
  };
26
26
  /*utility functions for TMCustomButton*/
27
- export const processButtonAttributes = (args, formData, selectedItems) => args && formData ? formDataMap(formData, args, selectedItems) : undefined;
28
- const processSelectedItems = (selectedItems) => selectedItems && selectedItems.map(item => item["DID"]) || [];
29
- const formDataMap = (data, args, selectedItems) => {
30
- const session = SDK_Globals.tmSession;
31
- const sessionDescr = session?.SessionDescr;
32
- const result = {};
33
- // Regex per catturare: chiave=[{@campo} ...] o chiave={valore} o {@campo}
34
- const keyValueRegex = /(\w+)=\[([^\]]+)\]|(\w+)=\{([^}]+)\}|\{@([^}]+)\}/g;
35
- let match;
36
- while ((match = keyValueRegex.exec(args)) !== null) {
37
- if (match[1]) {
38
- // Formato: chiave=[{@campo} {@campo} ...]
39
- const key = match[1];
40
- const content = match[2];
41
- // Estrai tutti i {@campo} e concatenali
42
- const fields = content.match(/\{@([^}]+)\}/g) || [];
43
- const values = fields.map(field => {
44
- const fieldName = field.slice(2, -1);
45
- const md = data.find(md => md.md?.name === fieldName);
46
- return md?.value ?? '';
47
- }).filter(v => v);
48
- result[key] = values.join(' ');
49
- }
50
- else if (match[3]) {
51
- // Formato: chiave={valore}
52
- const key = match[3];
53
- const value = match[4];
54
- result[key] = value;
55
- }
56
- else if (match[5]) {
57
- // Formato: {@campo}
58
- const fieldName = match[5];
27
+ export const processButtonAttributes = (args, formData) => args && formData ? formDataMap(formData, args) : undefined;
28
+ export const processSelectedItems = (args, formData, selectedItems) => {
29
+ if (!args || !selectedItems)
30
+ return [];
31
+ const MidList = formData ? formDataMap(formData, args, true) : [];
32
+ return selectedItems.map(item =>
33
+ //salvo il did come primo elemento dell'array
34
+ [item["DID"], ...MidList.map(key => key && item[key])]);
35
+ };
36
+ const formDataMap = (data, args, returnMid = false) => {
37
+ const tokens = args.match(/\{@?[^}]+\}/g) || [];
38
+ return tokens.map(token => {
39
+ if (token.startsWith('{@')) {
40
+ // Campo dinamico: {@campo} -> cerca in formData
41
+ const fieldName = token.slice(2, -1);
59
42
  const md = data.find(md => md.md?.name === fieldName);
60
- switch (fieldName) {
61
- case 'SelectedDIDs':
62
- result[fieldName] = processSelectedItems(selectedItems);
63
- break;
64
- case 'AuthenticationMode':
65
- result[fieldName] = sessionDescr?.authenticationMode ?? null;
66
- break;
67
- case 'ArchiveID':
68
- result[fieldName] = sessionDescr?.archiveID ?? null;
69
- break;
70
- case 'CultureID':
71
- result[fieldName] = sessionDescr?.cultureID ?? null;
72
- break;
73
- case 'Domain':
74
- result[fieldName] = sessionDescr?.domain ?? null;
75
- break;
76
- case 'UserID':
77
- result[fieldName] = sessionDescr?.userID ?? null;
78
- break;
79
- case 'UserName':
80
- result[fieldName] = sessionDescr?.userName ?? null;
81
- break;
82
- case 'Session':
83
- result[fieldName] = session ?? null;
84
- break;
85
- default:
86
- result[fieldName] = md?.value;
87
- }
43
+ return returnMid ? (md ? `${md.tid}_${md.mid}` : null) : (md?.value ?? null);
88
44
  }
89
- }
90
- return result;
45
+ else {
46
+ // Campo statico: {valore} -> ritorna il valore o null
47
+ return returnMid ? null : token.slice(1, -1);
48
+ }
49
+ });
91
50
  };
package/lib/ts/types.d.ts CHANGED
@@ -173,7 +173,6 @@ export interface ITMSaveFormBaseProps {
173
173
  customTooltipSaveButton?: string;
174
174
  showBackButton?: boolean;
175
175
  showUndoButton?: boolean;
176
- showCloseButton?: boolean;
177
176
  showWarningsCount?: boolean;
178
177
  showErrorCount?: boolean;
179
178
  hasNavigation?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.19.0-dev2.41",
3
+ "version": "6.19.0-dev2.42",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",