@sap-ux/preview-middleware 0.19.36 → 0.19.38

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.
@@ -10,8 +10,9 @@ sap.ui.define([
10
10
  '../api-handler',
11
11
  './BaseDialog.controller',
12
12
  '../utils',
13
- 'sap/ui/core/library'
14
- ], function (JSONModel, OverlayRegistry, ___sap_ux_private_control_property_editor_common, ____i18n, ____cpe_communication_service, __ControlUtils, __CommandExecutor, ___api_handler, __BaseDialog, ___utils, sap_ui_core_library) {
13
+ 'sap/ui/core/library',
14
+ '../../utils/additional-change-info'
15
+ ], function (JSONModel, OverlayRegistry, ___sap_ux_private_control_property_editor_common, ____i18n, ____cpe_communication_service, __ControlUtils, __CommandExecutor, ___api_handler, __BaseDialog, ___utils, sap_ui_core_library, ____utils_additional_change_info) {
15
16
  'use strict';
16
17
  function _interopRequireDefault(obj) {
17
18
  return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
@@ -26,6 +27,7 @@ sap.ui.define([
26
27
  const BaseDialog = _interopRequireDefault(__BaseDialog);
27
28
  const notifyUser = ___utils['notifyUser'];
28
29
  const ValueState = sap_ui_core_library['ValueState'];
30
+ const setAdditionalChangeInfoForChangeFile = ____utils_additional_change_info['setAdditionalChangeInfoForChangeFile'];
29
31
  const radix = 10;
30
32
  const COLUMNS_AGGREGATION = 'columns';
31
33
  const ITEMS_AGGREGATION = 'items';
@@ -149,7 +151,6 @@ sap.ui.define([
149
151
  const flexSettings = this.rta.getFlexSettings();
150
152
  const overlay = OverlayRegistry.getOverlay(this.runtimeControl);
151
153
  const designMetadata = overlay.getDesignTimeMetadata();
152
- const result = [];
153
154
  const compositeCommand = await this.commandExecutor.createCompositeCommand(this.runtimeControl);
154
155
  for (const fragment of fragments) {
155
156
  const modifiedValue = {
@@ -162,17 +163,11 @@ sap.ui.define([
162
163
  const command = await this.commandExecutor.getCommand(targetObject, 'addXML', modifiedValue, designMetadata, flexSettings);
163
164
  const templateName = fragment.targetAggregation === COLUMNS_AGGREGATION ? `V2_SMART_TABLE_COLUMN` : 'V2_SMART_TABLE_CELL';
164
165
  const preparedChange = command.getPreparedChange();
165
- const content = {
166
- ...preparedChange.getContent(),
167
- templateName
168
- };
169
- preparedChange.setContent(content);
166
+ setAdditionalChangeInfoForChangeFile(preparedChange.getDefinition().fileName, { templateName });
170
167
  compositeCommand.addCommand(command, false);
171
- result.push(templateName);
172
168
  }
173
169
  await this.commandExecutor.pushAndExecuteCommand(compositeCommand);
174
170
  CommunicationService.sendAction(setApplicationRequiresReload(true));
175
- return result;
176
171
  }
177
172
  });
178
173
  return AddTableColumnFragments;
@@ -39,6 +39,7 @@ import Input from 'sap/m/Input';
39
39
  import Control from 'sap/ui/core/Control';
40
40
  import ManagedObject from 'sap/ui/base/ManagedObject';
41
41
  import { QuickActionTelemetryData } from '../../cpe/quick-actions/quick-action-definition';
42
+ import { setAdditionalChangeInfoForChangeFile } from '../../utils/additional-change-info';
42
43
 
43
44
  const radix = 10;
44
45
 
@@ -60,7 +61,6 @@ interface CreateFragmentProps {
60
61
  * @namespace open.ux.preview.client.adp.controllers
61
62
  */
62
63
  export default class AddTableColumnFragments extends BaseDialog<AddTableColumnsFragmentsModel> {
63
-
64
64
  constructor(
65
65
  name: string,
66
66
  overlays: UI5Element,
@@ -255,7 +255,7 @@ export default class AddTableColumnFragments extends BaseDialog<AddTableColumnsF
255
255
  *
256
256
  * @param fragmentData Fragment Data
257
257
  */
258
- private async createFragmentChange(fragmentData: CreateFragmentProps): Promise<string[] | undefined> {
258
+ private async createFragmentChange(fragmentData: CreateFragmentProps): Promise<void> {
259
259
  const { fragments, index } = fragmentData;
260
260
 
261
261
  const flexSettings = this.rta.getFlexSettings();
@@ -263,8 +263,6 @@ export default class AddTableColumnFragments extends BaseDialog<AddTableColumnsF
263
263
  const overlay = OverlayRegistry.getOverlay(this.runtimeControl as UI5Element);
264
264
  const designMetadata = overlay.getDesignTimeMetadata();
265
265
 
266
- const result: string[] = [];
267
-
268
266
  const compositeCommand = await this.commandExecutor.createCompositeCommand(this.runtimeControl);
269
267
 
270
268
  for (const fragment of fragments) {
@@ -292,15 +290,11 @@ export default class AddTableColumnFragments extends BaseDialog<AddTableColumnsF
292
290
  const templateName =
293
291
  fragment.targetAggregation === COLUMNS_AGGREGATION ? `V2_SMART_TABLE_COLUMN` : 'V2_SMART_TABLE_CELL';
294
292
  const preparedChange = command.getPreparedChange();
295
- const content = { ...preparedChange.getContent(), templateName };
296
- preparedChange.setContent(content);
293
+ setAdditionalChangeInfoForChangeFile(preparedChange.getDefinition().fileName, { templateName });
297
294
  compositeCommand.addCommand(command, false);
298
- result.push(templateName);
299
295
  }
300
296
 
301
297
  await this.commandExecutor.pushAndExecuteCommand(compositeCommand);
302
298
  CommunicationService.sendAction(setApplicationRequiresReload(true));
303
-
304
- return result;
305
299
  }
306
300
  }
@@ -5,11 +5,12 @@ sap.ui.define(["../cpe/additional-change-info/add-xml-additional-info"], functio
5
5
 
6
6
  const getAddXMLAdditionalInfo = ___cpe_additional_change_info_add_xml_additional_info["getAddXMLAdditionalInfo"];
7
7
  const additionalChangeInfoMap = new Map();
8
+
8
9
  /**
9
- * This function is used to set additional change information for a given change.
10
- *
11
- * @param change - The change object for which additional information is to be set.
12
- */
10
+ * This function is used to set additional change information for a given change.
11
+ *
12
+ * @param change - The change object for which additional information is to be set.
13
+ */
13
14
  function setAdditionalChangeInfo(change) {
14
15
  if (!change) {
15
16
  return;
@@ -22,6 +23,9 @@ sap.ui.define(["../cpe/additional-change-info/add-xml-additional-info"], functio
22
23
  additionalChangeInfoMap.set(change.getDefinition().fileName, additionalChangeInfo);
23
24
  }
24
25
  }
26
+ function setAdditionalChangeInfoForChangeFile(fileName, additionalChangeInfo) {
27
+ additionalChangeInfoMap.set(fileName, additionalChangeInfo);
28
+ }
25
29
 
26
30
  /**
27
31
  * Retrieves additional change information for a given change.
@@ -33,11 +37,20 @@ sap.ui.define(["../cpe/additional-change-info/add-xml-additional-info"], functio
33
37
  function getAdditionalChangeInfo(change) {
34
38
  return additionalChangeInfoMap.get(change.fileName);
35
39
  }
40
+
41
+ /**
42
+ * Should only be used in tests.
43
+ */
44
+ function clearAdditionalChangeInfo() {
45
+ additionalChangeInfoMap.clear();
46
+ }
36
47
  var __exports = {
37
48
  __esModule: true
38
49
  };
39
50
  __exports.setAdditionalChangeInfo = setAdditionalChangeInfo;
51
+ __exports.setAdditionalChangeInfoForChangeFile = setAdditionalChangeInfoForChangeFile;
40
52
  __exports.getAdditionalChangeInfo = getAdditionalChangeInfo;
53
+ __exports.clearAdditionalChangeInfo = clearAdditionalChangeInfo;
41
54
  return __exports;
42
55
  });
43
56
  //# sourceMappingURL=additional-change-info.js.map
@@ -6,22 +6,22 @@ import {
6
6
  } from '../cpe/additional-change-info/add-xml-additional-info';
7
7
  import { FlexChange as Change } from '../flp/common';
8
8
 
9
- const additionalChangeInfoMap = new Map<string, AddXMLAdditionalInfo>();
9
+ export type AdditionalChangeInfo = AddXMLAdditionalInfo | undefined;
10
10
 
11
- export type AdditionalChangeInfo = AddXMLAdditionalInfo | undefined
11
+ const additionalChangeInfoMap = new Map<string, AdditionalChangeInfo>();
12
12
 
13
13
  /**
14
- * This function is used to set additional change information for a given change.
15
- *
16
- * @param change - The change object for which additional information is to be set.
17
- */
14
+ * This function is used to set additional change information for a given change.
15
+ *
16
+ * @param change - The change object for which additional information is to be set.
17
+ */
18
18
  export function setAdditionalChangeInfo(change: FlexChange<AddXMLChangeContent> | undefined): void {
19
19
  if (!change) {
20
20
  return;
21
21
  }
22
22
 
23
23
  let additionalChangeInfo;
24
- if(change?.getChangeType?.() === 'addXML') {
24
+ if (change?.getChangeType?.() === 'addXML') {
25
25
  additionalChangeInfo = getAddXMLAdditionalInfo(change);
26
26
  }
27
27
 
@@ -30,6 +30,13 @@ export function setAdditionalChangeInfo(change: FlexChange<AddXMLChangeContent>
30
30
  }
31
31
  }
32
32
 
33
+ export function setAdditionalChangeInfoForChangeFile(
34
+ fileName: string,
35
+ additionalChangeInfo: AdditionalChangeInfo
36
+ ): void {
37
+ additionalChangeInfoMap.set(fileName, additionalChangeInfo);
38
+ }
39
+
33
40
  /**
34
41
  * Retrieves additional change information for a given change.
35
42
  *
@@ -38,5 +45,12 @@ export function setAdditionalChangeInfo(change: FlexChange<AddXMLChangeContent>
38
45
  * or `undefined` if no additional information is available.
39
46
  */
40
47
  export function getAdditionalChangeInfo(change: Change): AdditionalChangeInfo {
41
- return additionalChangeInfoMap.get(change.fileName);
48
+ return additionalChangeInfoMap.get(change.fileName);
49
+ }
50
+
51
+ /**
52
+ * Should only be used in tests.
53
+ */
54
+ export function clearAdditionalChangeInfo(): void {
55
+ additionalChangeInfoMap.clear();
42
56
  }
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.19.36",
12
+ "version": "0.19.38",
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.13.40",
28
+ "@sap-ux/adp-tooling": "0.13.41",
29
29
  "@sap-ux/btp-utils": "1.0.3",
30
30
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.6.4",
31
31
  "@sap-ux/feature-toggle": "0.2.3",
32
- "@sap-ux/logger": "0.6.0",
33
32
  "@sap-ux/project-access": "1.29.21",
34
- "@sap-ux/system-access": "0.5.37"
33
+ "@sap-ux/logger": "0.6.0",
34
+ "@sap-ux/system-access": "0.5.38"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@sap-ux-private/playwright": "0.1.0",
@@ -49,11 +49,11 @@
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.13.20",
53
- "@sap-ux/axios-extension": "1.20.1",
52
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.13.21",
54
53
  "@sap-ux/i18n": "0.2.3",
55
- "@sap-ux/store": "1.0.0",
56
- "@sap-ux/ui5-info": "0.10.1"
54
+ "@sap-ux/axios-extension": "1.20.2",
55
+ "@sap-ux/ui5-info": "0.10.1",
56
+ "@sap-ux/store": "1.0.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "express": "4"