@sap/ux-specification 1.71.45 → 1.71.49
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 +77 -7
- package/dist/documentation/runDocu-min.js +1 -1
- package/dist/documentation/styleDocu.css +4 -5
- package/dist/documentation/v2/v2-AnalyticalListPage.html +1 -1
- package/dist/documentation/v2/v2-ApplicationV2.html +1 -1
- package/dist/documentation/v2/v2-ListReport.html +1 -1
- package/dist/documentation/v2/v2-ObjectPage.html +1 -1
- package/dist/documentation/v2/v2-OverviewPage.html +1 -1
- package/dist/index-min.js +1 -1
- package/dist/schemas/v2/AnalyticalListPageConfig.json +35 -38
- package/dist/schemas/v2/ListReportConfig.json +36 -28
- package/dist/schemas/v2/ObjectPageConfig.json +181 -48
- package/dist/schemas/v2/OverviewPageConfig.json +236 -190
- package/dist/scripts/extractDocu.js +18 -8
- package/dist/scripts/extractDocu.js.map +1 -1
- package/dist/scripts/runDocu.js +105 -89
- package/dist/scripts/runDocu.js.map +1 -1
- package/dist/scripts/to-json-schema.js +9 -1
- package/dist/scripts/to-json-schema.js.map +1 -1
- package/dist/specification/v2/index-min.js +1 -1
- package/dist/src/specification/common/types.d.ts +4 -0
- package/dist/src/specification/common/types.js +5 -0
- package/dist/src/specification/common/types.js.map +1 -1
- package/dist/src/specification/v2/controls/{FormAction.d.ts → Action.d.ts} +29 -2
- package/dist/src/specification/v2/controls/{FormAction.js → Action.js} +1 -1
- package/dist/src/specification/v2/controls/Action.js.map +1 -0
- package/dist/src/specification/v2/controls/Card.d.ts +20 -72
- package/dist/src/specification/v2/controls/Card.js.map +1 -1
- package/dist/src/specification/v2/controls/FilterBar.d.ts +4 -0
- package/dist/src/specification/v2/controls/ObjectPageFooter.d.ts +2 -2
- package/dist/src/specification/v2/controls/{ObjectPageHeaderAction.d.ts → ObjectPageFooterAction.d.ts} +4 -3
- package/dist/src/specification/v2/controls/{ObjectPageHeaderAction.js → ObjectPageFooterAction.js} +1 -1
- package/dist/src/specification/v2/controls/ObjectPageFooterAction.js.map +1 -0
- package/dist/src/specification/v2/controls/ObjectPageForm.d.ts +1 -2
- package/dist/src/specification/v2/controls/ObjectPageHeader.d.ts +1 -1
- package/dist/src/specification/v2/controls/ObjectPageTable.d.ts +5 -0
- package/dist/src/specification/v2/controls/ObjectPageTable.js.map +1 -1
- package/dist/src/specification/v2/controls/ObjectPageToolBar.d.ts +1 -5
- package/dist/src/specification/v2/controls/Table.d.ts +6 -9
- package/dist/src/specification/v2/controls/Table.js.map +1 -1
- package/dist/src/specification/v2/controls/ToolBar.d.ts +2 -2
- package/dist/src/specification/v2/controls/index.d.ts +8 -9
- package/dist/src/specification/v2/controls/index.js +3 -3
- package/dist/src/specification/v2/controls/index.js.map +1 -1
- package/dist/src/sync/common/generate/index.d.ts +1 -0
- package/dist/src/sync/common/generate/index.js +1 -0
- package/dist/src/sync/common/generate/index.js.map +1 -1
- package/dist/src/sync/common/generate/objectPage.js +22 -17
- package/dist/src/sync/common/generate/objectPage.js.map +1 -1
- package/dist/src/sync/common/generate/utils.d.ts +59 -0
- package/dist/src/sync/common/generate/utils.js +192 -0
- package/dist/src/sync/common/generate/utils.js.map +1 -0
- package/dist/src/sync/common/importProject.js +3 -3
- package/dist/src/sync/common/importProject.js.map +1 -1
- package/dist/src/sync/common/utils.d.ts +3 -23
- package/dist/src/sync/common/utils.js +15 -83
- package/dist/src/sync/common/utils.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Action.d.ts +13 -0
- package/dist/src/sync/v2/export/controls/Action.js +74 -0
- package/dist/src/sync/v2/export/controls/Action.js.map +1 -0
- package/dist/src/sync/v2/export/controls/Card.d.ts +3 -7
- package/dist/src/sync/v2/export/controls/Card.js +15 -43
- package/dist/src/sync/v2/export/controls/Card.js.map +1 -1
- package/dist/src/sync/v2/export/controls/FilterBar.d.ts +1 -0
- package/dist/src/sync/v2/export/controls/FilterBar.js +10 -0
- package/dist/src/sync/v2/export/controls/FilterBar.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Fragment.js +5 -4
- package/dist/src/sync/v2/export/controls/Fragment.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageFooterAction.d.ts +8 -0
- package/dist/src/sync/v2/export/controls/ObjectPageFooterAction.js +62 -0
- package/dist/src/sync/v2/export/controls/ObjectPageFooterAction.js.map +1 -0
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js +11 -29
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageTable.d.ts +5 -1
- package/dist/src/sync/v2/export/controls/ObjectPageTable.js +25 -0
- package/dist/src/sync/v2/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageToolBarAction.d.ts +8 -0
- package/dist/src/sync/v2/export/controls/ObjectPageToolBarAction.js +59 -0
- package/dist/src/sync/v2/export/controls/ObjectPageToolBarAction.js.map +1 -0
- package/dist/src/sync/v2/export/controls/Table.d.ts +5 -4
- package/dist/src/sync/v2/export/controls/Table.js +16 -21
- package/dist/src/sync/v2/export/controls/Table.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ToolBar.d.ts +4 -0
- package/dist/src/sync/v2/export/controls/ToolBar.js +6 -0
- package/dist/src/sync/v2/export/controls/ToolBar.js.map +1 -0
- package/dist/src/sync/v2/export/controls/index.d.ts +11 -7
- package/dist/src/sync/v2/export/controls/index.js +11 -7
- package/dist/src/sync/v2/export/controls/index.js.map +1 -1
- package/dist/src/sync/v2/export/export.js +1 -1
- package/dist/src/sync/v2/export/export.js.map +1 -1
- package/dist/src/sync/v2/export/exportPage.js +3 -2
- package/dist/src/sync/v2/export/exportPage.js.map +1 -1
- package/dist/src/sync/v2/generate/analyticalListReport.js +6 -3
- package/dist/src/sync/v2/generate/analyticalListReport.js.map +1 -1
- package/dist/src/sync/v2/generate/listReport.d.ts +8 -0
- package/dist/src/sync/v2/generate/listReport.js +18 -4
- package/dist/src/sync/v2/generate/listReport.js.map +1 -1
- package/dist/src/sync/v2/generate/objectPage.d.ts +0 -1
- package/dist/src/sync/v2/generate/objectPage.js +199 -106
- package/dist/src/sync/v2/generate/objectPage.js.map +1 -1
- package/dist/src/sync/v2/generate/utils.d.ts +3 -3
- package/dist/src/sync/v2/generate/utils.js +22 -14
- package/dist/src/sync/v2/generate/utils.js.map +1 -1
- package/dist/src/sync/v2/import/common/index.d.ts +8 -1
- package/dist/src/sync/v2/import/common/index.js +107 -43
- package/dist/src/sync/v2/import/common/index.js.map +1 -1
- package/dist/src/sync/v2/import/pages/listReport.js +31 -0
- package/dist/src/sync/v2/import/pages/listReport.js.map +1 -1
- package/dist/src/sync/v2/import/pages/objectPage.d.ts +1 -1
- package/dist/src/sync/v2/import/pages/objectPage.js +302 -235
- package/dist/src/sync/v2/import/pages/objectPage.js.map +1 -1
- package/dist/src/sync/v2/import/utils.d.ts +1 -1
- package/dist/src/sync/v2/import/utils.js +2 -2
- package/dist/src/sync/v2/import/utils.js.map +1 -1
- package/dist/src/sync/v2/types.d.ts +21 -2
- package/dist/src/sync/v2/types.js +7 -0
- package/dist/src/sync/v2/types.js.map +1 -1
- package/package.json +6 -4
- package/dist/src/specification/v2/controls/FormAction.js.map +0 -1
- package/dist/src/specification/v2/controls/ObjectPageHeaderAction.js.map +0 -1
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { GenerateAppSchemaParameters } from '../../../v2';
|
|
2
|
+
import { ConverterOutput, EntityType } from '@sap-ux/vocabularies-types';
|
|
3
|
+
/**
|
|
4
|
+
* Adds the enum types for QuickVariant and QuickVariantX, based on the entity type annotations
|
|
5
|
+
* @param {EntityType} entityType
|
|
6
|
+
* @param appSchema - app specific JSON schema
|
|
7
|
+
* @param {ConverterOutput} oDataServiceAVT - combined service metadata, as returned by annotation vocabularies tools
|
|
8
|
+
*/
|
|
9
|
+
export declare function addEnumForVariantPaths(entityType: EntityType, appSchema: object, oDataServiceAVT: ConverterOutput): void;
|
|
2
10
|
/**
|
|
3
11
|
* Generates an app specific schema for the FE V2 Listreport from the generic schema.
|
|
4
12
|
* Generic types are replaced by information from the app specific annotations.
|
|
@@ -8,8 +8,21 @@ const import_1 = require("../import");
|
|
|
8
8
|
const common_1 = require("../../common");
|
|
9
9
|
const i18next_1 = __importDefault(require("i18next"));
|
|
10
10
|
const i18n_1 = require("../../../i18n/i18n");
|
|
11
|
-
const v2_1 = require("../../../v2");
|
|
12
11
|
const types_1 = require("../types");
|
|
12
|
+
const v2_1 = require("../../../v2");
|
|
13
|
+
const extensionLogger_1 = require("../../../extensionLogger");
|
|
14
|
+
/**
|
|
15
|
+
* Adds the enum types for QuickVariant and QuickVariantX, based on the entity type annotations
|
|
16
|
+
* @param {EntityType} entityType
|
|
17
|
+
* @param appSchema - app specific JSON schema
|
|
18
|
+
* @param {ConverterOutput} oDataServiceAVT - combined service metadata, as returned by annotation vocabularies tools
|
|
19
|
+
*/
|
|
20
|
+
function addEnumForVariantPaths(entityType, appSchema, oDataServiceAVT) {
|
|
21
|
+
common_1.addEnumForSingleTabVariant(entityType, appSchema, 'QuickVariant');
|
|
22
|
+
common_1.addEnumForMultiTabVariant(oDataServiceAVT, appSchema, 'QuickVariantX');
|
|
23
|
+
common_1.addEnumForVariantEntitySet(oDataServiceAVT, appSchema, 'QuickVariantX');
|
|
24
|
+
}
|
|
25
|
+
exports.addEnumForVariantPaths = addEnumForVariantPaths;
|
|
13
26
|
/**
|
|
14
27
|
* Generates an app specific schema for the FE V2 Listreport from the generic schema.
|
|
15
28
|
* Generic types are replaced by information from the app specific annotations.
|
|
@@ -47,9 +60,9 @@ function generateListReportSchemaV2(generateParameters, genericSchema, entityTyp
|
|
|
47
60
|
appSchema['definitions'][types_1.ANALYTICALTABLE].properties.toolBar.$ref = lrToolBar;
|
|
48
61
|
appSchema['definitions'][types_1.GRIDTABLE] = gridTableDefinition;
|
|
49
62
|
appSchema['definitions'][types_1.GRIDTABLE].properties.toolBar.$ref = lrToolBar;
|
|
50
|
-
const entityType = generateParameters.serviceAVT.entityTypes.find((et) => et.name === entityTypeName);
|
|
63
|
+
const entityType = generateParameters === null || generateParameters === void 0 ? void 0 : generateParameters.serviceAVT.entityTypes.find((et) => et.name === entityTypeName);
|
|
51
64
|
if (!entityType) {
|
|
52
|
-
|
|
65
|
+
extensionLogger_1.log(generateParameters.logger, {
|
|
53
66
|
severity: "error" /* Error */,
|
|
54
67
|
message: i18next_1.default.t('NOENTITYTYPE', { entityType: entityTypeName }),
|
|
55
68
|
location: {
|
|
@@ -64,7 +77,7 @@ function generateListReportSchemaV2(generateParameters, genericSchema, entityTyp
|
|
|
64
77
|
const pageKeys = [];
|
|
65
78
|
const v2Page = import_1.findListReportPageV2(generateParameters.manifest[v2_1.ManifestSection.generic].pages, pageKeys);
|
|
66
79
|
if (!v2Page) {
|
|
67
|
-
|
|
80
|
+
extensionLogger_1.log(generateParameters.logger, {
|
|
68
81
|
severity: "error" /* Error */,
|
|
69
82
|
message: i18next_1.default.t('NOALP'),
|
|
70
83
|
location: {
|
|
@@ -75,6 +88,7 @@ function generateListReportSchemaV2(generateParameters, genericSchema, entityTyp
|
|
|
75
88
|
return;
|
|
76
89
|
}
|
|
77
90
|
utils_1.addListReportColumnExtensions(appSchema, entityType, v2Page, generateParameters.manifest, generateParameters.fragments);
|
|
91
|
+
addEnumForVariantPaths(entityType, appSchema, generateParameters.serviceAVT);
|
|
78
92
|
//Delete generic definitions
|
|
79
93
|
delete appSchema['definitions']['ResponsiveTableWithMultiSelect'];
|
|
80
94
|
delete appSchema['definitions']['ResponsiveTableWithInlineDelete'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listReport.js","sourceRoot":"","sources":["../../../../../src/sync/v2/generate/listReport.ts"],"names":[],"mappings":";;;;;AAAA,mCAA0E;AAC1E,sCAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"listReport.js","sourceRoot":"","sources":["../../../../../src/sync/v2/generate/listReport.ts"],"names":[],"m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AAE;YACT,qBAAG,CAAC,kBAAkB,CAAC,MAAM,EAAE;gBAC3B,QAAQ,qBAAmB;gBAC3B,OAAO,EAAE,iBAAO,CAAC,CAAC,CAAC,OAAO,CAAC;gBAC3B,QAAQ,EAAE;oBACN,IAAI,EAAE,iBAAY;oBAClB,KAAK,EAAE,CAAC,oBAAe,CAAC,OAAO,CAAC;iBACnC;aACJ,CAAC,CAAC;YACH,OAAO;SACV;QACD,qCAA6B,CACzB,SAAS,EACT,UAAU,EACV,MAAM,EACN,kBAAkB,CAAC,QAAQ,EAC3B,kBAAkB,CAAC,SAAS,CAC/B,CAAC;QAEF,sBAAsB,CAAC,UAAU,EAAE,SAAS,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAE7E,4BAA4B;QAC5B,OAAO,SAAS,CAAC,aAAa,CAAC,CAAC,gCAAgC,CAAC,CAAC;QAClE,OAAO,SAAS,CAAC,aAAa,CAAC,CAAC,iCAAiC,CAAC,CAAC;QACnE,OAAO,SAAS,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,CAAC;QAC7C,OAAO,SAAS,CAAC,aAAa,CAAC,CAAC,iBAAiB,CAAC,CAAC;QACnD,OAAO,SAAS,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,CAAC;QAC7C,OAAO,SAAS,CAAC,aAAa,CAAC,CAAC,gBAAgB,CAAC,CAAC;QAClD,OAAO,SAAS,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC;QAC3C,OAAO,SAAS,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC;KAC9C;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAvFD,gEAuFC"}
|
|
@@ -5,7 +5,6 @@ export interface ObjectPageSectionData {
|
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Generates an app specific schema out of the generic schema.
|
|
8
|
-
* Generic types are replaced by information from the app specific annotations.
|
|
9
8
|
* @param {GenerateSchemaParameters} generateParameters - list of API input parameters
|
|
10
9
|
* @param genericSchema - generic JSON schema of an object page
|
|
11
10
|
* @param entityTypeName - the base entity type of the given page
|
|
@@ -7,6 +7,7 @@ const common_1 = require("../../common");
|
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
8
|
const import_1 = require("../import");
|
|
9
9
|
const v2_1 = require("../../../v2");
|
|
10
|
+
const extensionLogger_1 = require("../../../extensionLogger");
|
|
10
11
|
const common_2 = require("../../../specification/common");
|
|
11
12
|
const i18next_1 = __importDefault(require("i18next"));
|
|
12
13
|
const i18n_1 = require("../../../i18n/i18n");
|
|
@@ -60,7 +61,7 @@ function addHeaderActionCallBackV2(entityType, appSchema, actionAnnotation, head
|
|
|
60
61
|
const action = common_1.replaceAlias(item.Action, oDataServiceAVT);
|
|
61
62
|
const { actionName, actionId } = common_1.getActionNameAndId(action, entityType);
|
|
62
63
|
const description = item.Label || actionName;
|
|
63
|
-
const actionDefinitionKey = `HeaderAction<${actionId}>`;
|
|
64
|
+
const actionDefinitionKey = `HeaderAction<${common_1.prepareRef(actionId)}>`;
|
|
64
65
|
appSchema['definitions'][actionDefinitionKey] = JSON.parse(JSON.stringify(appSchema['definitions']['HeaderAction']));
|
|
65
66
|
const convertedIdentification = actionAnnotation.fullyQualifiedName.replace(`@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`, `/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`);
|
|
66
67
|
appSchema['definitions'][actionDefinitionKey].annotationPath = `/${convertedIdentification}/${index}`;
|
|
@@ -78,14 +79,31 @@ function addHeaderActionCallBackV2(entityType, appSchema, actionAnnotation, head
|
|
|
78
79
|
* @param {string} entitySetName Entity set name.
|
|
79
80
|
* @param {string} entityTypeName Entity type name.
|
|
80
81
|
* @param {ConverterOutput} oDataServiceAVT Complete service information, as returned by annotation vocabularies tool
|
|
82
|
+
* @param {FacetConfig} facet information
|
|
83
|
+
* @param {string} facetKey - key of the facet, as listed in FacetConfigs
|
|
81
84
|
* @param {FileData[]} [fragments] Array with XML fragments.
|
|
82
85
|
* @return {string} Name of custom columns definition.
|
|
83
86
|
*/
|
|
84
|
-
function ensureCustomColumnDefinitionExists(appSchema, manifest, entitySetName, entityTypeName, oDataServiceAVT, fragments) {
|
|
85
|
-
|
|
87
|
+
function ensureCustomColumnDefinitionExists(appSchema, manifest, entitySetName, entityTypeName, oDataServiceAVT, facet, facetKey, fragments) {
|
|
88
|
+
let suffix, customColumnsDefinitionName;
|
|
89
|
+
if (facet.ID && facet.Label) {
|
|
90
|
+
suffix = facet.ID + facet.Label.replace(/\s+/g, '');
|
|
91
|
+
}
|
|
92
|
+
else if (facet.ID) {
|
|
93
|
+
suffix = facet.ID;
|
|
94
|
+
}
|
|
95
|
+
else if (facet.Label) {
|
|
96
|
+
suffix = facet.Label.replace(/\s+/g, '');
|
|
97
|
+
}
|
|
98
|
+
if (suffix) {
|
|
99
|
+
customColumnsDefinitionName = `${utils_1.CUSTOM_COLUMNS_DEFINITION}<${entitySetName}><${facetKey}><${suffix}>`;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
customColumnsDefinitionName = `${utils_1.CUSTOM_COLUMNS_DEFINITION}<${entitySetName}><${facetKey}>`;
|
|
103
|
+
}
|
|
86
104
|
if (appSchema['definitions'][customColumnsDefinitionName]) {
|
|
87
105
|
// Definition is already created - we do not need to create it again
|
|
88
|
-
return
|
|
106
|
+
return customColumnsDefinitionName;
|
|
89
107
|
}
|
|
90
108
|
// Create type specific 'TableCustomColumn' definition - use entity set as type.
|
|
91
109
|
const customColumnDefinitionName = `${utils_1.CUSTOM_COLUMN_DEFINITION}<${entitySetName}>`;
|
|
@@ -98,6 +116,53 @@ function ensureCustomColumnDefinitionExists(appSchema, manifest, entitySetName,
|
|
|
98
116
|
utils_1.addListReportColumnExtensions(appSchema, entityType, v2Page, manifest, fragments, customColumnsDefinitionName, customColumnDefinitionName);
|
|
99
117
|
return customColumnsDefinitionName;
|
|
100
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Method fills new app schema section with properties.
|
|
121
|
+
* @param {object} appSchema App schema in general
|
|
122
|
+
* @param {object} appSchemaSection app schema section to be filled
|
|
123
|
+
* @param {FacetConfig} facet facet or section information
|
|
124
|
+
* @param {SectionTypeV2} sectionType (sub)section type
|
|
125
|
+
* @param {SectionTypeV2} mainSectionType main section type, used to fill app schema section
|
|
126
|
+
* @return {boolean} returns false in case further handling is required.
|
|
127
|
+
*/
|
|
128
|
+
function addAppSchemaDefinition(appSchema, appSchemaSection, facet, sectionType, mainSectionType) {
|
|
129
|
+
var _a;
|
|
130
|
+
if ((facet === null || facet === void 0 ? void 0 : facet.ID) || ((_a = facet === null || facet === void 0 ? void 0 : facet.target) === null || _a === void 0 ? void 0 : _a['qualifier'])) {
|
|
131
|
+
appSchemaSection['properties'] = JSON.parse(JSON.stringify(appSchema['definitions'][mainSectionType]['properties']));
|
|
132
|
+
if (appSchemaSection['properties'].visible) {
|
|
133
|
+
addFlexChangeForSection(appSchema, appSchemaSection, 'visible', sectionType);
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Method adds title and description to app schema section in case facet information is available.
|
|
143
|
+
* @param {object} appSchemaSection app schema section to be filled
|
|
144
|
+
* @param {FacetConfig} facet facet or section information
|
|
145
|
+
*/
|
|
146
|
+
function addFacetTitleDescription(appSchemaSection, facet) {
|
|
147
|
+
if (facet === null || facet === void 0 ? void 0 : facet.ID) {
|
|
148
|
+
appSchemaSection['title'] = common_1.FacetTitlePrefix + facet.ID;
|
|
149
|
+
}
|
|
150
|
+
if (facet === null || facet === void 0 ? void 0 : facet.Label) {
|
|
151
|
+
appSchemaSection['description'] = facet.Label;
|
|
152
|
+
}
|
|
153
|
+
if (!appSchemaSection['description']) {
|
|
154
|
+
appSchemaSection['description'] = facet.base;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Method adds reference to section property key.
|
|
159
|
+
* @param {object} sections - schema of current sections definition
|
|
160
|
+
* @param {string} key section key which will contain the reference
|
|
161
|
+
* @param {string} definitionKey key which the section should point to
|
|
162
|
+
*/
|
|
163
|
+
function addSectionReference(sections, key, definitionKey) {
|
|
164
|
+
sections['properties'][key] = { $ref: `${common_1.DEFINITION_LINK_PREFIX}${definitionKey}` };
|
|
165
|
+
}
|
|
101
166
|
/**
|
|
102
167
|
* Reuse function for all table types, copies and adapts the generic definition
|
|
103
168
|
* @param tableType - Table type
|
|
@@ -106,7 +171,7 @@ function ensureCustomColumnDefinitionExists(appSchema, manifest, entitySetName,
|
|
|
106
171
|
* @param appSchema - app-specific schema, to be updated
|
|
107
172
|
*/
|
|
108
173
|
function addTableDefinition(tableType, facetId, facet, appSchema) {
|
|
109
|
-
const schemaId = `${tableType}<${facetId}
|
|
174
|
+
const schemaId = common_1.prepareRef(`${tableType}<${facetId}>`);
|
|
110
175
|
appSchema['definitions'][schemaId] = JSON.parse(JSON.stringify(appSchema['definitions'][tableType]));
|
|
111
176
|
appSchema['definitions'][schemaId]['properties']['columns']['$ref'] = common_1.DEFINITION_LINK_PREFIX + facetId;
|
|
112
177
|
appSchema['definitions'][schemaId].properties.toolBar.$ref = `${common_1.DEFINITION_LINK_PREFIX}ObjectPageToolBar<${facetId}>`;
|
|
@@ -115,87 +180,80 @@ function addTableDefinition(tableType, facetId, facet, appSchema) {
|
|
|
115
180
|
appSchema['definitions'][schemaId].title = common_1.FacetTitlePrefix + facet.ID;
|
|
116
181
|
}
|
|
117
182
|
appSchema['definitions'][schemaId].description = 'Table';
|
|
183
|
+
//adjust quickVariantSelection
|
|
184
|
+
appSchema['definitions'][schemaId].properties['quickVariantSelection'].$ref = `${common_1.DEFINITION_LINK_PREFIX}QuickVariantSelectionOP<${facetId}>`;
|
|
185
|
+
appSchema['definitions'][`QuickVariantSelectionOP<${facetId}>`] = JSON.parse(JSON.stringify(appSchema['definitions']['QuickVariantSelectionOP']));
|
|
186
|
+
appSchema['definitions'][`QuickVariant<${facetId}>`] = JSON.parse(JSON.stringify(appSchema['definitions']['QuickVariant']));
|
|
187
|
+
appSchema['definitions'][`QuickVariantSelectionOP<${facetId}>`].properties.variants.patternProperties['^[0-9]+$'].$ref = `${common_1.DEFINITION_LINK_PREFIX}QuickVariant<${facetId}>`;
|
|
188
|
+
common_1.addEnumForSingleTabVariant(facet.entityType, appSchema, `QuickVariant<${facetId}>`);
|
|
118
189
|
}
|
|
119
190
|
/**
|
|
120
191
|
* Adds definitions for line items in object page sections to the app schema
|
|
121
192
|
* @param {GenerateSchemaParameters} generateParameters - list of API input parameters
|
|
122
|
-
* @param {string}
|
|
193
|
+
* @param {string} facetKey - key of the facet, as listed in FacetConfigs
|
|
123
194
|
* @param {object} appSchema - app schema in general
|
|
124
195
|
* @param {FacetConfig} facet - the given facet from the UI annotations
|
|
125
196
|
* @param {FacetConfigs} facets - list of all facets
|
|
197
|
+
* @param {SectionTypeV2} sectionType (sub)section type
|
|
126
198
|
*/
|
|
127
|
-
function handleLineItem(generateParameters,
|
|
128
|
-
|
|
129
|
-
if (facet.base !== 'LineItem' || !facetId) {
|
|
199
|
+
function handleLineItem(generateParameters, facetKey, appSchema, facet, facets, sectionType) {
|
|
200
|
+
if (facet.base !== 'LineItem' || !facetKey) {
|
|
130
201
|
//no properties
|
|
131
202
|
return;
|
|
132
203
|
}
|
|
133
|
-
const navigationProperty =
|
|
134
|
-
const schemaIdForOpSection = `${sectionType}<${
|
|
135
|
-
appSchema['definitions'][schemaIdForOpSection] = common_1.createSectionWithoutProperties(facet,
|
|
204
|
+
const navigationProperty = facetKey.split('::')[0];
|
|
205
|
+
const schemaIdForOpSection = `${sectionType}<${facetKey}>`;
|
|
206
|
+
appSchema['definitions'][schemaIdForOpSection] = common_1.createSectionWithoutProperties(facet, facetKey);
|
|
136
207
|
const appSchemaSection = appSchema['definitions'][schemaIdForOpSection];
|
|
137
|
-
if (
|
|
138
|
-
appSchemaSection.properties = JSON.parse(JSON.stringify(appSchema['definitions'][types_1.SectionTypeV2.SectionTable]['properties']));
|
|
139
|
-
if (appSchemaSection.properties.visible) {
|
|
140
|
-
addFlexChangeForSection(appSchema, appSchemaSection, 'visible', sectionType);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
208
|
+
if (!addAppSchemaDefinition(appSchema, appSchemaSection, facet, sectionType, types_1.SectionTypeV2.SectionTable)) {
|
|
144
209
|
appSchemaSection.properties.table = JSON.parse(JSON.stringify(appSchema['definitions'][types_1.SectionTypeV2.SectionTable]['properties']['table']));
|
|
145
210
|
}
|
|
146
211
|
appSchemaSection.properties.table.anyOf = [
|
|
147
212
|
{
|
|
148
|
-
$ref: `${common_1.DEFINITION_LINK_PREFIX}ObjectPageResponsiveTable<${
|
|
213
|
+
$ref: `${common_1.DEFINITION_LINK_PREFIX}ObjectPageResponsiveTable<${facetKey}>`
|
|
149
214
|
},
|
|
150
215
|
{
|
|
151
|
-
$ref: `${common_1.DEFINITION_LINK_PREFIX}ObjectPageAnalyticalTable<${
|
|
216
|
+
$ref: `${common_1.DEFINITION_LINK_PREFIX}ObjectPageAnalyticalTable<${facetKey}>`
|
|
152
217
|
},
|
|
153
218
|
{
|
|
154
|
-
$ref: `${common_1.DEFINITION_LINK_PREFIX}ObjectPageGridTable<${
|
|
219
|
+
$ref: `${common_1.DEFINITION_LINK_PREFIX}ObjectPageGridTable<${facetKey}>`
|
|
155
220
|
},
|
|
156
221
|
{
|
|
157
|
-
$ref: `${common_1.DEFINITION_LINK_PREFIX}ObjectPageTreeTable<${
|
|
222
|
+
$ref: `${common_1.DEFINITION_LINK_PREFIX}ObjectPageTreeTable<${facetKey}>`
|
|
158
223
|
}
|
|
159
224
|
];
|
|
160
225
|
appSchemaSection.annotationPath = facet.annotationPath;
|
|
161
|
-
common_1.addSectionTitleAndDescription(facet, appSchemaSection,
|
|
226
|
+
common_1.addSectionTitleAndDescription(facet, appSchemaSection, facetKey);
|
|
162
227
|
// Find target entity
|
|
163
228
|
const targetEntity = facet.entityType
|
|
164
|
-
? generateParameters.serviceAVT.entitySets.find((es) => es.entityType.name === facet.entityType.name || es.name === facet.entityType.name)
|
|
165
|
-
|
|
166
|
-
addTableDefinition('
|
|
167
|
-
addTableDefinition('
|
|
168
|
-
addTableDefinition('
|
|
169
|
-
addTableDefinition('ObjectPageAnalyticalTable', facetId, facet, appSchema);
|
|
229
|
+
? generateParameters === null || generateParameters === void 0 ? void 0 : generateParameters.serviceAVT.entitySets.find((es) => es.entityType.name === facet.entityType.name || es.name === facet.entityType.name) : undefined;
|
|
230
|
+
addTableDefinition('ObjectPageResponsiveTable', facetKey, facet, appSchema);
|
|
231
|
+
addTableDefinition('ObjectPageGridTable', facetKey, facet, appSchema);
|
|
232
|
+
addTableDefinition('ObjectPageTreeTable', facetKey, facet, appSchema);
|
|
233
|
+
addTableDefinition('ObjectPageAnalyticalTable', facetKey, facet, appSchema);
|
|
170
234
|
let customColumnDefinitionKey;
|
|
171
235
|
if (targetEntity) {
|
|
172
236
|
// Make sure that custom columns definitions are created for passed entity
|
|
173
|
-
customColumnDefinitionKey = ensureCustomColumnDefinitionExists(appSchema, generateParameters.manifest, targetEntity.name, facet.entityType.name, generateParameters.serviceAVT, generateParameters.fragments);
|
|
237
|
+
customColumnDefinitionKey = ensureCustomColumnDefinitionExists(appSchema, generateParameters.manifest, targetEntity.name, facet.entityType.name, generateParameters === null || generateParameters === void 0 ? void 0 : generateParameters.serviceAVT, facet, facetKey, generateParameters.fragments);
|
|
174
238
|
}
|
|
175
239
|
for (const facetKey in facets) {
|
|
176
240
|
if (facets[facetKey].base === 'LineItem' && facetKey.includes(navigationProperty)) {
|
|
177
|
-
utils_1.addLineItemsType(appSchema, facets[facetKey].target, facets[facetKey].entityType,
|
|
241
|
+
utils_1.addLineItemsType(appSchema, facets[facetKey].target, facets[facetKey].entityType, facetKey, customColumnDefinitionKey);
|
|
178
242
|
}
|
|
179
243
|
}
|
|
180
244
|
}
|
|
181
245
|
/**
|
|
182
246
|
* Adds definitions for subsections in object page sections to the app schema
|
|
183
|
-
* @param
|
|
184
|
-
* @param
|
|
185
|
-
* @param facet
|
|
186
|
-
* @param
|
|
247
|
+
* @param {object} appSchema - app schema in general
|
|
248
|
+
* @param {string} definitionKey - key of app schema definition to be filled
|
|
249
|
+
* @param {FacetConfig} facet facet or section information
|
|
250
|
+
* @param {string} facetId - key of the facet, as listed in FacetConfigs
|
|
251
|
+
* @param {SectionTypeV2} sectionType (sub)section type
|
|
187
252
|
*/
|
|
188
|
-
function handleSubSection(
|
|
189
|
-
const schemaIdForSection = facetId.replace(`@${"com.sap.vocabularies.UI.v1.Facets" /* Facets */}`, facet.base);
|
|
190
|
-
const definitionKey = `${sectionType}<${schemaIdForSection}>`;
|
|
253
|
+
function handleSubSection(appSchema, definitionKey, facet, facetId, sectionType) {
|
|
191
254
|
appSchema['definitions'][definitionKey] = common_1.createSectionWithoutProperties(facet, facetId);
|
|
192
255
|
const appSchemaSection = appSchema['definitions'][definitionKey];
|
|
193
|
-
|
|
194
|
-
appSchemaSection.properties = JSON.parse(JSON.stringify(appSchema['definitions'][types_1.SectionTypeV2.SubSection]['properties']));
|
|
195
|
-
if (appSchemaSection.properties.visible) {
|
|
196
|
-
addFlexChangeForSection(appSchema, appSchemaSection, 'visible', sectionType);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
256
|
+
addAppSchemaDefinition(appSchema, appSchemaSection, facet, sectionType, types_1.SectionTypeV2.SubSection);
|
|
199
257
|
appSchemaSection.properties.subsections = {
|
|
200
258
|
type: 'object',
|
|
201
259
|
description: 'Subsections',
|
|
@@ -204,6 +262,79 @@ function handleSubSection(facetId, appSchema, facet, sectionType) {
|
|
|
204
262
|
isViewNode: true
|
|
205
263
|
};
|
|
206
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Method fills new chart section with properties.
|
|
267
|
+
* @param {object} appSchema App schema in general
|
|
268
|
+
* @param {string} definitionKey - key of app schema definition to be filled
|
|
269
|
+
* @param {FacetConfig} facet facet or section information
|
|
270
|
+
* @param {string} facetKey - facet key.
|
|
271
|
+
* @param {SectionTypeV2} sectionType (sub)section type
|
|
272
|
+
*/
|
|
273
|
+
function handleSectionChart(appSchema, definitionKey, facet, facetKey, sectionType) {
|
|
274
|
+
appSchema['definitions'][definitionKey] = common_1.createSectionWithoutProperties(facet, facetKey);
|
|
275
|
+
const appSchemaSection = appSchema['definitions'][definitionKey];
|
|
276
|
+
addAppSchemaDefinition(appSchema, appSchemaSection, facet, sectionType, types_1.SectionTypeV2.SectionChart);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Method fills new form section in app schema with properties.
|
|
280
|
+
* @param {object} appSchema App schema in general
|
|
281
|
+
* @param {string} definitionKey - key of app schema definition to be filled
|
|
282
|
+
* @param {FacetConfig} facet facet or section information
|
|
283
|
+
* @param {string} facetKey - facet key.
|
|
284
|
+
* @param {SectionTypeV2} sectionType (sub)section type
|
|
285
|
+
* @return {object} returns filled form section in app schema.
|
|
286
|
+
*/
|
|
287
|
+
function handleAppSchemaFormSection(appSchema, definitionKey, facet, facetKey, sectionType) {
|
|
288
|
+
appSchema['definitions'][definitionKey] = common_1.createSectionWithoutProperties(facet, facetKey);
|
|
289
|
+
const appSchemaSection = appSchema['definitions'][definitionKey];
|
|
290
|
+
addAppSchemaDefinition(appSchema, appSchemaSection, facet, sectionType, types_1.SectionTypeV2.SectionForm);
|
|
291
|
+
addFacetTitleDescription(appSchemaSection, facet);
|
|
292
|
+
appSchemaSection.annotationPath = facet.annotationPath;
|
|
293
|
+
appSchemaSection.isViewNode = true;
|
|
294
|
+
return appSchemaSection;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Mapping of facet type to (sub)section type to enable correct further handling
|
|
298
|
+
* @param {FacetBase} facetType - facet type to be mapped
|
|
299
|
+
* @param {boolean} isSubSection - if section is subsection of section
|
|
300
|
+
* @return {SectionTypeV2} sectionType (sub)section type
|
|
301
|
+
*/
|
|
302
|
+
function getSectionType(facetType, isSubSection) {
|
|
303
|
+
const sectionTypeMapping = new Map([
|
|
304
|
+
[v2_1.FacetBase.CollectionFacet, types_1.SectionTypeV2.Section],
|
|
305
|
+
[v2_1.FacetBase.LineItem, types_1.SectionTypeV2.SectionTable],
|
|
306
|
+
[v2_1.FacetBase.Chart, types_1.SectionTypeV2.SectionChart],
|
|
307
|
+
[v2_1.FacetBase.Form, types_1.SectionTypeV2.SectionForm],
|
|
308
|
+
[v2_1.FacetBase.Identification, types_1.SectionTypeV2.SectionForm]
|
|
309
|
+
]);
|
|
310
|
+
const subSectionTypeMapping = new Map([
|
|
311
|
+
[v2_1.FacetBase.CollectionFacet, types_1.SectionTypeV2.SubSection],
|
|
312
|
+
[v2_1.FacetBase.LineItem, types_1.SectionTypeV2.SubSectionTable],
|
|
313
|
+
[v2_1.FacetBase.Chart, types_1.SectionTypeV2.SubSectionChart],
|
|
314
|
+
[v2_1.FacetBase.Form, types_1.SectionTypeV2.SubSectionForm],
|
|
315
|
+
[v2_1.FacetBase.Identification, types_1.SectionTypeV2.SubSectionForm]
|
|
316
|
+
]);
|
|
317
|
+
if (isSubSection) {
|
|
318
|
+
return subSectionTypeMapping.get(facetType);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
return sectionTypeMapping.get(facetType);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Method returns reference key, special handling of (sub)sections
|
|
326
|
+
* @param {FacetConfig} facet facet or section information
|
|
327
|
+
* @param {string} facetKey - facet key.
|
|
328
|
+
* @param {SectionTypeV2} sectionType (sub)section type
|
|
329
|
+
* @return {string} reference key
|
|
330
|
+
*/
|
|
331
|
+
function getReferenceKey(facet, facetKey, sectionType) {
|
|
332
|
+
let referenceKey = facetKey;
|
|
333
|
+
if (sectionType === (types_1.SectionTypeV2.Section || types_1.SectionTypeV2.SubSection)) {
|
|
334
|
+
referenceKey = referenceKey.replace(`@${"com.sap.vocabularies.UI.v1.Facets" /* Facets */}`, facet.base);
|
|
335
|
+
}
|
|
336
|
+
return `${referenceKey}`;
|
|
337
|
+
}
|
|
207
338
|
/**
|
|
208
339
|
* Creates a section definition in app schema.
|
|
209
340
|
* @param {GenerateSchemaParameters} generateParameters - list of API input parameters
|
|
@@ -211,67 +342,35 @@ function handleSubSection(facetId, appSchema, facet, sectionType) {
|
|
|
211
342
|
* @param {string} facetKey - facet key.
|
|
212
343
|
* @param {object} sections - schema of current sections definition.
|
|
213
344
|
* @param {object} appSchema - app specific schema that potentially gets enhanced.
|
|
345
|
+
* @param {boolean} isSubSection - if section is subsection of section
|
|
214
346
|
*/
|
|
215
347
|
function addSection(generateParameters, facets, facetKey, sections, appSchema, isSubSection = false) {
|
|
216
|
-
var _a;
|
|
217
348
|
const facet = facets[facetKey];
|
|
218
|
-
|
|
219
|
-
|
|
349
|
+
const sectionType = getSectionType(facet.base, isSubSection);
|
|
350
|
+
const referenceKey = getReferenceKey(facet, facetKey, sectionType);
|
|
351
|
+
const definitionKey = `${sectionType}<${referenceKey}>`;
|
|
352
|
+
addSectionReference(sections, referenceKey, definitionKey);
|
|
353
|
+
switch (sectionType) {
|
|
354
|
+
case types_1.SectionTypeV2.Section:
|
|
355
|
+
case types_1.SectionTypeV2.SubSection: {
|
|
220
356
|
//handle collection facets
|
|
221
|
-
const sectionType = (sections === null || sections === void 0 ? void 0 : sections['description']) === 'Subsections' ? types_1.SectionTypeV2.SubSection : types_1.SectionTypeV2.Section;
|
|
222
|
-
const schemaIdForSection = facetKey.replace(`@${"com.sap.vocabularies.UI.v1.Facets" /* Facets */}`, facet.base);
|
|
223
357
|
isSubSection = true;
|
|
224
|
-
|
|
225
|
-
sections['properties'][schemaIdForSection] = { $ref: `${common_1.DEFINITION_LINK_PREFIX}${definitionKey}` };
|
|
226
|
-
handleSubSection(facetKey, appSchema, facet, sectionType);
|
|
358
|
+
handleSubSection(appSchema, definitionKey, facet, facetKey, sectionType);
|
|
227
359
|
const subSections = appSchema['definitions'][definitionKey].properties.subsections;
|
|
228
360
|
for (const key in facet['facets']) {
|
|
229
361
|
addSection(generateParameters, facet['facets'], key, subSections, appSchema, isSubSection);
|
|
230
362
|
}
|
|
231
363
|
break;
|
|
232
364
|
}
|
|
233
|
-
case
|
|
234
|
-
|
|
235
|
-
const sectionType = isSubSection ? types_1.SectionTypeV2.SubSectionTable : types_1.SectionTypeV2.SectionTable;
|
|
236
|
-
sections['properties'][facetKey] = {
|
|
237
|
-
$ref: `${common_1.DEFINITION_LINK_PREFIX}${sectionType}<${facetKey}>`
|
|
238
|
-
};
|
|
365
|
+
case types_1.SectionTypeV2.SectionTable:
|
|
366
|
+
case types_1.SectionTypeV2.SubSectionTable: {
|
|
239
367
|
handleLineItem(generateParameters, facetKey, appSchema, facet, facets, sectionType);
|
|
240
368
|
break;
|
|
241
369
|
}
|
|
242
|
-
case
|
|
243
|
-
case
|
|
244
|
-
const
|
|
245
|
-
const
|
|
246
|
-
sections['properties'][facetKey] = {
|
|
247
|
-
$ref: `${common_1.DEFINITION_LINK_PREFIX}${definitionKey}`
|
|
248
|
-
};
|
|
249
|
-
appSchema['definitions'][definitionKey] = common_1.createSectionWithoutProperties(facet, facetKey);
|
|
250
|
-
const appSchemaSection = appSchema['definitions'][definitionKey];
|
|
251
|
-
if ((facet === null || facet === void 0 ? void 0 : facet.ID) || ((_a = facet.target) === null || _a === void 0 ? void 0 : _a['qualifier'])) {
|
|
252
|
-
appSchemaSection['properties'] = JSON.parse(JSON.stringify(appSchema['definitions'][types_1.SectionTypeV2.SectionForm]['properties']));
|
|
253
|
-
if (appSchemaSection.properties.visible) {
|
|
254
|
-
addFlexChangeForSection(appSchema, appSchemaSection, 'visible', sectionType);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
if (facet === null || facet === void 0 ? void 0 : facet.ID) {
|
|
258
|
-
appSchemaSection.title = common_1.FacetTitlePrefix + facet.ID;
|
|
259
|
-
}
|
|
260
|
-
if (facet === null || facet === void 0 ? void 0 : facet.Label) {
|
|
261
|
-
appSchemaSection.description = facet.Label;
|
|
262
|
-
}
|
|
263
|
-
let withActions = true;
|
|
264
|
-
appSchemaSection.annotationPath = facet.annotationPath;
|
|
265
|
-
appSchemaSection.isViewNode = true;
|
|
266
|
-
if (!appSchemaSection.description) {
|
|
267
|
-
if (facet.base === v2_1.FacetBase.Form) {
|
|
268
|
-
appSchemaSection.description = 'Form';
|
|
269
|
-
}
|
|
270
|
-
else if (facet.base === 'Identification') {
|
|
271
|
-
appSchemaSection.description = 'Identification';
|
|
272
|
-
withActions = false;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
370
|
+
case types_1.SectionTypeV2.SectionForm:
|
|
371
|
+
case types_1.SectionTypeV2.SubSectionForm: {
|
|
372
|
+
const withActions = facet.base !== v2_1.FacetBase.Identification;
|
|
373
|
+
const appSchemaSection = handleAppSchemaFormSection(appSchema, definitionKey, facet, facetKey, sectionType);
|
|
275
374
|
common_1.handleForm(v2_1.SectionType.Section, facet, appSchemaSection, appSchema, common_2.FioriElementsVersion.v2, withActions);
|
|
276
375
|
break;
|
|
277
376
|
}
|
|
@@ -286,6 +385,7 @@ function addSection(generateParameters, facets, facetKey, sections, appSchema, i
|
|
|
286
385
|
* @param {GenerateSchemaParameters} generateParameters - list of API input parameters
|
|
287
386
|
* @param {object} appSchema - app specific schema that potentially gets enhanced
|
|
288
387
|
* @param {EntityType} entityType - current entity type
|
|
388
|
+
* @param {string} entitySetName Entity set name
|
|
289
389
|
* @param {SapUiAppPagesV2} pages - list of (manifest) pages
|
|
290
390
|
*/
|
|
291
391
|
function addSections(generateParameters, appSchema, entityType, entitySetName, pages) {
|
|
@@ -304,7 +404,7 @@ function addSections(generateParameters, appSchema, entityType, entitySetName, p
|
|
|
304
404
|
return;
|
|
305
405
|
}
|
|
306
406
|
// Get facet annotations
|
|
307
|
-
const facets = common_1.getObjectPageFacets(entityType, generateParameters.serviceAVT, common_2.FioriElementsVersion.v2, generateParameters.logger);
|
|
407
|
+
const facets = common_1.getObjectPageFacets(entityType, generateParameters === null || generateParameters === void 0 ? void 0 : generateParameters.serviceAVT, common_2.FioriElementsVersion.v2, generateParameters.logger);
|
|
308
408
|
if (!facets || Object.keys(facets).length === 0) {
|
|
309
409
|
return;
|
|
310
410
|
}
|
|
@@ -355,7 +455,6 @@ function addRelatedFacetKeysType(schema, entityType, oDataServiceAVT, logger) {
|
|
|
355
455
|
}
|
|
356
456
|
/**
|
|
357
457
|
* Generates an app specific schema out of the generic schema.
|
|
358
|
-
* Generic types are replaced by information from the app specific annotations.
|
|
359
458
|
* @param {GenerateSchemaParameters} generateParameters - list of API input parameters
|
|
360
459
|
* @param genericSchema - generic JSON schema of an object page
|
|
361
460
|
* @param entityTypeName - the base entity type of the given page
|
|
@@ -375,10 +474,9 @@ function generateObjectPageSchemaV2(generateParameters, genericSchema, entityTyp
|
|
|
375
474
|
appSchema['properties']['sections'] = {
|
|
376
475
|
$ref: common_1.DEFINITION_LINK_PREFIX + 'Sections'
|
|
377
476
|
};
|
|
378
|
-
const entitySet = generateParameters.serviceAVT.entitySets &&
|
|
379
|
-
generateParameters.serviceAVT.entitySets.find((es) => es.entityType.name === entityTypeName || es.name === entityTypeName);
|
|
477
|
+
const entitySet = (generateParameters === null || generateParameters === void 0 ? void 0 : generateParameters.serviceAVT.entitySets) && (generateParameters === null || generateParameters === void 0 ? void 0 : generateParameters.serviceAVT.entitySets.find((es) => es.entityType.name === entityTypeName || es.name === entityTypeName));
|
|
380
478
|
if (!entitySet) {
|
|
381
|
-
|
|
479
|
+
extensionLogger_1.log(generateParameters.logger, {
|
|
382
480
|
severity: "error" /* Error */,
|
|
383
481
|
message: i18next_1.default.t('NOENTITYSET4NAME', { entityType: entityTypeName }),
|
|
384
482
|
location: {
|
|
@@ -390,7 +488,7 @@ function generateObjectPageSchemaV2(generateParameters, genericSchema, entityTyp
|
|
|
390
488
|
const entityType = entitySet === null || entitySet === void 0 ? void 0 : entitySet.entityType;
|
|
391
489
|
const pages = generateParameters.manifest[common_2.ManifestSection.generic].pages;
|
|
392
490
|
if (!pages) {
|
|
393
|
-
|
|
491
|
+
extensionLogger_1.log(generateParameters.logger, {
|
|
394
492
|
severity: "error" /* Error */,
|
|
395
493
|
message: i18next_1.default.t('NOPAGES', { appId: generateParameters.manifest['sap.app']['id'] }),
|
|
396
494
|
location: {
|
|
@@ -401,15 +499,11 @@ function generateObjectPageSchemaV2(generateParameters, genericSchema, entityTyp
|
|
|
401
499
|
return appSchema;
|
|
402
500
|
}
|
|
403
501
|
// Add header
|
|
404
|
-
addHeader(appSchema, entityType, generateParameters.serviceAVT);
|
|
502
|
+
addHeader(appSchema, entityType, generateParameters === null || generateParameters === void 0 ? void 0 : generateParameters.serviceAVT);
|
|
405
503
|
// Add sections
|
|
406
504
|
addSections(generateParameters, appSchema, entityType, entitySet.name, pages);
|
|
407
505
|
// Custom section facets
|
|
408
|
-
addRelatedFacetKeysType(appSchema, entityType, generateParameters.serviceAVT, generateParameters.logger);
|
|
409
|
-
// Remove Custom Column non existing extensions - TreeTableColumnsExtension does not exist in ALP
|
|
410
|
-
utils_1.removeElementsFromEnum(appSchema['definitions']['TableColumnExtensionTypeV2']['enum'], [
|
|
411
|
-
v2_1.TableColumnExtensionTypeV2.TreeTableColumnsExtension
|
|
412
|
-
]);
|
|
506
|
+
addRelatedFacetKeysType(appSchema, entityType, generateParameters === null || generateParameters === void 0 ? void 0 : generateParameters.serviceAVT, generateParameters.logger);
|
|
413
507
|
if (!appSchema['definitions']['Sections']) {
|
|
414
508
|
if (appSchema['definitions']['RelatedFacetKeys'] &&
|
|
415
509
|
appSchema['definitions']['RelatedFacetKeys']['oneOf'].length) {
|
|
@@ -425,7 +519,7 @@ function generateObjectPageSchemaV2(generateParameters, genericSchema, entityTyp
|
|
|
425
519
|
delete appSchema['properties']['sections'];
|
|
426
520
|
}
|
|
427
521
|
}
|
|
428
|
-
common_1.addFooterActions(appSchema, entityType, generateParameters.serviceAVT);
|
|
522
|
+
common_1.addFooterActions(appSchema, entityType, generateParameters === null || generateParameters === void 0 ? void 0 : generateParameters.serviceAVT);
|
|
429
523
|
// Eliminate generic definitions
|
|
430
524
|
delete appSchema['definitions']['GenericSections'];
|
|
431
525
|
delete appSchema['definitions']['ObjectPageSectionTableV2'];
|
|
@@ -439,7 +533,6 @@ function generateObjectPageSchemaV2(generateParameters, genericSchema, entityTyp
|
|
|
439
533
|
delete appSchema['definitions']['ObjectPageGridTable'];
|
|
440
534
|
delete appSchema['definitions']['ObjectPageToolBar'];
|
|
441
535
|
delete appSchema['definitions']['ObjectPageToolBarActions'];
|
|
442
|
-
delete appSchema['definitions']['ObjectPageToolBarAction'];
|
|
443
536
|
delete appSchema['definitions']['ObjectPageForm'];
|
|
444
537
|
delete appSchema['definitions']['ObjectPageFormFields'];
|
|
445
538
|
delete appSchema['definitions']['ObjectPageFormActions'];
|