@topconsultnpm/sdkui-react-beta 6.16.28 → 6.16.30

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.
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { ITopMediaSession } from '@topconsultnpm/sdk-ts-beta';
3
+ import { ITMEditorBase } from '../base/TMEditorBase';
4
+ interface ITMPathChooser extends ITMEditorBase {
5
+ onValueChanged?: (e: string) => void;
6
+ allowBrowseFile_Area?: boolean;
7
+ allowBrowseFolder_Area?: boolean;
8
+ allowParametricPath?: boolean;
9
+ tmSession?: ITopMediaSession;
10
+ }
11
+ declare const TMPathChooser: React.FunctionComponent<ITMPathChooser>;
12
+ export default TMPathChooser;
@@ -0,0 +1,147 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { SDK_Globals, FileFormats } from '@topconsultnpm/sdk-ts-beta';
4
+ import { IconFileDots, SDKUI_Localizator, IconSearch, IconDownload, Globalization, AreaHelper } from '../../helper';
5
+ import { TMColors } from '../../utils/theme';
6
+ import ShowAlert from '../base/TMAlert';
7
+ import TMAreaManager from '../base/TMAreaManager';
8
+ import TMButton from '../base/TMButton';
9
+ import { TMLayoutItem } from '../base/TMLayout';
10
+ import TMModal from '../base/TMModal';
11
+ import { TMExceptionBoxManager } from '../base/TMPopUp';
12
+ import { TMLayoutWaitingContainer } from '../base/TMWaitPanel';
13
+ import TMTextBox from '../editors/TMTextBox';
14
+ let abortController = new AbortController();
15
+ const TMPathChooser = (props) => {
16
+ //const [path, setPath] = useState<string>(props.value)
17
+ const [elementStyle, setElementStyle] = useState(props.elementStyle);
18
+ const [showAreaFile, setShowAreaFile] = useState(false);
19
+ const [showAreaFolder, setShowAreaFolder] = useState(false);
20
+ const [areaFolderPath, setAreaFolderPath] = useState();
21
+ const [areaFilePath, setAreaFilePath] = useState();
22
+ const [showAreaManager, setShowAreaManager] = useState(false);
23
+ const [downloadLink, setDownloadLink] = useState(null);
24
+ const [file, setFile] = useState(null);
25
+ const [showWaitPanel, setShowWaitPanel] = useState(false);
26
+ const [waitPanelTitle, setWaitPanelTitle] = useState('');
27
+ const [showSecondary, setShowSecondary] = useState(false);
28
+ const [waitPanelTextSecondary, setWaitPanelTextSecondary] = useState('');
29
+ const [waitPanelValueSecondary, setWaitPanelValueSecondary] = useState(0);
30
+ const [waitPanelMaxValueSecondary, setWaitPanelMaxValueSecondary] = useState(0);
31
+ const formulaItems = ['{@JobName}', '{@JobStartDate}', '{@JobStartDateTime}', '{@ProcessRunID}', '{@ProcessName}', '{@ProcessStartDate}', '{@ProcessStartDateTime}'];
32
+ //useEffect(() => { setPath(props.value) }, [props.value])
33
+ useEffect(() => {
34
+ if (props.elementStyle) {
35
+ let style = { width: "100%", ...props.elementStyle };
36
+ setElementStyle(style);
37
+ }
38
+ }, [props.elementStyle]);
39
+ useEffect(() => {
40
+ if (file && file !== null) {
41
+ const fileURL = window.URL?.createObjectURL(file);
42
+ downloadLink.href = fileURL;
43
+ downloadLink.download = file?.name;
44
+ downloadLink.click();
45
+ }
46
+ }, [file]);
47
+ /*useEffect(() => {
48
+ return () => { setFile(null); }
49
+ }, [path])*/
50
+ const browseFile_Area = () => {
51
+ setShowAreaFile(true);
52
+ setShowAreaManager(true);
53
+ };
54
+ const browseFolder_Area = () => {
55
+ setShowAreaFolder(true);
56
+ setShowAreaManager(true);
57
+ };
58
+ const getParentDir = (str) => {
59
+ const newStr = str.slice(0, -1);
60
+ const index = newStr.lastIndexOf('\\');
61
+ const parent = str.substring(0, index);
62
+ return parent + '\\';
63
+ };
64
+ const areaChoose = () => {
65
+ setShowAreaManager(false);
66
+ if (showAreaFolder) {
67
+ if (areaFilePath)
68
+ props.onValueChanged?.(getParentDir(areaFilePath) || '');
69
+ else
70
+ props.onValueChanged?.(areaFolderPath ?? '');
71
+ setShowAreaFolder(false);
72
+ }
73
+ else if (showAreaFile) {
74
+ props.onValueChanged?.(areaFilePath ?? '');
75
+ setShowAreaFile(false);
76
+ }
77
+ };
78
+ const renderButtons = () => {
79
+ let buttons = [];
80
+ if (props.allowBrowseFile_Area)
81
+ buttons.push({
82
+ icon: _jsx(IconFileDots, {}), text: SDKUI_Localizator.BrowseAreaFile, onClick: () => { browseFile_Area(); }
83
+ });
84
+ if (props.allowBrowseFolder_Area)
85
+ buttons.push({ icon: _jsx(IconSearch, {}), text: SDKUI_Localizator.BrowseAreaFolder, onClick: () => browseFolder_Area() });
86
+ if (props.value !== '' && !props.allowBrowseFolder_Area) {
87
+ let dlLink = document.createElement('a');
88
+ dlLink.target = "_blank";
89
+ dlLink.rel = "noreferrer";
90
+ buttons.push({
91
+ icon: _jsx(IconDownload, { color: TMColors.success }), text: 'Download', onClick: () => {
92
+ onFileDownloadHandler();
93
+ setDownloadLink(dlLink);
94
+ }
95
+ });
96
+ }
97
+ ;
98
+ return buttons;
99
+ };
100
+ const onFileDownloadHandler = async () => {
101
+ try {
102
+ let av = AreaHelper.ExtractAreaInfo_2(props.value, true);
103
+ let doc;
104
+ let tms = props.tmSession ?? SDK_Globals.tmSession;
105
+ setShowWaitPanel(true);
106
+ setShowSecondary(true);
107
+ setWaitPanelTitle("Download");
108
+ abortController = new AbortController();
109
+ let firstBlock = true;
110
+ let maxFileSize = 0;
111
+ doc = await tms?.NewAreaEngine().RetrieveFileAsync(av.aid, av.subFolder, av.fileName, FileFormats.None, abortController.signal, (pd) => {
112
+ if (firstBlock) {
113
+ maxFileSize = pd.ProgressBarMaximum ?? 0;
114
+ setWaitPanelMaxValueSecondary(maxFileSize);
115
+ firstBlock = false;
116
+ }
117
+ setWaitPanelValueSecondary(pd.ProgressBarValue);
118
+ setWaitPanelTextSecondary(`Downloading... ${Globalization.getNumberDisplayValue(pd.ProgressBarValue, true)} / ${Globalization.getNumberDisplayValue(maxFileSize, true)}`);
119
+ if (pd.ProgressBarValue === pd.ProgressBarMaximum) {
120
+ setWaitPanelMaxValueSecondary(0);
121
+ setWaitPanelValueSecondary(0);
122
+ setWaitPanelTextSecondary('');
123
+ firstBlock = true;
124
+ }
125
+ });
126
+ setFile(doc);
127
+ }
128
+ catch (ex) {
129
+ const err = ex;
130
+ if (err.name === 'CanceledError') {
131
+ ShowAlert({ message: err.message, mode: 'warning', duration: 3000, title: 'Abort' });
132
+ }
133
+ else
134
+ TMExceptionBoxManager.show({ exception: ex });
135
+ setFile(null);
136
+ }
137
+ finally {
138
+ setWaitPanelTextSecondary('');
139
+ setWaitPanelMaxValueSecondary(0);
140
+ setWaitPanelValueSecondary(0);
141
+ setShowWaitPanel(false);
142
+ }
143
+ };
144
+ return (_jsxs(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: [_jsx(TMLayoutItem, { children: _jsx(TMTextBox, { buttons: renderButtons(), elementStyle: elementStyle, formulaItems: props.allowParametricPath ? formulaItems : [], isModifiedWhen: props.isModifiedWhen, label: props.label, value: props.value || '', onValueChanged: (e) => { /*setPath(e.target.value);*/ props.onValueChanged?.(e.target.value); }, validationItems: props.validationItems }) }), showAreaManager &&
145
+ _jsxs(TMModal, { resizable: true, width: '80%', onClose: () => setShowAreaManager(false), children: [_jsx(TMAreaManager, { showOnlyFolders: props.allowBrowseFolder_Area && !props.allowBrowseFile_Area, initialPath: props.value, onFolderChanged: (folder) => setAreaFolderPath(folder), onFileChanged: (file) => setAreaFilePath(file), isPathChooser: true, areaChoose: areaChoose, width: '98%', height: props.allowBrowseFile_Area ? '70vh' : '90%', tmSession: props.tmSession, selectionMode: 'single' }), _jsx("div", { style: { position: 'absolute', right: '22px', bottom: '8px' }, children: _jsx(TMButton, { caption: 'OK', onClick: () => areaChoose() }) })] })] }));
146
+ };
147
+ export default TMPathChooser;
@@ -4,6 +4,7 @@ export declare const getCultureIDImg: (cultureID: CultureIDs) => any;
4
4
  interface TMLocalizedTextBoxProps {
5
5
  label: string;
6
6
  value?: string;
7
+ isModifiedWhen?: boolean;
7
8
  value_IT?: string;
8
9
  value_EN?: string;
9
10
  value_FR?: string;
@@ -57,7 +57,7 @@ export const getCultureIDImg = (cultureID) => {
57
57
  default: return it;
58
58
  }
59
59
  };
60
- const TMLocalizedTextBox = ({ label, value, value_IT, value_EN, value_FR, value_PT, value_ES, value_DE, onValueChanged, }) => {
60
+ const TMLocalizedTextBox = ({ label, value, value_IT, value_EN, value_FR, value_PT, value_ES, value_DE, isModifiedWhen, onValueChanged, }) => {
61
61
  // const [isModalOpen, setIsModalOpen] = useState(false);
62
62
  const [isPopoverVisible, setIsPopoverVisible] = useState(false);
63
63
  const popoverRef = useRef(null);
@@ -90,6 +90,6 @@ const TMLocalizedTextBox = ({ label, value, value_IT, value_EN, value_FR, value_
90
90
  icon: (_jsxs(IconContainer, { children: [_jsx(IconLanguage, {}), localizedCount > 0 && _jsx(Badge, { children: localizedCount })] })),
91
91
  onClick: handleTogglePopover,
92
92
  };
93
- return (_jsxs(LocalizedContainer, { ref: popoverRef, children: [_jsx(TMTextBox, { type: "text", label: label, value: value, buttons: [localizationButton], onValueChanged: (e) => onValueChanged(CultureIDs.None, e.target.value) }), _jsx(Popover, { "$isVisible": isPopoverVisible, children: languages.map((lang) => (_jsx(TMTextBox, { label: `${lang.label}`, showClearButton: true, icon: _jsx("img", { src: getCultureIDImg(lang.code), alt: "Lang", width: 18, height: 18 }), value: lang.value || '', onValueChanged: (e) => onValueChanged(lang.code, e.target.value) }, lang.code))) })] }));
93
+ return (_jsxs(LocalizedContainer, { ref: popoverRef, children: [_jsx(TMTextBox, { type: "text", label: label, value: value, isModifiedWhen: isModifiedWhen, buttons: [localizationButton], onValueChanged: (e) => onValueChanged(CultureIDs.None, e.target.value) }), _jsx(Popover, { "$isVisible": isPopoverVisible, children: languages.map((lang) => (_jsx(TMTextBox, { label: `${lang.label}`, showClearButton: true, icon: _jsx("img", { src: getCultureIDImg(lang.code), alt: "Lang", width: 18, height: 18 }), value: lang.value || '', onValueChanged: (e) => onValueChanged(lang.code, e.target.value) }, lang.code))) })] }));
94
94
  };
95
95
  export default TMLocalizedTextBox;
@@ -5,6 +5,7 @@ interface ITMTextExpression extends ITMEditorBase {
5
5
  value: string | undefined;
6
6
  valueOrig: string | undefined;
7
7
  qd?: QueryDescriptor;
8
+ tid?: number;
8
9
  formulaItems?: string[];
9
10
  label?: string;
10
11
  titleChooser?: string;
@@ -11,6 +11,7 @@ const TMTextExpression = (props) => {
11
11
  const [showMetadataChooser, setShowMetadataChooser] = useState(false);
12
12
  const [showFormulaChooser, setShowFormulaChooser] = useState(false);
13
13
  useEffect(() => { MetadataInfos_Source_Get_Async(); }, [props.qd]);
14
+ useEffect(() => { MetadataInfos_Source_GetByTID_Async(); }, [props.tid]);
14
15
  async function MetadataInfos_Source_Get_Async() {
15
16
  if (!props.qd?.select)
16
17
  return;
@@ -46,13 +47,36 @@ const TMTextExpression = (props) => {
46
47
  }
47
48
  setMetadatas_Info_Source(mhs_source);
48
49
  }
50
+ async function MetadataInfos_Source_GetByTID_Async() {
51
+ if (!props.tid)
52
+ return;
53
+ let mhs_source = [];
54
+ try {
55
+ let dtd_source = await DcmtTypeListCacheService.GetAsync(props.tid, true);
56
+ if (dtd_source == undefined)
57
+ return;
58
+ if (dtd_source?.metadata == undefined)
59
+ return;
60
+ for (let md_source of dtd_source?.metadata) {
61
+ if (md_source?.name == undefined)
62
+ continue;
63
+ if (md_source?.id == undefined)
64
+ continue;
65
+ mhs_source.push(new MetatadaHelper(md_source.id, md_source.name));
66
+ }
67
+ }
68
+ catch (e) {
69
+ TMExceptionBoxManager.show({ exception: e, title: 'MetadataInfos_Source_GetByTID_Async' });
70
+ }
71
+ setMetadatas_Info_Source(mhs_source);
72
+ }
49
73
  function Expression_IDs2Names(expression) {
50
74
  if (expression == undefined)
51
75
  return expression;
52
76
  let temp = expression.slice();
53
77
  let mh;
54
78
  for (mh of metadatas_Info_Source) {
55
- temp = temp.replaceAll(mh.Mid.toString(), mh.MetadataName);
79
+ temp = temp.replaceAll(`{@${mh.Mid}}`, `{@${mh.MetadataName}}`);
56
80
  }
57
81
  temp = temp.replaceAll("{@1}", "{@DID}");
58
82
  return temp;
@@ -63,13 +87,13 @@ const TMTextExpression = (props) => {
63
87
  let temp = expression.slice();
64
88
  let mh;
65
89
  for (mh of metadatas_Info_Source)
66
- temp = temp.replaceAll(mh.MetadataName, mh.Mid.toString());
90
+ temp = temp.replaceAll(`{@${mh.MetadataName}}`, `{@${mh.Mid}}`);
67
91
  temp = temp.replaceAll("{@DID}", "{@1}");
68
92
  return temp;
69
93
  }
70
94
  const renderButtons = () => {
71
95
  let buttons = [];
72
- if (props.qd)
96
+ if (props.qd || props.tid)
73
97
  buttons.push({ icon: _jsx(IconColumns, {}), text: SDKUI_Localizator.MetadataReferenceInsert, onClick: () => { setShowMetadataChooser(true); } });
74
98
  if (props.formulaItems && props.formulaItems.length > 0)
75
99
  buttons.push({ icon: _jsx(IconDataList, {}), text: SDKUI_Localizator.Parameters, onClick: () => setShowFormulaChooser(true) });
@@ -111,7 +135,7 @@ const TMTextExpression = (props) => {
111
135
  }
112
136
  const openMetadataChooseForm = () => {
113
137
  return (showMetadataChooser ?
114
- _jsx(TMMetadataChooserForm, { allowMultipleSelection: true, qd: props.qd, qdShowOnlySelectItems: true, allowSysMetadata: true, onClose: () => setShowMetadataChooser(false), onChoose: (tid_mid) => {
138
+ _jsx(TMMetadataChooserForm, { allowMultipleSelection: true, qd: props.qd, tids: props.tid ? [props.tid] : undefined, qdShowOnlySelectItems: true, allowSysMetadata: true, onClose: () => setShowMetadataChooser(false), onChoose: (tid_mid) => {
115
139
  let list = mdList(tid_mid);
116
140
  props.onValueChanged?.(list);
117
141
  } }) : _jsx(_Fragment, {}));
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { DiagramItem } from './interfaces';
2
+ import { DiagramItem, WfInfo } from './interfaces';
3
3
  interface DiagramItemComponentProps {
4
+ wf?: WfInfo | null;
4
5
  item: DiagramItem;
5
6
  isSelected: boolean;
6
7
  isCurrent: boolean;
@@ -1,8 +1,10 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useState, useCallback, useRef, useEffect, useMemo } from 'react';
3
+ import { DiagramItemTypes } from './interfaces';
3
4
  import styled, { keyframes, css } from 'styled-components';
4
5
  import DiagramItemSvgContent from './DiagramItemSvgContent';
5
6
  import { calculateDiagramItemFullDimensions, FONT_SIZE, MAX_ITEM_WIDTH, MAX_LINES, PADDING_HORIZONTAL, PADDING_TOP, SPACING_SVG_TEXT, SVG_ICON_SIZE, wrapText } from './workflowHelpers';
7
+ import { DataListCacheService } from '@topconsultnpm/sdk-ts-beta';
6
8
  const blink = keyframes `
7
9
  0%, 100% { opacity: 1; }
8
10
  50% { opacity: 0.4; }
@@ -80,7 +82,7 @@ const ConnectorHitArea = styled.circle `
80
82
  opacity: 0;
81
83
  pointer-events: all;
82
84
  `;
83
- const DiagramItemComponent = ({ item, isSelected, isCurrent, readOnly, onClick, onDrag, onDragEnd, onConnectorMouseDown, onConnectorMouseUp, onDimensionsChange, onDoubleClick, }) => {
85
+ const DiagramItemComponent = ({ wf, item, isSelected, isCurrent, readOnly, onClick, onDrag, onDragEnd, onConnectorMouseDown, onConnectorMouseUp, onDimensionsChange, onDoubleClick, }) => {
84
86
  const diagramItemRef = useRef(null);
85
87
  const textRef = useRef(null);
86
88
  const [isDragging, setIsDragging] = useState(false);
@@ -88,6 +90,26 @@ const DiagramItemComponent = ({ item, isSelected, isCurrent, readOnly, onClick,
88
90
  const [startDragOffset, setStartDragOffset] = useState(null);
89
91
  const [currentPosition, setCurrentPosition] = useState({ x: item.Left, y: item.Top });
90
92
  const [textDimensions, setTextDimensions] = useState({ width: 0, height: 0 });
93
+ const [statusData, setStatusData] = useState(undefined);
94
+ useEffect(() => {
95
+ const fetchStatusData = async () => {
96
+ if (item.Type === DiagramItemTypes.Status && wf?.MStatusDLID) {
97
+ try {
98
+ const fullDataList = await DataListCacheService.GetAsync(wf.MStatusDLID);
99
+ const foundItem = fullDataList?.items?.find(o => o.value == item.StatusValue);
100
+ setStatusData(foundItem);
101
+ }
102
+ catch (error) {
103
+ console.error("Errore durante il recupero dei dati di stato:", error);
104
+ setStatusData(undefined);
105
+ }
106
+ }
107
+ else {
108
+ setStatusData(undefined);
109
+ }
110
+ };
111
+ fetchStatusData();
112
+ }, [item.Type, item.StatusValue, wf?.MStatusDLID]);
91
113
  // Calcola le dimensioni totali dell'elemento usando la funzione di utilità
92
114
  const { calculatedWidth, calculatedHeight } = useMemo(() => {
93
115
  return calculateDiagramItemFullDimensions(item, textDimensions);
@@ -235,7 +257,7 @@ const DiagramItemComponent = ({ item, isSelected, isCurrent, readOnly, onClick,
235
257
  isTruncated = textLines[textLines.length - 1].endsWith('...');
236
258
  }
237
259
  }
238
- return (_jsxs(_Fragment, { children: [isTruncated && _jsx("title", { children: item.ItemName }), _jsx("rect", { x: "0", y: "0", width: calculatedWidth, height: calculatedHeight, className: "item-main-shape" }), _jsx("g", { transform: `translate(${svgX}, ${svgY})`, children: _jsx(DiagramItemSvgContent, { itemType: item.Type, width: iconRenderWidth, height: iconRenderHeight }) }), textLines.length > 0 && (_jsx("text", { ref: textRef, x: calculatedWidth / 2, dominantBaseline: "central", className: "item-text", children: textLines.map((line, index) => (_jsx("tspan", { x: calculatedWidth / 2, dy: index === 0 ? PADDING_TOP + SVG_ICON_SIZE + SPACING_SVG_TEXT : FONT_SIZE + 1, children: line }, index))) })), connectors] }));
260
+ return (_jsxs(_Fragment, { children: [isTruncated && _jsx("title", { children: item.ItemName }), _jsx("rect", { x: "0", y: "0", width: calculatedWidth, height: calculatedHeight, className: "item-main-shape" }), _jsx("g", { transform: `translate(${svgX}, ${svgY})`, children: _jsx(DiagramItemSvgContent, { itemType: item.Type, width: iconRenderWidth, height: iconRenderHeight, statusData: statusData }) }), textLines.length > 0 && (_jsx("text", { ref: textRef, x: calculatedWidth / 2, dominantBaseline: "central", className: "item-text", children: textLines.map((line, index) => (_jsx("tspan", { x: calculatedWidth / 2, dy: index === 0 ? PADDING_TOP + SVG_ICON_SIZE + SPACING_SVG_TEXT : FONT_SIZE + 1, children: line }, index))) })), connectors] }));
239
261
  };
240
262
  return (_jsx(StyledDiagramItem, { ref: diagramItemRef, transform: `translate(${currentPosition.x}, ${currentPosition.y})`, "$isSelected": isSelected, "$itemType": item.Type, "$isDragging": isDragging, "$isHovered": isHovered, "$isReadOnly": readOnly, onMouseDown: handleMouseDown, onClick: handleItemClick, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onDoubleClick: handleDoubleClick, children: _jsx(AnimatingGroup, { "$isCurrent": isCurrent, children: renderContent() }) }));
241
263
  };
@@ -20,6 +20,8 @@ import TMFormulaEditor, { FormulaDescriptor, FormulaHelper, FormulaTargets } fro
20
20
  import TMDistinctValues from '../../../choosers/TMDistinctValues';
21
21
  import TMTidViewer from '../../../viewers/TMTidViewer';
22
22
  import { TMColors } from '../../../../utils/theme';
23
+ import TMPathChooser from '../../../choosers/TMPathChooser';
24
+ import TMTextExpression from '../../../editors/TMTextExpression';
23
25
  const FormContainer = styled.div `
24
26
  display: flex;
25
27
  flex-direction: column;
@@ -127,8 +129,7 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
127
129
  }, [localItem]);
128
130
  const isModified = useMemo(() => calcIsModified(localItem, localItemOrig), [localItem, localItemOrig]);
129
131
  const handleCancel = () => {
130
- setLocalItem(localItemOrig); // Revert to the original state
131
- onClose();
132
+ setLocalItem(localItemOrig);
132
133
  };
133
134
  const handleSave = () => {
134
135
  onApply(localItem);
@@ -303,7 +304,7 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
303
304
  // Function to render common elements like the name textbox
304
305
  const renderCommonFields = () => {
305
306
  if (localItem.Type !== DiagramItemTypes.Start && localItem.Type !== DiagramItemTypes.End && localItem.Type !== DiagramItemTypes.Exit && localItem.Type !== DiagramItemTypes.Status) {
306
- return (_jsx(TMLocalizedTextBox, { label: SDKUI_Localizator.Name, value: localItem.ItemName, value_IT: localItem.ItemName_IT, value_EN: localItem.ItemName_EN, value_FR: localItem.ItemName_FR, value_PT: localItem.ItemName_PT, value_ES: localItem.ItemName_ES, value_DE: localItem.ItemName_DE, onValueChanged: handleLocalizedNameChange }));
307
+ return (_jsx(TMLocalizedTextBox, { label: SDKUI_Localizator.Name, value: localItem.ItemName, isModifiedWhen: localItem.ItemName !== localItemOrig.ItemName, value_IT: localItem.ItemName_IT, value_EN: localItem.ItemName_EN, value_FR: localItem.ItemName_FR, value_PT: localItem.ItemName_PT, value_ES: localItem.ItemName_ES, value_DE: localItem.ItemName_DE, onValueChanged: handleLocalizedNameChange }));
307
308
  }
308
309
  return null;
309
310
  };
@@ -328,7 +329,9 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
328
329
  return (_jsx(TMDataListItemPicker, { dataListID: wf?.MStatusDLID, selectedValue: localItem.StatusValue, onItemSelect: handleStatusChange }));
329
330
  };
330
331
  const renderAppFields = () => {
331
- return (_jsxs(_Fragment, { children: [_jsx(TMDropDown, { label: SDKUI_Localizator.WorkflowAppType, dataSource: APP_TYPES_DATASOURCE, value: localItem.AppType, onValueChanged: (e) => { handleAppTypeChange(e.target.value); } }), _jsx(TMTextBox, { label: SDKUI_Localizator.WorkflowAppName, value: localItem.AppName, onValueChanged: (e) => { handleAppNameChange(e.target.value); } }), _jsx(TMTextBox, { label: SDKUI_Localizator.Arguments, value: localItem.AppArgs, onValueChanged: (e) => { handleAppArgsChange(e.target.value); } }), _jsx(TMDropDown, { label: SDKUI_Localizator.Format, dataSource: CULTUREIDs_DATASOURCE, value: localItem.FormatCultureID, onValueChanged: (e) => { handleFormatCultureIDChange(e.target.value); } })] }));
332
+ return (_jsxs(_Fragment, { children: [_jsx(TMDropDown, { label: SDKUI_Localizator.WorkflowAppType, dataSource: APP_TYPES_DATASOURCE, value: localItem.AppType, isModifiedWhen: localItem.AppType !== localItemOrig.AppType, onValueChanged: (e) => { handleAppTypeChange(e.target.value); } }), localItem.AppType === WFAppTypes.EXE
333
+ ? _jsx(TMPathChooser, { label: SDKUI_Localizator.WorkflowAppName, value: localItem.AppName || '', isModifiedWhen: (localItem.AppName ?? '') !== (localItemOrig.AppName ?? ''), onValueChanged: (newValue) => { handleAppNameChange(newValue); }, allowBrowseFile_Area: true, allowBrowseFolder_Area: false, allowParametricPath: false })
334
+ : _jsx(TMTextBox, { label: SDKUI_Localizator.WorkflowAppName, value: localItem.AppName, isModifiedWhen: (localItem.AppName ?? '') !== (localItemOrig.AppName ?? ''), onValueChanged: (e) => { handleAppNameChange(e.target.value); } }), _jsx(TMTextExpression, { label: SDKUI_Localizator.Arguments, value: localItem.AppArgs, valueOrig: localItemOrig.AppArgs, tid: wf?.MTID, onValueChanged: (newValue) => { handleAppArgsChange(newValue); } }), _jsx(TMDropDown, { label: SDKUI_Localizator.Format, dataSource: CULTUREIDs_DATASOURCE, value: localItem.FormatCultureID, isModifiedWhen: localItem.FormatCultureID !== localItemOrig.FormatCultureID, onValueChanged: (e) => { handleFormatCultureIDChange(e.target.value); } })] }));
332
335
  };
333
336
  // Function to render Approval-specific fields
334
337
  const renderApprovalFields = () => {
@@ -340,7 +343,7 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
340
343
  return qd;
341
344
  };
342
345
  const qdForRecipientsEditor = localItem.QD ?? newQD();
343
- return (_jsxs(_Fragment, { children: [_jsx(TMLocalizedTextBox, { label: SDKUI_Localizator.Description, value: localItem.Description, value_IT: localItem.Description_IT, value_EN: localItem.Description_EN, value_FR: localItem.Description_FR, value_PT: localItem.Description_PT, value_ES: localItem.Description_ES, value_DE: localItem.Description_DE, onValueChanged: handleLocalizedDescriptionChange }), _jsx(WorkitemRecipientsEditor, { tos: localItem.Tos ?? '', mTID: wf?.MTID, qd: qdForRecipientsEditor, onTosChange: handleTosChange, onQDChange: handleSetRuleQDChange }), _jsxs(FlexContainer, { children: [_jsx(TMDropDown, { label: SDKUI_Localizator.WorkflowRecipientSetRule, elementStyle: { width: '320px' }, dataSource: SET_RULE_DATASOURCE, value: localItem.SetRule, onValueChanged: (e) => { handleSetRuleChange(e.target.value); } }), _jsx(TMCheckBox, { value: localItem.AllowZeroTos ?? 0, label: SDKUI_Localizator.WorkflowAllowZeroTos, isModifiedWhen: localItem.AllowZeroTos !== localItemOrig.AllowZeroTos, onValueChanged: handleAllowZeroTosChange })] }), localItem.Type === DiagramItemTypes.ExecTask &&
346
+ return (_jsxs(_Fragment, { children: [_jsx(TMLocalizedTextBox, { label: SDKUI_Localizator.Description, value: localItem.Description, value_IT: localItem.Description_IT, value_EN: localItem.Description_EN, value_FR: localItem.Description_FR, value_PT: localItem.Description_PT, value_ES: localItem.Description_ES, value_DE: localItem.Description_DE, isModifiedWhen: localItem.Description !== localItemOrig.Description, onValueChanged: handleLocalizedDescriptionChange }), _jsx(WorkitemRecipientsEditor, { tos: localItem.Tos ?? '', mTID: wf?.MTID, qd: qdForRecipientsEditor, onTosChange: handleTosChange, onQDChange: handleSetRuleQDChange }), _jsxs(FlexContainer, { children: [_jsx(TMDropDown, { label: SDKUI_Localizator.WorkflowRecipientSetRule, elementStyle: { width: '320px' }, dataSource: SET_RULE_DATASOURCE, value: localItem.SetRule, isModifiedWhen: localItem.SetRule !== localItemOrig.SetRule, onValueChanged: (e) => { handleSetRuleChange(e.target.value); } }), _jsx(TMCheckBox, { value: localItem.AllowZeroTos ?? 0, label: SDKUI_Localizator.WorkflowAllowZeroTos, isModifiedWhen: localItem.AllowZeroTos !== localItemOrig.AllowZeroTos, onValueChanged: handleAllowZeroTosChange })] }), localItem.Type === DiagramItemTypes.ExecTask &&
344
347
  _jsxs(BoxContainer, { children: [_jsx(HeaderContainer, { children: _jsx("span", { children: SDKUI_Localizator.Application }) }), renderAppFields()] })] }));
345
348
  };
346
349
  // Function to render UpdateDcmt-specific fields
@@ -396,7 +399,7 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
396
399
  break;
397
400
  }
398
401
  }, []);
399
- return (_jsxs(_Fragment, { children: [_jsx(TMLocalizedTextBox, { label: SDKUI_Localizator.Description, value: localItem.Description, value_IT: localItem.Description_IT, value_EN: localItem.Description_EN, value_FR: localItem.Description_FR, value_PT: localItem.Description_PT, value_ES: localItem.Description_ES, value_DE: localItem.Description_DE, onValueChanged: handleLocalizedDescriptionChange }), _jsxs(BoxContainer, { children: [_jsx(HeaderContainer, { children: _jsx(TMTidViewer, { tid: wf?.MTID, showIcon: true }) }), _jsx(TMMetadataValues, { TID: wf?.MTID, isExpertMode: true, checkPerms: false, showCheckBoxes: ShowCheckBoxesMode.AlwaysReadOnly, showNullValueCheckBoxes: true, metadataValues: metadataValues, metadataValuesOrig: metadataValuesOrig, validationItems: validationItems, isOpenDistinctValues: showDistinctValuesPanel, selectedMID: focusedMetadataValue?.mid, onFocusedItemChanged: (item) => setFocusedMetadataValue(item), onAdvancedMenuClick: handleAdvancedMenuClick, onValueChanged: handleMetadataValuesChanged }), showDistinctValuesPanel && focusedMetadataValue &&
402
+ return (_jsxs(_Fragment, { children: [_jsx(TMLocalizedTextBox, { label: SDKUI_Localizator.Description, value: localItem.Description, value_IT: localItem.Description_IT, value_EN: localItem.Description_EN, value_FR: localItem.Description_FR, value_PT: localItem.Description_PT, value_ES: localItem.Description_ES, value_DE: localItem.Description_DE, isModifiedWhen: localItem.Description !== localItemOrig.Description, onValueChanged: handleLocalizedDescriptionChange }), _jsxs(BoxContainer, { children: [_jsx(HeaderContainer, { children: _jsx(TMTidViewer, { tid: wf?.MTID, showIcon: true }) }), _jsx(TMMetadataValues, { TID: wf?.MTID, isExpertMode: true, checkPerms: false, showCheckBoxes: ShowCheckBoxesMode.AlwaysReadOnly, showNullValueCheckBoxes: true, metadataValues: metadataValues, metadataValuesOrig: metadataValuesOrig, validationItems: validationItems, isOpenDistinctValues: showDistinctValuesPanel, selectedMID: focusedMetadataValue?.mid, onFocusedItemChanged: (item) => setFocusedMetadataValue(item), onAdvancedMenuClick: handleAdvancedMenuClick, onValueChanged: handleMetadataValuesChanged }), showDistinctValuesPanel && focusedMetadataValue &&
400
403
  _jsx(TMDistinctValues, { isModal: true, tid: TID, mid: focusedMetadataValue?.mid, separator: ', ', allowAppendMode: false, onClosePanelCallback: () => setShowDistinctValuesPanel(false), onSelectionChanged: (e) => {
401
404
  if (!e)
402
405
  return;
@@ -414,7 +417,7 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
414
417
  };
415
418
  // Function to render RunApp-specific fields
416
419
  const renderRunAppFields = () => {
417
- return (_jsxs(_Fragment, { children: [_jsx(TMLocalizedTextBox, { label: SDKUI_Localizator.Description, value: localItem.Description, value_IT: localItem.Description_IT, value_EN: localItem.Description_EN, value_FR: localItem.Description_FR, value_PT: localItem.Description_PT, value_ES: localItem.Description_ES, value_DE: localItem.Description_DE, onValueChanged: handleLocalizedDescriptionChange }), renderAppFields()] }));
420
+ return (_jsxs(_Fragment, { children: [_jsx(TMLocalizedTextBox, { label: SDKUI_Localizator.Description, value: localItem.Description, value_IT: localItem.Description_IT, value_EN: localItem.Description_EN, value_FR: localItem.Description_FR, value_PT: localItem.Description_PT, value_ES: localItem.Description_ES, value_DE: localItem.Description_DE, isModifiedWhen: localItem.Description !== localItemOrig.Description, onValueChanged: handleLocalizedDescriptionChange }), renderAppFields()] }));
418
421
  };
419
422
  const renderForm = () => {
420
423
  let specificFields;
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
2
  import { DiagramItemTypes } from './interfaces';
3
+ import { DataListItemDescriptor } from '@topconsultnpm/sdk-ts-beta';
3
4
  interface DiagramItemSvgContentProps {
4
5
  itemType: DiagramItemTypes;
5
6
  width: number;
6
7
  height: number;
7
8
  isToolboxPreview?: boolean;
9
+ statusData?: DataListItemDescriptor;
8
10
  }
9
11
  declare const DiagramItemSvgContent: React.FC<DiagramItemSvgContentProps>;
10
12
  export default DiagramItemSvgContent;
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { DiagramItemTypes } from './interfaces'; // Assicurati che il percorso sia corretto
3
3
  import styled from 'styled-components';
4
+ import { TMImageLibrary } from '../../../../helper';
4
5
  // Stili per il contenitore SVG nella toolbox per centrare l'elemento
5
6
  const StyledToolboxSvgContainer = styled.div `
6
7
  width: 100%;
@@ -15,7 +16,7 @@ const StyledToolboxSvgContainer = styled.div `
15
16
  display: block; // Rimuove spazi extra sotto l'SVG
16
17
  }
17
18
  `;
18
- const DiagramItemSvgContent = ({ itemType, width, height, isToolboxPreview = false }) => {
19
+ const DiagramItemSvgContent = ({ itemType, width, height, isToolboxPreview = false, statusData }) => {
19
20
  const PADDING = 10;
20
21
  // ICON_SIZE e SMALL_ICON_SIZE possono essere regolati a seconda se è una preview o l'elemento reale
21
22
  const ICON_SIZE = isToolboxPreview ? Math.min(width, height) * 0.6 : 40;
@@ -39,7 +40,19 @@ const DiagramItemSvgContent = ({ itemType, width, height, isToolboxPreview = fal
39
40
  svgContent = (_jsx("polygon", { points: `${svgCenterX},${PADDING} ${calculatedWidth - PADDING},${svgCenterY} ${svgCenterX},${calculatedHeight - PADDING} ${PADDING},${svgCenterY}`, fill: "#87d1df", stroke: "#62d3e2", strokeWidth: "2" }));
40
41
  break;
41
42
  case DiagramItemTypes.Status:
42
- svgContent = (_jsx("svg", { x: svgCenterX - ICON_SIZE / 2, y: svgCenterY - ICON_SIZE / 2, width: ICON_SIZE, height: ICON_SIZE, viewBox: "0 0 24 24", fill: "orange", children: _jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" }) }));
43
+ // Se i dati non sono disponibili o è una preview, mostra l'icona di fallback
44
+ if (isToolboxPreview || !statusData?.imageID) {
45
+ svgContent = (_jsx("svg", { x: svgCenterX - ICON_SIZE / 2, y: svgCenterY - ICON_SIZE / 2, width: ICON_SIZE, height: ICON_SIZE, viewBox: "0 0 24 24", fill: "orange", children: _jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z" }) }));
46
+ }
47
+ else { // Altrimenti, mostra l'immagine personalizzata
48
+ svgContent = (_jsx("foreignObject", { x: (width - ICON_SIZE) / 2, y: (height - ICON_SIZE) / 2, width: ICON_SIZE, height: ICON_SIZE, children: _jsx("div", { style: {
49
+ display: 'flex',
50
+ alignItems: 'center',
51
+ justifyContent: 'center',
52
+ width: '100%',
53
+ height: '100%'
54
+ }, children: statusData?.imageID && _jsx(TMImageLibrary, { imageID: statusData.imageID }) }) }));
55
+ }
43
56
  break;
44
57
  case DiagramItemTypes.DataEntry:
45
58
  case DiagramItemTypes.Approval:
@@ -3,7 +3,7 @@ import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
3
3
  import { DiagramItemTypes, ArrowSymbol } from './interfaces';
4
4
  import { parseWfDiagramXml } from './xmlParser';
5
5
  import styled from 'styled-components';
6
- import { WorkItemStatus } from "@topconsultnpm/sdk-ts-beta";
6
+ import { CultureIDs, WFAppTypes, WorkItemStatus } from "@topconsultnpm/sdk-ts-beta";
7
7
  import ConnectionComponent from './ConnectionComponent';
8
8
  import DiagramItemComponent from './DiagramItemComponent';
9
9
  import DiagramItemSvgContent from './DiagramItemSvgContent';
@@ -339,12 +339,17 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
339
339
  if (!wfDiagram || (selectedItems.size === 0 && selectedConnections.size === 0)) {
340
340
  return;
341
341
  }
342
+ // 1. Filtra i nodi "Start" e "End" dal set di elementi selezionati
343
+ const nonDeletableItems = wfDiagram.DiagramItems.filter(item => item.Type === DiagramItemTypes.Start || item.Type === DiagramItemTypes.End);
344
+ const deletableSelectedItems = new Set([...selectedItems].filter(id => !nonDeletableItems.some(item => item.ID === id)));
342
345
  let newDiagramItems = wfDiagram.DiagramItems;
343
346
  let newConnections = wfDiagram.Connections;
344
- if (selectedItems.size > 0) {
345
- newDiagramItems = wfDiagram.DiagramItems.filter(item => !selectedItems.has(item.ID));
346
- newConnections = newConnections.filter(conn => !selectedItems.has(conn.Source.ParentDiagramItem.ID) &&
347
- !selectedItems.has(conn.Sink.ParentDiagramItem.ID));
347
+ if (deletableSelectedItems.size > 0) {
348
+ // 2. Filtra gli elementi del diagramma usando il set filtrato
349
+ newDiagramItems = wfDiagram.DiagramItems.filter(item => !deletableSelectedItems.has(item.ID));
350
+ // 3. Filtra le connessioni usando il set filtrato
351
+ newConnections = newConnections.filter(conn => !deletableSelectedItems.has(conn.Source.ParentDiagramItem.ID) &&
352
+ !deletableSelectedItems.has(conn.Sink.ParentDiagramItem.ID));
348
353
  }
349
354
  if (selectedConnections.size > 0) {
350
355
  newConnections = newConnections.filter(conn => !selectedConnections.has(conn.ID));
@@ -354,7 +359,8 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
354
359
  DiagramItems: newDiagramItems,
355
360
  Connections: newConnections,
356
361
  };
357
- setSelectedItems(new Set());
362
+ // Assicura che i nodi non cancellabili restino selezionati per coerenza UI
363
+ setSelectedItems(new Set([...deletableSelectedItems, ...[...selectedItems].filter(id => nonDeletableItems.some(item => item.ID === id))]));
358
364
  setSelectedConnections(new Set());
359
365
  updateDiagram(newWfDiagram, false);
360
366
  }, [wfDiagram, selectedItems, selectedConnections, setWfDiagram, setSelectedItems, setSelectedConnections, updateDiagram, readOnly]);
@@ -1261,6 +1267,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
1261
1267
  Type: draggedItemType,
1262
1268
  ItemName: `New ${DiagramItemTypes[draggedItemType]}`,
1263
1269
  Description: "",
1270
+ ...(draggedItemType === DiagramItemTypes.RunApp || draggedItemType === DiagramItemTypes.ExecTask ? { AppType: WFAppTypes.EXE, FormatCultureID: CultureIDs.It_IT } : {})
1264
1271
  };
1265
1272
  const updatedDiagram = {
1266
1273
  ...wfDiagram,
@@ -1379,7 +1386,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
1379
1386
  }
1380
1387
  }, [wfDiagram]);
1381
1388
  return (_jsxs(CanvasContainer, { children: [!readOnly && (_jsxs(ToolbarContainer, { "$isCollapsed": isToolbarCollapsed, "$isFloating": isToolbarFloating, "$isToolboxVisible": isToolboxVisible, children: [_jsx(ButtonGroup, { "$isFloating": isToolbarFloating, children: _jsxs("button", { onClick: handleToggleToolboxVisibility, title: "Show toolbox", children: [_jsx(IconFlowChart, {}), !isToolbarCollapsed && _jsx("span", { children: "Mostra/nascondi toolbox" })] }) }), _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleUndo, disabled: historyIndex === 0, title: "Undo", children: [_jsx(IconUndo, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "Undo" })] }), _jsxs("button", { onClick: handleRedo, disabled: historyIndex === wfDiagramHistory.length - 1, title: "Redo", children: [_jsx(IconUndo, { style: { transform: 'scaleX(-1)' } }), " ", !isToolbarCollapsed && _jsx("span", { children: "Redo" })] }), _jsxs("button", { onClick: handleRestore, title: "Restore", children: [_jsx(IconRestore, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "Restore" })] }), _jsxs("button", { onClick: handleNew, title: "New diagram", disabled: readOnly, children: [_jsx(IconNew, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "New" })] })] }), _jsx(ButtonGroup, { "$isFloating": isToolbarFloating, children: _jsxs("button", { onClick: handleAutoAdjust, title: "Auto adjust", children: [_jsx(IconAdjust, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "Auto Adjust" })] }) }), _jsxs(ButtonGroup, { "$isFloating": isToolbarFloating, children: [_jsxs("button", { onClick: handleCopy, disabled: selectedItems.size === 0, title: "Copy", children: [_jsx(IconCopy, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "Copy" })] }), _jsxs("button", { onClick: handleCut, disabled: selectedItems.size === 0, title: "Cut", children: [_jsx(IconCut, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "Cut" })] }), _jsxs("button", { onClick: handlePaste, disabled: copiedItems.length === 0 && copiedConnections.length === 0, title: "Paste", children: [_jsx(IconPaste, {}), " ", !isToolbarCollapsed && _jsx("span", { children: "Paste" })] })] }), _jsxs("button", { onClick: handleToggleToolbarMode, title: isToolbarFloating ? "Dock Toolbar" : "Float Toolbar", children: [isToolbarFloating ? _jsx(IconPin, {}) : _jsx(IconUnpin, {}), !isToolbarCollapsed && !isToolbarFloating && _jsx("span", { children: "Toggle Mode" })] }), !isToolbarFloating && _jsx(ToolbarToggle, { onClick: () => setIsToolbarCollapsed(!isToolbarCollapsed), title: isToolbarCollapsed ? "Expand Toolbar" : "Collapse Toolbar", children: isToolbarCollapsed ? _jsx(IconChevronRight, {}) : _jsx(IconCloseOutline, {}) })] })), !readOnly && (_jsx(ToolboxContainer, { "$isVisible": isToolboxVisible, children: isToolboxVisible && availableItemTypes.map(type => (_jsxs(ToolboxItem, { draggable: true, onDragStart: (e) => handleToolboxDragStart(e, type), onDragEnd: handleToolboxDragEnd, children: [_jsx(DiagramItemSvgContent, { itemType: type, width: 40, height: 40, isToolboxPreview: true }), _jsx("span", { children: DiagramItemTypes[type] })] }, type))) })), _jsx(SvgScrollContainer, { children: isLoading ?
1382
- (_jsxs(StyledLoadingContainer, { children: [_jsx(StyledSpinner, {}), _jsx("span", { children: `${'Caricamento diagramma'}...` })] })) : wfDiagram ? (_jsx(StyledSvg, { ref: svgRef, tabIndex: 0, onKeyDownCapture: handleKeyDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseDown: handleMouseDown, onDrop: handleDropOnCanvas, onDragOver: handleDragOver, width: svgWidth, height: svgHeight, children: _jsxs(ScalableGroup, { "$scale": zoomLevel, "$translateX": translateX, "$translateY": translateY, children: [wfDiagram?.DiagramItems.map(item => (_jsx(DiagramItemComponent, { readOnly: readOnly, item: item, isSelected: selectedItems.has(item.ID), isCurrent: item.ID === currentSetID, onClick: handleDiagramItemClick, onDrag: handleDrag, onDragEnd: handleDragEnd, onConnectorMouseDown: handleConnectorMouseDown, onConnectorMouseUp: handleConnectorMouseUp, onDimensionsChange: handleItemDimensionsChange, onDoubleClick: handleDoubleClickItem }, item.ID))), calculatedConnections.map(connection => {
1389
+ (_jsxs(StyledLoadingContainer, { children: [_jsx(StyledSpinner, {}), _jsx("span", { children: `${'Caricamento diagramma'}...` })] })) : wfDiagram ? (_jsx(StyledSvg, { ref: svgRef, tabIndex: 0, onKeyDownCapture: handleKeyDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseDown: handleMouseDown, onDrop: handleDropOnCanvas, onDragOver: handleDragOver, width: svgWidth, height: svgHeight, children: _jsxs(ScalableGroup, { "$scale": zoomLevel, "$translateX": translateX, "$translateY": translateY, children: [wfDiagram?.DiagramItems.map(item => (_jsx(DiagramItemComponent, { wf: wfDiagram?.Info, readOnly: readOnly, item: item, isSelected: selectedItems.has(item.ID), isCurrent: item.ID === currentSetID, onClick: handleDiagramItemClick, onDrag: handleDrag, onDragEnd: handleDragEnd, onConnectorMouseDown: handleConnectorMouseDown, onConnectorMouseUp: handleConnectorMouseUp, onDimensionsChange: handleItemDimensionsChange, onDoubleClick: handleDoubleClickItem }, item.ID))), calculatedConnections.map(connection => {
1383
1390
  const sourceItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Source.ParentDiagramItem.ID);
1384
1391
  const sinkItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Sink.ParentDiagramItem.ID);
1385
1392
  if (!sourceItem || !sinkItem)
@@ -86,8 +86,8 @@ const TMChooserForm = ({ children, title, allowMultipleSelection = false, allowA
86
86
  ...summaryItems ?? {}
87
87
  });
88
88
  }, [manageUseLocalizedName, summaryItems]);
89
- return (_jsx(TMModal, { title: renderTitle(), width: width ?? '550px', height: height ?? '600px', toolbar: _jsx(ToolbarButtons, {}), onClose: onClose, children: (children ??
90
- filteredItems.length > 0)
89
+ return (_jsx(TMModal, { title: renderTitle(), width: width ?? '550px', height: height ?? '600px', toolbar: _jsx(ToolbarButtons, {}), onClose: onClose, children: children ??
90
+ filteredItems.length > 0
91
91
  ? _jsx(TMDataGrid, { dataSource: filteredItems, keyExpr: keyName, dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, searchPanelFocusStarting: true, headerFilter: { visible: true }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single', showCheckBoxesMode: 'always', selectAllMode: 'allPages' }, grouping: allowGrouping ? { autoExpandAll: false, expandMode: 'rowClick' } : undefined, summary: customSummary, onFocusedRowChanged: handleFocusedRowChange, onSelectionChanged: handleSelectionChanged, onRowDblClick: handleRowDoubleClick })
92
92
  : _jsx(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: _jsx(TMLayoutItem, { children: _jsx("p", { style: { height: "100%", color: TMColors.primaryColor, fontSize: "1.5rem", display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: SDKUI_Localizator.NoDataToDisplay }) }) }) }));
93
93
  };
@@ -49,6 +49,7 @@ export * from './choosers/TMInvoiceRetrieveFormats';
49
49
  export * from './choosers/TMMetadataChooser';
50
50
  export * from './choosers/TMOrderRetrieveFormats';
51
51
  export * from './choosers/TMUserChooser';
52
+ export * from './choosers/TMPathChooser';
52
53
  export { default as TMValidationItemsList } from './grids/TMValidationItemsList';
53
54
  export { default as TMBlogs } from './grids/TMBlogs';
54
55
  export { default as TMBlogCommentForm } from './features/blog/TMBlogCommentForm';
@@ -52,6 +52,7 @@ export * from './choosers/TMInvoiceRetrieveFormats';
52
52
  export * from './choosers/TMMetadataChooser';
53
53
  export * from './choosers/TMOrderRetrieveFormats';
54
54
  export * from './choosers/TMUserChooser';
55
+ export * from './choosers/TMPathChooser';
55
56
  //grids
56
57
  export { default as TMValidationItemsList } from './grids/TMValidationItemsList';
57
58
  // blogs
@@ -70,3 +70,15 @@ export declare function getContrastColor(inputColor: string): {
70
70
  export declare function updateMruTids(currentMruTIDs: number[] | undefined | null, newTid: unknown): number[];
71
71
  /** Remove TID to a list of "most recently used" (MRU) TIDs, keeping a maximum of 10 elements */
72
72
  export declare function removeMruTid(currentMruTIDs: number[] | undefined | null, tidToRemove: unknown): number[];
73
+ export declare class AreaValues {
74
+ aid: number;
75
+ subFolder: string;
76
+ fileName: string;
77
+ }
78
+ export declare class AreaHelper {
79
+ static readonly AreaPathPrefix: string;
80
+ static readonly AreaFolderNamePrefix: string;
81
+ static IsAreaPath(areaPath: string | undefined): boolean;
82
+ static ExtractAreaInfo_1(areaPath: string): AreaValues;
83
+ static ExtractAreaInfo_2(areaPath: string, extractFileName: boolean): AreaValues;
84
+ }
@@ -778,3 +778,56 @@ export function removeMruTid(currentMruTIDs, tidToRemove) {
778
778
  }
779
779
  return updatedMruTIDs;
780
780
  }
781
+ export class AreaValues {
782
+ constructor() {
783
+ this.aid = 0;
784
+ this.subFolder = "";
785
+ this.fileName = "";
786
+ }
787
+ }
788
+ export class AreaHelper {
789
+ static IsAreaPath(areaPath) {
790
+ if (stringIsNullOrEmpty(areaPath))
791
+ return false;
792
+ return areaPath.toLowerCase().startsWith((AreaHelper.AreaPathPrefix + AreaHelper.AreaFolderNamePrefix).toLowerCase());
793
+ }
794
+ // Overloading con diverso numero di paramentri non è supportato (ma solo con diverso tipo)
795
+ // public static void ExtractAreaInfo(string areaPath, out int aid, out string subFolder)
796
+ static ExtractAreaInfo_1(areaPath) {
797
+ let fileName;
798
+ return AreaHelper.ExtractAreaInfo_2(areaPath, false);
799
+ }
800
+ // public static void ExtractAreaInfo(string areaPath, out int aid, out string subFolder, ref string? fileName)
801
+ static ExtractAreaInfo_2(areaPath, extractFileName) {
802
+ let areaValues = new AreaValues();
803
+ areaValues.aid = 0;
804
+ areaValues.subFolder = "";
805
+ if (!AreaHelper.IsAreaPath(areaPath))
806
+ return areaValues;
807
+ areaPath = areaPath.replace(areaPath.substring(0, AreaHelper.AreaPathPrefix.length + AreaHelper.AreaFolderNamePrefix.length), "");
808
+ // areaPath = 5002\BarcodeArchiver\71232\00001.tiff
809
+ let pathTokens = areaPath.split('\\');
810
+ let id = pathTokens[0];
811
+ if (isNaN(parseInt(id)))
812
+ return areaValues;
813
+ areaValues.aid = parseInt(id);
814
+ let subFolders = "";
815
+ let lastFolderIndex = extractFileName ? pathTokens.length - 2 : pathTokens.length - 1;
816
+ let fileNameIndex = lastFolderIndex + 1;
817
+ for (let i = 1; i <= lastFolderIndex; i++) {
818
+ let s = pathTokens[i].trim();
819
+ if (stringIsNullOrEmpty(s))
820
+ continue;
821
+ subFolders += s + "\\";
822
+ }
823
+ if (subFolders.endsWith("\\"))
824
+ subFolders = subFolders.substring(0, subFolders.length - 1);
825
+ areaValues.fileName = (extractFileName && fileNameIndex > 0 && fileNameIndex < pathTokens.length) ? pathTokens[fileNameIndex].trim() : "";
826
+ if (subFolders.length == 0)
827
+ return areaValues;
828
+ areaValues.subFolder = subFolders;
829
+ return areaValues;
830
+ }
831
+ }
832
+ AreaHelper.AreaPathPrefix = "tmarea:\\\\";
833
+ AreaHelper.AreaFolderNamePrefix = "AID_";
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.16.28",
3
+ "version": "6.16.30",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
7
7
  "clean": "powershell Remove-Item lib/ -recurse",
8
8
  "copy-files": "copyfiles -u 1 src/assets/*.* src/assets/ImageLibrary/*.* src/assets/thumbnails/*.* src/assets/IconsS4t/*.* src/assets/Metadata/*.* src/css/tm-sdkui.css lib/",
9
9
  "tm-build": "npm run clean && tsc && npm run copy-files",
10
+ "tm-watch": "tsc -w",
10
11
  "tm-publish": "npm publish",
11
12
  "storybook": "storybook dev -p 6006",
12
13
  "build-storybook": "storybook build"