@sap-ux/preview-middleware 1.2.12 → 1.2.14

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.
@@ -96,7 +96,7 @@ sap.ui.define(["sap/ui/model/json/JSONModel", "../../i18n", "../command-executor
96
96
  },
97
97
  targetPage: {
98
98
  type: 'Component',
99
- id: `${targetEntitySet}ObjectPage`,
99
+ id: `${navProperty}|${targetEntitySet}ObjectPage`,
100
100
  name: 'sap.fe.templates.ObjectPage',
101
101
  routePattern,
102
102
  settings: {
@@ -154,7 +154,7 @@ export default class AddSubpage extends BaseDialog<AddSubpageModel> {
154
154
  },
155
155
  targetPage: {
156
156
  type: 'Component',
157
- id: `${targetEntitySet}ObjectPage`,
157
+ id: `${navProperty}|${targetEntitySet}ObjectPage`,
158
158
  name: 'sap.fe.templates.ObjectPage',
159
159
  routePattern,
160
160
  settings: {
@@ -10,6 +10,7 @@ sap.ui.define(["../../../utils/fe-v4", "../add-new-subpage-quick-action-base", "
10
10
  const getUi5Version = _____utils_versionjs["getUi5Version"];
11
11
  const isLowerThanMinimalUi5Version = _____utils_versionjs["isLowerThanMinimalUi5Version"];
12
12
  const getPageId = ___utilsjs["getPageId"];
13
+ const hasRouteForNavProperty = ___utilsjs["hasRouteForNavProperty"];
13
14
  const OBJECT_PAGE_COMPONENT_NAME_V4 = 'sap.fe.templates.ObjectPage.ObjectPage';
14
15
 
15
16
  /**
@@ -105,11 +106,20 @@ sap.ui.define(["../../../utils/fe-v4", "../add-new-subpage-quick-action-base", "
105
106
  }
106
107
  const entityTypePath = entitySet.$Type;
107
108
  const entitySetNavigationKeys = Object.keys(entitySet.$NavigationPropertyBinding);
109
+ const pageId = getPageId(this.context);
110
+ if (!pageId) {
111
+ return;
112
+ }
108
113
  for (const navigationProperty of entitySetNavigationKeys) {
109
- const associationEnd = await metaModel.requestObject(`/${entityTypePath}/${navigationProperty}`);
114
+ const associationEnd = await metaModel.requestObject(`/${entityTypePath}/${navigationProperty}`); // NO SONAR;
110
115
  if (associationEnd?.$isCollection) {
111
116
  const targetEntitySet = entitySet.$NavigationPropertyBinding[navigationProperty];
112
- await this.addNavigationOptionIfAvailable(metaModel, targetEntitySet, navigationProperty);
117
+ if (targetEntitySet && !hasRouteForNavProperty(this.context.manifest, pageId, navigationProperty)) {
118
+ this.navProperties.push({
119
+ entitySet: targetEntitySet,
120
+ navProperty: navigationProperty
121
+ });
122
+ }
113
123
  }
114
124
  }
115
125
  }
@@ -10,7 +10,7 @@ import FEObjectPageComponent from 'sap/fe/templates/ObjectPage/Component';
10
10
  import FEListReportComponent from 'sap/fe/templates/ListReport/Component';
11
11
  import { getUi5Version, isLowerThanMinimalUi5Version } from '../../../utils/version.js';
12
12
  import { PageDescriptorV4 } from '../../controllers/types.js';
13
- import { getPageId } from './utils.js';
13
+ import { getPageId, hasRouteForNavProperty } from './utils.js';
14
14
 
15
15
  export const OBJECT_PAGE_COMPONENT_NAME_V4 = 'sap.fe.templates.ObjectPage.ObjectPage';
16
16
 
@@ -142,16 +142,22 @@ export class AddNewSubpage extends AddNewSubpageBase<ODataMetaModelV4> {
142
142
  }
143
143
  const entityTypePath = entitySet.$Type;
144
144
  const entitySetNavigationKeys = Object.keys(entitySet.$NavigationPropertyBinding);
145
+ const pageId = getPageId(this.context);
146
+ if (!pageId) {
147
+ return;
148
+ }
145
149
 
146
150
  for (const navigationProperty of entitySetNavigationKeys) {
147
151
  const associationEnd = (await metaModel.requestObject(`/${entityTypePath}/${navigationProperty}`)) as {
148
152
  $Type: string;
149
153
  $isCollection: boolean;
150
154
  $kind: 'NavigationProperty';
151
- };
155
+ }; // NO SONAR;
152
156
  if (associationEnd?.$isCollection) {
153
157
  const targetEntitySet = entitySet.$NavigationPropertyBinding[navigationProperty];
154
- await this.addNavigationOptionIfAvailable(metaModel, targetEntitySet, navigationProperty);
158
+ if (targetEntitySet && !hasRouteForNavProperty(this.context.manifest, pageId, navigationProperty)) {
159
+ this.navProperties.push({ entitySet: targetEntitySet, navProperty: navigationProperty });
160
+ }
155
161
  }
156
162
  }
157
163
  }
@@ -134,6 +134,13 @@ sap.ui.define(["../../../utils/core", "sap/ui/rta/command/CommandFactory", "../.
134
134
  }
135
135
  return undefined;
136
136
  }
137
+ function hasRouteForNavProperty(manifest, sourcePageId, navigationProperty) {
138
+ const targets = manifest['sap.ui5']?.routing?.targets ?? {};
139
+ const sourceTarget = targets[sourcePageId];
140
+
141
+ // Check if a route exists from the source page for the specified navigation property.
142
+ return !!sourceTarget?.options?.settings?.navigation?.[navigationProperty]?.detail?.route;
143
+ }
137
144
 
138
145
  /**
139
146
  * Return the line item annotation that defines the table.
@@ -173,6 +180,7 @@ sap.ui.define(["../../../utils/core", "sap/ui/rta/command/CommandFactory", "../.
173
180
  __exports.generateRoutePattern = generateRoutePattern;
174
181
  __exports.getLineItemAnnotation = getLineItemAnnotation;
175
182
  __exports.getPropertyPath = getPropertyPath;
183
+ __exports.hasRouteForNavProperty = hasRouteForNavProperty;
176
184
  return __exports;
177
185
  });
178
186
  //# sourceMappingURL=utils.js.map
@@ -5,6 +5,7 @@ import CommandFactory from 'sap/ui/rta/command/CommandFactory';
5
5
  import { getV4AppComponent, getPageName, getReference, isMacroTable } from '../../../utils/fe-v4.js';
6
6
  import UI5Element from 'sap/ui/core/Element';
7
7
  import type AppComponent from 'sap/fe/core/AppComponent';
8
+ import { Manifest } from 'sap/ui/rta/RuntimeAuthoring';
8
9
 
9
10
  interface ViewDataType {
10
11
  stableId: string;
@@ -165,6 +166,18 @@ export function getPropertyPath(table: UI5Element, property: 'actions' | 'column
165
166
  return undefined;
166
167
  }
167
168
 
169
+ export function hasRouteForNavProperty(
170
+ manifest: Manifest,
171
+ sourcePageId: string,
172
+ navigationProperty: string
173
+ ): boolean {
174
+ const targets = manifest['sap.ui5']?.routing?.targets ?? {};
175
+ const sourceTarget = targets[sourcePageId];
176
+
177
+ // Check if a route exists from the source page for the specified navigation property.
178
+ return !!sourceTarget?.options?.settings?.navigation?.[navigationProperty]?.detail?.route;
179
+ }
180
+
168
181
  /**
169
182
  * Return the line item annotation that defines the table.
170
183
  * This may come from a Presentation Variant, a Selection Presentation Variant or the default.
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "bugs": {
11
11
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
12
12
  },
13
- "version": "1.2.12",
13
+ "version": "1.2.14",
14
14
  "license": "Apache-2.0",
15
15
  "author": "@SAP/ux-tools-team",
16
16
  "main": "dist/index.js",
@@ -28,13 +28,13 @@
28
28
  "mem-fs-editor": "9.4.0",
29
29
  "qrcode": "1.5.4",
30
30
  "@sap/bas-sdk": "3.13.10",
31
- "@sap-ux/adp-tooling": "1.0.53",
31
+ "@sap-ux/adp-tooling": "1.0.54",
32
32
  "@sap-ux/btp-utils": "2.0.6",
33
33
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@1.0.11",
34
34
  "@sap-ux/feature-toggle": "1.0.5",
35
35
  "@sap-ux/logger": "1.0.3",
36
36
  "@sap-ux/project-access": "2.2.0",
37
- "@sap-ux/system-access": "1.0.13",
37
+ "@sap-ux/system-access": "1.0.14",
38
38
  "@sap-ux/i18n": "1.0.3"
39
39
  },
40
40
  "devDependencies": {
@@ -54,9 +54,9 @@
54
54
  "nock": "14.0.16",
55
55
  "npm-run-all2": "9.0.2",
56
56
  "supertest": "7.2.2",
57
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@1.2.12",
57
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@1.2.14",
58
58
  "@sap-ux-private/playwright": "1.0.6",
59
- "@sap-ux/axios-extension": "2.0.10",
59
+ "@sap-ux/axios-extension": "2.1.0",
60
60
  "@sap-ux/store": "2.0.7",
61
61
  "@sap-ux/ui5-info": "1.0.6"
62
62
  },