@topconsultnpm/sdkui-react-beta 6.16.12 → 6.16.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SDK_Localizator, SDK_Globals } from "@topconsultnpm/sdk-ts-beta";
3
+ import { SDKUI_Localizator, IconUserGroup } from "../../helper";
4
+ import TMSpinner from "../base/TMSpinner";
5
+ import TMChooserForm from "../forms/TMChooserForm";
6
+ import { useEffect, useState } from "react";
7
+ export const TMGroupChooserForm = (props) => {
8
+ const getItems = async () => {
9
+ TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.Groups} ...` });
10
+ let items = await SDK_Globals.tmSession?.NewGroupEngine().RetrieveAllAdminAsync();
11
+ TMSpinner.hide();
12
+ return items ?? [];
13
+ };
14
+ return (_jsx(TMChooserForm, { title: SDK_Localizator.Groups, allowMultipleSelection: props.allowMultipleSelection, width: props.width, height: props.height, manageUseLocalizedName: true, hasShowOnlySelectedItems: true, selectedIDs: props.selectedIDs, startWithShowOnlySelectedItems: false, cellRenderIcon: () => _jsx(IconUserGroup, { color: '#767676' }), dataSource: props.dataSource, getItems: getItems, onClose: props.onClose, onChoose: (IDs) => { props.onChoose?.(IDs); } }));
15
+ };
16
+ export const TMGroupIdViewer = (props) => {
17
+ const [group, setGroup] = useState(null);
18
+ const [isLoading, setIsLoading] = useState(false);
19
+ useEffect(() => {
20
+ const fetchGroup = async () => {
21
+ if (props.groupID && props.groupID > 0) {
22
+ setIsLoading(true);
23
+ let fetchedGroup = await SDK_Globals.tmSession?.NewGroupEngine().RetrieveAdminAsync(props.groupID);
24
+ setGroup(fetchedGroup ?? null);
25
+ setIsLoading(false);
26
+ }
27
+ };
28
+ fetchGroup();
29
+ }, [props.groupID]);
30
+ if (isLoading) {
31
+ return _jsxs("span", { children: [SDKUI_Localizator.Loading, "..."] });
32
+ }
33
+ if (!group) {
34
+ return _jsx("span", { children: SDKUI_Localizator.NoDataToDisplay });
35
+ }
36
+ return _jsxs("span", { children: [props.showIcon && _jsx(IconUserGroup, { color: '#767676', style: { marginRight: '4px' } }), group.name] });
37
+ };
@@ -8,9 +8,10 @@ import TMMetadataChooser from '../../../choosers/TMMetadataChooser';
8
8
  import TMButton from '../../../base/TMButton';
9
9
  import styled from 'styled-components';
10
10
  import TMQuerySummary from '../../../query/TMQuerySummary';
11
- import { CultureIDs } from '@topconsultnpm/sdk-ts-beta';
11
+ import { CultureIDs, FromItem, SearchEngine } from '@topconsultnpm/sdk-ts-beta';
12
12
  import TMLocalizedTextBox from '../../../editors/TMLocalizedTextBox';
13
13
  import TMDataListItemPicker from '../../../choosers/TMDataListItemPicker';
14
+ import WorkitemRecipientsEditor from './WorkitemRecipientsEditor';
14
15
  const FormContainer = styled.div `
15
16
  display: flex;
16
17
  flex-direction: column;
@@ -52,6 +53,11 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
52
53
  width = '700px';
53
54
  height = '230px';
54
55
  break;
56
+ case DiagramItemTypes.Approval:
57
+ case DiagramItemTypes.DataEntry:
58
+ width = '700px';
59
+ height = '510px';
60
+ break;
55
61
  default:
56
62
  width = '50%';
57
63
  height = '50%';
@@ -103,6 +109,30 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
103
109
  StatusValue: selectedItem.value
104
110
  }));
105
111
  }, []);
112
+ const handleAllowZeroTosChange = useCallback((newValue) => {
113
+ setLocalItem(prevLocalItem => ({
114
+ ...prevLocalItem,
115
+ AllowZeroTos: newValue
116
+ }));
117
+ }, []);
118
+ const handleTosChange = useCallback((newTos) => {
119
+ setLocalItem(prevLocalItem => ({
120
+ ...prevLocalItem,
121
+ Tos: newTos
122
+ }));
123
+ }, []);
124
+ const handleSetRuleChange = useCallback((newRule) => {
125
+ setLocalItem(prevLocalItem => ({
126
+ ...prevLocalItem,
127
+ SetRule: newRule
128
+ }));
129
+ }, []);
130
+ const handleSetRuleQDChange = useCallback((newQD) => {
131
+ setLocalItem(prevLocalItem => ({
132
+ ...prevLocalItem,
133
+ QD: newQD
134
+ }));
135
+ }, []);
106
136
  // Gestore per il salvataggio
107
137
  const handleSave = () => {
108
138
  onApply(localItem);
@@ -138,6 +168,36 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
138
168
  return updatedItem;
139
169
  });
140
170
  }, []);
171
+ const handleLocalizedDescriptionChange = useCallback((lang, newValue) => {
172
+ setLocalItem(prevLocalItem => {
173
+ const updatedItem = { ...prevLocalItem };
174
+ // Aggiungi la logica per aggiornare il campo corretto
175
+ switch (lang) {
176
+ case CultureIDs.It_IT:
177
+ updatedItem.Description_IT = newValue;
178
+ break;
179
+ case CultureIDs.En_US:
180
+ updatedItem.Description_EN = newValue;
181
+ break;
182
+ case CultureIDs.Fr_FR:
183
+ updatedItem.Description_FR = newValue;
184
+ break;
185
+ case CultureIDs.Pt_PT:
186
+ updatedItem.Description_PT = newValue;
187
+ break;
188
+ case CultureIDs.Es_ES:
189
+ updatedItem.Description_ES = newValue;
190
+ break;
191
+ case CultureIDs.De_DE:
192
+ updatedItem.Description_DE = newValue;
193
+ break;
194
+ default:
195
+ updatedItem.Description = newValue;
196
+ break;
197
+ }
198
+ return updatedItem;
199
+ });
200
+ }, []);
141
201
  // Function to render common elements like the name textbox
142
202
  const renderCommonFields = () => {
143
203
  if (localItem.Type !== DiagramItemTypes.Start && localItem.Type !== DiagramItemTypes.End && localItem.Type !== DiagramItemTypes.Exit && localItem.Type !== DiagramItemTypes.Status) {
@@ -157,6 +217,7 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
157
217
  const renderExitFields = () => {
158
218
  return (_jsx(TMCheckBox, { value: localItem.EndWFInstance ?? 0, label: SDKUI_Localizator.WorkflowEndInstance, isModifiedWhen: localItem.EndWFInstance !== localItemOrig.EndWFInstance, onValueChanged: handleEndWFInstanceChange }));
159
219
  };
220
+ // Function to render Condition-specific fields
160
221
  const renderConditionFields = () => {
161
222
  return (_jsx(TMQuerySummary, { qd: localItem.QD, onValueChanged: handleQDChange }));
162
223
  };
@@ -164,6 +225,18 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
164
225
  const renderStatusFields = () => {
165
226
  return (_jsx(TMDataListItemPicker, { dataListID: wf?.MStatusDLID, selectedValue: localItem.StatusValue, onItemSelect: handleStatusChange }));
166
227
  };
228
+ // Function to render Approval-specific fields
229
+ const renderApprovalFields = () => {
230
+ const newQD = () => {
231
+ const qd = SearchEngine.NewQueryDescriptor();
232
+ qd.id = -1;
233
+ qd.from = new FromItem();
234
+ qd.from.tid = wf?.MTID;
235
+ return qd;
236
+ };
237
+ const qdForRecipientsEditor = localItem.QD ?? newQD();
238
+ 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(TMCheckBox, { value: localItem.AllowZeroTos ?? 0, label: SDKUI_Localizator.WorkflowAllowZeroTos, isModifiedWhen: localItem.AllowZeroTos !== localItemOrig.AllowZeroTos, onValueChanged: handleAllowZeroTosChange }), _jsx(WorkitemRecipientsEditor, { tos: localItem.Tos ?? '', mTID: wf?.MTID, qd: qdForRecipientsEditor, setRule: localItem.SetRule, onTosChange: handleTosChange, onSetRuleChange: handleSetRuleChange, onQDChange: handleSetRuleQDChange })] }));
239
+ };
167
240
  const renderForm = () => {
168
241
  let specificFields;
169
242
  switch (localItem.Type) {
@@ -182,6 +255,10 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
182
255
  case DiagramItemTypes.Status:
183
256
  specificFields = renderStatusFields();
184
257
  break;
258
+ case DiagramItemTypes.Approval:
259
+ case DiagramItemTypes.DataEntry:
260
+ specificFields = renderApprovalFields();
261
+ break;
185
262
  default:
186
263
  specificFields = null;
187
264
  }
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { QueryDescriptor, WorkItemSetRules } from '@topconsultnpm/sdk-ts-beta';
3
+ export declare enum WorkItemActorTypes {
4
+ None = 0,
5
+ UID = 1,
6
+ GID = 2,
7
+ MID = 3,
8
+ QID = 4,
9
+ FXID = 5,
10
+ STID = 6
11
+ }
12
+ export interface WorkItemActor {
13
+ ActorType: WorkItemActorTypes;
14
+ ActorID: string;
15
+ Or: number;
16
+ }
17
+ interface WorkitemRecipientsEditorProps {
18
+ tos: string;
19
+ setRule: WorkItemSetRules | undefined;
20
+ qd: QueryDescriptor | undefined;
21
+ mTID: number | undefined;
22
+ onTosChange: (newTos: string) => void;
23
+ onSetRuleChange: (newRule: WorkItemSetRules) => void;
24
+ onQDChange: (newQD: QueryDescriptor | undefined) => void;
25
+ }
26
+ declare const WorkitemRecipientsEditor: React.FC<WorkitemRecipientsEditorProps>;
27
+ export default WorkitemRecipientsEditor;
@@ -0,0 +1,287 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from 'react';
3
+ import styled from 'styled-components';
4
+ import TMButton from '../../../base/TMButton';
5
+ import { IconAdd, IconMetadata, IconSavedQuery, IconUser, IconUserGroup, SDKUI_Localizator } from '../../../../helper'; // Importa anche IconAdd
6
+ import { TMUserChooserForm, TMUserIdViewer } from '../../../choosers/TMUserChooser';
7
+ import { TMGroupChooserForm, TMGroupIdViewer } from '../../../choosers/TMGroupChooser';
8
+ import { SDK_Globals, SDK_Localizator, WorkItemSetRules } from '@topconsultnpm/sdk-ts-beta';
9
+ import { TMMetadataChooserForm } from '../../../choosers/TMMetadataChooser';
10
+ import { FormModes } from '../../../../ts';
11
+ import TMDropDown from '../../../editors/TMDropDown';
12
+ import { TMMidViewer } from '../../../viewers/TMMidViewer';
13
+ import TMQueryEditor from '../../../query/TMQueryEditor';
14
+ import TMModal from '../../../base/TMModal';
15
+ import { ButtonNames, TMMessageBoxManager } from '../../../base/TMPopUp';
16
+ import { useOutsideClick } from '../../../../hooks/useOutsideClick';
17
+ export var WorkItemActorTypes;
18
+ (function (WorkItemActorTypes) {
19
+ WorkItemActorTypes[WorkItemActorTypes["None"] = 0] = "None";
20
+ WorkItemActorTypes[WorkItemActorTypes["UID"] = 1] = "UID";
21
+ WorkItemActorTypes[WorkItemActorTypes["GID"] = 2] = "GID";
22
+ WorkItemActorTypes[WorkItemActorTypes["MID"] = 3] = "MID";
23
+ WorkItemActorTypes[WorkItemActorTypes["QID"] = 4] = "QID";
24
+ WorkItemActorTypes[WorkItemActorTypes["FXID"] = 5] = "FXID";
25
+ WorkItemActorTypes[WorkItemActorTypes["STID"] = 6] = "STID";
26
+ })(WorkItemActorTypes || (WorkItemActorTypes = {}));
27
+ const RecipientsContainer = styled.div `
28
+ display: flex;
29
+ gap: 20px;
30
+ /* padding: 10px 0px; */
31
+ flex-wrap: wrap;
32
+ `;
33
+ const RecipientsColumn = styled.div `
34
+ flex: 1;
35
+ border: 1px solid #ccc;
36
+ border-radius: 5px;
37
+ padding: 10px;
38
+ min-width: 300px;
39
+ position: relative;
40
+ `;
41
+ const HeaderContainer = styled.div `
42
+ display: flex;
43
+ justify-content: space-between;
44
+ align-items: center;
45
+ position: relative;
46
+ margin-bottom: 10px;
47
+ `;
48
+ const RecipientItem = styled.div `
49
+ display: flex;
50
+ align-items: center;
51
+ margin-bottom: 5px;
52
+ gap: 5px;
53
+ `;
54
+ const RecipientRemoveButton = styled.span `
55
+ cursor: pointer;
56
+ color: #c00;
57
+ font-weight: bold;
58
+ `;
59
+ const FloatingMenu = styled.div `
60
+ position: absolute;
61
+ top: 100%; /* Si apre sotto il bottone */
62
+ right: 0; /* Allinea il bordo destro del menu con quello del genitore */
63
+ background-color: white;
64
+ border: 1px solid #ccc;
65
+ border-radius: 5px;
66
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
67
+ z-index: 10;
68
+ display: flex;
69
+ flex-direction: column; /* Disposizione verticale */
70
+ gap: 5px;
71
+ padding: 5px;
72
+ min-width: 150px;
73
+ transform: translateY(5px);
74
+ align-items: center; /* Centra i pulsanti orizzontalmente */
75
+ `;
76
+ const FloatingMenuButton = styled(TMButton) `
77
+ width: 100%; /* Rende i pulsanti interni larghi quanto il menu */
78
+ `;
79
+ const WorkitemRecipientsEditor = ({ tos, setRule, qd, mTID, onTosChange, onQDChange, onSetRuleChange }) => {
80
+ const [isAndMenuOpen, setIsAndMenuOpen] = useState(false);
81
+ const [isOrMenuOpen, setIsOrMenuOpen] = useState(false);
82
+ const [showUserChooser, setShowUserChooser] = useState(false);
83
+ const [showGroupChooser, setShowGroupChooser] = useState(false);
84
+ // const [showFxChartChooser, setShowFxChartChooser] = useState(false);
85
+ const [showMetadataChooser, setShowMetadataChooser] = useState(false);
86
+ const [showQdEditor, setShowQdEditor] = useState(false);
87
+ const andMenuRef = useOutsideClick(() => {
88
+ setIsAndMenuOpen(false);
89
+ });
90
+ // Applica il custom hook per il menu OR
91
+ const orMenuRef = useOutsideClick(() => {
92
+ setIsOrMenuOpen(false);
93
+ });
94
+ // useEffect(() => {
95
+ // const handleClickOutside = (event: MouseEvent) => {
96
+ // // Controlla il menu AND
97
+ // if (isAndMenuOpen && andMenuRef.current && !andMenuRef.current.contains(event.target as Node) && andButtonRef.current && !andButtonRef.current.contains(event.target as Node)) {
98
+ // setIsAndMenuOpen(false);
99
+ // }
100
+ // // Controlla il menu OR
101
+ // if (isOrMenuOpen && orMenuRef.current && !orMenuRef.current.contains(event.target as Node) && orButtonRef.current && !orButtonRef.current.contains(event.target as Node)) {
102
+ // setIsOrMenuOpen(false);
103
+ // }
104
+ // };
105
+ // // Aggiungi l'event listener se un menu è aperto
106
+ // if (isAndMenuOpen || isOrMenuOpen) {
107
+ // document.addEventListener('mousedown', handleClickOutside);
108
+ // }
109
+ // // Pulisci l'event listener
110
+ // return () => {
111
+ // document.removeEventListener('mousedown', handleClickOutside);
112
+ // };
113
+ // }, [isAndMenuOpen, isOrMenuOpen]);
114
+ // useEffect(() => {
115
+ // const handleKeyDown = (event: KeyboardEvent) => {
116
+ // if (event.key === 'Escape') {
117
+ // if (isAndMenuOpen) {
118
+ // setIsAndMenuOpen(false);
119
+ // event.stopPropagation(); // Ferma la propagazione per non chiudere anche il modale
120
+ // } else if (isOrMenuOpen) {
121
+ // setIsOrMenuOpen(false);
122
+ // event.stopPropagation(); // Ferma la propagazione per non chiudere anche il modale
123
+ // }
124
+ // }
125
+ // };
126
+ // if (isAndMenuOpen || isOrMenuOpen) {
127
+ // document.addEventListener('keydown', handleKeyDown);
128
+ // }
129
+ // return () => {
130
+ // document.removeEventListener('keydown', handleKeyDown);
131
+ // };
132
+ // }, [isAndMenuOpen, isOrMenuOpen]);
133
+ const parseTos = (tosString) => {
134
+ const andRecipients = [];
135
+ const orRecipients = [];
136
+ if (!tosString)
137
+ return { andRecipients, orRecipients };
138
+ const tokens1 = tosString.split(';');
139
+ for (const t of tokens1) {
140
+ const t1 = t.trim();
141
+ if (!t1)
142
+ continue;
143
+ const tokens2 = t1.split('|');
144
+ if (tokens2.length < 2)
145
+ continue;
146
+ const actorTypeStr = tokens2[0].toUpperCase();
147
+ const actorType = WorkItemActorTypes[actorTypeStr];
148
+ const actorID = tokens2[1];
149
+ const or = tokens2.length === 3 ? parseInt(tokens2[2], 10) : 0;
150
+ if (actorType !== undefined) {
151
+ const actor = {
152
+ ActorType: actorType,
153
+ ActorID: actorID,
154
+ Or: or,
155
+ };
156
+ if (or === 0) {
157
+ andRecipients.push(actor);
158
+ }
159
+ else {
160
+ orRecipients.push(actor);
161
+ }
162
+ }
163
+ }
164
+ return { andRecipients, orRecipients };
165
+ };
166
+ const { andRecipients, orRecipients } = useMemo(() => parseTos(tos), [tos]);
167
+ const actorsToTos = (actors) => {
168
+ return actors.map(actor => `${WorkItemActorTypes[actor.ActorType]}|${actor.ActorID}|${actor.Or}`).join(';');
169
+ };
170
+ const handleRemoveRecipient = (recipientToRemove) => {
171
+ const allRecipients = [...andRecipients, ...orRecipients];
172
+ const updatedRecipients = allRecipients.filter(r => r !== recipientToRemove);
173
+ const newTos = actorsToTos(updatedRecipients);
174
+ onTosChange(newTos);
175
+ };
176
+ const handleAddRecipients = (newRecipients) => {
177
+ const allRecipients = [...andRecipients, ...orRecipients];
178
+ const updatedRecipients = [...allRecipients, ...newRecipients]; // Aggiunge tutti i nuovi destinatari
179
+ const newTos = actorsToTos(updatedRecipients);
180
+ onTosChange(newTos);
181
+ setIsAndMenuOpen(false);
182
+ setIsOrMenuOpen(false);
183
+ setShowUserChooser(false);
184
+ setShowQdEditor(false);
185
+ };
186
+ const handleUserChosen = (IDs, orValue) => {
187
+ if (IDs && IDs.length > 0) {
188
+ const recipientsToAdd = IDs.map(id => ({
189
+ ActorType: WorkItemActorTypes.UID,
190
+ ActorID: id.toString(),
191
+ Or: orValue
192
+ }));
193
+ handleAddRecipients(recipientsToAdd);
194
+ }
195
+ setShowUserChooser(false);
196
+ };
197
+ const handleGroupChosen = (IDs, orValue) => {
198
+ if (IDs && IDs.length > 0) {
199
+ const recipientsToAdd = IDs.map(id => ({
200
+ ActorType: WorkItemActorTypes.GID,
201
+ ActorID: id.toString(),
202
+ Or: orValue
203
+ }));
204
+ handleAddRecipients(recipientsToAdd);
205
+ }
206
+ setShowGroupChooser(false);
207
+ };
208
+ const handleMetadataChosen = (IDs, orValue) => {
209
+ if (IDs && IDs.length > 0) {
210
+ const recipientsToAdd = IDs.map(id => ({
211
+ ActorType: WorkItemActorTypes.MID,
212
+ ActorID: id.mid ? id.mid.toString() : '0',
213
+ Or: orValue
214
+ }));
215
+ handleAddRecipients(recipientsToAdd);
216
+ }
217
+ setShowMetadataChooser(false);
218
+ };
219
+ const handleQdChosen = (newQd, orValue) => {
220
+ if (newQd) {
221
+ // 1. Unisci tutti i destinatari e filtra per rimuovere eventuali QID esistenti.
222
+ const allRecipients = [...andRecipients, ...orRecipients];
223
+ const updatedRecipients = allRecipients.filter(r => r.ActorType !== WorkItemActorTypes.QID);
224
+ // 2. Crea il nuovo destinatario QID
225
+ const recipientToAdd = {
226
+ ActorType: WorkItemActorTypes.QID,
227
+ ActorID: newQd.id ? newQd.id.toString() : '-1',
228
+ Or: orValue
229
+ };
230
+ // 3. Aggiungi il nuovo destinatario alla lista
231
+ updatedRecipients.push(recipientToAdd);
232
+ // 4. Converte la lista aggiornata in una stringa e aggiorna lo stato.
233
+ const newTos = actorsToTos(updatedRecipients);
234
+ onTosChange(newTos);
235
+ onQDChange(newQd);
236
+ }
237
+ setIsAndMenuOpen(false);
238
+ setIsOrMenuOpen(false);
239
+ setShowQdEditor(false);
240
+ };
241
+ const renderActorViewer = (recipient) => {
242
+ const actorId = parseInt(recipient.ActorID, 10);
243
+ switch (recipient.ActorType) {
244
+ case WorkItemActorTypes.UID:
245
+ return _jsx(TMUserIdViewer, { userId: actorId, showIcon: true });
246
+ case WorkItemActorTypes.GID:
247
+ return _jsx(TMGroupIdViewer, { groupID: actorId, showIcon: true });
248
+ case WorkItemActorTypes.MID:
249
+ return _jsx(TMMidViewer, { tid_mid: { tid: mTID, mid: actorId }, showIcon: true });
250
+ case WorkItemActorTypes.QID:
251
+ return (_jsx("span", { onDoubleClick: openQdEditor, style: { cursor: 'pointer' }, children: SDKUI_Localizator.WorkflowGetRecipientsFromQuery }));
252
+ default:
253
+ return _jsxs("span", { children: [WorkItemActorTypes[recipient.ActorType], ": ", recipient.ActorID] });
254
+ }
255
+ };
256
+ const openQdEditor = () => {
257
+ const filteredRecipients = [...andRecipients, ...orRecipients].filter(r => r.ActorType === WorkItemActorTypes.QID);
258
+ if (filteredRecipients.length > 0) {
259
+ TMMessageBoxManager.show({
260
+ buttons: [ButtonNames.OK],
261
+ title: SDK_Globals.appModule,
262
+ message: "Definire solo una query per i destinatari"
263
+ });
264
+ setIsAndMenuOpen(false);
265
+ setIsOrMenuOpen(false);
266
+ return;
267
+ }
268
+ setShowQdEditor(true);
269
+ };
270
+ const renderRecipientList = (recipients, title, orValue) => (_jsxs(RecipientsColumn, { children: [_jsxs(HeaderContainer, { children: [_jsx("p", { style: { fontWeight: 600 }, children: title }), _jsx(TMButton, { btnStyle: 'icon', caption: 'Aggiungi destinatario', icon: _jsx(IconAdd, {}), onClick: () => {
271
+ if (orValue === 0) {
272
+ setIsAndMenuOpen(prevState => !prevState);
273
+ setIsOrMenuOpen(false);
274
+ }
275
+ else {
276
+ setIsOrMenuOpen(prevState => !prevState);
277
+ setIsAndMenuOpen(false);
278
+ }
279
+ } }), (orValue === 0 && isAndMenuOpen) && (_jsxs(FloatingMenu, { ref: andMenuRef, children: [_jsx(FloatingMenuButton, { btnStyle: 'text', icon: _jsx(IconUser, {}), caption: SDK_Localizator.Users, onClick: () => setShowUserChooser(true) }), _jsx(FloatingMenuButton, { btnStyle: 'text', icon: _jsx(IconUserGroup, {}), caption: SDK_Localizator.Groups, onClick: () => setShowGroupChooser(true) }), _jsx(FloatingMenuButton, { btnStyle: 'text', icon: _jsx(IconMetadata, {}), caption: SDK_Localizator.Metadata, onClick: () => setShowMetadataChooser(true) }), _jsx(FloatingMenuButton, { btnStyle: 'text', icon: _jsx(IconSavedQuery, {}), caption: SDK_Localizator.Query, onClick: openQdEditor })] })), (orValue === 1 && isOrMenuOpen) && (_jsxs(FloatingMenu, { ref: orMenuRef, children: [_jsx(FloatingMenuButton, { btnStyle: 'text', icon: _jsx(IconUser, {}), caption: SDK_Localizator.Users, onClick: () => setShowUserChooser(true) }), _jsx(FloatingMenuButton, { btnStyle: 'text', icon: _jsx(IconUserGroup, {}), caption: SDK_Localizator.Groups, onClick: () => setShowGroupChooser(true) }), _jsx(FloatingMenuButton, { btnStyle: 'text', icon: _jsx(IconMetadata, {}), caption: SDK_Localizator.Metadata, onClick: () => setShowMetadataChooser(true) }), _jsx(FloatingMenuButton, { btnStyle: 'text', icon: _jsx(IconSavedQuery, {}), caption: SDK_Localizator.Query, onClick: openQdEditor })] }))] }), _jsx("div", { style: { height: '150px', overflowY: 'auto' }, children: recipients.map((recipient, index) => (_jsxs(RecipientItem, { children: [_jsx(RecipientRemoveButton, { onClick: () => handleRemoveRecipient(recipient), children: "\u274C" }), renderActorViewer(recipient)] }, index))) })] }));
280
+ const SET_RULE_DATASOURCE = [
281
+ { value: WorkItemSetRules.Ands_AND_Ors, display: "Ands_AND_Ors" },
282
+ { value: WorkItemSetRules.Ands_OR_Ors, display: "Ands_OR_Ors" }
283
+ ];
284
+ return (_jsxs("div", { children: [_jsxs(RecipientsContainer, { children: [renderRecipientList(andRecipients, 'Destinatari in AND', 0), renderRecipientList(orRecipients, 'Destinatari in OR', 1)] }), _jsx("div", { style: { display: 'flex', justifyContent: 'center' }, children: _jsx(TMDropDown, { label: SDKUI_Localizator.WorkflowRecipientSetRule, width: '230px', dataSource: SET_RULE_DATASOURCE, value: setRule, onValueChanged: (e) => { onSetRuleChange?.(e.target.value); } }) }), showUserChooser && _jsx(TMUserChooserForm, { allowMultipleSelection: true, allowSorting: true, onClose: () => setShowUserChooser(false), onChoose: (IDs) => handleUserChosen(IDs, isAndMenuOpen ? 0 : 1) }), showGroupChooser && _jsx(TMGroupChooserForm, { allowMultipleSelection: true, allowSorting: true, onClose: () => setShowGroupChooser(false), onChoose: (IDs) => handleGroupChosen(IDs, isAndMenuOpen ? 0 : 1) }), showMetadataChooser && mTID && _jsx(TMMetadataChooserForm, { allowMultipleSelection: true, allowSorting: true, tids: [mTID], onClose: () => setShowMetadataChooser(false), onChoose: (IDs) => handleMetadataChosen(IDs, isAndMenuOpen ? 0 : 1) }), showQdEditor &&
285
+ _jsx(TMModal, { title: SDKUI_Localizator.QueryDefine, children: _jsx(TMQueryEditor, { inputData: qd, formMode: FormModes.Update, onApplied: (newQd) => handleQdChosen(newQd, isAndMenuOpen ? 0 : 1), onClose: () => { setShowQdEditor(false); } }) })] }));
286
+ };
287
+ export default WorkitemRecipientsEditor;
@@ -1,4 +1,4 @@
1
- import { QueryDescriptor, WorkItemStatus } from "@topconsultnpm/sdk-ts-beta";
1
+ import { QueryDescriptor, WorkItemSetRules, WorkItemStatus } from "@topconsultnpm/sdk-ts-beta";
2
2
  export declare enum DiagramItemTypes {
3
3
  None = 0,
4
4
  Start = 1,
@@ -55,7 +55,7 @@ export interface DiagramItem {
55
55
  RegisterPost?: boolean;
56
56
  AllowZeroTos?: boolean;
57
57
  Tos?: string;
58
- SetRule?: number;
58
+ SetRule?: WorkItemSetRules;
59
59
  StartAfterArchive?: number;
60
60
  StartAfterUpdate?: number;
61
61
  StartAfterUpdateMIDs?: number[];
@@ -86,8 +86,8 @@ const TMChooserForm = ({ children, title, allowMultipleSelection = false, allowA
86
86
  ...summaryItems ?? {}
87
87
  });
88
88
  }, [manageUseLocalizedName, summaryItems]);
89
- return (_jsx(TMModal, { title: renderTitle(), width: width ?? '550px', height: height ?? '600px', toolbar: _jsx(ToolbarButtons, {}), onClose: onClose, children: (children ??
90
- filteredItems.length > 0)
89
+ return (_jsx(TMModal, { title: renderTitle(), width: width ?? '550px', height: height ?? '600px', toolbar: _jsx(ToolbarButtons, {}), onClose: onClose, children: children ??
90
+ filteredItems.length > 0
91
91
  ? _jsx(TMDataGrid, { dataSource: filteredItems, keyExpr: keyName, dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, searchPanelFocusStarting: true, headerFilter: { visible: true }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single', showCheckBoxesMode: 'always', selectAllMode: 'allPages' }, grouping: allowGrouping ? { autoExpandAll: false, expandMode: 'rowClick' } : undefined, summary: customSummary, onFocusedRowChanged: handleFocusedRowChange, onSelectionChanged: handleSelectionChanged, onRowDblClick: handleRowDoubleClick })
92
92
  : _jsx(TMLayoutContainer, { gap: 30, alignItems: 'center', justifyContent: 'center', children: _jsx(TMLayoutItem, { children: _jsx("p", { style: { height: "100%", color: TMColors.primaryColor, fontSize: "1.5rem", display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: SDKUI_Localizator.NoDataToDisplay }) }) }) }));
93
93
  };
@@ -44,6 +44,7 @@ export * from './choosers/TMDistinctValues';
44
44
  export * from './choosers/TMDiskChooser';
45
45
  export * from './choosers/TMDynDataListItemChooser';
46
46
  export * from './choosers/TMDcmtTypeChooser';
47
+ export * from './choosers/TMGroupChooser';
47
48
  export * from './choosers/TMInvoiceRetrieveFormats';
48
49
  export * from './choosers/TMMetadataChooser';
49
50
  export * from './choosers/TMOrderRetrieveFormats';
@@ -47,6 +47,7 @@ export * from './choosers/TMDistinctValues';
47
47
  export * from './choosers/TMDiskChooser';
48
48
  export * from './choosers/TMDynDataListItemChooser';
49
49
  export * from './choosers/TMDcmtTypeChooser';
50
+ export * from './choosers/TMGroupChooser';
50
51
  export * from './choosers/TMInvoiceRetrieveFormats';
51
52
  export * from './choosers/TMMetadataChooser';
52
53
  export * from './choosers/TMOrderRetrieveFormats';
@@ -41,6 +41,8 @@ export declare class SDKUI_Localizator {
41
41
  static get ArchivedDocuments(): string;
42
42
  static get ArchiveID(): "Armazena" | "Dokumentarisches Archiv" | "Documental archive" | "Archivo de documentos" | "Archivage des documents" | "Archivio documentale";
43
43
  static get AssignedTo(): string;
44
+ static get AttachDocument(): "Dokument anhängen" | "Attach Document" | "Adjuntar documento" | "Joindre un document" | "Anexar documento" | "Allega documento";
45
+ static get AttachingDocuments(): "Dokumente werden angehängt..." | "Attaching documents..." | "Adjuntando documentos..." | "Pièces jointes en cours..." | "Anexando documentos..." | "Allegando documenti...";
44
46
  static get Attachment(): string;
45
47
  static get Attachments(): string;
46
48
  static get Attention(): "Aufmerksamkeit" | "Attention" | "Atención" | "Atenção" | "Attenzione";
@@ -130,6 +132,7 @@ export declare class SDKUI_Localizator {
130
132
  static get DisplayFormat(): string;
131
133
  static get DistinctValues(): "Unterschiedliche Werte" | "Distinct values" | "Valores distintos" | "Valeurs distinctes" | "Valori distinti";
132
134
  static get DocumentArchivedSuccessfully(): "Dokument erfolgreich archiviert" | "Document archived successfully" | "Documento archivado con éxito" | "Document archivé avec succès" | "Documento arquivado com sucesso" | "Documento archiviato con successo";
135
+ static get DocumentAttachedSuccessfullyToEmail(): "Dokument erfolgreich zur E-Mail hinzugefügt." | "Document attached successfully to the email." | "Documento adjuntado exitosamente al correo electrónico." | "Document joint avec succès à l'e-mail." | "Documento anexado com sucesso ao e-mail." | "Documento allegato con successo all'email.";
133
136
  static get DocumentData(): string;
134
137
  static get DocumentNotAvailable(): string;
135
138
  static get DocumentOpenedSuccessfully(): "Dokument erfolgreich geöffnet" | "Document opened successfully" | "Documento abierto con éxito" | "Document ouvert avec succès" | "Documento aberto com sucesso" | "Documento aperto con successo";
@@ -214,6 +217,7 @@ export declare class SDKUI_Localizator {
214
217
  static get File_Downloading(): "Datei wird heruntergeladen" | "File is downloading..." | "El archivo se está descargando" | "Le fichier est en cours de téléchargement" | "O arquivo está sendo baixado" | "Il file è in fase di download";
215
218
  static get File_Size(): "Dateigröße" | "File size" | "Tamaño del archivo" | "Taille du fichier" | "Tamanho do arquivo" | "Dimensione del file";
216
219
  static get FromTime(): "wurde" | "from" | "par" | "dal";
220
+ static get FullEmailMessage(): "Vollständige E-Mail-Nachricht (.eml-Format)" | "Full email message (.eml format)" | "Mensaje de correo electrónico completo (formato .eml)" | "Message e-mail complet (format .eml)" | "Mensagem de e-mail completa (formato .eml)" | "Messaggio email completo (formato .eml)";
217
221
  static get FullTextSearch(): string;
218
222
  static get General(): "Allgemein" | "General" | "Général" | "Geral" | "Generale";
219
223
  static get GetFileDeletionErrorMessage(): "Fehler beim Löschen der Datei" | "Error deleting the file" | "Error al eliminar el archivo" | "Erreur lors de la suppression du fichier" | "Erro ao excluir o arquivo" | "Errore nell'eliminazione del file";
@@ -370,6 +374,7 @@ export declare class SDKUI_Localizator {
370
374
  static get PhysDelete(): "Physische Stornierung" | "Physical delete" | "Cancelación física" | "Supression" | "Cancelamento física" | "Cancellazione fisica";
371
375
  static get PhysicalHistoryDeletion(): string;
372
376
  static get Practice(): "Praxis" | "Practice" | "Práctica" | "Pratique" | "Prática" | "Pratica";
377
+ static get PreparingFileForArchive(): "Datei für Archivierung vorbereiten..." | "Preparing file for archive..." | "Preparando archivo para archivar..." | "Préparation du fichier pour l'archive..." | "Preparando arquivo para arquivar..." | "Preparazione del file per l'archivio...";
373
378
  static get PreviewDocument(): "Vorschau-Dokument" | "Preview document" | "Documento de vista previa" | "Document d'aperçu" | "Documento de pré-visualização" | "Anteprima documento";
374
379
  static get PreviewNotAvailableOnDevice(): string;
375
380
  static get PreviewView(): string;
@@ -433,6 +438,9 @@ export declare class SDKUI_Localizator {
433
438
  static get Seconds(): "Sekunden" | "Seconds" | "Segundos" | "Secondes" | "Segundas" | "Secondi";
434
439
  static get Select(): "Wählen Sie Ihre" | "Select" | "Seleccionar" | "Sélectionne" | "Selecione" | "Seleziona";
435
440
  static get SelectAnOperationBetween(): "Wählen Sie eine Operation zwischen" | "Select an operation between" | "Selecciona una operación entre" | "Sélectionnez une opération entre" | "Selecione uma operação entre" | "Seleziona un'operazione tra";
441
+ static get SelectArchiveToStart(): "Klicken Sie auf <b>Archivieren</b>, um zu beginnen." | "Click on <b>Archive</b> button to start." | "Haz clic en el botón <b>Archivar</b> para comenzar." | "Cliquez sur le bouton <b>Archiver</b> pour commencer." | "Clique no botão <b>Arquivar</b> para iniciar." | "Clicca sul pulsante <b>Archivia</b> per iniziare.";
442
+ static get SelectAttachToStart(): "Sie können Dateien zu Ihrer E-Mail hinzufügen, klicken Sie auf <b>Anhängen</b>, um zu beginnen." | "You can attach files to your email, click on <b>Attach</b> button to start." | "Puedes adjuntar archivos a tu correo electrónico, haz clic en el botón <b>Adjuntar</b> para comenzar." | "Vous pouvez joindre des fichiers à votre e-mail, cliquez sur le bouton <b>Joindre</b> pour commencer." | "Você pode anexar arquivos ao seu e-mail, clique no botão <b>Anexar</b> para iniciar." | "Puoi allegare file alla tua email, clicca sul pulsante <b>Allega</b> per iniziare.";
443
+ static get SelectedAttachmentFile(): "Ausgewählte Anhangsdatei" | "Selected attachment file" | "Archivo adjunto seleccionado" | "Fichier de pièce jointe sélectionné" | "Arquivo de anexo selecionado" | "File di allegato selezionato";
436
444
  static get SelectSupportAreaMessage(): "Wählen Sie einen Ablagebereich aus" | "Select a support area" | "Seleccione un área de apoyo" | "Sélectionnez une zone de support" | "Selecione uma área de apoio" | "Selezionare un'area di appoggio";
437
445
  static get SelectedSingular(): string;
438
446
  static get Selected(): "Ausgewählt" | "Selected" | "Sélectionné" | "Selecionado" | "Seleccionados" | "Selezionati";
@@ -530,6 +538,8 @@ export declare class SDKUI_Localizator {
530
538
  static get Warning(): "Warnung" | "Warning" | "advertencia" | "avertissement" | "aviso" | "Avviso";
531
539
  static get Welcome(): "Willkommen" | "Welcome" | "Bienvenido" | "Bienvenue" | "Bem-vindo" | "Benvenuto";
532
540
  static get WelcomeTo(): "Willkommen bei {{0}}" | "Welcome to {{0}}" | "Bienvenido a {{0}}" | "Bienvenue sur {{0}}" | "Bem-vindo à {{0}}" | "Benvenuto su {{0}}";
541
+ static get WhatWouldYouLikeToArchive(): "Was möchten Sie archivieren?" | "What would you like to archive?" | "¿Qué te gustaría archivar?" | "Que souhaitez-vous archiver?" | "O que gostaria de arquivar?" | "Cosa vorresti archiviare?";
542
+ static get WorkflowAllowZeroTos(): "0 Empfänger zulassen" | "Allow 0 recipients" | "Permitir 0 destinatarios" | "Autoriser 0 destinataires" | "Permitir 0 destinatários" | "Consenti 0 destinatari";
533
543
  static get WorkflowApproval(): "Workflow-Genehmigung" | "Workflow approval" | "Aprobación de flujo de trabajo" | "Approbation de workflow" | "Aprovação de fluxo de trabalho" | "Approvazione workflow";
534
544
  static get WorkflowDiagramMissingOrInvalid(): "Diagramm fehlt oder ist ungültig" | "Diagram missing or invalid" | "Diagrama no presente o no válido" | "Schéma manquant ou invalide" | "Diagrama ausente ou inválido" | "Diagramma non presente o non valido";
535
545
  static get WorkflowEndInstance(): "Instanz beenden" | "End instance" | "Finalizar instancia" | "Termine l'instance" | "Pare a instância" | "Termina istanza";
@@ -537,6 +547,8 @@ export declare class SDKUI_Localizator {
537
547
  static get WorkflowNoInstances(): "Keine Instanzen aktiv" | "No running instances" | "Ninguna instancia en curso" | "Aucune instance en cours" | "Nenhuma instância em execução" | "Nessuna istanza in corso";
538
548
  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";
539
549
  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";
550
+ 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";
551
+ 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";
540
552
  static get WorkGroup(): "Arbeitsgruppe" | "Work Group" | "Grupo de Trabajo" | "Groupe de travail" | "Grupo de Trabalho" | "Gruppo di lavoro";
541
553
  static get WorkgroupOperations(): string;
542
554
  static get WorkingGroups(): "Arbeitsgruppen" | "Work groups" | "Grupos de trabajo" | "Groupes de travail" | "Grupos de trabalho" | "Gruppi di lavoro";