@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
|
@@ -3,9 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const ajv_1 = __importDefault(require("ajv"));
|
|
8
|
-
const lodash_unset_1 = __importDefault(require("lodash.unset"));
|
|
6
|
+
// Note: the main functions or entry points reside in ./exportPage.ts
|
|
9
7
|
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
10
8
|
const controls_1 = require("./controls");
|
|
11
9
|
const common_1 = require("../../common");
|
|
@@ -13,17 +11,6 @@ const v2_1 = require("../../../v2");
|
|
|
13
11
|
const application_1 = require("../application");
|
|
14
12
|
const manifest_1 = require("./manifest");
|
|
15
13
|
const utils_1 = require("../import/utils");
|
|
16
|
-
const i18next_1 = __importDefault(require("i18next"));
|
|
17
|
-
/**
|
|
18
|
-
* Returns a fresh export results object with default values
|
|
19
|
-
*/
|
|
20
|
-
const getDefaultExportResult = (fragmentFiles) => ({
|
|
21
|
-
flexChanges: [],
|
|
22
|
-
manifest: {
|
|
23
|
-
'sap.ui.generic.app': { pages: {} }
|
|
24
|
-
},
|
|
25
|
-
fragments: fragmentFiles ? fragmentFiles : []
|
|
26
|
-
});
|
|
27
14
|
/**
|
|
28
15
|
* Create missing card from the manifest
|
|
29
16
|
* @param key - card name
|
|
@@ -59,22 +46,25 @@ function findAvailableId(sectionIds, candidateId) {
|
|
|
59
46
|
/**
|
|
60
47
|
* Private recursive function that traverses the content of the current object. It reads decorators and fills manifest entries and flex changes
|
|
61
48
|
* @param configObject - current object to traverse
|
|
62
|
-
* @param manifest - app descriptor (manifest.json)
|
|
63
49
|
* @param exportResults - object with all collected manifest entries and flex changes
|
|
64
50
|
* @param jsonSchema - application specific schema
|
|
65
51
|
* @param targetDefinition - the current entry point or definition in the app schema
|
|
52
|
+
* @param {MetadataInstanceInterface} factory - factory for creating metadata instances
|
|
66
53
|
* @param pathHierarchy - elements of the path indicating the hierarchical level
|
|
67
54
|
*/
|
|
68
|
-
function transferManifestEntriesOVP(configObject,
|
|
55
|
+
function transferManifestEntriesOVP(configObject, exportResults, jsonSchema, targetDefinition, factory, pathHierarchy) {
|
|
69
56
|
if (targetDefinition) {
|
|
70
57
|
if (targetDefinition['properties']) {
|
|
71
|
-
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
59
|
+
processProperties(configObject, exportResults, jsonSchema, targetDefinition['properties'], factory, pathHierarchy);
|
|
72
60
|
}
|
|
73
61
|
else if (targetDefinition['additionalProperties']) {
|
|
74
|
-
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
63
|
+
processProperties(configObject, exportResults, jsonSchema, targetDefinition['additionalProperties'], factory, pathHierarchy);
|
|
75
64
|
}
|
|
76
65
|
}
|
|
77
66
|
}
|
|
67
|
+
exports.transferManifestEntriesOVP = transferManifestEntriesOVP;
|
|
78
68
|
/**
|
|
79
69
|
* Assign sync rules to {currentObject}
|
|
80
70
|
*
|
|
@@ -86,16 +76,102 @@ function assignReflectMetadataRules(factory, structureName, currentObject, defau
|
|
|
86
76
|
return factory.createInstance(v2_1.PageType.OverviewPage, defaultTypeName, currentObject, structureName);
|
|
87
77
|
}
|
|
88
78
|
exports.assignReflectMetadataRules = assignReflectMetadataRules;
|
|
79
|
+
function processAnyOfDefinitionsOfOVP(pathHierarchy, propertyList, jsonSchema, currentObject, configObject, factory, exportResults) {
|
|
80
|
+
pathHierarchy.pop();
|
|
81
|
+
let newConfigObject = currentObject;
|
|
82
|
+
for (const anyOfKey in propertyList['anyOf']) {
|
|
83
|
+
if (propertyList['anyOf'][anyOfKey].$ref) {
|
|
84
|
+
const definitionArray = propertyList['anyOf'][anyOfKey].$ref.split(common_1.DEFINITION_LINK_PREFIX);
|
|
85
|
+
const nextTargetDefinition = jsonSchema['definitions'][definitionArray[definitionArray.length - 1]];
|
|
86
|
+
const cardSettingsType = pathHierarchy[1];
|
|
87
|
+
currentObject = configObject[cardSettingsType];
|
|
88
|
+
newConfigObject = assignReflectMetadataRules(factory, cardSettingsType, currentObject, 'CustomCard');
|
|
89
|
+
transferManifestEntriesOVP(newConfigObject, exportResults, jsonSchema, nextTargetDefinition, factory, [
|
|
90
|
+
...pathHierarchy
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
93
|
+
else if (typeof propertyList['anyOf'][anyOfKey] === 'object') {
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
95
|
+
processProperties(configObject, exportResults, jsonSchema, propertyList['anyOf'][anyOfKey].properties, factory, [...pathHierarchy, 'anyOfObject']);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return newConfigObject;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Transfer manifest settings from config to manifest
|
|
102
|
+
* @param syncRule
|
|
103
|
+
* @param pathHierarchy
|
|
104
|
+
* @param key
|
|
105
|
+
* @param exportResults
|
|
106
|
+
* @param currentObject
|
|
107
|
+
* @param configObject
|
|
108
|
+
* @param exceptionList
|
|
109
|
+
*/
|
|
110
|
+
function transferToManifest(syncRule, pathHierarchy, key, exportResults, currentObject, configObject, exceptionList) {
|
|
111
|
+
const path = syncRule.manifest.path([...pathHierarchy, key]);
|
|
112
|
+
const manifestSection = manifest_1.getManifestSectionByPathV2(exportResults.manifest, path);
|
|
113
|
+
if (key in v2_1.CardSettingsType || key === 'settings') {
|
|
114
|
+
manifestSection['settings'] = deepmerge_1.default(manifestSection['settings'] || {}, currentObject || {}, {
|
|
115
|
+
arrayMerge: common_1.arrayCombineMerge
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
else if (currentObject !== undefined) {
|
|
119
|
+
const exportHandler = syncRule.manifest.export;
|
|
120
|
+
if (exportHandler !== false) {
|
|
121
|
+
if (exportHandler && typeof exportHandler === 'function') {
|
|
122
|
+
exportHandler(manifestSection, configObject, key);
|
|
123
|
+
}
|
|
124
|
+
else if (typeof currentObject === 'object' && !exceptionList.includes(key)) {
|
|
125
|
+
// colorPalette is an exception as it can contain anything as per our schema, so just replace the object
|
|
126
|
+
manifestSection[key] = deepmerge_1.default(manifestSection[key] || {}, currentObject || {}, {
|
|
127
|
+
arrayMerge: common_1.arrayCombineMerge
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
manifestSection[key] = currentObject;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else if (manifestSection[key] !== undefined) {
|
|
136
|
+
delete manifestSection[key];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function transferCards(currentObject, jsonSchema, factory, exportResults) {
|
|
140
|
+
Object.keys(currentObject).forEach((cardKey) => {
|
|
141
|
+
const cardType = currentObject[cardKey].template;
|
|
142
|
+
//Determine target defintion
|
|
143
|
+
let targetDefinition;
|
|
144
|
+
if (!Object.values(v2_1.CardTemplateType).includes(cardType)) {
|
|
145
|
+
targetDefinition = ['CustomCard'];
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
targetDefinition = Object.keys(jsonSchema['definitions']).filter((definition) => {
|
|
149
|
+
var _a, _b, _c;
|
|
150
|
+
return ((_c = (_b = (_a = jsonSchema['definitions'][definition].properties) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.enum) === null || _c === void 0 ? void 0 : _c.indexOf(currentObject[cardKey].template)) > -1;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
//Get metadata
|
|
154
|
+
currentObject[cardKey] = assignReflectMetadataRules(factory, targetDefinition[0], currentObject[cardKey], 'CustomCard');
|
|
155
|
+
createCard(cardKey, exportResults['manifest'][v2_1.ManifestSection.ovp]);
|
|
156
|
+
transferManifestEntriesOVP(currentObject[cardKey], exportResults, jsonSchema, jsonSchema['definitions'][targetDefinition[0]], factory, [cardKey]);
|
|
157
|
+
});
|
|
158
|
+
//check for deletions:
|
|
159
|
+
Object.keys(exportResults.manifest[v2_1.ManifestSection.ovp].cards).forEach((manifestCard) => {
|
|
160
|
+
if (!currentObject[manifestCard]) {
|
|
161
|
+
delete exportResults.manifest[v2_1.ManifestSection.ovp].cards[manifestCard];
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
89
165
|
/**
|
|
90
166
|
* Recursive function that transfers the content of a list of properties of a configuration to the overall exportResults
|
|
91
167
|
* @param configObject - the given part of the configuration
|
|
92
|
-
* @param manifest - manifest.json of the app
|
|
93
168
|
* @param exportResults - overall result list, to be updated
|
|
94
169
|
* @param jsonSchema - app-specific JSOn schema
|
|
95
170
|
* @param propertyList - current property list of the config (properties or additional properties)
|
|
171
|
+
* @param {MetadataInstanceInterface} factory - factory for creating metadata instances
|
|
96
172
|
* @param pathHierarchy - elements of the path indicating the hierarchical level
|
|
97
173
|
*/
|
|
98
|
-
function processProperties(configObject,
|
|
174
|
+
function processProperties(configObject, exportResults, jsonSchema, propertyList, factory, pathHierarchy) {
|
|
99
175
|
let currentObject;
|
|
100
176
|
let isAnyOfObject = false;
|
|
101
177
|
let isObjectProperty = false;
|
|
@@ -120,142 +196,162 @@ function processProperties(configObject, manifest, exportResults, jsonSchema, pr
|
|
|
120
196
|
syncRule = common_1.getReflectMetadata(configObject, pathHierarchy[pathHierarchy.length - 1]);
|
|
121
197
|
}
|
|
122
198
|
if (pathHierarchy[pathHierarchy.length - 1] === 'anyOf') {
|
|
123
|
-
pathHierarchy
|
|
124
|
-
for (const key in propertyList['anyOf']) {
|
|
125
|
-
if (propertyList['anyOf'][key].$ref) {
|
|
126
|
-
const definitionArray = propertyList['anyOf'][key].$ref.split('#/definitions/');
|
|
127
|
-
const nextTargetDefinition = jsonSchema['definitions'][definitionArray[definitionArray.length - 1]];
|
|
128
|
-
const cardSettingsType = pathHierarchy[1];
|
|
129
|
-
currentObject = configObject[cardSettingsType];
|
|
130
|
-
currentObject = assignReflectMetadataRules(factory, cardSettingsType, currentObject, 'CustomCard');
|
|
131
|
-
transferManifestEntriesOVP(currentObject, manifest, exportResults, jsonSchema, nextTargetDefinition, factory, [...pathHierarchy]);
|
|
132
|
-
}
|
|
133
|
-
else if (typeof propertyList['anyOf'][key] === 'object') {
|
|
134
|
-
processProperties(configObject, manifest, exportResults, jsonSchema, propertyList['anyOf'][key].properties, factory, [...pathHierarchy, 'anyOfObject']);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
199
|
+
currentObject = processAnyOfDefinitionsOfOVP(pathHierarchy, propertyList, jsonSchema, currentObject, configObject, factory, exportResults);
|
|
137
200
|
}
|
|
138
|
-
if (syncRule) {
|
|
139
|
-
|
|
140
|
-
const path = syncRule.manifest.path([...pathHierarchy, key]);
|
|
141
|
-
const manifestSection = manifest_1.getManifestSectionByPathV2(exportResults.manifest, path);
|
|
142
|
-
if (key in v2_1.CardSettingsType || key === 'settings') {
|
|
143
|
-
manifestSection['settings'] = deepmerge_1.default(manifestSection['settings'] || {}, currentObject || {}, {
|
|
144
|
-
arrayMerge: common_1.arrayCombineMerge
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
else if (currentObject !== undefined) {
|
|
148
|
-
const exportHandler = syncRule.manifest.export;
|
|
149
|
-
if (exportHandler !== false) {
|
|
150
|
-
if (exportHandler && typeof exportHandler === 'function') {
|
|
151
|
-
exportHandler(manifestSection, configObject, key);
|
|
152
|
-
}
|
|
153
|
-
else if (typeof currentObject === 'object' && !exceptionList.includes(key)) {
|
|
154
|
-
// colorPalette is an exception as it can contain anything as per our schema, so just replace the object
|
|
155
|
-
manifestSection[key] = deepmerge_1.default(manifestSection[key] || {}, currentObject || {}, {
|
|
156
|
-
arrayMerge: common_1.arrayCombineMerge
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
manifestSection[key] = currentObject;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
else if (manifestSection[key] !== undefined) {
|
|
165
|
-
delete manifestSection[key];
|
|
166
|
-
}
|
|
167
|
-
}
|
|
201
|
+
if (syncRule === null || syncRule === void 0 ? void 0 : syncRule.manifest) {
|
|
202
|
+
transferToManifest(syncRule, pathHierarchy, key, exportResults, currentObject, configObject, exceptionList);
|
|
168
203
|
}
|
|
169
204
|
if (currentObject && typeof currentObject === 'object' && propertyList[key]) {
|
|
170
205
|
if (key === 'cards') {
|
|
171
206
|
//inserts and updates:
|
|
172
|
-
|
|
173
|
-
const cardType = currentObject[cardKey].template;
|
|
174
|
-
//Determine target defintion
|
|
175
|
-
let targetDefinition;
|
|
176
|
-
if (!Object.values(v2_1.CardTemplateType).includes(cardType)) {
|
|
177
|
-
targetDefinition = ['CustomCard'];
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
targetDefinition = Object.keys(jsonSchema['definitions']).filter((definition) => {
|
|
181
|
-
var _a, _b, _c;
|
|
182
|
-
return ((_c = (_b = (_a = jsonSchema['definitions'][definition].properties) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.enum) === null || _c === void 0 ? void 0 : _c.indexOf(currentObject[cardKey].template)) > -1;
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
//Get metadata
|
|
186
|
-
currentObject[cardKey] = assignReflectMetadataRules(factory, targetDefinition[0], currentObject[cardKey], 'CustomCard');
|
|
187
|
-
createCard(cardKey, exportResults['manifest'][v2_1.ManifestSection.ovp]);
|
|
188
|
-
transferManifestEntriesOVP(currentObject[cardKey], manifest, exportResults, jsonSchema, jsonSchema['definitions'][targetDefinition[0]], factory, [cardKey]);
|
|
189
|
-
});
|
|
190
|
-
//check for deletions:
|
|
191
|
-
Object.keys(manifest[v2_1.ManifestSection.ovp].cards).forEach((manifestCard) => {
|
|
192
|
-
if (!currentObject[manifestCard]) {
|
|
193
|
-
delete exportResults.manifest[v2_1.ManifestSection.ovp].cards[manifestCard];
|
|
194
|
-
}
|
|
195
|
-
});
|
|
207
|
+
transferCards(currentObject, jsonSchema, factory, exportResults);
|
|
196
208
|
}
|
|
197
209
|
else if (propertyList[key].$ref) {
|
|
198
210
|
const definitionArray = propertyList[key].$ref.split(common_1.DEFINITION_LINK_PREFIX);
|
|
199
211
|
const nextTargetDefinition = jsonSchema['definitions'][definitionArray[definitionArray.length - 1]];
|
|
200
212
|
currentObject = assignReflectMetadataRules(factory, key, currentObject, key === 'settings' ? 'CustomCard' : '');
|
|
201
|
-
transferManifestEntriesOVP(currentObject,
|
|
213
|
+
transferManifestEntriesOVP(currentObject, exportResults, jsonSchema, nextTargetDefinition, factory, [
|
|
214
|
+
...pathHierarchy,
|
|
215
|
+
key
|
|
216
|
+
]);
|
|
202
217
|
}
|
|
203
218
|
else if (propertyList[key].anyOf) {
|
|
204
|
-
processProperties(configObject,
|
|
219
|
+
processProperties(configObject, exportResults, jsonSchema, propertyList[key], factory, [
|
|
205
220
|
...pathHierarchy,
|
|
206
221
|
key,
|
|
207
222
|
'anyOf'
|
|
208
223
|
]);
|
|
209
224
|
}
|
|
210
225
|
else if (propertyList[key]['properties'] !== undefined) {
|
|
211
|
-
processProperties(configObject,
|
|
226
|
+
processProperties(configObject, exportResults, jsonSchema, propertyList[key].properties, factory, [
|
|
227
|
+
...pathHierarchy,
|
|
228
|
+
key,
|
|
229
|
+
'objectProperties'
|
|
230
|
+
]);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Evaluates an export rule for a property, transfers to flex change
|
|
237
|
+
* @param {TransferParameterTypeV2} transferParameters - list of input parameters for the recursive function call
|
|
238
|
+
* @param breadcrumbs - list of breadcrumbs, i.e. ID parts for building the stable ID
|
|
239
|
+
* @param syncRule - export rule from the object classes decorator
|
|
240
|
+
* @param configObject - current (sub)object of the configuration file
|
|
241
|
+
* @param ids - list of parent & child ids
|
|
242
|
+
* @param title - title from the app schema (comprising for instance the facet ID)
|
|
243
|
+
* @param key - key of the given property
|
|
244
|
+
*/
|
|
245
|
+
function evaluateFlexRule(transferParameters, breadcrumbs, syncRule, ids, title, configObject, key) {
|
|
246
|
+
let localBreadcrumbs;
|
|
247
|
+
if (breadcrumbs.length === 0) {
|
|
248
|
+
//only added on top = page level, do not forward
|
|
249
|
+
localBreadcrumbs = ['page'];
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
localBreadcrumbs = breadcrumbs;
|
|
253
|
+
}
|
|
254
|
+
const controlId = syncRule.flex.controlId(transferParameters.baseId, ids, localBreadcrumbs, syncRule.flex.controlType, title);
|
|
255
|
+
const flexChange = common_1.fillFlexChangeContent(configObject, syncRule, transferParameters.ui5Version, key, controlId);
|
|
256
|
+
const completeFlexChange = syncRule.flex.createFlexChange(flexChange, transferParameters.exportResults.manifest);
|
|
257
|
+
const flexChangeExists = transferParameters.exportResults.flexChanges.find((change) => {
|
|
258
|
+
let result = false, oldChange = JSON.parse(change);
|
|
259
|
+
oldChange = {
|
|
260
|
+
content: oldChange['content'],
|
|
261
|
+
selector: oldChange['selector']
|
|
262
|
+
};
|
|
263
|
+
let newChange = JSON.parse(completeFlexChange);
|
|
264
|
+
newChange = {
|
|
265
|
+
content: newChange['content'],
|
|
266
|
+
selector: newChange['selector']
|
|
267
|
+
};
|
|
268
|
+
if (JSON.stringify(oldChange) === JSON.stringify(newChange)) {
|
|
269
|
+
result = true;
|
|
270
|
+
}
|
|
271
|
+
return result;
|
|
272
|
+
});
|
|
273
|
+
if (!flexChangeExists) {
|
|
274
|
+
transferParameters.exportResults.flexChanges.push(completeFlexChange);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Evaluates an export rule for a property, transfers to manifest setting
|
|
279
|
+
* @param {TransferParameterTypeV2} transferParameters - list of input parameters for the recursive function call
|
|
280
|
+
* @param syncRule - export rule from the object classes decorator
|
|
281
|
+
* @param configObject - current (sub)object of the configuration file
|
|
282
|
+
* @param ids - list of parent & child ids
|
|
283
|
+
* @param title - title from the app schema (comprising for instance the facet ID)
|
|
284
|
+
* @param key - key of the given property
|
|
285
|
+
*/
|
|
286
|
+
function evaluateManifestRule(transferParameters, path, syncRule, key, configObject) {
|
|
287
|
+
const manifestSection = manifest_1.getManifestSectionByPathV2(transferParameters.exportResults.manifest, path);
|
|
288
|
+
const manifestKey = syncRule.manifest.key || key;
|
|
289
|
+
if (configObject[key] !== undefined) {
|
|
290
|
+
// In case of arrays we take over complete array
|
|
291
|
+
if (!(transferParameters.propertyDefinition['type'] !== 'array' &&
|
|
292
|
+
transferParameters.nextDefinition &&
|
|
293
|
+
transferParameters.nextDefinition['targetDefinition'].type === 'object' &&
|
|
294
|
+
transferParameters.nextDefinition['targetDefinition'].properties)) {
|
|
295
|
+
const exportHandler = syncRule.manifest.export;
|
|
296
|
+
if (exportHandler !== false) {
|
|
297
|
+
if (exportHandler && typeof exportHandler === 'function') {
|
|
298
|
+
exportHandler(manifestSection, configObject, key, manifestKey);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
manifestSection[manifestKey] = configObject[key];
|
|
302
|
+
}
|
|
212
303
|
}
|
|
213
304
|
}
|
|
305
|
+
else if (transferParameters.propertyDefinition['type'] !== 'array' &&
|
|
306
|
+
manifestSection[manifestKey] === undefined) {
|
|
307
|
+
manifestSection[manifestKey] = {};
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
if (Object.prototype.hasOwnProperty.call(manifestSection, manifestKey)) {
|
|
312
|
+
delete manifestSection[manifestKey];
|
|
313
|
+
}
|
|
214
314
|
}
|
|
315
|
+
common_1.deleteEmptyStructure(transferParameters.exportResults.manifest, path);
|
|
215
316
|
}
|
|
216
317
|
/**
|
|
217
318
|
* Evaluates an export rule for a property or object, transfers to flex change or manifest setting
|
|
319
|
+
* @param {TransferParameterTypeV2} transferParameters - list of input parameters for the recursive function call
|
|
218
320
|
* @param syncRule - export rule from the object classes decorator
|
|
219
321
|
* @param configObject - current (sub)object of the configuration file
|
|
220
322
|
* @param breadcrumbs - list of breadcrumbs, i.e. ID parts for building the stable ID
|
|
221
|
-
* @param baseId - selector id of the current page
|
|
222
323
|
* @param ids - list of parent & child ids
|
|
223
324
|
* @param title - title from the app schema (comprising for instance the facet ID)
|
|
224
325
|
* @param key - key of the given property
|
|
225
|
-
* @param exportResults - object with all collected manifest entries and flex changes
|
|
226
|
-
* @param fullManifest - old or existing manifest
|
|
227
|
-
* @param pageKeys - array of keys to identify component in manifest
|
|
228
|
-
* @param manifestSection - current manifest section
|
|
229
326
|
*/
|
|
230
|
-
function evaluateExportRule(syncRule, configObject, breadcrumbs,
|
|
327
|
+
function evaluateExportRule(transferParameters, syncRule, configObject, breadcrumbs, ids, title, key) {
|
|
231
328
|
function getManifestPath() {
|
|
232
329
|
let path;
|
|
233
330
|
if (breadcrumbs[0] === 'sections') {
|
|
234
331
|
if (breadcrumbs[1] === 'custom') {
|
|
235
|
-
path = syncRule.manifest.path(pageKeys, {}, breadcrumbs[2]);
|
|
332
|
+
path = syncRule.manifest.path(transferParameters.pageKeys, {}, breadcrumbs[2]);
|
|
236
333
|
}
|
|
237
334
|
else {
|
|
238
|
-
path = syncRule.manifest.path(pageKeys, {}, breadcrumbs[1]);
|
|
239
|
-
path = path.replace('/@', '::').replace(
|
|
335
|
+
path = syncRule.manifest.path(transferParameters.pageKeys, {}, breadcrumbs[1], breadcrumbs[breadcrumbs.length - 1]);
|
|
336
|
+
path = path.replace('/@', '::').replace(/VOCWITHCOLONS/g, '::com.sap.vocabularies');
|
|
240
337
|
}
|
|
241
338
|
}
|
|
242
339
|
else if (breadcrumbs[0] === 'table') {
|
|
243
340
|
if (breadcrumbs[1] === 'columns' && breadcrumbs[2] === 'custom') {
|
|
244
|
-
path = syncRule.manifest.path(pageKeys,
|
|
341
|
+
path = syncRule.manifest.path(transferParameters.pageKeys, transferParameters.exportResults.manifest, configObject['tabKey']);
|
|
245
342
|
}
|
|
246
343
|
else {
|
|
247
|
-
path = syncRule.manifest.path(pageKeys, {}, breadcrumbs[1]);
|
|
344
|
+
path = syncRule.manifest.path(transferParameters.pageKeys, {}, breadcrumbs[breadcrumbs.length - 1]);
|
|
248
345
|
}
|
|
249
346
|
}
|
|
250
347
|
else if (breadcrumbs[0] === 'keyPerformanceIndicators') {
|
|
251
|
-
path = syncRule.manifest.path(pageKeys,
|
|
348
|
+
path = syncRule.manifest.path(transferParameters.pageKeys, transferParameters.exportResults.manifest, title);
|
|
252
349
|
}
|
|
253
350
|
else {
|
|
254
|
-
path = syncRule.manifest.path(pageKeys);
|
|
351
|
+
path = syncRule.manifest.path(transferParameters.pageKeys);
|
|
255
352
|
}
|
|
256
353
|
return path;
|
|
257
354
|
}
|
|
258
|
-
let localBreadcrumbs;
|
|
259
355
|
//eliminate subsections' hierarchy
|
|
260
356
|
let index = breadcrumbs.indexOf('subsections');
|
|
261
357
|
while (index > -1) {
|
|
@@ -263,114 +359,54 @@ function evaluateExportRule(syncRule, configObject, breadcrumbs, baseId, ids, ti
|
|
|
263
359
|
index = breadcrumbs.indexOf('subsections');
|
|
264
360
|
}
|
|
265
361
|
if (syncRule.flex) {
|
|
266
|
-
|
|
267
|
-
//only added on top = page level, do not forward
|
|
268
|
-
localBreadcrumbs = ['page'];
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
localBreadcrumbs = breadcrumbs;
|
|
272
|
-
}
|
|
273
|
-
const flexChange = common_1.createFlexChange(configObject, localBreadcrumbs, syncRule, ui5Version, baseId, ids, title, key);
|
|
274
|
-
let flexChangeExists;
|
|
275
|
-
const completeFlexChange = syncRule.flex.createFlexChange(flexChange, fullManifest);
|
|
276
|
-
exportResults.flexChanges.find((change) => {
|
|
277
|
-
let oldChange = JSON.parse(change);
|
|
278
|
-
oldChange = {
|
|
279
|
-
content: oldChange['content'],
|
|
280
|
-
selector: oldChange['selector']
|
|
281
|
-
};
|
|
282
|
-
let newChange = JSON.parse(completeFlexChange);
|
|
283
|
-
newChange = {
|
|
284
|
-
content: newChange['content'],
|
|
285
|
-
selector: newChange['selector']
|
|
286
|
-
};
|
|
287
|
-
if (JSON.stringify(oldChange) === JSON.stringify(newChange)) {
|
|
288
|
-
flexChangeExists = true;
|
|
289
|
-
}
|
|
290
|
-
return flexChangeExists;
|
|
291
|
-
});
|
|
292
|
-
if (!flexChangeExists) {
|
|
293
|
-
exportResults.flexChanges.push(completeFlexChange);
|
|
294
|
-
}
|
|
362
|
+
evaluateFlexRule(transferParameters, breadcrumbs, syncRule, ids, title, configObject, key);
|
|
295
363
|
}
|
|
296
364
|
else if (syncRule.manifest) {
|
|
297
365
|
const path = getManifestPath();
|
|
298
|
-
|
|
299
|
-
const manifestKey = syncRule.manifest.key || key;
|
|
300
|
-
if (configObject[key] !== undefined) {
|
|
301
|
-
if (!syncRule.hasDistinctDefinition) {
|
|
302
|
-
const exportHandler = syncRule.manifest.export;
|
|
303
|
-
if (exportHandler !== false) {
|
|
304
|
-
if (exportHandler && typeof exportHandler === 'function') {
|
|
305
|
-
exportHandler(manifestSection, configObject, key);
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
manifestSection[manifestKey] = configObject[key];
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
else if (manifestSection[manifestKey] === undefined) {
|
|
313
|
-
manifestSection[manifestKey] = {};
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
else {
|
|
317
|
-
if (Object.prototype.hasOwnProperty.call(manifestSection, manifestKey)) {
|
|
318
|
-
delete manifestSection[manifestKey];
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
common_1.deleteEmptyStructure(exportResults.manifest, path);
|
|
366
|
+
evaluateManifestRule(transferParameters, path, syncRule, key, configObject);
|
|
322
367
|
}
|
|
323
368
|
}
|
|
324
369
|
/**
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
* @param
|
|
370
|
+
* Walks through the extensions registered in manifest and compares the columns of the fragment with the ones present in config.
|
|
371
|
+
* If not present anymore, the extension column gets deleted from fragment.
|
|
372
|
+
* @param path - path to extesnions section in manifest
|
|
373
|
+
* @param exportResults - result structure, including the fragments that may get updated
|
|
374
|
+
* @param entitySet - current entity set
|
|
375
|
+
* @param config - current config JSON
|
|
376
|
+
* @param sectionKey - section key
|
|
377
|
+
* @param extensionType - extensionType
|
|
378
|
+
* @param appId - application ID
|
|
328
379
|
*/
|
|
329
|
-
function
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
380
|
+
function deleteObsoleteColumnsFromFragment(path, exportResults, entitySet, config, sectionKey, extensionType, appId) {
|
|
381
|
+
const folderPath = path.substr(0, path.lastIndexOf('/'));
|
|
382
|
+
const manifestSection = manifest_1.getManifestSectionByPathV2(exportResults.manifest, folderPath);
|
|
383
|
+
const extensionPattern = path.substr(path.lastIndexOf('/') + 1);
|
|
384
|
+
for (const key in manifestSection) {
|
|
385
|
+
if (key.startsWith(extensionPattern)) {
|
|
386
|
+
const keyParts = key.split('|');
|
|
387
|
+
const keyEntitySet = keyParts[1];
|
|
388
|
+
const keyTab = keyParts[2];
|
|
389
|
+
if (keyEntitySet === entitySet) {
|
|
390
|
+
//relevant extension. still present in config?
|
|
391
|
+
const existingConfigEntries = config === null || config === void 0 ? void 0 : config.filter((column) => (column.tabKey === keyTab ||
|
|
392
|
+
(keyTab === undefined && column.tabKey === '') ||
|
|
393
|
+
(keyTab && sectionKey === keyTab)) &&
|
|
394
|
+
column.extensionType === extensionType);
|
|
395
|
+
if (!existingConfigEntries || existingConfigEntries.length === 0) {
|
|
396
|
+
controls_1.deleteColumnFromFragment(manifestSection, key, appId, exportResults.fragments);
|
|
397
|
+
// delete from manifest
|
|
398
|
+
delete manifestSection[key];
|
|
399
|
+
// delete cells entry
|
|
400
|
+
if (key.startsWith(common_1.ViewTemplateType.ResponsiveTableColumnsExtension)) {
|
|
401
|
+
const cellsPattern = key.replace(common_1.ViewTemplateType.ResponsiveTableColumnsExtension, common_1.ViewTemplateType.ResponsiveTableCellsExtension);
|
|
402
|
+
controls_1.deleteColumnFromFragment(manifestSection, cellsPattern, appId, exportResults.fragments);
|
|
403
|
+
// delete from manifest
|
|
404
|
+
delete manifestSection[cellsPattern];
|
|
405
|
+
}
|
|
345
406
|
}
|
|
346
407
|
}
|
|
347
408
|
}
|
|
348
409
|
}
|
|
349
|
-
/**
|
|
350
|
-
* Recursive sub-function for handling subsections
|
|
351
|
-
* @param section - Object page section in config
|
|
352
|
-
*/
|
|
353
|
-
function getSubsectionClasses(section, factory) {
|
|
354
|
-
var _a;
|
|
355
|
-
if (section['subsections']) {
|
|
356
|
-
let subSection, sectionInManifest;
|
|
357
|
-
for (const subSectionId in section['subsections']) {
|
|
358
|
-
subSection = section['subsections'][subSectionId];
|
|
359
|
-
sectionInManifest =
|
|
360
|
-
((_a = v2Page.component.settings) === null || _a === void 0 ? void 0 : _a.sections) && v2Page.component.settings.sections[subSectionId];
|
|
361
|
-
getClassesForSingleSection(subSection, subSectionId, sectionInManifest, factory);
|
|
362
|
-
getSubsectionClasses(subSection, factory);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
// Main function
|
|
367
|
-
let section, sectionInManifest;
|
|
368
|
-
for (const sectionId in objectPageConfig.sections) {
|
|
369
|
-
section = objectPage.sections[sectionId];
|
|
370
|
-
sectionInManifest = ((_a = v2Page.component.settings) === null || _a === void 0 ? void 0 : _a.sections) && v2Page.component.settings.sections[sectionId];
|
|
371
|
-
getClassesForSingleSection(section, sectionId, sectionInManifest, factory);
|
|
372
|
-
getSubsectionClasses(section, factory);
|
|
373
|
-
}
|
|
374
410
|
}
|
|
375
411
|
/**
|
|
376
412
|
* Transfers column extensions to manifest and fragment files
|
|
@@ -381,42 +417,16 @@ function getExportClassesForSections(objectPageConfig, objectPage, v2Page, facto
|
|
|
381
417
|
* @param {SapUiAppPageV2} page - Page object from manifest.
|
|
382
418
|
* @param {ObjectPageSectionData} [objectPageSectionData] - Object Page section's data containing target and key options.
|
|
383
419
|
*/
|
|
384
|
-
function transferColumnExtensions(
|
|
420
|
+
function transferColumnExtensions(transferParameters, config, schemaDefinition, objectPageSectionData) {
|
|
385
421
|
const sectionKey = objectPageSectionData ? objectPageSectionData.key : undefined;
|
|
386
422
|
const sectionTarget = objectPageSectionData ? objectPageSectionData.target : undefined;
|
|
387
|
-
const entitySet = sectionTarget ||
|
|
423
|
+
const entitySet = sectionTarget || transferParameters.v2Page.entitySet;
|
|
388
424
|
for (const extensionType in v2_1.TableColumnExtensionTypeV2) {
|
|
389
|
-
const { path
|
|
425
|
+
const { path } = controls_1.getCustomColumnPath(transferParameters.v2Page, entitySet, sectionKey, extensionType);
|
|
390
426
|
if (!path) {
|
|
391
427
|
continue;
|
|
392
428
|
}
|
|
393
|
-
|
|
394
|
-
const manifestSection = manifest_1.getManifestSectionByPathV2(exportResults.manifest, folderPath);
|
|
395
|
-
const extensionPattern = path.substr(path.lastIndexOf('/') + 1);
|
|
396
|
-
for (const key in manifestSection) {
|
|
397
|
-
if (key.startsWith(extensionPattern)) {
|
|
398
|
-
const [keyExtensionType, keyEntitySet, keyTab] = key.split('|');
|
|
399
|
-
if (keyEntitySet === entitySet) {
|
|
400
|
-
//relevant extension. still present in config?
|
|
401
|
-
const existingConfigEntries = config === null || config === void 0 ? void 0 : config.filter((column) => (column.tabKey === keyTab ||
|
|
402
|
-
(keyTab === undefined && column.tabKey === '') ||
|
|
403
|
-
(keyTab && sectionKey === keyTab)) &&
|
|
404
|
-
column.extensionType === extensionType);
|
|
405
|
-
if (!existingConfigEntries || existingConfigEntries.length === 0) {
|
|
406
|
-
controls_1.deleteColumnFromFragment(manifestSection, key, appId, exportResults.fragments);
|
|
407
|
-
// delete from manifest
|
|
408
|
-
delete manifestSection[key];
|
|
409
|
-
// delete cells entry
|
|
410
|
-
if (key.startsWith(common_1.ViewTemplateType.ResponsiveTableColumnsExtension)) {
|
|
411
|
-
const cellsPattern = key.replace(common_1.ViewTemplateType.ResponsiveTableColumnsExtension, common_1.ViewTemplateType.ResponsiveTableCellsExtension);
|
|
412
|
-
controls_1.deleteColumnFromFragment(manifestSection, cellsPattern, appId, exportResults.fragments);
|
|
413
|
-
// delete from manifest
|
|
414
|
-
delete manifestSection[cellsPattern];
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
429
|
+
deleteObsoleteColumnsFromFragment(path, transferParameters.exportResults, entitySet, config, sectionKey, extensionType, transferParameters.appId);
|
|
420
430
|
}
|
|
421
431
|
//cluster existing custom columns by manifest path (or tab key)
|
|
422
432
|
const cluster = {};
|
|
@@ -437,7 +447,7 @@ function transferColumnExtensions(config, exportResults, appId, schemaDefinition
|
|
|
437
447
|
continue;
|
|
438
448
|
}
|
|
439
449
|
}
|
|
440
|
-
const { path, viewTemplateType } = controls_1.getCustomColumnPath(
|
|
450
|
+
const { path, viewTemplateType } = controls_1.getCustomColumnPath(transferParameters.v2Page, entitySet, customColumn.tabKey || sectionKey, customColumn['extensionType']);
|
|
441
451
|
if (!cluster[path]) {
|
|
442
452
|
cluster[path] = {
|
|
443
453
|
viewTemplateType: viewTemplateType,
|
|
@@ -448,27 +458,20 @@ function transferColumnExtensions(config, exportResults, appId, schemaDefinition
|
|
|
448
458
|
}
|
|
449
459
|
//Export to fragment
|
|
450
460
|
for (const path in cluster) {
|
|
451
|
-
controls_1.exportToFragment(exportResults, path, cluster[path].columns, appId, cluster[path].viewTemplateType, logger);
|
|
461
|
+
controls_1.exportToFragment(transferParameters.exportResults, path, cluster[path].columns, transferParameters.appId, cluster[path].viewTemplateType, transferParameters.logger);
|
|
452
462
|
}
|
|
453
463
|
}
|
|
454
464
|
}
|
|
455
465
|
/**
|
|
456
466
|
* Recursive function that traverses the content of the current object. It reads decorators and fills manifest entries and flex changes
|
|
467
|
+
* @param {TransferParameterTypeV2} transferParameters - list of input parameters for the recursive function call
|
|
457
468
|
* @param configSections - sections from configuration object
|
|
458
469
|
* @param pageKey - page key
|
|
459
|
-
* @param fullManifest - the complete manifest.json file content
|
|
460
470
|
* @param parentIds - array of collected parent ids
|
|
461
|
-
* @param manifest - app descriptor (manifest.json)
|
|
462
471
|
* @param breadcrumbs - array of properties that we are currently processing. Required for instance for table column name
|
|
463
|
-
* @param exportResults - object with all collected manifest entries and flex changes
|
|
464
|
-
* @param appId - id of the Fiori elements app, which is usually namespace.appid
|
|
465
|
-
* @param baseId - selector id of the current page
|
|
466
|
-
* @param pageKeys - array of keys to identify component in manifest
|
|
467
|
-
* @param jsonSchema - application specific schema
|
|
468
472
|
* @param targetDefinition - the current entry point or definition in the app schema
|
|
469
|
-
* @param entityAnnotations - list of annotations of the entity type that the page is referring to
|
|
470
473
|
*/
|
|
471
|
-
function transferManifestExtensions(
|
|
474
|
+
function transferManifestExtensions(transferParameters, configSections, pageKey, parentIds, breadcrumbs, targetDefinition) {
|
|
472
475
|
const sectionIds = [];
|
|
473
476
|
const entity = pageKey.split('|')[1];
|
|
474
477
|
if (!configSections) {
|
|
@@ -478,14 +481,15 @@ function transferManifestExtensions(pageType, configSections, pageKey, fullManif
|
|
|
478
481
|
const id = findAvailableId(sectionIds, [section.relativePosition, entity, section.relatedFacet].join('|'));
|
|
479
482
|
sectionIds.push(id);
|
|
480
483
|
}
|
|
481
|
-
for (
|
|
484
|
+
for (let index = 0; index < sectionIds.length; index++) {
|
|
482
485
|
const definition = targetDefinition['anyOf'].find((element) => element.$ref.includes(configSections[index].constructor.name));
|
|
483
486
|
const definitionArray = definition.$ref.split(common_1.DEFINITION_LINK_PREFIX);
|
|
484
|
-
const nextTargetDefinition =
|
|
485
|
-
|
|
487
|
+
const nextTargetDefinition = transferParameters.appSchema['definitions'][definitionArray[definitionArray.length - 1]];
|
|
488
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
489
|
+
transferManifestEntriesAndFlexChange(transferParameters, configSections[index], parentIds, [...breadcrumbs, sectionIds[index]], nextTargetDefinition);
|
|
486
490
|
}
|
|
487
491
|
// Delete removed manifest entries
|
|
488
|
-
const manifestSections = manifest_1.getManifestSectionByPathV2(exportResults.manifest, application_1.getViewExtensionsPath());
|
|
492
|
+
const manifestSections = manifest_1.getManifestSectionByPathV2(transferParameters.exportResults.manifest, application_1.getViewExtensionsPath());
|
|
489
493
|
for (const key in manifestSections) {
|
|
490
494
|
if (utils_1.isAssociatedCustomSection(key, entity) && !sectionIds.includes(key)) {
|
|
491
495
|
delete manifestSections[key];
|
|
@@ -508,67 +512,69 @@ function getSectionId(breadcrumbs, title) {
|
|
|
508
512
|
}
|
|
509
513
|
return common_1.convertSectionId(sectionId, title);
|
|
510
514
|
}
|
|
515
|
+
function transferIndexTable(currentConfigObject, transferParameters, title, propertyDefinition, key, ids, breadcrumbs) {
|
|
516
|
+
Object.keys(currentConfigObject).forEach((newKey) => {
|
|
517
|
+
const nextDefinition = common_1.getNextTargetDefinition(transferParameters.appSchema, title, currentConfigObject[newKey], propertyDefinition.additionalProperties, key, transferParameters.factory, transferParameters.pageType);
|
|
518
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
519
|
+
transferManifestEntriesAndFlexChange(transferParameters, nextDefinition.configObject, ids, [...breadcrumbs, key], nextDefinition.targetDefinition, newKey);
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
function transferCustomColumns(propertyDefinition, breadcrumbs, title, transferParameters, configObject, nextDefinition) {
|
|
523
|
+
let objectPageSectionData;
|
|
524
|
+
const target = utils_1.getTargetFromCustomColumnRef(propertyDefinition.$ref);
|
|
525
|
+
if (target) {
|
|
526
|
+
objectPageSectionData = {
|
|
527
|
+
target,
|
|
528
|
+
key: getSectionId(breadcrumbs, title)
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
transferColumnExtensions(transferParameters, configObject === null || configObject === void 0 ? void 0 : configObject.custom, nextDefinition.targetDefinition, objectPageSectionData);
|
|
532
|
+
}
|
|
511
533
|
/**
|
|
512
|
-
*
|
|
534
|
+
* Function that traverses the content of the current object. It reads decorators and fills manifest entries and flex changes
|
|
535
|
+
* @param {TransferParameterTypeV2} transferParameters - list of input parameters for the recursive function call
|
|
513
536
|
* @param configObject - current (sub)object of the configuration file
|
|
514
537
|
* @param parentIds - array of collected parent ids
|
|
515
|
-
* @param manifest - app descriptor (manifest.json)
|
|
516
538
|
* @param breadcrumbs - array of properties that we are currently processing. Required for instance for table column name
|
|
517
|
-
* @param exportResults - object with all collected manifest entries and flex changes
|
|
518
|
-
* @param appId - id of the Fiori elements app, which is usually namespace.appid
|
|
519
|
-
* @param baseId - selector id of the current page
|
|
520
|
-
* @param pageKeys - array of keys to identify component in manifest
|
|
521
|
-
* @param jsonSchema - application specific schema
|
|
522
539
|
* @param schemaDefinition - the current entry point or definition in the app schema
|
|
523
540
|
* @param title - title from the app schema (comprising for instance the facet ID)
|
|
524
541
|
*/
|
|
525
|
-
function transferManifestEntriesAndFlexChange(
|
|
526
|
-
let
|
|
542
|
+
function transferManifestEntriesAndFlexChange(transferParameters, configObject, parentIds, breadcrumbs, schemaDefinition, title) {
|
|
543
|
+
let currentConfigObject;
|
|
527
544
|
if (schemaDefinition && schemaDefinition['properties']) {
|
|
528
545
|
for (const key in schemaDefinition['properties']) {
|
|
529
546
|
currentConfigObject = configObject && configObject[key];
|
|
530
547
|
const childId = configObject && common_1.getChildId(configObject, key);
|
|
531
548
|
const ids = childId ? [...parentIds, childId] : parentIds;
|
|
532
549
|
const syncRule = common_1.getReflectMetadata(configObject, key);
|
|
550
|
+
const propertyDefinition = (transferParameters.propertyDefinition = schemaDefinition['properties'][key]);
|
|
551
|
+
let nextDefinition = (transferParameters.nextDefinition = common_1.getNextTargetDefinition(transferParameters.appSchema, title, currentConfigObject, propertyDefinition, key, transferParameters.factory, transferParameters.pageType));
|
|
533
552
|
if (syncRule) {
|
|
534
|
-
evaluateExportRule(syncRule, configObject, breadcrumbs,
|
|
553
|
+
evaluateExportRule(transferParameters, syncRule, configObject, [...breadcrumbs], ids, title, key);
|
|
535
554
|
}
|
|
536
|
-
const propertyDefinition = schemaDefinition['properties'][key];
|
|
537
555
|
if (currentConfigObject && propertyDefinition.additionalProperties) {
|
|
538
556
|
//index table
|
|
539
|
-
|
|
540
|
-
const nextDefinition = common_1.getNextTargetDefinition(jsonSchema, title, currentConfigObject[newKey], propertyDefinition.additionalProperties, key, factory, pageType);
|
|
541
|
-
transferManifestEntriesAndFlexChange(pageType, fullManifest, nextDefinition.configObject, ids, manifest, [...breadcrumbs, key], exportResults, appId, baseId, pageKeys, jsonSchema, nextDefinition.targetDefinition, ui5Version, factory, newKey, logger);
|
|
542
|
-
});
|
|
557
|
+
transferIndexTable(currentConfigObject, transferParameters, title, propertyDefinition, key, ids, breadcrumbs);
|
|
543
558
|
}
|
|
544
559
|
if ((currentConfigObject === undefined || typeof currentConfigObject === 'object') && propertyDefinition) {
|
|
545
560
|
if (propertyDefinition.type === 'array' &&
|
|
546
561
|
(breadcrumbs[0] === 'sections' || breadcrumbs[0] === 'subsections') &&
|
|
547
562
|
key === 'custom') {
|
|
548
|
-
transferManifestExtensions(
|
|
563
|
+
transferManifestExtensions(transferParameters, configObject[key], transferParameters.pageKeys[transferParameters.pageKeys.length - 1], ids, [...breadcrumbs, key], propertyDefinition.items);
|
|
549
564
|
continue;
|
|
550
565
|
}
|
|
551
|
-
let nextDefinition = common_1.getNextTargetDefinition(jsonSchema, title, currentConfigObject, propertyDefinition, key, factory, pageType);
|
|
552
566
|
if (nextDefinition && key === 'custom') {
|
|
553
|
-
|
|
554
|
-
const target = utils_1.getTargetFromCustomColumnRef(propertyDefinition.$ref);
|
|
555
|
-
if (target) {
|
|
556
|
-
objectPageSectionData = {
|
|
557
|
-
target,
|
|
558
|
-
key: getSectionId(breadcrumbs, title)
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
transferColumnExtensions(configObject === null || configObject === void 0 ? void 0 : configObject.custom, exportResults, appId, nextDefinition.targetDefinition, logger, manifest, objectPageSectionData);
|
|
567
|
+
transferCustomColumns(propertyDefinition, breadcrumbs, title, transferParameters, configObject, nextDefinition);
|
|
562
568
|
continue;
|
|
563
569
|
}
|
|
564
570
|
else if (nextDefinition) {
|
|
565
|
-
transferManifestEntriesAndFlexChange(
|
|
571
|
+
transferManifestEntriesAndFlexChange(transferParameters, nextDefinition.configObject, ids, [...breadcrumbs, key], nextDefinition.targetDefinition, nextDefinition.title);
|
|
566
572
|
}
|
|
567
573
|
else if (propertyDefinition['anyOf']) {
|
|
568
574
|
propertyDefinition['anyOf'].forEach((element) => {
|
|
569
|
-
nextDefinition = common_1.getNextTargetDefinition(
|
|
575
|
+
nextDefinition = common_1.getNextTargetDefinition(transferParameters.appSchema, title, currentConfigObject, element, key, transferParameters.factory, transferParameters.pageType);
|
|
570
576
|
if (nextDefinition) {
|
|
571
|
-
transferManifestEntriesAndFlexChange(
|
|
577
|
+
transferManifestEntriesAndFlexChange(transferParameters, nextDefinition.configObject, ids, [...breadcrumbs, key], nextDefinition.targetDefinition, nextDefinition.title);
|
|
572
578
|
}
|
|
573
579
|
});
|
|
574
580
|
}
|
|
@@ -576,236 +582,11 @@ function transferManifestEntriesAndFlexChange(pageType, fullManifest, configObje
|
|
|
576
582
|
else if (propertyDefinition &&
|
|
577
583
|
propertyDefinition.$ref === common_1.DEFINITION_LINK_PREFIX + 'TableCustomColumns') {
|
|
578
584
|
//empty config ==> delete all given extensions
|
|
579
|
-
transferColumnExtensions([],
|
|
585
|
+
transferColumnExtensions(transferParameters, [], transferParameters.appSchema['definitions']['TableCustomColumn']);
|
|
580
586
|
continue;
|
|
581
587
|
}
|
|
582
588
|
}
|
|
583
589
|
}
|
|
584
590
|
}
|
|
585
|
-
|
|
586
|
-
* Run through the given ListReport config and return respective manifest entry and flex changes
|
|
587
|
-
* @param appId - id of the Fiori elements app, which is usually namespace.appid
|
|
588
|
-
* @param page - page definition and configuration file content
|
|
589
|
-
* @param manifest - app descriptor (manifest.json)
|
|
590
|
-
* @param jsonSchema - application specific schema
|
|
591
|
-
* @param ui5Version - SAP UI5 version
|
|
592
|
-
* @param fragments - list of all extension fragment files and their content
|
|
593
|
-
* @param logger - Logger class for logging messages
|
|
594
|
-
* @returns ExportResults - The export result comprises the enhanced manifest as well as a list of flex changes.
|
|
595
|
-
*/
|
|
596
|
-
function exportListReportPage(appId, page, manifest, jsonSchema, ui5Version, fragments, logger) {
|
|
597
|
-
const listReportConfig = page.config;
|
|
598
|
-
const entitySet = page.entitySet;
|
|
599
|
-
const exportResults = getDefaultExportResult(fragments);
|
|
600
|
-
const factory = new factory_1.MetadataInstanceFactoryV2();
|
|
601
|
-
const listReport = factory.createPageInstance(v2_1.PageType.ListReport, listReportConfig);
|
|
602
|
-
const pageLayoutInformation = common_1.getPageLayoutInformation(listReport);
|
|
603
|
-
const baseId = `${appId}::${pageLayoutInformation.id}::${entitySet}--`;
|
|
604
|
-
const pageKeys = [];
|
|
605
|
-
const v2Page = utils_1.findListReportPage(manifest[v2_1.ManifestSection.generic].pages, pageKeys);
|
|
606
|
-
if (!v2Page) {
|
|
607
|
-
v2_1.log(logger, {
|
|
608
|
-
severity: "error" /* Error */,
|
|
609
|
-
message: i18next_1.default.t('NOLR'),
|
|
610
|
-
location: {
|
|
611
|
-
path: v2_1.MANIFESTPATH,
|
|
612
|
-
range: [v2_1.ManifestSection.generic]
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
return;
|
|
616
|
-
}
|
|
617
|
-
if (!v2Page.component.settings) {
|
|
618
|
-
v2Page.component.settings = {};
|
|
619
|
-
}
|
|
620
|
-
exportResults.manifest = JSON.parse(JSON.stringify(manifest));
|
|
621
|
-
if (listReportConfig && Object.keys(listReportConfig).length !== 0) {
|
|
622
|
-
transferManifestEntriesAndFlexChange(v2_1.PageType.ListReport, exportResults.manifest, listReport, [], v2Page, [], exportResults, appId, baseId, pageKeys, jsonSchema, jsonSchema, //starting point for target definition
|
|
623
|
-
ui5Version, factory, undefined, //title
|
|
624
|
-
logger);
|
|
625
|
-
}
|
|
626
|
-
return exportResults;
|
|
627
|
-
}
|
|
628
|
-
/**
|
|
629
|
-
* Run through the given AnalyticalListPage config and return respective manifest entry and flex changes
|
|
630
|
-
* @param appId - id of the Fiori elements app, which is usually namespace.appid
|
|
631
|
-
* @param page - page definition and configuration file content
|
|
632
|
-
* @param entitySet - name of the entity set
|
|
633
|
-
* @param manifest - app descriptor (manifest.json)
|
|
634
|
-
* @param jsonSchema - application specific schema
|
|
635
|
-
* @param ui5Version - SAP UI5 version
|
|
636
|
-
* @param fragments - list of all extension fragment files and their content
|
|
637
|
-
* @param logger - Logger class for logging messages
|
|
638
|
-
* @returns ExportResults - The export result comprises the enhanced manifest as well as a list of flex changes.
|
|
639
|
-
*/
|
|
640
|
-
function exportAnalyticalListPage(appId, page, manifest, jsonSchema, ui5Version, fragments, logger) {
|
|
641
|
-
const analyticalListPageConfig = page.config;
|
|
642
|
-
const entitySet = page.entitySet;
|
|
643
|
-
const exportResults = getDefaultExportResult(fragments);
|
|
644
|
-
exportResults.flexChanges = [];
|
|
645
|
-
exportResults.manifest = JSON.parse(JSON.stringify(manifest));
|
|
646
|
-
const factory = new factory_1.MetadataInstanceFactoryV2();
|
|
647
|
-
//Instantiate Page
|
|
648
|
-
const analyticalListPage = factory.createPageInstance(v2_1.PageType.AnalyticalListPage, analyticalListPageConfig);
|
|
649
|
-
//Instantiate base ID
|
|
650
|
-
const pageLayoutInformation = common_1.getPageLayoutInformation(analyticalListPage);
|
|
651
|
-
const baseId = `${appId}::${pageLayoutInformation.id}::${entitySet}--`;
|
|
652
|
-
const pageKeys = [];
|
|
653
|
-
const v2Page = utils_1.findAnalyticalListPage(manifest[v2_1.ManifestSection.generic].pages, pageKeys);
|
|
654
|
-
if (!v2Page) {
|
|
655
|
-
v2_1.log(logger, {
|
|
656
|
-
severity: "error" /* Error */,
|
|
657
|
-
message: i18next_1.default.t('NOALP'),
|
|
658
|
-
location: {
|
|
659
|
-
path: v2_1.MANIFESTPATH,
|
|
660
|
-
range: [v2_1.ManifestSection.generic]
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
if (!v2Page.component.settings) {
|
|
666
|
-
v2Page.component.settings = {};
|
|
667
|
-
}
|
|
668
|
-
exportResults.manifest = JSON.parse(JSON.stringify(manifest));
|
|
669
|
-
if (analyticalListPageConfig && Object.keys(analyticalListPageConfig).length !== 0) {
|
|
670
|
-
transferManifestEntriesAndFlexChange(v2_1.PageType.AnalyticalListPage, exportResults.manifest, analyticalListPage, [], v2Page, [], exportResults, appId, baseId, pageKeys, jsonSchema, jsonSchema, //starting point for target definition
|
|
671
|
-
ui5Version, factory, undefined, logger);
|
|
672
|
-
}
|
|
673
|
-
return exportResults;
|
|
674
|
-
}
|
|
675
|
-
/**
|
|
676
|
-
* Run through the given ObjectPage config and return respective manifest entry and flex changes
|
|
677
|
-
* @param appId - id of the Fiori elements app, which is usually namespace.appid
|
|
678
|
-
* @param page - page definition and configuration file content
|
|
679
|
-
* @param manifest - app descriptor (manifest.json)
|
|
680
|
-
* @param jsonSchema - application specific schema
|
|
681
|
-
* @param ui5Version - SAP UI5 version
|
|
682
|
-
* @param fragments - list of all extension fragment files and their content
|
|
683
|
-
* @param logger - Logger class for logging messages
|
|
684
|
-
* @returns ExportResults - The export result comprises the enhanced manifest as well as a list of flex changes.
|
|
685
|
-
*/
|
|
686
|
-
function exportObjectPage(appId, page, manifest, jsonSchema, ui5Version, fragments, logger) {
|
|
687
|
-
const objectPageConfig = page.config;
|
|
688
|
-
const entitySet = page.entitySet;
|
|
689
|
-
const exportResults = getDefaultExportResult(fragments);
|
|
690
|
-
const factory = new factory_1.MetadataInstanceFactoryV2();
|
|
691
|
-
const objectPage = factory.createPageInstance(v2_1.PageType.ObjectPage, objectPageConfig);
|
|
692
|
-
if (objectPageConfig) {
|
|
693
|
-
const pageLayoutInformation = common_1.getPageLayoutInformation(objectPage);
|
|
694
|
-
const baseId = `${appId}::${pageLayoutInformation.id}::${entitySet}--`;
|
|
695
|
-
exportResults.manifest = JSON.parse(JSON.stringify(manifest));
|
|
696
|
-
const pageKeys = [];
|
|
697
|
-
const v2Page = utils_1.findObjectPage(manifest[v2_1.ManifestSection.generic].pages, entitySet, pageKeys);
|
|
698
|
-
if (!v2Page) {
|
|
699
|
-
return exportResults;
|
|
700
|
-
}
|
|
701
|
-
if (objectPageConfig && objectPageConfig.sections) {
|
|
702
|
-
getExportClassesForSections(objectPageConfig, objectPage, v2Page, factory);
|
|
703
|
-
}
|
|
704
|
-
if (objectPageConfig && Object.keys(objectPageConfig).length !== 0) {
|
|
705
|
-
transferManifestEntriesAndFlexChange(v2_1.PageType.ObjectPage, exportResults.manifest, objectPage, [], v2Page, [], exportResults, appId, baseId, pageKeys, jsonSchema, jsonSchema, //starting point for target definition
|
|
706
|
-
ui5Version, factory, undefined, logger);
|
|
707
|
-
}
|
|
708
|
-
return exportResults;
|
|
709
|
-
}
|
|
710
|
-
else {
|
|
711
|
-
exportResults.manifest = JSON.parse(JSON.stringify(manifest));
|
|
712
|
-
return exportResults;
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
/**
|
|
716
|
-
* Run through the given ObjectPage config and return respective manifest entry and flex changes
|
|
717
|
-
* @param overviewPageConfig - content of the src/OverviewPage_<entity_set>.json file
|
|
718
|
-
* @param manifest - app descriptor (manifest.json)
|
|
719
|
-
* @param jsonSchema - application specific schema
|
|
720
|
-
* @returns ExportResults - The export result comprises the enhanced manifest as well as a list of flex changes.
|
|
721
|
-
*/
|
|
722
|
-
const exportOverviewPage = (overviewPageConfig, manifest, jsonSchema) => {
|
|
723
|
-
const exportResults = getDefaultExportResult();
|
|
724
|
-
const factory = new factory_1.MetadataInstanceFactoryV2();
|
|
725
|
-
const overviewPage = factory.createPageInstance(v2_1.PageType.OverviewPage, overviewPageConfig);
|
|
726
|
-
const ajv = new ajv_1.default({ allErrors: true });
|
|
727
|
-
const validate = ajv.compile(jsonSchema);
|
|
728
|
-
if (!validate(overviewPage)) {
|
|
729
|
-
for (const err of validate.errors) {
|
|
730
|
-
const additionalProperty = err.params['additionalProperty'];
|
|
731
|
-
if (err.keyword === 'additionalProperties' &&
|
|
732
|
-
!Object.values(v2_1.CardSettingsType).includes(err.params['additionalProperty']) &&
|
|
733
|
-
additionalProperty !== 'settings') {
|
|
734
|
-
lodash_unset_1.default(overviewPage, `${err.dataPath.slice(1)}.${additionalProperty}`);
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
exportResults.manifest = JSON.parse(JSON.stringify(manifest));
|
|
739
|
-
if (overviewPageConfig && Object.keys(overviewPageConfig).length !== 0) {
|
|
740
|
-
transferManifestEntriesOVP(overviewPage, exportResults.manifest, exportResults, jsonSchema, jsonSchema, factory, []);
|
|
741
|
-
}
|
|
742
|
-
return exportResults;
|
|
743
|
-
};
|
|
744
|
-
/**
|
|
745
|
-
* Exports a Fiori Element V2 application.
|
|
746
|
-
* It converts the entries of the input application (config file) to corresponding manifest settings and flex changes
|
|
747
|
-
* @param application - content of the config file of an application
|
|
748
|
-
* @param manifest - app descriptor (manifest.json)
|
|
749
|
-
* @param jsonSchema - application specific schema
|
|
750
|
-
* @returns ExportResults - The export result comprises the enhanced manifest as well as a list of flex changes.
|
|
751
|
-
*/
|
|
752
|
-
const exportApplicationV2 = (application, manifest, jsonSchema) => {
|
|
753
|
-
const exportResults = getDefaultExportResult();
|
|
754
|
-
exportResults.manifest = JSON.parse(JSON.stringify(manifest));
|
|
755
|
-
//transfer application settings
|
|
756
|
-
const applicationV2 = Object.assign(new application_1.ApplicationV2(), application);
|
|
757
|
-
applicationV2.settings = Object.assign(new application_1.AppSettings(), application['settings']);
|
|
758
|
-
for (const key in jsonSchema['definitions']['AppSettings']['properties']) {
|
|
759
|
-
const syncRule = common_1.getReflectMetadata(applicationV2.settings, key);
|
|
760
|
-
if (syncRule && syncRule.manifest) {
|
|
761
|
-
const path = syncRule.manifest.path();
|
|
762
|
-
const manifestSection = manifest_1.getManifestSectionByPathV2(exportResults.manifest, path);
|
|
763
|
-
if (application['settings'] && application['settings'][key] !== undefined) {
|
|
764
|
-
manifestSection[key] = application['settings'][key];
|
|
765
|
-
}
|
|
766
|
-
else {
|
|
767
|
-
delete manifestSection[key];
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
// transfer pages and routings
|
|
772
|
-
const manifestPages = exportResults.manifest[v2_1.ManifestSection.generic] && exportResults.manifest[v2_1.ManifestSection.generic].pages;
|
|
773
|
-
if (manifestPages && application['pages']) {
|
|
774
|
-
manifest_1.transformPageToNewManifestV2(application.home, application['pages'], Object.values(manifestPages)[0]);
|
|
775
|
-
}
|
|
776
|
-
return exportResults;
|
|
777
|
-
};
|
|
778
|
-
/**
|
|
779
|
-
* Exports a Fiori Element V2 page.
|
|
780
|
-
* It converts the entries of the input page (config file) to corresponding manifest settings and flex changes
|
|
781
|
-
* @param appId - application id
|
|
782
|
-
* @param page - content of the config file of a page
|
|
783
|
-
* @param manifest - app descriptor (manifest.json)
|
|
784
|
-
* @param jsonSchema - application specific schema
|
|
785
|
-
* @param entityAnnotations - list of annotations of the entity type that the page is referring to
|
|
786
|
-
* @returns ExportResults - The export result comprises the enhanced manifest as well as a list of flex changes.
|
|
787
|
-
*/
|
|
788
|
-
function exportPageV2(exportParametersV2, ui5Version) {
|
|
789
|
-
if (exportParametersV2[v2_1.SchemaType.ListReport]) {
|
|
790
|
-
const { appId, page, manifest, jsonSchema, fragments, logger } = exportParametersV2[v2_1.SchemaType.ListReport];
|
|
791
|
-
return exportListReportPage(appId, page, manifest, jsonSchema, ui5Version, fragments, logger);
|
|
792
|
-
}
|
|
793
|
-
else if (exportParametersV2[v2_1.SchemaType.ObjectPage]) {
|
|
794
|
-
const { appId, page, manifest, jsonSchema, fragments, logger } = exportParametersV2[v2_1.SchemaType.ObjectPage];
|
|
795
|
-
return exportObjectPage(appId, page, manifest, jsonSchema, ui5Version, fragments, logger);
|
|
796
|
-
}
|
|
797
|
-
else if (exportParametersV2[v2_1.SchemaType.OverviewPage]) {
|
|
798
|
-
const { page, manifest, jsonSchema } = exportParametersV2[v2_1.SchemaType.OverviewPage];
|
|
799
|
-
return exportOverviewPage(page.config, manifest, jsonSchema);
|
|
800
|
-
}
|
|
801
|
-
else if (exportParametersV2[v2_1.SchemaType.Application]) {
|
|
802
|
-
const { application, manifest, jsonSchema } = exportParametersV2[v2_1.SchemaType.Application];
|
|
803
|
-
return exportApplicationV2(application, manifest, jsonSchema);
|
|
804
|
-
}
|
|
805
|
-
else if (exportParametersV2[v2_1.SchemaType.AnalyticalListPage]) {
|
|
806
|
-
const { appId, page, manifest, jsonSchema, fragments, logger } = exportParametersV2[v2_1.SchemaType.AnalyticalListPage];
|
|
807
|
-
return exportAnalyticalListPage(appId, page, manifest, jsonSchema, ui5Version, fragments, logger);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
exports.exportPageV2 = exportPageV2;
|
|
591
|
+
exports.transferManifestEntriesAndFlexChange = transferManifestEntriesAndFlexChange;
|
|
811
592
|
//# sourceMappingURL=export.js.map
|