@sap/ux-specification 1.90.9 → 1.90.13
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 +99 -24
- 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/documentation/v4/v4-AnalyticalListPage.html +49 -0
- package/dist/documentation/v4/v4-ApplicationV4.html +48 -0
- package/dist/documentation/v4/v4-ListReport.html +49 -0
- package/dist/documentation/v4/v4-ObjectPage.html +49 -0
- package/dist/index-min.js +1 -1
- package/dist/schemas/v2/AnalyticalListPageConfig.json +87 -12
- package/dist/schemas/v2/ApplicationV2.json +6 -0
- package/dist/schemas/v2/ListReportConfig.json +86 -11
- package/dist/schemas/v2/ObjectPageConfig.json +338 -52
- package/dist/schemas/v2/OverviewPageConfig.json +25 -42
- package/dist/schemas/v4/ApplicationV4.json +2 -1
- package/dist/schemas/v4/ObjectPageConfig.json +35 -2
- 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/specification/v4/index-min.js +1 -1
- package/dist/src/api.js +13 -22
- package/dist/src/api.js.map +1 -1
- package/dist/src/apiTypes.d.ts +117 -105
- package/dist/src/extensionLogger.js +7 -2
- package/dist/src/extensionLogger.js.map +1 -1
- package/dist/src/specification/common/page.d.ts +2 -3
- package/dist/src/specification/common/page.js +0 -1
- 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 -10
- 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 +43 -0
- package/dist/src/specification/v2/controls/FormAction.js +20 -0
- package/dist/src/specification/v2/controls/FormAction.js.map +1 -0
- package/dist/src/specification/v2/controls/ObjectPageChart.d.ts +1 -1
- 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 +25 -8
- package/dist/src/specification/v2/controls/ObjectPageSection.js.map +1 -1
- package/dist/src/specification/v2/controls/ObjectPageTable.d.ts +12 -5
- package/dist/src/specification/v2/controls/ObjectPageTable.js.map +1 -1
- package/dist/src/specification/v2/controls/Table.d.ts +4 -3
- 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/specification/v4/ApplicationV4.d.ts +2 -0
- package/dist/src/specification/v4/controls/ObjectPageFooter.d.ts +11 -0
- package/dist/src/specification/v4/controls/ObjectPageFooter.js +3 -0
- package/dist/src/specification/v4/controls/ObjectPageFooter.js.map +1 -0
- package/dist/src/specification/v4/controls/ObjectPageHeader.d.ts +6 -1
- package/dist/src/specification/v4/controls/index.d.ts +1 -0
- package/dist/src/specification/v4/pages/ObjectPageConfig.d.ts +2 -1
- package/dist/src/specification/v4/webapp/manifest/sapUi5.d.ts +2 -1
- package/dist/src/specification/v4/webapp/manifest/sapUi5.js.map +1 -1
- package/dist/src/specification/v4/webapp/manifest/sapUiPageV4.d.ts +1 -0
- package/dist/src/specification/v4/webapp/manifest/sapUiPageV4.js +1 -0
- package/dist/src/specification/v4/webapp/manifest/sapUiPageV4.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 +331 -0
- package/dist/src/sync/common/generate/objectPage.js.map +1 -0
- package/dist/src/sync/common/i18n.json +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 +70 -79
- 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 +17 -5
- 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 +41 -13
- package/dist/src/sync/common/utils.js +291 -198
- 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 +21 -10
- 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/FilterBar.d.ts +1 -2
- package/dist/src/sync/v2/export/controls/FilterBar.js +17 -19
- package/dist/src/sync/v2/export/controls/FilterBar.js.map +1 -1
- package/dist/src/sync/v2/export/controls/FormAction.d.ts +15 -0
- package/dist/src/sync/v2/export/controls/FormAction.js +133 -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/ObjectPageChart.d.ts +4 -1
- package/dist/src/sync/v2/export/controls/ObjectPageChart.js +13 -0
- package/dist/src/sync/v2/export/controls/ObjectPageChart.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 +32 -0
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js +144 -0
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js.map +1 -0
- package/dist/src/sync/v2/export/controls/ObjectPageTable.d.ts +5 -4
- package/dist/src/sync/v2/export/controls/ObjectPageTable.js +19 -7
- package/dist/src/sync/v2/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Table.d.ts +12 -4
- package/dist/src/sync/v2/export/controls/Table.js +105 -57
- 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 +284 -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/ObjectPage.js.map +1 -1
- package/dist/src/sync/v2/export/pages/OverviewPage.d.ts +4 -2
- package/dist/src/sync/v2/export/pages/OverviewPage.js +1 -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 +15 -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 -10
- package/dist/src/sync/v2/generate/listReport.js +24 -30
- 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 +246 -155
- 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 +19 -4
- 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 +26 -27
- package/dist/src/sync/v2/import/pages/listReport.js.map +1 -1
- package/dist/src/sync/v2/import/pages/objectPage.d.ts +3 -10
- package/dist/src/sync/v2/import/pages/objectPage.js +294 -156
- package/dist/src/sync/v2/import/pages/objectPage.js.map +1 -1
- package/dist/src/sync/v2/import/pages/overviewPage.d.ts +2 -1
- package/dist/src/sync/v2/import/pages/overviewPage.js +65 -57
- 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 +33 -0
- package/dist/src/sync/v2/types.js +16 -0
- package/dist/src/sync/v2/types.js.map +1 -1
- package/dist/src/sync/v4/application.js +10 -10
- package/dist/src/sync/v4/application.js.map +1 -1
- package/dist/src/sync/v4/export/controls/ObjectPageTable.js +4 -3
- package/dist/src/sync/v4/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/src/sync/v4/export/controls/Table.js +4 -3
- package/dist/src/sync/v4/export/controls/Table.js.map +1 -1
- package/dist/src/sync/v4/export/export.d.ts +1 -1
- package/dist/src/sync/v4/export/export.js +219 -175
- package/dist/src/sync/v4/export/export.js.map +1 -1
- package/dist/src/sync/v4/export/manifest.js +100 -78
- package/dist/src/sync/v4/export/manifest.js.map +1 -1
- package/dist/src/sync/v4/export/pages/AnalyticalListPage.js +3 -2
- package/dist/src/sync/v4/export/pages/AnalyticalListPage.js.map +1 -1
- package/dist/src/sync/v4/export/types.d.ts +14 -1
- package/dist/src/sync/v4/generate/generate.js +10 -2
- package/dist/src/sync/v4/generate/generate.js.map +1 -1
- package/dist/src/sync/v4/generate/listReport.js +1 -1
- package/dist/src/sync/v4/generate/listReport.js.map +1 -1
- package/dist/src/sync/v4/generate/objectPage.d.ts +3 -6
- package/dist/src/sync/v4/generate/objectPage.js +97 -193
- package/dist/src/sync/v4/generate/objectPage.js.map +1 -1
- package/dist/src/sync/v4/import/app/appProvider.d.ts +1 -1
- package/dist/src/sync/v4/import/app/appProvider.js +131 -52
- package/dist/src/sync/v4/import/app/appProvider.js.map +1 -1
- package/dist/src/sync/v4/import/fragment.js +53 -58
- package/dist/src/sync/v4/import/fragment.js.map +1 -1
- package/dist/src/sync/v4/import/pages/analyticalListPage.d.ts +2 -2
- package/dist/src/sync/v4/import/pages/analyticalListPage.js +6 -6
- package/dist/src/sync/v4/import/pages/analyticalListPage.js.map +1 -1
- package/dist/src/sync/v4/import/pages/listReport.d.ts +5 -7
- package/dist/src/sync/v4/import/pages/listReport.js +21 -23
- package/dist/src/sync/v4/import/pages/listReport.js.map +1 -1
- package/dist/src/sync/v4/import/pages/objectPage.d.ts +3 -5
- package/dist/src/sync/v4/import/pages/objectPage.js +105 -73
- package/dist/src/sync/v4/import/pages/objectPage.js.map +1 -1
- package/dist/src/sync/v4/import/utils.d.ts +11 -9
- package/dist/src/sync/v4/import/utils.js +23 -13
- package/dist/src/sync/v4/import/utils.js.map +1 -1
- package/dist/src/sync/v4/utils/StableIdHelper.js +5 -7
- package/dist/src/sync/v4/utils/StableIdHelper.js.map +1 -1
- package/dist/src/sync/v4/utils/utils.js +3 -2
- package/dist/src/sync/v4/utils/utils.js.map +1 -1
- package/package.json +16 -7
- package/dist/src/sync/v4/import/common/index.d.ts +0 -12
- package/dist/src/sync/v4/import/common/index.js +0 -41
- package/dist/src/sync/v4/import/common/index.js.map +0 -1
|
@@ -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,222 +231,325 @@ 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
|
|
205
241
|
* @param pageKeys - list of page keys (comprises the one entry describing the given page)
|
|
206
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 === 'TreeTable' || tableType === 'AnalyticalTable' || tableType === 'GridTable') {
|
|
295
|
+
localJsonSchema = schemaDefinitions['ObjectPage' + tableType + '<' + escapedSectionId + '>'];
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
if (schemaDefinitions[`ObjectPageResponsiveTableWithMultiSelect<${escapedSectionId}>`] &&
|
|
299
|
+
schemaDefinitions[`ObjectPageResponsiveTableWithInlineDelete<${escapedSectionId}>`]) {
|
|
300
|
+
localJsonSchema = JSON.parse(JSON.stringify(schemaDefinitions[`ObjectPageResponsiveTableWithMultiSelect<${escapedSectionId}>`]));
|
|
301
|
+
localJsonSchema['properties'] = Object.assign(Object.assign({}, localJsonSchema['properties']), schemaDefinitions[`ObjectPageResponsiveTableWithInlineDelete<${escapedSectionId}>`]['properties']);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedSectionId], schemaSection, pageKeys, flexChanges, undefined, sectionTitle);
|
|
305
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedSectionId]['table'], localJsonSchema, pageKeys, flexChanges, sectionId, sectionTitle);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Fills custom columns in a V2 object page config JSON
|
|
310
|
+
* @param appSchema - app specific schema
|
|
311
|
+
* @param escapedSectionId - escaped version of the section ID
|
|
312
|
+
* @param sectionTitle - section title
|
|
313
|
+
* @param configPart - the given part of the object page config
|
|
314
|
+
* @param manifest - manifest.json of the app
|
|
207
315
|
* @param {SapUiAppPageV2} v2Page - v2 page from manifest.
|
|
208
|
-
* @param {ObjectPageConfig} objectPageConfig - page config object.
|
|
209
316
|
* @param {FileData[]} fragments - Array with XML fragments.
|
|
210
317
|
*/
|
|
211
|
-
function
|
|
212
|
-
|
|
318
|
+
function fillCustomColumnsInConfig(importParameters, escapedSectionId, sectionTitle, configPart, v2Page) {
|
|
319
|
+
const customColumnSchemaProp = importParameters.jsonSchema['definitions'][escapedSectionId].properties.custom;
|
|
320
|
+
const customColumnTarget = customColumnSchemaProp
|
|
321
|
+
? utils_1.getTargetFromCustomColumnRef(customColumnSchemaProp.$ref)
|
|
322
|
+
: undefined;
|
|
323
|
+
if (customColumnTarget) {
|
|
324
|
+
const objectPageSectionData = {
|
|
325
|
+
key: sectionTitle || escapedSectionId.replace('@', ''),
|
|
326
|
+
target: customColumnTarget
|
|
327
|
+
};
|
|
328
|
+
listReport_1.addFragments(configPart[escapedSectionId], importParameters.manifest, v2Page, common_2.PageType.ObjectPage, importParameters.fragments, objectPageSectionData);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Fills the sections and subsections of the object page config (recursive function)
|
|
333
|
+
* @param {ImportObjectPageV2Parameters} importParameters - object comprising all input data
|
|
334
|
+
* @param sectionProperties - current properties' list (of sections or subsections)
|
|
335
|
+
* @param manifestSettings - object page settings section of the manifest
|
|
336
|
+
* @param configPart - the given part of the object page config
|
|
337
|
+
* @param pageKeys - list of page keys (comprises the one entry describing the given page)
|
|
338
|
+
* @param flexChanges - list of flex changes (pre-processed by prepareFlexChanges)
|
|
339
|
+
* @param {SapUiAppPageV2} v2Page - v2 page from manifest.
|
|
340
|
+
* @param {ObjectPageConfig} objectPageConfig - page config object.
|
|
341
|
+
*/
|
|
342
|
+
function fillSectionsInConfig(importParameters, sectionProperties, manifestSettings, configPart, factory, pageKeys, flexChanges, v2Page, objectPageConfig) {
|
|
343
|
+
var _a, _b;
|
|
344
|
+
let sectionTitle;
|
|
213
345
|
for (const sectionId in sectionProperties) {
|
|
214
|
-
|
|
346
|
+
const escapedSectionId = sectionId.replace(/\/@/g, '::');
|
|
215
347
|
let schemaSection = sectionProperties[sectionId];
|
|
216
348
|
if (schemaSection['$ref'] &&
|
|
217
|
-
schemaSection
|
|
349
|
+
(getSectionType(schemaSection) === types_1.SectionTypeV2.SectionTable ||
|
|
350
|
+
getSectionType(schemaSection) === types_1.SectionTypeV2.SubSectionTable)) {
|
|
351
|
+
const sectionType = getSectionType(schemaSection);
|
|
352
|
+
fillTableInConfig(importParameters, manifestSettings, flexChanges, factory, configPart, pageKeys, sectionId, sectionType);
|
|
353
|
+
// Custom column ref
|
|
354
|
+
fillCustomColumnsInConfig(importParameters, escapedSectionId, sectionTitle, configPart, v2Page);
|
|
355
|
+
}
|
|
356
|
+
else if (schemaSection['$ref'] &&
|
|
357
|
+
(getSectionType(schemaSection) === types_1.SectionTypeV2.SectionChart ||
|
|
358
|
+
getSectionType(schemaSection) === types_1.SectionTypeV2.SubSectionChart)) {
|
|
218
359
|
// Section without subsections
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const
|
|
360
|
+
const sectionType = getSectionType(schemaSection);
|
|
361
|
+
schemaSection = importParameters.jsonSchema['definitions'][`${sectionType}<${sectionId}>`];
|
|
362
|
+
const sectionTitle = common_1.getSectionTitle(schemaSection, importParameters.jsonSchema);
|
|
363
|
+
const manifestKey = escapedSectionId.replace('@com.sap', 'com.sap');
|
|
222
364
|
const manifestSection = manifestSettings && manifestSettings.sections && manifestSettings.sections[manifestKey];
|
|
365
|
+
configPart[escapedSectionId] = factory.createInstance(common_2.PageType.ObjectPage, sectionType, { chart: {} });
|
|
366
|
+
configPart[escapedSectionId]['chart'] = factory.createInstance(common_2.PageType.ObjectPage, 'ObjectPageChart');
|
|
223
367
|
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 === 'TreeTable' || tableType === 'AnalyticalTable' || tableType === 'GridTable') {
|
|
236
|
-
localJsonSchema = jsonSchema['definitions']['ObjectPage' + tableType + '<' + escapedId + '>'];
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
if (jsonSchema['definitions']['ObjectPageResponsiveTableWithMultiSelect<' + escapedId + '>'] &&
|
|
240
|
-
jsonSchema['definitions']['ObjectPageResponsiveTableWithInlineDelete<' + escapedId + '>']) {
|
|
241
|
-
localJsonSchema = JSON.parse(JSON.stringify(jsonSchema['definitions']['ObjectPageResponsiveTableWithMultiSelect<' + escapedId + '>']));
|
|
242
|
-
localJsonSchema['properties'] = Object.assign(Object.assign({}, localJsonSchema['properties']), jsonSchema['definitions']['ObjectPageResponsiveTableWithInlineDelete<' + escapedId + '>']['properties']);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
transferSettingsAndFlexChanges(configPart[escapedId]['table'], manifest, localJsonSchema, pageKeys, flexChanges, jsonSchema, logger, sectionId, sectionTitle);
|
|
246
|
-
// Custom column ref
|
|
247
|
-
const customColumnSchemaProp = jsonSchema['definitions'][escapedId].properties.custom;
|
|
248
|
-
const customColumnTarget = customColumnSchemaProp
|
|
249
|
-
? utils_1.getTargetFromCustomColumnRef(customColumnSchemaProp.$ref)
|
|
250
|
-
: undefined;
|
|
251
|
-
if (customColumnTarget) {
|
|
252
|
-
const objectPageSectionData = {
|
|
253
|
-
key: sectionTitle || escapedId.replace('@', ''),
|
|
254
|
-
target: customColumnTarget
|
|
255
|
-
};
|
|
256
|
-
listReport_1.addFragments(configPart[escapedId], manifest, v2Page, common_3.PageType.ObjectPage, fragments, objectPageSectionData);
|
|
257
|
-
}
|
|
368
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedSectionId], schemaSection, pageKeys, flexChanges, undefined, sectionTitle);
|
|
369
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedSectionId]['chart'], importParameters.jsonSchema['definitions']['ObjectPageChart'], pageKeys, flexChanges, sectionId, sectionTitle);
|
|
258
370
|
}
|
|
259
371
|
}
|
|
260
|
-
else if (schemaSection['
|
|
372
|
+
else if (schemaSection['$ref'] &&
|
|
373
|
+
(getSectionType(schemaSection) === types_1.SectionTypeV2.SectionForm ||
|
|
374
|
+
getSectionType(schemaSection) === types_1.SectionTypeV2.SubSectionForm)) {
|
|
375
|
+
const sectionType = getSectionType(schemaSection);
|
|
376
|
+
schemaSection = importParameters.jsonSchema['definitions'][`${sectionType}<${sectionId}>`];
|
|
377
|
+
const sectionTitle = common_1.getSectionTitle(schemaSection, importParameters.jsonSchema);
|
|
378
|
+
const formId = schemaSection['properties']['form']['$ref'].split('SectionForm')[1];
|
|
379
|
+
configPart[escapedSectionId] = factory.createInstance(common_2.PageType.ObjectPage, sectionType, { form: {} });
|
|
380
|
+
if (flexChanges) {
|
|
381
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedSectionId], schemaSection, pageKeys, flexChanges, undefined, sectionTitle);
|
|
382
|
+
}
|
|
383
|
+
const formActions = importParameters.jsonSchema['definitions'][`SectionActions${formId}`];
|
|
384
|
+
if (formActions['properties']) {
|
|
385
|
+
fillActions(importParameters, formActions.properties, configPart[escapedSectionId]['form'], factory, pageKeys, flexChanges, `${escapedSectionId}::FormAction`);
|
|
386
|
+
}
|
|
387
|
+
const formFields = importParameters.jsonSchema['definitions'][`SectionFields${formId}`];
|
|
388
|
+
if (formFields['properties']) {
|
|
389
|
+
fillFields(importParameters, escapedSectionId, formFields.properties, configPart, factory, pageKeys, flexChanges);
|
|
390
|
+
}
|
|
391
|
+
if (Object.keys(configPart[escapedSectionId]['form']).length === 0) {
|
|
392
|
+
delete configPart[escapedSectionId]['form'];
|
|
393
|
+
}
|
|
394
|
+
if (Object.keys(configPart[escapedSectionId]).length === 0) {
|
|
395
|
+
delete configPart[escapedSectionId];
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
else if ((schemaSection['properties'] && schemaSection['properties']['subsections']) ||
|
|
399
|
+
(schemaSection['$ref'] &&
|
|
400
|
+
(getSectionType(schemaSection) === types_1.SectionTypeV2.Section ||
|
|
401
|
+
getSectionType(schemaSection) === types_1.SectionTypeV2.SubSection))) {
|
|
261
402
|
// Section with subsections
|
|
262
|
-
|
|
403
|
+
const sectionType = getSectionType(schemaSection);
|
|
404
|
+
schemaSection = importParameters.jsonSchema['definitions'][`${sectionType}<${sectionId}>`];
|
|
405
|
+
const sectionTitle = common_1.getSectionTitle(schemaSection, importParameters.jsonSchema);
|
|
406
|
+
configPart[escapedSectionId] = factory.createInstance(common_2.PageType.ObjectPage, sectionType, {
|
|
263
407
|
subsections: {}
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const manifestKey = escapedId.replace('@com.sap', 'com.sap');
|
|
275
|
-
const manifestSection = manifestSettings && manifestSettings.sections && manifestSettings.sections[manifestKey];
|
|
276
|
-
const chartConfig = factory.createInstance(common_3.PageType.ObjectPage, 'ObjectPageChart');
|
|
277
|
-
configPart[escapedId] = { chart: chartConfig };
|
|
278
|
-
if (manifestSection || flexChanges) {
|
|
279
|
-
transferSettingsAndFlexChanges(configPart[escapedId]['chart'], manifest, jsonSchema['definitions']['ObjectPageChart'], pageKeys, flexChanges, jsonSchema, logger, sectionId, sectionTitle);
|
|
408
|
+
});
|
|
409
|
+
if (flexChanges) {
|
|
410
|
+
transferSettingsAndFlexChanges(importParameters, configPart[escapedSectionId], schemaSection, pageKeys, flexChanges, undefined, sectionTitle);
|
|
411
|
+
}
|
|
412
|
+
let currentSchemaSection;
|
|
413
|
+
if ((_b = (_a = schemaSection['properties']) === null || _a === void 0 ? void 0 : _a['subsections']) === null || _b === void 0 ? void 0 : _b['properties']) {
|
|
414
|
+
currentSchemaSection = schemaSection['properties']['subsections']['properties'];
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
currentSchemaSection = schemaSection['properties'];
|
|
280
418
|
}
|
|
419
|
+
fillSectionsInConfig(importParameters, currentSchemaSection, manifestSettings, configPart[escapedSectionId]['subsections'], factory, pageKeys, flexChanges, v2Page, objectPageConfig);
|
|
281
420
|
}
|
|
282
421
|
}
|
|
283
422
|
}
|
|
284
423
|
/**
|
|
285
424
|
* Fills the action of the configuration
|
|
425
|
+
* @param {ImportObjectPageV2Parameters} importParameters - object comprising all input data
|
|
286
426
|
* @param actionProperties - current properties' list (of action)
|
|
287
427
|
* @param configPart - the given part of the object page config
|
|
288
|
-
* @param
|
|
289
|
-
* @param jsonSchema - app specific schema
|
|
428
|
+
* @param actionInstance - type of action that should be initiated
|
|
290
429
|
* @param {MetadataInstanceInterface} factory - factory, for generating the access to reflect-metadata
|
|
291
430
|
* @param pageKeys - list of page keys (comprises the one entry describing the given page)
|
|
292
431
|
* @param flexChanges - list of flex changes (pre-processed by prepareFlexChanges)
|
|
293
432
|
*/
|
|
294
|
-
function fillActions(actionProperties, configPart,
|
|
295
|
-
let actionId;
|
|
433
|
+
function fillActions(importParameters, actionProperties, configPart, factory, pageKeys, flexChanges, sectionId) {
|
|
434
|
+
let actionId, configActionId;
|
|
296
435
|
configPart['actions'] = {};
|
|
436
|
+
const actionType = sectionId ? 'FormAction' : 'HeaderAction';
|
|
297
437
|
if (flexChanges.constructor === Object && Object.keys(flexChanges).length !== 0) {
|
|
298
438
|
for (const actionProperty in actionProperties) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
439
|
+
configActionId = actionProperty.replace(/@/g, '::');
|
|
440
|
+
actionId = (sectionId ? `${actionProperty}${sectionId}` : actionProperty).replace(/@/g, '::');
|
|
441
|
+
configPart['actions'][configActionId] = factory.createInstance(common_2.PageType.ObjectPage, actionType);
|
|
442
|
+
transferSettingsAndFlexChanges(importParameters, configPart['actions'][configActionId], importParameters.jsonSchema['definitions'][actionType], pageKeys, flexChanges, undefined, undefined, actionId);
|
|
443
|
+
if (sectionId && Object.keys(configPart['actions'][configActionId]).length === 0) {
|
|
444
|
+
delete configPart['actions'][configActionId];
|
|
445
|
+
}
|
|
302
446
|
}
|
|
303
447
|
}
|
|
448
|
+
if (sectionId && Object.keys(configPart['actions']).length === 0) {
|
|
449
|
+
delete configPart['actions'];
|
|
450
|
+
}
|
|
304
451
|
}
|
|
305
452
|
/**
|
|
306
453
|
* Fill properties of object page confg based on manifest settings
|
|
307
|
-
* @param
|
|
308
|
-
* @param manifest - manifest.json of the given app
|
|
309
|
-
* @param jsonSchema - app specific JSON schema
|
|
454
|
+
* @param {ImportObjectPageV2Parameters} importParameters - object comprising all input data
|
|
310
455
|
* @param pageKeys - list of page keys (comprises the one entry describing the given page)
|
|
311
|
-
* @param entitySet - entity set for identifying the given object page
|
|
312
456
|
* @param flexChangesForTransfer - list of flex changes (pre-processed by prepareFlexChanges)
|
|
313
457
|
* @param v2Page - page definition in manifest.json
|
|
314
458
|
* @param {MetadataInstanceInterface} factory - factory, for generating the access to reflect-metadata
|
|
315
|
-
* @
|
|
316
|
-
* @param logger - Logger class for logging messages
|
|
459
|
+
* @returns {ObjectPageConfig} - the object page configuration (JSON)
|
|
317
460
|
*/
|
|
318
|
-
function fillConfig(
|
|
461
|
+
function fillConfig(importParameters, pageKeys, flexChangesForTransfer, v2Page, factory) {
|
|
462
|
+
const objectPageConfig = factory.createPageInstance(common_2.PageType.ObjectPage);
|
|
319
463
|
const manifestSettings = v2Page.component.settings;
|
|
320
464
|
// Transfer page information
|
|
321
|
-
transferSettingsAndFlexChanges(
|
|
465
|
+
transferSettingsAndFlexChanges(importParameters, objectPageConfig, importParameters.jsonSchema['properties'], pageKeys, flexChangesForTransfer);
|
|
322
466
|
// Transfer header information
|
|
323
|
-
objectPageConfig.header = factory.createInstance(
|
|
324
|
-
transferSettingsAndFlexChanges(objectPageConfig.header,
|
|
325
|
-
? jsonSchema['definitions']['ObjectPageHeader']
|
|
326
|
-
: jsonSchema['definitions']['ObjectPageHeader<GenericActions>'], pageKeys, flexChangesForTransfer
|
|
327
|
-
const headerAction = jsonSchema['definitions']['HeaderActions'];
|
|
467
|
+
objectPageConfig.header = factory.createInstance(common_2.PageType.ObjectPage, 'ObjectPageHeader');
|
|
468
|
+
transferSettingsAndFlexChanges(importParameters, objectPageConfig.header, importParameters.jsonSchema['definitions']['ObjectPageHeader']
|
|
469
|
+
? importParameters.jsonSchema['definitions']['ObjectPageHeader']
|
|
470
|
+
: importParameters.jsonSchema['definitions']['ObjectPageHeader<GenericActions>'], pageKeys, flexChangesForTransfer);
|
|
471
|
+
const headerAction = importParameters.jsonSchema['definitions']['HeaderActions'];
|
|
328
472
|
if (headerAction) {
|
|
329
|
-
fillActions(headerAction.properties, objectPageConfig.header,
|
|
473
|
+
fillActions(importParameters, headerAction.properties, objectPageConfig.header, factory, pageKeys, flexChangesForTransfer);
|
|
330
474
|
}
|
|
331
475
|
// Transfer Layout information
|
|
332
|
-
objectPageConfig.layout = factory.createInstance(
|
|
333
|
-
transferSettingsAndFlexChanges(objectPageConfig.layout,
|
|
476
|
+
objectPageConfig.layout = factory.createInstance(common_2.PageType.ObjectPage, 'ObjectPageLayout');
|
|
477
|
+
transferSettingsAndFlexChanges(importParameters, objectPageConfig.layout, importParameters.jsonSchema['definitions']['ObjectPageLayout'], pageKeys, flexChangesForTransfer);
|
|
334
478
|
if (Object.keys(objectPageConfig.layout).length === 0) {
|
|
335
479
|
delete objectPageConfig.layout;
|
|
336
480
|
}
|
|
337
481
|
// Fill sections and subsections
|
|
338
482
|
objectPageConfig.sections = {};
|
|
339
|
-
const sections = jsonSchema['definitions']['Sections'];
|
|
483
|
+
const sections = importParameters.jsonSchema['definitions']['Sections'];
|
|
340
484
|
if (sections) {
|
|
341
|
-
|
|
485
|
+
fillSectionsInConfig(importParameters, sections.properties, manifestSettings, objectPageConfig.sections, factory, pageKeys, flexChangesForTransfer, v2Page, objectPageConfig);
|
|
342
486
|
}
|
|
343
487
|
// Find custom sections
|
|
344
|
-
const customSections = utils_1.findCustomSectionExtensions(manifest, entitySet);
|
|
488
|
+
const customSections = utils_1.findCustomSectionExtensions(importParameters.manifest, importParameters.entitySet);
|
|
345
489
|
if (Object.keys(customSections).length > 0) {
|
|
346
490
|
objectPageConfig.sections.custom = [];
|
|
347
491
|
for (const sectionId in customSections) {
|
|
348
492
|
const customSection = 'fragmentName' in customSections[sectionId]
|
|
349
|
-
? factory.createInstance(
|
|
350
|
-
: factory.createInstance(
|
|
351
|
-
transferSettingsAndFlexChanges(
|
|
493
|
+
? factory.createInstance(common_2.PageType.ObjectPage, 'ObjectPageCustomSectionFragment')
|
|
494
|
+
: factory.createInstance(common_2.PageType.ObjectPage, 'ObjectPageCustomSectionView');
|
|
495
|
+
transferSettingsAndFlexChanges(importParameters, customSection, importParameters.jsonSchema['definitions']['fragmentName' in customSections[sectionId]
|
|
352
496
|
? 'ObjectPageCustomSectionFragment'
|
|
353
|
-
: 'ObjectPageCustomSectionView'], pageKeys, flexChangesForTransfer,
|
|
497
|
+
: 'ObjectPageCustomSectionView'], pageKeys, flexChangesForTransfer, sectionId);
|
|
354
498
|
objectPageConfig.sections.custom.push(customSection);
|
|
355
499
|
}
|
|
356
500
|
}
|
|
501
|
+
return objectPageConfig;
|
|
357
502
|
}
|
|
358
503
|
/**
|
|
359
504
|
* Creates the configuration (file content) for a V2 object page
|
|
360
|
-
* @param {
|
|
361
|
-
* @param {string[]} flex - list of flex changes (from UI adaptatin)
|
|
362
|
-
* @param {object} jsonSchema - app specific JSON schema
|
|
363
|
-
* @param {string} entitySet - current entity set, identifying the given page
|
|
364
|
-
* @param {FileData[]} fragments - list of all extension fragment files and their content
|
|
365
|
-
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
505
|
+
* @param {ImportObjectPageV2Parameters} importParameters - object comprising all input data
|
|
366
506
|
*
|
|
367
507
|
* @returns {ObjectPageConfig} - the object page configuration (JSON)
|
|
368
508
|
*/
|
|
369
|
-
function
|
|
509
|
+
function createObjectPageConfigV2(importParameters) {
|
|
370
510
|
// Initialize i18next
|
|
371
511
|
i18n_1.initI18n();
|
|
372
|
-
if (!manifest[
|
|
373
|
-
extensionLogger_1.log(logger, {
|
|
512
|
+
if (!importParameters.manifest[common_2.ManifestSection.generic]) {
|
|
513
|
+
extensionLogger_1.log(importParameters.logger, {
|
|
374
514
|
severity: "error" /* Error */,
|
|
375
515
|
message: i18next_1.default.t('NOFE'),
|
|
376
516
|
location: {
|
|
377
517
|
path: v2_1.MANIFESTPATH,
|
|
378
|
-
range: [
|
|
518
|
+
range: [common_2.ManifestSection.generic]
|
|
379
519
|
}
|
|
380
520
|
});
|
|
381
521
|
return;
|
|
382
522
|
}
|
|
383
523
|
const pageKeys = [];
|
|
384
|
-
const v2Pages = manifest[
|
|
524
|
+
const v2Pages = importParameters.manifest[common_2.ManifestSection.generic].pages;
|
|
385
525
|
if (!v2Pages) {
|
|
386
|
-
extensionLogger_1.log(logger, {
|
|
526
|
+
extensionLogger_1.log(importParameters.logger, {
|
|
387
527
|
severity: "error" /* Error */,
|
|
388
|
-
message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
|
|
528
|
+
message: i18next_1.default.t('NOPAGES', { appId: importParameters.manifest['sap.app']['id'] }),
|
|
389
529
|
location: {
|
|
390
530
|
path: v2_1.MANIFESTPATH,
|
|
391
|
-
range: [
|
|
531
|
+
range: [common_2.ManifestSection.generic]
|
|
392
532
|
}
|
|
393
533
|
});
|
|
394
534
|
return;
|
|
395
535
|
}
|
|
396
|
-
const
|
|
536
|
+
const entitySet = importParameters.entitySet;
|
|
537
|
+
const v2Page = utils_1.findObjectPageV2(v2Pages, importParameters.entitySet, pageKeys);
|
|
397
538
|
if (!v2Page) {
|
|
398
|
-
extensionLogger_1.log(logger, {
|
|
539
|
+
extensionLogger_1.log(importParameters.logger, {
|
|
399
540
|
severity: "error" /* Error */,
|
|
400
541
|
message: i18next_1.default.t('NOENTITYSET', { entitySet }),
|
|
401
542
|
location: {
|
|
402
543
|
path: v2_1.MANIFESTPATH,
|
|
403
|
-
range: [
|
|
544
|
+
range: [common_2.ManifestSection.generic]
|
|
404
545
|
}
|
|
405
546
|
});
|
|
406
547
|
return;
|
|
407
548
|
}
|
|
408
|
-
const flexChangesForTransfer = prepareFlexChanges(flex, entitySet);
|
|
549
|
+
const flexChangesForTransfer = prepareFlexChanges(importParameters.flex, entitySet);
|
|
409
550
|
const factory = new factory_1.MetadataInstanceFactoryV2();
|
|
410
|
-
//Instantiate Page
|
|
411
|
-
const config = factory.createPageInstance(common_3.PageType.ObjectPage);
|
|
412
551
|
//Fill config.json with manifest settings and flex changes
|
|
413
|
-
fillConfig(
|
|
414
|
-
return config;
|
|
552
|
+
return fillConfig(importParameters, pageKeys, flexChangesForTransfer, v2Page, factory);
|
|
415
553
|
}
|
|
416
|
-
exports.
|
|
554
|
+
exports.createObjectPageConfigV2 = createObjectPageConfigV2;
|
|
417
555
|
//# sourceMappingURL=objectPage.js.map
|