@topconsultnpm/sdkui-react 6.20.0-dev3.15 → 6.20.0-dev3.17
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/TMPopUp.js +4 -0
- package/lib/components/choosers/TMDataListItemFields.js +1 -1
- package/lib/components/choosers/TMDataListItemPicker.d.ts +1 -0
- package/lib/components/choosers/TMDataListItemPicker.js +5 -1
- package/lib/components/choosers/TMUserChooser.js +1 -1
- package/lib/components/features/tasks/TMTaskFormUtils.js +1 -1
- package/lib/components/features/workflow/diagram/DiagramItemForm.d.ts +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +32 -25
- package/lib/components/features/workflow/diagram/RecipientList.d.ts +3 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +13 -9
- package/lib/components/features/workflow/diagram/WFDiagram.js +13 -1
- package/lib/components/features/workflow/diagram/workflowHelpers.js +11 -0
- package/lib/components/viewers/TMMidViewer.js +2 -1
- package/lib/helper/SDKUI_Localizator.d.ts +2 -0
- package/lib/helper/SDKUI_Localizator.js +20 -0
- package/lib/hooks/useDataUserIdItem.js +2 -2
- package/package.json +1 -1
|
@@ -258,6 +258,10 @@ const TMMessageBox = ({ resizable = false, onButtonClick, title = 'TopMedia', me
|
|
|
258
258
|
const el = document.getElementById('tm-messagebox-wrapper');
|
|
259
259
|
if (el)
|
|
260
260
|
el.style.zIndex = '20000';
|
|
261
|
+
// Blocca traduzione sul titolo
|
|
262
|
+
const titleEl = el?.querySelector('.dx-popup-title');
|
|
263
|
+
if (titleEl)
|
|
264
|
+
titleEl.setAttribute('translate', 'no');
|
|
261
265
|
}, onResizeEnd: handleResizeEnd, wrapperAttr: { id: 'tm-messagebox-wrapper' }, children: _jsx(ResponsiveMessageBody, { message: message, isMobile: isMobile, MessageToolbar: MessageToolbar, showToppy: showToppy }) }));
|
|
262
266
|
};
|
|
263
267
|
const TMExceptionBox = ({ resizable = false, exception, title = `${SDK_Globals.appModule} v. ${SDK_Globals.appVersion}`, onClose }) => {
|
|
@@ -56,6 +56,6 @@ const TMDataListItemFields = ({ item, originalItem, onItemChanged, validationIte
|
|
|
56
56
|
Object.assign(clone, item);
|
|
57
57
|
onItemChanged(clone);
|
|
58
58
|
};
|
|
59
|
-
return (_jsxs(FieldsContainer, { children: [_jsx(TMTextBox, { label: SDKUI_Localizator.Value, value: item.value, isModifiedWhen: (item.value || '') != (originalItem?.value || ''), validationItems: validationItems.filter(o => o.PropertyName === "value"), readOnly: readOnly, onValueChanged: handleValueChange }), _jsx(TMLocalizedTextBox, { label: SDKUI_Localizator.Description, value: item.name, isModifiedWhen: (item.name || '') != (originalItem?.name || ''), validationItems: validationItems.filter(o => o.PropertyName === "itemName"), readOnly: readOnly, value_IT: item.namesLoc?.it_IT, value_EN: item.namesLoc?.en_US, value_FR: item.namesLoc?.fr_FR, value_PT: item.namesLoc?.pt_PT, value_ES: item.namesLoc?.es_ES, value_DE: item.namesLoc?.de_DE, onValueChanged: handleLocalizedNameChange }), _jsx(TMImageIDChooser, { elementStyle: { marginBottom: '10px' }, label: "Immagine", value: item.imageID, isModifiedWhen: (item.imageID || '') != (originalItem?.imageID || ''), validationItems: validationItems.filter(o => o.PropertyName === "imageID"), readOnly: readOnly, onValueChanged: handleImageIDChange })] }));
|
|
59
|
+
return (_jsxs(FieldsContainer, { children: [_jsx(TMTextBox, { label: SDKUI_Localizator.Value, value: item.value, isModifiedWhen: (item.value || '') != (originalItem?.value || ''), validationItems: validationItems.filter(o => o.PropertyName === "value"), readOnly: readOnly, autoFocus: true, onValueChanged: handleValueChange }), _jsx(TMLocalizedTextBox, { label: SDKUI_Localizator.Description, value: item.name, isModifiedWhen: (item.name || '') != (originalItem?.name || ''), validationItems: validationItems.filter(o => o.PropertyName === "itemName"), readOnly: readOnly, value_IT: item.namesLoc?.it_IT, value_EN: item.namesLoc?.en_US, value_FR: item.namesLoc?.fr_FR, value_PT: item.namesLoc?.pt_PT, value_ES: item.namesLoc?.es_ES, value_DE: item.namesLoc?.de_DE, onValueChanged: handleLocalizedNameChange }), _jsx(TMImageIDChooser, { elementStyle: { marginBottom: '10px' }, label: "Immagine", value: item.imageID, isModifiedWhen: (item.imageID || '') != (originalItem?.imageID || ''), validationItems: validationItems.filter(o => o.PropertyName === "imageID"), readOnly: readOnly, onValueChanged: handleImageIDChange })] }));
|
|
60
60
|
};
|
|
61
61
|
export default TMDataListItemFields;
|
|
@@ -4,6 +4,7 @@ interface TMDataListItemPickerProps {
|
|
|
4
4
|
dataListID: number | undefined;
|
|
5
5
|
selectedValue: string | undefined;
|
|
6
6
|
onItemSelect: (item: DataListItemDescriptor) => void;
|
|
7
|
+
onItemEdited?: (originalItem: DataListItemDescriptor, editedItem: DataListItemDescriptor) => void;
|
|
7
8
|
allowEdit?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const TMDataListItemPicker: React.FC<TMDataListItemPickerProps>;
|
|
@@ -128,7 +128,7 @@ const Label = styled.div `
|
|
|
128
128
|
font-weight: bold;
|
|
129
129
|
margin-bottom: 5px;
|
|
130
130
|
`;
|
|
131
|
-
const TMDataListItemPicker = ({ dataListID, selectedValue, onItemSelect, allowEdit = false }) => {
|
|
131
|
+
const TMDataListItemPicker = ({ dataListID, selectedValue, onItemSelect, onItemEdited, allowEdit = false }) => {
|
|
132
132
|
const [dataList, setDataList] = useState(undefined);
|
|
133
133
|
const [items, setItems] = useState([]);
|
|
134
134
|
const [loading, setLoading] = useState(true);
|
|
@@ -194,6 +194,10 @@ const TMDataListItemPicker = ({ dataListID, selectedValue, onItemSelect, allowEd
|
|
|
194
194
|
DataListCacheService.Remove();
|
|
195
195
|
// Ricarica i dati dalla cache (che richiamerà il server)
|
|
196
196
|
await loadDataList(false);
|
|
197
|
+
// Notifica il parent se un item esistente è stato modificato
|
|
198
|
+
if (!isCreating && editingItem) {
|
|
199
|
+
onItemEdited?.(editingItem, newItem);
|
|
200
|
+
}
|
|
197
201
|
handleCloseDialog();
|
|
198
202
|
}
|
|
199
203
|
catch (error) {
|
|
@@ -100,7 +100,7 @@ export const TMUserTooltip = ({ ud, children }) => {
|
|
|
100
100
|
.filter(Boolean)
|
|
101
101
|
.join('\n');
|
|
102
102
|
};
|
|
103
|
-
return (_jsx("
|
|
103
|
+
return (_jsx("span", { title: buildTitle(ud), style: { display: 'inline-flex', alignItems: 'center' }, children: children }));
|
|
104
104
|
};
|
|
105
105
|
const getCompleteUserName = (domain, name) => {
|
|
106
106
|
if (!name)
|
|
@@ -358,7 +358,7 @@ const TaskFormResponseComment = (props) => {
|
|
|
358
358
|
}, children: currentResponse && currentResponse.length > 0
|
|
359
359
|
? _jsx(TMHtmlContentDisplay, { markup: currentResponse ?? '-', isSelected: false })
|
|
360
360
|
: _jsx("span", { style: { color: '#6c757d', fontStyle: 'italic' }, children: SDKUI_Localizator.NoAnswerProvided }) }) }))] })
|
|
361
|
-
: (_jsxs(ResponseCommentWrapper, { children: [_jsx(ResponseCommentTextArea, { id: "responseId", name: "response", "$isValid": true, value: currentResponse ?? '', onChange: onAnswerChange ? onAnswerChange : undefined
|
|
361
|
+
: (_jsxs(ResponseCommentWrapper, { children: [_jsx(ResponseCommentTextArea, { id: "responseId", name: "response", "$isValid": true, value: currentResponse ?? '', onChange: onAnswerChange ? onAnswerChange : undefined }), _jsx(ResponseCommentLabel, { htmlFor: "responseId", children: SDKUI_Localizator.Answer }), _jsx(ResponseCommentCharacterCounter, { children: `${500 - (currentResponse ?? '').length} ${SDKUI_Localizator.CharactersRemaining}` })] })) }));
|
|
362
362
|
};
|
|
363
363
|
// Stile comune per i container dei campi
|
|
364
364
|
const fieldContainerStyle = { width: '100%' };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DiagramItem, WfInfo } from './interfaces';
|
|
3
|
+
import { DataListItemDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
4
|
interface DiagramItemFormProps {
|
|
4
5
|
itemToEdit: DiagramItem;
|
|
5
6
|
wf: WfInfo | null | undefined;
|
|
6
7
|
onClose: () => void;
|
|
7
8
|
onApply: (updatedItem: DiagramItem) => void;
|
|
9
|
+
onStatusItemEdited?: (originalItem: DataListItemDescriptor, editedItem: DataListItemDescriptor) => void;
|
|
8
10
|
}
|
|
9
11
|
declare const DiagramItemForm: React.FC<DiagramItemFormProps>;
|
|
10
12
|
export default DiagramItemForm;
|
|
@@ -10,7 +10,7 @@ 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, Severities, WFAppTypes, WorkItemSetRules } from '@topconsultnpm/sdk-ts';
|
|
13
|
+
import { CultureIDs, DcmtTypeListCacheService, FromItem, MetadataDataDomains, ResultTypes, SDK_Globals, SearchEngine, Severities, WFAppTypes, WorkItemSetRules } from '@topconsultnpm/sdk-ts';
|
|
14
14
|
import TMLocalizedTextBox from '../../../editors/TMLocalizedTextBox';
|
|
15
15
|
import TMDataListItemPicker from '../../../choosers/TMDataListItemPicker';
|
|
16
16
|
import WorkitemRecipientsEditor, { actorsToTos, RecipientsContainer, tosToActors } from './WorkitemRecipientsEditor';
|
|
@@ -30,9 +30,16 @@ import { DiagramItemProps, wfDiagramItemValidator } from './workflowHelpers';
|
|
|
30
30
|
const FormContainer = styled.div `
|
|
31
31
|
display: flex;
|
|
32
32
|
flex-direction: column;
|
|
33
|
-
|
|
33
|
+
height: 100%;
|
|
34
34
|
padding: 10px;
|
|
35
35
|
`;
|
|
36
|
+
const FieldsContainer = styled.div `
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
gap: 5px;
|
|
40
|
+
flex: 1;
|
|
41
|
+
overflow-y: auto;
|
|
42
|
+
`;
|
|
36
43
|
const FlexContainer = styled.div `
|
|
37
44
|
display: flex;
|
|
38
45
|
align-items: center;
|
|
@@ -76,7 +83,7 @@ const APP_TYPES_DATASOURCE = [
|
|
|
76
83
|
{ value: WFAppTypes.SP, display: "SP" },
|
|
77
84
|
{ value: WFAppTypes.REST, display: "REST" }
|
|
78
85
|
];
|
|
79
|
-
const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
|
|
86
|
+
const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply, onStatusItemEdited }) => {
|
|
80
87
|
const [localItem, setLocalItem] = useState(itemToEdit);
|
|
81
88
|
const [localItemOrig] = useState(structuredClone(itemToEdit));
|
|
82
89
|
const [validationItems, setValidationItems] = useState([]);
|
|
@@ -392,7 +399,7 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
|
|
|
392
399
|
};
|
|
393
400
|
// Function to render Status-specific fields
|
|
394
401
|
const renderStatusFields = () => {
|
|
395
|
-
return (_jsx(TMDataListItemPicker, { dataListID: wf?.MStatusDLID, selectedValue: localItem.StatusValue, onItemSelect: handleStatusChange, allowEdit: true }));
|
|
402
|
+
return (_jsx(TMDataListItemPicker, { dataListID: wf?.MStatusDLID, selectedValue: localItem.StatusValue, onItemSelect: handleStatusChange, onItemEdited: onStatusItemEdited, allowEdit: true }));
|
|
396
403
|
};
|
|
397
404
|
const renderAppFields = () => {
|
|
398
405
|
return (_jsxs(_Fragment, { children: [_jsx(TMDropDown, { label: SDKUI_Localizator.WorkflowAppType, dataSource: APP_TYPES_DATASOURCE, value: localItem.AppType, isModifiedWhen: localItem.AppType !== localItemOrig.AppType, validationItems: validationItems.filter(v => v.PropertyName === DiagramItemProps.AppType), onValueChanged: (e) => { handleAppTypeChange(e.target.value); } }), localItem.AppType === WFAppTypes.EXE
|
|
@@ -580,38 +587,38 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
|
|
|
580
587
|
setDossierTypes(formattedList);
|
|
581
588
|
});
|
|
582
589
|
}, [localItem.Type]);
|
|
583
|
-
//
|
|
584
|
-
const { andRecipients:
|
|
585
|
-
return tosToActors(localItem.Tos ?? '');
|
|
586
|
-
}, [localItem.Tos]);
|
|
587
|
-
const { andRecipients: tos2Recipients } = useMemo(() => {
|
|
590
|
+
// Owner = Tos2, Participants = Tos
|
|
591
|
+
const { andRecipients: ownerRecipients } = useMemo(() => {
|
|
588
592
|
return tosToActors(localItem.Tos2 ?? '');
|
|
589
593
|
}, [localItem.Tos2]);
|
|
590
|
-
const
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
handleTosChange(newTos);
|
|
595
|
-
}, [localItem.Tos, handleTosChange]);
|
|
596
|
-
const handleRemoveTosRecipient = useCallback((recipientToRemove) => {
|
|
597
|
-
const { andRecipients } = tosToActors(localItem.Tos ?? '');
|
|
598
|
-
const updatedRecipients = andRecipients.filter(r => r.ActorType !== recipientToRemove.ActorType || r.ActorID !== recipientToRemove.ActorID);
|
|
599
|
-
const newTos = actorsToTos(updatedRecipients);
|
|
600
|
-
handleTosChange(newTos);
|
|
601
|
-
}, [localItem.Tos, handleTosChange]);
|
|
602
|
-
const handleAddTos2Recipients = useCallback((newRecipients, orValue) => {
|
|
594
|
+
const { andRecipients: participantRecipients } = useMemo(() => {
|
|
595
|
+
return tosToActors(localItem.Tos ?? '');
|
|
596
|
+
}, [localItem.Tos]);
|
|
597
|
+
const handleAddOwnerRecipients = useCallback((newRecipients, orValue) => {
|
|
603
598
|
const { andRecipients } = tosToActors(localItem.Tos2 ?? '');
|
|
604
599
|
const updatedRecipients = [...andRecipients, ...newRecipients.map(r => ({ ...r, Or: orValue }))];
|
|
605
600
|
const newTos = actorsToTos(updatedRecipients);
|
|
606
601
|
handleTos2Change(newTos);
|
|
607
602
|
}, [localItem.Tos2, handleTos2Change]);
|
|
608
|
-
const
|
|
603
|
+
const handleRemoveOwnerRecipient = useCallback((recipientToRemove) => {
|
|
609
604
|
const { andRecipients } = tosToActors(localItem.Tos2 ?? '');
|
|
610
605
|
const updatedRecipients = andRecipients.filter(r => r.ActorType !== recipientToRemove.ActorType || r.ActorID !== recipientToRemove.ActorID);
|
|
611
606
|
const newTos = actorsToTos(updatedRecipients);
|
|
612
607
|
handleTos2Change(newTos);
|
|
613
608
|
}, [localItem.Tos2, handleTos2Change]);
|
|
614
|
-
|
|
609
|
+
const handleAddParticipantRecipients = useCallback((newRecipients, orValue) => {
|
|
610
|
+
const { andRecipients } = tosToActors(localItem.Tos ?? '');
|
|
611
|
+
const updatedRecipients = [...andRecipients, ...newRecipients.map(r => ({ ...r, Or: orValue }))];
|
|
612
|
+
const newTos = actorsToTos(updatedRecipients);
|
|
613
|
+
handleTosChange(newTos);
|
|
614
|
+
}, [localItem.Tos, handleTosChange]);
|
|
615
|
+
const handleRemoveParticipantRecipient = useCallback((recipientToRemove) => {
|
|
616
|
+
const { andRecipients } = tosToActors(localItem.Tos ?? '');
|
|
617
|
+
const updatedRecipients = andRecipients.filter(r => r.ActorType !== recipientToRemove.ActorType || r.ActorID !== recipientToRemove.ActorID);
|
|
618
|
+
const newTos = actorsToTos(updatedRecipients);
|
|
619
|
+
handleTosChange(newTos);
|
|
620
|
+
}, [localItem.Tos, handleTosChange]);
|
|
621
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMTextExpression, { label: `${SDKUI_Localizator.Name} (${SDKUI_Localizator.Dossier})`, value: localItem.PlatformObjName, valueOrig: localItemOrig.PlatformObjName, tid: wf?.MTID, isModifiedWhen: (localItem.PlatformObjName ?? '') !== (localItemOrig.PlatformObjName ?? ''), onValueChanged: handlePlatformObjNameChange }), _jsx(TMDropDown, { dataSource: dossierTypes, label: SDKUI_Localizator.DossierType, value: localItem.Value3asInt, isModifiedWhen: (localItem.Value3asInt ?? 0) !== (localItemOrig.Value3asInt ?? 0), onValueChanged: (e) => { handleValue3asIntChange(e.target.value); } }), _jsx(TMTextExpression, { label: `${SDKUI_Localizator.Description} (${SDKUI_Localizator.Dossier})`, value: localItem.PlatformObjDescr, valueOrig: localItemOrig.PlatformObjDescr, tid: wf?.MTID, isModifiedWhen: (localItem.PlatformObjDescr ?? '') !== (localItemOrig.PlatformObjDescr ?? ''), onValueChanged: handlePlatformObjDescrChange }), _jsx(TMCultureIDPicker, { label: SDKUI_Localizator.Format, selectedValue: localItem.FormatCultureID, isModifiedWhen: localItem.FormatCultureID !== localItemOrig.FormatCultureID, openChooserBySingleClick: true, onSelectCultureID: handleFormatCultureIDChange }), _jsx(TMTextExpression, { label: `${SDKUI_Localizator.CommentText} (${SDKUI_Localizator.BlogCase})`, placeHolder: 'Inserisci il valore', rows: 2, value: localItem.Value1asString, valueOrig: localItemOrig.Value1asString, tid: wf?.MTID, isModifiedWhen: (localItem.Value1asString ?? '') !== (localItemOrig.Value1asString ?? ''), onValueChanged: handleValue1asStringChange }), _jsx(TMCheckBox, { value: localItem.Value1asInt ?? 0, label: SDKUI_Localizator.WorkflowAddDcmtAsAttachment, isModifiedWhen: localItem.Value1asInt !== localItemOrig.Value1asInt, onValueChanged: handleValue1asIntChange }), _jsx(TMCheckBox, { value: localItem.Value2asInt ?? 0, label: SDKUI_Localizator.WorkflowAddDcmtToDossier, isModifiedWhen: localItem.Value2asInt !== localItemOrig.Value2asInt, onValueChanged: handleValue2asIntChange }), _jsx(TMCheckBox, { value: localItem.Trunc ?? 0, label: SDKUI_Localizator.TruncateString, isModifiedWhen: localItem.Trunc !== localItemOrig.Trunc, onValueChanged: handleTruncChange }), _jsxs(RecipientsContainer, { children: [_jsx(RecipientList, { recipients: ownerRecipients, title: SDKUI_Localizator.OwnerName, tid: wf?.MTID, maxRecipients: 1, validationItems: validationItems.filter(v => v.PropertyName === DiagramItemProps.Tos2), onAdd: (newRecipients) => handleAddOwnerRecipients(newRecipients, 0), onRemove: handleRemoveOwnerRecipient }), _jsx(RecipientList, { recipients: participantRecipients, title: SDKUI_Localizator.Participants, tid: wf?.MTID, onAdd: (newRecipients) => handleAddParticipantRecipients(newRecipients, 0), onRemove: handleRemoveParticipantRecipient })] })] }));
|
|
615
622
|
};
|
|
616
623
|
const renderAddPartsFields = () => {
|
|
617
624
|
const { andRecipients: tosRecipients } = useMemo(() => {
|
|
@@ -679,7 +686,7 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
|
|
|
679
686
|
default:
|
|
680
687
|
specificFields = null;
|
|
681
688
|
}
|
|
682
|
-
return (_jsxs(FormContainer, { children: [renderCommonFields(), specificFields, _jsxs(ButtonsContainer, { children: [_jsx(TMButton, { caption: 'Applica', btnStyle: 'advanced', advancedColor: TMColors.tertiary, icon: _jsx(IconApply, {}), showTooltip: false, disabled: !isModified, onClick: handleSave }), _jsx(TMButton, { caption: 'Annulla', btnStyle: 'toolbar', color: 'primary', icon: _jsx(IconUndo, {}), showTooltip: false, disabled: !isModified, onClick: handleCancel })] })] }));
|
|
689
|
+
return (_jsxs(FormContainer, { children: [_jsxs(FieldsContainer, { children: [renderCommonFields(), specificFields] }), _jsxs(ButtonsContainer, { children: [_jsx(TMButton, { caption: 'Applica', btnStyle: 'advanced', advancedColor: TMColors.tertiary, icon: _jsx(IconApply, {}), showTooltip: false, disabled: !isModified || validationItems.some(v => v.ResultType === ResultTypes.ERROR), onClick: handleSave }), _jsx(TMButton, { caption: 'Annulla', btnStyle: 'toolbar', color: 'primary', icon: _jsx(IconUndo, {}), showTooltip: false, disabled: !isModified, onClick: handleCancel })] })] }));
|
|
683
690
|
};
|
|
684
691
|
return (_jsx(TMModal, { title: LocalizeDiagramItemType(localItem.Type), onClose: onClose, isModal: true, width: calculatedWidth, height: calculatedHeight, children: renderForm() }));
|
|
685
692
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryDescriptor } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { QueryDescriptor, ValidationItem } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
export declare enum WorkItemActorTypes {
|
|
4
4
|
None = 0,
|
|
5
5
|
UID = 1,
|
|
@@ -19,6 +19,8 @@ interface RecipientListProps {
|
|
|
19
19
|
title: string;
|
|
20
20
|
tid?: number;
|
|
21
21
|
qd?: QueryDescriptor;
|
|
22
|
+
maxRecipients?: number;
|
|
23
|
+
validationItems?: ValidationItem[];
|
|
22
24
|
onQDChange?: (newQd: QueryDescriptor | undefined) => void;
|
|
23
25
|
onAdd: (recipient: WorkItemActor[]) => void;
|
|
24
26
|
onRemove: (recipient: WorkItemActor) => void;
|
|
@@ -7,6 +7,7 @@ import { TMUserChooserForm } from '../../../choosers/TMUserChooser';
|
|
|
7
7
|
import { TMGroupChooserForm, TMGroupIdViewer } from '../../../choosers/TMGroupChooser';
|
|
8
8
|
import { TMMidViewer } from '../../../viewers/TMMidViewer';
|
|
9
9
|
import { SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts';
|
|
10
|
+
import TMVilViewer from '../../../base/TMVilViewer';
|
|
10
11
|
import { useOutsideClick } from '../../../../hooks/useOutsideClick';
|
|
11
12
|
import { FormModes } from '../../../../ts';
|
|
12
13
|
import { TMMessageBoxManager, ButtonNames } from '../../../base/TMPopUp';
|
|
@@ -70,7 +71,7 @@ const FloatingMenu = styled.div `
|
|
|
70
71
|
const FloatingMenuButton = (props) => {
|
|
71
72
|
return _jsx(TMButton, { width: "100%", ...props });
|
|
72
73
|
};
|
|
73
|
-
const RecipientList = ({ recipients, title, tid, qd, onAdd, onRemove, onQDChange }) => {
|
|
74
|
+
const RecipientList = ({ recipients, title, tid, qd, maxRecipients, validationItems, onAdd, onRemove, onQDChange }) => {
|
|
74
75
|
const [uiState, setUiState] = useState({
|
|
75
76
|
isMenuOpen: false,
|
|
76
77
|
showUserChooser: false,
|
|
@@ -102,7 +103,7 @@ const RecipientList = ({ recipients, title, tid, qd, onAdd, onRemove, onQDChange
|
|
|
102
103
|
onAdd(recipientsToAdd);
|
|
103
104
|
}
|
|
104
105
|
setUiState(prevState => ({ ...prevState, showUserChooser: false }));
|
|
105
|
-
}, []);
|
|
106
|
+
}, [onAdd]);
|
|
106
107
|
const handleGroupChosen = useCallback((IDs) => {
|
|
107
108
|
if (IDs && IDs.length > 0) {
|
|
108
109
|
const recipientsToAdd = IDs.map(id => ({
|
|
@@ -113,7 +114,7 @@ const RecipientList = ({ recipients, title, tid, qd, onAdd, onRemove, onQDChange
|
|
|
113
114
|
onAdd(recipientsToAdd);
|
|
114
115
|
}
|
|
115
116
|
setUiState(prevState => ({ ...prevState, showGroupChooser: false }));
|
|
116
|
-
}, []);
|
|
117
|
+
}, [onAdd]);
|
|
117
118
|
const handleMetadataChosen = useCallback((IDs) => {
|
|
118
119
|
if (IDs && IDs.length > 0) {
|
|
119
120
|
const recipientsToAdd = IDs.map(item => ({
|
|
@@ -124,8 +125,11 @@ const RecipientList = ({ recipients, title, tid, qd, onAdd, onRemove, onQDChange
|
|
|
124
125
|
onAdd(recipientsToAdd);
|
|
125
126
|
}
|
|
126
127
|
setUiState(prevState => ({ ...prevState, showMetadataChooser: false }));
|
|
127
|
-
}, []);
|
|
128
|
+
}, [onAdd]);
|
|
129
|
+
const isMaxReached = maxRecipients !== undefined && recipients.length >= maxRecipients;
|
|
128
130
|
const handleAddClick = () => {
|
|
131
|
+
if (isMaxReached)
|
|
132
|
+
return;
|
|
129
133
|
setUiState(prevState => ({ ...prevState, isMenuOpen: !prevState.isMenuOpen }));
|
|
130
134
|
};
|
|
131
135
|
const handleRecipientClick = useCallback((index) => {
|
|
@@ -195,11 +199,11 @@ const RecipientList = ({ recipients, title, tid, qd, onAdd, onRemove, onQDChange
|
|
|
195
199
|
document.removeEventListener('keydown', handleKeyPress);
|
|
196
200
|
};
|
|
197
201
|
}, [handleKeyPress]);
|
|
198
|
-
return (_jsxs(RecipientsColumn, { children: [_jsxs(HeaderContainer, { children: [_jsx("p", { style: { fontWeight: 600 }, children: title }), _jsx(TMButton, { btnStyle: 'icon', caption: SDKUI_Localizator.AddRecipient, icon: _jsx(IconAdd, {}), onClick: handleAddClick }), uiState.isMenuOpen && renderFloatingMenu()] }), _jsx("div", { style: { height: '150px', overflowY: 'auto', gap: '5px', display: 'flex', flexDirection: 'column' }, children: recipients.map((recipient, index) => (_jsxs(RecipientItem, { "$isSelected": uiState.selectedRecipientIndex === index, onClick: () => handleRecipientClick(index), tabIndex: 0, children: [_jsx(IconDelete, { color: '#c00', cursor: 'pointer', onClick: (e) => {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
return (_jsxs(RecipientsColumn, { children: [_jsxs(HeaderContainer, { children: [_jsx("p", { style: { fontWeight: 600 }, children: title }), _jsx(TMButton, { btnStyle: 'icon', caption: SDKUI_Localizator.AddRecipient, icon: _jsx(IconAdd, {}), onClick: handleAddClick, disabled: isMaxReached }), uiState.isMenuOpen && !isMaxReached && renderFloatingMenu()] }), _jsx(TMVilViewer, { vil: validationItems }), _jsx("div", { style: { height: '150px', overflowY: 'auto', gap: '5px', display: 'flex', flexDirection: 'column' }, children: recipients.map((recipient, index) => (_jsxs(RecipientItem, { "$isSelected": uiState.selectedRecipientIndex === index, onClick: () => handleRecipientClick(index), tabIndex: 0, children: [_jsx("span", { style: { display: 'flex', alignItems: 'center', flexShrink: 0 }, children: _jsx(IconDelete, { color: '#c00', cursor: 'pointer', onClick: (e) => {
|
|
203
|
+
e.stopPropagation();
|
|
204
|
+
onRemove(recipient);
|
|
205
|
+
setUiState(prevState => ({ ...prevState, selectedRecipientIndex: null }));
|
|
206
|
+
} }) }), _jsx("span", { style: { flex: 1, minWidth: 0, display: 'flex', alignItems: 'center' }, children: renderActorViewer(recipient) })] }, index))) }), uiState.showUserChooser && _jsx(TMUserChooserForm, { allowMultipleSelection: true, allowSorting: true, onClose: () => setUiState(prevState => ({ ...prevState, showUserChooser: false })), onChoose: (IDs) => handleUserChosen(IDs) }), uiState.showGroupChooser && _jsx(TMGroupChooserForm, { allowMultipleSelection: true, allowSorting: true, onClose: () => setUiState(prevState => ({ ...prevState, showGroupChooser: false })), onChoose: (IDs) => handleGroupChosen(IDs) }), uiState.showMetadataChooser && tid && _jsx(TMMetadataChooserForm, { allowMultipleSelection: true, allowSorting: true, tids: [tid], onClose: () => setUiState(prevState => ({ ...prevState, showMetadataChooser: false })), onChoose: (IDs) => handleMetadataChosen(IDs) }), uiState.showQdEditor &&
|
|
203
207
|
_jsx(TMModal, { title: SDKUI_Localizator.QueryDefine, onClose: () => setUiState(prevState => ({ ...prevState, showQdEditor: false })), children: _jsx(TMQueryEditor, { inputData: qd, formMode: FormModes.Update, showDistinct: true, onApplied: handleQdChosen, onClose: () => setUiState(prevState => ({ ...prevState, showQdEditor: false })) }) })] }));
|
|
204
208
|
};
|
|
205
209
|
export default RecipientList;
|
|
@@ -1643,6 +1643,18 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
1643
1643
|
const newDiagram = { ...wfDiagram, DiagramItems: updatedDiagramItems };
|
|
1644
1644
|
updateDiagram(newDiagram);
|
|
1645
1645
|
}, [wfDiagram, updateDiagram]);
|
|
1646
|
+
const handleStatusItemEdited = useCallback((originalItem, editedItem) => {
|
|
1647
|
+
if (!wfDiagram)
|
|
1648
|
+
return;
|
|
1649
|
+
const updatedDiagramItems = wfDiagram.DiagramItems.map(item => {
|
|
1650
|
+
if (item.Type === DiagramItemTypes.Status && item.StatusValue === originalItem.value) {
|
|
1651
|
+
return { ...item, ItemName: editedItem.name || '', StatusValue: editedItem.value };
|
|
1652
|
+
}
|
|
1653
|
+
return item;
|
|
1654
|
+
});
|
|
1655
|
+
const newDiagram = { ...wfDiagram, DiagramItems: updatedDiagramItems };
|
|
1656
|
+
updateDiagram(newDiagram);
|
|
1657
|
+
}, [wfDiagram, updateDiagram]);
|
|
1646
1658
|
const handleUpdateConnection = useCallback((updatedConnection) => {
|
|
1647
1659
|
setWfDiagram(prevDiagram => {
|
|
1648
1660
|
if (!prevDiagram)
|
|
@@ -1924,7 +1936,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
1924
1936
|
// Determina se questa è la connessione che stiamo trascinando
|
|
1925
1937
|
const isThisConnectionBeingDragged = isDraggingExistingConnectionEndpoint && draggingConnectionId === connection.ID;
|
|
1926
1938
|
return (_jsx(ConnectionComponent, { connection: connection, isSelected: selectedConnections.has(connection.ID), sourcePoint: sourcePoint, sinkPoint: sinkPoint, isTemporary: isThisConnectionBeingDragged, onClick: handleConnectionClick, onDoubleClick: handleDoubleClickConnection, onConnectionEndpointMouseDown: handleConnectionEndpointMouseDown, onContextMenu: handleConnectionContextMenu }, connection.ID));
|
|
1927
|
-
}), isDrawingConnection && tempConnectionPathData && (_jsx(TempConnectionPath, { d: tempConnectionPathData })), isDraggingExistingConnectionEndpoint && tempConnectionPathData && (_jsx(TempConnectionPath, { d: tempConnectionPathData })), isDrawingSelectionRect && currentSelectionRect && (_jsx(SelectionRect, { x: currentSelectionRect.x, y: currentSelectionRect.y, width: currentSelectionRect.width, height: currentSelectionRect.height }))] }) })) : (_jsx(DiagramMessage, { children: `${SDKUI_Localizator.WorkflowDiagramMissingOrInvalid} ...` })) }), isModalOpen && itemToEdit && (_jsx(DiagramItemForm, { itemToEdit: itemToEdit, wf: wfDiagram?.Info, onClose: handleCloseModal, onApply: handleUpdateDiagramItem })), isConnectionModalOpen && connectionToEdit && (_jsx(ConnectionForm, { connectionToEdit: connectionToEdit, onClose: () => setIsConnectionModalOpen(false), onApply: handleUpdateConnection })), _jsx(TMContextMenu, { items: connectionContextMenuItems, externalControl: {
|
|
1939
|
+
}), isDrawingConnection && tempConnectionPathData && (_jsx(TempConnectionPath, { d: tempConnectionPathData })), isDraggingExistingConnectionEndpoint && tempConnectionPathData && (_jsx(TempConnectionPath, { d: tempConnectionPathData })), isDrawingSelectionRect && currentSelectionRect && (_jsx(SelectionRect, { x: currentSelectionRect.x, y: currentSelectionRect.y, width: currentSelectionRect.width, height: currentSelectionRect.height }))] }) })) : (_jsx(DiagramMessage, { children: `${SDKUI_Localizator.WorkflowDiagramMissingOrInvalid} ...` })) }), isModalOpen && itemToEdit && (_jsx(DiagramItemForm, { itemToEdit: itemToEdit, wf: wfDiagram?.Info, onClose: handleCloseModal, onApply: handleUpdateDiagramItem, onStatusItemEdited: handleStatusItemEdited })), isConnectionModalOpen && connectionToEdit && (_jsx(ConnectionForm, { connectionToEdit: connectionToEdit, onClose: () => setIsConnectionModalOpen(false), onApply: handleUpdateConnection })), _jsx(TMContextMenu, { items: connectionContextMenuItems, externalControl: {
|
|
1928
1940
|
visible: contextMenuConnectionId !== null,
|
|
1929
1941
|
position: connectionContextMenuPosition,
|
|
1930
1942
|
onClose: closeConnectionContextMenu
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PlatformObjectValidator, QueryValidatorOptions, ResultTypes, ValidationItem, WorkItemStatus } from '@topconsultnpm/sdk-ts';
|
|
2
2
|
import { DiagramItemTypes, ArrowSymbol } from './interfaces'; // Assicurati che il percorso sia corretto
|
|
3
3
|
import { generateUUID, LocalizeDiagramItemType, SDKUI_Localizator } from '../../../../helper';
|
|
4
|
+
import { tosToActors } from './WorkitemRecipientsEditor';
|
|
4
5
|
/**
|
|
5
6
|
* Calculates the angle in degrees of an arrow based on two points.
|
|
6
7
|
* @param prevPoint The previous point on the trajectory.
|
|
@@ -484,6 +485,16 @@ export const wfDiagramItemValidator = async (d) => {
|
|
|
484
485
|
vil.push(new ValidationItem(ResultTypes.ERROR, LocalizeDiagramItemType(d.Type), `La query della condizione '${d.ItemName}' non contiene criteri di selezione`, [DiagramItemProps.QD]));
|
|
485
486
|
}
|
|
486
487
|
break;
|
|
488
|
+
case DiagramItemTypes.CaseFlow_Create:
|
|
489
|
+
PlatformObjectValidator.RequiredStringValidator(d.ItemName, DiagramItemProps.ItemName, vil, SDKUI_Localizator.Name);
|
|
490
|
+
PlatformObjectValidator.RequiredStringValidator(d.Tos2, DiagramItemProps.Tos2, vil, SDKUI_Localizator.OwnerName);
|
|
491
|
+
if (d.Tos2) {
|
|
492
|
+
const { andRecipients } = tosToActors(d.Tos2);
|
|
493
|
+
if (andRecipients.length > 1) {
|
|
494
|
+
vil.push(new ValidationItem(ResultTypes.ERROR, DiagramItemProps.Tos2, SDKUI_Localizator.WorkflowOnlyOneOwnerAllowed));
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
break;
|
|
487
498
|
}
|
|
488
499
|
return vil;
|
|
489
500
|
};
|
|
@@ -38,11 +38,12 @@ export const TMMidViewer = ({ isMetadataSelected = false, color, tmSession, tid_
|
|
|
38
38
|
color: md?.isRequired == 1 ? 'red' : color,
|
|
39
39
|
}, children: [showIcon && _jsx(TMMetadataIcon, { isMetadataSelected: isMetadataSelected, tid: tid_mid?.tid, md: md, color: color }), _jsx("p", { title: displayName(), style: {
|
|
40
40
|
textAlign: 'left',
|
|
41
|
+
margin: 0,
|
|
41
42
|
marginLeft: showIcon ? '5px' : '',
|
|
42
43
|
whiteSpace: 'nowrap',
|
|
43
44
|
overflow: 'hidden',
|
|
44
45
|
textOverflow: 'ellipsis'
|
|
45
|
-
}, children: displayName() }), showId && _jsx("p", { style: { padding: '0px 3px' }, children: `(MID: ${tid_mid?.mid})` })] }));
|
|
46
|
+
}, children: displayName() }), showId && _jsx("p", { style: { padding: '0px 3px', margin: 0 }, children: `(MID: ${tid_mid?.mid})` })] }));
|
|
46
47
|
};
|
|
47
48
|
export const TMMetadataIcon = ({ tid, md, color, layoutMode = LayoutModes.Update, isMetadataSelected = false, elementStyle }) => {
|
|
48
49
|
let selectedMetadataStyle = { borderBottom: isMetadataSelected ? `thick solid ${TMColors.text_normal}` : 'none', height: 'max-content' };
|
|
@@ -202,6 +202,7 @@ export declare class SDKUI_Localizator {
|
|
|
202
202
|
static get Domain(): "Domäne" | "Domain" | "Dominio" | "Domaine";
|
|
203
203
|
static get Dossier(): "Übung" | "Dossier" | "Expediente" | "Pratique" | "Prática" | "Pratica";
|
|
204
204
|
static get Dossiers(): "Akten" | "Dossiers" | "Expedientes" | "Pratiques" | "Práticas" | "Pratiche";
|
|
205
|
+
static get DossierType(): "Aktentyp" | "Dossier Type" | "Tipo de Expediente" | "Type de Pratique" | "Tipo de Prática" | "Modello di Pratica";
|
|
205
206
|
static get DownloadFile(): string;
|
|
206
207
|
static get Download_in_Process(): "Download läuft" | "Download in progress" | "Descarga en curso" | "Téléchargement en cours" | "Download em progresso" | "Download in corso";
|
|
207
208
|
static get DownloadXMLAttachments(): string;
|
|
@@ -771,6 +772,7 @@ export declare class SDKUI_Localizator {
|
|
|
771
772
|
static get WorkflowStartAfterArchive(): "Starten Sie die Instanz beim Archivieren des Dokuments" | "Start the instance when you archive the document" | "Iniciar la instancia cuando se almacena el documento" | "Démarrer l'instance lorsque vous archivez le document" | "Inicie a instância quando você fizer check in no documento" | "Avviare l'istanza quando si archivia il documento";
|
|
772
773
|
static get WorkflowStartAfterUpdate(): "Starten Sie die Instanz beim Bearbeiten der folgenden Methadaten" | "Start the instance when updating the following metadata" | "Iniciar la instancia cuando se modifican los siguientes metadatos" | "Démarrer l'instance lors de l'édition des métadonnées suivantes" | "Inicie a instância ao editar os seguintes metadados" | "Avviare l'istanza quando si modificano i seguenti metadati";
|
|
773
774
|
static get WorkflowGetRecipientsFromQuery(): "Ermitteln Sie die Empfänger aus der ABFRAGE" | "Get the recipients from QUERY" | "Obtenga los destinatarios de QUERY" | "Obtenez les destinataires de QUERY" | "Obtenha os destinatários de QUERY" | "Ottieni i destinatari da QUERY";
|
|
775
|
+
static get WorkflowOnlyOneOwnerAllowed(): "Es ist nur ein Eigentümer zulässig" | "Only one owner is allowed" | "Solo se permite un propietario" | "Un seul propriétaire est autorisé" | "Apenas um proprietário é permitido" | "È consentito un solo proprietario";
|
|
774
776
|
static get WorkflowOnlyOneQueryForRecipients(): "Nur eine Abfrage für die Empfänger definieren" | "Define only one query for recipients" | "Definir solo una consulta para los destinatarios" | "Définissez une seule requête pour les destinataires" | "Defina apenas uma query para os destinatários" | "Definire solo una query per i destinatari";
|
|
775
777
|
static get WorkflowRecipientSetRule(): "Verwalten Sie Empfänger mit der folgenden Regel" | "Manage recipients with the following rule" | "Gestionar los destinatarios con la siguiente regla" | "Gérer les destinataires avec la règle suivante" | "Gerenciar destinatários com a seguinte regra" | "Gestisci i destinatari con la seguente regola";
|
|
776
778
|
static get WorkGroup(): "Arbeitsgruppe" | "Work Group" | "Grupo de Trabajo" | "Groupe de travail" | "Grupo de Trabalho" | "Gruppo di lavoro";
|
|
@@ -1969,6 +1969,16 @@ export class SDKUI_Localizator {
|
|
|
1969
1969
|
default: return "Pratiche";
|
|
1970
1970
|
}
|
|
1971
1971
|
}
|
|
1972
|
+
static get DossierType() {
|
|
1973
|
+
switch (this._cultureID) {
|
|
1974
|
+
case CultureIDs.De_DE: return "Aktentyp";
|
|
1975
|
+
case CultureIDs.En_US: return "Dossier Type";
|
|
1976
|
+
case CultureIDs.Es_ES: return "Tipo de Expediente";
|
|
1977
|
+
case CultureIDs.Fr_FR: return "Type de Pratique";
|
|
1978
|
+
case CultureIDs.Pt_PT: return "Tipo de Prática";
|
|
1979
|
+
default: return "Modello di Pratica";
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1972
1982
|
static get DownloadFile() {
|
|
1973
1983
|
switch (this._cultureID) {
|
|
1974
1984
|
case CultureIDs.De_DE: return "Datei herunterladen";
|
|
@@ -7694,6 +7704,16 @@ export class SDKUI_Localizator {
|
|
|
7694
7704
|
default: return "Ottieni i destinatari da QUERY";
|
|
7695
7705
|
}
|
|
7696
7706
|
}
|
|
7707
|
+
static get WorkflowOnlyOneOwnerAllowed() {
|
|
7708
|
+
switch (this._cultureID) {
|
|
7709
|
+
case CultureIDs.De_DE: return "Es ist nur ein Eigentümer zulässig";
|
|
7710
|
+
case CultureIDs.En_US: return "Only one owner is allowed";
|
|
7711
|
+
case CultureIDs.Es_ES: return "Solo se permite un propietario";
|
|
7712
|
+
case CultureIDs.Fr_FR: return "Un seul propriétaire est autorisé";
|
|
7713
|
+
case CultureIDs.Pt_PT: return "Apenas um proprietário é permitido";
|
|
7714
|
+
default: return "È consentito un solo proprietario";
|
|
7715
|
+
}
|
|
7716
|
+
}
|
|
7697
7717
|
static get WorkflowOnlyOneQueryForRecipients() {
|
|
7698
7718
|
switch (this._cultureID) {
|
|
7699
7719
|
case CultureIDs.De_DE: return "Nur eine Abfrage für die Empfänger definieren";
|
|
@@ -76,14 +76,14 @@ export const useDataUserIdItem = () => {
|
|
|
76
76
|
return null;
|
|
77
77
|
if (!userId)
|
|
78
78
|
return null;
|
|
79
|
-
return ud ? _jsx(TMUserIcon, { ud: ud }) : _jsx("
|
|
79
|
+
return ud ? _jsx(TMUserIcon, { ud: ud }) : _jsx("span", { title: showTitile ? SDKUI_Localizator.ValueNotPresent : undefined, style: { display: 'inline-flex', alignItems: 'center' }, children: _jsx(IconWarning, { color: TMColors.warning }) });
|
|
80
80
|
};
|
|
81
81
|
const getDescription = () => {
|
|
82
82
|
if (!userId)
|
|
83
83
|
return undefined;
|
|
84
84
|
return ud ? getCompleteUserName(ud.domain, ud.name) : userId.toString() ?? SDKUI_Localizator.NoneSelection;
|
|
85
85
|
};
|
|
86
|
-
return (_jsxs("
|
|
86
|
+
return (_jsxs("span", { style: { display: 'inline-flex', alignItems: 'center', gap: '4px', lineHeight: 1 }, children: [getIcon(), _jsx("span", { style: { lineHeight: 'normal' }, children: getDescription() })] }));
|
|
87
87
|
}, [getUserItem, getCompleteUserName]);
|
|
88
88
|
return {
|
|
89
89
|
loadUsersAsync,
|