@topconsultnpm/sdkui-react-beta 6.16.67 → 6.16.68

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.
@@ -189,7 +189,7 @@ const TMFileManager = (props) => {
189
189
  const handleDragLeave = (e) => {
190
190
  setIsDragging(false);
191
191
  };
192
- return _jsx(TMPanel, { title: SDKUI_Localizator.Drafts, totalItems: dcmtsFound ?? 0, showHeader: showPanel, onBack: (isMobile && openDraftList) ? onBackCallback : undefined, onClose: onClosePanel, allowMaximize: !isMobile ? allowMaximize : false, onMaximize: !isMobile ? onMaximizePanel : undefined, onHeaderDoubleClick: !isMobile ? onMaximizePanel : undefined, toolbar: toolbar, children: _jsx("div", { style: { flexDirection: "column", height: "100%", width: "100%", }, children: _jsxs(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: "flex", flexGrow: 1, height: "100%" }, children: _jsx(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: [isLeftPanelCollapsed ? '0%' : "30%", isLeftPanelCollapsed ? '100%' : "70%"], children: children }, "TMWGs-panels-treeView") }), children: [_jsxs("div", { style: {
192
+ return _jsx(TMPanel, { title: SDKUI_Localizator.Drafts, totalItems: dcmtsFound ?? 0, showHeader: showPanel, onBack: (isMobile && openDraftList) ? onBackCallback : undefined, onClose: onClosePanel, allowMaximize: !isMobile ? allowMaximize : false, onMaximize: !isMobile ? onMaximizePanel : undefined, onHeaderDoubleClick: !isMobile ? onMaximizePanel : undefined, toolbar: toolbar, children: _jsx("div", { style: { flexDirection: "column", height: "100%", width: "100%", }, children: _jsxs(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: "flex", flexGrow: 1, height: "100%" }, children: _jsx(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: [isLeftPanelCollapsed ? '0%' : "32.5%", isLeftPanelCollapsed ? '100%' : "67.5%"], children: children }, "TMWGs-panels-treeView") }), children: [_jsxs("div", { style: {
193
193
  height: "100%",
194
194
  width: "100%",
195
195
  ...(isMobile && { display: openDraftList ? 'none' : 'block', transition: "opacity 0.3s ease-in-out" }),
@@ -7,7 +7,7 @@ const TMVilViewer = ({ vil = [] }) => {
7
7
  if (!vil)
8
8
  return [];
9
9
  let errItems = [];
10
- let sortedVil = vil.sort((a, b) => a.ResultType.localeCompare(b.ResultType));
10
+ let sortedVil = vil.slice().sort((a, b) => a.ResultType.localeCompare(b.ResultType));
11
11
  for (let i = 0; i < sortedVil.length; i++) {
12
12
  let viColor = sortedVil[i].ResultType == ResultTypes.ERROR ? TMColors.error : sortedVil[i].ResultType == ResultTypes.INFO ? TMColors.info : TMColors.tertiary;
13
13
  let msg_prefix = sortedVil.length > 1 ? `${i + 1}) ` : '';
@@ -70,7 +70,7 @@ export interface DiagramItem {
70
70
  RegAsWfInstPart?: number;
71
71
  FormatCultureID?: CultureIDs | undefined;
72
72
  Tos2?: string;
73
- QD2?: string;
73
+ QD2?: QueryDescriptor;
74
74
  PlatformObjName?: string;
75
75
  PlatformObjDescr?: string;
76
76
  Value1asInt?: number;
@@ -1,20 +1,4 @@
1
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
2
  /**
19
3
  * Parsa la stringa XML annidata di MetadataValues in un array di MetadataValueDescriptor.
20
4
  * @param xmlString La stringa XML grezza contenente le entità codificate.
@@ -22,8 +6,7 @@ const encodeXmlEntities = (xmlString) => {
22
6
  */
23
7
  export const parseMetadataValuesXml = (xmlString) => {
24
8
  const parser = new DOMParser();
25
- const decodedXml = decodeXmlEntities(xmlString);
26
- const xmlDoc = parser.parseFromString(decodedXml, "application/xml");
9
+ const xmlDoc = parser.parseFromString(xmlString, "application/xml");
27
10
  const metadataDescriptors = [];
28
11
  const itemsXML = xmlDoc.querySelectorAll("MetadataValueDescriptor");
29
12
  itemsXML.forEach(itemXML => {
@@ -67,5 +50,5 @@ export const serializeMetadataValuesToXml = (metadataValues) => {
67
50
  });
68
51
  xml += `</ArrayOfMetadataValueDescriptor>`;
69
52
  // Codifica le entità XML per inserire la stringa nel tag principale
70
- return encodeXmlEntities(xml);
53
+ return xml;
71
54
  };
@@ -1,2 +1,3 @@
1
1
  import { QueryDescriptor } from '@topconsultnpm/sdk-ts-beta';
2
2
  export declare const parseQueryDescriptorXml: (xmlString: string) => QueryDescriptor | undefined;
3
+ export declare const serializeQueryDescriptorXml: (qd: QueryDescriptor | undefined) => Promise<string>;
@@ -1,4 +1,4 @@
1
- import { FromItem, JoinItem, OnJoinItem, OrderByItem, QueryDescriptor, QueryParameterDescriptor, SelectItem, WhereItem } from '@topconsultnpm/sdk-ts-beta';
1
+ import { FromItem, JoinItem, OnJoinItem, OrderByItem, QueryDescriptor, QueryParameterDescriptor, SDK_Globals, SelectItem, WhereItem } from '@topconsultnpm/sdk-ts-beta';
2
2
  /**
3
3
  * Safely gets text content of an element and converts to a number.
4
4
  * Returns undefined if element or content is missing/invalid.
@@ -174,3 +174,15 @@ export const parseQueryDescriptorXml = (xmlString) => {
174
174
  queryDescriptor.params = paramsItems.length > 0 ? paramsItems : undefined;
175
175
  return queryDescriptor;
176
176
  };
177
+ export const serializeQueryDescriptorXml = async (qd) => {
178
+ // try {
179
+ if (!qd)
180
+ return '';
181
+ let xml = await SDK_Globals.tmSession?.NewDcmtPlatformEngine().UtilsSerializeQdAsync(qd) ?? '';
182
+ return xml;
183
+ // } catch (error) {
184
+ // console.error('Error serializing QueryDescriptor to XML:', error);
185
+ //TODO: gestire errore
186
+ // return '';
187
+ // }
188
+ };
@@ -1,11 +1,10 @@
1
1
  import { WfDiagram } from './interfaces';
2
- import { CultureIDs, QueryDescriptor, Severities, WFAppTypes, WorkItemSetRules, WorkItemStatus } from '@topconsultnpm/sdk-ts-beta';
2
+ import { CultureIDs, Severities, WFAppTypes, WorkItemSetRules, WorkItemStatus } from '@topconsultnpm/sdk-ts-beta';
3
3
  export declare const getCultureIDsNumber: (cultureID: CultureIDs | undefined) => number;
4
4
  export declare const getWorkItemStatusNumber: (status: WorkItemStatus | undefined) => number;
5
5
  export declare const getSeveritiesNumber: (severity: Severities | undefined) => number;
6
6
  export declare const getWorkItemSetRulesNumber: (setRule: WorkItemSetRules | undefined) => number;
7
7
  export declare const getWFAppTypesNumber: (appType: WFAppTypes | undefined) => number;
8
8
  export declare const mapCultureIDs: (cultureIDValue: number) => CultureIDs;
9
- export declare const serializeQueryDescriptorXml: (qd: QueryDescriptor | undefined) => Promise<string>;
10
9
  export declare const parseWfDiagramXml: (xmlString: string) => WfDiagram;
11
10
  export declare const serializeWfDiagramToXml: (wfDiagram: WfDiagram | null) => Promise<string>;
@@ -1,7 +1,7 @@
1
- import { ArrowSymbol } from './interfaces';
2
- import { CultureIDs, SDK_Globals, Severities, WFAppTypes, WorkItemSetRules, WorkItemStatus } from '@topconsultnpm/sdk-ts-beta';
3
- import { parseQueryDescriptorXml } from './queryDescriptorParser'; // Import the new parser
4
- import { parseMetadataValuesXml } from './metadataParser';
1
+ import { ArrowSymbol, DiagramItemTypes } from './interfaces';
2
+ import { CultureIDs, Severities, WFAppTypes, WorkItemSetRules, WorkItemStatus } from '@topconsultnpm/sdk-ts-beta';
3
+ import { parseQueryDescriptorXml, serializeQueryDescriptorXml } from './queryDescriptorParser'; // Import the new parser
4
+ import { parseMetadataValuesXml, serializeMetadataValuesToXml } from './metadataParser';
5
5
  // Funzione helper per escapare i caratteri XML speciali (necessaria per i campi stringa)
6
6
  const escapeXml = (unsafe) => {
7
7
  if (unsafe === undefined || unsafe === null)
@@ -13,7 +13,7 @@ const escapeXml = (unsafe) => {
13
13
  case '>': return '&gt;';
14
14
  case '&': return '&amp;';
15
15
  case "'": return '&apos;';
16
- case '"': return '&quot;';
16
+ // case '"': return '&quot;';
17
17
  default: return c;
18
18
  }
19
19
  });
@@ -105,7 +105,8 @@ export const mapCultureIDs = (cultureIDValue) => {
105
105
  return CultureIDs.Es_ES;
106
106
  case 6:
107
107
  return CultureIDs.De_DE;
108
- case 0: // 0 è None
108
+ case 0:
109
+ return CultureIDs.None;
109
110
  default:
110
111
  console.warn(`Valore CultureID sconosciuto: ${cultureIDValue}. Ritorno CultureIDs.None.`);
111
112
  return CultureIDs.None;
@@ -173,26 +174,6 @@ const mapWFAppTypes = (appTypeValue) => {
173
174
  return WFAppTypes.None;
174
175
  }
175
176
  };
176
- export const serializeQueryDescriptorXml = async (qd) => {
177
- // try {
178
- if (!qd)
179
- return '';
180
- let xml = await SDK_Globals.tmSession?.NewDcmtPlatformEngine().UtilsSerializeQdAsync(qd) ?? '';
181
- return xml;
182
- // } catch (error) {
183
- // console.error('Error serializing QueryDescriptor to XML:', error);
184
- //TODO: gestire errore
185
- // return '';
186
- // }
187
- };
188
- // Placeholder per la serializzazione di MetadataValues in XML (DA MODIFICARE CON LA LOGICA REALE)
189
- const serializeMetadataValuesXml = (values) => {
190
- if (!values || values.length === 0)
191
- return '';
192
- // Logica di serializzazione reale qui, ad esempio per ogni elemento in values:
193
- // return values.map(v => `<Value Name="${v.Name}">${v.Value}</Value>`).join('');
194
- return '[METADATA_VALUES_XML_PLACEHOLDER]';
195
- };
196
177
  export const parseWfDiagramXml = (xmlString) => {
197
178
  const parser = new DOMParser();
198
179
  const xmlDoc = parser.parseFromString(xmlString, "application/xml");
@@ -222,11 +203,6 @@ export const parseWfDiagramXml = (xmlString) => {
222
203
  MStatusDLID: parseInt(workflowXML.querySelector("WFMStatusDLID")?.textContent || "0", 10),
223
204
  Type: 0,
224
205
  };
225
- // wfDiagram.Info.ID = workflowXML.querySelector("WFID")?.textContent || "";
226
- // wfDiagram.Info.MTID = parseInt(workflowXML.querySelector("WFMTID")?.textContent || "0", 10);
227
- // wfDiagram.Info.MStatusMID = parseInt(workflowXML.querySelector("WFMStatusMID")?.textContent || "0", 10);
228
- // wfDiagram.Info.MStatusDLID = parseInt(workflowXML.querySelector("WFMStatusDLID")?.textContent || "0", 10);
229
- // Potrebbe esserci un campo <Type> anche qui, se presente
230
206
  }
231
207
  // Parsing DiagramItems
232
208
  const diagramItemsXML = rootElement.querySelectorAll("DiagramItems > DiagramItem");
@@ -244,6 +220,12 @@ export const parseWfDiagramXml = (xmlString) => {
244
220
  // Parse the QD XML string into a QueryDescriptor object
245
221
  parsedQD = parseQueryDescriptorXml(qdXmlString);
246
222
  }
223
+ const qd2XmlString = itemXML.querySelector("QD2")?.textContent || undefined;
224
+ let parsedQD2 = undefined;
225
+ if (qd2XmlString) {
226
+ // Parse the QD XML string into a QueryDescriptor object
227
+ parsedQD2 = parseQueryDescriptorXml(qd2XmlString);
228
+ }
247
229
  const metadataValuesXmlString = itemXML.querySelector("MetadataValues")?.textContent || undefined;
248
230
  let parsedMetadataValues = undefined;
249
231
  if (metadataValuesXmlString) {
@@ -295,7 +277,7 @@ export const parseWfDiagramXml = (xmlString) => {
295
277
  RegAsWfInstPart: parseInt(itemXML.querySelector("RegAsWfInstPart")?.textContent || "0", 10),
296
278
  FormatCultureID: mapCultureIDs(parseInt(itemXML.querySelector("FormatCultureID")?.textContent || "0", 10)),
297
279
  Tos2: itemXML.querySelector("Tos2")?.textContent || undefined,
298
- QD2: itemXML.querySelector("QD2")?.textContent || undefined,
280
+ QD2: parsedQD2,
299
281
  PlatformObjName: itemXML.querySelector("PlatformObjName")?.textContent || undefined,
300
282
  PlatformObjDescr: itemXML.querySelector("PlatformObjDescr")?.textContent || undefined,
301
283
  Value1asInt: parseInt(itemXML.querySelector("Value1asInt")?.textContent || "0", 10),
@@ -425,10 +407,11 @@ export const serializeWfDiagramToXml = async (wfDiagram) => {
425
407
  if (item.SOD)
426
408
  xml += ` <SOD>${escapeXml(item.SOD)}</SOD>\n`;
427
409
  // MetadataValues
428
- // if (item.MetadataValues && item.MetadataValues.length > 0) {
429
- // const mvXmlContent = serializeMetadataValuesXml(item.MetadataValues);
430
- // xml += ` <MetadataValues><![CDATA[${mvXmlContent}]]></MetadataValues>\n`;
431
- // }
410
+ if (item.Type === DiagramItemTypes.UpdateDcmt && item.MetadataValues && item.MetadataValues.length > 0) {
411
+ const mvXmlContent = serializeMetadataValuesToXml(item.MetadataValues);
412
+ let mvEscaped = escapeXml(mvXmlContent);
413
+ xml += ` <MetadataValues>${mvEscaped}</MetadataValues>\n`;
414
+ }
432
415
  if (item.Severity !== undefined)
433
416
  xml += ` <Severity>${getSeveritiesNumber(item.Severity)}</Severity>\n`;
434
417
  if (item.RegAsWfInstPart !== undefined)
@@ -437,8 +420,11 @@ export const serializeWfDiagramToXml = async (wfDiagram) => {
437
420
  xml += ` <FormatCultureID>${getCultureIDsNumber(item.FormatCultureID)}</FormatCultureID>\n`;
438
421
  if (item.Tos2)
439
422
  xml += ` <Tos2>${escapeXml(item.Tos2)}</Tos2>\n`;
440
- if (item.QD2)
441
- xml += ` <QD2>${escapeXml(item.QD2)}</QD2>\n`;
423
+ if (item.QD2) {
424
+ let qdXmlContent = await serializeQueryDescriptorXml(item.QD2);
425
+ let qdEscaped = escapeXml(qdXmlContent);
426
+ xml += ` <QD2>${qdEscaped}</QD2>\n`;
427
+ }
442
428
  if (item.PlatformObjName)
443
429
  xml += ` <PlatformObjName>${escapeXml(item.PlatformObjName)}</PlatformObjName>\n`;
444
430
  if (item.PlatformObjDescr)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.16.67",
3
+ "version": "6.16.68",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",