@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
|
@@ -9,6 +9,7 @@ const edmx_parser_1 = require("@sap-ux/edmx-parser");
|
|
|
9
9
|
const common_1 = require("../../specification/common");
|
|
10
10
|
const schemaAccess_1 = require("../../specification/schemaAccess");
|
|
11
11
|
const i18next_1 = __importDefault(require("i18next"));
|
|
12
|
+
const v2_1 = require("../../specification/v2");
|
|
12
13
|
const v4_1 = require("../../specification/v4");
|
|
13
14
|
const extensionLogger_1 = require("../../extensionLogger");
|
|
14
15
|
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
@@ -16,7 +17,6 @@ var TemplateType;
|
|
|
16
17
|
(function (TemplateType) {
|
|
17
18
|
TemplateType["ListReportObjectPageV2"] = "ListReportObjectPageV2";
|
|
18
19
|
TemplateType["ListReportObjectPageV4"] = "ListReportObjectPageV4";
|
|
19
|
-
TemplateType["FormPageV4"] = "FormPageV4";
|
|
20
20
|
TemplateType["OverviewPageV2"] = "OverviewPageV2";
|
|
21
21
|
TemplateType["AnalyticalListPageV2"] = "AnalyticalListPageV2";
|
|
22
22
|
TemplateType["AnalyticalListPageV4"] = "AnalyticalListPageV4";
|
|
@@ -84,11 +84,12 @@ function evaluateCommonLabel(annotations, entityType, label) {
|
|
|
84
84
|
}
|
|
85
85
|
else if (annotations.Common.Label['type'] === 'Path') {
|
|
86
86
|
const targetProperty = entityType.resolvePath(annotations.Common.Label['path']);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
if (targetProperty.value) {
|
|
88
|
+
label = targetProperty.value;
|
|
89
|
+
}
|
|
90
|
+
else if (typeof ((_b = targetProperty.Common) === null || _b === void 0 ? void 0 : _b.Label) === 'string') {
|
|
91
|
+
label = targetProperty.annotations.Common.Label;
|
|
92
|
+
}
|
|
92
93
|
}
|
|
93
94
|
else if (typeof ((_d = (_c = annotations.Common) === null || _c === void 0 ? void 0 : _c.Label) === null || _d === void 0 ? void 0 : _d.toString()) === 'string') {
|
|
94
95
|
label = annotations.Common.Label.toString();
|
|
@@ -105,7 +106,9 @@ exports.evaluateCommonLabel = evaluateCommonLabel;
|
|
|
105
106
|
*/
|
|
106
107
|
function getLabelForPropertyPath(propertyPath, entityType) {
|
|
107
108
|
let label = propertyPath.value;
|
|
108
|
-
|
|
109
|
+
if (propertyPath.$target) {
|
|
110
|
+
label = evaluateCommonLabel(propertyPath.$target.annotations, entityType, label);
|
|
111
|
+
}
|
|
109
112
|
return label;
|
|
110
113
|
}
|
|
111
114
|
exports.getLabelForPropertyPath = getLabelForPropertyPath;
|
|
@@ -166,6 +169,12 @@ function getLabel(dataFieldLabel, entityType) {
|
|
|
166
169
|
return undefined;
|
|
167
170
|
}
|
|
168
171
|
}
|
|
172
|
+
function getTitleForDataField(dataField, entityType, dataFieldLabel) {
|
|
173
|
+
const propertyCommonLabel = getLabelForDataField(dataField, entityType);
|
|
174
|
+
return (dataFieldLabel ||
|
|
175
|
+
propertyCommonLabel ||
|
|
176
|
+
(dataField.Value.$target ? dataField.Value.$target.name : dataField.Value.value || dataField.Value.path));
|
|
177
|
+
}
|
|
169
178
|
/**
|
|
170
179
|
* Determines the description of a data field, e.g. for the column header
|
|
171
180
|
* @param dataFieldAbstract - the given record of the line item annotation
|
|
@@ -177,13 +186,7 @@ function getDatafieldDescription(dataFieldAbstract, entityType) {
|
|
|
177
186
|
switch (dataFieldAbstract.$Type) {
|
|
178
187
|
case "com.sap.vocabularies.UI.v1.DataField" /* DataField */:
|
|
179
188
|
dataField = dataFieldAbstract;
|
|
180
|
-
|
|
181
|
-
title =
|
|
182
|
-
dataFieldLabel ||
|
|
183
|
-
propertyCommonLabel ||
|
|
184
|
-
(dataField.Value.$target
|
|
185
|
-
? dataField.Value.$target.name
|
|
186
|
-
: dataField.Value.value || dataField.Value.path);
|
|
189
|
+
title = getTitleForDataField(dataField, entityType, dataFieldLabel);
|
|
187
190
|
break;
|
|
188
191
|
case "com.sap.vocabularies.UI.v1.DataFieldWithUrl" /* DataFieldWithUrl */:
|
|
189
192
|
dataField = dataFieldAbstract;
|
|
@@ -215,13 +218,7 @@ function getDatafieldDescription(dataFieldAbstract, entityType) {
|
|
|
215
218
|
break;
|
|
216
219
|
case "com.sap.vocabularies.UI.v1.DataFieldWithNavigationPath" /* DataFieldWithNavigationPath */:
|
|
217
220
|
dataField = dataFieldAbstract;
|
|
218
|
-
|
|
219
|
-
title =
|
|
220
|
-
dataFieldLabel ||
|
|
221
|
-
propertyCommonLabel ||
|
|
222
|
-
(dataField.Value.$target
|
|
223
|
-
? dataField.Value.$target.name
|
|
224
|
-
: dataField.Value.value || dataField.Value.path);
|
|
221
|
+
title = getTitleForDataField(dataField, entityType, dataFieldLabel);
|
|
225
222
|
break;
|
|
226
223
|
default:
|
|
227
224
|
break;
|
|
@@ -235,7 +232,8 @@ exports.getDatafieldDescription = getDatafieldDescription;
|
|
|
235
232
|
*/
|
|
236
233
|
function getPageTypeV2(name) {
|
|
237
234
|
if (name) {
|
|
238
|
-
|
|
235
|
+
const templatePart = `${v2_1.FE_TEMPLATE_V2}.`;
|
|
236
|
+
return name.split(templatePart)[1];
|
|
239
237
|
}
|
|
240
238
|
}
|
|
241
239
|
exports.getPageTypeV2 = getPageTypeV2;
|
|
@@ -245,7 +243,8 @@ exports.getPageTypeV2 = getPageTypeV2;
|
|
|
245
243
|
*/
|
|
246
244
|
function getPageTypeV4(name) {
|
|
247
245
|
if (name) {
|
|
248
|
-
|
|
246
|
+
const templatePart = `${v4_1.FE_TEMPLATE_V4}.`;
|
|
247
|
+
return name.split(templatePart)[1];
|
|
249
248
|
}
|
|
250
249
|
}
|
|
251
250
|
exports.getPageTypeV4 = getPageTypeV4;
|
|
@@ -276,6 +275,38 @@ function findAlias(namespace, oDataServiceAVT) {
|
|
|
276
275
|
return aliasReference === null || aliasReference === void 0 ? void 0 : aliasReference.alias;
|
|
277
276
|
}
|
|
278
277
|
exports.findAlias = findAlias;
|
|
278
|
+
/**
|
|
279
|
+
* Determines the target annotation
|
|
280
|
+
* @param navigationParts - parts of the target annotation path
|
|
281
|
+
* @param entityType - entity type
|
|
282
|
+
* @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
283
|
+
* @returns the target annotation
|
|
284
|
+
*/
|
|
285
|
+
function determineTargetAnnotation(navigationParts, entityType, oDataServiceAVT) {
|
|
286
|
+
var _a;
|
|
287
|
+
const lastNavigationPart = navigationParts[navigationParts.length - 1];
|
|
288
|
+
const annotation = lastNavigationPart.substring(lastNavigationPart.lastIndexOf('.') + 1, lastNavigationPart.length);
|
|
289
|
+
const alias = findAlias(lastNavigationPart.substring(0, lastNavigationPart.lastIndexOf('.')).replace('@', ''), oDataServiceAVT);
|
|
290
|
+
return (_a = entityType === null || entityType === void 0 ? void 0 : entityType.annotations[alias]) === null || _a === void 0 ? void 0 : _a[annotation];
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Adjust key by considering navigation
|
|
294
|
+
* @param key - given key
|
|
295
|
+
* @param keyForRelatedFacetKeys - construct key for 'keyForRelatedFacetKeys' property(used to define custom sections) - we should not add '@' symbol there.
|
|
296
|
+
* @param navigationParts - parts of the target annotation path
|
|
297
|
+
*/
|
|
298
|
+
function adjustKey(key, navigationParts, keyForRelatedFacetKeys) {
|
|
299
|
+
const uiParts = (navigationParts[1] || navigationParts[0]).split('#');
|
|
300
|
+
const uiClass = uiParts[0];
|
|
301
|
+
if (uiClass.includes('.LineItem')) {
|
|
302
|
+
const pathParts = key.split('::');
|
|
303
|
+
pathParts[pathParts.length - 1] = `${!keyForRelatedFacetKeys ? '@' : ''}${"com.sap.vocabularies.UI.v1.LineItem" /* LineItem */}`;
|
|
304
|
+
key = pathParts.join('::');
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}com.sap.vocabularies.UI.v1`);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
279
310
|
/**
|
|
280
311
|
* Resolve page section(get key and label->description).
|
|
281
312
|
* @param facetDefinition - the actual annotation record
|
|
@@ -285,12 +316,12 @@ exports.findAlias = findAlias;
|
|
|
285
316
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
286
317
|
* @returns {FacetSection} - object comprising the relevant facet information
|
|
287
318
|
*/
|
|
288
|
-
function getSectionFacet(facetDefinition,
|
|
289
|
-
var _a
|
|
290
|
-
let entityType = sourceEntityType; //default
|
|
291
|
-
const facetName = facetDefinition.fullyQualifiedName.substr(facetDefinition.fullyQualifiedName.lastIndexOf('@'));
|
|
319
|
+
function getSectionFacet(facetDefinition, sourceEntityType, oDataServiceAVT, logger, oDataVersion = common_1.FioriElementsVersion.v2, keyForRelatedFacetKeys = false) {
|
|
320
|
+
var _a;
|
|
292
321
|
//Take facet ID as fallback
|
|
322
|
+
const facetName = facetDefinition.fullyQualifiedName.substr(facetDefinition.fullyQualifiedName.lastIndexOf('@'));
|
|
293
323
|
let key = facetDefinition.ID ? facetDefinition.ID.toString() : facetName;
|
|
324
|
+
let entityType = sourceEntityType; //default
|
|
294
325
|
//If reference facet: overwrite with target annotation if present
|
|
295
326
|
if (facetDefinition.$Type !== 'com.sap.vocabularies.UI.v1.CollectionFacet' && 'Target' in facetDefinition) {
|
|
296
327
|
const propertyValue = exports.getAnnotationPropertyValue(facetDefinition.Target);
|
|
@@ -301,34 +332,22 @@ function getSectionFacet(facetDefinition, keyForRelatedFacetKeys = false, oDataV
|
|
|
301
332
|
});
|
|
302
333
|
return;
|
|
303
334
|
}
|
|
304
|
-
const navSeparator = oDataVersion === common_1.FioriElementsVersion.v2 ? '::' : '/';
|
|
305
|
-
const separator = oDataVersion === common_1.FioriElementsVersion.v2 ? '::' : '#';
|
|
306
335
|
const navigationParts = propertyValue.split('/');
|
|
307
336
|
const navigation = navigationParts.length > 1 ? navigationParts[0] : '';
|
|
308
337
|
if (navigation) {
|
|
309
338
|
entityType = (_a = sourceEntityType.resolvePath(navigation)) === null || _a === void 0 ? void 0 : _a.targetType;
|
|
310
339
|
}
|
|
311
|
-
|
|
312
|
-
const
|
|
313
|
-
if (uiClass.includes('.LineItem')) {
|
|
314
|
-
const pathParts = key.split('::');
|
|
315
|
-
pathParts[pathParts.length - 1] = `${!keyForRelatedFacetKeys ? '@' : ''}com.sap.vocabularies.UI.v1.LineItem`;
|
|
316
|
-
key = pathParts.join('::');
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
key = uiClass.replace('@UI', `${!keyForRelatedFacetKeys ? '@' : ''}com.sap.vocabularies.UI.v1`);
|
|
320
|
-
}
|
|
321
|
-
const lastNavigationPart = navigationParts[navigationParts.length - 1];
|
|
322
|
-
const annotation = lastNavigationPart.substring(lastNavigationPart.lastIndexOf('.') + 1, lastNavigationPart.length);
|
|
323
|
-
const alias = findAlias(lastNavigationPart.substring(0, lastNavigationPart.lastIndexOf('.')).replace('@', ''), oDataServiceAVT);
|
|
324
|
-
const targetAnnotation = (_b = entityType === null || entityType === void 0 ? void 0 : entityType.annotations[alias]) === null || _b === void 0 ? void 0 : _b[annotation];
|
|
340
|
+
adjustKey(key, navigationParts, keyForRelatedFacetKeys);
|
|
341
|
+
const targetAnnotation = determineTargetAnnotation(navigationParts, entityType, oDataServiceAVT);
|
|
325
342
|
if (targetAnnotation) {
|
|
343
|
+
const separator = oDataVersion === common_1.FioriElementsVersion.v2 ? '::' : '#';
|
|
326
344
|
key = getTargetAnnotationName(targetAnnotation, keyForRelatedFacetKeys).replace('#', separator);
|
|
327
345
|
}
|
|
328
346
|
else {
|
|
329
347
|
return undefined;
|
|
330
348
|
}
|
|
331
349
|
if (navigation) {
|
|
350
|
+
const navSeparator = oDataVersion === common_1.FioriElementsVersion.v2 ? '::' : '/';
|
|
332
351
|
key = `${navigation}${navSeparator}${key}`;
|
|
333
352
|
}
|
|
334
353
|
}
|
|
@@ -425,69 +444,58 @@ exports.getSchemaKeyOfLineItemRecord = getSchemaKeyOfLineItemRecord;
|
|
|
425
444
|
* @param {FioriElementsVersion} oDataVersion - OData version
|
|
426
445
|
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
427
446
|
*/
|
|
428
|
-
function evaluateTargetAnnotation(annotationRecord, facets, entityType, oDataServiceAVT, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
|
|
447
|
+
function evaluateTargetAnnotation(section, annotationRecord, facets, entityType, oDataServiceAVT, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
|
|
429
448
|
var _a, _b, _c, _d, _e;
|
|
430
|
-
const alias = findAlias(
|
|
431
|
-
const section = getSectionFacet(annotationRecord, false, oDataVersion, entityType, oDataServiceAVT, logger);
|
|
432
|
-
if (!section) {
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
449
|
+
const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
|
|
435
450
|
let path = section ? section.key : '';
|
|
436
451
|
const targetEntityType = section.entityType;
|
|
437
|
-
let
|
|
438
|
-
|
|
439
|
-
if (path.includes('com.sap.vocabularies.UI.v1.Chart') || path.includes(alias + '.Chart')) {
|
|
452
|
+
let annotation, targetAnnotation;
|
|
453
|
+
if (path.includes("com.sap.vocabularies.UI.v1.Chart" /* Chart */) || path.includes(alias + '.Chart')) {
|
|
440
454
|
facets[path] = { base: types_1.FacetBase.Chart };
|
|
441
455
|
facets[path]['entityType'] = targetEntityType;
|
|
442
456
|
}
|
|
443
|
-
else if (path.includes(
|
|
457
|
+
else if (path.includes("com.sap.vocabularies.UI.v1.Identification" /* Identification */) || path.includes(alias + '.Identification')) {
|
|
444
458
|
annotation = path.split('.')[path.split('.').length - 1];
|
|
445
|
-
targetAnnotation = targetEntityType.annotations[
|
|
459
|
+
targetAnnotation = targetEntityType.annotations[alias][annotation];
|
|
446
460
|
facets[path] = { base: types_1.FacetBase.Identification };
|
|
447
461
|
facets[path]['entityType'] = targetEntityType;
|
|
448
462
|
facets[path]['target'] = targetAnnotation;
|
|
449
463
|
}
|
|
450
|
-
else if (path.includes(
|
|
451
|
-
if (
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
else if (path.includes('.LineItem')) {
|
|
456
|
-
annotation = 'LineItem';
|
|
457
|
-
const pathParts = path.split('::');
|
|
458
|
-
pathParts[pathParts.length - 1] = '@com.sap.vocabularies.UI.v1.LineItem';
|
|
459
|
-
path = pathParts.join('::');
|
|
460
|
-
}
|
|
461
|
-
facets[path] = { base: types_1.FacetBase.LineItem };
|
|
462
|
-
facets[path]['lineItem'] = (_a = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _a === void 0 ? void 0 : _a.$target;
|
|
463
|
-
facets[path]['entityType'] = targetEntityType;
|
|
464
|
+
else if (entityType && (path.includes("com.sap.vocabularies.UI.v1.LineItem" /* LineItem */) || path.includes(alias + '.LineItem'))) {
|
|
465
|
+
if (!path.includes("com.sap.vocabularies.UI.v1.LineItem" /* LineItem */) && path.includes('.LineItem')) {
|
|
466
|
+
const pathParts = path.split('::');
|
|
467
|
+
pathParts[pathParts.length - 1] = `@${"com.sap.vocabularies.UI.v1.LineItem" /* LineItem */}`;
|
|
468
|
+
path = pathParts.join('::');
|
|
464
469
|
}
|
|
470
|
+
facets[path] = { base: types_1.FacetBase.LineItem };
|
|
471
|
+
facets[path].target = (_a = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _a === void 0 ? void 0 : _a.$target;
|
|
472
|
+
facets[path].entityType = targetEntityType;
|
|
465
473
|
}
|
|
466
|
-
else if (path.includes(
|
|
474
|
+
else if (path.includes("com.sap.vocabularies.UI.v1.FieldGroup" /* FieldGroup */) || path.includes(alias + '.FieldGroup')) {
|
|
467
475
|
facets[path] = { base: types_1.FacetBase.Form };
|
|
468
|
-
facets[path]
|
|
469
|
-
facets[path]
|
|
476
|
+
facets[path].target = (_b = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _b === void 0 ? void 0 : _b.$target;
|
|
477
|
+
facets[path].entityType = targetEntityType;
|
|
470
478
|
}
|
|
471
|
-
else if (path.includes(
|
|
479
|
+
else if (path.includes("com.sap.vocabularies.UI.v1.DataPoint" /* DataPoint */) || path.includes(alias + '.DataPoint')) {
|
|
472
480
|
facets[path] = { base: types_1.FacetBase.DataPoint };
|
|
473
481
|
facets[path].target = (_c = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _c === void 0 ? void 0 : _c.$target;
|
|
474
|
-
facets[path]
|
|
482
|
+
facets[path].entityType = targetEntityType;
|
|
475
483
|
}
|
|
476
484
|
else if (path.includes('com.sap.vocabularies.Communication.v1.Contact') || path.includes(alias + '.Contact')) {
|
|
477
485
|
facets[path] = { base: types_1.FacetBase.Contact };
|
|
478
486
|
facets[path].target = (_d = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _d === void 0 ? void 0 : _d.$target;
|
|
479
|
-
facets[path]
|
|
487
|
+
facets[path].entityType = targetEntityType;
|
|
480
488
|
}
|
|
481
489
|
else if (path.includes('com.sap.vocabularies.Communication.v1.Address') || path.includes(alias + '.Address')) {
|
|
482
490
|
facets[path] = { base: types_1.FacetBase.Address };
|
|
483
491
|
facets[path].target = (_e = annotationRecord === null || annotationRecord === void 0 ? void 0 : annotationRecord.Target) === null || _e === void 0 ? void 0 : _e.$target;
|
|
484
|
-
facets[path]
|
|
492
|
+
facets[path].entityType = targetEntityType;
|
|
485
493
|
}
|
|
486
494
|
else {
|
|
487
495
|
facets[path] = { base: types_1.FacetBase.Unknown };
|
|
488
496
|
}
|
|
489
497
|
if (facets[path]) {
|
|
490
|
-
facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies',
|
|
498
|
+
facets[path].annotationPath = `/${annotationRecord.fullyQualifiedName.replace('@com.sap.vocabularies', types_1.VOCWITHSLASH)}`;
|
|
491
499
|
if (annotationRecord.Label) {
|
|
492
500
|
facets[path].Label = annotationRecord.Label;
|
|
493
501
|
}
|
|
@@ -518,14 +526,14 @@ function evaluateTargetAnnotation(annotationRecord, facets, entityType, oDataSer
|
|
|
518
526
|
*/
|
|
519
527
|
function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entityType, facets, oDataVersion = common_1.FioriElementsVersion.v2, logger) {
|
|
520
528
|
var _a;
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
+
const section = getSectionFacet(annotationRecord, entityType, oDataServiceAVT, logger, oDataVersion, false);
|
|
530
|
+
if (section) {
|
|
531
|
+
switch (annotationRecord.$Type) {
|
|
532
|
+
case "com.sap.vocabularies.UI.v1.ReferenceFacet" /* ReferenceFacet */: {
|
|
533
|
+
evaluateTargetAnnotation(section, annotationRecord, facets, entityType, oDataServiceAVT, oDataVersion, logger);
|
|
534
|
+
break;
|
|
535
|
+
}
|
|
536
|
+
case "com.sap.vocabularies.UI.v1.CollectionFacet" /* CollectionFacet */: {
|
|
529
537
|
const annotationPath = `/${entityType.fullyQualifiedName}/${annotationRecord.fullyQualifiedName.split(entityType.fullyQualifiedName)[1]}`;
|
|
530
538
|
const facet = (facets[section.key] = {
|
|
531
539
|
base: types_1.FacetBase.CollectionFacet,
|
|
@@ -537,8 +545,8 @@ function addFacetToConfig(annotationRecord, oDataServiceAVT, serviceName, entity
|
|
|
537
545
|
(_a = annotationRecord.Facets) === null || _a === void 0 ? void 0 : _a.forEach((collectionItem) => {
|
|
538
546
|
addFacetToConfig(collectionItem, oDataServiceAVT, serviceName, entityType, facet.facets, oDataVersion, logger);
|
|
539
547
|
});
|
|
548
|
+
break;
|
|
540
549
|
}
|
|
541
|
-
break;
|
|
542
550
|
}
|
|
543
551
|
}
|
|
544
552
|
}
|
|
@@ -554,7 +562,7 @@ function getObjectPageHeaderFacets(entityType, oDataServiceAVT, oDataVersion = c
|
|
|
554
562
|
if (!entityType || !entityType.annotations) {
|
|
555
563
|
return;
|
|
556
564
|
}
|
|
557
|
-
const alias = findAlias(
|
|
565
|
+
const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
|
|
558
566
|
const facetAnnotation = alias && entityType.annotations[alias] && entityType.annotations[alias].HeaderFacets;
|
|
559
567
|
if (facetAnnotation) {
|
|
560
568
|
const lastDot = entityType.fullyQualifiedName.lastIndexOf('.');
|
|
@@ -579,7 +587,7 @@ function getObjectPageFacets(entityType, oDataServiceAVT, oDataVersion = common_
|
|
|
579
587
|
if (!entityType || !entityType.annotations) {
|
|
580
588
|
return;
|
|
581
589
|
}
|
|
582
|
-
const alias = findAlias(
|
|
590
|
+
const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
|
|
583
591
|
const facetAnnotation = alias && entityType.annotations[alias] && entityType.annotations[alias].Facets;
|
|
584
592
|
if (facetAnnotation) {
|
|
585
593
|
const lastDot = entityType.fullyQualifiedName.lastIndexOf('.');
|
|
@@ -605,90 +613,118 @@ function getVersionFromManifest(manifest) {
|
|
|
605
613
|
}
|
|
606
614
|
}
|
|
607
615
|
exports.getVersionFromManifest = getVersionFromManifest;
|
|
608
|
-
|
|
616
|
+
/**
|
|
617
|
+
* Determines the template type of a V2 app
|
|
618
|
+
* @param manifest - the manifest.json file
|
|
619
|
+
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
620
|
+
* @returns {TemplateType} the template type
|
|
621
|
+
*/
|
|
622
|
+
function determineV2Template(manifest, logger) {
|
|
609
623
|
let templateType;
|
|
610
|
-
if (manifest[v4_1.ManifestSection.
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
else if (fioriElementsVersion === common_1.FioriElementsVersion.v2) {
|
|
614
|
-
if (manifest[v4_1.ManifestSection.generic]) {
|
|
615
|
-
const v2Pages = manifest[v4_1.ManifestSection.generic].pages;
|
|
616
|
-
if (!v2Pages) {
|
|
617
|
-
extensionLogger_1.log(logger, {
|
|
618
|
-
severity: "error" /* Error */,
|
|
619
|
-
message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
|
|
620
|
-
location: {
|
|
621
|
-
path: types_1.MANIFESTPATH,
|
|
622
|
-
range: [v4_1.ManifestSection.generic]
|
|
623
|
-
}
|
|
624
|
-
});
|
|
625
|
-
return;
|
|
626
|
-
}
|
|
627
|
-
for (const pageKey in v2Pages) {
|
|
628
|
-
const v2Page = v2Pages[pageKey];
|
|
629
|
-
if (getPageTypeV2(v2Page.component.name) === common_1.PageType.AnalyticalListPage) {
|
|
630
|
-
templateType = TemplateType.AnalyticalListPageV2;
|
|
631
|
-
break;
|
|
632
|
-
}
|
|
633
|
-
else if (getPageTypeV2(v2Page.component.name) === common_1.PageType.ListReport) {
|
|
634
|
-
templateType = TemplateType.ListReportObjectPageV2;
|
|
635
|
-
break;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
else {
|
|
640
|
-
if (!templateType) {
|
|
641
|
-
extensionLogger_1.log(logger, {
|
|
642
|
-
severity: "error" /* Error */,
|
|
643
|
-
message: i18next_1.default.t('NOTEMPLATE', { section: v4_1.ManifestSection.generic }),
|
|
644
|
-
location: {
|
|
645
|
-
path: types_1.MANIFESTPATH,
|
|
646
|
-
range: [v4_1.ManifestSection.generic]
|
|
647
|
-
}
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
else if (fioriElementsVersion === common_1.FioriElementsVersion.v4) {
|
|
653
|
-
const v4Pages = manifest[v4_1.ManifestSection.ui5].routing &&
|
|
654
|
-
manifest[v4_1.ManifestSection.ui5].routing.targets;
|
|
655
|
-
if (!v4Pages) {
|
|
624
|
+
if (manifest[v4_1.ManifestSection.generic]) {
|
|
625
|
+
const v2Pages = manifest[v4_1.ManifestSection.generic].pages;
|
|
626
|
+
if (!v2Pages) {
|
|
656
627
|
extensionLogger_1.log(logger, {
|
|
657
628
|
severity: "error" /* Error */,
|
|
658
629
|
message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
|
|
659
630
|
location: {
|
|
660
631
|
path: types_1.MANIFESTPATH,
|
|
661
|
-
range: [v4_1.ManifestSection.
|
|
632
|
+
range: [v4_1.ManifestSection.generic]
|
|
662
633
|
}
|
|
663
634
|
});
|
|
664
635
|
return;
|
|
665
636
|
}
|
|
666
|
-
for (const pageKey in
|
|
667
|
-
const
|
|
668
|
-
if (
|
|
669
|
-
templateType = TemplateType.
|
|
670
|
-
break;
|
|
671
|
-
}
|
|
672
|
-
else if (getPageTypeV4(v4Page.name) === common_1.PageTypeV4.ListReport) {
|
|
673
|
-
templateType = TemplateType.ListReportObjectPageV4;
|
|
637
|
+
for (const pageKey in v2Pages) {
|
|
638
|
+
const v2Page = v2Pages[pageKey];
|
|
639
|
+
if (getPageTypeV2(v2Page.component.name) === common_1.PageType.AnalyticalListPage) {
|
|
640
|
+
templateType = TemplateType.AnalyticalListPageV2;
|
|
674
641
|
break;
|
|
675
642
|
}
|
|
676
|
-
else if (
|
|
677
|
-
templateType = TemplateType.
|
|
643
|
+
else if (getPageTypeV2(v2Page.component.name) === common_1.PageType.ListReport) {
|
|
644
|
+
templateType = TemplateType.ListReportObjectPageV2;
|
|
678
645
|
break;
|
|
679
646
|
}
|
|
680
647
|
}
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
681
650
|
if (!templateType) {
|
|
682
651
|
extensionLogger_1.log(logger, {
|
|
683
652
|
severity: "error" /* Error */,
|
|
684
|
-
message: i18next_1.default.t('NOTEMPLATE', { section: v4_1.ManifestSection.
|
|
653
|
+
message: i18next_1.default.t('NOTEMPLATE', { section: v4_1.ManifestSection.generic }),
|
|
685
654
|
location: {
|
|
686
655
|
path: types_1.MANIFESTPATH,
|
|
687
|
-
range: [v4_1.ManifestSection.
|
|
656
|
+
range: [v4_1.ManifestSection.generic]
|
|
688
657
|
}
|
|
689
658
|
});
|
|
690
659
|
}
|
|
691
660
|
}
|
|
661
|
+
return templateType;
|
|
662
|
+
}
|
|
663
|
+
exports.determineV2Template = determineV2Template;
|
|
664
|
+
/**
|
|
665
|
+
* Determines the template type of a V4 app
|
|
666
|
+
* @param manifest - the manifest.json file
|
|
667
|
+
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
668
|
+
* @returns {TemplateType} the template type
|
|
669
|
+
*/
|
|
670
|
+
function determineV4Template(manifest, logger) {
|
|
671
|
+
let templateType;
|
|
672
|
+
const v4Pages = manifest[v4_1.ManifestSection.ui5].routing &&
|
|
673
|
+
manifest[v4_1.ManifestSection.ui5].routing.targets;
|
|
674
|
+
if (!v4Pages) {
|
|
675
|
+
extensionLogger_1.log(logger, {
|
|
676
|
+
severity: "error" /* Error */,
|
|
677
|
+
message: i18next_1.default.t('NOPAGES', { appId: manifest['sap.app']['id'] }),
|
|
678
|
+
location: {
|
|
679
|
+
path: types_1.MANIFESTPATH,
|
|
680
|
+
range: [v4_1.ManifestSection.ui5, 'routing']
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
for (const pageKey in v4Pages) {
|
|
686
|
+
const v4Page = v4Pages[pageKey];
|
|
687
|
+
const pageType = getPageTypeV4(v4Page.name);
|
|
688
|
+
if (pageType === common_1.PageTypeV4.AnalyticalListPage) {
|
|
689
|
+
templateType = TemplateType.AnalyticalListPageV4;
|
|
690
|
+
break;
|
|
691
|
+
}
|
|
692
|
+
else if (pageType === common_1.PageTypeV4.ListReport || pageType === common_1.PageTypeV4.ObjectPage) {
|
|
693
|
+
templateType = TemplateType.ListReportObjectPageV4;
|
|
694
|
+
break;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
if (!templateType) {
|
|
698
|
+
extensionLogger_1.log(logger, {
|
|
699
|
+
severity: "error" /* Error */,
|
|
700
|
+
message: i18next_1.default.t('NOTEMPLATE', { section: v4_1.ManifestSection.ui5 }),
|
|
701
|
+
location: {
|
|
702
|
+
path: types_1.MANIFESTPATH,
|
|
703
|
+
range: [v4_1.ManifestSection.ui5, 'routing', 'targets']
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
return templateType;
|
|
708
|
+
}
|
|
709
|
+
exports.determineV4Template = determineV4Template;
|
|
710
|
+
/**
|
|
711
|
+
* Determines the template type, based on the given manifest entries of the app
|
|
712
|
+
* @param manifest - the manifest.json file
|
|
713
|
+
* @param {FioriElementsVersion} fioriElementsVersion - OData or FE version
|
|
714
|
+
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
715
|
+
* @returns {TemplateType} the template type
|
|
716
|
+
*/
|
|
717
|
+
function getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger) {
|
|
718
|
+
let templateType;
|
|
719
|
+
if (manifest[v4_1.ManifestSection.ovp]) {
|
|
720
|
+
templateType = TemplateType.OverviewPageV2;
|
|
721
|
+
}
|
|
722
|
+
else if (fioriElementsVersion === common_1.FioriElementsVersion.v2) {
|
|
723
|
+
templateType = determineV2Template(manifest, logger);
|
|
724
|
+
}
|
|
725
|
+
else if (fioriElementsVersion === common_1.FioriElementsVersion.v4) {
|
|
726
|
+
templateType = determineV4Template(manifest, logger);
|
|
727
|
+
}
|
|
692
728
|
else {
|
|
693
729
|
if (!templateType) {
|
|
694
730
|
extensionLogger_1.log(logger, {
|
|
@@ -703,12 +739,40 @@ function getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger) {
|
|
|
703
739
|
return templateType;
|
|
704
740
|
}
|
|
705
741
|
exports.getTemplateTypeFromManifest = getTemplateTypeFromManifest;
|
|
742
|
+
/**
|
|
743
|
+
* Adds title and description to a section or header section in an app schema
|
|
744
|
+
* @param facet - intermediate facet structure comprising annotation information
|
|
745
|
+
* @param section - section in the app schema
|
|
746
|
+
* @param facetKey - key of the facet
|
|
747
|
+
*/
|
|
748
|
+
function addSectionTitleAndDescription(facet, section, facetKey) {
|
|
749
|
+
if (facet === null || facet === void 0 ? void 0 : facet.ID) {
|
|
750
|
+
section['title'] = types_1.FacetTitlePrefix + facet.ID;
|
|
751
|
+
}
|
|
752
|
+
else {
|
|
753
|
+
section['title'] = facetKey.substr(facetKey.lastIndexOf('.') + 1);
|
|
754
|
+
}
|
|
755
|
+
// Description
|
|
756
|
+
if (facet === null || facet === void 0 ? void 0 : facet.Label) {
|
|
757
|
+
section['description'] = facet.Label;
|
|
758
|
+
}
|
|
759
|
+
else if (facet === null || facet === void 0 ? void 0 : facet.ID) {
|
|
760
|
+
section['description'] = facet.ID;
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
section['description'] = facetKey.substr(facetKey.lastIndexOf('.') + 1);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
exports.addSectionTitleAndDescription = addSectionTitleAndDescription;
|
|
706
767
|
/**
|
|
707
768
|
* Creates a default object for a new section or subsection, and adds the ID as title if present.
|
|
708
769
|
* @param facet Facet configuration, to be analyzed
|
|
709
770
|
* @returns the new section object
|
|
710
771
|
*/
|
|
711
|
-
function createSectionWithoutProperties(facet) {
|
|
772
|
+
function createSectionWithoutProperties(facet, facetKey) {
|
|
773
|
+
if (!facet) {
|
|
774
|
+
return undefined;
|
|
775
|
+
}
|
|
712
776
|
const section = {
|
|
713
777
|
type: 'object',
|
|
714
778
|
properties: {},
|
|
@@ -716,12 +780,7 @@ function createSectionWithoutProperties(facet) {
|
|
|
716
780
|
annotationPath: facet.annotationPath,
|
|
717
781
|
isViewNode: true
|
|
718
782
|
};
|
|
719
|
-
|
|
720
|
-
section['title'] = types_1.FacetTitlePrefix + facet.ID;
|
|
721
|
-
}
|
|
722
|
-
if (facet && facet.Label) {
|
|
723
|
-
section['description'] = facet.Label;
|
|
724
|
-
}
|
|
783
|
+
addSectionTitleAndDescription(facet, section, facetKey);
|
|
725
784
|
return section;
|
|
726
785
|
}
|
|
727
786
|
exports.createSectionWithoutProperties = createSectionWithoutProperties;
|
|
@@ -735,22 +794,23 @@ exports.createSectionWithoutProperties = createSectionWithoutProperties;
|
|
|
735
794
|
* @returns {FacetSection[]} - Array of facets or sections
|
|
736
795
|
*/
|
|
737
796
|
function getObjectPageFacetSection(entityType, oDataServiceAVT, logger, oDataVersion = common_1.FioriElementsVersion.v2, checkUnresolvableFacets = false) {
|
|
738
|
-
const alias = findAlias(
|
|
797
|
+
const alias = findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
|
|
798
|
+
let sections = [];
|
|
739
799
|
if (entityType) {
|
|
740
800
|
const facetAnnotation = alias && entityType.annotations && entityType.annotations[alias] && entityType.annotations[alias].Facets;
|
|
741
|
-
if (
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
801
|
+
if (facetAnnotation) {
|
|
802
|
+
sections = facetAnnotation.reduce(function (result, item) {
|
|
803
|
+
if (checkUnresolvableFacets && !item['ID'] && !('Target' in item && item['Target'])) {
|
|
804
|
+
return result;
|
|
805
|
+
}
|
|
806
|
+
const section = getSectionFacet(item, entityType, oDataServiceAVT, logger, oDataVersion, true);
|
|
807
|
+
if (section) {
|
|
808
|
+
result.push(section);
|
|
809
|
+
}
|
|
746
810
|
return result;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
result.push(section);
|
|
751
|
-
}
|
|
752
|
-
return result;
|
|
753
|
-
}, []);
|
|
811
|
+
}, sections);
|
|
812
|
+
}
|
|
813
|
+
return sections;
|
|
754
814
|
}
|
|
755
815
|
}
|
|
756
816
|
exports.getObjectPageFacetSection = getObjectPageFacetSection;
|
|
@@ -856,27 +916,16 @@ function generatePageId(pageType, entitySet, navigationProperty, viewId) {
|
|
|
856
916
|
}
|
|
857
917
|
exports.generatePageId = generatePageId;
|
|
858
918
|
/**
|
|
859
|
-
*
|
|
860
|
-
* @param
|
|
861
|
-
* @param
|
|
862
|
-
*
|
|
863
|
-
* @param
|
|
864
|
-
* @
|
|
865
|
-
* @param factory - factory for creating metadata instances
|
|
866
|
-
* @param pageType - page type
|
|
919
|
+
* Fills an array of next definitions from given references in the JSON schema
|
|
920
|
+
* @param propertyDefinition - Definition of the current property in schema
|
|
921
|
+
* @param currentConfigObject - Current object in the config JSON. Evaluated to get the right value of a cntrolling property,
|
|
922
|
+
* for making the right choice in case of multiple options (anyOf)
|
|
923
|
+
* @param appSchema - app-spcific JSON schema
|
|
924
|
+
* @returns an array of definitions to proceed with
|
|
867
925
|
*/
|
|
868
|
-
function
|
|
869
|
-
let nextDefinition = {
|
|
870
|
-
configObject: undefined,
|
|
871
|
-
targetDefinition: {},
|
|
872
|
-
title: ''
|
|
873
|
-
};
|
|
926
|
+
function fillArrayFromPropertyDefinition(propertyDefinition, currentConfigObject, appSchema) {
|
|
874
927
|
const definitionArray = [];
|
|
875
|
-
if (propertyDefinition['
|
|
876
|
-
nextDefinition = getNextTargetDefinition(appSchema, title, currentConfigObject, propertyDefinition['items'], key, factory, pageType);
|
|
877
|
-
return nextDefinition;
|
|
878
|
-
}
|
|
879
|
-
else if (propertyDefinition['$ref']) {
|
|
928
|
+
if (propertyDefinition['$ref']) {
|
|
880
929
|
definitionArray.push(propertyDefinition['$ref'].split(exports.DEFINITION_LINK_PREFIX)[1]);
|
|
881
930
|
}
|
|
882
931
|
else if (propertyDefinition['anyOf']) {
|
|
@@ -897,16 +946,38 @@ function getNextTargetDefinition(appSchema, title, currentConfigObject, property
|
|
|
897
946
|
return undefined;
|
|
898
947
|
}
|
|
899
948
|
}
|
|
949
|
+
return definitionArray;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Determines the next definition to be handled, based on the definition array.
|
|
953
|
+
* It also creates the Metadata instance for the next definition, to subsequently access metadata like the syncRule
|
|
954
|
+
* @param definitionArray - Array of definitions, as determined by fillArrayFromNextDefinition
|
|
955
|
+
* @param appSchema - app-spcific JSON schema
|
|
956
|
+
* @param title - default title
|
|
957
|
+
* @param currentConfigObject - Current object in the config JSON.
|
|
958
|
+
* @param key - actual key
|
|
959
|
+
* @param {MetadataInstanceInterface} factory - factory for creating metadata instances
|
|
960
|
+
* @param pageType - page type
|
|
961
|
+
* @param propertyDefinition - Definition of the current property in schema
|
|
962
|
+
* @returns {NextDefinition} - Next target definition to process
|
|
963
|
+
*/
|
|
964
|
+
function determineNextDefinitionFromDefinitionArray(definitionArray, appSchema, title, currentConfigObject, key, factory, pageType, propertyDefinition) {
|
|
965
|
+
let nextDefinition = {
|
|
966
|
+
configObject: undefined,
|
|
967
|
+
targetDefinition: {},
|
|
968
|
+
title: ''
|
|
969
|
+
};
|
|
900
970
|
if (definitionArray.length) {
|
|
901
971
|
const lastDefinition = definitionArray[definitionArray.length - 1];
|
|
902
972
|
nextDefinition.targetDefinition = appSchema['definitions'][lastDefinition];
|
|
903
973
|
if (nextDefinition.targetDefinition['$ref'] || nextDefinition.targetDefinition['type'] === 'array') {
|
|
974
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
904
975
|
nextDefinition = getNextTargetDefinition(appSchema, title, currentConfigObject, nextDefinition.targetDefinition, key, factory, pageType);
|
|
905
976
|
return nextDefinition;
|
|
906
977
|
}
|
|
907
978
|
if (definitionArray.length > 1) {
|
|
908
979
|
definitionArray.forEach((element) => {
|
|
909
|
-
if (element
|
|
980
|
+
if (element !== '') {
|
|
910
981
|
nextDefinition.targetDefinition['properties'] = Object.assign(Object.assign({}, nextDefinition.targetDefinition['properties']), appSchema['definitions'][element]['properties']);
|
|
911
982
|
}
|
|
912
983
|
});
|
|
@@ -928,36 +999,58 @@ function getNextTargetDefinition(appSchema, title, currentConfigObject, property
|
|
|
928
999
|
}
|
|
929
1000
|
return nextDefinition;
|
|
930
1001
|
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Recursive function to determine the next config part, next definition in the app schema and the title
|
|
1004
|
+
* @param appSchema - app-spcific JSON schema
|
|
1005
|
+
* @param title - default title
|
|
1006
|
+
* @param currentConfigObject - current part of the configuration that gets traversed
|
|
1007
|
+
* @param propertyDefinition - definition of a given property in the app schema
|
|
1008
|
+
* @param key - actual key
|
|
1009
|
+
* @param {MetadataInstanceInterface} factory - factory for creating metadata instances
|
|
1010
|
+
* @param pageType - page type
|
|
1011
|
+
*/
|
|
1012
|
+
function getNextTargetDefinition(appSchema, title, currentConfigObject, propertyDefinition, key, factory, pageType) {
|
|
1013
|
+
let nextDefinition;
|
|
1014
|
+
if (propertyDefinition['type'] === 'array') {
|
|
1015
|
+
nextDefinition = getNextTargetDefinition(appSchema, title, currentConfigObject, propertyDefinition['items'], key, factory, pageType);
|
|
1016
|
+
return nextDefinition;
|
|
1017
|
+
}
|
|
1018
|
+
const definitionArray = fillArrayFromPropertyDefinition(propertyDefinition, currentConfigObject, appSchema);
|
|
1019
|
+
if (!definitionArray) {
|
|
1020
|
+
return undefined;
|
|
1021
|
+
}
|
|
1022
|
+
nextDefinition = determineNextDefinitionFromDefinitionArray(definitionArray, appSchema, title, currentConfigObject, key, factory, pageType, propertyDefinition);
|
|
1023
|
+
return nextDefinition;
|
|
1024
|
+
}
|
|
931
1025
|
exports.getNextTargetDefinition = getNextTargetDefinition;
|
|
932
1026
|
/**
|
|
933
1027
|
* Add schema definitions for fields of createWithParameterDialog
|
|
934
1028
|
* @param {object} appSchema - Application-specific schema, to be enhanced
|
|
935
|
-
* @param {EntityType} entityType - Given entity type for which entries shall get generated
|
|
1029
|
+
* @param {EntityType} entityType - Given entity type for which entries shall get generated
|
|
1030
|
+
* @param {string=} floorplanSuffix - floorplan specific suffix (optional)
|
|
936
1031
|
*/
|
|
937
|
-
function addFieldsType(appSchema, entityType) {
|
|
1032
|
+
function addFieldsType(appSchema, entityType, floorplanSuffix = '') {
|
|
938
1033
|
const propertyNameArray = [], propertyObject = {};
|
|
939
|
-
for (const key
|
|
940
|
-
const propertyName =
|
|
1034
|
+
for (const key of entityType.entityProperties) {
|
|
1035
|
+
const propertyName = key.name;
|
|
941
1036
|
propertyNameArray.push(propertyName);
|
|
942
1037
|
propertyObject[propertyName] = {
|
|
943
|
-
$ref: exports.DEFINITION_LINK_PREFIX +
|
|
1038
|
+
$ref: exports.DEFINITION_LINK_PREFIX + `FieldPath${floorplanSuffix}`
|
|
944
1039
|
};
|
|
945
1040
|
}
|
|
946
1041
|
appSchema['definitions'][entityType.name] = {
|
|
947
1042
|
enum: propertyNameArray
|
|
948
1043
|
};
|
|
949
|
-
appSchema['definitions'][
|
|
1044
|
+
appSchema['definitions'][`FieldPath${floorplanSuffix}`].properties.path = {
|
|
950
1045
|
$ref: exports.DEFINITION_LINK_PREFIX + entityType.name
|
|
951
1046
|
};
|
|
952
|
-
appSchema['definitions'][
|
|
1047
|
+
appSchema['definitions'][`CreationFieldKeys${floorplanSuffix}`] = {
|
|
953
1048
|
type: 'object',
|
|
954
1049
|
properties: propertyObject,
|
|
955
1050
|
additionalProperties: false
|
|
956
1051
|
};
|
|
957
|
-
const fields4Dialog = appSchema['definitions'][
|
|
958
|
-
fields4Dialog.properties.fields = {
|
|
959
|
-
$ref: exports.DEFINITION_LINK_PREFIX + 'CreationFieldKeys'
|
|
960
|
-
};
|
|
1052
|
+
const fields4Dialog = appSchema['definitions'][`Fields4Dialog${floorplanSuffix}`];
|
|
1053
|
+
fields4Dialog.properties.fields.$ref = exports.DEFINITION_LINK_PREFIX + `CreationFieldKeys${floorplanSuffix}`;
|
|
961
1054
|
}
|
|
962
1055
|
exports.addFieldsType = addFieldsType;
|
|
963
1056
|
/**
|