@topconsultnpm/sdkui-react 6.19.0-dev2.21 → 6.19.0-dev2.22

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
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { SDK_Globals } from '@topconsultnpm/sdk-ts';
3
- import { useEffect, useRef, useState } from 'react';
3
+ import { useEffect, useRef, useState, useMemo } from 'react';
4
4
  import TMModal from './TMModal';
5
5
  import styled from 'styled-components';
6
- import { processButtonAttributes } from '../../helper/dcmtsHelper';
6
+ import { TMLayoutWaitingContainer } from '../..';
7
+ import { processButtonAttributes, processSelectedItems } from '../../helper/dcmtsHelper';
7
8
  const IframeContainer = styled.div `
8
9
  display: flex;
9
10
  height: 100%;
@@ -18,46 +19,98 @@ 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 = processButtonAttributes(args, formData);
22
+ const attributes = useMemo(() => processButtonAttributes(args, formData), [args, formData]);
23
+ const selectedItemsProcessed = useMemo(() => processSelectedItems(selectedItems), [selectedItems]);
24
+ const RunOnce = button.mode === "RunOnce";
22
25
  const [loading, setLoading] = useState(true);
23
26
  const [error, setError] = useState(false);
24
- const getTargetOrigin = (url) => {
25
- if (!url)
27
+ const selectedItemsCount = selectedItems?.length || 1;
28
+ // Stati per il wait panel
29
+ const [showWaitPanel, setShowWaitPanel] = useState(true);
30
+ const [waitPanelText, setWaitPanelText] = useState("Esecuzione azione 1/" + selectedItemsCount.toString());
31
+ const [waitPanelValue, setWaitPanelValue] = useState(0);
32
+ const [waitPanelMaxValue, setWaitPanelMaxValue] = useState(selectedItemsCount);
33
+ const [abortController, setAbortController] = useState(undefined);
34
+ const targetOrigin = useMemo(() => {
35
+ if (!scriptUrl)
26
36
  return '*';
27
37
  try {
28
- const urlObj = new URL(url);
38
+ const urlObj = new URL(scriptUrl);
29
39
  return urlObj.origin;
30
40
  }
31
41
  catch {
32
42
  return '*';
33
43
  }
44
+ }, [scriptUrl]);
45
+ const handleLoad = () => setLoading(false);
46
+ const handleError = () => {
47
+ setLoading(false);
48
+ setError(true);
49
+ };
50
+ const executeSequentially = async (controller) => {
51
+ if (!selectedItemsProcessed)
52
+ return;
53
+ const processedItems = selectedItemsProcessed.length === 0 ? [...selectedItemsProcessed, attributes] : selectedItemsProcessed;
54
+ for (const [index, item] of processedItems.entries()) {
55
+ if (controller.signal.aborted)
56
+ break;
57
+ setWaitPanelText("Esecuzione azione " + (index + 1).toString() + "/" + selectedItemsCount.toString());
58
+ setWaitPanelValue(index);
59
+ // Attendi che l'iframe sia pronto e invia il messaggio
60
+ await new Promise((resolve) => {
61
+ const checkIframe = setInterval(() => {
62
+ if (iframeRef.current?.contentWindow) {
63
+ clearInterval(checkIframe);
64
+ iframeRef.current.contentWindow.postMessage({
65
+ "options": item,
66
+ "session": SDK_Globals.tmSession
67
+ }, targetOrigin);
68
+ // Attendi prima di passare al prossimo
69
+ setTimeout(() => {
70
+ setWaitPanelValue(index + 1);
71
+ resolve();
72
+ }, 500);
73
+ }
74
+ }, 100);
75
+ });
76
+ }
77
+ setShowWaitPanel(false);
78
+ onClose?.();
34
79
  };
35
80
  useEffect(() => {
36
- if (iframeRef.current?.contentWindow) {
37
- const mergedAttributes = { ...attributes, selectedItems: selectedItems };
81
+ if (loading || error)
82
+ return;
83
+ //if(error) clearTimeout(timeoutIframe);
84
+ console.log("TMCustomButton - useEffect - loading:", loading, " error:", error, " RunOnce:", RunOnce);
85
+ if (!RunOnce) {
86
+ // esegui per ogni item selezionato
87
+ const controller = new AbortController();
88
+ controller.signal.addEventListener('abort', () => {
89
+ setShowWaitPanel(false);
90
+ onClose?.();
91
+ });
92
+ setAbortController(controller);
93
+ setWaitPanelMaxValue(selectedItemsCount);
94
+ executeSequentially(controller);
95
+ }
96
+ else if (iframeRef.current?.contentWindow) {
97
+ // Modalità RunOnce: invia dati all'iframe quando è caricato
98
+ const mergedAttributes = { ...attributes, selectedItems: selectedItemsProcessed };
38
99
  iframeRef.current.contentWindow.postMessage({
39
100
  "options": mergedAttributes,
40
101
  "session": SDK_Globals.tmSession
41
- }, getTargetOrigin(scriptUrl));
102
+ }, targetOrigin);
103
+ //clearTimeout(timeoutIframe);
42
104
  }
43
- clearTimeout(timeoutIframe);
44
- }, [loading, error, scriptUrl, attributes]);
45
- const handleLoad = () => setLoading(false);
46
- const handleError = () => {
47
- setLoading(false);
48
- setError(true);
49
- };
50
- // Timeout di sicurezza nel caso l'evento 'error' non venga chiamato
51
- const timeoutIframe = setTimeout(() => {
52
- if (loading)
53
- handleError();
54
- }, 5000); // 5 secondi
105
+ }, [loading, error, RunOnce]);
55
106
  useEffect(() => {
56
- if (!isModal && scriptUrl) {
107
+ if (!isModal && RunOnce && scriptUrl) {
57
108
  window.open(scriptUrl, '_blank');
58
109
  onClose?.();
59
110
  }
60
- }, [isModal, scriptUrl, onClose]);
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;
111
+ }, []);
112
+ const iframeContent = (_jsxs(IframeContainer, { style: !RunOnce ? { visibility: 'hidden' } : {}, 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 })] }));
113
+ return isModal && RunOnce ? (_jsx(TMModal, { title: button.title, width: '60%', height: '70%', resizable: true, onClose: onClose, children: iframeContent })) : !RunOnce && showWaitPanel ? (_jsxs(_Fragment, { children: [_jsx(TMLayoutWaitingContainer, { showWaitPanel: true, waitPanelTitle: "Operazione in corso", showWaitPanelPrimary: true, waitPanelTextPrimary: waitPanelText, waitPanelValuePrimary: waitPanelValue, waitPanelMaxValuePrimary: waitPanelMaxValue, showWaitPanelSecondary: false, isCancelable: true, abortController: abortController, children: undefined }), iframeContent] }))
114
+ : null;
62
115
  };
63
116
  export default TMCustomButton;
@@ -357,6 +357,7 @@ const TMTaskForm = (props) => {
357
357
  }, children: _jsx(TMTooltip, { content: formData.pdG !== PdGs.None ? gotoPDGExtendedLabel(true, formData.pdG, formData.iD1Name) : '', children: _jsxs("span", { onClick: () => formData.pdG !== PdGs.None ? gotoPDGExtendedLabelClickCallback() : null, style: {
358
358
  display: 'inline-flex',
359
359
  alignItems: 'center',
360
+ lineHeight: 1,
360
361
  padding: '6px 10px',
361
362
  borderRadius: 8,
362
363
  backgroundColor: formData.pdG !== PdGs.None ? '#f5f5f7' : 'transparent',
@@ -371,7 +372,7 @@ const TMTaskForm = (props) => {
371
372
  }, onMouseLeave: e => {
372
373
  if (formData.pdG !== PdGs.None)
373
374
  e.currentTarget.style.backgroundColor = '#f5f5f7';
374
- }, children: [getPdgsIconMap().get(formData.pdG), _jsx("span", { children: getOriginLabel(formData.pdG, formData.iD1Name) })] }) }) }) }) })), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.Name, value: formData?.name ?? '', readOnly: fieldsReadOnly.name, autoFocus: true, maxLength: 100, isModifiedWhen: formData?.name !== formDataOrig?.name, onValueChanged: (e) => { setFormData({ ...formData ?? {}, name: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Name) }) }) }), _jsx("div", { style: { width: '100%' }, children: _jsx(TMTextArea, { label: SDKUI_Localizator.Description, value: formData?.description ?? '', maxLength: 200, readOnly: fieldsReadOnly.description, isModifiedWhen: formData?.description !== formDataOrig?.description, onValueChanged: (e) => { setFormData({ ...formData ?? {}, description: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Description), resize: false }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: (formMode === FormModes.Create || !areDifferentIDs(formDataOrig?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID)) ?
375
+ }, children: [_jsx("span", { style: { display: 'flex', alignItems: 'center' }, children: getPdgsIconMap().get(formData.pdG) }), _jsx("span", { children: getOriginLabel(formData.pdG, formData.iD1Name) })] }) }) }) }) })), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: _jsx("div", { style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMTextBox, { label: SDKUI_Localizator.Name, value: formData?.name ?? '', readOnly: fieldsReadOnly.name, autoFocus: true, maxLength: 100, isModifiedWhen: formData?.name !== formDataOrig?.name, onValueChanged: (e) => { setFormData({ ...formData ?? {}, name: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Name) }) }) }), _jsx("div", { style: { width: '100%' }, children: _jsx(TMTextArea, { label: SDKUI_Localizator.Description, value: formData?.description ?? '', maxLength: 200, readOnly: fieldsReadOnly.description, isModifiedWhen: formData?.description !== formDataOrig?.description, onValueChanged: (e) => { setFormData({ ...formData ?? {}, description: e.target.value }); }, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.Description), resize: false }) }), _jsx(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: 'flex', flexDirection: 'row', width: '100%', gap: 10 }, children: children }), children: (formMode === FormModes.Create || !areDifferentIDs(formDataOrig?.fromID, SDK_Globals.tmSession?.SessionDescr?.userID)) ?
375
376
  _jsx("div", { id: "assignedToAnotherUserField", style: { width: isMobile ? '100%' : '50%' }, children: _jsx(TMUserChooser, { dataSource: usersList ?? undefined, allowMultipleSelection: false, label: SDKUI_Localizator.AssignedTo, readOnly: fieldsReadOnly.assignedTO, values: formData?.toID ? [formData?.toID] : [], isModifiedWhen: formData?.toID !== formDataOrig?.toID, validationItems: validationItems?.filter(o => o.PropertyName === SDKUI_Localizator.AssignedTo), onValueChanged: (newValue) => {
376
377
  if (newValue === undefined)
377
378
  return;
@@ -35,7 +35,28 @@ export const calculateNumberOfDays = (startTime, endTime) => {
35
35
  };
36
36
  export const renderTaskIcons = (taskData) => {
37
37
  const { stateLabel, stateTooltipLabel, pdg, ID1Name, endTime, remTime, isNew, numberOfDays } = taskData;
38
- return (_jsxs(_Fragment, { children: [_jsxs(TMTooltip, { content: stateTooltipLabel, children: [" ", _jsx("div", { children: taskStateIconMap().get(stateLabel) })] }), _jsxs(TMTooltip, { content: gotoPDGExtendedLabel(false, pdg ?? PdGs.None, ID1Name), children: [" ", _jsx("div", { children: getPdgsIconMap().get(pdg) })] }), (stateLabel !== Task_States.Completed && endTime && taskIsExpiringSoon(endTime, remTime)) && _jsx(TMTooltip, { content: SDKUI_Localizator.Expiring, children: _jsx("i", { style: { fontSize: "24px" }, className: "dx-icon-warning" }) }), numberOfDays > 1 && _jsx("i", { title: SDKUI_Localizator.ActivityOverMultipleDays.replaceParams(numberOfDays), style: { fontSize: 20 }, className: "dx-icon-unselectall" }), isNew && _jsx(TMTooltip, { content: SDKUI_Localizator.NewAssignedActivity, children: _jsx("i", { style: { fontSize: "24px" }, className: "dx-icon-bell" }) })] }));
38
+ return (_jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [_jsx(TMTooltip, { content: stateTooltipLabel, children: _jsx("div", { className: "task-icon", children: taskStateIconMap().get(stateLabel) }) }), (stateLabel !== Task_States.Completed && endTime && taskIsExpiringSoon(endTime, remTime)) &&
39
+ _jsx(TMTooltip, { content: SDKUI_Localizator.Expiring, children: _jsx("i", { className: "dx-icon-warning task-icon" }) }), _jsx(TMTooltip, { content: gotoPDGExtendedLabel(false, pdg ?? PdGs.None, ID1Name), children: _jsx("div", { className: "task-icon", style: {
40
+ marginLeft: pdg === PdGs.CF || pdg === PdGs.WG ? "-4px" : undefined,
41
+ marginRight: pdg === PdGs.CF || pdg === PdGs.WG ? "-4px" : undefined,
42
+ }, children: getPdgsIconMap().get(pdg) }) }), numberOfDays > 1 &&
43
+ _jsx(TMTooltip, { content: SDKUI_Localizator.ActivityOverMultipleDays.replaceParams(numberOfDays), children: _jsx("div", { className: "task-icon", style: {
44
+ display: "inline-flex",
45
+ alignItems: "center",
46
+ justifyContent: "center",
47
+ minWidth: "20px",
48
+ height: "20px",
49
+ padding: "0 4px",
50
+ borderRadius: "12px",
51
+ border: "1px solid #0078d4",
52
+ backgroundColor: "rgba(0, 120, 212, 0.08)",
53
+ color: "#0078d4",
54
+ fontSize: "11px",
55
+ fontWeight: 600,
56
+ lineHeight: 1,
57
+ boxSizing: "border-box"
58
+ }, children: numberOfDays > 99 ? "99+" : numberOfDays }) }), isNew &&
59
+ _jsx(TMTooltip, { content: SDKUI_Localizator.NewAssignedActivity, children: _jsx("i", { className: "dx-icon-bell task-icon" }) })] }));
39
60
  };
40
61
  export const TMActionCalendar = (props) => {
41
62
  const { currentTask, openTaskForm, onDeleteCallback } = props;
@@ -6,6 +6,7 @@ export declare enum DateDisplayTypes {
6
6
  }
7
7
  export declare class Globalization {
8
8
  static getDateTimeDisplayValue(value: Date | string | undefined, displayType?: DateDisplayTypes, metadataFormat?: MetadataFormats): string;
9
+ static getDateTimeDisplayValueCompact(value: Date | string | undefined, displayType?: DateDisplayTypes, metadataFormat?: MetadataFormats): string;
9
10
  static getDateDisplayFormat(displayType?: DateDisplayTypes): string;
10
11
  static getNumberDisplayValue(value: Number, withThousandsSeparator?: boolean, numberDisplayFormat?: string): string;
11
12
  static metadataFormatToDateDisplayFormat(format: MetadataFormats): "" | "MM/dd/yyyy" | "dd/MM/yyyy" | "EEEE dd MMMM yyyy" | "HH:mm" | "HH:mm:ss" | "MM/dd/yyyy HH:mm:ss" | "dd/MM/yyyy HH:mm:ss" | "MM/dd/yyyy HH:mm" | "dd/MM/yyyy HH:mm" | "EEEE dd MMMM yyyy HH:mm" | "EEEE dd MMMM yyyy HH:mm:ss";
@@ -29,6 +29,36 @@ export class Globalization {
29
29
  dateTime = dateTime.replace("ss", dt.getSeconds().toString().padStart(2, '0'));
30
30
  return dateTime;
31
31
  }
32
+ static getDateTimeDisplayValueCompact(value, displayType, metadataFormat) {
33
+ if (!value)
34
+ return "";
35
+ let dt = typeof value === "string" ? new Date(value) : value;
36
+ let dateDisplayFormat = metadataFormat ? this.metadataFormatToDateDisplayFormat(metadataFormat) : this.getDateDisplayFormat(displayType);
37
+ let dateTime = dateDisplayFormat;
38
+ dateTime = dateTime.replace("EEEE", dt.toLocaleString(navigator.language, { weekday: "long" }));
39
+ dateTime = dateTime.replace("dd", dt.toLocaleString(navigator.language, { day: "2-digit" }));
40
+ dateTime = dateTime.replace("MMMM", dt.toLocaleString(navigator.language, { month: "long" }));
41
+ dateTime = dateTime.replace("MM", dt.toLocaleString(navigator.language, { month: "2-digit" }));
42
+ dateTime = dateTime.replace("yyyy", dt.toLocaleString(navigator.language, { year: "numeric" }));
43
+ // gestione ore, minuti e secondi
44
+ const hh = dt.getHours().toString().padStart(2, '0');
45
+ const mm = dt.getMinutes().toString().padStart(2, '0');
46
+ const ss = dt.getSeconds().toString().padStart(2, '0');
47
+ if (hh === '00' && mm === '00' && ss === '00') {
48
+ // nessun tempo
49
+ dateTime = dateTime.replace(/HH:mm:ss/, '').trim();
50
+ }
51
+ else if (ss === '00') {
52
+ // togli solo i secondi
53
+ dateTime = dateTime.replace(/ss/, '').replace(/:$/, '');
54
+ dateTime = dateTime.replace("HH", hh).replace("mm", mm);
55
+ }
56
+ else {
57
+ // mantieni tutto
58
+ dateTime = dateTime.replace("HH", hh).replace("mm", mm).replace("ss", ss);
59
+ }
60
+ return dateTime;
61
+ }
32
62
  static getDateDisplayFormat(displayType = DateDisplayTypes.DateTime) {
33
63
  let timeFormat = "HH:mm:ss";
34
64
  if (displayType == DateDisplayTypes.Time)
@@ -271,4 +271,4 @@ export declare function IconPair(props: React.SVGProps<SVGSVGElement>): import("
271
271
  export declare function IconUnpair(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
272
272
  export declare function IconBackhandIndexPointingRight(props: Readonly<React.SVGProps<SVGSVGElement>>): import("react/jsx-runtime").JSX.Element;
273
273
  export declare function IconMoveToFolder(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
274
- export { Icon123, IconABC, IconAccessPoint, IconAddressBook, IconSignCert, IconServerService, IconActivity, IconActivityLog, IconAdd, IconAddCircleOutline, IconAll, IconApply, IconApplyAndClose, IconArchive, IconArchiveDoc, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconAtSign, IconAttachment, IconAutoConfig, IconBackward, IconBasket, IconBoard, IconBoxArchiveIn, IconBxInfo, IconBxLock, IconCalendar, IconCloseCircle, IconCloseOutline, IconCloud, IconCircleInfo, IconClear, IconColumns, IconCommand, IconCopy, IconCount, IconCrown, IconDashboard, IconDcmtType, IconDcmtTypeOnlyMetadata, IconDcmtTypeSys, IconDelete, IconDetails, IconDown, IconDownload, IconDotsVerticalCircleOutline, IconDuplicate, IconEdit, IconEqual, IconEqualNot, IconEraser, IconExpandRight, IconExport, IconFastBackward, IconFoldeAdd, IconFolderSearch, IconFolderZip, IconFastForward, IconFastSearch, IconFileDots, IconFilter, IconForceStop, IconForward, IconFreeze, IconFreeSearch, IconGreaterThan, IconGreaterThanOrEqual, IconHistory, IconImport, IconTag, IconInfo, IconInsertAbove, IconInsertBelow, IconHeart, IconHide, IconLanguage, IconLeft, IconLessThan, IconLessThanOrEqual, IconLock, IconLockClosed, IconLogin, IconLink, IconLogout, IconMail, IconMapping, IconMic, IconMenuHorizontal, IconMenuKebab, IconMenuVertical, IconMetadata, IconMetadata_Computed, IconMetadata_DataList, IconMetadata_Date, IconMetadata_DynamicDataList, IconMetadata_Numerator, IconMetadata_Numeric, IconMetadata_Special, IconMetadata_Text, IconMetadata_User, IconMonitor, IconOpenInNew, IconNotification, IconPassword, IconPencil, IconPlatform, IconPlay, IconPreview, IconPrinter, IconPrintOutline, IconProcess, IconProgressAbortRequested, IconProgressCompleted, IconProgressNotCompleted, IconProgressReady, IconProgressRunning, IconProgressStarted, IconRefresh, IconReset, IconRecentlyViewed, IconRight, IconSave, IconSearch, IconSelected, IconSettings, IconShow, IconSort, IconStop, IconStopwatch, IconSuccess, IconAlarmPlus, IconHourglass, IconNone, IconNotStarted, IconProgress, IconSuccessCirlce, IconSuitcase, IconSupport, IconUndo, IconUnFreeze, IconUp, IconUpdate, IconUpload, IconUser, IconUserProfile, IconVisible, IconWarning, IconWeb, IconWifi, IconWindowMaximize, IconWindowMinimize, IconWorkflow, IconWorkspace, IconUserGroup, IconUserGroupOutline, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconDraggabledots, IconRelation, IconEasy, IconSum, IconDisk, IconDataList, IconPalette, IconFormatPageSplit, IconPaste, IconFileSearch, IconStar, IconStarRemove, IconSearchCheck, IconLightningFill, IconArrowUnsorted, IconArrowSortedUp, IconArrowSortedDown, IconConvertFilePdf, IconExportTo, IconSharedDcmt, IconShare, IconBatchUpdate, IconCheckFile, IconStatistics, IconSubstFile, IconAdvanced, IconSync, IconSavedQuery, IconSignature, IconSignaturePencil, IconRecursiveOps, IconCheckIn, IconTree, IconGrid, IconList, IconFolder, IconFolderOpen, IconFactory, IconTest, IconCheck, IconUncheck, IconSortAsc, IconSortDesc, IconRoundFileUpload, IconSortAscLetters, IconSortDescLetters, IconRotate, IconSortAscNumbers, IconSortDescNumbers, IconSortAscClock, IconSortDescClock, IconLayerGroup, IconBell, IconBellCheck, IconBellOutline, IconBellCheckOutline, IconEnvelopeOpenText, IconChangeUser, IconUserCheck, IconRelationManyToMany, IconRelationOneToMany, IconUserExpired, IconKey, IconZoomInLinear, IconZoomOutLinear, IconMenuCAWorkingGroups, IconCADossier, IconMenuCACaseflow, IconMenuDashboard, IconMenuCAAreas, IconMenuTask, IconMenuSearch, IconMenuFullTextSearch, IconMenuFavourite, IconSAPLogin, IconSAPLogin2, IconView, };
274
+ export { Icon123, IconABC, IconAccessPoint, IconAddressBook, IconSignCert, IconServerService, IconActivity, IconActivityLog, IconAdd, IconAddCircleOutline, IconAll, IconApply, IconApplyAndClose, IconArchive, IconArchiveDoc, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconAtSign, IconAttachment, IconAutoConfig, IconBackward, IconBasket, IconBoard, IconBoxArchiveIn, IconBxInfo, IconBxLock, IconCalendar, IconCloseCircle, IconCloseOutline, IconCloud, IconCircleInfo, IconClear, IconColumns, IconCommand, IconCopy, IconCount, IconCrown, IconDashboard, IconDcmtType, IconDcmtTypeOnlyMetadata, IconDcmtTypeSys, IconDelete, IconDetails, IconDown, IconDownload, IconDotsVerticalCircleOutline, IconDuplicate, IconEdit, IconEqual, IconEqualNot, IconEraser, IconExpandRight, IconExport, IconFastBackward, IconFoldeAdd, IconFolderSearch, IconFolderZip, IconFastForward, IconFastSearch, IconFileDots, IconFilter, IconForceStop, IconForward, IconFreeze, IconFreeSearch, IconGreaterThan, IconGreaterThanOrEqual, IconHistory, IconImport, IconTag, IconInfo, IconInsertAbove, IconInsertBelow, IconHeart, IconHide, IconLanguage, IconLeft, IconLessThan, IconLessThanOrEqual, IconLock, IconLockClosed, IconLogin, IconLink, IconLogout, IconMail, IconMapping, IconMic, IconMenuHorizontal, IconMenuKebab, IconMenuVertical, IconMetadata, IconMetadata_Computed, IconMetadata_DataList, IconMetadata_Date, IconMetadata_DynamicDataList, IconMetadata_Numerator, IconMetadata_Numeric, IconMetadata_Special, IconMetadata_Text, IconMetadata_User, IconMonitor, IconOpenInNew, IconNotification, IconPassword, IconPencil, IconPlatform, IconPlay, IconPreview, IconPrinter, IconPrintOutline, IconProcess, IconProgressAbortRequested, IconProgressCompleted, IconProgressNotCompleted, IconProgressReady, IconProgressRunning, IconProgressStarted, IconRefresh, IconReset, IconRecentlyViewed, IconRight, IconSave, IconSearch, IconSelected, IconSettings, IconShow, IconSort, IconStop, IconStopwatch, IconSuccess, IconAlarmPlus, IconHourglass, IconNone, IconNotStarted, IconProgress, IconSuccessCirlce, IconSuitcase, IconSupport, IconUndo, IconUnFreeze, IconUp, IconUpdate, IconUpload, IconUser, IconUserProfile, IconVisible, IconWarning, IconWeb, IconWifi, IconWindowMaximize, IconWindowMinimize, IconWorkflow, IconWorkspace, IconUserGroup, IconUserGroupOutline, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconDraggabledots, IconRelation, IconEasy, IconSum, IconDisk, IconDataList, IconPalette, IconFormatPageSplit, IconPaste, IconFileSearch, IconStar, IconStarRemove, IconSearchCheck, IconLightningFill, IconArrowUnsorted, IconArrowSortedUp, IconArrowSortedDown, IconConvertFilePdf, IconExportTo, IconSharedDcmt, IconShare, IconBatchUpdate, IconCheckFile, IconStatistics, IconSubstFile, IconAdvanced, IconSync, IconSavedQuery, IconSignature, IconSignaturePencil, IconRecursiveOps, IconCheckIn, IconTree, IconGrid, IconList, IconFolder, IconFolderOpen, IconFactory, IconTest, IconCheck, IconUncheck, IconSortAsc, IconSortDesc, IconRoundFileUpload, IconSortAscLetters, IconSortDescLetters, IconRotate, IconSortAscNumbers, IconSortDescNumbers, IconSortAscClock, IconSortDescClock, IconLayerGroup, IconBell, IconBellCheck, IconBellOutline, IconBellCheckOutline, IconEnvelopeOpenText, IconChangeUser, IconUserCheck, IconRelationManyToMany, IconRelationOneToMany, IconUserExpired, IconKey, IconZoomInLinear, IconZoomOutLinear, IconMenuCAWorkingGroups, IconCADossier, IconMenuCACaseflow, IconMenuDashboard, IconMenuCAAreas, IconMenuTask, IconMenuSearch, IconMenuFullTextSearch, IconMenuFavourite, IconSAPLogin, IconSAPLogin2, IconView };
@@ -670,4 +670,4 @@ export function IconBackhandIndexPointingRight(props) {
670
670
  export function IconMoveToFolder(props) {
671
671
  return (_jsx("svg", { fontSize: props.fontSize ?? FONTSIZE, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 28 28", width: "1em", height: "1em", ...props, children: _jsx("path", { d: "M21.5 15a5.5 5.5 0 1 1 0 11a5.5 5.5 0 0 1 0-11zM10.207 4c.46 0 .908.141 1.284.402l.156.12L14.022 6.5h9.728a2.25 2.25 0 0 1 2.229 1.938l.016.158l.005.154v7.06a6.518 6.518 0 0 0-1.499-1.077L24.5 8.75a.75.75 0 0 0-.648-.743L23.75 8h-9.729l-2.374 1.978a2.25 2.25 0 0 1-1.244.513l-.196.009l-6.707-.001V21.75c0 .38.282.693.648.743l.102.007h11.064a6.47 6.47 0 0 0 .709 1.501L4.25 24a2.25 2.25 0 0 1-2.245-2.096L2 21.75V6.25a2.25 2.25 0 0 1 2.096-2.245L4.25 4h5.957zm11.585 13.545l-.076.044l-.07.057l-.057.07a.5.5 0 0 0 0 .568l.057.07l1.646 1.645l-4.798.001l-.09.008a.5.5 0 0 0-.402.402l-.008.09l.008.09a.5.5 0 0 0 .402.402l.09.008l4.8-.001l-1.648 1.647l-.057.07a.5.5 0 0 0 .695.695l.07-.057l2.535-2.541l.031-.042l.042-.08l.026-.083l.01-.064l-.002-.11l-.008-.042l-.026-.083l-.042-.08l-.037-.05l-2.53-2.533l-.069-.057a.5.5 0 0 0-.492-.044zM10.207 5.5H4.25a.75.75 0 0 0-.743.648L3.5 6.25v2.749L10.207 9a.75.75 0 0 0 .395-.113l.085-.06l1.891-1.578l-1.89-1.575a.75.75 0 0 0-.377-.167l-.104-.007z", fill: "currentColor", fillRule: "nonzero" }) }));
672
672
  }
673
- export { Icon123, IconABC, IconAccessPoint, IconAddressBook, IconSignCert, IconServerService, IconActivity, IconActivityLog, IconAdd, IconAddCircleOutline, IconAll, IconApply, IconApplyAndClose, IconArchive, IconArchiveDoc, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconAtSign, IconAttachment, IconAutoConfig, IconBackward, IconBasket, IconBoard, IconBoxArchiveIn, IconBxInfo, IconBxLock, IconCalendar, IconCloseCircle, IconCloseOutline, IconCloud, IconCircleInfo, IconClear, IconColumns, IconCommand, IconCopy, IconCount, IconCrown, IconDashboard, IconDcmtType, IconDcmtTypeOnlyMetadata, IconDcmtTypeSys, IconDelete, IconDetails, IconDown, IconDownload, IconDotsVerticalCircleOutline, IconDuplicate, IconEdit, IconEqual, IconEqualNot, IconEraser, IconExpandRight, IconExport, IconFastBackward, IconFoldeAdd, IconFolderSearch, IconFolderZip, IconFastForward, IconFastSearch, IconFileDots, IconFilter, IconForceStop, IconForward, IconFreeze, IconFreeSearch, IconGreaterThan, IconGreaterThanOrEqual, IconHistory, IconImport, IconTag, IconInfo, IconInsertAbove, IconInsertBelow, IconHeart, IconHide, IconLanguage, IconLeft, IconLessThan, IconLessThanOrEqual, IconLock, IconLockClosed, IconLogin, IconLink, IconLogout, IconMail, IconMapping, IconMic, IconMenuHorizontal, IconMenuKebab, IconMenuVertical, IconMetadata, IconMetadata_Computed, IconMetadata_DataList, IconMetadata_Date, IconMetadata_DynamicDataList, IconMetadata_Numerator, IconMetadata_Numeric, IconMetadata_Special, IconMetadata_Text, IconMetadata_User, IconMonitor, IconOpenInNew, IconNotification, IconPassword, IconPencil, IconPlatform, IconPlay, IconPreview, IconPrinter, IconPrintOutline, IconProcess, IconProgressAbortRequested, IconProgressCompleted, IconProgressNotCompleted, IconProgressReady, IconProgressRunning, IconProgressStarted, IconRefresh, IconReset, IconRecentlyViewed, IconRight, IconSave, IconSearch, IconSelected, IconSettings, IconShow, IconSort, IconStop, IconStopwatch, IconSuccess, IconAlarmPlus, IconHourglass, IconNone, IconNotStarted, IconProgress, IconSuccessCirlce, IconSuitcase, IconSupport, IconUndo, IconUnFreeze, IconUp, IconUpdate, IconUpload, IconUser, IconUserProfile, IconVisible, IconWarning, IconWeb, IconWifi, IconWindowMaximize, IconWindowMinimize, IconWorkflow, IconWorkspace, IconUserGroup, IconUserGroupOutline, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconDraggabledots, IconRelation, IconEasy, IconSum, IconDisk, IconDataList, IconPalette, IconFormatPageSplit, IconPaste, IconFileSearch, IconStar, IconStarRemove, IconSearchCheck, IconLightningFill, IconArrowUnsorted, IconArrowSortedUp, IconArrowSortedDown, IconConvertFilePdf, IconExportTo, IconSharedDcmt, IconShare, IconBatchUpdate, IconCheckFile, IconStatistics, IconSubstFile, IconAdvanced, IconSync, IconSavedQuery, IconSignature, IconSignaturePencil, IconRecursiveOps, IconCheckIn, IconTree, IconGrid, IconList, IconFolder, IconFolderOpen, IconFactory, IconTest, IconCheck, IconUncheck, IconSortAsc, IconSortDesc, IconRoundFileUpload, IconSortAscLetters, IconSortDescLetters, IconRotate, IconSortAscNumbers, IconSortDescNumbers, IconSortAscClock, IconSortDescClock, IconLayerGroup, IconBell, IconBellCheck, IconBellOutline, IconBellCheckOutline, IconEnvelopeOpenText, IconChangeUser, IconUserCheck, IconRelationManyToMany, IconRelationOneToMany, IconUserExpired, IconKey, IconZoomInLinear, IconZoomOutLinear, IconMenuCAWorkingGroups, IconCADossier, IconMenuCACaseflow, IconMenuDashboard, IconMenuCAAreas, IconMenuTask, IconMenuSearch, IconMenuFullTextSearch, IconMenuFavourite, IconSAPLogin, IconSAPLogin2, IconView, };
673
+ export { Icon123, IconABC, IconAccessPoint, IconAddressBook, IconSignCert, IconServerService, IconActivity, IconActivityLog, IconAdd, IconAddCircleOutline, IconAll, IconApply, IconApplyAndClose, IconArchive, IconArchiveDoc, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconAtSign, IconAttachment, IconAutoConfig, IconBackward, IconBasket, IconBoard, IconBoxArchiveIn, IconBxInfo, IconBxLock, IconCalendar, IconCloseCircle, IconCloseOutline, IconCloud, IconCircleInfo, IconClear, IconColumns, IconCommand, IconCopy, IconCount, IconCrown, IconDashboard, IconDcmtType, IconDcmtTypeOnlyMetadata, IconDcmtTypeSys, IconDelete, IconDetails, IconDown, IconDownload, IconDotsVerticalCircleOutline, IconDuplicate, IconEdit, IconEqual, IconEqualNot, IconEraser, IconExpandRight, IconExport, IconFastBackward, IconFoldeAdd, IconFolderSearch, IconFolderZip, IconFastForward, IconFastSearch, IconFileDots, IconFilter, IconForceStop, IconForward, IconFreeze, IconFreeSearch, IconGreaterThan, IconGreaterThanOrEqual, IconHistory, IconImport, IconTag, IconInfo, IconInsertAbove, IconInsertBelow, IconHeart, IconHide, IconLanguage, IconLeft, IconLessThan, IconLessThanOrEqual, IconLock, IconLockClosed, IconLogin, IconLink, IconLogout, IconMail, IconMapping, IconMic, IconMenuHorizontal, IconMenuKebab, IconMenuVertical, IconMetadata, IconMetadata_Computed, IconMetadata_DataList, IconMetadata_Date, IconMetadata_DynamicDataList, IconMetadata_Numerator, IconMetadata_Numeric, IconMetadata_Special, IconMetadata_Text, IconMetadata_User, IconMonitor, IconOpenInNew, IconNotification, IconPassword, IconPencil, IconPlatform, IconPlay, IconPreview, IconPrinter, IconPrintOutline, IconProcess, IconProgressAbortRequested, IconProgressCompleted, IconProgressNotCompleted, IconProgressReady, IconProgressRunning, IconProgressStarted, IconRefresh, IconReset, IconRecentlyViewed, IconRight, IconSave, IconSearch, IconSelected, IconSettings, IconShow, IconSort, IconStop, IconStopwatch, IconSuccess, IconAlarmPlus, IconHourglass, IconNone, IconNotStarted, IconProgress, IconSuccessCirlce, IconSuitcase, IconSupport, IconUndo, IconUnFreeze, IconUp, IconUpdate, IconUpload, IconUser, IconUserProfile, IconVisible, IconWarning, IconWeb, IconWifi, IconWindowMaximize, IconWindowMinimize, IconWorkflow, IconWorkspace, IconUserGroup, IconUserGroupOutline, IconUserLevelMember, IconUserLevelAdministrator, IconUserLevelSystemAdministrator, IconUserLevelAutonomousAdministrator, IconDraggabledots, IconRelation, IconEasy, IconSum, IconDisk, IconDataList, IconPalette, IconFormatPageSplit, IconPaste, IconFileSearch, IconStar, IconStarRemove, IconSearchCheck, IconLightningFill, IconArrowUnsorted, IconArrowSortedUp, IconArrowSortedDown, IconConvertFilePdf, IconExportTo, IconSharedDcmt, IconShare, IconBatchUpdate, IconCheckFile, IconStatistics, IconSubstFile, IconAdvanced, IconSync, IconSavedQuery, IconSignature, IconSignaturePencil, IconRecursiveOps, IconCheckIn, IconTree, IconGrid, IconList, IconFolder, IconFolderOpen, IconFactory, IconTest, IconCheck, IconUncheck, IconSortAsc, IconSortDesc, IconRoundFileUpload, IconSortAscLetters, IconSortDescLetters, IconRotate, IconSortAscNumbers, IconSortDescNumbers, IconSortAscClock, IconSortDescClock, IconLayerGroup, IconBell, IconBellCheck, IconBellOutline, IconBellCheckOutline, IconEnvelopeOpenText, IconChangeUser, IconUserCheck, IconRelationManyToMany, IconRelationOneToMany, IconUserExpired, IconKey, IconZoomInLinear, IconZoomOutLinear, IconMenuCAWorkingGroups, IconCADossier, IconMenuCACaseflow, IconMenuDashboard, IconMenuCAAreas, IconMenuTask, IconMenuSearch, IconMenuFullTextSearch, IconMenuFavourite, IconSAPLogin, IconSAPLogin2, IconView };
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import styled from "styled-components";
3
3
  import { TMTooltip } from '../components';
4
- import { IconKey } from './TMIcons';
4
+ import { IconCADossier, IconKey, IconMenuCAWorkingGroups } from './TMIcons';
5
5
  import { DataListCacheService, MetadataDataDomains, PdGs } from '@topconsultnpm/sdk-ts';
6
6
  import { SDKUI_Localizator } from './SDKUI_Localizator';
7
7
  const StyledIconFileContainer = styled.div `
@@ -201,21 +201,12 @@ export const StyledTabIcon = styled.i `
201
201
  transition: color 0.2s ease;
202
202
  `;
203
203
  export const TMCountBadge = styled.div ` background-color: #ff5252; color: white; border-radius: 999px; margin-left: 8px; font-size: 0.7rem; line-height: 1; min-height: 20px; min-width: 20px; display: flex ; align-items: center; justify-content: center; `;
204
- const taskPdgsIconClassMap = () => {
205
- return new Map([
206
- [PdGs.None, ""],
207
- [PdGs.CF, "dx-icon-folder"],
208
- [PdGs.DT, "dx-icon-file"],
209
- [PdGs.WF, "dx-icon-box"],
210
- [PdGs.WG, "dx-icon-group"],
211
- ]);
212
- };
213
204
  export const getPdgsIconMap = (fontSize = 20) => {
214
205
  return new Map([
215
206
  [PdGs.None, _jsx("span", {}, "PdGs-None")],
216
- [PdGs.CF, _jsx("i", { style: { fontSize }, className: taskPdgsIconClassMap().get(PdGs.CF) }, "PdGs-CF")],
217
- [PdGs.DT, _jsx("i", { style: { fontSize }, className: taskPdgsIconClassMap().get(PdGs.DT) }, "PdGs-DT")],
218
- [PdGs.WF, _jsx("i", { style: { fontSize }, className: taskPdgsIconClassMap().get(PdGs.WF) }, "PdGs-WF")],
219
- [PdGs.WG, _jsx("i", { style: { fontSize }, className: taskPdgsIconClassMap().get(PdGs.WG) }, "PdGs-WG")], // <IconUserGroup color="#009700"/>
207
+ [PdGs.CF, _jsx(IconCADossier, { color: "#e65b00", fontSize: 28 }, "PdGs-CF")],
208
+ [PdGs.DT, _jsx("i", { style: { fontSize, color: '#0066cc' }, className: "dx-icon-file" }, "PdGs-DT")],
209
+ [PdGs.WF, _jsx("i", { style: { fontSize }, className: "dx-icon-box" }, "PdGs-WF")],
210
+ [PdGs.WG, _jsx(IconMenuCAWorkingGroups, { color: "#009700", fontSize: 28 }, "PdGs-WG")],
220
211
  ]);
221
212
  };
@@ -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) => Record<string, string | number> | undefined;
7
+ export declare const processButtonAttributes: (args: string | undefined, formData: MetadataValueDescriptorEx[] | undefined) => Record<string, string> | undefined;
8
+ export declare const processSelectedItems: (selectedItems: Array<any> | undefined) => any[] | undefined;
@@ -24,20 +24,26 @@ export const isXMLFileExt = (fileExt) => {
24
24
  }
25
25
  };
26
26
  /*utility functions for TMCustomButton*/
27
- export const processButtonAttributes = (args, formData) => args && formData ? splitArguments(replaceCustomButtonAttributes(args, formDataMap(formData))) : undefined;
28
- const replaceCustomButtonAttributes = (input, attributes) => {
29
- const matches = Array.from(input.matchAll(/@\w+/g));
30
- return matches
31
- .map(([match]) => `${match}=${attributes[match.slice(1)] ?? ''}`)
32
- .join(';') + ';';
33
- };
34
- const formDataMap = (data) => data.reduce((acc, md) => {
35
- const key = md.md?.name;
27
+ export const processButtonAttributes = (args, formData) => args && formData ? formDataMap(formData, args) : undefined;
28
+ export const processSelectedItems = (selectedItems) => selectedItems?.map(item => {
29
+ const tid = item.TID;
30
+ if (!tid)
31
+ return item;
32
+ const prefix = `${tid}_`;
33
+ const prefixLength = prefix.length;
34
+ return Object.keys(item).reduce((acc, key) => {
35
+ acc[key.startsWith(prefix) ? key.substring(prefixLength) : key] = item[key];
36
+ return acc;
37
+ }, {});
38
+ });
39
+ const formDataMap = (data, args) => data.reduce((acc, md) => {
40
+ const matches = Array.from(args.matchAll(/@\w+/g));
41
+ const keys = matches.map(([match]) => match.slice(1));
42
+ if (!keys.includes(md.md?.name || ''))
43
+ return acc;
44
+ //const key = md.md?.name;
45
+ const key = md?.mid; // inserisco il mid come chiave
36
46
  if (key && md.value)
37
47
  acc[key] = md.value;
38
48
  return acc;
39
49
  }, {});
40
- const splitArguments = (input) => Object.fromEntries(Array.from(input.matchAll(/@?(\w+)=([^;]+)/g), ([, key, value]) => [
41
- key,
42
- isNaN(Number(value)) ? value : Number(value),
43
- ]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.19.0-dev2.21",
3
+ "version": "6.19.0-dev2.22",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",