@sap-ux/preview-middleware 0.20.44 → 0.20.46

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.
@@ -129,7 +129,7 @@ export type GenericChange =
129
129
  | ConfigChange
130
130
  | V2ConfigChange;
131
131
 
132
- export type changeType = GenericChange['changeType'];
132
+ export type ChangeType = GenericChange['changeType'];
133
133
 
134
134
  /**
135
135
  * Returns a shortened version of the given configuration path segments by removing excess segments,
@@ -36,7 +36,7 @@ import UI5Element from 'sap/ui/core/Element';
36
36
  import { setAdditionalChangeInfo } from '../../utils/additional-change-info';
37
37
  import {
38
38
  ChangeHandler,
39
- changeType,
39
+ ChangeType,
40
40
  ConfigChange,
41
41
  GENERIC_CHANGE_HANDLER,
42
42
  getControlIdByChange,
@@ -444,7 +444,7 @@ export class ChangeService extends EventTarget {
444
444
 
445
445
  const changeDefinition = change.getDefinition ? change.getDefinition() : (change.getJson() as ChangeDefinition);
446
446
  const { fileName } = changeDefinition;
447
- const handler = GENERIC_CHANGE_HANDLER[changeType as changeType] as unknown as ChangeHandler<GenericChange>;
447
+ const handler = GENERIC_CHANGE_HANDLER[changeType as ChangeType] as unknown as ChangeHandler<GenericChange>;
448
448
  if (handler) {
449
449
  const {
450
450
  properties,
@@ -68,7 +68,7 @@ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/UIComponent", "../utils/c
68
68
  }
69
69
  const manifestPropertiesValue = overlayData?.manifestSettingsValues(overlayData?.manifestSettings(control), control);
70
70
  const manifestProperties = overlayData?.manifestSettings(control).reduce((acc, item) => {
71
- const propertyId = item.id;
71
+ const propertyId = item.path ?? item.id;
72
72
  const value = changeService.getConfigurationPropertyValue(control.getId(), propertyId);
73
73
  let propertyValue = value === 0 || value === false || value ? value : manifestPropertiesValue[propertyId];
74
74
  if (item?.type && ['boolean', 'number', 'string'].includes(item?.type)) {
@@ -124,7 +124,7 @@ export function getManifestProperties(
124
124
  },
125
125
  item: DesigntimeSetting
126
126
  ) => {
127
- const propertyId = item.id;
127
+ const propertyId = item.path ?? item.id;
128
128
  const value = changeService.getConfigurationPropertyValue(control.getId(), propertyId);
129
129
  let propertyValue = value === 0 || value === false || value ? value : manifestPropertiesValue[propertyId];
130
130
  if (item?.type && ['boolean', 'number', 'string'].includes(item?.type)) {
@@ -90,12 +90,22 @@ sap.ui.define(["sap/ui/core/Component", "./core", "sap/ui/rta/command/CommandFac
90
90
  if (!overlay) {
91
91
  return undefined;
92
92
  }
93
- const overlayData = overlay?.getDesignTimeMetadata().getData();
93
+ const overlayData = overlay.getDesignTimeMetadata().getData();
94
+ const settings = overlayData.manifestSettings(modifiedControl);
94
95
  let manifestPropertyPath = overlayData.manifestPropertyPath(modifiedControl);
95
96
  if (propertyPathExtraSegments) {
96
97
  manifestPropertyPath += '/' + propertyPathExtraSegments.join('/');
97
98
  }
98
- const [manifestPropertyChange] = overlayData.manifestPropertyChange(propertyChanges, manifestPropertyPath, modifiedControl);
99
+ const adjustedChanges = {};
100
+ for (const [key, value] of Object.entries(propertyChanges)) {
101
+ const setting = settings.find(s => s.id === key);
102
+ if (setting) {
103
+ adjustedChanges[setting.path ?? setting.id] = value;
104
+ } else {
105
+ adjustedChanges[key] = value;
106
+ }
107
+ }
108
+ const [manifestPropertyChange] = overlayData.manifestPropertyChange(adjustedChanges, manifestPropertyPath, modifiedControl);
99
109
  const modifiedValue = {
100
110
  reference: getReference(modifiedControl),
101
111
  appComponent: manifestPropertyChange.appComponent,
@@ -103,13 +103,24 @@ export async function createManifestPropertyChange(
103
103
  if (!overlay) {
104
104
  return undefined;
105
105
  }
106
- const overlayData = overlay?.getDesignTimeMetadata().getData();
106
+ const overlayData = overlay.getDesignTimeMetadata().getData();
107
+ const settings = overlayData.manifestSettings(modifiedControl);
107
108
  let manifestPropertyPath = overlayData.manifestPropertyPath(modifiedControl);
108
109
  if (propertyPathExtraSegments) {
109
110
  manifestPropertyPath += '/' + propertyPathExtraSegments.join('/');
110
111
  }
112
+ const adjustedChanges: Record<string, string | string[] | boolean | number | object | undefined> = {};
113
+ for (const [key, value] of Object.entries(propertyChanges)) {
114
+ const setting = settings.find((s) => s.id === key);
115
+ if (setting) {
116
+ adjustedChanges[setting.path ?? setting.id] = value;
117
+ } else {
118
+ adjustedChanges[key] = value;
119
+ }
120
+
121
+ }
111
122
  const [manifestPropertyChange] = overlayData.manifestPropertyChange(
112
- propertyChanges,
123
+ adjustedChanges,
113
124
  manifestPropertyPath,
114
125
  modifiedControl
115
126
  );
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
11
11
  },
12
- "version": "0.20.44",
12
+ "version": "0.20.46",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -25,13 +25,13 @@
25
25
  "ejs": "3.1.10",
26
26
  "mem-fs": "2.1.0",
27
27
  "mem-fs-editor": "9.4.0",
28
- "@sap-ux/adp-tooling": "0.14.32",
28
+ "@sap-ux/adp-tooling": "0.14.33",
29
29
  "@sap-ux/btp-utils": "1.1.0",
30
30
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.6.6",
31
+ "@sap-ux/feature-toggle": "0.3.0",
31
32
  "@sap-ux/logger": "0.7.0",
32
- "@sap-ux/project-access": "1.30.3",
33
- "@sap-ux/system-access": "0.6.9",
34
- "@sap-ux/feature-toggle": "0.3.0"
33
+ "@sap-ux/project-access": "1.30.4",
34
+ "@sap-ux/system-access": "0.6.9"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@sap-ux-private/playwright": "0.2.0",
@@ -49,7 +49,7 @@
49
49
  "nock": "13.4.0",
50
50
  "npm-run-all2": "6.2.0",
51
51
  "supertest": "6.3.3",
52
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.14.8",
52
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.14.9",
53
53
  "@sap-ux/axios-extension": "1.22.3",
54
54
  "@sap-ux/i18n": "0.3.1",
55
55
  "@sap-ux/store": "1.1.1",