@sap/ux-specification 1.71.41 → 1.71.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -22
- package/README.md +4 -4
- package/dist/documentation/runDocu-min.js +2 -0
- package/dist/documentation/runDocu-min.js.LICENSE.txt +24 -0
- package/dist/documentation/styleDocu.css +227 -0
- package/dist/documentation/v2/v2-AnalyticalListPage.html +49 -0
- package/dist/documentation/v2/v2-ApplicationV2.html +48 -0
- package/dist/documentation/v2/v2-ListReport.html +49 -0
- package/dist/documentation/v2/v2-ObjectPage.html +49 -0
- package/dist/documentation/v2/v2-OverviewPage.html +49 -0
- package/dist/index-min.js +1 -1
- package/dist/schemas/v2/AnalyticalListPageConfig.json +76 -6
- package/dist/schemas/v2/ApplicationV2.json +6 -0
- package/dist/schemas/v2/ListReportConfig.json +75 -5
- package/dist/schemas/v2/ObjectPageConfig.json +302 -42
- package/dist/schemas/v2/OverviewPageConfig.json +24 -41
- package/dist/scripts/extractDocu.js +186 -19
- package/dist/scripts/extractDocu.js.map +1 -1
- package/dist/scripts/runDocu.d.ts +1 -0
- package/dist/scripts/runDocu.js +561 -0
- package/dist/scripts/runDocu.js.map +1 -0
- package/dist/specification/v2/index-min.js +1 -1
- package/dist/src/api.js +8 -14
- package/dist/src/api.js.map +1 -1
- package/dist/src/apiTypes.d.ts +72 -65
- package/dist/src/extensionLogger.js +2 -2
- package/dist/src/extensionLogger.js.map +1 -1
- package/dist/src/specification/common/page.d.ts +2 -2
- package/dist/src/specification/common/page.js.map +1 -1
- package/dist/src/specification/common/types.d.ts +1 -0
- package/dist/src/specification/common/webapp/manifest/Manifest.d.ts +3 -1
- package/dist/src/specification/common/webapp/manifest/Manifest.js +1 -0
- package/dist/src/specification/common/webapp/manifest/Manifest.js.map +1 -1
- package/dist/src/specification/common/webapp/manifest/sapOvp.d.ts +2 -1
- package/dist/src/specification/v2/ApplicationV2.d.ts +6 -0
- package/dist/src/specification/v2/controls/AnalyticalListPageChart.d.ts +1 -1
- package/dist/src/specification/v2/controls/Card.d.ts +11 -13
- package/dist/src/specification/v2/controls/Card.js +0 -3
- package/dist/src/specification/v2/controls/Card.js.map +1 -1
- package/dist/src/specification/v2/controls/Facets.d.ts +2 -1
- package/dist/src/specification/v2/controls/Field.d.ts +10 -0
- package/dist/src/specification/v2/controls/Field.js +3 -0
- package/dist/src/specification/v2/controls/Field.js.map +1 -0
- package/dist/src/specification/v2/controls/FormAction.d.ts +38 -0
- package/dist/src/specification/v2/controls/FormAction.js +15 -0
- package/dist/src/specification/v2/controls/FormAction.js.map +1 -0
- package/dist/src/specification/v2/controls/ObjectPageFooter.d.ts +11 -0
- package/dist/src/specification/v2/controls/ObjectPageFooter.js +3 -0
- package/dist/src/specification/v2/controls/ObjectPageFooter.js.map +1 -0
- package/dist/src/specification/v2/controls/ObjectPageForm.d.ts +16 -0
- package/dist/src/specification/v2/controls/ObjectPageForm.js +3 -0
- package/dist/src/specification/v2/controls/ObjectPageForm.js.map +1 -0
- package/dist/src/specification/v2/controls/ObjectPageHeaderAction.d.ts +21 -5
- package/dist/src/specification/v2/controls/ObjectPageHeaderAction.js +0 -5
- package/dist/src/specification/v2/controls/ObjectPageHeaderAction.js.map +1 -1
- package/dist/src/specification/v2/controls/ObjectPageSection.d.ts +24 -7
- package/dist/src/specification/v2/controls/ObjectPageSection.js.map +1 -1
- package/dist/src/specification/v2/controls/ObjectPageTable.d.ts +4 -1
- package/dist/src/specification/v2/controls/Table.d.ts +4 -0
- package/dist/src/specification/v2/controls/Table.js.map +1 -1
- package/dist/src/specification/v2/controls/ToolBar.d.ts +2 -6
- package/dist/src/specification/v2/controls/index.d.ts +5 -0
- package/dist/src/specification/v2/controls/index.js +1 -1
- package/dist/src/specification/v2/controls/index.js.map +1 -1
- package/dist/src/specification/v2/pages/ListReportConfig.d.ts +2 -1
- package/dist/src/specification/v2/pages/ObjectPageConfig.d.ts +2 -1
- package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.d.ts +1 -0
- package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.js +1 -0
- package/dist/src/specification/v2/webapp/manifest/sapUiPageV2.js.map +1 -1
- package/dist/src/sync/common/decoration/control.d.ts +8 -1
- package/dist/src/sync/common/decoration/control.js +62 -21
- package/dist/src/sync/common/decoration/control.js.map +1 -1
- package/dist/src/sync/common/flexUtils.d.ts +2 -2
- package/dist/src/sync/common/flexUtils.js +10 -5
- package/dist/src/sync/common/flexUtils.js.map +1 -1
- package/dist/src/sync/common/generate/index.d.ts +1 -0
- package/dist/src/sync/common/generate/index.js +7 -0
- package/dist/src/sync/common/generate/index.js.map +1 -0
- package/dist/src/sync/common/generate/objectPage.d.ts +49 -0
- package/dist/src/sync/common/generate/objectPage.js +319 -0
- package/dist/src/sync/common/generate/objectPage.js.map +1 -0
- package/dist/src/sync/common/import/utils.d.ts +28 -0
- package/dist/src/sync/common/import/utils.js +75 -0
- package/dist/src/sync/common/import/utils.js.map +1 -0
- package/dist/src/sync/common/importProject.js +53 -50
- package/dist/src/sync/common/importProject.js.map +1 -1
- package/dist/src/sync/common/index.d.ts +2 -0
- package/dist/src/sync/common/index.js +2 -0
- package/dist/src/sync/common/index.js.map +1 -1
- package/dist/src/sync/common/types.d.ts +19 -6
- package/dist/src/sync/common/types.js +12 -0
- package/dist/src/sync/common/types.js.map +1 -1
- package/dist/src/sync/common/utils.d.ts +30 -9
- package/dist/src/sync/common/utils.js +255 -173
- package/dist/src/sync/common/utils.js.map +1 -1
- package/dist/src/sync/v2/application.d.ts +2 -0
- package/dist/src/sync/v2/application.js +18 -5
- package/dist/src/sync/v2/application.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Card.d.ts +4 -3
- package/dist/src/sync/v2/export/controls/Card.js +16 -9
- package/dist/src/sync/v2/export/controls/Card.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Field.d.ts +4 -0
- package/dist/src/sync/v2/export/controls/Field.js +32 -0
- package/dist/src/sync/v2/export/controls/Field.js.map +1 -0
- package/dist/src/sync/v2/export/controls/FormAction.d.ts +15 -0
- package/dist/src/sync/v2/export/controls/FormAction.js +127 -0
- package/dist/src/sync/v2/export/controls/FormAction.js.map +1 -0
- package/dist/src/sync/v2/export/controls/Fragment.d.ts +1 -1
- package/dist/src/sync/v2/export/controls/Fragment.js +100 -87
- package/dist/src/sync/v2/export/controls/Fragment.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageHeader.js +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageHeader.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.d.ts +6 -2
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js +43 -4
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.d.ts +25 -0
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js +113 -0
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js.map +1 -0
- package/dist/src/sync/v2/export/controls/ObjectPageTable.js +4 -5
- package/dist/src/sync/v2/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Table.d.ts +8 -1
- package/dist/src/sync/v2/export/controls/Table.js +88 -31
- package/dist/src/sync/v2/export/controls/Table.js.map +1 -1
- package/dist/src/sync/v2/export/controls/TableColumn.js +1 -1
- package/dist/src/sync/v2/export/controls/TableColumn.js.map +1 -1
- package/dist/src/sync/v2/export/controls/index.d.ts +3 -0
- package/dist/src/sync/v2/export/controls/index.js +3 -0
- package/dist/src/sync/v2/export/controls/index.js.map +1 -1
- package/dist/src/sync/v2/export/export.d.ts +24 -10
- package/dist/src/sync/v2/export/export.js +285 -503
- package/dist/src/sync/v2/export/export.js.map +1 -1
- package/dist/src/sync/v2/export/exportPage.d.ts +10 -0
- package/dist/src/sync/v2/export/exportPage.js +311 -0
- package/dist/src/sync/v2/export/exportPage.js.map +1 -0
- package/dist/src/sync/v2/export/pages/ListReport.d.ts +3 -1
- package/dist/src/sync/v2/export/pages/ListReport.js.map +1 -1
- package/dist/src/sync/v2/export/pages/OverviewPage.d.ts +3 -1
- package/dist/src/sync/v2/export/pages/OverviewPage.js.map +1 -1
- package/dist/src/sync/v2/export/view-controller-generator.js +1 -1
- package/dist/src/sync/v2/export/view-controller-generator.js.map +1 -1
- package/dist/src/sync/v2/generate/analyticalListReport.d.ts +3 -9
- package/dist/src/sync/v2/generate/analyticalListReport.js +13 -16
- package/dist/src/sync/v2/generate/analyticalListReport.js.map +1 -1
- package/dist/src/sync/v2/generate/generate.js +28 -6
- package/dist/src/sync/v2/generate/generate.js.map +1 -1
- package/dist/src/sync/v2/generate/listReport.d.ts +3 -9
- package/dist/src/sync/v2/generate/listReport.js +20 -23
- package/dist/src/sync/v2/generate/listReport.js.map +1 -1
- package/dist/src/sync/v2/generate/objectPage.d.ts +3 -10
- package/dist/src/sync/v2/generate/objectPage.js +226 -141
- package/dist/src/sync/v2/generate/objectPage.js.map +1 -1
- package/dist/src/sync/v2/generate/utils.d.ts +1 -2
- package/dist/src/sync/v2/generate/utils.js +21 -6
- package/dist/src/sync/v2/generate/utils.js.map +1 -1
- package/dist/src/sync/v2/import/app/appProvider.js +25 -3
- package/dist/src/sync/v2/import/app/appProvider.js.map +1 -1
- package/dist/src/sync/v2/import/app/ovpProvider.d.ts +2 -1
- package/dist/src/sync/v2/import/app/ovpProvider.js +7 -3
- package/dist/src/sync/v2/import/app/ovpProvider.js.map +1 -1
- package/dist/src/sync/v2/import/common/index.d.ts +10 -1
- package/dist/src/sync/v2/import/common/index.js +17 -38
- package/dist/src/sync/v2/import/common/index.js.map +1 -1
- package/dist/src/sync/v2/import/controls/table.d.ts +2 -1
- package/dist/src/sync/v2/import/controls/table.js +1 -1
- package/dist/src/sync/v2/import/controls/table.js.map +1 -1
- package/dist/src/sync/v2/import/pages/analyticalListPage.d.ts +3 -8
- package/dist/src/sync/v2/import/pages/analyticalListPage.js +23 -24
- package/dist/src/sync/v2/import/pages/analyticalListPage.js.map +1 -1
- package/dist/src/sync/v2/import/pages/listReport.d.ts +3 -7
- package/dist/src/sync/v2/import/pages/listReport.js +23 -24
- package/dist/src/sync/v2/import/pages/listReport.js.map +1 -1
- package/dist/src/sync/v2/import/pages/objectPage.d.ts +6 -12
- package/dist/src/sync/v2/import/pages/objectPage.js +293 -154
- package/dist/src/sync/v2/import/pages/objectPage.js.map +1 -1
- package/dist/src/sync/v2/import/pages/overviewPage.d.ts +9 -1
- package/dist/src/sync/v2/import/pages/overviewPage.js +69 -39
- package/dist/src/sync/v2/import/pages/overviewPage.js.map +1 -1
- package/dist/src/sync/v2/import/utils.d.ts +3 -3
- package/dist/src/sync/v2/import/utils.js +5 -5
- package/dist/src/sync/v2/import/utils.js.map +1 -1
- package/dist/src/sync/v2/types.d.ts +32 -0
- package/dist/src/sync/v2/types.js +15 -0
- package/dist/src/sync/v2/types.js.map +1 -1
- package/dist/src/sync/v4/utils/StableIdHelper.d.ts +4 -0
- package/dist/src/sync/v4/utils/StableIdHelper.js +153 -0
- package/dist/src/sync/v4/utils/StableIdHelper.js.map +1 -0
- package/package.json +15 -7
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const StableIdHelper_1 = require("../../v4/utils/StableIdHelper");
|
|
4
|
+
const common_1 = require("../../../specification/common");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
/**
|
|
7
|
+
* Adds a field definition to the app specific schema
|
|
8
|
+
* @param {string} sectionType - prefix to distinguish Section and HeaderSection
|
|
9
|
+
* @param {object} appSchema - App schema in general
|
|
10
|
+
* @param {DataFieldAbstractTypes} field - field definition in parser output (AVT)
|
|
11
|
+
* @param {string} targetID - unique ID, identifies the parent object (form)
|
|
12
|
+
* @param {string} key - current field key
|
|
13
|
+
* @param {SectionType} section - current section of the object page
|
|
14
|
+
*/
|
|
15
|
+
function addField(sectionType, appSchema, field, targetID, key, section, version, withActions = true) {
|
|
16
|
+
var _a, _b, _c, _d, _e;
|
|
17
|
+
const fieldReferenceId = StableIdHelper_1.getStableIdPartFromDataField(field);
|
|
18
|
+
const fieldReference = version === common_1.FioriElementsVersion.v2 && fieldReferenceId && fieldReferenceId.includes('::')
|
|
19
|
+
? fieldReferenceId
|
|
20
|
+
.split('::')
|
|
21
|
+
.splice(1)
|
|
22
|
+
.join('::')
|
|
23
|
+
: fieldReferenceId;
|
|
24
|
+
const fieldReferenceType = version === common_1.FioriElementsVersion.v2 && fieldReferenceId && fieldReferenceId.includes('::')
|
|
25
|
+
? fieldReferenceId.split('::')[0].replace('DataField', 'Field')
|
|
26
|
+
: undefined;
|
|
27
|
+
const fieldDefinition = version === common_1.FioriElementsVersion.v2
|
|
28
|
+
? `${fieldReferenceType}<${targetID}::${fieldReference}>`
|
|
29
|
+
: `${targetID}::${fieldReference}`;
|
|
30
|
+
const fieldsDefinition = `${sectionType}Fields<${targetID}>`;
|
|
31
|
+
const actionsDefinition = `${sectionType}Actions<${targetID}>`;
|
|
32
|
+
if (!field || !field.$Type) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
else if (field.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAction" /* DataFieldForAction */ ||
|
|
36
|
+
field.$Type === "com.sap.vocabularies.UI.v1.DataFieldForIntentBasedNavigation" /* DataFieldForIntentBasedNavigation */) {
|
|
37
|
+
if (withActions && sectionType === __1.SectionType.Section) {
|
|
38
|
+
appSchema['definitions'][actionsDefinition]['properties'][fieldReference] = {
|
|
39
|
+
$ref: __1.DEFINITION_LINK_PREFIX + fieldDefinition,
|
|
40
|
+
propertyIndex: parseInt(key)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
appSchema['definitions'][fieldsDefinition]['properties'][fieldReference] = {
|
|
46
|
+
$ref: __1.DEFINITION_LINK_PREFIX + fieldDefinition,
|
|
47
|
+
propertyIndex: parseInt(key)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
appSchema['definitions'][fieldDefinition] = {
|
|
51
|
+
type: 'object',
|
|
52
|
+
isViewNode: true,
|
|
53
|
+
properties: {},
|
|
54
|
+
description: __1.getDatafieldDescription(field, section.entityType),
|
|
55
|
+
additionalProperties: false
|
|
56
|
+
};
|
|
57
|
+
if (version === common_1.FioriElementsVersion.v2 && appSchema['definitions']['Field']) {
|
|
58
|
+
switch (field.$Type) {
|
|
59
|
+
case "com.sap.vocabularies.UI.v1.DataField" /* DataField */:
|
|
60
|
+
case "com.sap.vocabularies.UI.v1.DataFieldForAnnotation" /* DataFieldForAnnotation */:
|
|
61
|
+
case "com.sap.vocabularies.UI.v1.DataFieldWithUrl" /* DataFieldWithUrl */: {
|
|
62
|
+
appSchema['definitions'][fieldDefinition]['properties'] =
|
|
63
|
+
appSchema['definitions']['Field']['properties'];
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (field.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAction" /* DataFieldForAction */ && ((_a = appSchema['definitions']) === null || _a === void 0 ? void 0 : _a['FormAction'])) {
|
|
69
|
+
appSchema['definitions'][fieldDefinition]['properties'] = appSchema['definitions']['FormAction']['properties'];
|
|
70
|
+
}
|
|
71
|
+
if ((_c = (_b = field['Value']) === null || _b === void 0 ? void 0 : _b.$target) === null || _c === void 0 ? void 0 : _c.type) {
|
|
72
|
+
appSchema['definitions'][fieldDefinition].dataType = (_e = (_d = field['Value']) === null || _d === void 0 ? void 0 : _d.$target) === null || _e === void 0 ? void 0 : _e.type;
|
|
73
|
+
}
|
|
74
|
+
appSchema['definitions'][fieldDefinition].annotationPath = `/${section.entityType.fullyQualifiedName}/${field.fullyQualifiedName.split(section.entityType.fullyQualifiedName)[1]}`;
|
|
75
|
+
}
|
|
76
|
+
function determineTargetIdOfForm(section) {
|
|
77
|
+
let targetID;
|
|
78
|
+
if (section.target && section.target['qualifier'] && section.entityType) {
|
|
79
|
+
targetID = `${section.entityType.name}::${section.base}::${section.target['qualifier']}`;
|
|
80
|
+
}
|
|
81
|
+
else if (section.entityType) {
|
|
82
|
+
targetID = `${section.entityType.name}::${section.base}`;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
targetID = section.ID;
|
|
86
|
+
}
|
|
87
|
+
return targetID;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Adds definitions for forms in object page sections to the app schema
|
|
91
|
+
* @param {SectionType} sectionType - prefix to distinguish Section and HeaderSection
|
|
92
|
+
* @param {FacetConfig} section - facet or section in the FE core model
|
|
93
|
+
* @param {object} appSchemaSection - current definition of facet or section in the JSON schema
|
|
94
|
+
* @param {object} appSchema - app specific schema that gets enhanced
|
|
95
|
+
*/
|
|
96
|
+
function handleForm(sectionType, section, appSchemaSection, appSchema, version, withActions = true) {
|
|
97
|
+
var _a;
|
|
98
|
+
if (!section.target) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const targetID = determineTargetIdOfForm(section);
|
|
102
|
+
const formDefinition = `${sectionType}Form<${targetID}>`;
|
|
103
|
+
const fieldsDefinition = `${sectionType}Fields<${targetID}>`;
|
|
104
|
+
const actionsDefinition = `${sectionType}Actions<${targetID}>`;
|
|
105
|
+
// Form definition
|
|
106
|
+
appSchemaSection['properties']['form'] = { $ref: __1.DEFINITION_LINK_PREFIX + formDefinition };
|
|
107
|
+
if (sectionType === __1.SectionType.Section && withActions) {
|
|
108
|
+
appSchema['definitions'][formDefinition] = {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {
|
|
111
|
+
actions: {
|
|
112
|
+
$ref: __1.DEFINITION_LINK_PREFIX + actionsDefinition
|
|
113
|
+
},
|
|
114
|
+
fields: { $ref: __1.DEFINITION_LINK_PREFIX + fieldsDefinition }
|
|
115
|
+
},
|
|
116
|
+
isViewNode: true,
|
|
117
|
+
description: 'Form',
|
|
118
|
+
additionalProperties: false
|
|
119
|
+
};
|
|
120
|
+
appSchema['definitions'][actionsDefinition] = {
|
|
121
|
+
type: 'object',
|
|
122
|
+
properties: {},
|
|
123
|
+
isViewNode: true,
|
|
124
|
+
description: 'Actions',
|
|
125
|
+
additionalProperties: false
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
appSchema['definitions'][formDefinition] = {
|
|
130
|
+
type: 'object',
|
|
131
|
+
properties: {
|
|
132
|
+
fields: { $ref: __1.DEFINITION_LINK_PREFIX + fieldsDefinition }
|
|
133
|
+
},
|
|
134
|
+
isViewNode: true,
|
|
135
|
+
description: 'Form',
|
|
136
|
+
additionalProperties: false
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if ((_a = section.entityType) === null || _a === void 0 ? void 0 : _a.name) {
|
|
140
|
+
appSchema['definitions'][formDefinition].annotationPath = __1.createAnnotationPath(section.entityType.fullyQualifiedName, section.target['term'], section.target['qualifier']);
|
|
141
|
+
}
|
|
142
|
+
// Fields definition
|
|
143
|
+
appSchema['definitions'][fieldsDefinition] = {
|
|
144
|
+
type: 'object',
|
|
145
|
+
properties: {},
|
|
146
|
+
isViewNode: true,
|
|
147
|
+
description: 'Fields',
|
|
148
|
+
additionalProperties: false
|
|
149
|
+
};
|
|
150
|
+
// Add fields
|
|
151
|
+
if (section.base === __1.FacetBase.Identification) {
|
|
152
|
+
for (const key in section.target) {
|
|
153
|
+
const field = section.target[key];
|
|
154
|
+
if (field) {
|
|
155
|
+
addField(sectionType, appSchema, field, targetID, key, section, version, withActions);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
for (const key in section.target['Data']) {
|
|
161
|
+
const field = section.target['Data'][key];
|
|
162
|
+
addField(sectionType, appSchema, field, targetID, key, section, version);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.handleForm = handleForm;
|
|
167
|
+
/**
|
|
168
|
+
* Replaces an alias in an annotation ID or reference, based on the AVT references' list
|
|
169
|
+
* @param annotationIdentifier - annotation ID or reference
|
|
170
|
+
* @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
171
|
+
* @returns the converted string
|
|
172
|
+
*/
|
|
173
|
+
function replaceAlias(annotationIdentifier, oDataServiceAVT) {
|
|
174
|
+
const potentialAlias = annotationIdentifier.indexOf('.') > -1 ? annotationIdentifier.split('.')[0] : undefined;
|
|
175
|
+
let result = annotationIdentifier;
|
|
176
|
+
if (potentialAlias) {
|
|
177
|
+
const reference = oDataServiceAVT.references.find((ref) => {
|
|
178
|
+
return ref.alias === potentialAlias;
|
|
179
|
+
});
|
|
180
|
+
if (reference) {
|
|
181
|
+
result = annotationIdentifier.replace(potentialAlias, reference.namespace);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
exports.replaceAlias = replaceAlias;
|
|
187
|
+
/**
|
|
188
|
+
* Common routine to determine the name and the ID of a header action
|
|
189
|
+
* @param action - action as given by AVT
|
|
190
|
+
* @param entityType - entity type by AVT
|
|
191
|
+
* @returns an object comprising action name and action id
|
|
192
|
+
*/
|
|
193
|
+
function getActionNameAndId(action, entityType) {
|
|
194
|
+
let separatorIndex = action.lastIndexOf('/');
|
|
195
|
+
if (separatorIndex === -1) {
|
|
196
|
+
separatorIndex = action.lastIndexOf('.');
|
|
197
|
+
}
|
|
198
|
+
let actionName, actionId;
|
|
199
|
+
if (separatorIndex > -1) {
|
|
200
|
+
actionName = action.substr(separatorIndex + 1);
|
|
201
|
+
actionId = action.substr(0, separatorIndex) + '::' + actionName;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
actionName = action;
|
|
205
|
+
const namespace = entityType.fullyQualifiedName.split(entityType.name)[0];
|
|
206
|
+
actionId = namespace.substr(0, namespace.length - 1) + '::' + actionName;
|
|
207
|
+
}
|
|
208
|
+
return { actionName, actionId };
|
|
209
|
+
}
|
|
210
|
+
exports.getActionNameAndId = getActionNameAndId;
|
|
211
|
+
/**
|
|
212
|
+
* Add Object Page Footer Action Buttons to app-specific schema
|
|
213
|
+
*
|
|
214
|
+
* @param {object} appSchema Schema of the app
|
|
215
|
+
* @param {EntityType} entityType - current entity type
|
|
216
|
+
* @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
217
|
+
*/
|
|
218
|
+
function addFooterActions(appSchema, entityType, oDataServiceAVT) {
|
|
219
|
+
appSchema['definitions']['ObjectPageFooter'] = JSON.parse(JSON.stringify(appSchema['definitions']['ObjectPageFooter<GenericFooterActions>']));
|
|
220
|
+
// Change reference of footer
|
|
221
|
+
appSchema['properties']['footer'] = {
|
|
222
|
+
$ref: __1.DEFINITION_LINK_PREFIX + 'ObjectPageFooter'
|
|
223
|
+
};
|
|
224
|
+
// Add action to configuration
|
|
225
|
+
appSchema['definitions']['ObjectPageFooter'].properties['actions'] = {
|
|
226
|
+
$ref: `${__1.DEFINITION_LINK_PREFIX}FooterActions`
|
|
227
|
+
};
|
|
228
|
+
const footerActions = (appSchema['definitions']['FooterActions'] = {
|
|
229
|
+
type: 'object',
|
|
230
|
+
properties: {},
|
|
231
|
+
description: 'Actions',
|
|
232
|
+
additionalProperties: false,
|
|
233
|
+
isViewNode: true
|
|
234
|
+
});
|
|
235
|
+
const alias = __1.findAlias(__1.UIVOCABULARY, oDataServiceAVT);
|
|
236
|
+
const actionAnnotation = alias &&
|
|
237
|
+
entityType.annotations &&
|
|
238
|
+
entityType.annotations[alias] &&
|
|
239
|
+
entityType.annotations[alias].Identification;
|
|
240
|
+
if (actionAnnotation) {
|
|
241
|
+
const convertedIdentification = actionAnnotation.fullyQualifiedName.replace(`@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`, `/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`);
|
|
242
|
+
footerActions['annotationPath'] = `/${convertedIdentification}`;
|
|
243
|
+
actionAnnotation.forEach((item, index) => {
|
|
244
|
+
if (item['Determining'] && item.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAction" /* DataFieldForAction */) {
|
|
245
|
+
const { actionName, actionId } = getActionNameAndId(item.Action, entityType);
|
|
246
|
+
const description = item.Label || actionName;
|
|
247
|
+
const actionDefinitionKey = `FooterAction<${actionId}>`;
|
|
248
|
+
appSchema['definitions'][actionDefinitionKey] = {
|
|
249
|
+
isViewNode: true,
|
|
250
|
+
type: 'object',
|
|
251
|
+
properties: {},
|
|
252
|
+
description: description,
|
|
253
|
+
annotationPath: `/${convertedIdentification}/${index}`
|
|
254
|
+
};
|
|
255
|
+
footerActions.properties[actionId] = {
|
|
256
|
+
$ref: `${__1.DEFINITION_LINK_PREFIX}${actionDefinitionKey}`
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
footerActions['annotationPath'] = `/${entityType.fullyQualifiedName}/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`;
|
|
263
|
+
}
|
|
264
|
+
delete appSchema['definitions']['GenericFooterActions'];
|
|
265
|
+
delete appSchema['definitions']['FooterAction'];
|
|
266
|
+
delete appSchema['definitions']['ObjectPageFooter<GenericFooterActions>'];
|
|
267
|
+
}
|
|
268
|
+
exports.addFooterActions = addFooterActions;
|
|
269
|
+
/**
|
|
270
|
+
* Add Object Page Header Action Buttons to app-specific schema
|
|
271
|
+
* @param {object} appSchema Schema of the app
|
|
272
|
+
* @param {EntityType} entityType - current entity type
|
|
273
|
+
* @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
274
|
+
*/
|
|
275
|
+
function addHeaderActions(appSchema, entityType, oDataServiceAVT,
|
|
276
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
277
|
+
addHeaderActionCallBack) {
|
|
278
|
+
appSchema['definitions']['ObjectPageHeader'].properties['actions'] = {
|
|
279
|
+
$ref: `${__1.DEFINITION_LINK_PREFIX}HeaderActions`
|
|
280
|
+
};
|
|
281
|
+
const headerActions = (appSchema['definitions']['HeaderActions'] = {
|
|
282
|
+
type: 'object',
|
|
283
|
+
properties: {},
|
|
284
|
+
description: 'Actions',
|
|
285
|
+
additionalProperties: false,
|
|
286
|
+
isViewNode: true
|
|
287
|
+
});
|
|
288
|
+
const alias = __1.findAlias(__1.UIVOCABULARY, oDataServiceAVT);
|
|
289
|
+
const identification = alias &&
|
|
290
|
+
entityType.annotations &&
|
|
291
|
+
entityType.annotations[alias] &&
|
|
292
|
+
entityType.annotations[alias].Identification;
|
|
293
|
+
if (identification) {
|
|
294
|
+
headerActions['annotationPath'] =
|
|
295
|
+
'/' +
|
|
296
|
+
identification.fullyQualifiedName.replace(`@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`, `/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`);
|
|
297
|
+
identification.forEach(addHeaderActionCallBack(entityType, appSchema, identification, headerActions, oDataServiceAVT));
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
headerActions['annotationPath'] = `/${entityType.fullyQualifiedName}/@${"com.sap.vocabularies.UI.v1.Identification" /* Identification */}`;
|
|
301
|
+
}
|
|
302
|
+
delete appSchema['definitions']['GenericActions'];
|
|
303
|
+
delete appSchema['definitions']['ObjectPageHeader<GenericActions>'];
|
|
304
|
+
}
|
|
305
|
+
exports.addHeaderActions = addHeaderActions;
|
|
306
|
+
/**
|
|
307
|
+
* Adds common Object Page Header definitions to the app schema
|
|
308
|
+
* @param appSchema - app-specific JSOn schema
|
|
309
|
+
* @param entityType - current entity Type
|
|
310
|
+
*/
|
|
311
|
+
function addCommonHeaderSchema(appSchema, entityType) {
|
|
312
|
+
appSchema['properties']['header'] = {
|
|
313
|
+
$ref: __1.DEFINITION_LINK_PREFIX + 'ObjectPageHeader'
|
|
314
|
+
};
|
|
315
|
+
appSchema['definitions']['ObjectPageHeader'] = JSON.parse(JSON.stringify(appSchema['definitions']['ObjectPageHeader<GenericActions>']));
|
|
316
|
+
appSchema['definitions']['ObjectPageHeader'].annotationPath = `/${entityType.fullyQualifiedName}/@${"com.sap.vocabularies.UI.v1.HeaderInfo" /* HeaderInfo */}`;
|
|
317
|
+
}
|
|
318
|
+
exports.addCommonHeaderSchema = addCommonHeaderSchema;
|
|
319
|
+
//# sourceMappingURL=objectPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectPage.js","sourceRoot":"","sources":["../../../../../src/sync/common/generate/objectPage.ts"],"names":[],"mappings":";;AAOA,kEAA6E;AAC7E,0DAAqE;AACrE,0BASY;AAEZ;;;;;;;;GAQG;AACH,SAAS,QAAQ,CACb,WAAwB,EACxB,SAAiB,EACjB,KAA6B,EAC7B,QAAgB,EAChB,GAAW,EACX,OAAoB,EACpB,OAA6B,EAC7B,WAAW,GAAG,IAAI;;IAElB,MAAM,gBAAgB,GAAG,6CAA4B,CAAC,KAAK,CAAC,CAAC;IAC7D,MAAM,cAAc,GAChB,OAAO,KAAK,6BAAoB,CAAC,EAAE,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtF,CAAC,CAAC,gBAAgB;aACX,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,CAAC,CAAC;aACT,IAAI,CAAC,IAAI,CAAC;QACjB,CAAC,CAAC,gBAAgB,CAAC;IAC3B,MAAM,kBAAkB,GACpB,OAAO,KAAK,6BAAoB,CAAC,EAAE,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtF,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC;QAC/D,CAAC,CAAC,SAAS,CAAC;IACpB,MAAM,eAAe,GACjB,OAAO,KAAK,6BAAoB,CAAC,EAAE;QAC/B,CAAC,CAAC,GAA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,CAAC,CACjG,CAAC;KACL;SAAM;QACH,aAAa,CAAC,gBAAgB,CAAC,GAAG,IAAI,UAAU,CAAC,kBAAkB,KAAK,gEAAgC,EAAE,CAAC;KAC9G;IACD,OAAO,SAAS,CAAC,aAAa,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAClD,OAAO,SAAS,CAAC,aAAa,CAAC,CAAC,kCAAkC,CAAC,CAAC;AACxE,CAAC;AAxCD,4CAwCC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,SAAiB,EAAE,UAAsB;IAC3E,SAAS,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,GAAG;QAChC,IAAI,EAAE,0BAAsB,GAAG,kBAAkB;KACpD,CAAC;IACF,SAAS,CAAC,aAAa,CAAC,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,KAAK,CACrD,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAC/E,CAAC;IACF,SAAS,CAAC,aAAa,CAAC,CACpB,kBAAkB,CACrB,CAAC,cAAc,GAAG,IAAI,UAAU,CAAC,kBAAkB,KAAK,wDAA4B,EAAE,CAAC;AAC5F,CAAC;AAVD,sDAUC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DeprecatedProperties, SyncRule } from '../';
|
|
2
|
+
import { ExtensionLogger } from '../../../apiTypes';
|
|
3
|
+
/**
|
|
4
|
+
* Transfers the value of a single manifest setting to the config
|
|
5
|
+
* @param syncRule - Metadata rule
|
|
6
|
+
* @param manifestSection - Section in manifest.json
|
|
7
|
+
* @param propertyKey - Key of the property or setting
|
|
8
|
+
* @param configPart - Part of the config JSON
|
|
9
|
+
* @param sectionId - Section or facet ID
|
|
10
|
+
*/
|
|
11
|
+
export declare function importProperty(syncRule: SyncRule, manifestSection: {}, propertyKey: string, configPart: {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}, sectionId?: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Validation during import: check if properties are marked as deprecated.
|
|
16
|
+
* If so, log them.
|
|
17
|
+
* @param deprecatedProperties - existing list, to be actualized
|
|
18
|
+
* @param manifestSection - Section in manifest.json
|
|
19
|
+
* @param path - path to the section in manifest
|
|
20
|
+
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
21
|
+
*/
|
|
22
|
+
export declare function checkDeprecatedProperties(deprecatedProperties: DeprecatedProperties[], manifestSection: {}, path: string, logger?: ExtensionLogger): void;
|
|
23
|
+
/**
|
|
24
|
+
* get title of the section (Facet ID)
|
|
25
|
+
* @param schemaSection - Section in manifest.json
|
|
26
|
+
* @param jsonSchema - app specific schema
|
|
27
|
+
*/
|
|
28
|
+
export declare function getSectionTitle(schemaSection: object, jsonSchema: object): string;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const __1 = require("../");
|
|
4
|
+
const extensionLogger_1 = require("../../../extensionLogger");
|
|
5
|
+
/**
|
|
6
|
+
* Transfers the value of a single manifest setting to the config
|
|
7
|
+
* @param syncRule - Metadata rule
|
|
8
|
+
* @param manifestSection - Section in manifest.json
|
|
9
|
+
* @param propertyKey - Key of the property or setting
|
|
10
|
+
* @param configPart - Part of the config JSON
|
|
11
|
+
* @param sectionId - Section or facet ID
|
|
12
|
+
*/
|
|
13
|
+
function importProperty(syncRule, manifestSection, propertyKey, configPart, sectionId) {
|
|
14
|
+
const manifestKey = syncRule.manifest.key || propertyKey;
|
|
15
|
+
const importHandler = syncRule.manifest.import;
|
|
16
|
+
if (importHandler && typeof importHandler === 'function') {
|
|
17
|
+
const value = importHandler(manifestSection, sectionId);
|
|
18
|
+
if (value !== undefined) {
|
|
19
|
+
configPart[propertyKey] = value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else if (manifestSection[manifestKey] !== undefined) {
|
|
23
|
+
configPart[propertyKey] = manifestSection[manifestKey];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.importProperty = importProperty;
|
|
27
|
+
/**
|
|
28
|
+
* Validation during import: check if properties are marked as deprecated.
|
|
29
|
+
* If so, log them.
|
|
30
|
+
* @param deprecatedProperties - existing list, to be actualized
|
|
31
|
+
* @param manifestSection - Section in manifest.json
|
|
32
|
+
* @param path - path to the section in manifest
|
|
33
|
+
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
34
|
+
*/
|
|
35
|
+
function checkDeprecatedProperties(deprecatedProperties, manifestSection, path, logger) {
|
|
36
|
+
if (manifestSection && deprecatedProperties) {
|
|
37
|
+
for (const key in manifestSection) {
|
|
38
|
+
const deprecated = deprecatedProperties[key];
|
|
39
|
+
if (deprecated) {
|
|
40
|
+
extensionLogger_1.log(logger, {
|
|
41
|
+
severity: "warning" /* Warning */,
|
|
42
|
+
message: __1.getTextForDeprecated(key, deprecated),
|
|
43
|
+
location: {
|
|
44
|
+
path: 'webapp/manifest.json/',
|
|
45
|
+
range: path.split('/')
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
delete deprecatedProperties[key];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.checkDeprecatedProperties = checkDeprecatedProperties;
|
|
54
|
+
/**
|
|
55
|
+
* get title of the section (Facet ID)
|
|
56
|
+
* @param schemaSection - Section in manifest.json
|
|
57
|
+
* @param jsonSchema - app specific schema
|
|
58
|
+
*/
|
|
59
|
+
function getSectionTitle(schemaSection, jsonSchema) {
|
|
60
|
+
if (schemaSection['$ref'] && !schemaSection['title']) {
|
|
61
|
+
const refTitle = jsonSchema['definitions'][schemaSection['$ref'].split(__1.DEFINITION_LINK_PREFIX)[1]];
|
|
62
|
+
getSectionTitle(refTitle, jsonSchema);
|
|
63
|
+
}
|
|
64
|
+
else if (schemaSection['title'] && schemaSection['title'].startsWith(__1.FacetTitlePrefix)) {
|
|
65
|
+
return schemaSection['title'].split(__1.FacetTitlePrefix)[1];
|
|
66
|
+
}
|
|
67
|
+
else if (schemaSection['title']) {
|
|
68
|
+
return schemaSection['title'];
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.getSectionTitle = getSectionTitle;
|
|
75
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/sync/common/import/utils.ts"],"names":[],"mappings":";;AAAA,2BAAqH;AACrH,8DAA4D;AAG5D;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC1B,QAAkB,EAClB,eAAmB,EACnB,WAAmB,EACnB,UAAkC,EAClC,SAAkB;IAElB,MAAM,WAAW,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI,WAAW,CAAC;IAEzD,MAAM,aAAa,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC/C,IAAI,aAAa,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE;QACtD,MAAM,KAAK,GAAG,aAAa,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;QACxD,IAAI,KAAK,KAAK,SAAS,EAAE;YACrB,UAAU,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC;SACnC;KACJ;SAAM,IAAI,eAAe,CAAC,WAAW,CAAC,KAAK,SAAS,EAAE;QACnD,UAAU,CAAC,WAAW,CAAC,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;KAC1D;AACL,CAAC;AAlBD,wCAkBC;AAED;;;;;;;GAOG;AACH,SAAgB,yBAAyB,CACrC,oBAA4C,EAC5C,eAAmB,EACnB,IAAY,EACZ,MAAwB;IAExB,IAAI,eAAe,IAAI,oBAAoB,EAAE;QACzC,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE;YAC/B,MAAM,UAAU,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;YAC7C,IAAI,UAAU,EAAE;gBACZ,qBAAG,CAAC,MAAM,EAAE;oBACR,QAAQ,yBAAqB;oBAC7B,OAAO,EAAE,wBAAoB,CAAC,GAAG,EAAE,UAAU,CAAC;oBAC9C,QAAQ,EAAE;wBACN,IAAI,EAAE,uBAAuB;wBAC7B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;qBACzB;iBACJ,CAAC,CAAC;gBACH,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;aACpC;SACJ;KACJ;AACL,CAAC;AAtBD,8DAsBC;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAC,aAAqB,EAAE,UAAkB;IACrE,IAAI,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QAClD,MAAM,QAAQ,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,0BAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnG,eAAe,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;KACzC;SAAM,IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,oBAAgB,CAAC,EAAE;QACtF,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,oBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;KAC5D;SAAM,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE;QAC/B,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC;KACjC;SAAM;QACH,OAAO,SAAS,CAAC;KACpB;AACL,CAAC;AAXD,0CAWC"}
|
|
@@ -54,9 +54,9 @@ function getAnnotationsForUi(oDataServiceAVT) {
|
|
|
54
54
|
Facets: [],
|
|
55
55
|
LineItems: []
|
|
56
56
|
};
|
|
57
|
-
const allEntityTypes = oDataServiceAVT
|
|
57
|
+
const allEntityTypes = oDataServiceAVT === null || oDataServiceAVT === void 0 ? void 0 : oDataServiceAVT.entityTypes;
|
|
58
58
|
if (allEntityTypes) {
|
|
59
|
-
const alias = utils_1.findAlias(
|
|
59
|
+
const alias = utils_1.findAlias(types_1.UIVOCABULARY, oDataServiceAVT);
|
|
60
60
|
for (const entity of allEntityTypes) {
|
|
61
61
|
if (!entity.annotations || !entity.annotations[alias]) {
|
|
62
62
|
continue;
|
|
@@ -65,8 +65,8 @@ function getAnnotationsForUi(oDataServiceAVT) {
|
|
|
65
65
|
const { LineItem, Facets } = entity.annotations[alias];
|
|
66
66
|
if (LineItem &&
|
|
67
67
|
!LineItem.qualifier &&
|
|
68
|
-
LineItem.find((li) => li.$Type ===
|
|
69
|
-
li.$Type ===
|
|
68
|
+
LineItem.find((li) => li.$Type === "com.sap.vocabularies.UI.v1.DataField" /* DataField */ ||
|
|
69
|
+
li.$Type === "com.sap.vocabularies.UI.v1.DataFieldForAnnotation" /* DataFieldForAnnotation */)) {
|
|
70
70
|
filteredEntityTypes.LineItems.push(name);
|
|
71
71
|
}
|
|
72
72
|
if (Facets && !Facets.qualifier) {
|
|
@@ -82,84 +82,77 @@ function getEntitySetByEntitySetName(entitySetName, oDataServiceAVT) {
|
|
|
82
82
|
exports.getEntitySetByEntitySetName = getEntitySetByEntitySetName;
|
|
83
83
|
/**
|
|
84
84
|
* The function generates one app schema per entitySet that is linked with an object page in V2
|
|
85
|
+
* @param {GenerateSchemaParameters} generateParameters - list of API input parameters
|
|
85
86
|
* @param {Schema} genericSchemas - The generic schemas
|
|
86
|
-
* @param {Manifest} manifest - manifest.json of the given app
|
|
87
|
-
* @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
88
87
|
* @param {Schema} appSchemas - the list of app schemas that shall get extended
|
|
89
|
-
* @param {FileData[]} [fragments] - array with XML fragments
|
|
90
|
-
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
91
88
|
*/
|
|
92
|
-
function generateObjectPageSchemasV2(
|
|
93
|
-
const allPages = appProvider_1.getPages(manifest[common_1.ManifestSection.generic].pages, pageV2.FE_TEMPLATE_V2_OBJECT_PAGE);
|
|
89
|
+
function generateObjectPageSchemasV2(generateParameters, genericSchemas, appSchemas) {
|
|
90
|
+
const allPages = appProvider_1.getPages(generateParameters.manifest[common_1.ManifestSection.generic].pages, pageV2.FE_TEMPLATE_V2_OBJECT_PAGE);
|
|
94
91
|
for (const page in allPages) {
|
|
95
92
|
const entitySetName = allPages[page].entitySet;
|
|
96
|
-
const entitySet = getEntitySetByEntitySetName(entitySetName,
|
|
93
|
+
const entitySet = getEntitySetByEntitySetName(entitySetName, generateParameters.serviceAVT);
|
|
97
94
|
const entityTypeName = entitySet && entitySet.entityType && entitySet.entityType.name;
|
|
98
95
|
const schemaFile = utils_1.getSchemaFilePath(common_1.SchemaType.ObjectPage, (entitySet === null || entitySet === void 0 ? void 0 : entitySet.name) || entitySetName);
|
|
99
96
|
const genericSchemaFile = utils_1.getSchemaFilePath(common_1.SchemaType.ObjectPage);
|
|
100
|
-
appSchemas[schemaFile.filename] = generate_1.generateObjectPageSchemaV2(genericSchemas[genericSchemaFile.filename], entityTypeName
|
|
97
|
+
appSchemas[schemaFile.filename] = generate_1.generateObjectPageSchemaV2(generateParameters, genericSchemas[genericSchemaFile.filename], entityTypeName);
|
|
101
98
|
}
|
|
102
99
|
}
|
|
103
100
|
/**
|
|
104
101
|
* Generates all app specific schemas for a Fiori Elements V2 application
|
|
102
|
+
* @param {GenerateSchemaParameters} generateParameters - list of API input parameters
|
|
105
103
|
* @param {Schemas} genericSchemas - The generic schemas
|
|
106
104
|
* @param {UiEntityTypes} uiEntityTypes - list of all entity types, as comprised in oDataServiceAVT
|
|
107
|
-
* @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
108
|
-
* @param {Manifest} manifest - manifest.json of the given app
|
|
109
105
|
* @param {TemplateType} templateType - the given Fiori Elements' template type
|
|
110
|
-
* @param {FileData[]} fragments - list of fragment files and their content
|
|
111
|
-
* @param {ExtensionLogger} logger - Logger class for logging messages
|
|
112
106
|
*/
|
|
113
|
-
function generateAppSchemasV2(genericSchemas, uiEntityTypes,
|
|
114
|
-
|
|
107
|
+
function generateAppSchemasV2(generateParameters, genericSchemas, uiEntityTypes, templateType) {
|
|
108
|
+
var _a;
|
|
109
|
+
const appSchemas = {};
|
|
115
110
|
if (templateType === utils_1.TemplateType.ListReportObjectPageV2 && uiEntityTypes) {
|
|
116
111
|
/*--- List Report ----*/
|
|
117
|
-
const allPages = appProvider_1.getPages(manifest[common_1.ManifestSection.generic].pages, pageV2.FE_TEMPLATE_V2_LIST_REPORT);
|
|
112
|
+
const allPages = appProvider_1.getPages(generateParameters.manifest[common_1.ManifestSection.generic].pages, pageV2.FE_TEMPLATE_V2_LIST_REPORT);
|
|
118
113
|
for (const page in allPages) {
|
|
119
114
|
const entitySetName = allPages[page].entitySet;
|
|
120
|
-
const entitySet = getEntitySetByEntitySetName(entitySetName,
|
|
115
|
+
const entitySet = getEntitySetByEntitySetName(entitySetName, generateParameters.serviceAVT);
|
|
121
116
|
const entityTypeName = entitySet && entitySet.entityType && entitySet.entityType.name;
|
|
122
117
|
const schemaFile = utils_1.getSchemaFilePath(common_1.SchemaType.ListReport, (entitySet === null || entitySet === void 0 ? void 0 : entitySet.name) || entitySetName);
|
|
123
118
|
const genericSchemaFile = utils_1.getSchemaFilePath(common_1.SchemaType.ListReport);
|
|
124
|
-
appSchemas[schemaFile.filename] = generate_1.generateListReportSchemaV2(genericSchemas[genericSchemaFile.filename], entityTypeName
|
|
119
|
+
appSchemas[schemaFile.filename] = generate_1.generateListReportSchemaV2(generateParameters, genericSchemas[genericSchemaFile.filename], entityTypeName);
|
|
125
120
|
}
|
|
126
121
|
/*--- Object Pages ----*/
|
|
127
|
-
generateObjectPageSchemasV2(
|
|
122
|
+
generateObjectPageSchemasV2(generateParameters, genericSchemas, appSchemas);
|
|
128
123
|
}
|
|
129
124
|
else if (templateType === utils_1.TemplateType.AnalyticalListPageV2 && uiEntityTypes) {
|
|
130
125
|
/*--- Analytical List Page ----*/
|
|
131
|
-
const allPages = appProvider_1.getPages(manifest[common_1.ManifestSection.generic].pages, pageV2.FE_TEMPLATE_V2_ALP);
|
|
126
|
+
const allPages = appProvider_1.getPages(generateParameters.manifest[common_1.ManifestSection.generic].pages, pageV2.FE_TEMPLATE_V2_ALP);
|
|
132
127
|
for (const page in allPages) {
|
|
133
128
|
const entitySetName = allPages[page].entitySet;
|
|
134
|
-
const entitySet = getEntitySetByEntitySetName(entitySetName,
|
|
135
|
-
const entityTypeName = entitySet
|
|
129
|
+
const entitySet = getEntitySetByEntitySetName(entitySetName, generateParameters.serviceAVT);
|
|
130
|
+
const entityTypeName = (_a = entitySet === null || entitySet === void 0 ? void 0 : entitySet.entityType) === null || _a === void 0 ? void 0 : _a.name;
|
|
136
131
|
const schemaFile = utils_1.getSchemaFilePath(common_1.SchemaType.AnalyticalListPage, (entitySet === null || entitySet === void 0 ? void 0 : entitySet.name) || entitySetName);
|
|
137
132
|
const genericSchemaFile = utils_1.getSchemaFilePath(common_1.SchemaType.AnalyticalListPage);
|
|
138
|
-
appSchemas[schemaFile.filename] = generate_1.generateAnalyticalListReportSchemaV2(genericSchemas[genericSchemaFile.filename], entityTypeName
|
|
133
|
+
appSchemas[schemaFile.filename] = generate_1.generateAnalyticalListReportSchemaV2(generateParameters, genericSchemas[genericSchemaFile.filename], entityTypeName);
|
|
139
134
|
}
|
|
140
135
|
/*--- Object Pages ----*/
|
|
141
|
-
generateObjectPageSchemasV2(
|
|
136
|
+
generateObjectPageSchemasV2(generateParameters, genericSchemas, appSchemas);
|
|
142
137
|
}
|
|
143
138
|
else if (templateType === utils_1.TemplateType.OverviewPageV2) {
|
|
144
139
|
/*--- Overview Page ----*/
|
|
145
140
|
const schemaFile = utils_1.getSchemaFilePath(common_1.SchemaType.OverviewPage);
|
|
146
141
|
const genericSchemaFile = utils_1.getSchemaFilePath(common_1.SchemaType.OverviewPage);
|
|
147
|
-
appSchemas[schemaFile.filename] = generate_1.generateOVPInterfaceV2(genericSchemas[genericSchemaFile.filename], manifest);
|
|
142
|
+
appSchemas[schemaFile.filename] = generate_1.generateOVPInterfaceV2(genericSchemas[genericSchemaFile.filename], generateParameters.manifest);
|
|
148
143
|
}
|
|
149
144
|
return Object.assign(Object.assign({}, genericSchemas), appSchemas);
|
|
150
145
|
}
|
|
151
146
|
/**
|
|
152
147
|
* Generates app specific schemas by adding annotation information to copies of the generic schemas, thus replacing all generic definitions.
|
|
148
|
+
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
153
149
|
* @param {UiEntityTypes} uiEntityTypes - list of all entity types from the service metadata
|
|
154
|
-
* @param {FioriElementsVersion} fioriElementsVersion - version of Fiori Element (V2 or V4)
|
|
155
|
-
* @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
156
|
-
* @param manifest - manifest.json file content of the app in JSON format
|
|
157
150
|
* @param templateType - type of the Fiori Elements' template
|
|
158
151
|
*/
|
|
159
|
-
async function generateAppSchemas(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return generateAppSchemasV2(genericSchemas, uiEntityTypes,
|
|
152
|
+
async function generateAppSchemas(generateParameters, uiEntityTypes, templateType) {
|
|
153
|
+
if (generateParameters.fioriElementsVersion === common_1.FioriElementsVersion.v2) {
|
|
154
|
+
const genericSchemas = await getGenericSchemas(templateType, generateParameters.fioriElementsVersion);
|
|
155
|
+
return generateAppSchemasV2(generateParameters, genericSchemas, uiEntityTypes, templateType);
|
|
163
156
|
}
|
|
164
157
|
}
|
|
165
158
|
/**
|
|
@@ -167,11 +160,10 @@ async function generateAppSchemas(uiEntityTypes, fioriElementsVersion, oDataServ
|
|
|
167
160
|
* @param {Manifest} manifest - manifest.json file content of the app in JSON format
|
|
168
161
|
* @param {string[]} flex - list of all UI flexibility changes
|
|
169
162
|
* @param {Schemas} appSchemas - list of app-specific schemas
|
|
170
|
-
* @param {ConverterOutput} oDataServiceAVT - complete service information, as returned by annotation vocabularies tool
|
|
171
163
|
* @param {TemplateType} templateType - type of the Fiori Elements' template
|
|
172
164
|
* @returns {File[]} a list of all configuration files as generated by the function
|
|
173
165
|
*/
|
|
174
|
-
function importConfigs(manifest, flex, appSchemas,
|
|
166
|
+
function importConfigs(manifest, flex, appSchemas, templateType, fragments) {
|
|
175
167
|
let provider;
|
|
176
168
|
const files = [];
|
|
177
169
|
switch (templateType) {
|
|
@@ -221,16 +213,21 @@ async function importProjectSchema(importProjectParameters) {
|
|
|
221
213
|
// Initialize i18next
|
|
222
214
|
i18n_1.initI18n();
|
|
223
215
|
let files = [];
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
const service = utils_1.parseAndMergeAndConvert(annotations, logger);
|
|
216
|
+
const fioriElementsVersion = utils_1.getVersionFromManifest(importProjectParameters.manifest);
|
|
217
|
+
const service = utils_1.parseAndMergeAndConvert(importProjectParameters.annotations, importProjectParameters.logger);
|
|
227
218
|
const uiEntityTypes = getAnnotationsForUi(service);
|
|
228
|
-
const templateType = utils_1.getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger);
|
|
229
|
-
|
|
230
|
-
|
|
219
|
+
const templateType = utils_1.getTemplateTypeFromManifest(importProjectParameters.manifest, fioriElementsVersion, importProjectParameters.logger);
|
|
220
|
+
const generateParameters = {
|
|
221
|
+
manifest: importProjectParameters.manifest,
|
|
222
|
+
serviceAVT: service,
|
|
223
|
+
fragments: importProjectParameters.fragments,
|
|
224
|
+
fioriElementsVersion,
|
|
225
|
+
logger: importProjectParameters.logger
|
|
226
|
+
};
|
|
227
|
+
if (templateType) {
|
|
228
|
+
const appSchemas = await generateAppSchemas(generateParameters, uiEntityTypes, templateType);
|
|
229
|
+
files = getFileList(appSchemas);
|
|
231
230
|
}
|
|
232
|
-
const appSchemas = await generateAppSchemas(uiEntityTypes, fioriElementsVersion, service, manifest, templateType, fragments);
|
|
233
|
-
files = getFileList(appSchemas);
|
|
234
231
|
return files;
|
|
235
232
|
}
|
|
236
233
|
exports.importProjectSchema = importProjectSchema;
|
|
@@ -246,14 +243,20 @@ async function importProjectSchemaAndConfig(importProjectParameters) {
|
|
|
246
243
|
const { manifest, annotations, flex, fragments, logger } = importProjectParameters;
|
|
247
244
|
const fioriElementsVersion = utils_1.getVersionFromManifest(manifest);
|
|
248
245
|
const oDataServiceAVT = utils_1.parseAndMergeAndConvert(annotations, logger);
|
|
246
|
+
const generateParameters = {
|
|
247
|
+
manifest: importProjectParameters.manifest,
|
|
248
|
+
serviceAVT: oDataServiceAVT,
|
|
249
|
+
fragments: importProjectParameters.fragments,
|
|
250
|
+
fioriElementsVersion,
|
|
251
|
+
logger: importProjectParameters.logger
|
|
252
|
+
};
|
|
249
253
|
const uiEntityTypes = getAnnotationsForUi(oDataServiceAVT);
|
|
250
254
|
const templateType = utils_1.getTemplateTypeFromManifest(manifest, fioriElementsVersion, logger);
|
|
251
|
-
if (
|
|
252
|
-
|
|
255
|
+
if (templateType) {
|
|
256
|
+
const appSchemas = await generateAppSchemas(generateParameters, uiEntityTypes, templateType);
|
|
257
|
+
configFiles = importConfigs(manifest, flex, appSchemas, templateType, fragments);
|
|
258
|
+
files = getFileList(appSchemas, configFiles);
|
|
253
259
|
}
|
|
254
|
-
const appSchemas = await generateAppSchemas(uiEntityTypes, fioriElementsVersion, oDataServiceAVT, manifest, templateType, fragments);
|
|
255
|
-
configFiles = importConfigs(manifest, flex, appSchemas, oDataServiceAVT, templateType, fragments);
|
|
256
|
-
files = getFileList(appSchemas, configFiles);
|
|
257
260
|
return files;
|
|
258
261
|
}
|
|
259
262
|
exports.importProjectSchemaAndConfig = importProjectSchemaAndConfig;
|