@topconsultnpm/sdkui-react-beta 6.16.29 → 6.16.31
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.
- package/lib/components/base/TMDataGridExportForm.js +1 -1
- package/lib/components/choosers/TMCultureIDPicker.d.ts +9 -0
- package/lib/components/choosers/TMCultureIDPicker.js +72 -0
- package/lib/components/editors/TMTextExpression.d.ts +1 -0
- package/lib/components/editors/TMTextExpression.js +5 -1
- package/lib/components/features/workflow/diagram/DiagramItemComponent.d.ts +2 -1
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +24 -2
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +69 -11
- package/lib/components/features/workflow/diagram/DiagramItemSvgContent.d.ts +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemSvgContent.js +15 -2
- package/lib/components/features/workflow/diagram/WFDiagram.js +21 -15
- package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.d.ts +6 -0
- package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.js +2 -2
- package/lib/components/features/workflow/diagram/interfaces.d.ts +2 -2
- package/package.json +2 -1
- package/lib/components/base/TMDropDown.d.ts +0 -11
- package/lib/components/base/TMDropDown.js +0 -64
|
@@ -4,12 +4,12 @@ import { Workbook } from 'exceljs';
|
|
|
4
4
|
import { buildValueToLabelMapFromDataColumns, getExceptionMessage, SDKUI_Localizator } from '../../helper';
|
|
5
5
|
import TMCheckBox from '../editors/TMCheckBox';
|
|
6
6
|
import TMButton from './TMButton';
|
|
7
|
-
import TMDropDown from './TMDropDown';
|
|
8
7
|
import TMModal from './TMModal';
|
|
9
8
|
import { TMExceptionBoxManager } from './TMPopUp';
|
|
10
9
|
import { ResultTypes } from '@topconsultnpm/sdk-ts-beta';
|
|
11
10
|
import TMSpinner from './TMSpinner';
|
|
12
11
|
import { TMResultManager } from '../forms/TMResultDialog';
|
|
12
|
+
import TMDropDown from '../editors/TMDropDown';
|
|
13
13
|
const formatDataSource = [
|
|
14
14
|
{ value: 'csv', display: 'CSV' },
|
|
15
15
|
{ value: 'xlsx', display: 'XLSX' },
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CultureIDs } from '@topconsultnpm/sdk-ts-beta';
|
|
3
|
+
import { ITMChooserProps } from '../../ts';
|
|
4
|
+
interface TMCultureIDPickerProps extends ITMChooserProps {
|
|
5
|
+
selectedValue: CultureIDs | undefined;
|
|
6
|
+
onSelectCultureID: (cultureID: CultureIDs) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const TMCultureIDPicker: React.FC<TMCultureIDPickerProps>;
|
|
9
|
+
export default TMCultureIDPicker;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { IconSearch, SDKUI_Localizator } from '../../helper';
|
|
5
|
+
import { CultureIDs } from '@topconsultnpm/sdk-ts-beta';
|
|
6
|
+
import { getCultureIDImg } from '../editors/TMLocalizedTextBox';
|
|
7
|
+
import TMModal from '../base/TMModal';
|
|
8
|
+
import TMSummary from '../editors/TMSummary';
|
|
9
|
+
import { StyledDivHorizontal } from '../..';
|
|
10
|
+
const CULTUREIDs_DATASOURCE = [
|
|
11
|
+
{ value: CultureIDs.It_IT, display: "Italiano", icon: _jsx("img", { src: getCultureIDImg(CultureIDs.It_IT), alt: "Lang", width: 16, height: 16 }) },
|
|
12
|
+
{ value: CultureIDs.Fr_FR, display: "Française", icon: _jsx("img", { src: getCultureIDImg(CultureIDs.Fr_FR), alt: "Lang", width: 16, height: 16 }) },
|
|
13
|
+
{ value: CultureIDs.Pt_PT, display: "Português", icon: _jsx("img", { src: getCultureIDImg(CultureIDs.Pt_PT), alt: "Lang", width: 16, height: 16 }) },
|
|
14
|
+
{ value: CultureIDs.En_US, display: "English", icon: _jsx("img", { src: getCultureIDImg(CultureIDs.En_US), alt: "Lang", width: 16, height: 16 }) },
|
|
15
|
+
{ value: CultureIDs.Es_ES, display: "Español", icon: _jsx("img", { src: getCultureIDImg(CultureIDs.Es_ES), alt: "Lang", width: 16, height: 16 }) },
|
|
16
|
+
{ value: CultureIDs.De_DE, display: "Deutsch", icon: _jsx("img", { src: getCultureIDImg(CultureIDs.De_DE), alt: "Lang", width: 16, height: 16 }) },
|
|
17
|
+
];
|
|
18
|
+
const PickerContainer = styled.div `
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: 10px;
|
|
22
|
+
padding: 20px;
|
|
23
|
+
`;
|
|
24
|
+
const ItemsContainer = styled.div `
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-wrap: wrap;
|
|
27
|
+
gap: 15px;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
`;
|
|
30
|
+
const CultureItem = styled.div `
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
text-align: center;
|
|
37
|
+
font-size: 0.9em;
|
|
38
|
+
padding: 10px 15px;
|
|
39
|
+
border-radius: 8px;
|
|
40
|
+
border: 2px solid transparent;
|
|
41
|
+
transition: all 0.2s ease-in-out;
|
|
42
|
+
width: 120px;
|
|
43
|
+
|
|
44
|
+
&:hover {
|
|
45
|
+
background-color: #f0f0f0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
${props => props.$isSelected && `
|
|
49
|
+
border-color: #007bff;
|
|
50
|
+
background-color: #e6f2ff;
|
|
51
|
+
`}
|
|
52
|
+
`;
|
|
53
|
+
const FlagIcon = styled.div `
|
|
54
|
+
margin-bottom: 5px;
|
|
55
|
+
font-size: 2em;
|
|
56
|
+
`;
|
|
57
|
+
const TMCultureIDPicker = ({ selectedValue, onSelectCultureID, placeHolder, width = '100%', icon, backgroundColor, readOnly = false, openChooserBySingleClick = false, buttons = [], elementStyle, isModifiedWhen, label, showClearButton = false, validationItems = [], onValueChanged }) => {
|
|
58
|
+
const [showPicker, setShowPicker] = useState(false);
|
|
59
|
+
const getCultureIDName = (cultureID) => {
|
|
60
|
+
const item = CULTUREIDs_DATASOURCE.find(c => c.value === cultureID);
|
|
61
|
+
return item ? item.display : '';
|
|
62
|
+
};
|
|
63
|
+
const renderTemplate = () => {
|
|
64
|
+
const isPlaceholder = selectedValue === placeHolder;
|
|
65
|
+
return (_jsxs(StyledDivHorizontal, { style: { width: '100%', color: isPlaceholder ? '#a9a9a9' : 'inherit' }, children: [selectedValue && _jsx("img", { src: getCultureIDImg(selectedValue), alt: "Lang", width: 16, height: 16, style: { marginRight: '8px' } }), selectedValue && _jsx("p", { children: getCultureIDName(selectedValue) })] }));
|
|
66
|
+
};
|
|
67
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { width: width, icon: icon, buttons: buttons, readOnly: readOnly, backgroundColor: backgroundColor, showBorder: true, hasValue: selectedValue !== undefined, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => !readOnly && setShowPicker(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, label: label, openEditorOnSummaryClick: openChooserBySingleClick, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showPicker && _jsx(TMModal, { title: label || SDKUI_Localizator.Select, onClose: () => setShowPicker(false), isModal: true, width: "450px", height: "255px", children: _jsx(PickerContainer, { children: _jsx(ItemsContainer, { children: CULTUREIDs_DATASOURCE.map(item => (_jsxs(CultureItem, { "$isSelected": item.value === selectedValue, onClick: () => {
|
|
68
|
+
onSelectCultureID(item.value);
|
|
69
|
+
setShowPicker(false);
|
|
70
|
+
}, children: [_jsx(FlagIcon, { children: item.icon }), _jsx("span", { children: item.display })] }, item.value))) }) }) })] }));
|
|
71
|
+
};
|
|
72
|
+
export default TMCultureIDPicker;
|
|
@@ -14,6 +14,7 @@ interface ITMTextExpression extends ITMEditorBase {
|
|
|
14
14
|
widthChooser?: string;
|
|
15
15
|
disableMultipleSelection?: boolean;
|
|
16
16
|
validationItems?: ValidationItem[];
|
|
17
|
+
rows?: number;
|
|
17
18
|
onValueChanged?: (newText: string | undefined) => void;
|
|
18
19
|
}
|
|
19
20
|
declare const TMTextExpression: React.FunctionComponent<ITMTextExpression>;
|
|
@@ -6,6 +6,7 @@ import { TMExceptionBoxManager } from '../base/TMPopUp';
|
|
|
6
6
|
import { TMMetadataChooserForm } from '../choosers/TMMetadataChooser';
|
|
7
7
|
import TMChooserForm from '../forms/TMChooserForm';
|
|
8
8
|
import TMTextBox from './TMTextBox';
|
|
9
|
+
import TMTextArea from './TMTextArea';
|
|
9
10
|
const TMTextExpression = (props) => {
|
|
10
11
|
const [metadatas_Info_Source, setMetadatas_Info_Source] = useState([]);
|
|
11
12
|
const [showMetadataChooser, setShowMetadataChooser] = useState(false);
|
|
@@ -153,7 +154,10 @@ const TMTextExpression = (props) => {
|
|
|
153
154
|
props.onValueChanged?.(expr);
|
|
154
155
|
} }) : _jsx(_Fragment, {}));
|
|
155
156
|
};
|
|
156
|
-
return (_jsxs(_Fragment, { children: [
|
|
157
|
+
return (_jsxs(_Fragment, { children: [props.rows === undefined ?
|
|
158
|
+
_jsx(TMTextBox, { buttons: renderButtons(), isModifiedWhen: props.value != props.valueOrig, label: props.label, value: Expression_IDs2Names(props.value) ?? '', validationItems: props.validationItems, onValueChanged: (e) => { props.onValueChanged?.(Expression_Names2IDs(e.target.value)); } })
|
|
159
|
+
:
|
|
160
|
+
_jsx(TMTextArea, { buttons: renderButtons(), isModifiedWhen: props.value != props.valueOrig, label: props.label, rows: props.rows, resize: false, placeHolder: props.placeHolder, value: Expression_IDs2Names(props.value) ?? '', validationItems: props.validationItems, onValueChanged: (e) => { props.onValueChanged?.(Expression_Names2IDs(e.target.value)); } }), openMetadataChooseForm(), " ", openFormulaChooseForm()] }));
|
|
157
161
|
};
|
|
158
162
|
class MetatadaHelper {
|
|
159
163
|
constructor(mid, metadataName) {
|
|
@@ -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
|
};
|
|
@@ -10,10 +10,10 @@ import TMTextBox from '../../../editors/TMTextBox';
|
|
|
10
10
|
import TMButton from '../../../base/TMButton';
|
|
11
11
|
import styled from 'styled-components';
|
|
12
12
|
import TMQuerySummary from '../../../query/TMQuerySummary';
|
|
13
|
-
import { CultureIDs, DcmtTypeListCacheService, FromItem, MetadataDataDomains, SDK_Globals, SearchEngine, WFAppTypes, WorkItemSetRules } from '@topconsultnpm/sdk-ts-beta';
|
|
14
|
-
import TMLocalizedTextBox
|
|
13
|
+
import { CultureIDs, DcmtTypeListCacheService, FromItem, MetadataDataDomains, SDK_Globals, SearchEngine, Severities, WFAppTypes, WorkItemSetRules } from '@topconsultnpm/sdk-ts-beta';
|
|
14
|
+
import TMLocalizedTextBox from '../../../editors/TMLocalizedTextBox';
|
|
15
15
|
import TMDataListItemPicker from '../../../choosers/TMDataListItemPicker';
|
|
16
|
-
import WorkitemRecipientsEditor from './WorkitemRecipientsEditor';
|
|
16
|
+
import WorkitemRecipientsEditor, { actorsToTos, tosToActors } from './WorkitemRecipientsEditor';
|
|
17
17
|
import TMDropDown from '../../../editors/TMDropDown';
|
|
18
18
|
import TMMetadataValues, { AdvancedMenuButtons, ShowCheckBoxesMode } from '../../../editors/TMMetadataValues';
|
|
19
19
|
import TMFormulaEditor, { FormulaDescriptor, FormulaHelper, FormulaTargets } from '../../../editors/TMFormulaEditor';
|
|
@@ -22,6 +22,8 @@ import TMTidViewer from '../../../viewers/TMTidViewer';
|
|
|
22
22
|
import { TMColors } from '../../../../utils/theme';
|
|
23
23
|
import TMPathChooser from '../../../choosers/TMPathChooser';
|
|
24
24
|
import TMTextExpression from '../../../editors/TMTextExpression';
|
|
25
|
+
import TMCultureIDPicker from '../../../choosers/TMCultureIDPicker';
|
|
26
|
+
import RecipientList, { WorkItemActorTypes } from './RecipientList';
|
|
25
27
|
const FormContainer = styled.div `
|
|
26
28
|
display: flex;
|
|
27
29
|
flex-direction: column;
|
|
@@ -60,13 +62,11 @@ const SET_RULE_DATASOURCE = [
|
|
|
60
62
|
{ value: WorkItemSetRules.Ands_AND_Ors, display: "Ands_AND_Ors" },
|
|
61
63
|
{ value: WorkItemSetRules.Ands_OR_Ors, display: "Ands_OR_Ors" }
|
|
62
64
|
];
|
|
63
|
-
const
|
|
64
|
-
{ value:
|
|
65
|
-
{ value:
|
|
66
|
-
{ value:
|
|
67
|
-
{ value:
|
|
68
|
-
{ value: CultureIDs.Es_ES, display: "Español", icon: _jsx("img", { src: getCultureIDImg(CultureIDs.Es_ES), alt: "Lang", width: 16, height: 16 }) },
|
|
69
|
-
{ value: CultureIDs.De_DE, display: "Deutsch", icon: _jsx("img", { src: getCultureIDImg(CultureIDs.De_DE), alt: "Lang", width: 16, height: 16 }) },
|
|
65
|
+
const SEVERITY_DATASOURCE = [
|
|
66
|
+
{ value: Severities.Critical, display: "Critical" },
|
|
67
|
+
{ value: Severities.Error, display: "Error" },
|
|
68
|
+
{ value: Severities.Warning, display: "Warning" },
|
|
69
|
+
{ value: Severities.Information, display: "Information" },
|
|
70
70
|
];
|
|
71
71
|
const APP_TYPES_DATASOURCE = [
|
|
72
72
|
{ value: WFAppTypes.EXE, display: "EXE" },
|
|
@@ -117,6 +117,10 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
|
|
|
117
117
|
width = '450px';
|
|
118
118
|
height = '420px';
|
|
119
119
|
break;
|
|
120
|
+
case DiagramItemTypes.Notification:
|
|
121
|
+
width = '700px';
|
|
122
|
+
height = '700px';
|
|
123
|
+
break;
|
|
120
124
|
default:
|
|
121
125
|
width = '50%';
|
|
122
126
|
height = '50%';
|
|
@@ -331,7 +335,7 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
|
|
|
331
335
|
const renderAppFields = () => {
|
|
332
336
|
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
337
|
? _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(
|
|
338
|
+
: _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(TMCultureIDPicker, { label: SDKUI_Localizator.Format, selectedValue: localItem.FormatCultureID, isModifiedWhen: localItem.FormatCultureID !== localItemOrig.FormatCultureID, openChooserBySingleClick: true, onSelectCultureID: handleFormatCultureIDChange })] }));
|
|
335
339
|
};
|
|
336
340
|
// Function to render Approval-specific fields
|
|
337
341
|
const renderApprovalFields = () => {
|
|
@@ -419,6 +423,57 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
|
|
|
419
423
|
const renderRunAppFields = () => {
|
|
420
424
|
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()] }));
|
|
421
425
|
};
|
|
426
|
+
const handleRegAsWfInstPartChange = useCallback((newValue) => {
|
|
427
|
+
setLocalItem(prevLocalItem => ({
|
|
428
|
+
...prevLocalItem,
|
|
429
|
+
RegAsWfInstPart: newValue
|
|
430
|
+
}));
|
|
431
|
+
}, []);
|
|
432
|
+
const renderNotificationFields = () => {
|
|
433
|
+
const qdForRecipientsEditor = localItem.QD ?? SearchEngine.NewQueryDescriptor();
|
|
434
|
+
if (!qdForRecipientsEditor.from) {
|
|
435
|
+
qdForRecipientsEditor.from = new FromItem();
|
|
436
|
+
}
|
|
437
|
+
qdForRecipientsEditor.from.tid = wf?.MTID;
|
|
438
|
+
const { andRecipients } = useMemo(() => {
|
|
439
|
+
return tosToActors(localItem.Tos ?? '');
|
|
440
|
+
}, [localItem.Tos]);
|
|
441
|
+
const handleQDChosen = useCallback((newQd, orValue) => {
|
|
442
|
+
const allRecipients = [...andRecipients];
|
|
443
|
+
const updatedRecipients = allRecipients.filter(r => r.ActorType !== WorkItemActorTypes.QID);
|
|
444
|
+
const recipientToAdd = {
|
|
445
|
+
ActorType: WorkItemActorTypes.QID,
|
|
446
|
+
ActorID: newQd.id ? newQd.id.toString() : '-1',
|
|
447
|
+
Or: orValue,
|
|
448
|
+
};
|
|
449
|
+
updatedRecipients.push(recipientToAdd);
|
|
450
|
+
const newTos = actorsToTos(updatedRecipients);
|
|
451
|
+
handleTosChange(newTos);
|
|
452
|
+
handleSetRuleQDChange(newQd);
|
|
453
|
+
}, [andRecipients]);
|
|
454
|
+
const handleAddRecipients = useCallback((newRecipients, orValue) => {
|
|
455
|
+
const { andRecipients } = tosToActors(localItem.Tos ?? '');
|
|
456
|
+
let allRecipients = [...andRecipients];
|
|
457
|
+
// 1. Rimuovi qualsiasi QID esistente se il nuovo destinatario è una query
|
|
458
|
+
if (newRecipients.length > 0 && newRecipients[0].ActorType === WorkItemActorTypes.QID) {
|
|
459
|
+
allRecipients = allRecipients.filter(r => r.ActorType !== WorkItemActorTypes.QID);
|
|
460
|
+
}
|
|
461
|
+
const updatedRecipients = [...allRecipients, ...newRecipients.map(r => ({ ...r, Or: orValue }))];
|
|
462
|
+
const newTos = actorsToTos(updatedRecipients);
|
|
463
|
+
handleTosChange(newTos);
|
|
464
|
+
}, [localItem.Tos, handleTosChange]);
|
|
465
|
+
const handleRemoveRecipient = useCallback((recipientToRemove) => {
|
|
466
|
+
const { andRecipients } = tosToActors(localItem.Tos ?? '');
|
|
467
|
+
const allRecipients = [...andRecipients];
|
|
468
|
+
const updatedRecipients = allRecipients.filter(r => r.ActorType !== recipientToRemove.ActorType || r.ActorID !== recipientToRemove.ActorID || r.Or !== recipientToRemove.Or);
|
|
469
|
+
const newTos = actorsToTos(updatedRecipients);
|
|
470
|
+
handleTosChange(newTos);
|
|
471
|
+
if (recipientToRemove.ActorType === WorkItemActorTypes.QID) {
|
|
472
|
+
handleSetRuleQDChange(undefined);
|
|
473
|
+
}
|
|
474
|
+
}, [localItem]);
|
|
475
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMTextExpression, { label: SDKUI_Localizator.Description, placeHolder: 'Inserire il testo della notifica...', rows: 3, value: localItem.Description, tid: wf?.MTID, isModifiedWhen: (localItem.Description ?? '') !== (localItemOrig.Description ?? ''), onValueChanged: (newValue) => handleLocalizedDescriptionChange(CultureIDs.None, newValue ?? ''), valueOrig: undefined }), _jsx(TMDropDown, { label: "Gravit\u00E0", dataSource: SEVERITY_DATASOURCE, value: localItem.Severity, isModifiedWhen: localItem.Severity !== localItemOrig.Severity, onValueChanged: (e) => setLocalItem(prevLocalItem => ({ ...prevLocalItem, Severity: e.target.value })) }), _jsx(TMCultureIDPicker, { label: SDKUI_Localizator.Format, selectedValue: localItem.FormatCultureID, isModifiedWhen: localItem.FormatCultureID !== localItemOrig.FormatCultureID, openChooserBySingleClick: true, onSelectCultureID: handleFormatCultureIDChange }), _jsx(TMCheckBox, { value: localItem.RegAsWfInstPart ?? 0, label: "Registra i destinatari della notifica come partecipanti dell'istanza di flusso", isModifiedWhen: localItem.RegAsWfInstPart !== localItemOrig.RegAsWfInstPart, onValueChanged: handleRegAsWfInstPartChange }), _jsx(RecipientList, { recipients: andRecipients, title: "Destinatari", tid: wf?.MTID, qd: qdForRecipientsEditor, onQDChange: (newQd) => newQd && handleQDChosen(newQd, 0), onAdd: (newRecipients) => handleAddRecipients(newRecipients, 0), onRemove: handleRemoveRecipient })] }));
|
|
476
|
+
};
|
|
422
477
|
const renderForm = () => {
|
|
423
478
|
let specificFields;
|
|
424
479
|
switch (localItem.Type) {
|
|
@@ -448,6 +503,9 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
|
|
|
448
503
|
case DiagramItemTypes.RunApp:
|
|
449
504
|
specificFields = renderRunAppFields();
|
|
450
505
|
break;
|
|
506
|
+
case DiagramItemTypes.Notification:
|
|
507
|
+
specificFields = renderNotificationFields();
|
|
508
|
+
break;
|
|
451
509
|
default:
|
|
452
510
|
specificFields = null;
|
|
453
511
|
}
|
|
@@ -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
|
-
|
|
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:
|
|
@@ -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 (
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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
|
-
|
|
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]);
|
|
@@ -593,7 +599,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
593
599
|
const isNonLinearConnection = isConnectionNonLinear(sourceRect, sinkRect, sourceConnectorName, sinkConnectorName);
|
|
594
600
|
let pathPoints = [];
|
|
595
601
|
let sinkArrowAngle = 0;
|
|
596
|
-
const
|
|
602
|
+
const offsetStub = 15;
|
|
597
603
|
const bypassBuffer = 50;
|
|
598
604
|
const getDirection = (connectorName) => {
|
|
599
605
|
if (connectorName === 'Left' || connectorName === 'Right')
|
|
@@ -605,16 +611,16 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
605
611
|
let startStubPoint;
|
|
606
612
|
switch (connection.Source.ConnectorName) {
|
|
607
613
|
case 'Right':
|
|
608
|
-
startStubPoint = { x: sourcePoint.x +
|
|
614
|
+
startStubPoint = { x: sourcePoint.x + offsetStub, y: sourcePoint.y };
|
|
609
615
|
break;
|
|
610
616
|
case 'Left':
|
|
611
|
-
startStubPoint = { x: sourcePoint.x -
|
|
617
|
+
startStubPoint = { x: sourcePoint.x - offsetStub, y: sourcePoint.y };
|
|
612
618
|
break;
|
|
613
619
|
case 'Bottom':
|
|
614
|
-
startStubPoint = { x: sourcePoint.x, y: sourcePoint.y +
|
|
620
|
+
startStubPoint = { x: sourcePoint.x, y: sourcePoint.y + offsetStub };
|
|
615
621
|
break;
|
|
616
622
|
case 'Top':
|
|
617
|
-
startStubPoint = { x: sourcePoint.x, y: sourcePoint.y -
|
|
623
|
+
startStubPoint = { x: sourcePoint.x, y: sourcePoint.y - offsetStub };
|
|
618
624
|
break;
|
|
619
625
|
default: startStubPoint = sourcePoint;
|
|
620
626
|
}
|
|
@@ -623,16 +629,16 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
623
629
|
let endStubPoint;
|
|
624
630
|
switch (connection.Sink.ConnectorName) {
|
|
625
631
|
case 'Right':
|
|
626
|
-
endStubPoint = { x: sinkPoint.x +
|
|
632
|
+
endStubPoint = { x: sinkPoint.x + offsetStub, y: sinkPoint.y };
|
|
627
633
|
break;
|
|
628
634
|
case 'Left':
|
|
629
|
-
endStubPoint = { x: sinkPoint.x -
|
|
635
|
+
endStubPoint = { x: sinkPoint.x - offsetStub, y: sinkPoint.y };
|
|
630
636
|
break;
|
|
631
637
|
case 'Bottom':
|
|
632
|
-
endStubPoint = { x: sinkPoint.x, y: sinkPoint.y +
|
|
638
|
+
endStubPoint = { x: sinkPoint.x, y: sinkPoint.y + offsetStub };
|
|
633
639
|
break;
|
|
634
640
|
case 'Top':
|
|
635
|
-
endStubPoint = { x: sinkPoint.x, y: sinkPoint.y -
|
|
641
|
+
endStubPoint = { x: sinkPoint.x, y: sinkPoint.y - offsetStub };
|
|
636
642
|
break;
|
|
637
643
|
default: endStubPoint = sinkPoint;
|
|
638
644
|
}
|
|
@@ -1380,7 +1386,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1380
1386
|
}
|
|
1381
1387
|
}, [wfDiagram]);
|
|
1382
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 ?
|
|
1383
|
-
(_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 => {
|
|
1384
1390
|
const sourceItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Source.ParentDiagramItem.ID);
|
|
1385
1391
|
const sinkItem = wfDiagram?.DiagramItems.find(item => item.ID === connection.Sink.ParentDiagramItem.ID);
|
|
1386
1392
|
if (!sourceItem || !sinkItem)
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { QueryDescriptor } from '@topconsultnpm/sdk-ts-beta';
|
|
3
|
+
import { WorkItemActor } from './RecipientList';
|
|
4
|
+
export declare const tosToActors: (tosString: string) => {
|
|
5
|
+
andRecipients: WorkItemActor[];
|
|
6
|
+
orRecipients: WorkItemActor[];
|
|
7
|
+
};
|
|
8
|
+
export declare const actorsToTos: (actors: WorkItemActor[]) => string;
|
|
3
9
|
interface WorkitemRecipientsEditorProps {
|
|
4
10
|
tos: string;
|
|
5
11
|
qd: QueryDescriptor | undefined;
|
|
@@ -7,7 +7,7 @@ const RecipientsContainer = styled.div `
|
|
|
7
7
|
gap: 20px;
|
|
8
8
|
flex-wrap: wrap;
|
|
9
9
|
`;
|
|
10
|
-
const tosToActors = (tosString) => {
|
|
10
|
+
export const tosToActors = (tosString) => {
|
|
11
11
|
const andRecipients = [];
|
|
12
12
|
const orRecipients = [];
|
|
13
13
|
if (!tosString)
|
|
@@ -40,7 +40,7 @@ const tosToActors = (tosString) => {
|
|
|
40
40
|
}
|
|
41
41
|
return { andRecipients, orRecipients };
|
|
42
42
|
};
|
|
43
|
-
const actorsToTos = (actors) => {
|
|
43
|
+
export const actorsToTos = (actors) => {
|
|
44
44
|
return actors.map(actor => `${WorkItemActorTypes[actor.ActorType]}|${actor.ActorID}|${actor.Or}`).join(';');
|
|
45
45
|
};
|
|
46
46
|
const WorkitemRecipientsEditor = ({ tos, qd, mTID, onTosChange, onQDChange }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CultureIDs, QueryDescriptor, WFAppTypes, WorkItemSetRules, WorkItemStatus } from "@topconsultnpm/sdk-ts-beta";
|
|
1
|
+
import { CultureIDs, QueryDescriptor, Severities, WFAppTypes, WorkItemSetRules, WorkItemStatus } from "@topconsultnpm/sdk-ts-beta";
|
|
2
2
|
import { MetadataValueDescriptorEx } from "../../../../ts";
|
|
3
3
|
export declare enum DiagramItemTypes {
|
|
4
4
|
None = 0,
|
|
@@ -66,7 +66,7 @@ export interface DiagramItem {
|
|
|
66
66
|
QD?: QueryDescriptor;
|
|
67
67
|
SOD?: string;
|
|
68
68
|
MetadataValues?: MetadataValueDescriptorEx[];
|
|
69
|
-
Severity?:
|
|
69
|
+
Severity?: Severities;
|
|
70
70
|
RegAsWfInstPart?: number;
|
|
71
71
|
FormatCultureID?: CultureIDs | undefined;
|
|
72
72
|
Tos2?: string;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topconsultnpm/sdkui-react-beta",
|
|
3
|
-
"version": "6.16.
|
|
3
|
+
"version": "6.16.31",
|
|
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"
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Colors, ITMEditorBase } from './TMEditorBase';
|
|
3
|
-
interface ITMDropDown extends ITMEditorBase {
|
|
4
|
-
dataSource?: any[];
|
|
5
|
-
color?: Colors;
|
|
6
|
-
value?: string | number;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
onValueChanged?: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
9
|
-
}
|
|
10
|
-
declare const TMDropDown: React.FC<ITMDropDown>;
|
|
11
|
-
export default TMDropDown;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { FontSize } from '../../utils/theme';
|
|
5
|
-
import { getColor } from "../../helper/helpers";
|
|
6
|
-
const StyledDropDownContainer = styled.div.withConfig({ shouldForwardProp: prop => !['labelPosition'].includes(prop) }) `
|
|
7
|
-
width: ${props => props.width};
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: ${props => props.labelPosition === 'left' ? 'row' : 'column'};
|
|
10
|
-
justify-content: flex-start;
|
|
11
|
-
align-items: ${props => props.labelPosition === 'left' ? 'center' : 'flex-start'};;
|
|
12
|
-
position: relative;
|
|
13
|
-
`;
|
|
14
|
-
const StyledDropDown = styled.select.withConfig({ shouldForwardProp: prop => !['flexBase'].includes(prop) }) `
|
|
15
|
-
width: ${props => props.width};
|
|
16
|
-
padding: 3px 15px 3px 5px;
|
|
17
|
-
border: 1px solid;
|
|
18
|
-
border-color: ${props => !props.disabled ? getColor(props.color) : 'rgb(180,180,180)'};;
|
|
19
|
-
color: ${props => getColor(props.color)};
|
|
20
|
-
border-radius: 5px;
|
|
21
|
-
min-width: 70px;
|
|
22
|
-
/* &:focus{
|
|
23
|
-
outline: none;
|
|
24
|
-
} */
|
|
25
|
-
font-size: ${props => props.fontSize};
|
|
26
|
-
flex: ${props => 10 - props.flexBase};
|
|
27
|
-
&::placeholder {
|
|
28
|
-
/* color: ${props => getColor(props.color)}; */
|
|
29
|
-
font-size: ${props => props.fontSize};
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
const StyledDropDownIcon = styled.div.withConfig({ shouldForwardProp: prop => !['labelPosition'].includes(prop) }) `
|
|
33
|
-
color: ${props => !props.disabled ? getColor(props.color) : 'rgb(180,180,180)'};
|
|
34
|
-
width: 25px;
|
|
35
|
-
height: 25px;
|
|
36
|
-
margin-right: 2px;
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
justify-content: center;
|
|
40
|
-
font-size: 18px;
|
|
41
|
-
user-select: none;
|
|
42
|
-
`;
|
|
43
|
-
const StyledDropDownLabel = styled.div.withConfig({ shouldForwardProp: prop => !['flexBase'].includes(prop) }) `
|
|
44
|
-
font-size: ${props => props.fontSize} ;
|
|
45
|
-
color: ${props => !props.disabled ? getColor(props.color) : 'rgb(180,180,180)'};
|
|
46
|
-
flex: ${props => props.flexBase};
|
|
47
|
-
transform: translateY(1px);
|
|
48
|
-
user-select: none;
|
|
49
|
-
padding-right: 10px;
|
|
50
|
-
`;
|
|
51
|
-
const TMDropDown = ({ disabled = false, elementStyle, isModifiedWhen, labelPosition = 'left', flexBase = 1, label, icon, width = '100%', fontSize = FontSize.defaultFontSize, dataSource, color = 'primary', value, onValueChanged }) => {
|
|
52
|
-
const [currentColor, setCurrentColor] = useState(color);
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
setCurrentColor(isModifiedWhen ? 'tertiary' : color);
|
|
55
|
-
}, [isModifiedWhen, color]);
|
|
56
|
-
const renderedLeftLabelTextBox = () => {
|
|
57
|
-
return (_jsx("div", { style: { display: 'flex', flexDirection: 'column', justifyContent: 'flex-start', alignItems: 'flex-start', width: '100%' }, children: _jsxs(StyledDropDownContainer, { labelPosition: labelPosition, width: width, children: [icon && _jsx(StyledDropDownIcon, { disabled: disabled, labelPosition: labelPosition, color: currentColor, children: icon }), label && _jsx(StyledDropDownLabel, { disabled: disabled, flexBase: flexBase, color: currentColor, fontSize: fontSize, children: label }), _jsx(StyledDropDown, { disabled: disabled, flexBase: flexBase, fontSize: fontSize, width: width, color: currentColor, value: value, onChange: onValueChanged, children: dataSource?.map((data, index) => (_jsx("option", { value: data.value, children: data.display }, index))) })] }) }));
|
|
58
|
-
};
|
|
59
|
-
const renderedTopLabelTextBox = () => {
|
|
60
|
-
return (_jsxs(StyledDropDownContainer, { labelPosition: labelPosition, width: width, children: [_jsx("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginBottom: '2px', marginTop: '3px', width: '100%' }, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center' }, children: [icon && _jsx(StyledDropDownIcon, { disabled: disabled, labelPosition: labelPosition, color: currentColor, children: icon }), label && _jsx(StyledDropDownLabel, { disabled: disabled, flexBase: flexBase, color: currentColor, fontSize: fontSize, children: label })] }) }), _jsx("div", { style: { width: '100%', display: 'flex', flexDirection: 'row', position: 'relative' }, children: _jsx(StyledDropDown, { disabled: disabled, flexBase: flexBase, fontSize: fontSize, width: width, color: currentColor, value: value, onChange: onValueChanged, children: dataSource?.map((data, index) => (_jsx("option", { value: data.value, children: data.display }, index))) }) })] }));
|
|
61
|
-
};
|
|
62
|
-
return (_jsx("div", { style: elementStyle, children: labelPosition === 'left' ? renderedLeftLabelTextBox() : renderedTopLabelTextBox() }));
|
|
63
|
-
};
|
|
64
|
-
export default TMDropDown;
|