@sap-ux/preview-middleware 0.11.14 → 0.11.16

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.
@@ -62,11 +62,6 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/model/json/JSONModel", "sap/ui/dt/O
62
62
  this.model.setProperty('/index', updatedIndexArray);
63
63
  this.model.setProperty('/selectedIndex', updatedIndexArray.length - 1);
64
64
  },
65
- onIndexChanged: function _onIndexChanged(event) {
66
- const source = event.getSource();
67
- const selectedIndex = source.getSelectedItem()?.getText();
68
- this.model.setProperty('/selectedIndex', selectedIndex);
69
- },
70
65
  onCreateBtnPress: async function _onCreateBtnPress(event) {
71
66
  const source = event.getSource();
72
67
  source.setEnabled(false);
@@ -60,20 +60,25 @@ export default class AddFragment extends BaseDialog {
60
60
  }
61
61
 
62
62
  /**
63
- * Handles the index field whenever a specific aggregation is chosen
64
- *
65
- * @param specialIndexAggregation string | number
66
- */
63
+ * Handles the index field whenever a specific aggregation is chosen
64
+ *
65
+ * @param specialIndexAggregation string | number
66
+ */
67
67
  private specialIndexHandling(specialIndexAggregation: string | number): void {
68
68
  const overlay = OverlayRegistry.getOverlay(this.runtimeControl as UI5Element);
69
69
  const aggregations = overlay.getDesignTimeMetadata().getData().aggregations;
70
70
 
71
- if(specialIndexAggregation in aggregations && 'specialIndexHandling' in aggregations[specialIndexAggregation]) {
71
+ if (
72
+ specialIndexAggregation in aggregations &&
73
+ 'specialIndexHandling' in aggregations[specialIndexAggregation]
74
+ ) {
72
75
  const controlType = this.runtimeControl.getMetadata().getName();
73
76
  this.model.setProperty('/indexHandlingFlag', false);
74
77
  this.model.setProperty('/specialIndexHandlingIcon', true);
75
- this.model.setProperty('/iconTooltip', `Index is defined by special logic of ${controlType} and can't be set here`);
76
-
78
+ this.model.setProperty(
79
+ '/iconTooltip',
80
+ `Index is defined by special logic of ${controlType} and can't be set here`
81
+ );
77
82
  } else {
78
83
  this.model.setProperty('/indexHandlingFlag', true);
79
84
  this.model.setProperty('/specialIndexHandlingIcon', false);
@@ -107,7 +112,7 @@ export default class AddFragment extends BaseDialog {
107
112
  newSelectedControlChildren = newSelectedControlChildren.map((key) => {
108
113
  return parseInt(key);
109
114
  });
110
-
115
+
111
116
  this.specialIndexHandling(selectedItemText);
112
117
 
113
118
  const updatedIndexArray: { key: number; value: number }[] = this.fillIndexArray(newSelectedControlChildren);
@@ -116,17 +121,6 @@ export default class AddFragment extends BaseDialog {
116
121
  this.model.setProperty('/selectedIndex', updatedIndexArray.length - 1);
117
122
  }
118
123
 
119
- /**
120
- * Handles the change in target indexes
121
- *
122
- * @param event Event
123
- */
124
- onIndexChanged(event: Event) {
125
- const source = event.getSource<ComboBox>();
126
- const selectedIndex = source.getSelectedItem()?.getText();
127
- this.model.setProperty('/selectedIndex', selectedIndex);
128
- }
129
-
130
124
  /**
131
125
  * Handles create button press
132
126
  *
@@ -13,7 +13,7 @@
13
13
  <Label text="Control Type" />
14
14
  <Text text="{/selectedControlName}" />
15
15
  <Label text="Target Aggregation" />
16
- <ComboBox
16
+ <Select
17
17
  change="onAggregationChanged"
18
18
  selectedKey="{/selectedAggregation/key}"
19
19
  items="{
@@ -21,10 +21,10 @@
21
21
  sorter: { path: 'text' }
22
22
  }">
23
23
  <core:Item key="{key}" text="{value}" />
24
- </ComboBox>
24
+ </Select>
25
25
  <Label text="Index" />
26
26
  <HBox alignItems="Center">
27
- <ComboBox
27
+ <Select
28
28
  enabled="{/indexHandlingFlag}"
29
29
  selectedKey='{/selectedIndex}'
30
30
  items="{
@@ -32,7 +32,7 @@
32
32
  sorter: { path: 'text' }
33
33
  }">
34
34
  <core:Item key="{key}" text="{value}" />
35
- </ComboBox>
35
+ </Select>
36
36
  <core:Icon
37
37
  useIconTooltip="false"
38
38
  visible="{/specialIndexHandlingIcon}"
@@ -196,7 +196,7 @@ sap.ui.define([
196
196
  controlId: selectorId,
197
197
  changeType,
198
198
  isActive: index >= inactiveCommandCount,
199
- controlName: command.getElement().getMetadata().getName().split('.').pop() ?? ''
199
+ controlName: changeType === 'addXMLAtExtensionPoint' ? command.getSelector().name ?? '' : command.getElement().getMetadata().getName().split('.').pop() ?? ''
200
200
  };
201
201
  }
202
202
  return result;
@@ -204,7 +204,11 @@ sap.ui.define([
204
204
  retryOperations(operations) {
205
205
  for (const operation of operations) {
206
206
  try {
207
- return operation();
207
+ const result = operation();
208
+ if (!result) {
209
+ continue;
210
+ }
211
+ return result;
208
212
  } catch (error) {
209
213
  Log.error(`Retry operation failed: ${ error?.message }`);
210
214
  continue;
@@ -221,7 +225,9 @@ sap.ui.define([
221
225
  getCommandSelectorId(command) {
222
226
  return this.retryOperations([
223
227
  () => command.getSelector().id,
224
- () => command.getElement().getProperty('persistencyKey')
228
+ () => command.getElement().getProperty('persistencyKey'),
229
+ () => command.getElement().getId(),
230
+ () => command.getParent()?.getElement().getId()
225
231
  ]);
226
232
  }
227
233
  }
@@ -316,7 +316,10 @@ export class ChangeService {
316
316
  controlId: selectorId,
317
317
  changeType,
318
318
  isActive: index >= inactiveCommandCount,
319
- controlName: command.getElement().getMetadata().getName().split('.').pop() ?? ''
319
+ controlName:
320
+ changeType === 'addXMLAtExtensionPoint'
321
+ ? command.getSelector().name ?? ''
322
+ : command.getElement().getMetadata().getName().split('.').pop() ?? ''
320
323
  };
321
324
  }
322
325
 
@@ -332,7 +335,11 @@ export class ChangeService {
332
335
  private retryOperations<T>(operations: Array<() => T>): T | undefined {
333
336
  for (const operation of operations) {
334
337
  try {
335
- return operation();
338
+ const result = operation();
339
+ if (!result) {
340
+ continue;
341
+ }
342
+ return result;
336
343
  } catch (error) {
337
344
  Log.error(`Retry operation failed: ${error?.message}`);
338
345
  continue;
@@ -363,7 +370,9 @@ export class ChangeService {
363
370
  private getCommandSelectorId(command: FlexCommand): string | undefined {
364
371
  return this.retryOperations([
365
372
  () => command.getSelector().id,
366
- () => command.getElement().getProperty('persistencyKey')
373
+ () => command.getElement().getProperty('persistencyKey'),
374
+ () => command.getElement().getId(),
375
+ () => command.getParent()?.getElement().getId()
367
376
  ]);
368
377
  }
369
378
  }
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.11.14",
12
+ "version": "0.11.16",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "supertest": "6.3.3",
39
39
  "@sap-ux-private/playwright": "0.0.1",
40
40
  "dotenv": "16.3.1",
41
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.8.8",
41
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.8.10",
42
42
  "@sap-ux/project-access": "1.16.1",
43
43
  "@sap-ux/store": "0.4.0"
44
44
  },