@topconsultnpm/sdkui-react-beta 6.16.28 → 6.16.29
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/choosers/TMPathChooser.d.ts +12 -0
- package/lib/components/choosers/TMPathChooser.js +147 -0
- package/lib/components/editors/TMLocalizedTextBox.d.ts +1 -0
- package/lib/components/editors/TMLocalizedTextBox.js +2 -2
- package/lib/components/editors/TMTextExpression.d.ts +1 -0
- package/lib/components/editors/TMTextExpression.js +28 -4
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +10 -7
- package/lib/components/features/workflow/diagram/WFDiagram.js +2 -1
- package/lib/components/forms/TMChooserForm.js +2 -2
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/helper/helpers.d.ts +12 -0
- package/lib/helper/helpers.js +53 -0
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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
|
|
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
|
|
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, {}));
|
|
@@ -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);
|
|
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,
|
|
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;
|
|
@@ -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';
|
|
@@ -1261,6 +1261,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, readOnly = false, zoomLevel
|
|
|
1261
1261
|
Type: draggedItemType,
|
|
1262
1262
|
ItemName: `New ${DiagramItemTypes[draggedItemType]}`,
|
|
1263
1263
|
Description: "",
|
|
1264
|
+
...(draggedItemType === DiagramItemTypes.RunApp || draggedItemType === DiagramItemTypes.ExecTask ? { AppType: WFAppTypes.EXE, FormatCultureID: CultureIDs.It_IT } : {})
|
|
1264
1265
|
};
|
|
1265
1266
|
const updatedDiagram = {
|
|
1266
1267
|
...wfDiagram,
|
|
@@ -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:
|
|
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';
|
package/lib/components/index.js
CHANGED
|
@@ -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
|
package/lib/helper/helpers.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/lib/helper/helpers.js
CHANGED
|
@@ -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_";
|