@topconsultnpm/sdkui-react-beta 6.16.18 → 6.16.20

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.
@@ -1,23 +1,48 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback, useMemo, useState } from 'react'; // Importa useState
2
+ import { useCallback, useEffect, useMemo, useState } from 'react'; // Importa useState
3
3
  import TMModal from '../../../base/TMModal';
4
4
  import { DiagramItemTypes } from './interfaces';
5
5
  import TMCheckBox from '../../../editors/TMCheckBox';
6
- import { SDKUI_Localizator } from '../../../../helper';
6
+ import { calcIsModified, getSystemMetadata, IconUndo, SDKUI_Localizator } from '../../../../helper';
7
7
  import TMMetadataChooser from '../../../choosers/TMMetadataChooser';
8
+ import { FormModes, MetadataValueDescriptorEx } from '../../../../ts';
8
9
  import TMButton from '../../../base/TMButton';
9
10
  import styled from 'styled-components';
10
11
  import TMQuerySummary from '../../../query/TMQuerySummary';
11
- import { CultureIDs, FromItem, SearchEngine } from '@topconsultnpm/sdk-ts-beta';
12
+ import { CultureIDs, DcmtTypeListCacheService, FromItem, MetadataDataDomains, SDK_Globals, SearchEngine, WorkItemSetRules } from '@topconsultnpm/sdk-ts-beta';
12
13
  import TMLocalizedTextBox from '../../../editors/TMLocalizedTextBox';
13
14
  import TMDataListItemPicker from '../../../choosers/TMDataListItemPicker';
14
15
  import WorkitemRecipientsEditor from './WorkitemRecipientsEditor';
16
+ import TMDropDown from '../../../editors/TMDropDown';
17
+ import TMMetadataValues, { AdvancedMenuButtons, ShowCheckBoxesMode } from '../../../editors/TMMetadataValues';
18
+ import TMFormulaEditor, { FormulaDescriptor, FormulaHelper, FormulaTargets } from '../../../editors/TMFormulaEditor';
19
+ import TMDistinctValues from '../../../choosers/TMDistinctValues';
15
20
  const FormContainer = styled.div `
16
21
  display: flex;
17
22
  flex-direction: column;
18
23
  gap: 5px;
19
24
  padding: 10px;
20
25
  `;
26
+ const FlexContainer = styled.div `
27
+ display: flex;
28
+ align-items: center;
29
+ gap: 20px;
30
+ `;
31
+ const BoxContainer = styled.div `
32
+ flex: 1;
33
+ border: 1px solid #ccc;
34
+ border-radius: 5px;
35
+ padding: 10px;
36
+ min-width: 300px;
37
+ position: relative;
38
+ `;
39
+ const HeaderContainer = styled.div `
40
+ display: flex;
41
+ justify-content: space-between;
42
+ align-items: center;
43
+ position: relative;
44
+ margin-bottom: 10px;
45
+ `;
21
46
  const ButtonsContainer = styled.div `
22
47
  display: flex;
23
48
  justify-content: center;
@@ -25,6 +50,10 @@ const ButtonsContainer = styled.div `
25
50
  margin-top: auto;
26
51
  padding-top: 20px;
27
52
  `;
53
+ const SET_RULE_DATASOURCE = [
54
+ { value: WorkItemSetRules.Ands_AND_Ors, display: "Ands_AND_Ors" },
55
+ { value: WorkItemSetRules.Ands_OR_Ors, display: "Ands_OR_Ors" }
56
+ ];
28
57
  const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
29
58
  const [localItem, setLocalItem] = useState(itemToEdit);
30
59
  const [localItemOrig] = useState(structuredClone(itemToEdit));
@@ -58,6 +87,10 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
58
87
  width = '700px';
59
88
  height = '510px';
60
89
  break;
90
+ case DiagramItemTypes.UpdateDcmt:
91
+ width = '700px';
92
+ height = '510px';
93
+ break;
61
94
  default:
62
95
  width = '50%';
63
96
  height = '50%';
@@ -65,6 +98,15 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
65
98
  }
66
99
  return { calculatedWidth: width, calculatedHeight: height };
67
100
  }, [localItem.Type]);
101
+ const isModified = useMemo(() => calcIsModified(localItem, localItemOrig), [localItem, localItemOrig]);
102
+ const handleCancel = () => {
103
+ setLocalItem(localItemOrig); // Revert to the original state
104
+ onClose();
105
+ };
106
+ const handleSave = () => {
107
+ onApply(localItem);
108
+ onClose();
109
+ };
68
110
  const handleStartAfterArchiveChange = useCallback((newValue) => {
69
111
  setLocalItem(prevLocalItem => ({
70
112
  ...prevLocalItem,
@@ -133,11 +175,6 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
133
175
  QD: newQD
134
176
  }));
135
177
  }, []);
136
- // Gestore per il salvataggio
137
- const handleSave = () => {
138
- onApply(localItem);
139
- onClose();
140
- };
141
178
  const handleLocalizedNameChange = useCallback((lang, newValue) => {
142
179
  setLocalItem(prevLocalItem => {
143
180
  const updatedItem = { ...prevLocalItem };
@@ -198,6 +235,20 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
198
235
  return updatedItem;
199
236
  });
200
237
  }, []);
238
+ const handleMetadataValuesChanged = useCallback((newItems) => {
239
+ const updatedMetadataValues = newItems
240
+ .filter(item => item.isNull || item.value)
241
+ .map(item => {
242
+ const newMvd = new MetadataValueDescriptorEx();
243
+ newMvd.mid = item.mid;
244
+ newMvd.value = item.isNull ? undefined : item.value;
245
+ return newMvd;
246
+ });
247
+ setLocalItem(prevLocalItem => ({
248
+ ...prevLocalItem,
249
+ MetadataValues: updatedMetadataValues
250
+ }));
251
+ }, []);
201
252
  // Function to render common elements like the name textbox
202
253
  const renderCommonFields = () => {
203
254
  if (localItem.Type !== DiagramItemTypes.Start && localItem.Type !== DiagramItemTypes.End && localItem.Type !== DiagramItemTypes.Exit && localItem.Type !== DiagramItemTypes.Status) {
@@ -235,7 +286,77 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
235
286
  return qd;
236
287
  };
237
288
  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 })] }));
289
+ 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 })] })] }));
290
+ };
291
+ // Function to render UpdateDcmt-specific fields
292
+ const renderUpdateDcmtFields = () => {
293
+ const [metadataValues, setMetadataValues] = useState([]);
294
+ const [metadataValuesOrig, setMetadataValuesOrig] = useState([]);
295
+ const [focusedMetadataValue, setFocusedMetadataValue] = useState();
296
+ const [showDistinctValuesPanel, setShowDistinctValuesPanel] = useState(false);
297
+ const [showFormulaEditor, setShowFormulaEditor] = useState(false);
298
+ const [dtd, setDtd] = useState();
299
+ const TID = wf?.MTID;
300
+ useEffect(() => {
301
+ DcmtTypeListCacheService.GetAsync(TID).then((dtd) => setDtd(dtd));
302
+ }, [TID]);
303
+ useEffect(() => {
304
+ const mappedValues = dtd?.metadata?.filter(o => o.dataDomain !== MetadataDataDomains.Computed &&
305
+ o.isSystem !== 1).map(item => ({
306
+ mid: item.id,
307
+ tid: TID,
308
+ value: localItem.MetadataValues?.find(o => o.mid === item.id)?.value,
309
+ md: item,
310
+ isRequired: item.isRequired,
311
+ isEditable: FormulaHelper.isFormula(localItem.MetadataValues?.find(o => o.mid === item.id)?.value),
312
+ isLexProt: 0,
313
+ isSelected: localItem.MetadataValues?.find(o => o.mid === item.id) !== undefined,
314
+ isNull: localItem.MetadataValues?.find(o => o.mid === item.id) && localItem.MetadataValues?.find(o => o.mid === item.id)?.value === undefined,
315
+ }));
316
+ setMetadataValues(mappedValues);
317
+ setMetadataValuesOrig(structuredClone(mappedValues));
318
+ setFocusedMetadataValue(undefined);
319
+ setShowDistinctValuesPanel(false);
320
+ setShowFormulaEditor(false);
321
+ }, [dtd, localItem.MetadataValues]);
322
+ const validationItems = [];
323
+ const getFormula = () => {
324
+ let fd = new FormulaDescriptor();
325
+ fd.expression = FormulaHelper.isFormula(focusedMetadataValue?.value) ? FormulaHelper.removeFormulaTag(focusedMetadataValue?.value) : undefined;
326
+ fd.formulaTarget = FormulaTargets.BatchUpdate;
327
+ fd.items = FormulaHelper.TreeViewList(TID ?? 0, getSystemMetadata(true), undefined, FormulaTargets.BatchUpdate, SDK_Globals.dbBrand);
328
+ fd.mid = focusedMetadataValue?.mid ?? 0;
329
+ fd.tid = TID;
330
+ return fd;
331
+ };
332
+ const handleAdvancedMenuClick = useCallback((e) => {
333
+ switch (e.button) {
334
+ case AdvancedMenuButtons.DistinctValues:
335
+ setShowDistinctValuesPanel(prev => !prev);
336
+ setShowFormulaEditor(false);
337
+ break;
338
+ case AdvancedMenuButtons.FormulaEditor:
339
+ setShowFormulaEditor(prev => !prev);
340
+ setShowDistinctValuesPanel(false);
341
+ break;
342
+ }
343
+ }, []);
344
+ // Return the TMMetadataValues component with the necessary props
345
+ return (_jsxs(_Fragment, { children: [_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 &&
346
+ _jsx(TMDistinctValues, { isModal: true, tid: TID, mid: focusedMetadataValue?.mid, separator: ', ', allowAppendMode: false, onClosePanelCallback: () => setShowDistinctValuesPanel(false), onSelectionChanged: (e) => {
347
+ if (!e)
348
+ return;
349
+ setMetadataValues((prevItems) => prevItems.map((item) => item.tid == e.tid && item.mid === e.mid ? { ...item, value: e.newValue, isSelected: true } : item));
350
+ } }), showFormulaEditor && focusedMetadataValue &&
351
+ _jsx(TMFormulaEditor, { isModal: true, formMode: FormModes.Update, inputData: getFormula(), showBack: false, onClose: () => setShowFormulaEditor(false), onApplied: (newFormula) => {
352
+ setMetadataValues((prevItems) => prevItems.map((item) => item.tid == newFormula.tid && item.mid === newFormula.mid ? { ...item, value: FormulaHelper.addFormulaTag(newFormula.expression), isSelected: true, isEditable: true } : item));
353
+ setFocusedMetadataValue(prevState => ({
354
+ ...prevState,
355
+ isSelected: true,
356
+ isEditable: true,
357
+ value: FormulaHelper.addFormulaTag(newFormula.expression)
358
+ }));
359
+ } })] }));
239
360
  };
240
361
  const renderForm = () => {
241
362
  let specificFields;
@@ -259,10 +380,13 @@ const DiagramItemForm = ({ itemToEdit, wf, onClose, onApply }) => {
259
380
  case DiagramItemTypes.DataEntry:
260
381
  specificFields = renderApprovalFields();
261
382
  break;
383
+ case DiagramItemTypes.UpdateDcmt:
384
+ specificFields = renderUpdateDcmtFields();
385
+ break;
262
386
  default:
263
387
  specificFields = null;
264
388
  }
265
- return (_jsxs(FormContainer, { children: [renderCommonFields(), specificFields, _jsx(ButtonsContainer, { children: _jsx(TMButton, { caption: 'Applica', color: 'success', showTooltip: false, onClick: handleSave }) })] }));
389
+ return (_jsxs(FormContainer, { children: [renderCommonFields(), specificFields, _jsxs(ButtonsContainer, { children: [_jsx(TMButton, { caption: 'Applica', color: 'tertiary', showTooltip: false, disabled: !isModified, onClick: handleSave }), _jsx(TMButton, { caption: 'Annulla', btnStyle: 'toolbar', color: 'primary', icon: _jsx(IconUndo, {}), showTooltip: false, disabled: !isModified, onClick: handleCancel })] })] }));
266
390
  };
267
391
  return (_jsx(TMModal, { title: DiagramItemTypes[localItem.Type].toString(), onClose: onClose, isModal: true, width: calculatedWidth, height: calculatedHeight, children: renderForm() }));
268
392
  };
@@ -1,12 +1,10 @@
1
1
  import React from 'react';
2
- import { QueryDescriptor, WorkItemSetRules } from '@topconsultnpm/sdk-ts-beta';
2
+ import { QueryDescriptor } from '@topconsultnpm/sdk-ts-beta';
3
3
  interface WorkitemRecipientsEditorProps {
4
4
  tos: string;
5
- setRule: WorkItemSetRules | undefined;
6
5
  qd: QueryDescriptor | undefined;
7
6
  mTID: number | undefined;
8
7
  onTosChange: (newTos: string) => void;
9
- onSetRuleChange: (newRule: WorkItemSetRules) => void;
10
8
  onQDChange: (newQD: QueryDescriptor | undefined) => void;
11
9
  }
12
10
  declare const WorkitemRecipientsEditor: React.FC<WorkitemRecipientsEditorProps>;
@@ -1,10 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import styled from 'styled-components';
4
- import TMDropDown from '../../../editors/TMDropDown';
5
- import { WorkItemSetRules } from '@topconsultnpm/sdk-ts-beta';
6
4
  import RecipientList, { WorkItemActorTypes } from './RecipientList';
7
- import { SDKUI_Localizator } from '../../../../helper';
8
5
  const RecipientsContainer = styled.div `
9
6
  display: flex;
10
7
  gap: 20px;
@@ -46,7 +43,7 @@ const tosToActors = (tosString) => {
46
43
  const actorsToTos = (actors) => {
47
44
  return actors.map(actor => `${WorkItemActorTypes[actor.ActorType]}|${actor.ActorID}|${actor.Or}`).join(';');
48
45
  };
49
- const WorkitemRecipientsEditor = ({ tos, setRule, qd, mTID, onTosChange, onQDChange, onSetRuleChange }) => {
46
+ const WorkitemRecipientsEditor = ({ tos, qd, mTID, onTosChange, onQDChange }) => {
50
47
  const [localTos, setLocalTos] = useState(tos);
51
48
  useEffect(() => {
52
49
  setLocalTos(tos);
@@ -94,10 +91,6 @@ const WorkitemRecipientsEditor = ({ tos, setRule, qd, mTID, onTosChange, onQDCha
94
91
  onTosChange(newTos);
95
92
  onQDChange(newQd);
96
93
  }, [andRecipients, orRecipients, onTosChange, onQDChange]);
97
- const SET_RULE_DATASOURCE = [
98
- { value: WorkItemSetRules.Ands_AND_Ors, display: "Ands_AND_Ors" },
99
- { value: WorkItemSetRules.Ands_OR_Ors, display: "Ands_OR_Ors" }
100
- ];
101
- return (_jsxs("div", { children: [_jsxs(RecipientsContainer, { children: [_jsx(RecipientList, { recipients: andRecipients, title: "Destinatari in AND", tid: mTID, qd: qd, onQDChange: (newQd) => newQd && handleQDChosen(newQd, 0), onAdd: (newRecipients) => handleAddRecipients(newRecipients, 0), onRemove: handleRemoveRecipient }), _jsx(RecipientList, { recipients: orRecipients, title: "Destinatari in OR", tid: mTID, qd: qd, onQDChange: (newQd) => newQd && handleQDChosen(newQd, 1), onAdd: (newRecipients) => handleAddRecipients(newRecipients, 1), onRemove: handleRemoveRecipient })] }), _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); } }) })] }));
94
+ return (_jsxs(RecipientsContainer, { children: [_jsx(RecipientList, { recipients: andRecipients, title: "Destinatari in AND", tid: mTID, qd: qd, onQDChange: (newQd) => newQd && handleQDChosen(newQd, 0), onAdd: (newRecipients) => handleAddRecipients(newRecipients, 0), onRemove: handleRemoveRecipient }), _jsx(RecipientList, { recipients: orRecipients, title: "Destinatari in OR", tid: mTID, qd: qd, onQDChange: (newQd) => newQd && handleQDChosen(newQd, 1), onAdd: (newRecipients) => handleAddRecipients(newRecipients, 1), onRemove: handleRemoveRecipient })] }));
102
95
  };
103
96
  export default WorkitemRecipientsEditor;
@@ -1,4 +1,5 @@
1
1
  import { QueryDescriptor, WorkItemSetRules, WorkItemStatus } from "@topconsultnpm/sdk-ts-beta";
2
+ import { MetadataValueDescriptorEx } from "../../../../ts";
2
3
  export declare enum DiagramItemTypes {
3
4
  None = 0,
4
5
  Start = 1,
@@ -64,7 +65,7 @@ export interface DiagramItem {
64
65
  EndWFInstance?: number;
65
66
  QD?: QueryDescriptor;
66
67
  SOD?: string;
67
- MetadataValues?: string;
68
+ MetadataValues?: MetadataValueDescriptorEx[];
68
69
  Severity?: number;
69
70
  RegAsWfInstPart?: number;
70
71
  FormatCultureID?: number;
@@ -0,0 +1,14 @@
1
+ import { MetadataValueDescriptorEx } from "../../../../ts";
2
+ /**
3
+ * Parsa la stringa XML annidata di MetadataValues in un array di MetadataValueDescriptor.
4
+ * @param xmlString La stringa XML grezza contenente le entità codificate.
5
+ * @returns Un array di MetadataValueDescriptor.
6
+ */
7
+ export declare const parseMetadataValuesXml: (xmlString: string) => MetadataValueDescriptorEx[];
8
+ /**
9
+ * Serializza un array di MetadataValueDescriptor nella stringa XML richiesta
10
+ * dal C# DataContractSerializer, con le entità codificate.
11
+ * @param metadataValues L'array di MetadataValueDescriptor da serializzare.
12
+ * @returns La stringa XML pronta da inserire nel tag <MetadataValues>.
13
+ */
14
+ export declare const serializeMetadataValuesToXml: (metadataValues: MetadataValueDescriptorEx[] | undefined) => string;
@@ -0,0 +1,71 @@
1
+ import { MetadataValueDescriptorEx } from "../../../../ts";
2
+ // Funzione per decodificare le entità HTML/XML
3
+ const decodeXmlEntities = (xmlString) => {
4
+ return xmlString.replace(/&lt;/g, "<")
5
+ .replace(/&gt;/g, ">")
6
+ .replace(/&amp;/g, "&")
7
+ .replace(/&quot;/g, '"')
8
+ .replace(/&apos;/g, "'");
9
+ };
10
+ // Funzione per codificare le entità XML
11
+ const encodeXmlEntities = (xmlString) => {
12
+ return xmlString.replace(/&/g, "&amp;")
13
+ .replace(/</g, "&lt;")
14
+ .replace(/>/g, "&gt;")
15
+ .replace(/"/g, "&quot;")
16
+ .replace(/'/g, "&apos;");
17
+ };
18
+ /**
19
+ * Parsa la stringa XML annidata di MetadataValues in un array di MetadataValueDescriptor.
20
+ * @param xmlString La stringa XML grezza contenente le entità codificate.
21
+ * @returns Un array di MetadataValueDescriptor.
22
+ */
23
+ export const parseMetadataValuesXml = (xmlString) => {
24
+ const parser = new DOMParser();
25
+ const decodedXml = decodeXmlEntities(xmlString);
26
+ const xmlDoc = parser.parseFromString(decodedXml, "application/xml");
27
+ const metadataDescriptors = [];
28
+ const itemsXML = xmlDoc.querySelectorAll("MetadataValueDescriptor");
29
+ itemsXML.forEach(itemXML => {
30
+ const descriptor = new MetadataValueDescriptorEx();
31
+ descriptor.mid = parseInt(itemXML.querySelector("MID")?.textContent || "0", 10);
32
+ descriptor.metadataName = itemXML.querySelector("MetadataName")?.textContent || undefined;
33
+ descriptor.value = itemXML.querySelector("Value")?.textContent || undefined;
34
+ metadataDescriptors.push(descriptor);
35
+ });
36
+ return metadataDescriptors;
37
+ };
38
+ /**
39
+ * Serializza un array di MetadataValueDescriptor nella stringa XML richiesta
40
+ * dal C# DataContractSerializer, con le entità codificate.
41
+ * @param metadataValues L'array di MetadataValueDescriptor da serializzare.
42
+ * @returns La stringa XML pronta da inserire nel tag <MetadataValues>.
43
+ */
44
+ export const serializeMetadataValuesToXml = (metadataValues) => {
45
+ if (!metadataValues || metadataValues.length === 0) {
46
+ return "";
47
+ }
48
+ let xml = `<ArrayOfMetadataValueDescriptor xmlns="http://schemas.datacontract.org/2004/07/TopConsult.TM5.Server.WEBSDK.Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">`;
49
+ metadataValues.forEach(md => {
50
+ xml += `<MetadataValueDescriptor>`;
51
+ xml += `<MID>${md.mid}</MID>`;
52
+ // Il C# DataContractSerializer usa <MetadataName i:nil="true"/> per valori nulli
53
+ if (md.metadataName === undefined || md.metadataName === null) {
54
+ xml += `<MetadataName i:nil="true"/>`;
55
+ }
56
+ else {
57
+ xml += `<MetadataName>${md.metadataName}</MetadataName>`;
58
+ }
59
+ // Gestione del valore (potrebbe essere nullo o vuoto)
60
+ if (md.value === undefined || md.value === null) {
61
+ xml += `<Value i:nil="true"/>`;
62
+ }
63
+ else {
64
+ xml += `<Value>${md.value}</Value>`;
65
+ }
66
+ xml += `</MetadataValueDescriptor>`;
67
+ });
68
+ xml += `</ArrayOfMetadataValueDescriptor>`;
69
+ // Codifica le entità XML per inserire la stringa nel tag principale
70
+ return encodeXmlEntities(xml);
71
+ };
@@ -1,6 +1,7 @@
1
1
  import { ArrowSymbol } from './interfaces';
2
2
  import { WorkItemStatus } from '@topconsultnpm/sdk-ts-beta';
3
3
  import { parseQueryDescriptorXml } from './queryDescriptorParser'; // Import the new parser
4
+ import { parseMetadataValuesXml } from './metadataParser';
4
5
  // Funzione helper per mappare i valori numerici di OutputStatus
5
6
  const mapOutputStatus = (statusValue) => {
6
7
  switch (statusValue) {
@@ -67,6 +68,11 @@ export const parseWfDiagramXml = (xmlString) => {
67
68
  // Parse the QD XML string into a QueryDescriptor object
68
69
  parsedQD = parseQueryDescriptorXml(qdXmlString);
69
70
  }
71
+ const metadataValuesXmlString = itemXML.querySelector("MetadataValues")?.textContent || undefined;
72
+ let parsedMetadataValues = undefined;
73
+ if (metadataValuesXmlString) {
74
+ parsedMetadataValues = parseMetadataValuesXml(metadataValuesXmlString);
75
+ }
70
76
  const item = {
71
77
  ID: itemXML.querySelector("ID")?.textContent || "",
72
78
  Left: left,
@@ -101,7 +107,7 @@ export const parseWfDiagramXml = (xmlString) => {
101
107
  EndWFInstance: parseInt(itemXML.querySelector("EndWFInstance")?.textContent || "0", 10),
102
108
  QD: parsedQD, // Assign the parsed object
103
109
  SOD: itemXML.querySelector("SOD")?.textContent || undefined,
104
- MetadataValues: itemXML.querySelector("MetadataValues")?.textContent || undefined,
110
+ MetadataValues: parsedMetadataValues,
105
111
  Severity: parseInt(itemXML.querySelector("Severity")?.textContent || "0", 10),
106
112
  RegAsWfInstPart: parseInt(itemXML.querySelector("RegAsWfInstPart")?.textContent || "0", 10),
107
113
  FormatCultureID: parseInt(itemXML.querySelector("FormatCultureID")?.textContent || "0", 10),
@@ -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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.16.18",
3
+ "version": "6.16.20",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -38,7 +38,7 @@
38
38
  "lib"
39
39
  ],
40
40
  "dependencies": {
41
- "@topconsultnpm/sdk-ts-beta": "6.16.2",
41
+ "@topconsultnpm/sdk-ts-beta": "6.16.3",
42
42
  "buffer": "^6.0.3",
43
43
  "devextreme": "25.1.4",
44
44
  "devextreme-react": "25.1.4",