@sap/ux-specification 1.71.41 → 1.71.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -22
- package/README.md +4 -4
- package/dist/documentation/runDocu-min.js +2 -0
- package/dist/documentation/runDocu-min.js.LICENSE.txt +24 -0
- package/dist/documentation/styleDocu.css +227 -0
- package/dist/documentation/v2/v2-AnalyticalListPage.html +49 -0
- package/dist/documentation/v2/v2-ApplicationV2.html +48 -0
- package/dist/documentation/v2/v2-ListReport.html +49 -0
- package/dist/documentation/v2/v2-ObjectPage.html +49 -0
- package/dist/documentation/v2/v2-OverviewPage.html +49 -0
- package/dist/index-min.js +1 -1
- package/dist/schemas/v2/AnalyticalListPageConfig.json +76 -6
- package/dist/schemas/v2/ApplicationV2.json +6 -0
- package/dist/schemas/v2/ListReportConfig.json +75 -5
- package/dist/schemas/v2/ObjectPageConfig.json +302 -42
- package/dist/schemas/v2/OverviewPageConfig.json +24 -41
- package/dist/scripts/extractDocu.js +186 -19
- package/dist/scripts/extractDocu.js.map +1 -1
- package/dist/scripts/runDocu.d.ts +1 -0
- package/dist/scripts/runDocu.js +561 -0
- package/dist/scripts/runDocu.js.map +1 -0
- package/dist/specification/v2/index-min.js +1 -1
- package/dist/src/api.js +8 -14
- package/dist/src/api.js.map +1 -1
- package/dist/src/apiTypes.d.ts +72 -65
- package/dist/src/extensionLogger.js +2 -2
- package/dist/src/extensionLogger.js.map +1 -1
- package/dist/src/specification/common/page.d.ts +2 -2
- package/dist/src/specification/common/page.js.map +1 -1
- package/dist/src/specification/common/types.d.ts +1 -0
- package/dist/src/specification/common/webapp/manifest/Manifest.d.ts +3 -1
- package/dist/src/specification/common/webapp/manifest/Manifest.js +1 -0
- package/dist/src/specification/common/webapp/manifest/Manifest.js.map +1 -1
- package/dist/src/specification/common/webapp/manifest/sapOvp.d.ts +2 -1
- package/dist/src/specification/v2/ApplicationV2.d.ts +6 -0
- package/dist/src/specification/v2/controls/AnalyticalListPageChart.d.ts +1 -1
- package/dist/src/specification/v2/controls/Card.d.ts +11 -13
- package/dist/src/specification/v2/controls/Card.js +0 -3
- package/dist/src/specification/v2/controls/Card.js.map +1 -1
- package/dist/src/specification/v2/controls/Facets.d.ts +2 -1
- package/dist/src/specification/v2/controls/Field.d.ts +10 -0
- package/dist/src/specification/v2/controls/Field.js +3 -0
- package/dist/src/specification/v2/controls/Field.js.map +1 -0
- package/dist/src/specification/v2/controls/FormAction.d.ts +38 -0
- package/dist/src/specification/v2/controls/FormAction.js +15 -0
- package/dist/src/specification/v2/controls/FormAction.js.map +1 -0
- package/dist/src/specification/v2/controls/ObjectPageFooter.d.ts +11 -0
- package/dist/src/specification/v2/controls/ObjectPageFooter.js +3 -0
- package/dist/src/specification/v2/controls/ObjectPageFooter.js.map +1 -0
- package/dist/src/specification/v2/controls/ObjectPageForm.d.ts +16 -0
- package/dist/src/specification/v2/controls/ObjectPageForm.js +3 -0
- package/dist/src/specification/v2/controls/ObjectPageForm.js.map +1 -0
- package/dist/src/specification/v2/controls/ObjectPageHeaderAction.d.ts +21 -5
- package/dist/src/specification/v2/controls/ObjectPageHeaderAction.js +0 -5
- package/dist/src/specification/v2/controls/ObjectPageHeaderAction.js.map +1 -1
- package/dist/src/specification/v2/controls/ObjectPageSection.d.ts +24 -7
- package/dist/src/specification/v2/controls/ObjectPageSection.js.map +1 -1
- package/dist/src/specification/v2/controls/ObjectPageTable.d.ts +4 -1
- package/dist/src/specification/v2/controls/Table.d.ts +4 -0
- package/dist/src/specification/v2/controls/Table.js.map +1 -1
- package/dist/src/specification/v2/controls/ToolBar.d.ts +2 -6
- package/dist/src/specification/v2/controls/index.d.ts +5 -0
- package/dist/src/specification/v2/controls/index.js +1 -1
- package/dist/src/specification/v2/controls/index.js.map +1 -1
- package/dist/src/specification/v2/pages/ListReportConfig.d.ts +2 -1
- package/dist/src/specification/v2/pages/ObjectPageConfig.d.ts +2 -1
- package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.d.ts +1 -0
- package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.js +1 -0
- package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.js.map +1 -1
- package/dist/src/sync/common/decoration/control.d.ts +8 -1
- package/dist/src/sync/common/decoration/control.js +62 -21
- package/dist/src/sync/common/decoration/control.js.map +1 -1
- package/dist/src/sync/common/flexUtils.d.ts +2 -2
- package/dist/src/sync/common/flexUtils.js +10 -5
- package/dist/src/sync/common/flexUtils.js.map +1 -1
- package/dist/src/sync/common/generate/index.d.ts +1 -0
- package/dist/src/sync/common/generate/index.js +7 -0
- package/dist/src/sync/common/generate/index.js.map +1 -0
- package/dist/src/sync/common/generate/objectPage.d.ts +49 -0
- package/dist/src/sync/common/generate/objectPage.js +319 -0
- package/dist/src/sync/common/generate/objectPage.js.map +1 -0
- package/dist/src/sync/common/import/utils.d.ts +28 -0
- package/dist/src/sync/common/import/utils.js +75 -0
- package/dist/src/sync/common/import/utils.js.map +1 -0
- package/dist/src/sync/common/importProject.js +53 -50
- package/dist/src/sync/common/importProject.js.map +1 -1
- package/dist/src/sync/common/index.d.ts +2 -0
- package/dist/src/sync/common/index.js +2 -0
- package/dist/src/sync/common/index.js.map +1 -1
- package/dist/src/sync/common/types.d.ts +19 -6
- package/dist/src/sync/common/types.js +12 -0
- package/dist/src/sync/common/types.js.map +1 -1
- package/dist/src/sync/common/utils.d.ts +30 -9
- package/dist/src/sync/common/utils.js +255 -173
- package/dist/src/sync/common/utils.js.map +1 -1
- package/dist/src/sync/v2/application.d.ts +2 -0
- package/dist/src/sync/v2/application.js +18 -5
- package/dist/src/sync/v2/application.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Card.d.ts +4 -3
- package/dist/src/sync/v2/export/controls/Card.js +16 -9
- package/dist/src/sync/v2/export/controls/Card.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Field.d.ts +4 -0
- package/dist/src/sync/v2/export/controls/Field.js +32 -0
- package/dist/src/sync/v2/export/controls/Field.js.map +1 -0
- package/dist/src/sync/v2/export/controls/FormAction.d.ts +15 -0
- package/dist/src/sync/v2/export/controls/FormAction.js +127 -0
- package/dist/src/sync/v2/export/controls/FormAction.js.map +1 -0
- package/dist/src/sync/v2/export/controls/Fragment.d.ts +1 -1
- package/dist/src/sync/v2/export/controls/Fragment.js +100 -87
- package/dist/src/sync/v2/export/controls/Fragment.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageHeader.js +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageHeader.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.d.ts +6 -2
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js +43 -4
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.d.ts +25 -0
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js +113 -0
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js.map +1 -0
- package/dist/src/sync/v2/export/controls/ObjectPageTable.js +4 -5
- package/dist/src/sync/v2/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Table.d.ts +8 -1
- package/dist/src/sync/v2/export/controls/Table.js +88 -31
- package/dist/src/sync/v2/export/controls/Table.js.map +1 -1
- package/dist/src/sync/v2/export/controls/TableColumn.js +1 -1
- package/dist/src/sync/v2/export/controls/TableColumn.js.map +1 -1
- package/dist/src/sync/v2/export/controls/index.d.ts +3 -0
- package/dist/src/sync/v2/export/controls/index.js +3 -0
- package/dist/src/sync/v2/export/controls/index.js.map +1 -1
- package/dist/src/sync/v2/export/export.d.ts +24 -10
- package/dist/src/sync/v2/export/export.js +285 -503
- package/dist/src/sync/v2/export/export.js.map +1 -1
- package/dist/src/sync/v2/export/exportPage.d.ts +10 -0
- package/dist/src/sync/v2/export/exportPage.js +311 -0
- package/dist/src/sync/v2/export/exportPage.js.map +1 -0
- package/dist/src/sync/v2/export/pages/ListReport.d.ts +3 -1
- package/dist/src/sync/v2/export/pages/ListReport.js.map +1 -1
- package/dist/src/sync/v2/export/pages/OverviewPage.d.ts +3 -1
- package/dist/src/sync/v2/export/pages/OverviewPage.js.map +1 -1
- package/dist/src/sync/v2/export/view-controller-generator.js +1 -1
- package/dist/src/sync/v2/export/view-controller-generator.js.map +1 -1
- package/dist/src/sync/v2/generate/analyticalListReport.d.ts +3 -9
- package/dist/src/sync/v2/generate/analyticalListReport.js +13 -16
- package/dist/src/sync/v2/generate/analyticalListReport.js.map +1 -1
- package/dist/src/sync/v2/generate/generate.js +28 -6
- package/dist/src/sync/v2/generate/generate.js.map +1 -1
- package/dist/src/sync/v2/generate/listReport.d.ts +3 -9
- package/dist/src/sync/v2/generate/listReport.js +20 -23
- package/dist/src/sync/v2/generate/listReport.js.map +1 -1
- package/dist/src/sync/v2/generate/objectPage.d.ts +3 -10
- package/dist/src/sync/v2/generate/objectPage.js +226 -141
- package/dist/src/sync/v2/generate/objectPage.js.map +1 -1
- package/dist/src/sync/v2/generate/utils.d.ts +1 -2
- package/dist/src/sync/v2/generate/utils.js +21 -6
- package/dist/src/sync/v2/generate/utils.js.map +1 -1
- package/dist/src/sync/v2/import/app/appProvider.js +25 -3
- package/dist/src/sync/v2/import/app/appProvider.js.map +1 -1
- package/dist/src/sync/v2/import/app/ovpProvider.d.ts +2 -1
- package/dist/src/sync/v2/import/app/ovpProvider.js +7 -3
- package/dist/src/sync/v2/import/app/ovpProvider.js.map +1 -1
- package/dist/src/sync/v2/import/common/index.d.ts +10 -1
- package/dist/src/sync/v2/import/common/index.js +17 -38
- package/dist/src/sync/v2/import/common/index.js.map +1 -1
- package/dist/src/sync/v2/import/controls/table.d.ts +2 -1
- package/dist/src/sync/v2/import/controls/table.js +1 -1
- package/dist/src/sync/v2/import/controls/table.js.map +1 -1
- package/dist/src/sync/v2/import/pages/analyticalListPage.d.ts +3 -8
- package/dist/src/sync/v2/import/pages/analyticalListPage.js +23 -24
- package/dist/src/sync/v2/import/pages/analyticalListPage.js.map +1 -1
- package/dist/src/sync/v2/import/pages/listReport.d.ts +3 -7
- package/dist/src/sync/v2/import/pages/listReport.js +23 -24
- package/dist/src/sync/v2/import/pages/listReport.js.map +1 -1
- package/dist/src/sync/v2/import/pages/objectPage.d.ts +6 -12
- package/dist/src/sync/v2/import/pages/objectPage.js +293 -154
- package/dist/src/sync/v2/import/pages/objectPage.js.map +1 -1
- package/dist/src/sync/v2/import/pages/overviewPage.d.ts +9 -1
- package/dist/src/sync/v2/import/pages/overviewPage.js +69 -39
- package/dist/src/sync/v2/import/pages/overviewPage.js.map +1 -1
- package/dist/src/sync/v2/import/utils.d.ts +3 -3
- package/dist/src/sync/v2/import/utils.js +5 -5
- package/dist/src/sync/v2/import/utils.js.map +1 -1
- package/dist/src/sync/v2/types.d.ts +32 -0
- package/dist/src/sync/v2/types.js +15 -0
- package/dist/src/sync/v2/types.js.map +1 -1
- package/dist/src/sync/v4/utils/StableIdHelper.d.ts +4 -0
- package/dist/src/sync/v4/utils/StableIdHelper.js +153 -0
- package/dist/src/sync/v4/utils/StableIdHelper.js.map +1 -0
- package/package.json +15 -7
|
@@ -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,103 @@ 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
|
+
const manifestKey = syncRule.manifest.key || key;
|
|
114
|
+
if (key in v2_1.CardSettingsType || key === 'settings') {
|
|
115
|
+
manifestSection['settings'] = deepmerge_1.default(manifestSection['settings'] || {}, currentObject || {}, {
|
|
116
|
+
arrayMerge: common_1.arrayCombineMerge
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
else if (currentObject !== undefined) {
|
|
120
|
+
const exportHandler = syncRule.manifest.export;
|
|
121
|
+
if (exportHandler !== false) {
|
|
122
|
+
if (exportHandler && typeof exportHandler === 'function') {
|
|
123
|
+
exportHandler(manifestSection, configObject, key, manifestKey);
|
|
124
|
+
}
|
|
125
|
+
else if (typeof currentObject === 'object' && !exceptionList.includes(key)) {
|
|
126
|
+
// colorPalette is an exception as it can contain anything as per our schema, so just replace the object
|
|
127
|
+
manifestSection[key] = deepmerge_1.default(manifestSection[key] || {}, currentObject || {}, {
|
|
128
|
+
arrayMerge: common_1.arrayCombineMerge
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
manifestSection[key] = currentObject;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else if (manifestSection[key] !== undefined) {
|
|
137
|
+
delete manifestSection[key];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function transferCards(currentObject, jsonSchema, factory, exportResults) {
|
|
141
|
+
Object.keys(currentObject).forEach((cardKey) => {
|
|
142
|
+
const cardType = currentObject[cardKey].template;
|
|
143
|
+
//Determine target defintion
|
|
144
|
+
let targetDefinition;
|
|
145
|
+
if (!Object.values(v2_1.CardTemplateType).includes(cardType)) {
|
|
146
|
+
targetDefinition = ['CustomCard'];
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
targetDefinition = Object.keys(jsonSchema['definitions']).filter((definition) => {
|
|
150
|
+
var _a, _b, _c;
|
|
151
|
+
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;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
//Get metadata
|
|
155
|
+
currentObject[cardKey] = assignReflectMetadataRules(factory, targetDefinition[0], currentObject[cardKey], 'CustomCard');
|
|
156
|
+
createCard(cardKey, exportResults['manifest'][v2_1.ManifestSection.ovp]);
|
|
157
|
+
transferManifestEntriesOVP(currentObject[cardKey], exportResults, jsonSchema, jsonSchema['definitions'][targetDefinition[0]], factory, [cardKey]);
|
|
158
|
+
});
|
|
159
|
+
//check for deletions:
|
|
160
|
+
Object.keys(exportResults.manifest[v2_1.ManifestSection.ovp].cards).forEach((manifestCard) => {
|
|
161
|
+
if (!currentObject[manifestCard]) {
|
|
162
|
+
delete exportResults.manifest[v2_1.ManifestSection.ovp].cards[manifestCard];
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
89
166
|
/**
|
|
90
167
|
* Recursive function that transfers the content of a list of properties of a configuration to the overall exportResults
|
|
91
168
|
* @param configObject - the given part of the configuration
|
|
92
|
-
* @param manifest - manifest.json of the app
|
|
93
169
|
* @param exportResults - overall result list, to be updated
|
|
94
170
|
* @param jsonSchema - app-specific JSOn schema
|
|
95
171
|
* @param propertyList - current property list of the config (properties or additional properties)
|
|
172
|
+
* @param {MetadataInstanceInterface} factory - factory for creating metadata instances
|
|
96
173
|
* @param pathHierarchy - elements of the path indicating the hierarchical level
|
|
97
174
|
*/
|
|
98
|
-
function processProperties(configObject,
|
|
175
|
+
function processProperties(configObject, exportResults, jsonSchema, propertyList, factory, pathHierarchy) {
|
|
99
176
|
let currentObject;
|
|
100
177
|
let isAnyOfObject = false;
|
|
101
178
|
let isObjectProperty = false;
|
|
@@ -120,142 +197,162 @@ function processProperties(configObject, manifest, exportResults, jsonSchema, pr
|
|
|
120
197
|
syncRule = common_1.getReflectMetadata(configObject, pathHierarchy[pathHierarchy.length - 1]);
|
|
121
198
|
}
|
|
122
199
|
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
|
-
}
|
|
200
|
+
currentObject = processAnyOfDefinitionsOfOVP(pathHierarchy, propertyList, jsonSchema, currentObject, configObject, factory, exportResults);
|
|
137
201
|
}
|
|
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
|
-
}
|
|
202
|
+
if (syncRule === null || syncRule === void 0 ? void 0 : syncRule.manifest) {
|
|
203
|
+
transferToManifest(syncRule, pathHierarchy, key, exportResults, currentObject, configObject, exceptionList);
|
|
168
204
|
}
|
|
169
205
|
if (currentObject && typeof currentObject === 'object' && propertyList[key]) {
|
|
170
206
|
if (key === 'cards') {
|
|
171
207
|
//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
|
-
});
|
|
208
|
+
transferCards(currentObject, jsonSchema, factory, exportResults);
|
|
196
209
|
}
|
|
197
210
|
else if (propertyList[key].$ref) {
|
|
198
211
|
const definitionArray = propertyList[key].$ref.split(common_1.DEFINITION_LINK_PREFIX);
|
|
199
212
|
const nextTargetDefinition = jsonSchema['definitions'][definitionArray[definitionArray.length - 1]];
|
|
200
213
|
currentObject = assignReflectMetadataRules(factory, key, currentObject, key === 'settings' ? 'CustomCard' : '');
|
|
201
|
-
transferManifestEntriesOVP(currentObject,
|
|
214
|
+
transferManifestEntriesOVP(currentObject, exportResults, jsonSchema, nextTargetDefinition, factory, [
|
|
215
|
+
...pathHierarchy,
|
|
216
|
+
key
|
|
217
|
+
]);
|
|
202
218
|
}
|
|
203
219
|
else if (propertyList[key].anyOf) {
|
|
204
|
-
processProperties(configObject,
|
|
220
|
+
processProperties(configObject, exportResults, jsonSchema, propertyList[key], factory, [
|
|
205
221
|
...pathHierarchy,
|
|
206
222
|
key,
|
|
207
223
|
'anyOf'
|
|
208
224
|
]);
|
|
209
225
|
}
|
|
210
226
|
else if (propertyList[key]['properties'] !== undefined) {
|
|
211
|
-
processProperties(configObject,
|
|
227
|
+
processProperties(configObject, exportResults, jsonSchema, propertyList[key].properties, factory, [
|
|
228
|
+
...pathHierarchy,
|
|
229
|
+
key,
|
|
230
|
+
'objectProperties'
|
|
231
|
+
]);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Evaluates an export rule for a property, transfers to flex change
|
|
238
|
+
* @param {TransferParameterTypeV2} transferParameters - list of input parameters for the recursive function call
|
|
239
|
+
* @param breadcrumbs - list of breadcrumbs, i.e. ID parts for building the stable ID
|
|
240
|
+
* @param syncRule - export rule from the object classes decorator
|
|
241
|
+
* @param configObject - current (sub)object of the configuration file
|
|
242
|
+
* @param ids - list of parent & child ids
|
|
243
|
+
* @param title - title from the app schema (comprising for instance the facet ID)
|
|
244
|
+
* @param key - key of the given property
|
|
245
|
+
*/
|
|
246
|
+
function evaluateFlexRule(transferParameters, breadcrumbs, syncRule, ids, title, configObject, key) {
|
|
247
|
+
let localBreadcrumbs;
|
|
248
|
+
if (breadcrumbs.length === 0) {
|
|
249
|
+
//only added on top = page level, do not forward
|
|
250
|
+
localBreadcrumbs = ['page'];
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
localBreadcrumbs = breadcrumbs;
|
|
254
|
+
}
|
|
255
|
+
const controlId = syncRule.flex.controlId(transferParameters.baseId, ids, localBreadcrumbs, syncRule.flex.controlType, title);
|
|
256
|
+
const flexChange = common_1.fillFlexChangeContent(configObject, syncRule, transferParameters.ui5Version, key, controlId);
|
|
257
|
+
const completeFlexChange = syncRule.flex.createFlexChange(flexChange, transferParameters.exportResults.manifest);
|
|
258
|
+
const flexChangeExists = transferParameters.exportResults.flexChanges.find((change) => {
|
|
259
|
+
let result = false, oldChange = JSON.parse(change);
|
|
260
|
+
oldChange = {
|
|
261
|
+
content: oldChange['content'],
|
|
262
|
+
selector: oldChange['selector']
|
|
263
|
+
};
|
|
264
|
+
let newChange = JSON.parse(completeFlexChange);
|
|
265
|
+
newChange = {
|
|
266
|
+
content: newChange['content'],
|
|
267
|
+
selector: newChange['selector']
|
|
268
|
+
};
|
|
269
|
+
if (JSON.stringify(oldChange) === JSON.stringify(newChange)) {
|
|
270
|
+
result = true;
|
|
271
|
+
}
|
|
272
|
+
return result;
|
|
273
|
+
});
|
|
274
|
+
if (!flexChangeExists) {
|
|
275
|
+
transferParameters.exportResults.flexChanges.push(completeFlexChange);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Evaluates an export rule for a property, transfers to manifest setting
|
|
280
|
+
* @param {TransferParameterTypeV2} transferParameters - list of input parameters for the recursive function call
|
|
281
|
+
* @param syncRule - export rule from the object classes decorator
|
|
282
|
+
* @param configObject - current (sub)object of the configuration file
|
|
283
|
+
* @param ids - list of parent & child ids
|
|
284
|
+
* @param title - title from the app schema (comprising for instance the facet ID)
|
|
285
|
+
* @param key - key of the given property
|
|
286
|
+
*/
|
|
287
|
+
function evaluateManifestRule(transferParameters, path, syncRule, key, configObject) {
|
|
288
|
+
const manifestSection = manifest_1.getManifestSectionByPathV2(transferParameters.exportResults.manifest, path);
|
|
289
|
+
const manifestKey = syncRule.manifest.key || key;
|
|
290
|
+
if (configObject[key] !== undefined) {
|
|
291
|
+
// In case of arrays we take over complete array
|
|
292
|
+
if (!(transferParameters.propertyDefinition['type'] !== 'array' &&
|
|
293
|
+
transferParameters.nextDefinition &&
|
|
294
|
+
transferParameters.nextDefinition['targetDefinition'].type === 'object' &&
|
|
295
|
+
transferParameters.nextDefinition['targetDefinition'].properties)) {
|
|
296
|
+
const exportHandler = syncRule.manifest.export;
|
|
297
|
+
if (exportHandler !== false) {
|
|
298
|
+
if (exportHandler && typeof exportHandler === 'function') {
|
|
299
|
+
exportHandler(manifestSection, configObject, key, manifestKey);
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
manifestSection[manifestKey] = configObject[key];
|
|
303
|
+
}
|
|
212
304
|
}
|
|
213
305
|
}
|
|
306
|
+
else if (transferParameters.propertyDefinition['type'] !== 'array' &&
|
|
307
|
+
manifestSection[manifestKey] === undefined) {
|
|
308
|
+
manifestSection[manifestKey] = {};
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
if (Object.prototype.hasOwnProperty.call(manifestSection, manifestKey)) {
|
|
313
|
+
delete manifestSection[manifestKey];
|
|
314
|
+
}
|
|
214
315
|
}
|
|
316
|
+
common_1.deleteEmptyStructure(transferParameters.exportResults.manifest, path);
|
|
215
317
|
}
|
|
216
318
|
/**
|
|
217
319
|
* Evaluates an export rule for a property or object, transfers to flex change or manifest setting
|
|
320
|
+
* @param {TransferParameterTypeV2} transferParameters - list of input parameters for the recursive function call
|
|
218
321
|
* @param syncRule - export rule from the object classes decorator
|
|
219
322
|
* @param configObject - current (sub)object of the configuration file
|
|
220
323
|
* @param breadcrumbs - list of breadcrumbs, i.e. ID parts for building the stable ID
|
|
221
|
-
* @param baseId - selector id of the current page
|
|
222
324
|
* @param ids - list of parent & child ids
|
|
223
325
|
* @param title - title from the app schema (comprising for instance the facet ID)
|
|
224
326
|
* @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
327
|
*/
|
|
230
|
-
function evaluateExportRule(syncRule, configObject, breadcrumbs,
|
|
328
|
+
function evaluateExportRule(transferParameters, syncRule, configObject, breadcrumbs, ids, title, key) {
|
|
231
329
|
function getManifestPath() {
|
|
232
330
|
let path;
|
|
233
331
|
if (breadcrumbs[0] === 'sections') {
|
|
234
332
|
if (breadcrumbs[1] === 'custom') {
|
|
235
|
-
path = syncRule.manifest.path(pageKeys, {}, breadcrumbs[2]);
|
|
333
|
+
path = syncRule.manifest.path(transferParameters.pageKeys, {}, breadcrumbs[2]);
|
|
236
334
|
}
|
|
237
335
|
else {
|
|
238
|
-
path = syncRule.manifest.path(pageKeys, {}, breadcrumbs[1]);
|
|
239
|
-
path = path.replace('/@', '::').replace(
|
|
336
|
+
path = syncRule.manifest.path(transferParameters.pageKeys, {}, breadcrumbs[1], breadcrumbs[breadcrumbs.length - 1]);
|
|
337
|
+
path = path.replace('/@', '::').replace(/VOCWITHCOLONS/g, '::com.sap.vocabularies');
|
|
240
338
|
}
|
|
241
339
|
}
|
|
242
340
|
else if (breadcrumbs[0] === 'table') {
|
|
243
341
|
if (breadcrumbs[1] === 'columns' && breadcrumbs[2] === 'custom') {
|
|
244
|
-
path = syncRule.manifest.path(pageKeys,
|
|
342
|
+
path = syncRule.manifest.path(transferParameters.pageKeys, transferParameters.exportResults.manifest, configObject['tabKey']);
|
|
245
343
|
}
|
|
246
344
|
else {
|
|
247
|
-
path = syncRule.manifest.path(pageKeys, {}, breadcrumbs[1]);
|
|
345
|
+
path = syncRule.manifest.path(transferParameters.pageKeys, {}, breadcrumbs[breadcrumbs.length - 1]);
|
|
248
346
|
}
|
|
249
347
|
}
|
|
250
348
|
else if (breadcrumbs[0] === 'keyPerformanceIndicators') {
|
|
251
|
-
path = syncRule.manifest.path(pageKeys,
|
|
349
|
+
path = syncRule.manifest.path(transferParameters.pageKeys, transferParameters.exportResults.manifest, title);
|
|
252
350
|
}
|
|
253
351
|
else {
|
|
254
|
-
path = syncRule.manifest.path(pageKeys);
|
|
352
|
+
path = syncRule.manifest.path(transferParameters.pageKeys);
|
|
255
353
|
}
|
|
256
354
|
return path;
|
|
257
355
|
}
|
|
258
|
-
let localBreadcrumbs;
|
|
259
356
|
//eliminate subsections' hierarchy
|
|
260
357
|
let index = breadcrumbs.indexOf('subsections');
|
|
261
358
|
while (index > -1) {
|
|
@@ -263,114 +360,54 @@ function evaluateExportRule(syncRule, configObject, breadcrumbs, baseId, ids, ti
|
|
|
263
360
|
index = breadcrumbs.indexOf('subsections');
|
|
264
361
|
}
|
|
265
362
|
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
|
-
}
|
|
363
|
+
evaluateFlexRule(transferParameters, breadcrumbs, syncRule, ids, title, configObject, key);
|
|
295
364
|
}
|
|
296
365
|
else if (syncRule.manifest) {
|
|
297
366
|
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);
|
|
367
|
+
evaluateManifestRule(transferParameters, path, syncRule, key, configObject);
|
|
322
368
|
}
|
|
323
369
|
}
|
|
324
370
|
/**
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
* @param
|
|
371
|
+
* Walks through the extensions registered in manifest and compares the columns of the fragment with the ones present in config.
|
|
372
|
+
* If not present anymore, the extension column gets deleted from fragment.
|
|
373
|
+
* @param path - path to extesnions section in manifest
|
|
374
|
+
* @param exportResults - result structure, including the fragments that may get updated
|
|
375
|
+
* @param entitySet - current entity set
|
|
376
|
+
* @param config - current config JSON
|
|
377
|
+
* @param sectionKey - section key
|
|
378
|
+
* @param extensionType - extensionType
|
|
379
|
+
* @param appId - application ID
|
|
328
380
|
*/
|
|
329
|
-
function
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
381
|
+
function deleteObsoleteColumnsFromFragment(path, exportResults, entitySet, config, sectionKey, extensionType, appId) {
|
|
382
|
+
const folderPath = path.substr(0, path.lastIndexOf('/'));
|
|
383
|
+
const manifestSection = manifest_1.getManifestSectionByPathV2(exportResults.manifest, folderPath);
|
|
384
|
+
const extensionPattern = path.substr(path.lastIndexOf('/') + 1);
|
|
385
|
+
for (const key in manifestSection) {
|
|
386
|
+
if (key.startsWith(extensionPattern)) {
|
|
387
|
+
const keyParts = key.split('|');
|
|
388
|
+
const keyEntitySet = keyParts[1];
|
|
389
|
+
const keyTab = keyParts[2];
|
|
390
|
+
if (keyEntitySet === entitySet) {
|
|
391
|
+
//relevant extension. still present in config?
|
|
392
|
+
const existingConfigEntries = config === null || config === void 0 ? void 0 : config.filter((column) => (column.tabKey === keyTab ||
|
|
393
|
+
(keyTab === undefined && column.tabKey === '') ||
|
|
394
|
+
(keyTab && sectionKey === keyTab)) &&
|
|
395
|
+
column.extensionType === extensionType);
|
|
396
|
+
if (!existingConfigEntries || existingConfigEntries.length === 0) {
|
|
397
|
+
controls_1.deleteColumnFromFragment(manifestSection, key, appId, exportResults.fragments);
|
|
398
|
+
// delete from manifest
|
|
399
|
+
delete manifestSection[key];
|
|
400
|
+
// delete cells entry
|
|
401
|
+
if (key.startsWith(common_1.ViewTemplateType.ResponsiveTableColumnsExtension)) {
|
|
402
|
+
const cellsPattern = key.replace(common_1.ViewTemplateType.ResponsiveTableColumnsExtension, common_1.ViewTemplateType.ResponsiveTableCellsExtension);
|
|
403
|
+
controls_1.deleteColumnFromFragment(manifestSection, cellsPattern, appId, exportResults.fragments);
|
|
404
|
+
// delete from manifest
|
|
405
|
+
delete manifestSection[cellsPattern];
|
|
406
|
+
}
|
|
345
407
|
}
|
|
346
408
|
}
|
|
347
409
|
}
|
|
348
410
|
}
|
|
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
411
|
}
|
|
375
412
|
/**
|
|
376
413
|
* Transfers column extensions to manifest and fragment files
|
|
@@ -381,42 +418,16 @@ function getExportClassesForSections(objectPageConfig, objectPage, v2Page, facto
|
|
|
381
418
|
* @param {SapUiAppPageV2} page - Page object from manifest.
|
|
382
419
|
* @param {ObjectPageSectionData} [objectPageSectionData] - Object Page section's data containing target and key options.
|
|
383
420
|
*/
|
|
384
|
-
function transferColumnExtensions(
|
|
421
|
+
function transferColumnExtensions(transferParameters, config, schemaDefinition, objectPageSectionData) {
|
|
385
422
|
const sectionKey = objectPageSectionData ? objectPageSectionData.key : undefined;
|
|
386
423
|
const sectionTarget = objectPageSectionData ? objectPageSectionData.target : undefined;
|
|
387
|
-
const entitySet = sectionTarget ||
|
|
424
|
+
const entitySet = sectionTarget || transferParameters.v2Page.entitySet;
|
|
388
425
|
for (const extensionType in v2_1.TableColumnExtensionTypeV2) {
|
|
389
|
-
const { path
|
|
426
|
+
const { path } = controls_1.getCustomColumnPath(transferParameters.v2Page, entitySet, sectionKey, extensionType);
|
|
390
427
|
if (!path) {
|
|
391
428
|
continue;
|
|
392
429
|
}
|
|
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
|
-
}
|
|
430
|
+
deleteObsoleteColumnsFromFragment(path, transferParameters.exportResults, entitySet, config, sectionKey, extensionType, transferParameters.appId);
|
|
420
431
|
}
|
|
421
432
|
//cluster existing custom columns by manifest path (or tab key)
|
|
422
433
|
const cluster = {};
|
|
@@ -437,7 +448,7 @@ function transferColumnExtensions(config, exportResults, appId, schemaDefinition
|
|
|
437
448
|
continue;
|
|
438
449
|
}
|
|
439
450
|
}
|
|
440
|
-
const { path, viewTemplateType } = controls_1.getCustomColumnPath(
|
|
451
|
+
const { path, viewTemplateType } = controls_1.getCustomColumnPath(transferParameters.v2Page, entitySet, customColumn.tabKey || sectionKey, customColumn['extensionType']);
|
|
441
452
|
if (!cluster[path]) {
|
|
442
453
|
cluster[path] = {
|
|
443
454
|
viewTemplateType: viewTemplateType,
|
|
@@ -448,27 +459,20 @@ function transferColumnExtensions(config, exportResults, appId, schemaDefinition
|
|
|
448
459
|
}
|
|
449
460
|
//Export to fragment
|
|
450
461
|
for (const path in cluster) {
|
|
451
|
-
controls_1.exportToFragment(exportResults, path, cluster[path].columns, appId, cluster[path].viewTemplateType, logger);
|
|
462
|
+
controls_1.exportToFragment(transferParameters.exportResults, path, cluster[path].columns, transferParameters.appId, cluster[path].viewTemplateType, transferParameters.logger);
|
|
452
463
|
}
|
|
453
464
|
}
|
|
454
465
|
}
|
|
455
466
|
/**
|
|
456
467
|
* Recursive function that traverses the content of the current object. It reads decorators and fills manifest entries and flex changes
|
|
468
|
+
* @param {TransferParameterTypeV2} transferParameters - list of input parameters for the recursive function call
|
|
457
469
|
* @param configSections - sections from configuration object
|
|
458
470
|
* @param pageKey - page key
|
|
459
|
-
* @param fullManifest - the complete manifest.json file content
|
|
460
471
|
* @param parentIds - array of collected parent ids
|
|
461
|
-
* @param manifest - app descriptor (manifest.json)
|
|
462
472
|
* @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
473
|
* @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
474
|
*/
|
|
471
|
-
function transferManifestExtensions(
|
|
475
|
+
function transferManifestExtensions(transferParameters, configSections, pageKey, parentIds, breadcrumbs, targetDefinition) {
|
|
472
476
|
const sectionIds = [];
|
|
473
477
|
const entity = pageKey.split('|')[1];
|
|
474
478
|
if (!configSections) {
|
|
@@ -478,14 +482,15 @@ function transferManifestExtensions(pageType, configSections, pageKey, fullManif
|
|
|
478
482
|
const id = findAvailableId(sectionIds, [section.relativePosition, entity, section.relatedFacet].join('|'));
|
|
479
483
|
sectionIds.push(id);
|
|
480
484
|
}
|
|
481
|
-
for (
|
|
485
|
+
for (let index = 0; index < sectionIds.length; index++) {
|
|
482
486
|
const definition = targetDefinition['anyOf'].find((element) => element.$ref.includes(configSections[index].constructor.name));
|
|
483
487
|
const definitionArray = definition.$ref.split(common_1.DEFINITION_LINK_PREFIX);
|
|
484
|
-
const nextTargetDefinition =
|
|
485
|
-
|
|
488
|
+
const nextTargetDefinition = transferParameters.appSchema['definitions'][definitionArray[definitionArray.length - 1]];
|
|
489
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
490
|
+
transferManifestEntriesAndFlexChange(transferParameters, configSections[index], parentIds, [...breadcrumbs, sectionIds[index]], nextTargetDefinition);
|
|
486
491
|
}
|
|
487
492
|
// Delete removed manifest entries
|
|
488
|
-
const manifestSections = manifest_1.getManifestSectionByPathV2(exportResults.manifest, application_1.getViewExtensionsPath());
|
|
493
|
+
const manifestSections = manifest_1.getManifestSectionByPathV2(transferParameters.exportResults.manifest, application_1.getViewExtensionsPath());
|
|
489
494
|
for (const key in manifestSections) {
|
|
490
495
|
if (utils_1.isAssociatedCustomSection(key, entity) && !sectionIds.includes(key)) {
|
|
491
496
|
delete manifestSections[key];
|
|
@@ -508,67 +513,69 @@ function getSectionId(breadcrumbs, title) {
|
|
|
508
513
|
}
|
|
509
514
|
return common_1.convertSectionId(sectionId, title);
|
|
510
515
|
}
|
|
516
|
+
function transferIndexTable(currentConfigObject, transferParameters, title, propertyDefinition, key, ids, breadcrumbs) {
|
|
517
|
+
Object.keys(currentConfigObject).forEach((newKey) => {
|
|
518
|
+
const nextDefinition = common_1.getNextTargetDefinition(transferParameters.appSchema, title, currentConfigObject[newKey], propertyDefinition.additionalProperties, key, transferParameters.factory, transferParameters.pageType);
|
|
519
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
520
|
+
transferManifestEntriesAndFlexChange(transferParameters, nextDefinition.configObject, ids, [...breadcrumbs, key], nextDefinition.targetDefinition, newKey);
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
function transferCustomColumns(propertyDefinition, breadcrumbs, title, transferParameters, configObject, nextDefinition) {
|
|
524
|
+
let objectPageSectionData;
|
|
525
|
+
const target = utils_1.getTargetFromCustomColumnRef(propertyDefinition.$ref);
|
|
526
|
+
if (target) {
|
|
527
|
+
objectPageSectionData = {
|
|
528
|
+
target,
|
|
529
|
+
key: getSectionId(breadcrumbs, title)
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
transferColumnExtensions(transferParameters, configObject === null || configObject === void 0 ? void 0 : configObject.custom, nextDefinition.targetDefinition, objectPageSectionData);
|
|
533
|
+
}
|
|
511
534
|
/**
|
|
512
|
-
*
|
|
535
|
+
* Function that traverses the content of the current object. It reads decorators and fills manifest entries and flex changes
|
|
536
|
+
* @param {TransferParameterTypeV2} transferParameters - list of input parameters for the recursive function call
|
|
513
537
|
* @param configObject - current (sub)object of the configuration file
|
|
514
538
|
* @param parentIds - array of collected parent ids
|
|
515
|
-
* @param manifest - app descriptor (manifest.json)
|
|
516
539
|
* @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
540
|
* @param schemaDefinition - the current entry point or definition in the app schema
|
|
523
541
|
* @param title - title from the app schema (comprising for instance the facet ID)
|
|
524
542
|
*/
|
|
525
|
-
function transferManifestEntriesAndFlexChange(
|
|
526
|
-
let
|
|
543
|
+
function transferManifestEntriesAndFlexChange(transferParameters, configObject, parentIds, breadcrumbs, schemaDefinition, title) {
|
|
544
|
+
let currentConfigObject;
|
|
527
545
|
if (schemaDefinition && schemaDefinition['properties']) {
|
|
528
546
|
for (const key in schemaDefinition['properties']) {
|
|
529
547
|
currentConfigObject = configObject && configObject[key];
|
|
530
548
|
const childId = configObject && common_1.getChildId(configObject, key);
|
|
531
549
|
const ids = childId ? [...parentIds, childId] : parentIds;
|
|
532
550
|
const syncRule = common_1.getReflectMetadata(configObject, key);
|
|
551
|
+
const propertyDefinition = (transferParameters.propertyDefinition = schemaDefinition['properties'][key]);
|
|
552
|
+
let nextDefinition = (transferParameters.nextDefinition = common_1.getNextTargetDefinition(transferParameters.appSchema, title, currentConfigObject, propertyDefinition, key, transferParameters.factory, transferParameters.pageType));
|
|
533
553
|
if (syncRule) {
|
|
534
|
-
evaluateExportRule(syncRule, configObject, breadcrumbs,
|
|
554
|
+
evaluateExportRule(transferParameters, syncRule, configObject, [...breadcrumbs], ids, title, key);
|
|
535
555
|
}
|
|
536
|
-
const propertyDefinition = schemaDefinition['properties'][key];
|
|
537
556
|
if (currentConfigObject && propertyDefinition.additionalProperties) {
|
|
538
557
|
//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
|
-
});
|
|
558
|
+
transferIndexTable(currentConfigObject, transferParameters, title, propertyDefinition, key, ids, breadcrumbs);
|
|
543
559
|
}
|
|
544
560
|
if ((currentConfigObject === undefined || typeof currentConfigObject === 'object') && propertyDefinition) {
|
|
545
561
|
if (propertyDefinition.type === 'array' &&
|
|
546
562
|
(breadcrumbs[0] === 'sections' || breadcrumbs[0] === 'subsections') &&
|
|
547
563
|
key === 'custom') {
|
|
548
|
-
transferManifestExtensions(
|
|
564
|
+
transferManifestExtensions(transferParameters, configObject[key], transferParameters.pageKeys[transferParameters.pageKeys.length - 1], ids, [...breadcrumbs, key], propertyDefinition.items);
|
|
549
565
|
continue;
|
|
550
566
|
}
|
|
551
|
-
let nextDefinition = common_1.getNextTargetDefinition(jsonSchema, title, currentConfigObject, propertyDefinition, key, factory, pageType);
|
|
552
567
|
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);
|
|
568
|
+
transferCustomColumns(propertyDefinition, breadcrumbs, title, transferParameters, configObject, nextDefinition);
|
|
562
569
|
continue;
|
|
563
570
|
}
|
|
564
571
|
else if (nextDefinition) {
|
|
565
|
-
transferManifestEntriesAndFlexChange(
|
|
572
|
+
transferManifestEntriesAndFlexChange(transferParameters, nextDefinition.configObject, ids, [...breadcrumbs, key], nextDefinition.targetDefinition, nextDefinition.title);
|
|
566
573
|
}
|
|
567
574
|
else if (propertyDefinition['anyOf']) {
|
|
568
575
|
propertyDefinition['anyOf'].forEach((element) => {
|
|
569
|
-
nextDefinition = common_1.getNextTargetDefinition(
|
|
576
|
+
nextDefinition = common_1.getNextTargetDefinition(transferParameters.appSchema, title, currentConfigObject, element, key, transferParameters.factory, transferParameters.pageType);
|
|
570
577
|
if (nextDefinition) {
|
|
571
|
-
transferManifestEntriesAndFlexChange(
|
|
578
|
+
transferManifestEntriesAndFlexChange(transferParameters, nextDefinition.configObject, ids, [...breadcrumbs, key], nextDefinition.targetDefinition, nextDefinition.title);
|
|
572
579
|
}
|
|
573
580
|
});
|
|
574
581
|
}
|
|
@@ -576,236 +583,11 @@ function transferManifestEntriesAndFlexChange(pageType, fullManifest, configObje
|
|
|
576
583
|
else if (propertyDefinition &&
|
|
577
584
|
propertyDefinition.$ref === common_1.DEFINITION_LINK_PREFIX + 'TableCustomColumns') {
|
|
578
585
|
//empty config ==> delete all given extensions
|
|
579
|
-
transferColumnExtensions([],
|
|
586
|
+
transferColumnExtensions(transferParameters, [], transferParameters.appSchema['definitions']['TableCustomColumn']);
|
|
580
587
|
continue;
|
|
581
588
|
}
|
|
582
589
|
}
|
|
583
590
|
}
|
|
584
591
|
}
|
|
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;
|
|
592
|
+
exports.transferManifestEntriesAndFlexChange = transferManifestEntriesAndFlexChange;
|
|
811
593
|
//# sourceMappingURL=export.js.map
|