@sap/ux-specification 1.71.41 → 1.71.45
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/CHANGELOG.md +88 -22
- package/README.md +4 -4
- package/dist/documentation/runDocu-min.js +2 -0
- package/dist/documentation/runDocu-min.js.LICENSE.txt +24 -0
- package/dist/documentation/styleDocu.css +227 -0
- package/dist/documentation/v2/v2-AnalyticalListPage.html +49 -0
- package/dist/documentation/v2/v2-ApplicationV2.html +48 -0
- package/dist/documentation/v2/v2-ListReport.html +49 -0
- package/dist/documentation/v2/v2-ObjectPage.html +49 -0
- package/dist/documentation/v2/v2-OverviewPage.html +49 -0
- package/dist/index-min.js +1 -1
- package/dist/schemas/v2/AnalyticalListPageConfig.json +76 -6
- package/dist/schemas/v2/ApplicationV2.json +6 -0
- package/dist/schemas/v2/ListReportConfig.json +75 -5
- package/dist/schemas/v2/ObjectPageConfig.json +302 -42
- package/dist/schemas/v2/OverviewPageConfig.json +24 -41
- package/dist/scripts/extractDocu.js +186 -19
- package/dist/scripts/extractDocu.js.map +1 -1
- package/dist/scripts/runDocu.d.ts +1 -0
- package/dist/scripts/runDocu.js +561 -0
- package/dist/scripts/runDocu.js.map +1 -0
- package/dist/specification/v2/index-min.js +1 -1
- package/dist/src/api.js +8 -14
- package/dist/src/api.js.map +1 -1
- package/dist/src/apiTypes.d.ts +72 -65
- package/dist/src/extensionLogger.js +2 -2
- package/dist/src/extensionLogger.js.map +1 -1
- package/dist/src/specification/common/page.d.ts +2 -2
- package/dist/src/specification/common/page.js.map +1 -1
- package/dist/src/specification/common/types.d.ts +1 -0
- package/dist/src/specification/common/webapp/manifest/Manifest.d.ts +3 -1
- package/dist/src/specification/common/webapp/manifest/Manifest.js +1 -0
- package/dist/src/specification/common/webapp/manifest/Manifest.js.map +1 -1
- package/dist/src/specification/common/webapp/manifest/sapOvp.d.ts +2 -1
- package/dist/src/specification/v2/ApplicationV2.d.ts +6 -0
- package/dist/src/specification/v2/controls/AnalyticalListPageChart.d.ts +1 -1
- package/dist/src/specification/v2/controls/Card.d.ts +11 -13
- package/dist/src/specification/v2/controls/Card.js +0 -3
- package/dist/src/specification/v2/controls/Card.js.map +1 -1
- package/dist/src/specification/v2/controls/Facets.d.ts +2 -1
- package/dist/src/specification/v2/controls/Field.d.ts +10 -0
- package/dist/src/specification/v2/controls/Field.js +3 -0
- package/dist/src/specification/v2/controls/Field.js.map +1 -0
- package/dist/src/specification/v2/controls/FormAction.d.ts +38 -0
- package/dist/src/specification/v2/controls/FormAction.js +15 -0
- package/dist/src/specification/v2/controls/FormAction.js.map +1 -0
- package/dist/src/specification/v2/controls/ObjectPageFooter.d.ts +11 -0
- package/dist/src/specification/v2/controls/ObjectPageFooter.js +3 -0
- package/dist/src/specification/v2/controls/ObjectPageFooter.js.map +1 -0
- package/dist/src/specification/v2/controls/ObjectPageForm.d.ts +16 -0
- package/dist/src/specification/v2/controls/ObjectPageForm.js +3 -0
- package/dist/src/specification/v2/controls/ObjectPageForm.js.map +1 -0
- package/dist/src/specification/v2/controls/ObjectPageHeaderAction.d.ts +21 -5
- package/dist/src/specification/v2/controls/ObjectPageHeaderAction.js +0 -5
- package/dist/src/specification/v2/controls/ObjectPageHeaderAction.js.map +1 -1
- package/dist/src/specification/v2/controls/ObjectPageSection.d.ts +24 -7
- package/dist/src/specification/v2/controls/ObjectPageSection.js.map +1 -1
- package/dist/src/specification/v2/controls/ObjectPageTable.d.ts +4 -1
- package/dist/src/specification/v2/controls/Table.d.ts +4 -0
- package/dist/src/specification/v2/controls/Table.js.map +1 -1
- package/dist/src/specification/v2/controls/ToolBar.d.ts +2 -6
- package/dist/src/specification/v2/controls/index.d.ts +5 -0
- package/dist/src/specification/v2/controls/index.js +1 -1
- package/dist/src/specification/v2/controls/index.js.map +1 -1
- package/dist/src/specification/v2/pages/ListReportConfig.d.ts +2 -1
- package/dist/src/specification/v2/pages/ObjectPageConfig.d.ts +2 -1
- package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.d.ts +1 -0
- package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.js +1 -0
- package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.js.map +1 -1
- package/dist/src/sync/common/decoration/control.d.ts +8 -1
- package/dist/src/sync/common/decoration/control.js +62 -21
- package/dist/src/sync/common/decoration/control.js.map +1 -1
- package/dist/src/sync/common/flexUtils.d.ts +2 -2
- package/dist/src/sync/common/flexUtils.js +10 -5
- package/dist/src/sync/common/flexUtils.js.map +1 -1
- package/dist/src/sync/common/generate/index.d.ts +1 -0
- package/dist/src/sync/common/generate/index.js +7 -0
- package/dist/src/sync/common/generate/index.js.map +1 -0
- package/dist/src/sync/common/generate/objectPage.d.ts +49 -0
- package/dist/src/sync/common/generate/objectPage.js +319 -0
- package/dist/src/sync/common/generate/objectPage.js.map +1 -0
- package/dist/src/sync/common/import/utils.d.ts +28 -0
- package/dist/src/sync/common/import/utils.js +75 -0
- package/dist/src/sync/common/import/utils.js.map +1 -0
- package/dist/src/sync/common/importProject.js +53 -50
- package/dist/src/sync/common/importProject.js.map +1 -1
- package/dist/src/sync/common/index.d.ts +2 -0
- package/dist/src/sync/common/index.js +2 -0
- package/dist/src/sync/common/index.js.map +1 -1
- package/dist/src/sync/common/types.d.ts +19 -6
- package/dist/src/sync/common/types.js +12 -0
- package/dist/src/sync/common/types.js.map +1 -1
- package/dist/src/sync/common/utils.d.ts +30 -9
- package/dist/src/sync/common/utils.js +255 -173
- package/dist/src/sync/common/utils.js.map +1 -1
- package/dist/src/sync/v2/application.d.ts +2 -0
- package/dist/src/sync/v2/application.js +18 -5
- package/dist/src/sync/v2/application.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Card.d.ts +4 -3
- package/dist/src/sync/v2/export/controls/Card.js +16 -9
- package/dist/src/sync/v2/export/controls/Card.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Field.d.ts +4 -0
- package/dist/src/sync/v2/export/controls/Field.js +32 -0
- package/dist/src/sync/v2/export/controls/Field.js.map +1 -0
- package/dist/src/sync/v2/export/controls/FormAction.d.ts +15 -0
- package/dist/src/sync/v2/export/controls/FormAction.js +127 -0
- package/dist/src/sync/v2/export/controls/FormAction.js.map +1 -0
- package/dist/src/sync/v2/export/controls/Fragment.d.ts +1 -1
- package/dist/src/sync/v2/export/controls/Fragment.js +100 -87
- package/dist/src/sync/v2/export/controls/Fragment.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageHeader.js +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageHeader.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.d.ts +6 -2
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js +43 -4
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.d.ts +25 -0
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js +113 -0
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js.map +1 -0
- package/dist/src/sync/v2/export/controls/ObjectPageTable.js +4 -5
- package/dist/src/sync/v2/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Table.d.ts +8 -1
- package/dist/src/sync/v2/export/controls/Table.js +88 -31
- package/dist/src/sync/v2/export/controls/Table.js.map +1 -1
- package/dist/src/sync/v2/export/controls/TableColumn.js +1 -1
- package/dist/src/sync/v2/export/controls/TableColumn.js.map +1 -1
- package/dist/src/sync/v2/export/controls/index.d.ts +3 -0
- package/dist/src/sync/v2/export/controls/index.js +3 -0
- package/dist/src/sync/v2/export/controls/index.js.map +1 -1
- package/dist/src/sync/v2/export/export.d.ts +24 -10
- package/dist/src/sync/v2/export/export.js +285 -503
- package/dist/src/sync/v2/export/export.js.map +1 -1
- package/dist/src/sync/v2/export/exportPage.d.ts +10 -0
- package/dist/src/sync/v2/export/exportPage.js +311 -0
- package/dist/src/sync/v2/export/exportPage.js.map +1 -0
- package/dist/src/sync/v2/export/pages/ListReport.d.ts +3 -1
- package/dist/src/sync/v2/export/pages/ListReport.js.map +1 -1
- package/dist/src/sync/v2/export/pages/OverviewPage.d.ts +3 -1
- package/dist/src/sync/v2/export/pages/OverviewPage.js.map +1 -1
- package/dist/src/sync/v2/export/view-controller-generator.js +1 -1
- package/dist/src/sync/v2/export/view-controller-generator.js.map +1 -1
- package/dist/src/sync/v2/generate/analyticalListReport.d.ts +3 -9
- package/dist/src/sync/v2/generate/analyticalListReport.js +13 -16
- package/dist/src/sync/v2/generate/analyticalListReport.js.map +1 -1
- package/dist/src/sync/v2/generate/generate.js +28 -6
- package/dist/src/sync/v2/generate/generate.js.map +1 -1
- package/dist/src/sync/v2/generate/listReport.d.ts +3 -9
- package/dist/src/sync/v2/generate/listReport.js +20 -23
- package/dist/src/sync/v2/generate/listReport.js.map +1 -1
- package/dist/src/sync/v2/generate/objectPage.d.ts +3 -10
- package/dist/src/sync/v2/generate/objectPage.js +226 -141
- package/dist/src/sync/v2/generate/objectPage.js.map +1 -1
- package/dist/src/sync/v2/generate/utils.d.ts +1 -2
- package/dist/src/sync/v2/generate/utils.js +21 -6
- package/dist/src/sync/v2/generate/utils.js.map +1 -1
- package/dist/src/sync/v2/import/app/appProvider.js +25 -3
- package/dist/src/sync/v2/import/app/appProvider.js.map +1 -1
- package/dist/src/sync/v2/import/app/ovpProvider.d.ts +2 -1
- package/dist/src/sync/v2/import/app/ovpProvider.js +7 -3
- package/dist/src/sync/v2/import/app/ovpProvider.js.map +1 -1
- package/dist/src/sync/v2/import/common/index.d.ts +10 -1
- package/dist/src/sync/v2/import/common/index.js +17 -38
- package/dist/src/sync/v2/import/common/index.js.map +1 -1
- package/dist/src/sync/v2/import/controls/table.d.ts +2 -1
- package/dist/src/sync/v2/import/controls/table.js +1 -1
- package/dist/src/sync/v2/import/controls/table.js.map +1 -1
- package/dist/src/sync/v2/import/pages/analyticalListPage.d.ts +3 -8
- package/dist/src/sync/v2/import/pages/analyticalListPage.js +23 -24
- package/dist/src/sync/v2/import/pages/analyticalListPage.js.map +1 -1
- package/dist/src/sync/v2/import/pages/listReport.d.ts +3 -7
- package/dist/src/sync/v2/import/pages/listReport.js +23 -24
- package/dist/src/sync/v2/import/pages/listReport.js.map +1 -1
- package/dist/src/sync/v2/import/pages/objectPage.d.ts +6 -12
- package/dist/src/sync/v2/import/pages/objectPage.js +293 -154
- package/dist/src/sync/v2/import/pages/objectPage.js.map +1 -1
- package/dist/src/sync/v2/import/pages/overviewPage.d.ts +9 -1
- package/dist/src/sync/v2/import/pages/overviewPage.js +69 -39
- package/dist/src/sync/v2/import/pages/overviewPage.js.map +1 -1
- package/dist/src/sync/v2/import/utils.d.ts +3 -3
- package/dist/src/sync/v2/import/utils.js +5 -5
- package/dist/src/sync/v2/import/utils.js.map +1 -1
- package/dist/src/sync/v2/types.d.ts +32 -0
- package/dist/src/sync/v2/types.js +15 -0
- package/dist/src/sync/v2/types.js.map +1 -1
- package/dist/src/sync/v4/utils/StableIdHelper.d.ts +4 -0
- package/dist/src/sync/v4/utils/StableIdHelper.js +153 -0
- package/dist/src/sync/v4/utils/StableIdHelper.js.map +1 -0
- package/package.json +15 -7
|
@@ -4,18 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const v2_1 = require("../../../../v2");
|
|
7
|
-
const common_1 = require("../../../common");
|
|
8
7
|
const table_1 = require("../controls/table");
|
|
9
8
|
const extensionLogger_1 = require("../../../../extensionLogger");
|
|
10
9
|
const utils_1 = require("../utils");
|
|
11
|
-
const
|
|
10
|
+
const common_1 = require("../../../common");
|
|
12
11
|
const manifest_1 = require("../../export/manifest");
|
|
13
12
|
const sapUiPageV2_1 = require("../.../../../../../specification/v2/webapp/manifest/sapUiPageV2");
|
|
14
13
|
const i18next_1 = __importDefault(require("i18next"));
|
|
15
14
|
const i18n_1 = require("../../../../i18n/i18n");
|
|
16
|
-
const
|
|
15
|
+
const common_2 = require("../../../../specification/common");
|
|
17
16
|
const listReport_1 = require("../pages/listReport");
|
|
18
17
|
const factory_1 = require("../../export/factory");
|
|
18
|
+
const types_1 = require("../../types");
|
|
19
19
|
/**
|
|
20
20
|
* Prepares the list of flex changes
|
|
21
21
|
* @param change - the flex change (UI Adaptation)
|
|
@@ -28,21 +28,21 @@ function prepareFlexChanges(changes, entitySet, logger) {
|
|
|
28
28
|
changes.forEach((changeString) => {
|
|
29
29
|
var _a, _b;
|
|
30
30
|
try {
|
|
31
|
-
const change =
|
|
32
|
-
if (((_a = change.controlId) === null || _a === void 0 ? void 0 : _a.includes(sapUiPageV2_1.FE_TEMPLATE_V2_OBJECT_PAGE)) && ((_b = change.controlId) === null || _b === void 0 ? void 0 : _b.includes(entitySet))) {
|
|
31
|
+
const change = common_1.parseChangeString(changeString);
|
|
32
|
+
if (change && ((_a = change.controlId) === null || _a === void 0 ? void 0 : _a.includes(sapUiPageV2_1.FE_TEMPLATE_V2_OBJECT_PAGE)) && ((_b = change.controlId) === null || _b === void 0 ? void 0 : _b.includes(entitySet))) {
|
|
33
33
|
let selectorId = change.controlId.split('--')[1].replace(/:3a:3a/g, '::');
|
|
34
34
|
const complexIdMatch = new RegExp('.+DataField.+:::sSmartTableId::.+');
|
|
35
35
|
if (complexIdMatch.exec(selectorId) !== null) {
|
|
36
36
|
selectorId = selectorId.split('template:::TableColumn:::')[1];
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const selectorIdParts = selectorId.split(':::');
|
|
39
39
|
let id, facetID;
|
|
40
|
-
if (
|
|
41
|
-
const lastIdParts =
|
|
40
|
+
if (selectorIdParts.length === 1) {
|
|
41
|
+
const lastIdParts = selectorIdParts[0].split('-');
|
|
42
42
|
id = lastIdParts[lastIdParts.length - 1];
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
if (selectorIdParts[0].indexOf("com.sap.vocabularies.UI.v1.LineItem" /* LineItem */) >= 0 ||
|
|
44
|
+
selectorIdParts[0].indexOf('UI.LineItem') >= 0 ||
|
|
45
|
+
selectorIdParts[0].indexOf('::Table') >= 0) {
|
|
46
46
|
facetID = lastIdParts[0]
|
|
47
47
|
.split('::Table')[0]
|
|
48
48
|
.split('::responsiveTable')[0]
|
|
@@ -52,7 +52,6 @@ function prepareFlexChanges(changes, entitySet, logger) {
|
|
|
52
52
|
const idParts = id.split('::');
|
|
53
53
|
if (idParts.length > 1) {
|
|
54
54
|
facetID = idParts[0];
|
|
55
|
-
id = idParts[1];
|
|
56
55
|
}
|
|
57
56
|
else if (lastIdParts[0].indexOf('::') > -1) {
|
|
58
57
|
facetID = lastIdParts[0].split('::')[0];
|
|
@@ -60,22 +59,19 @@ function prepareFlexChanges(changes, entitySet, logger) {
|
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
else if (selectorId.indexOf('sSmartTableId') >= 0) {
|
|
63
|
-
|
|
64
|
-
for (let index = 0; index < idParts.length; index++) {
|
|
65
|
-
const element = idParts[index];
|
|
62
|
+
for (const element of selectorIdParts) {
|
|
66
63
|
if (element.startsWith('sSmartTableId')) {
|
|
67
64
|
facetID = element
|
|
68
65
|
.split('sSmartTableId::')[1]
|
|
69
66
|
.split('::Table')[0]
|
|
70
67
|
.split('/responsiveTable')[0]
|
|
71
|
-
.replace(
|
|
68
|
+
.replace(`::${"com.sap.vocabularies.UI.v1.LineItem" /* LineItem */}`, `/@${"com.sap.vocabularies.UI.v1.LineItem" /* LineItem */}`);
|
|
72
69
|
break;
|
|
73
70
|
}
|
|
74
71
|
}
|
|
75
72
|
}
|
|
76
73
|
else {
|
|
77
|
-
facetID =
|
|
78
|
-
id = idParts[1];
|
|
74
|
+
facetID = selectorIdParts[0];
|
|
79
75
|
}
|
|
80
76
|
selectorId = selectorId
|
|
81
77
|
.replace(/:2f/g, '/')
|
|
@@ -105,51 +101,90 @@ function prepareFlexChanges(changes, entitySet, logger) {
|
|
|
105
101
|
});
|
|
106
102
|
return result;
|
|
107
103
|
}
|
|
104
|
+
const addFlexToConfig = (config, propertyKey, flexChange) => {
|
|
105
|
+
config[propertyKey] = flexChange;
|
|
106
|
+
};
|
|
107
|
+
const getSectionType = (schemaSection) => {
|
|
108
|
+
let reference;
|
|
109
|
+
if (schemaSection['$ref']) {
|
|
110
|
+
reference = schemaSection['$ref'].includes('<') ? schemaSection['$ref'].split('<')[0] : schemaSection['$ref'];
|
|
111
|
+
return reference.replace(common_1.DEFINITION_LINK_PREFIX, '');
|
|
112
|
+
}
|
|
113
|
+
else if (schemaSection['properties']['subsections']['$ref']) {
|
|
114
|
+
reference = schemaSection['properties']['subsections']['$ref'];
|
|
115
|
+
reference = reference.includes('<') ? reference.split('<')[0] : reference;
|
|
116
|
+
return reference.replace(common_1.DEFINITION_LINK_PREFIX, '');
|
|
117
|
+
}
|
|
118
|
+
else if (schemaSection['properties']['subsections']) {
|
|
119
|
+
return types_1.SectionTypeV2.SubSection;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
108
122
|
/**
|
|
109
123
|
* Transfers settings from manifest and flexChanges to object page config
|
|
124
|
+
* @param {ImportObjectPageV2Parameters} importParameters - object comprising all input data
|
|
110
125
|
* @param configPart - part of the configuration to be filled
|
|
111
|
-
* @param manifest - manifest.json of the app
|
|
112
126
|
* @param schemaDefinition - current section of the app specific schema
|
|
113
127
|
* @param pageKeys - list of page keys (comprises the one entry describing the given page)
|
|
114
128
|
* @param flexChanges - list of flex changes (pre-processed by prepareFlexChanges)
|
|
115
129
|
* @param sectionId - ID of the given section (optional)
|
|
116
|
-
* @param sectionTitle - title of the section (
|
|
130
|
+
* @param sectionTitle - title of the section (optional)
|
|
117
131
|
* @param actionId - ID of the given action (optional)
|
|
118
132
|
*/
|
|
119
|
-
function transferSettingsAndFlexChanges(
|
|
133
|
+
function transferSettingsAndFlexChanges(importParameters, configPart, schemaDefinition, pageKeys, flexChanges, sectionId, sectionTitle, actionId) {
|
|
134
|
+
var _a;
|
|
120
135
|
if (!schemaDefinition) {
|
|
121
136
|
return;
|
|
122
137
|
}
|
|
123
138
|
let deprecatedProperties = [];
|
|
124
139
|
let manifestSection = {};
|
|
125
|
-
if (configPart.getDeprecated) {
|
|
140
|
+
if (configPart === null || configPart === void 0 ? void 0 : configPart.getDeprecated) {
|
|
126
141
|
deprecatedProperties = configPart.getDeprecated();
|
|
127
142
|
}
|
|
128
|
-
const unescapedId = sectionId && sectionId.replace(/::@com.sap.vocabularies/g,
|
|
143
|
+
const unescapedId = sectionId && sectionId.replace(/::@com.sap.vocabularies/g, v2_1.VOCWITHSLASH);
|
|
129
144
|
for (const propertyKey in schemaDefinition['properties'] || schemaDefinition) {
|
|
130
|
-
const syncRule =
|
|
145
|
+
const syncRule = common_1.getReflectMetadata(configPart, propertyKey);
|
|
131
146
|
if (syncRule || propertyKey === 'columns') {
|
|
132
147
|
if (propertyKey === 'columns' || (syncRule && syncRule.flex)) {
|
|
133
148
|
if (sectionId) {
|
|
134
149
|
for (const selector in flexChanges) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
flexChanges[selector].facetId === sectionTitle)) {
|
|
142
|
-
table_1.addFlexForTable(configPart, flexChanges[selector], jsonSchema);
|
|
150
|
+
const flexChange = flexChanges[selector];
|
|
151
|
+
const propertyIdMatch = flexChange.propertyId === propertyKey;
|
|
152
|
+
const isTableColumn = propertyKey === 'columns' && flexChange.controlType === common_1.ControlType.TableColumn;
|
|
153
|
+
const facetIds = [sectionId, unescapedId, sectionTitle];
|
|
154
|
+
if ((propertyIdMatch || isTableColumn) && facetIds.indexOf(flexChange === null || flexChange === void 0 ? void 0 : flexChange.facetId) > -1) {
|
|
155
|
+
table_1.addFlexForTable(configPart, flexChanges[selector], importParameters.jsonSchema);
|
|
143
156
|
}
|
|
144
157
|
}
|
|
145
158
|
}
|
|
146
159
|
else {
|
|
147
160
|
for (const selector in flexChanges) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
161
|
+
const flexChange = flexChanges[selector];
|
|
162
|
+
const actionIdMatch = !actionId || new RegExp(`.*${actionId}\\d?$`).test(selector);
|
|
163
|
+
const propertyIdMatch = flexChange.propertyId === propertyKey;
|
|
164
|
+
const schemaControlType = (_a = schemaDefinition['properties'][flexChange.propertyId]) === null || _a === void 0 ? void 0 : _a.controlType;
|
|
165
|
+
const controlTypeMatch = flexChange.controlType === schemaControlType;
|
|
166
|
+
if (!flexChange.facetId && actionIdMatch && propertyIdMatch) {
|
|
167
|
+
addFlexToConfig(configPart, propertyKey, flexChange.newValue);
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
else if (flexChange.facetId === 'action' &&
|
|
171
|
+
!sectionTitle &&
|
|
172
|
+
actionIdMatch &&
|
|
173
|
+
propertyIdMatch) {
|
|
174
|
+
// Actions
|
|
175
|
+
addFlexToConfig(configPart, propertyKey, flexChange.newValue);
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
else if (!sectionTitle && actionIdMatch && propertyIdMatch && controlTypeMatch) {
|
|
179
|
+
addFlexToConfig(configPart, propertyKey, flexChange.newValue);
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
else if (selector.includes(sectionTitle) &&
|
|
183
|
+
actionIdMatch &&
|
|
184
|
+
propertyIdMatch &&
|
|
185
|
+
controlTypeMatch) {
|
|
186
|
+
// Sections
|
|
187
|
+
addFlexToConfig(configPart, propertyKey, flexChange.newValue);
|
|
153
188
|
break;
|
|
154
189
|
}
|
|
155
190
|
}
|
|
@@ -160,7 +195,7 @@ function transferSettingsAndFlexChanges(configPart, manifest, schemaDefinition,
|
|
|
160
195
|
? sectionId.replace(/\/@/g, '::').replace(/@com.sap/g, 'com.sap')
|
|
161
196
|
: undefined;
|
|
162
197
|
const path = syncRule.manifest.path(pageKeys, {}, sectionIdInManifest);
|
|
163
|
-
manifestSection = manifest_1.getManifestSectionByPathV2(manifest, path);
|
|
198
|
+
manifestSection = manifest_1.getManifestSectionByPathV2(importParameters.manifest, path);
|
|
164
199
|
const importHandler = syncRule.manifest.import;
|
|
165
200
|
if (importHandler && typeof importHandler === 'function') {
|
|
166
201
|
const value = importHandler(manifestSection, sectionId);
|
|
@@ -179,9 +214,9 @@ function transferSettingsAndFlexChanges(configPart, manifest, schemaDefinition,
|
|
|
179
214
|
for (const key in manifestSection) {
|
|
180
215
|
const deprecated = deprecatedProperties[key];
|
|
181
216
|
if (deprecated) {
|
|
182
|
-
extensionLogger_1.log(logger, {
|
|
217
|
+
extensionLogger_1.log(importParameters.logger, {
|
|
183
218
|
severity: "warning" /* Warning */,
|
|
184
|
-
message:
|
|
219
|
+
message: common_1.getTextForDeprecated(key, deprecated),
|
|
185
220
|
location: {
|
|
186
221
|
path: 'webapp/manifest.json/',
|
|
187
222
|
range: path.split('/')
|
|
@@ -196,217 +231,321 @@ function transferSettingsAndFlexChanges(configPart, manifest, schemaDefinition,
|
|
|
196
231
|
}
|
|
197
232
|
}
|
|
198
233
|
/**
|
|
199
|
-
* Fills the
|
|
200
|
-
* @param
|
|
201
|
-
* @param
|
|
234
|
+
* Fills the fields of an object page form
|
|
235
|
+
* @param escapedId - current Id for config part
|
|
236
|
+
* @param fieldProperties - current properties' list (of fields)
|
|
202
237
|
* @param configPart - the given part of the object page config
|
|
203
238
|
* @param manifest - manifest.json of the app
|
|
204
239
|
* @param jsonSchema - app specific schema
|
|
240
|
+
* @param {MetadataInstanceInterface} factory - factory, for generating the access to reflect-metadata
|
|
241
|
+
* @param pageKeys - list of page keys (comprises the one entry describing the given page)
|
|
242
|
+
* @param flexChanges - list of flex changes (pre-processed by prepareFlexChanges)
|
|
243
|
+
*/
|
|
244
|
+
function fillFields(importParameters, escapedId, fieldProperties, configPart, factory, pageKeys, flexChanges) {
|
|
245
|
+
let fieldId;
|
|
246
|
+
configPart[escapedId]['form']['fields'] = {};
|
|
247
|
+
for (const fieldProperty in fieldProperties) {
|
|
248
|
+
fieldId = fieldProperty.includes('::')
|
|
249
|
+
? fieldProperty.split('::')[1] + '::GroupElement'
|
|
250
|
+
: fieldProperty + '::GroupElement';
|
|
251
|
+
configPart[escapedId]['form']['fields'][fieldProperty] = factory.createInstance(common_2.PageType.ObjectPage, 'Field');
|
|
252
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedId]['form']['fields'][fieldProperty], importParameters.jsonSchema['definitions']['Field'], pageKeys, flexChanges, undefined, undefined, fieldId);
|
|
253
|
+
if (Object.keys(configPart[escapedId]['form']['fields'][fieldProperty]).length === 0) {
|
|
254
|
+
delete configPart[escapedId]['form']['fields'][fieldProperty];
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (Object.keys(configPart[escapedId]['form']['fields']).length === 0) {
|
|
258
|
+
delete configPart[escapedId]['form']['fields'];
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Fill table settings in config.json
|
|
263
|
+
* @param {ImportObjectPageV2Parameters} importParameters - object comprising all input data
|
|
264
|
+
* @param manifestSettings - object page settings section of the manifest
|
|
265
|
+
* @param flexChanges - list of flex changes (pre-processed by prepareFlexChanges)
|
|
266
|
+
* @param {MetadataInstanceInterface} factory - factory, for generating the access to reflect-metadata
|
|
267
|
+
* @param configPart - the given part of the object page config
|
|
268
|
+
* @param manifest - manifest.json of the app
|
|
269
|
+
* @param pageKeys - list of page keys (comprises the one entry describing the given page)
|
|
270
|
+
* @param logger - Logger class for logging messages
|
|
271
|
+
* @param sectionId - ID of the current section
|
|
272
|
+
* @param sectionType - Section type (Sub/Section Table)
|
|
273
|
+
*/
|
|
274
|
+
function fillTableInConfig(importParameters, manifestSettings, flexChanges, factory, configPart, pageKeys, sectionId, sectionType) {
|
|
275
|
+
const escapedSectionId = sectionId.replace(/\/@/g, '::');
|
|
276
|
+
const schemaSection = importParameters.jsonSchema['definitions'][`${sectionType}<${sectionId}>`];
|
|
277
|
+
const sectionTitle = schemaSection.title ? schemaSection.title.split(v2_1.FacetTitlePrefix)[1] : undefined;
|
|
278
|
+
const manifestKey = escapedSectionId.replace('@com.sap', 'com.sap');
|
|
279
|
+
const manifestSection = manifestSettings && manifestSettings.sections && manifestSettings.sections[manifestKey];
|
|
280
|
+
if (manifestSection || flexChanges) {
|
|
281
|
+
const tableType = manifestSection
|
|
282
|
+
? manifestSection.tableSettings
|
|
283
|
+
? manifestSection.tableSettings.type
|
|
284
|
+
? manifestSection.tableSettings.type
|
|
285
|
+
: 'ResponsiveTable'
|
|
286
|
+
: 'ResponsiveTable'
|
|
287
|
+
: 'ResponsiveTable';
|
|
288
|
+
//Instantiate metadata
|
|
289
|
+
const OPtable = factory.createInstance(common_2.PageType.ObjectPage, `ObjectPage${tableType}`);
|
|
290
|
+
configPart[escapedSectionId] = factory.createInstance(common_2.PageType.ObjectPage, sectionType, { table: {} });
|
|
291
|
+
configPart[escapedSectionId]['table'] = OPtable;
|
|
292
|
+
let localJsonSchema;
|
|
293
|
+
const schemaDefinitions = importParameters.jsonSchema['definitions'];
|
|
294
|
+
if (tableType) {
|
|
295
|
+
localJsonSchema = schemaDefinitions['ObjectPage' + tableType + '<' + escapedSectionId + '>'];
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
localJsonSchema = schemaDefinitions['ObjectPageResponsiveTable<' + escapedSectionId + '>'];
|
|
299
|
+
}
|
|
300
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedSectionId], schemaSection, pageKeys, flexChanges, undefined, sectionTitle);
|
|
301
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedSectionId]['table'], localJsonSchema, pageKeys, flexChanges, sectionId, sectionTitle);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Fills custom columns in a V2 object page config JSON
|
|
306
|
+
* @param appSchema - app specific schema
|
|
307
|
+
* @param escapedSectionId - escaped version of the section ID
|
|
308
|
+
* @param sectionTitle - section title
|
|
309
|
+
* @param configPart - the given part of the object page config
|
|
310
|
+
* @param manifest - manifest.json of the app
|
|
311
|
+
* @param {SapUiAppPageV2} v2Page - v2 page from manifest.
|
|
312
|
+
* @param {FileData[]} fragments - Array with XML fragments.
|
|
313
|
+
*/
|
|
314
|
+
function fillCustomColumnsInConfig(importParameters, escapedSectionId, sectionTitle, configPart, v2Page) {
|
|
315
|
+
const customColumnSchemaProp = importParameters.jsonSchema['definitions'][escapedSectionId].properties.custom;
|
|
316
|
+
const customColumnTarget = customColumnSchemaProp
|
|
317
|
+
? utils_1.getTargetFromCustomColumnRef(customColumnSchemaProp.$ref)
|
|
318
|
+
: undefined;
|
|
319
|
+
if (customColumnTarget) {
|
|
320
|
+
const objectPageSectionData = {
|
|
321
|
+
key: sectionTitle || escapedSectionId.replace('@', ''),
|
|
322
|
+
target: customColumnTarget
|
|
323
|
+
};
|
|
324
|
+
listReport_1.addFragments(configPart[escapedSectionId], importParameters.manifest, v2Page, common_2.PageType.ObjectPage, importParameters.fragments, objectPageSectionData);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Fills the sections and subsections of the object page config (recursive function)
|
|
329
|
+
* @param {ImportObjectPageV2Parameters} importParameters - object comprising all input data
|
|
330
|
+
* @param sectionProperties - current properties' list (of sections or subsections)
|
|
331
|
+
* @param manifestSettings - object page settings section of the manifest
|
|
332
|
+
* @param configPart - the given part of the object page config
|
|
205
333
|
* @param pageKeys - list of page keys (comprises the one entry describing the given page)
|
|
206
334
|
* @param flexChanges - list of flex changes (pre-processed by prepareFlexChanges)
|
|
207
335
|
* @param {SapUiAppPageV2} v2Page - v2 page from manifest.
|
|
208
336
|
* @param {ObjectPageConfig} objectPageConfig - page config object.
|
|
209
|
-
* @param {FileData[]} fragments - Array with XML fragments.
|
|
210
337
|
*/
|
|
211
|
-
function
|
|
212
|
-
|
|
338
|
+
function fillSectionsInConfig(importParameters, sectionProperties, manifestSettings, configPart, factory, pageKeys, flexChanges, v2Page, objectPageConfig) {
|
|
339
|
+
var _a, _b;
|
|
340
|
+
let sectionTitle;
|
|
213
341
|
for (const sectionId in sectionProperties) {
|
|
214
|
-
|
|
342
|
+
const escapedSectionId = sectionId.replace(/\/@/g, '::');
|
|
215
343
|
let schemaSection = sectionProperties[sectionId];
|
|
216
344
|
if (schemaSection['$ref'] &&
|
|
217
|
-
schemaSection
|
|
345
|
+
(getSectionType(schemaSection) === types_1.SectionTypeV2.SectionTable ||
|
|
346
|
+
getSectionType(schemaSection) === types_1.SectionTypeV2.SubSectionTable)) {
|
|
347
|
+
const sectionType = getSectionType(schemaSection);
|
|
348
|
+
fillTableInConfig(importParameters, manifestSettings, flexChanges, factory, configPart, pageKeys, sectionId, sectionType);
|
|
349
|
+
// Custom column ref
|
|
350
|
+
fillCustomColumnsInConfig(importParameters, escapedSectionId, sectionTitle, configPart, v2Page);
|
|
351
|
+
}
|
|
352
|
+
else if (schemaSection['$ref'] &&
|
|
353
|
+
(getSectionType(schemaSection) === types_1.SectionTypeV2.SectionChart ||
|
|
354
|
+
getSectionType(schemaSection) === types_1.SectionTypeV2.SubSectionChart)) {
|
|
218
355
|
// Section without subsections
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const
|
|
356
|
+
const sectionType = getSectionType(schemaSection);
|
|
357
|
+
schemaSection = importParameters.jsonSchema['definitions'][`${sectionType}<${sectionId}>`];
|
|
358
|
+
const sectionTitle = common_1.getSectionTitle(schemaSection, importParameters.jsonSchema);
|
|
359
|
+
const manifestKey = escapedSectionId.replace('@com.sap', 'com.sap');
|
|
222
360
|
const manifestSection = manifestSettings && manifestSettings.sections && manifestSettings.sections[manifestKey];
|
|
361
|
+
configPart[escapedSectionId] = factory.createInstance(common_2.PageType.ObjectPage, sectionType, { chart: {} });
|
|
362
|
+
configPart[escapedSectionId]['chart'] = factory.createInstance(common_2.PageType.ObjectPage, 'ObjectPageChart');
|
|
223
363
|
if (manifestSection || flexChanges) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
? manifestSection.tableSettings.type
|
|
227
|
-
? manifestSection.tableSettings.type
|
|
228
|
-
: 'ResponsiveTable'
|
|
229
|
-
: 'ResponsiveTable'
|
|
230
|
-
: 'ResponsiveTable';
|
|
231
|
-
//Instantiate metadata
|
|
232
|
-
const OPtable = factory.createInstance(common_3.PageType.ObjectPage, 'ObjectPage' + tableType);
|
|
233
|
-
configPart[escapedId] = { table: OPtable };
|
|
234
|
-
let localJsonSchema;
|
|
235
|
-
if (tableType) {
|
|
236
|
-
localJsonSchema = jsonSchema['definitions']['ObjectPage' + tableType + '<' + escapedId + '>'];
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
localJsonSchema = jsonSchema['definitions']['ObjectPageResponsiveTable<' + escapedId + '>'];
|
|
240
|
-
}
|
|
241
|
-
transferSettingsAndFlexChanges(configPart[escapedId]['table'], manifest, localJsonSchema, pageKeys, flexChanges, jsonSchema, logger, sectionId, sectionTitle);
|
|
242
|
-
// Custom column ref
|
|
243
|
-
const customColumnSchemaProp = jsonSchema['definitions'][escapedId].properties.custom;
|
|
244
|
-
const customColumnTarget = customColumnSchemaProp
|
|
245
|
-
? utils_1.getTargetFromCustomColumnRef(customColumnSchemaProp.$ref)
|
|
246
|
-
: undefined;
|
|
247
|
-
if (customColumnTarget) {
|
|
248
|
-
const objectPageSectionData = {
|
|
249
|
-
key: sectionTitle || escapedId.replace('@', ''),
|
|
250
|
-
target: customColumnTarget
|
|
251
|
-
};
|
|
252
|
-
listReport_1.addFragments(configPart[escapedId], manifest, v2Page, common_3.PageType.ObjectPage, fragments, objectPageSectionData);
|
|
253
|
-
}
|
|
364
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedSectionId], schemaSection, pageKeys, flexChanges, undefined, sectionTitle);
|
|
365
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedSectionId]['chart'], importParameters.jsonSchema['definitions']['ObjectPageChart'], pageKeys, flexChanges, sectionId, sectionTitle);
|
|
254
366
|
}
|
|
255
367
|
}
|
|
256
|
-
else if (schemaSection['
|
|
368
|
+
else if (schemaSection['$ref'] &&
|
|
369
|
+
(getSectionType(schemaSection) === types_1.SectionTypeV2.SectionForm ||
|
|
370
|
+
getSectionType(schemaSection) === types_1.SectionTypeV2.SubSectionForm)) {
|
|
371
|
+
const sectionType = getSectionType(schemaSection);
|
|
372
|
+
schemaSection = importParameters.jsonSchema['definitions'][`${sectionType}<${sectionId}>`];
|
|
373
|
+
const sectionTitle = common_1.getSectionTitle(schemaSection, importParameters.jsonSchema);
|
|
374
|
+
const formId = schemaSection['properties']['form']['$ref'].split('SectionForm')[1];
|
|
375
|
+
configPart[escapedSectionId] = factory.createInstance(common_2.PageType.ObjectPage, sectionType, { form: {} });
|
|
376
|
+
if (flexChanges) {
|
|
377
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedSectionId], schemaSection, pageKeys, flexChanges, undefined, sectionTitle);
|
|
378
|
+
}
|
|
379
|
+
const formActions = importParameters.jsonSchema['definitions'][`SectionActions${formId}`];
|
|
380
|
+
if (formActions['properties']) {
|
|
381
|
+
fillActions(importParameters, formActions.properties, configPart[escapedSectionId]['form'], factory, pageKeys, flexChanges, `${escapedSectionId}::FormAction`);
|
|
382
|
+
}
|
|
383
|
+
const formFields = importParameters.jsonSchema['definitions'][`SectionFields${formId}`];
|
|
384
|
+
if (formFields['properties']) {
|
|
385
|
+
fillFields(importParameters, escapedSectionId, formFields.properties, configPart, factory, pageKeys, flexChanges);
|
|
386
|
+
}
|
|
387
|
+
if (Object.keys(configPart[escapedSectionId]['form']).length === 0) {
|
|
388
|
+
delete configPart[escapedSectionId]['form'];
|
|
389
|
+
}
|
|
390
|
+
if (Object.keys(configPart[escapedSectionId]).length === 0) {
|
|
391
|
+
delete configPart[escapedSectionId];
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
else if ((schemaSection['properties'] && schemaSection['properties']['subsections']) ||
|
|
395
|
+
(schemaSection['$ref'] &&
|
|
396
|
+
(getSectionType(schemaSection) === types_1.SectionTypeV2.Section ||
|
|
397
|
+
getSectionType(schemaSection) === types_1.SectionTypeV2.SubSection))) {
|
|
257
398
|
// Section with subsections
|
|
258
|
-
|
|
399
|
+
const sectionType = getSectionType(schemaSection);
|
|
400
|
+
schemaSection = importParameters.jsonSchema['definitions'][`${sectionType}<${sectionId}>`];
|
|
401
|
+
const sectionTitle = common_1.getSectionTitle(schemaSection, importParameters.jsonSchema);
|
|
402
|
+
configPart[escapedSectionId] = factory.createInstance(common_2.PageType.ObjectPage, sectionType, {
|
|
259
403
|
subsections: {}
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
// Section without subsections
|
|
268
|
-
schemaSection = jsonSchema['definitions']['ObjectPageSectionChartV2'];
|
|
269
|
-
sectionTitle = schemaSection.title ? schemaSection.title.split(v2_1.FacetTitlePrefix)[1] : undefined;
|
|
270
|
-
const manifestKey = escapedId.replace('@com.sap', 'com.sap');
|
|
271
|
-
const manifestSection = manifestSettings && manifestSettings.sections && manifestSettings.sections[manifestKey];
|
|
272
|
-
const chartConfig = factory.createInstance(common_3.PageType.ObjectPage, 'ObjectPageChart');
|
|
273
|
-
configPart[escapedId] = { chart: chartConfig };
|
|
274
|
-
if (manifestSection || flexChanges) {
|
|
275
|
-
transferSettingsAndFlexChanges(configPart[escapedId]['chart'], manifest, jsonSchema['definitions']['ObjectPageChart'], pageKeys, flexChanges, jsonSchema, logger, sectionId, sectionTitle);
|
|
404
|
+
});
|
|
405
|
+
if (flexChanges) {
|
|
406
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedSectionId], schemaSection, pageKeys, flexChanges, undefined, sectionTitle);
|
|
407
|
+
}
|
|
408
|
+
let currentSchemaSection;
|
|
409
|
+
if ((_b = (_a = schemaSection['properties']) === null || _a === void 0 ? void 0 : _a['subsections']) === null || _b === void 0 ? void 0 : _b['properties']) {
|
|
410
|
+
currentSchemaSection = schemaSection['properties']['subsections']['properties'];
|
|
276
411
|
}
|
|
412
|
+
else {
|
|
413
|
+
currentSchemaSection = schemaSection['properties'];
|
|
414
|
+
}
|
|
415
|
+
fillSectionsInConfig(importParameters, currentSchemaSection, manifestSettings, configPart[escapedSectionId]['subsections'], factory, pageKeys, flexChanges, v2Page, objectPageConfig);
|
|
277
416
|
}
|
|
278
417
|
}
|
|
279
418
|
}
|
|
280
419
|
/**
|
|
281
420
|
* Fills the action of the configuration
|
|
421
|
+
* @param {ImportObjectPageV2Parameters} importParameters - object comprising all input data
|
|
282
422
|
* @param actionProperties - current properties' list (of action)
|
|
283
423
|
* @param configPart - the given part of the object page config
|
|
284
|
-
* @param
|
|
285
|
-
* @param jsonSchema - app specific schema
|
|
424
|
+
* @param actionInstance - type of action that should be initiated
|
|
286
425
|
* @param {MetadataInstanceInterface} factory - factory, for generating the access to reflect-metadata
|
|
287
426
|
* @param pageKeys - list of page keys (comprises the one entry describing the given page)
|
|
288
427
|
* @param flexChanges - list of flex changes (pre-processed by prepareFlexChanges)
|
|
289
428
|
*/
|
|
290
|
-
function fillActions(actionProperties, configPart,
|
|
291
|
-
let actionId;
|
|
429
|
+
function fillActions(importParameters, actionProperties, configPart, factory, pageKeys, flexChanges, sectionId) {
|
|
430
|
+
let actionId, configActionId;
|
|
292
431
|
configPart['actions'] = {};
|
|
432
|
+
const actionType = sectionId ? 'FormAction' : 'HeaderAction';
|
|
293
433
|
if (flexChanges.constructor === Object && Object.keys(flexChanges).length !== 0) {
|
|
294
434
|
for (const actionProperty in actionProperties) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
435
|
+
configActionId = actionProperty.replace(/@/g, '::');
|
|
436
|
+
actionId = (sectionId ? `${actionProperty}${sectionId}` : actionProperty).replace(/@/g, '::');
|
|
437
|
+
configPart['actions'][configActionId] = factory.createInstance(common_2.PageType.ObjectPage, actionType);
|
|
438
|
+
transferSettingsAndFlexChanges(importParameters, configPart['actions'][configActionId], importParameters.jsonSchema['definitions'][actionType], pageKeys, flexChanges, undefined, undefined, actionId);
|
|
439
|
+
if (sectionId && Object.keys(configPart['actions'][configActionId]).length === 0) {
|
|
440
|
+
delete configPart['actions'][configActionId];
|
|
441
|
+
}
|
|
298
442
|
}
|
|
299
443
|
}
|
|
444
|
+
if (sectionId && Object.keys(configPart['actions']).length === 0) {
|
|
445
|
+
delete configPart['actions'];
|
|
446
|
+
}
|
|
300
447
|
}
|
|
301
448
|
/**
|
|
302
449
|
* Fill properties of object page confg based on manifest settings
|
|
303
|
-
* @param
|
|
304
|
-
* @param manifest - manifest.json of the given app
|
|
305
|
-
* @param jsonSchema - app specific JSON schema
|
|
450
|
+
* @param {ImportObjectPageV2Parameters} importParameters - object comprising all input data
|
|
306
451
|
* @param pageKeys - list of page keys (comprises the one entry describing the given page)
|
|
307
|
-
* @param entitySet - entity set for identifying the given object page
|
|
308
452
|
* @param flexChangesForTransfer - list of flex changes (pre-processed by prepareFlexChanges)
|
|
309
453
|
* @param v2Page - page definition in manifest.json
|
|
310
454
|
* @param {MetadataInstanceInterface} factory - factory, for generating the access to reflect-metadata
|
|
311
|
-
* @
|
|
312
|
-
* @param logger - Logger class for logging messages
|
|
455
|
+
* @returns {ObjectPageConfig} - the object page configuration (JSON)
|
|
313
456
|
*/
|
|
314
|
-
function fillConfig(
|
|
457
|
+
function fillConfig(importParameters, pageKeys, flexChangesForTransfer, v2Page, factory) {
|
|
458
|
+
const objectPageConfig = factory.createPageInstance(common_2.PageType.ObjectPage);
|
|
315
459
|
const manifestSettings = v2Page.component.settings;
|
|
316
460
|
// Transfer page information
|
|
317
|
-
transferSettingsAndFlexChanges(
|
|
461
|
+
transferSettingsAndFlexChanges(importParameters, objectPageConfig, importParameters.jsonSchema['properties'], pageKeys, flexChangesForTransfer);
|
|
318
462
|
// Transfer header information
|
|
319
|
-
objectPageConfig.header = factory.createInstance(
|
|
320
|
-
transferSettingsAndFlexChanges(objectPageConfig.header,
|
|
321
|
-
? jsonSchema['definitions']['ObjectPageHeader']
|
|
322
|
-
: jsonSchema['definitions']['ObjectPageHeader<GenericActions>'], pageKeys, flexChangesForTransfer
|
|
323
|
-
const headerAction = jsonSchema['definitions']['HeaderActions'];
|
|
463
|
+
objectPageConfig.header = factory.createInstance(common_2.PageType.ObjectPage, 'ObjectPageHeader');
|
|
464
|
+
transferSettingsAndFlexChanges(importParameters, objectPageConfig.header, importParameters.jsonSchema['definitions']['ObjectPageHeader']
|
|
465
|
+
? importParameters.jsonSchema['definitions']['ObjectPageHeader']
|
|
466
|
+
: importParameters.jsonSchema['definitions']['ObjectPageHeader<GenericActions>'], pageKeys, flexChangesForTransfer);
|
|
467
|
+
const headerAction = importParameters.jsonSchema['definitions']['HeaderActions'];
|
|
324
468
|
if (headerAction) {
|
|
325
|
-
fillActions(headerAction.properties, objectPageConfig.header,
|
|
469
|
+
fillActions(importParameters, headerAction.properties, objectPageConfig.header, factory, pageKeys, flexChangesForTransfer);
|
|
326
470
|
}
|
|
327
471
|
// Transfer Layout information
|
|
328
|
-
objectPageConfig.layout = factory.createInstance(
|
|
329
|
-
transferSettingsAndFlexChanges(objectPageConfig.layout,
|
|
472
|
+
objectPageConfig.layout = factory.createInstance(common_2.PageType.ObjectPage, 'ObjectPageLayout');
|
|
473
|
+
transferSettingsAndFlexChanges(importParameters, objectPageConfig.layout, importParameters.jsonSchema['definitions']['ObjectPageLayout'], pageKeys, flexChangesForTransfer);
|
|
330
474
|
if (Object.keys(objectPageConfig.layout).length === 0) {
|
|
331
475
|
delete objectPageConfig.layout;
|
|
332
476
|
}
|
|
333
477
|
// Fill sections and subsections
|
|
334
478
|
objectPageConfig.sections = {};
|
|
335
|
-
const sections = jsonSchema['definitions']['Sections'];
|
|
479
|
+
const sections = importParameters.jsonSchema['definitions']['Sections'];
|
|
336
480
|
if (sections) {
|
|
337
|
-
|
|
481
|
+
fillSectionsInConfig(importParameters, sections.properties, manifestSettings, objectPageConfig.sections, factory, pageKeys, flexChangesForTransfer, v2Page, objectPageConfig);
|
|
338
482
|
}
|
|
339
483
|
// Find custom sections
|
|
340
|
-
const customSections = utils_1.findCustomSectionExtensions(manifest, entitySet);
|
|
484
|
+
const customSections = utils_1.findCustomSectionExtensions(importParameters.manifest, importParameters.entitySet);
|
|
341
485
|
if (Object.keys(customSections).length > 0) {
|
|
342
486
|
objectPageConfig.sections.custom = [];
|
|
343
487
|
for (const sectionId in customSections) {
|
|
344
488
|
const customSection = 'fragmentName' in customSections[sectionId]
|
|
345
|
-
? factory.createInstance(
|
|
346
|
-
: factory.createInstance(
|
|
347
|
-
transferSettingsAndFlexChanges(
|
|
489
|
+
? factory.createInstance(common_2.PageType.ObjectPage, 'ObjectPageCustomSectionFragment')
|
|
490
|
+
: factory.createInstance(common_2.PageType.ObjectPage, 'ObjectPageCustomSectionView');
|
|
491
|
+
transferSettingsAndFlexChanges(importParameters, customSection, importParameters.jsonSchema['definitions']['fragmentName' in customSections[sectionId]
|
|
348
492
|
? 'ObjectPageCustomSectionFragment'
|
|
349
|
-
: 'ObjectPageCustomSectionView'], pageKeys, flexChangesForTransfer,
|
|
493
|
+
: 'ObjectPageCustomSectionView'], pageKeys, flexChangesForTransfer, sectionId);
|
|
350
494
|
objectPageConfig.sections.custom.push(customSection);
|
|
351
495
|
}
|
|
352
496
|
}
|
|
497
|
+
return objectPageConfig;
|
|
353
498
|
}
|
|
354
499
|
/**
|
|
355
|
-
*
|
|
356
|
-
* @param {
|
|
357
|
-
*
|
|
358
|
-
* @
|
|
359
|
-
* @param {string} entitySet - current entity set, identifying the given page
|
|
360
|
-
* @param {FileData[]} fragments - list of all extension fragment files and their content
|
|
361
|
-
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
362
|
-
* @returns config - the object page configuration
|
|
500
|
+
* Creates the configuration (file content) for a V2 object page
|
|
501
|
+
* @param {ImportObjectPageV2Parameters} importParameters - object comprising all input data
|
|
502
|
+
*
|
|
503
|
+
* @returns {ObjectPageConfig} - the object page configuration (JSON)
|
|
363
504
|
*/
|
|
364
|
-
function
|
|
505
|
+
function createObjectPageConfigV2(importParameters) {
|
|
365
506
|
// Initialize i18next
|
|
366
507
|
i18n_1.initI18n();
|
|
367
|
-
if (!manifest[
|
|
368
|
-
extensionLogger_1.log(logger, {
|
|
508
|
+
if (!importParameters.manifest[common_2.ManifestSection.generic]) {
|
|
509
|
+
extensionLogger_1.log(importParameters.logger, {
|
|
369
510
|
severity: "error" /* Error */,
|
|
370
511
|
message: i18next_1.default.t('NOFE'),
|
|
371
512
|
location: {
|
|
372
513
|
path: v2_1.MANIFESTPATH,
|
|
373
|
-
range: [
|
|
514
|
+
range: [common_2.ManifestSection.generic]
|
|
374
515
|
}
|
|
375
516
|
});
|
|
376
517
|
return;
|
|
377
518
|
}
|
|
378
519
|
const pageKeys = [];
|
|
379
|
-
const v2Pages = manifest[
|
|
520
|
+
const v2Pages = importParameters.manifest[common_2.ManifestSection.generic].pages;
|
|
380
521
|
if (!v2Pages) {
|
|
381
|
-
extensionLogger_1.log(logger, {
|
|
522
|
+
extensionLogger_1.log(importParameters.logger, {
|
|
382
523
|
severity: "error" /* Error */,
|
|
383
|
-
message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
|
|
524
|
+
message: i18next_1.default.t('NOPAGES', { appId: importParameters.manifest['sap.app']['id'] }),
|
|
384
525
|
location: {
|
|
385
526
|
path: v2_1.MANIFESTPATH,
|
|
386
|
-
range: [
|
|
527
|
+
range: [common_2.ManifestSection.generic]
|
|
387
528
|
}
|
|
388
529
|
});
|
|
389
530
|
return;
|
|
390
531
|
}
|
|
391
|
-
const
|
|
532
|
+
const entitySet = importParameters.entitySet;
|
|
533
|
+
const v2Page = utils_1.findObjectPageV2(v2Pages, importParameters.entitySet, pageKeys);
|
|
392
534
|
if (!v2Page) {
|
|
393
|
-
extensionLogger_1.log(logger, {
|
|
535
|
+
extensionLogger_1.log(importParameters.logger, {
|
|
394
536
|
severity: "error" /* Error */,
|
|
395
537
|
message: i18next_1.default.t('NOENTITYSET', { entitySet }),
|
|
396
538
|
location: {
|
|
397
539
|
path: v2_1.MANIFESTPATH,
|
|
398
|
-
range: [
|
|
540
|
+
range: [common_2.ManifestSection.generic]
|
|
399
541
|
}
|
|
400
542
|
});
|
|
401
543
|
return;
|
|
402
544
|
}
|
|
403
|
-
const flexChangesForTransfer = prepareFlexChanges(flex, entitySet);
|
|
545
|
+
const flexChangesForTransfer = prepareFlexChanges(importParameters.flex, entitySet);
|
|
404
546
|
const factory = new factory_1.MetadataInstanceFactoryV2();
|
|
405
|
-
//Instantiate Page
|
|
406
|
-
const config = factory.createPageInstance(common_3.PageType.ObjectPage);
|
|
407
547
|
//Fill config.json with manifest settings and flex changes
|
|
408
|
-
fillConfig(
|
|
409
|
-
return config;
|
|
548
|
+
return fillConfig(importParameters, pageKeys, flexChangesForTransfer, v2Page, factory);
|
|
410
549
|
}
|
|
411
|
-
exports.
|
|
550
|
+
exports.createObjectPageConfigV2 = createObjectPageConfigV2;
|
|
412
551
|
//# sourceMappingURL=objectPage.js.map
|