@sap-ux/preview-middleware 0.20.44 → 0.20.47

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/dist/base/flp.js CHANGED
@@ -431,7 +431,7 @@ class FlpSandbox {
431
431
  }
432
432
  }
433
433
  if (!version) {
434
- this.logger.error('Could not get UI5 version of application. Using 1.130.0 as fallback.');
434
+ this.logger.error('Could not get UI5 version of application. Using version: 1.130.0 as fallback.');
435
435
  version = '1.130.0';
436
436
  }
437
437
  const [major, minor, patch] = version.split('.').map((versionPart) => parseInt(versionPart, 10));
@@ -439,7 +439,7 @@ class FlpSandbox {
439
439
  if (this.flpConfig.enhancedHomePage &&
440
440
  ((major < 2 && minor < 123) || major >= 2 || label?.includes('legacy-free'))) {
441
441
  this.flpConfig.enhancedHomePage = this.templateConfig.enhancedHomePage = false;
442
- this.logger.warn(`Feature enhancedHomePage disabled: UI5 version ${version} not supported.`);
442
+ this.logger.warn(`Feature enhancedHomePage disabled: UI5 version: ${version} not supported.`);
443
443
  }
444
444
  return {
445
445
  major,
@@ -455,7 +455,7 @@ class FlpSandbox {
455
455
  * @returns the template for the sandbox HTML file
456
456
  */
457
457
  getSandboxTemplate(ui5Version) {
458
- this.logger.info(`Using sandbox template for UI5 version ${ui5Version.major}.${ui5Version.minor}.${ui5Version.patch}${ui5Version.label ? `-${ui5Version.label}` : ''}.`);
458
+ this.logger.info(`Using sandbox template for UI5 version: ${ui5Version.major}.${ui5Version.minor}.${ui5Version.patch}${ui5Version.label ? `-${ui5Version.label}` : ''}.`);
459
459
  const filePrefix = ui5Version.major > 1 || ui5Version.label?.includes('legacy-free') ? '2' : '';
460
460
  const template = this.flpConfig.enhancedHomePage ? 'cdm' : 'sandbox';
461
461
  return (0, fs_1.readFileSync)((0, path_1.join)(__dirname, `../../templates/flp/${template}${filePrefix}.html`), 'utf-8');
@@ -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
  );
@@ -37,7 +37,7 @@ sap.ui.define(["sap/ui/VersionInfo", "sap/base/Log"], function (VersionInfo, Log
37
37
  library
38
38
  }))?.version;
39
39
  if (!version) {
40
- Log.error('Could not get UI5 version of application. Using 1.130.0 as fallback.');
40
+ Log.error('Could not get UI5 version of application. Using version: 1.130.0 as fallback.');
41
41
  version = '1.130.0';
42
42
  }
43
43
  const [major, minor, patch] = version.split('.').map(versionPart => parseInt(versionPart, 10));
@@ -48,7 +48,7 @@ function checkVersionInfo(versionInfo: Ui5VersionInfo): void {
48
48
  export async function getUi5Version(library: string = 'sap.ui.core'): Promise<Ui5VersionInfo> {
49
49
  let version = ((await VersionInfo.load({ library })) as SingleVersionInfo)?.version;
50
50
  if (!version) {
51
- Log.error('Could not get UI5 version of application. Using 1.130.0 as fallback.');
51
+ Log.error('Could not get UI5 version of application. Using version: 1.130.0 as fallback.');
52
52
  version = '1.130.0';
53
53
  }
54
54
  const [major, minor, patch] = version.split('.').map((versionPart) => parseInt(versionPart, 10));
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.47",
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.34",
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",