@sap-ux/preview-middleware 0.19.37 → 0.19.39
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/add-fragment.js +46 -46
- package/dist/client/adp/api-handler.js +159 -159
- package/dist/client/adp/command-executor.js +75 -75
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +5 -10
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +3 -9
- package/dist/client/adp/controllers/ControllerExtension.controller.js +210 -210
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +139 -139
- package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
- package/dist/client/adp/dialog-factory.js +135 -135
- package/dist/client/adp/init-dialogs.js +163 -163
- package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +96 -96
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +60 -60
- package/dist/client/adp/quick-actions/common/create-page-action.js +54 -54
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +39 -39
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +67 -67
- package/dist/client/adp/quick-actions/common/utils.js +18 -18
- package/dist/client/adp/quick-actions/control-types.js +23 -23
- package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
- package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
- package/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +81 -81
- package/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +67 -67
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +107 -107
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +99 -99
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
- package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
- package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
- package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
- package/dist/client/adp/quick-actions/fe-v2/registry.js +77 -77
- package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
- package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +138 -138
- package/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +79 -79
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +75 -75
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +53 -53
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +49 -49
- package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +84 -84
- package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
- package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
- package/dist/client/adp/quick-actions/fe-v4/registry.js +60 -60
- package/dist/client/adp/quick-actions/fe-v4/utils.js +72 -72
- package/dist/client/adp/quick-actions/load.js +44 -44
- package/dist/client/adp/quick-actions/quick-action-base.js +64 -64
- package/dist/client/adp/utils.js +218 -218
- package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +75 -75
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/validator.js +39 -39
- package/dist/client/cpe/documentation.js +164 -164
- package/dist/client/cpe/feature-service.js +36 -36
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/outline/editable.js +37 -37
- package/dist/client/cpe/outline/nodes.js +203 -203
- package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
- package/dist/client/cpe/quick-actions/registry.js +143 -143
- package/dist/client/cpe/quick-actions/utils.js +92 -92
- package/dist/client/cpe/types.js +4 -4
- package/dist/client/cpe/ui5-utils.js +33 -33
- package/dist/client/cpe/utils.js +111 -111
- package/dist/client/flp/WorkspaceConnector.js +92 -92
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +89 -89
- package/dist/client/flp/homepage/Component.js +14 -14
- package/dist/client/flp/initCdm.js +117 -117
- package/dist/client/flp/initConnectors.js +28 -28
- package/dist/client/flp/initRta.js +178 -178
- package/dist/client/i18n.js +56 -56
- package/dist/client/utils/additional-change-info.js +54 -41
- package/dist/client/utils/additional-change-info.ts +22 -8
- package/dist/client/utils/application.js +32 -32
- package/dist/client/utils/core.js +84 -84
- package/dist/client/utils/error.js +19 -19
- package/dist/client/utils/fe-v2.js +56 -56
- package/dist/client/utils/fe-v4.js +140 -140
- package/dist/client/utils/version.js +104 -104
- package/package.json +4 -4
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/rta/command/CommandFactory", "../../../utils/version", "sap/ui/core/Component"], function (CommandFactory, _____utils_version, Component) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const getUi5Version = _____utils_version["getUi5Version"];
|
|
7
|
-
const isLowerThanMinimalUi5Version = _____utils_version["isLowerThanMinimalUi5Version"];
|
|
8
|
-
const isVersionEqualOrHasNewerPatch = _____utils_version["isVersionEqualOrHasNewerPatch"];
|
|
9
|
-
/**
|
|
10
|
-
* Gets app component of a v2 project.
|
|
11
|
-
*
|
|
12
|
-
* @param control - ManagedObject.
|
|
13
|
-
* @returns AppComponent.
|
|
14
|
-
*/
|
|
15
|
-
function getV2AppComponent(control) {
|
|
16
|
-
const ownerComponent = Component.getOwnerComponentFor(control);
|
|
17
|
-
let result;
|
|
18
|
-
if (ownerComponent?.isA('sap.suite.ui.generic.template.lib.TemplateComponent')) {
|
|
19
|
-
result = ownerComponent.getAppComponent();
|
|
20
|
-
}
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Prepares the change for the manifest setting.
|
|
26
|
-
*
|
|
27
|
-
* @param context - The context object containing flexSettings.
|
|
28
|
-
* @param propertyPath - The path of the property in the manifest.
|
|
29
|
-
* @param control - The UI5 element representing the control.
|
|
30
|
-
* @param component - component name e.g list report or object page.
|
|
31
|
-
* @param entitySet - Entity Set name.
|
|
32
|
-
* @param propertyValue - The value to be set for the property.
|
|
33
|
-
*
|
|
34
|
-
* @returns A Promise resolving to an array of FlexCommand objects.
|
|
35
|
-
*/
|
|
36
|
-
async function prepareManifestChange(context, propertyPath, control, component, entitySet, propertyValue) {
|
|
37
|
-
const {
|
|
38
|
-
flexSettings
|
|
39
|
-
} = context;
|
|
40
|
-
const appComponent = getV2AppComponent(control);
|
|
41
|
-
const modifiedValue = {
|
|
42
|
-
changeType: 'appdescr_ui_generic_app_changePageConfiguration',
|
|
43
|
-
reference: flexSettings.projectId,
|
|
44
|
-
appComponent,
|
|
45
|
-
parameters: {
|
|
46
|
-
parentPage: {
|
|
47
|
-
component,
|
|
48
|
-
entitySet
|
|
49
|
-
},
|
|
50
|
-
entityPropertyChange: {
|
|
51
|
-
propertyPath: propertyPath,
|
|
52
|
-
operation: 'UPSERT',
|
|
53
|
-
propertyValue: propertyValue
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const command = await CommandFactory.getCommandFor(control, 'appDescriptor', modifiedValue, null, flexSettings);
|
|
58
|
-
return [command];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Checks whether the manifest has array structured page definitions
|
|
63
|
-
* @param manifest - manifest object
|
|
64
|
-
* @returns true if pages are defined as array, false if defined as object
|
|
65
|
-
*/
|
|
66
|
-
function isManifestArrayStructured(manifest) {
|
|
67
|
-
return Array.isArray(manifest['sap.ui.generic.app']?.pages);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Checks if the current UI5 version and manifest structure is supported in v2 applications.
|
|
72
|
-
*
|
|
73
|
-
* @param manifest - manifest changes of the current application.
|
|
74
|
-
*
|
|
75
|
-
* Returns `false`
|
|
76
|
-
*
|
|
77
|
-
* - If the manifest is structured is an array and is below version 1.134
|
|
78
|
-
* - If the UI5 version is not supported
|
|
79
|
-
* Otherwise, returns `true`.
|
|
80
|
-
*
|
|
81
|
-
*/
|
|
82
|
-
async function areManifestChangesSupported(manifest) {
|
|
83
|
-
const version = await getUi5Version();
|
|
84
|
-
if (isLowerThanMinimalUi5Version(version, {
|
|
85
|
-
major: 1,
|
|
86
|
-
minor: 134
|
|
87
|
-
}) && isManifestArrayStructured(manifest)) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
const isAboveOrEqualMinimalVersion = !isLowerThanMinimalUi5Version(version, {
|
|
91
|
-
major: 1,
|
|
92
|
-
minor: 128
|
|
93
|
-
});
|
|
94
|
-
const isSupportedPatchVersion = isVersionEqualOrHasNewerPatch(version, {
|
|
95
|
-
major: 1,
|
|
96
|
-
minor: 96,
|
|
97
|
-
patch: 35
|
|
98
|
-
}) || isVersionEqualOrHasNewerPatch(version, {
|
|
99
|
-
major: 1,
|
|
100
|
-
minor: 108,
|
|
101
|
-
patch: 38
|
|
102
|
-
}) || isVersionEqualOrHasNewerPatch(version, {
|
|
103
|
-
major: 1,
|
|
104
|
-
minor: 120,
|
|
105
|
-
patch: 23
|
|
106
|
-
});
|
|
107
|
-
return isAboveOrEqualMinimalVersion || isSupportedPatchVersion;
|
|
108
|
-
}
|
|
109
|
-
var __exports = {
|
|
110
|
-
__esModule: true
|
|
111
|
-
};
|
|
112
|
-
__exports.getV2AppComponent = getV2AppComponent;
|
|
113
|
-
__exports.prepareManifestChange = prepareManifestChange;
|
|
114
|
-
__exports.isManifestArrayStructured = isManifestArrayStructured;
|
|
115
|
-
__exports.areManifestChangesSupported = areManifestChangesSupported;
|
|
116
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/rta/command/CommandFactory", "../../../utils/version", "sap/ui/core/Component"], function (CommandFactory, _____utils_version, Component) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getUi5Version = _____utils_version["getUi5Version"];
|
|
7
|
+
const isLowerThanMinimalUi5Version = _____utils_version["isLowerThanMinimalUi5Version"];
|
|
8
|
+
const isVersionEqualOrHasNewerPatch = _____utils_version["isVersionEqualOrHasNewerPatch"];
|
|
9
|
+
/**
|
|
10
|
+
* Gets app component of a v2 project.
|
|
11
|
+
*
|
|
12
|
+
* @param control - ManagedObject.
|
|
13
|
+
* @returns AppComponent.
|
|
14
|
+
*/
|
|
15
|
+
function getV2AppComponent(control) {
|
|
16
|
+
const ownerComponent = Component.getOwnerComponentFor(control);
|
|
17
|
+
let result;
|
|
18
|
+
if (ownerComponent?.isA('sap.suite.ui.generic.template.lib.TemplateComponent')) {
|
|
19
|
+
result = ownerComponent.getAppComponent();
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Prepares the change for the manifest setting.
|
|
26
|
+
*
|
|
27
|
+
* @param context - The context object containing flexSettings.
|
|
28
|
+
* @param propertyPath - The path of the property in the manifest.
|
|
29
|
+
* @param control - The UI5 element representing the control.
|
|
30
|
+
* @param component - component name e.g list report or object page.
|
|
31
|
+
* @param entitySet - Entity Set name.
|
|
32
|
+
* @param propertyValue - The value to be set for the property.
|
|
33
|
+
*
|
|
34
|
+
* @returns A Promise resolving to an array of FlexCommand objects.
|
|
35
|
+
*/
|
|
36
|
+
async function prepareManifestChange(context, propertyPath, control, component, entitySet, propertyValue) {
|
|
37
|
+
const {
|
|
38
|
+
flexSettings
|
|
39
|
+
} = context;
|
|
40
|
+
const appComponent = getV2AppComponent(control);
|
|
41
|
+
const modifiedValue = {
|
|
42
|
+
changeType: 'appdescr_ui_generic_app_changePageConfiguration',
|
|
43
|
+
reference: flexSettings.projectId,
|
|
44
|
+
appComponent,
|
|
45
|
+
parameters: {
|
|
46
|
+
parentPage: {
|
|
47
|
+
component,
|
|
48
|
+
entitySet
|
|
49
|
+
},
|
|
50
|
+
entityPropertyChange: {
|
|
51
|
+
propertyPath: propertyPath,
|
|
52
|
+
operation: 'UPSERT',
|
|
53
|
+
propertyValue: propertyValue
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const command = await CommandFactory.getCommandFor(control, 'appDescriptor', modifiedValue, null, flexSettings);
|
|
58
|
+
return [command];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Checks whether the manifest has array structured page definitions
|
|
63
|
+
* @param manifest - manifest object
|
|
64
|
+
* @returns true if pages are defined as array, false if defined as object
|
|
65
|
+
*/
|
|
66
|
+
function isManifestArrayStructured(manifest) {
|
|
67
|
+
return Array.isArray(manifest['sap.ui.generic.app']?.pages);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Checks if the current UI5 version and manifest structure is supported in v2 applications.
|
|
72
|
+
*
|
|
73
|
+
* @param manifest - manifest changes of the current application.
|
|
74
|
+
*
|
|
75
|
+
* Returns `false`
|
|
76
|
+
*
|
|
77
|
+
* - If the manifest is structured is an array and is below version 1.134
|
|
78
|
+
* - If the UI5 version is not supported
|
|
79
|
+
* Otherwise, returns `true`.
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
82
|
+
async function areManifestChangesSupported(manifest) {
|
|
83
|
+
const version = await getUi5Version();
|
|
84
|
+
if (isLowerThanMinimalUi5Version(version, {
|
|
85
|
+
major: 1,
|
|
86
|
+
minor: 134
|
|
87
|
+
}) && isManifestArrayStructured(manifest)) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
const isAboveOrEqualMinimalVersion = !isLowerThanMinimalUi5Version(version, {
|
|
91
|
+
major: 1,
|
|
92
|
+
minor: 128
|
|
93
|
+
});
|
|
94
|
+
const isSupportedPatchVersion = isVersionEqualOrHasNewerPatch(version, {
|
|
95
|
+
major: 1,
|
|
96
|
+
minor: 96,
|
|
97
|
+
patch: 35
|
|
98
|
+
}) || isVersionEqualOrHasNewerPatch(version, {
|
|
99
|
+
major: 1,
|
|
100
|
+
minor: 108,
|
|
101
|
+
patch: 38
|
|
102
|
+
}) || isVersionEqualOrHasNewerPatch(version, {
|
|
103
|
+
major: 1,
|
|
104
|
+
minor: 120,
|
|
105
|
+
patch: 23
|
|
106
|
+
});
|
|
107
|
+
return isAboveOrEqualMinimalVersion || isSupportedPatchVersion;
|
|
108
|
+
}
|
|
109
|
+
var __exports = {
|
|
110
|
+
__esModule: true
|
|
111
|
+
};
|
|
112
|
+
__exports.getV2AppComponent = getV2AppComponent;
|
|
113
|
+
__exports.prepareManifestChange = prepareManifestChange;
|
|
114
|
+
__exports.isManifestArrayStructured = isManifestArrayStructured;
|
|
115
|
+
__exports.areManifestChangesSupported = areManifestChangesSupported;
|
|
116
|
+
return __exports;
|
|
117
117
|
});
|
|
118
118
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["../../../utils/fe-v4", "../add-new-subpage-quick-action-base", "../../../utils/core", "../../../utils/version"], function (_____utils_fe_v4, ___add_new_subpage_quick_action_base, _____utils_core, _____utils_version) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const getV4AppComponent = _____utils_fe_v4["getV4AppComponent"];
|
|
7
|
-
const getV4ApplicationPages = _____utils_fe_v4["getV4ApplicationPages"];
|
|
8
|
-
const AddNewSubpageBase = ___add_new_subpage_quick_action_base["AddNewSubpageBase"];
|
|
9
|
-
const isA = _____utils_core["isA"];
|
|
10
|
-
const getUi5Version = _____utils_version["getUi5Version"];
|
|
11
|
-
const isLowerThanMinimalUi5Version = _____utils_version["isLowerThanMinimalUi5Version"];
|
|
12
|
-
const OBJECT_PAGE_COMPONENT_NAME_V4 = 'sap.fe.templates.ObjectPage.ObjectPage';
|
|
13
|
-
/**
|
|
14
|
-
* Quick Action for adding a custom page action.
|
|
15
|
-
*/
|
|
16
|
-
class AddNewSubpage extends AddNewSubpageBase {
|
|
17
|
-
get currentPageDescriptor() {
|
|
18
|
-
if (!this.pageId) {
|
|
19
|
-
throw new Error('pageId is not defined');
|
|
20
|
-
}
|
|
21
|
-
if (!this.routePattern) {
|
|
22
|
-
throw new Error('routePattern is not defined');
|
|
23
|
-
}
|
|
24
|
-
if (!this.appComponent) {
|
|
25
|
-
throw new Error('appComponent is not defined');
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
appType: 'fe-v4',
|
|
29
|
-
appComponent: this.appComponent,
|
|
30
|
-
pageId: this.pageId,
|
|
31
|
-
routePattern: this.routePattern
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
getApplicationPages() {
|
|
35
|
-
return getV4ApplicationPages(this.context.manifest);
|
|
36
|
-
}
|
|
37
|
-
async resolveContextPathTargetName(contextPath, metaModel) {
|
|
38
|
-
let result;
|
|
39
|
-
const segments = contextPath.split('/').filter(s => !!s);
|
|
40
|
-
if (segments.length === 1) {
|
|
41
|
-
// one segment - assumed it is the direct name of entitySet
|
|
42
|
-
result = segments[0];
|
|
43
|
-
} else {
|
|
44
|
-
// resolve segment by segment
|
|
45
|
-
let targetObject = await metaModel.requestObject(`/${segments[0]}`); // NO SONAR;
|
|
46
|
-
|
|
47
|
-
let idx = 1;
|
|
48
|
-
let targetSetName = '';
|
|
49
|
-
while (targetObject && idx < segments.length) {
|
|
50
|
-
const navProp = segments[idx];
|
|
51
|
-
targetSetName = targetObject.$NavigationPropertyBinding[navProp];
|
|
52
|
-
if (!targetSetName) {
|
|
53
|
-
targetObject = undefined;
|
|
54
|
-
} else {
|
|
55
|
-
targetObject = await metaModel.requestObject(`/${targetSetName}`); // NO SONAR;
|
|
56
|
-
idx++;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (targetObject) {
|
|
60
|
-
result = targetSetName;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return result;
|
|
64
|
-
}
|
|
65
|
-
async isPageExists(targetEntitySet, metaModel) {
|
|
66
|
-
let pageFound = false;
|
|
67
|
-
let entitySetName;
|
|
68
|
-
for (const page of this.existingPages) {
|
|
69
|
-
if (page.contextPath) {
|
|
70
|
-
// resolve contextPath to target entitySet
|
|
71
|
-
entitySetName = await this.resolveContextPathTargetName(page.contextPath, metaModel);
|
|
72
|
-
} else {
|
|
73
|
-
entitySetName = page.entitySet;
|
|
74
|
-
}
|
|
75
|
-
if (entitySetName === targetEntitySet) {
|
|
76
|
-
pageFound = true;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return pageFound;
|
|
81
|
-
}
|
|
82
|
-
isCurrentObjectPage() {
|
|
83
|
-
return this.pageType === OBJECT_PAGE_COMPONENT_NAME_V4;
|
|
84
|
-
}
|
|
85
|
-
getODataMetaModel() {
|
|
86
|
-
return this.context.rta.getRootControlInstance().getModel()?.getMetaModel();
|
|
87
|
-
}
|
|
88
|
-
async getEntitySetNameFromPageComponent(component, metaModel) {
|
|
89
|
-
if (!isA('sap.fe.templates.ListReport.Component', component) && !isA('sap.fe.templates.ObjectPage.Component', component)) {
|
|
90
|
-
throw new Error('Unexpected type of page owner component');
|
|
91
|
-
}
|
|
92
|
-
let entitySet = component.getEntitySet();
|
|
93
|
-
let contextPath = component.getContextPath();
|
|
94
|
-
if (contextPath) {
|
|
95
|
-
entitySet = await this.resolveContextPathTargetName(contextPath, metaModel);
|
|
96
|
-
}
|
|
97
|
-
return entitySet;
|
|
98
|
-
}
|
|
99
|
-
async prepareNavigationData(metaModel) {
|
|
100
|
-
const entitySet = await metaModel.requestObject(`/${this.entitySet}`); // NO SONAR;
|
|
101
|
-
if (!entitySet) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
const entityTypePath = entitySet.$Type;
|
|
105
|
-
const entitySetNavigationKeys = Object.keys(entitySet.$NavigationPropertyBinding);
|
|
106
|
-
for (const navigationProperty of entitySetNavigationKeys) {
|
|
107
|
-
const associationEnd = await metaModel.requestObject(`/${entityTypePath}/${navigationProperty}`);
|
|
108
|
-
if (associationEnd?.$isCollection) {
|
|
109
|
-
const targetEntitySet = entitySet.$NavigationPropertyBinding[navigationProperty];
|
|
110
|
-
await this.addNavigationOptionIfAvailable(metaModel, targetEntitySet, navigationProperty);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
async initialize() {
|
|
115
|
-
const version = await getUi5Version();
|
|
116
|
-
if (isLowerThanMinimalUi5Version(version, {
|
|
117
|
-
major: 1,
|
|
118
|
-
minor: 135
|
|
119
|
-
})) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
await super.initialize();
|
|
123
|
-
this.appComponent = getV4AppComponent(this.context.view);
|
|
124
|
-
this.pageId = this.context.view.getViewData()?.stableId.split('::').pop();
|
|
125
|
-
// remember current page route pattern (used in dialog controller for new page change)
|
|
126
|
-
const currentPageRoute = (this.context.manifest['sap.ui5'].routing?.routes ?? []).find(r => r.name === this.pageId);
|
|
127
|
-
if (!currentPageRoute) {
|
|
128
|
-
throw new Error('Current page navigation route not found in manifest');
|
|
129
|
-
}
|
|
130
|
-
this.routePattern = currentPageRoute.pattern;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
var __exports = {
|
|
134
|
-
__esModule: true
|
|
135
|
-
};
|
|
136
|
-
__exports.OBJECT_PAGE_COMPONENT_NAME_V4 = OBJECT_PAGE_COMPONENT_NAME_V4;
|
|
137
|
-
__exports.AddNewSubpage = AddNewSubpage;
|
|
138
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["../../../utils/fe-v4", "../add-new-subpage-quick-action-base", "../../../utils/core", "../../../utils/version"], function (_____utils_fe_v4, ___add_new_subpage_quick_action_base, _____utils_core, _____utils_version) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getV4AppComponent = _____utils_fe_v4["getV4AppComponent"];
|
|
7
|
+
const getV4ApplicationPages = _____utils_fe_v4["getV4ApplicationPages"];
|
|
8
|
+
const AddNewSubpageBase = ___add_new_subpage_quick_action_base["AddNewSubpageBase"];
|
|
9
|
+
const isA = _____utils_core["isA"];
|
|
10
|
+
const getUi5Version = _____utils_version["getUi5Version"];
|
|
11
|
+
const isLowerThanMinimalUi5Version = _____utils_version["isLowerThanMinimalUi5Version"];
|
|
12
|
+
const OBJECT_PAGE_COMPONENT_NAME_V4 = 'sap.fe.templates.ObjectPage.ObjectPage';
|
|
13
|
+
/**
|
|
14
|
+
* Quick Action for adding a custom page action.
|
|
15
|
+
*/
|
|
16
|
+
class AddNewSubpage extends AddNewSubpageBase {
|
|
17
|
+
get currentPageDescriptor() {
|
|
18
|
+
if (!this.pageId) {
|
|
19
|
+
throw new Error('pageId is not defined');
|
|
20
|
+
}
|
|
21
|
+
if (!this.routePattern) {
|
|
22
|
+
throw new Error('routePattern is not defined');
|
|
23
|
+
}
|
|
24
|
+
if (!this.appComponent) {
|
|
25
|
+
throw new Error('appComponent is not defined');
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
appType: 'fe-v4',
|
|
29
|
+
appComponent: this.appComponent,
|
|
30
|
+
pageId: this.pageId,
|
|
31
|
+
routePattern: this.routePattern
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
getApplicationPages() {
|
|
35
|
+
return getV4ApplicationPages(this.context.manifest);
|
|
36
|
+
}
|
|
37
|
+
async resolveContextPathTargetName(contextPath, metaModel) {
|
|
38
|
+
let result;
|
|
39
|
+
const segments = contextPath.split('/').filter(s => !!s);
|
|
40
|
+
if (segments.length === 1) {
|
|
41
|
+
// one segment - assumed it is the direct name of entitySet
|
|
42
|
+
result = segments[0];
|
|
43
|
+
} else {
|
|
44
|
+
// resolve segment by segment
|
|
45
|
+
let targetObject = await metaModel.requestObject(`/${segments[0]}`); // NO SONAR;
|
|
46
|
+
|
|
47
|
+
let idx = 1;
|
|
48
|
+
let targetSetName = '';
|
|
49
|
+
while (targetObject && idx < segments.length) {
|
|
50
|
+
const navProp = segments[idx];
|
|
51
|
+
targetSetName = targetObject.$NavigationPropertyBinding[navProp];
|
|
52
|
+
if (!targetSetName) {
|
|
53
|
+
targetObject = undefined;
|
|
54
|
+
} else {
|
|
55
|
+
targetObject = await metaModel.requestObject(`/${targetSetName}`); // NO SONAR;
|
|
56
|
+
idx++;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (targetObject) {
|
|
60
|
+
result = targetSetName;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
async isPageExists(targetEntitySet, metaModel) {
|
|
66
|
+
let pageFound = false;
|
|
67
|
+
let entitySetName;
|
|
68
|
+
for (const page of this.existingPages) {
|
|
69
|
+
if (page.contextPath) {
|
|
70
|
+
// resolve contextPath to target entitySet
|
|
71
|
+
entitySetName = await this.resolveContextPathTargetName(page.contextPath, metaModel);
|
|
72
|
+
} else {
|
|
73
|
+
entitySetName = page.entitySet;
|
|
74
|
+
}
|
|
75
|
+
if (entitySetName === targetEntitySet) {
|
|
76
|
+
pageFound = true;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return pageFound;
|
|
81
|
+
}
|
|
82
|
+
isCurrentObjectPage() {
|
|
83
|
+
return this.pageType === OBJECT_PAGE_COMPONENT_NAME_V4;
|
|
84
|
+
}
|
|
85
|
+
getODataMetaModel() {
|
|
86
|
+
return this.context.rta.getRootControlInstance().getModel()?.getMetaModel();
|
|
87
|
+
}
|
|
88
|
+
async getEntitySetNameFromPageComponent(component, metaModel) {
|
|
89
|
+
if (!isA('sap.fe.templates.ListReport.Component', component) && !isA('sap.fe.templates.ObjectPage.Component', component)) {
|
|
90
|
+
throw new Error('Unexpected type of page owner component');
|
|
91
|
+
}
|
|
92
|
+
let entitySet = component.getEntitySet();
|
|
93
|
+
let contextPath = component.getContextPath();
|
|
94
|
+
if (contextPath) {
|
|
95
|
+
entitySet = await this.resolveContextPathTargetName(contextPath, metaModel);
|
|
96
|
+
}
|
|
97
|
+
return entitySet;
|
|
98
|
+
}
|
|
99
|
+
async prepareNavigationData(metaModel) {
|
|
100
|
+
const entitySet = await metaModel.requestObject(`/${this.entitySet}`); // NO SONAR;
|
|
101
|
+
if (!entitySet) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const entityTypePath = entitySet.$Type;
|
|
105
|
+
const entitySetNavigationKeys = Object.keys(entitySet.$NavigationPropertyBinding);
|
|
106
|
+
for (const navigationProperty of entitySetNavigationKeys) {
|
|
107
|
+
const associationEnd = await metaModel.requestObject(`/${entityTypePath}/${navigationProperty}`);
|
|
108
|
+
if (associationEnd?.$isCollection) {
|
|
109
|
+
const targetEntitySet = entitySet.$NavigationPropertyBinding[navigationProperty];
|
|
110
|
+
await this.addNavigationOptionIfAvailable(metaModel, targetEntitySet, navigationProperty);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async initialize() {
|
|
115
|
+
const version = await getUi5Version();
|
|
116
|
+
if (isLowerThanMinimalUi5Version(version, {
|
|
117
|
+
major: 1,
|
|
118
|
+
minor: 135
|
|
119
|
+
})) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
await super.initialize();
|
|
123
|
+
this.appComponent = getV4AppComponent(this.context.view);
|
|
124
|
+
this.pageId = this.context.view.getViewData()?.stableId.split('::').pop();
|
|
125
|
+
// remember current page route pattern (used in dialog controller for new page change)
|
|
126
|
+
const currentPageRoute = (this.context.manifest['sap.ui5'].routing?.routes ?? []).find(r => r.name === this.pageId);
|
|
127
|
+
if (!currentPageRoute) {
|
|
128
|
+
throw new Error('Current page navigation route not found in manifest');
|
|
129
|
+
}
|
|
130
|
+
this.routePattern = currentPageRoute.pattern;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
var __exports = {
|
|
134
|
+
__esModule: true
|
|
135
|
+
};
|
|
136
|
+
__exports.OBJECT_PAGE_COMPONENT_NAME_V4 = OBJECT_PAGE_COMPONENT_NAME_V4;
|
|
137
|
+
__exports.AddNewSubpage = AddNewSubpage;
|
|
138
|
+
return __exports;
|
|
139
139
|
});
|
|
140
140
|
//# sourceMappingURL=add-new-subpage.js.map
|