@sap-ux/preview-middleware 0.19.9 → 0.19.11
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/client/adp/controllers/AddFragment.controller.js +1 -1
- package/dist/client/adp/controllers/AddFragment.controller.ts +2 -1
- package/dist/client/adp/controllers/ControllerExtension.controller.js +1 -1
- package/dist/client/adp/controllers/ControllerExtension.controller.ts +3 -1
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +1 -1
- package/dist/client/adp/controllers/ExtensionPoint.controller.ts +2 -1
- package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +2 -2
- package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.ts +7 -4
- package/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +4 -4
- package/dist/client/adp/quick-actions/fe-v2/add-new-subpage.ts +5 -5
- package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +12 -4
- package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.ts +15 -4
- package/package.json +6 -6
|
@@ -71,9 +71,9 @@ sap.ui.define([
|
|
|
71
71
|
this.model.setProperty('/selectedIndex', updatedIndexArray.length - 1);
|
|
72
72
|
},
|
|
73
73
|
onCreateBtnPress: async function _onCreateBtnPress(event) {
|
|
74
|
-
await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
|
|
75
74
|
const source = event.getSource();
|
|
76
75
|
source.setEnabled(false);
|
|
76
|
+
await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
|
|
77
77
|
const fragmentName = this.model.getProperty('/newFragmentName');
|
|
78
78
|
const index = this.model.getProperty('/selectedIndex');
|
|
79
79
|
const targetAggregation = this.model.getProperty('/selectedAggregation/value');
|
|
@@ -142,10 +142,11 @@ export default class AddFragment extends BaseDialog<AddFragmentModel> {
|
|
|
142
142
|
* @param event Event
|
|
143
143
|
*/
|
|
144
144
|
async onCreateBtnPress(event: Event) {
|
|
145
|
-
await super.onCreateBtnPressHandler();
|
|
146
145
|
const source = event.getSource<Button>();
|
|
147
146
|
source.setEnabled(false);
|
|
148
147
|
|
|
148
|
+
await super.onCreateBtnPressHandler();
|
|
149
|
+
|
|
149
150
|
const fragmentName = this.model.getProperty('/newFragmentName');
|
|
150
151
|
const index = this.model.getProperty('/selectedIndex');
|
|
151
152
|
const targetAggregation = this.model.getProperty('/selectedAggregation/value');
|
|
@@ -80,8 +80,8 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/library", "sap/ui/model/json/J
|
|
|
80
80
|
* @param event Event
|
|
81
81
|
*/
|
|
82
82
|
onCreateBtnPress: async function _onCreateBtnPress(event) {
|
|
83
|
-
await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
|
|
84
83
|
const source = event.getSource();
|
|
84
|
+
await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
|
|
85
85
|
const controllerExists = this.model.getProperty('/controllerExists');
|
|
86
86
|
if (!controllerExists) {
|
|
87
87
|
source.setEnabled(false);
|
|
@@ -128,8 +128,10 @@ export default class ControllerExtension extends BaseDialog<ControllerModel> {
|
|
|
128
128
|
* @param event Event
|
|
129
129
|
*/
|
|
130
130
|
async onCreateBtnPress(event: Event) {
|
|
131
|
-
await super.onCreateBtnPressHandler();
|
|
132
131
|
const source = event.getSource<Button>();
|
|
132
|
+
|
|
133
|
+
await super.onCreateBtnPressHandler();
|
|
134
|
+
|
|
133
135
|
const controllerExists = this.model.getProperty('/controllerExists');
|
|
134
136
|
|
|
135
137
|
if (!controllerExists) {
|
|
@@ -37,9 +37,9 @@ sap.ui.define(["sap/ui/model/json/JSONModel", "../api-handler", "./BaseDialog.co
|
|
|
37
37
|
* @param event Event
|
|
38
38
|
*/
|
|
39
39
|
onCreateBtnPress: async function _onCreateBtnPress(event) {
|
|
40
|
-
await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
|
|
41
40
|
const source = event.getSource();
|
|
42
41
|
source.setEnabled(false);
|
|
42
|
+
await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
|
|
43
43
|
const fragmentName = this.model.getProperty('/newFragmentName');
|
|
44
44
|
this.createExtensionPointFragmentChange(fragmentName);
|
|
45
45
|
notifyUser(`Note: The '${fragmentName}.fragment.xml' fragment will be created once you save the change.`, 8000);
|
|
@@ -61,10 +61,11 @@ export default class ExtensionPoint extends BaseDialog<ExtensionPointModel> {
|
|
|
61
61
|
* @param event Event
|
|
62
62
|
*/
|
|
63
63
|
async onCreateBtnPress(event: Event) {
|
|
64
|
-
await super.onCreateBtnPressHandler();
|
|
65
64
|
const source = event.getSource<Button>();
|
|
66
65
|
source.setEnabled(false);
|
|
67
66
|
|
|
67
|
+
await super.onCreateBtnPressHandler();
|
|
68
|
+
|
|
68
69
|
const fragmentName = this.model.getProperty('/newFragmentName');
|
|
69
70
|
|
|
70
71
|
this.createExtensionPointFragmentChange(fragmentName);
|
|
@@ -60,7 +60,7 @@ sap.ui.define(["sap/ui/core/Component", "sap/ui/dt/OverlayRegistry", "../../cpe/
|
|
|
60
60
|
return Promise.resolve();
|
|
61
61
|
}
|
|
62
62
|
const component = Component.getOwnerComponentFor(modifiedControl);
|
|
63
|
-
const entitySetName = this.getEntitySetNameFromPageComponent(component);
|
|
63
|
+
const entitySetName = await this.getEntitySetNameFromPageComponent(component, metaModel);
|
|
64
64
|
if (!entitySetName) {
|
|
65
65
|
return Promise.resolve();
|
|
66
66
|
}
|
|
@@ -69,7 +69,7 @@ sap.ui.define(["sap/ui/core/Component", "sap/ui/dt/OverlayRegistry", "../../cpe/
|
|
|
69
69
|
if (!this.isCurrentObjectPage()) {
|
|
70
70
|
await this.addNavigationOptionIfAvailable(metaModel, this.entitySet);
|
|
71
71
|
} else {
|
|
72
|
-
await this.prepareNavigationData(
|
|
72
|
+
await this.prepareNavigationData(metaModel);
|
|
73
73
|
}
|
|
74
74
|
this.control = modifiedControl;
|
|
75
75
|
return Promise.resolve();
|
|
@@ -60,8 +60,11 @@ export abstract class AddNewSubpageBase<ODataMetaModelType>
|
|
|
60
60
|
protected abstract getApplicationPages(): ApplicationPageData[];
|
|
61
61
|
protected abstract isPageExists(targetEntitySet: string, metaModel: ODataMetaModelType): boolean | Promise<boolean>;
|
|
62
62
|
protected abstract isCurrentObjectPage(): boolean;
|
|
63
|
-
protected abstract getEntitySetNameFromPageComponent(
|
|
64
|
-
|
|
63
|
+
protected abstract getEntitySetNameFromPageComponent(
|
|
64
|
+
component: Component | undefined,
|
|
65
|
+
metaModel: ODataMetaModelType
|
|
66
|
+
): Promise<string | undefined>;
|
|
67
|
+
protected abstract prepareNavigationData(metaModel: ODataMetaModelType): Promise<void>;
|
|
65
68
|
protected abstract getODataMetaModel(): ODataMetaModelType | undefined;
|
|
66
69
|
|
|
67
70
|
protected async addNavigationOptionIfAvailable(
|
|
@@ -101,7 +104,7 @@ export abstract class AddNewSubpageBase<ODataMetaModelType>
|
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
const component = Component.getOwnerComponentFor(modifiedControl);
|
|
104
|
-
const entitySetName = this.getEntitySetNameFromPageComponent(component);
|
|
107
|
+
const entitySetName = await this.getEntitySetNameFromPageComponent(component, metaModel);
|
|
105
108
|
if (!entitySetName) {
|
|
106
109
|
return Promise.resolve();
|
|
107
110
|
}
|
|
@@ -111,7 +114,7 @@ export abstract class AddNewSubpageBase<ODataMetaModelType>
|
|
|
111
114
|
if (!this.isCurrentObjectPage()) {
|
|
112
115
|
await this.addNavigationOptionIfAvailable(metaModel, this.entitySet);
|
|
113
116
|
} else {
|
|
114
|
-
await this.prepareNavigationData(
|
|
117
|
+
await this.prepareNavigationData(metaModel);
|
|
115
118
|
}
|
|
116
119
|
this.control = modifiedControl;
|
|
117
120
|
|
|
@@ -47,12 +47,12 @@ sap.ui.define(["../../../utils/fe-v2", "../add-new-subpage-quick-action-base", "
|
|
|
47
47
|
if (!isA('sap.suite.ui.generic.template.lib.TemplateComponent', component)) {
|
|
48
48
|
throw new Error('Unexpected type of page owner component');
|
|
49
49
|
}
|
|
50
|
-
return component.getEntitySet();
|
|
50
|
+
return Promise.resolve(component.getEntitySet());
|
|
51
51
|
}
|
|
52
|
-
async prepareNavigationData(
|
|
53
|
-
const entitySet = metaModel.getODataEntitySet(
|
|
52
|
+
async prepareNavigationData(metaModel) {
|
|
53
|
+
const entitySet = metaModel.getODataEntitySet(this.entitySet);
|
|
54
54
|
const entityType = metaModel.getODataEntityType(entitySet.entityType);
|
|
55
|
-
for (const navProp of entityType?.navigationProperty
|
|
55
|
+
for (const navProp of entityType?.navigationProperty ?? []) {
|
|
56
56
|
const associationEnd = metaModel.getODataAssociationEnd(entityType, navProp.name);
|
|
57
57
|
if (associationEnd?.multiplicity !== '*') {
|
|
58
58
|
continue;
|
|
@@ -52,18 +52,18 @@ export class AddNewSubpage extends AddNewSubpageBase<ODataMetaModelV2> {
|
|
|
52
52
|
return (this.context.rta.getRootControlInstance().getModel() as ODataModelV2)?.getMetaModel();
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
protected getEntitySetNameFromPageComponent(component: Component | undefined): string {
|
|
55
|
+
protected getEntitySetNameFromPageComponent(component: Component | undefined): Promise<string> {
|
|
56
56
|
if (!isA<TemplateComponent>('sap.suite.ui.generic.template.lib.TemplateComponent', component)) {
|
|
57
57
|
throw new Error('Unexpected type of page owner component');
|
|
58
58
|
}
|
|
59
|
-
return component.getEntitySet();
|
|
59
|
+
return Promise.resolve(component.getEntitySet());
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
protected async prepareNavigationData(
|
|
63
|
-
const entitySet = metaModel.getODataEntitySet(
|
|
62
|
+
protected async prepareNavigationData(metaModel: ODataMetaModelV2): Promise<void> {
|
|
63
|
+
const entitySet = metaModel.getODataEntitySet(this.entitySet!) as EntitySet;
|
|
64
64
|
const entityType = metaModel.getODataEntityType(entitySet.entityType) as EntityType;
|
|
65
65
|
|
|
66
|
-
for (const navProp of entityType?.navigationProperty
|
|
66
|
+
for (const navProp of entityType?.navigationProperty ?? []) {
|
|
67
67
|
const associationEnd = metaModel.getODataAssociationEnd(entityType, navProp.name);
|
|
68
68
|
if (associationEnd?.multiplicity !== '*') {
|
|
69
69
|
continue;
|
|
@@ -85,14 +85,22 @@ sap.ui.define(["../../../utils/fe-v4", "../add-new-subpage-quick-action-base", "
|
|
|
85
85
|
getODataMetaModel() {
|
|
86
86
|
return this.context.rta.getRootControlInstance().getModel()?.getMetaModel();
|
|
87
87
|
}
|
|
88
|
-
getEntitySetNameFromPageComponent(component) {
|
|
88
|
+
async getEntitySetNameFromPageComponent(component, metaModel) {
|
|
89
89
|
if (!isA('sap.fe.templates.ListReport.Component', component) && !isA('sap.fe.templates.ObjectPage.Component', component)) {
|
|
90
90
|
throw new Error('Unexpected type of page owner component');
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
let entitySet = component.getEntitySet();
|
|
93
|
+
let contextPath = component.getContextPath();
|
|
94
|
+
if (contextPath) {
|
|
95
|
+
entitySet = await this.resolveContextPathTargetName(contextPath, metaModel);
|
|
96
|
+
}
|
|
97
|
+
return entitySet;
|
|
93
98
|
}
|
|
94
|
-
async prepareNavigationData(
|
|
95
|
-
const entitySet = await metaModel.requestObject(`/${
|
|
99
|
+
async prepareNavigationData(metaModel) {
|
|
100
|
+
const entitySet = await metaModel.requestObject(`/${this.entitySet}`); // NO SONAR;
|
|
101
|
+
if (!entitySet) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
96
104
|
const entityTypePath = entitySet.$Type;
|
|
97
105
|
const entitySetNavigationKeys = Object.keys(entitySet.$NavigationPropertyBinding);
|
|
98
106
|
for (const navigationProperty of entitySetNavigationKeys) {
|
|
@@ -117,21 +117,32 @@ export class AddNewSubpage extends AddNewSubpageBase<ODataMetaModelV4> {
|
|
|
117
117
|
return (this.context.rta.getRootControlInstance().getModel() as ODataModelV4)?.getMetaModel();
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
protected getEntitySetNameFromPageComponent(
|
|
120
|
+
protected async getEntitySetNameFromPageComponent(
|
|
121
|
+
component: Component | undefined,
|
|
122
|
+
metaModel: ODataMetaModelV4
|
|
123
|
+
): Promise<string | undefined> {
|
|
121
124
|
if (
|
|
122
125
|
!isA<FEObjectPageComponent>('sap.fe.templates.ListReport.Component', component) &&
|
|
123
126
|
!isA<FEListReportComponent>('sap.fe.templates.ObjectPage.Component', component)
|
|
124
127
|
) {
|
|
125
128
|
throw new Error('Unexpected type of page owner component');
|
|
126
129
|
}
|
|
127
|
-
|
|
130
|
+
let entitySet: string | undefined = component.getEntitySet();
|
|
131
|
+
let contextPath = component.getContextPath();
|
|
132
|
+
if (contextPath) {
|
|
133
|
+
entitySet = await this.resolveContextPathTargetName(contextPath, metaModel);
|
|
134
|
+
}
|
|
135
|
+
return entitySet;
|
|
128
136
|
}
|
|
129
137
|
|
|
130
|
-
protected async prepareNavigationData(
|
|
131
|
-
const entitySet = (await metaModel.requestObject(`/${
|
|
138
|
+
protected async prepareNavigationData(metaModel: ODataMetaModelV4) {
|
|
139
|
+
const entitySet = (await metaModel.requestObject(`/${this.entitySet}`)) as {
|
|
132
140
|
$Type: string;
|
|
133
141
|
$NavigationPropertyBinding: { [key: string]: string };
|
|
134
142
|
}; // NO SONAR;
|
|
143
|
+
if (!entitySet) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
135
146
|
const entityTypePath = entitySet.$Type;
|
|
136
147
|
const entitySetNavigationKeys = Object.keys(entitySet.$NavigationPropertyBinding);
|
|
137
148
|
|
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.
|
|
12
|
+
"version": "0.19.11",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -25,12 +25,12 @@
|
|
|
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.22",
|
|
29
|
+
"@sap-ux/feature-toggle": "0.2.3",
|
|
28
30
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.6.2",
|
|
29
31
|
"@sap-ux/btp-utils": "1.0.2",
|
|
30
|
-
"@sap-ux/adp-tooling": "0.13.22",
|
|
31
32
|
"@sap-ux/logger": "0.6.0",
|
|
32
33
|
"@sap-ux/project-access": "1.29.18",
|
|
33
|
-
"@sap-ux/feature-toggle": "0.2.3",
|
|
34
34
|
"@sap-ux/system-access": "0.5.34"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -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.
|
|
52
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.13.13",
|
|
53
|
+
"@sap-ux/axios-extension": "1.19.2",
|
|
53
54
|
"@sap-ux/i18n": "0.2.3",
|
|
54
|
-
"@sap-ux/ui5-info": "0.9.1",
|
|
55
55
|
"@sap-ux/store": "1.0.0",
|
|
56
|
-
"@sap-ux/
|
|
56
|
+
"@sap-ux/ui5-info": "0.9.1"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"express": "4"
|