@sap/ux-specification 1.84.36 → 1.84.39
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 +65 -3
- 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/documentation/v4/v4-ApplicationV4.html +1 -1
- package/dist/documentation/v4/v4-ListReport.html +1 -1
- package/dist/documentation/v4/v4-ObjectPage.html +1 -1
- package/dist/index-min.js +1 -1
- package/dist/schemas/v2/AnalyticalListPageConfig.json +9 -5
- package/dist/schemas/v2/ListReportConfig.json +11 -7
- package/dist/schemas/v2/ObjectPageConfig.json +195 -7
- package/dist/schemas/v4/ListReportConfig.json +22 -2
- package/dist/schemas/v4/ObjectPageConfig.json +36 -0
- package/dist/specification/v2/index-min.js +1 -1
- package/dist/src/apiTypes.d.ts +5 -4
- package/dist/src/project.d.ts +1 -0
- package/dist/src/project.js +2 -2
- package/dist/src/project.js.map +1 -1
- package/dist/src/specification/schemaAccess.js +2 -2
- package/dist/src/specification/schemaAccess.js.map +1 -1
- package/dist/src/specification/v2/controls/Facets.d.ts +2 -1
- package/dist/src/specification/v2/controls/ObjectPageSection.d.ts +44 -9
- package/dist/src/specification/v2/controls/ObjectPageSection.js.map +1 -1
- package/dist/src/specification/v2/controls/ObjectPageTable.d.ts +2 -3
- package/dist/src/specification/v2/controls/Table.d.ts +5 -2
- package/dist/src/specification/v2/controls/Table.js +5 -0
- package/dist/src/specification/v2/controls/Table.js.map +1 -1
- package/dist/src/specification/v4/controls/ObjectPageSection.d.ts +22 -1
- package/dist/src/specification/v4/controls/ObjectPageSection.js.map +1 -1
- package/dist/src/specification/v4/controls/Table.d.ts +4 -0
- package/dist/src/sync/common/appProvider.d.ts +1 -1
- package/dist/src/sync/common/appProvider.js +1 -1
- package/dist/src/sync/common/decoration/control.d.ts +1 -1
- package/dist/src/sync/common/decoration/control.js +28 -23
- package/dist/src/sync/common/decoration/control.js.map +1 -1
- package/dist/src/sync/common/decoration/decorators.d.ts +2 -2
- package/dist/src/sync/common/decoration/decorators.js +8 -6
- package/dist/src/sync/common/decoration/decorators.js.map +1 -1
- package/dist/src/sync/common/flexUtils.js +1 -2
- package/dist/src/sync/common/flexUtils.js.map +1 -1
- package/dist/src/sync/common/generate/objectPage.d.ts +8 -9
- package/dist/src/sync/common/generate/objectPage.js +13 -13
- package/dist/src/sync/common/generate/objectPage.js.map +1 -1
- package/dist/src/sync/common/generate/utils.d.ts +62 -13
- package/dist/src/sync/common/generate/utils.js +124 -22
- package/dist/src/sync/common/generate/utils.js.map +1 -1
- package/dist/src/sync/common/import/utils.d.ts +9 -2
- package/dist/src/sync/common/import/utils.js +25 -6
- package/dist/src/sync/common/import/utils.js.map +1 -1
- package/dist/src/sync/common/importProject.d.ts +2 -3
- package/dist/src/sync/common/importProject.js +20 -19
- package/dist/src/sync/common/importProject.js.map +1 -1
- package/dist/src/sync/common/types.d.ts +65 -9
- package/dist/src/sync/common/types.js +57 -4
- package/dist/src/sync/common/types.js.map +1 -1
- package/dist/src/sync/common/utils.d.ts +30 -23
- package/dist/src/sync/common/utils.js +124 -86
- package/dist/src/sync/common/utils.js.map +1 -1
- package/dist/src/sync/v2/application.d.ts +3 -3
- package/dist/src/sync/v2/application.js +4 -4
- package/dist/src/sync/v2/application.js.map +1 -1
- package/dist/src/sync/v2/export/controls/AnalyticalListPageChart.js +1 -1
- package/dist/src/sync/v2/export/controls/AnalyticalListPageChart.js.map +1 -1
- package/dist/src/sync/v2/export/controls/AnalyticalListPageKPI.js +6 -6
- package/dist/src/sync/v2/export/controls/AnalyticalListPageKPI.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageCustomSection.js +3 -3
- package/dist/src/sync/v2/export/controls/ObjectPageCustomSection.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.d.ts +26 -14
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js +57 -5
- package/dist/src/sync/v2/export/controls/ObjectPageSectionsV2.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageTable.d.ts +2 -3
- package/dist/src/sync/v2/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Table.d.ts +3 -3
- package/dist/src/sync/v2/export/controls/Table.js +90 -49
- package/dist/src/sync/v2/export/controls/Table.js.map +1 -1
- package/dist/src/sync/v2/export/export.d.ts +0 -1
- package/dist/src/sync/v2/export/export.js +219 -157
- package/dist/src/sync/v2/export/export.js.map +1 -1
- package/dist/src/sync/v2/export/exportPage.js +34 -33
- package/dist/src/sync/v2/export/exportPage.js.map +1 -1
- package/dist/src/sync/v2/export/manifest.d.ts +6 -0
- package/dist/src/sync/v2/export/manifest.js +50 -35
- package/dist/src/sync/v2/export/manifest.js.map +1 -1
- package/dist/src/sync/v2/export/pages/OverviewPage.d.ts +1 -1
- package/dist/src/sync/v2/export/pages/OverviewPage.js +18 -16
- package/dist/src/sync/v2/export/pages/OverviewPage.js.map +1 -1
- package/dist/src/sync/v2/generate/analyticalListReport.js +3 -3
- package/dist/src/sync/v2/generate/analyticalListReport.js.map +1 -1
- package/dist/src/sync/v2/generate/listReport.d.ts +3 -4
- package/dist/src/sync/v2/generate/listReport.js +1 -1
- package/dist/src/sync/v2/generate/listReport.js.map +1 -1
- package/dist/src/sync/v2/generate/objectPage.js +50 -36
- package/dist/src/sync/v2/generate/objectPage.js.map +1 -1
- package/dist/src/sync/v2/generate/utils.d.ts +11 -9
- package/dist/src/sync/v2/generate/utils.js +98 -95
- package/dist/src/sync/v2/generate/utils.js.map +1 -1
- package/dist/src/sync/v2/import/app/appProvider.d.ts +9 -0
- package/dist/src/sync/v2/import/app/appProvider.js +36 -13
- package/dist/src/sync/v2/import/app/appProvider.js.map +1 -1
- package/dist/src/sync/v2/import/app/ovpProvider.js +1 -1
- package/dist/src/sync/v2/import/app/ovpProvider.js.map +1 -1
- package/dist/src/sync/v2/import/common/index.js +5 -5
- package/dist/src/sync/v2/import/common/index.js.map +1 -1
- package/dist/src/sync/v2/import/pages/objectPage.js +89 -95
- package/dist/src/sync/v2/import/pages/objectPage.js.map +1 -1
- package/dist/src/sync/v2/types.d.ts +8 -3
- package/dist/src/sync/v2/types.js +6 -2
- package/dist/src/sync/v2/types.js.map +1 -1
- package/dist/src/sync/v4/application.d.ts +22 -10
- package/dist/src/sync/v4/application.js +67 -18
- package/dist/src/sync/v4/application.js.map +1 -1
- package/dist/src/sync/v4/export/controls/Table.d.ts +5 -1
- package/dist/src/sync/v4/export/controls/Table.js +83 -50
- package/dist/src/sync/v4/export/controls/Table.js.map +1 -1
- package/dist/src/sync/v4/export/controls/TableColumn.js +4 -4
- package/dist/src/sync/v4/export/controls/TableColumn.js.map +1 -1
- package/dist/src/sync/v4/export/export.js +305 -172
- package/dist/src/sync/v4/export/export.js.map +1 -1
- package/dist/src/sync/v4/export/manifest.js +25 -6
- package/dist/src/sync/v4/export/manifest.js.map +1 -1
- package/dist/src/sync/v4/export/pages/ObjectPage.js +3 -2
- package/dist/src/sync/v4/export/pages/ObjectPage.js.map +1 -1
- package/dist/src/sync/v4/export/types.d.ts +5 -5
- package/dist/src/sync/v4/generate/listReport.d.ts +2 -2
- package/dist/src/sync/v4/generate/listReport.js +264 -165
- package/dist/src/sync/v4/generate/listReport.js.map +1 -1
- package/dist/src/sync/v4/generate/objectPage.d.ts +1 -1
- package/dist/src/sync/v4/generate/objectPage.js +292 -150
- package/dist/src/sync/v4/generate/objectPage.js.map +1 -1
- package/dist/src/sync/v4/import/app/appProvider.js +32 -22
- package/dist/src/sync/v4/import/app/appProvider.js.map +1 -1
- package/dist/src/sync/v4/import/pages/listReport.js +100 -60
- package/dist/src/sync/v4/import/pages/listReport.js.map +1 -1
- package/dist/src/sync/v4/import/pages/objectPage.d.ts +13 -0
- package/dist/src/sync/v4/import/pages/objectPage.js +64 -35
- package/dist/src/sync/v4/import/pages/objectPage.js.map +1 -1
- package/dist/src/sync/v4/import/utils.d.ts +2 -1
- package/dist/src/sync/v4/import/utils.js +1 -1
- package/dist/src/sync/v4/import/utils.js.map +1 -1
- package/dist/src/sync/v4/types.d.ts +2 -0
- package/dist/src/sync/v4/utils/StableIdHelper.js +13 -10
- package/dist/src/sync/v4/utils/StableIdHelper.js.map +1 -1
- package/dist/src/sync/v4/utils/utils.d.ts +9 -8
- package/dist/src/sync/v4/utils/utils.js +26 -26
- package/dist/src/sync/v4/utils/utils.js.map +1 -1
- package/package.json +6 -7
|
@@ -11,7 +11,7 @@ const extensionLogger_1 = require("../../../extensionLogger");
|
|
|
11
11
|
const common_1 = require("../../common");
|
|
12
12
|
/**
|
|
13
13
|
* Adds the selection fields to the app schema, as properties of the Filterbar
|
|
14
|
-
* @param entityType - the entity type as part of the AVT
|
|
14
|
+
* @param entityType - the entity type as part of the AVT ConvertedMetadata
|
|
15
15
|
* @param appSchema - the app specific schema that shall get enhanced
|
|
16
16
|
* @param selectionFieldsAnnotation - the UI.SelectionField annotation
|
|
17
17
|
*/
|
|
@@ -39,17 +39,19 @@ function addSelectionFields(entityType, appSchema, selectionFieldsAnnotation) {
|
|
|
39
39
|
i++;
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Convert alias prefix of visualization if different from @UI (e.g. SAP__UI)
|
|
44
|
+
* @param visualization visualization of an (Selection)PresentationVariant
|
|
45
|
+
* @param alias - the given alias or namespace of the OData annotations
|
|
46
|
+
* @returns the converted visualization
|
|
47
|
+
*/
|
|
42
48
|
function convertVisualization(visualization, alias) {
|
|
43
|
-
if (!visualization) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (visualization.startsWith(`@${common_1.UIVOCABULARY}`)) {
|
|
47
|
-
visualization = visualization.replace(common_1.UIVOCABULARY, '@UI');
|
|
49
|
+
if (visualization && !visualization.startsWith(`@${alias}`)) {
|
|
50
|
+
return visualization.replace(visualization.split('.')[0], '@UI');
|
|
48
51
|
}
|
|
49
|
-
else
|
|
50
|
-
|
|
52
|
+
else {
|
|
53
|
+
return visualization;
|
|
51
54
|
}
|
|
52
|
-
return visualization;
|
|
53
55
|
}
|
|
54
56
|
function defineActions(appSchema, schemaIdForActions, annotations, targetAnnotation, entityType) {
|
|
55
57
|
appSchema.definitions[schemaIdForActions] = JSON.parse(JSON.stringify(appSchema.definitions['Actions']));
|
|
@@ -61,7 +63,7 @@ function defineActions(appSchema, schemaIdForActions, annotations, targetAnnotat
|
|
|
61
63
|
let i = 0;
|
|
62
64
|
chartAnnotation.Actions.forEach((actionRecord) => {
|
|
63
65
|
const actionDefinition = common_1.prepareRef(`${v4_1.DefinitionName.ChartToolBarAction}<${actionRecord.Action}>`);
|
|
64
|
-
const description = common_1.
|
|
66
|
+
const description = common_1.getDataFieldDescription(actionRecord, entityType);
|
|
65
67
|
const prefix = actionRecord.$Type.split(`${common_1.UIVOCABULARY}.`)[1];
|
|
66
68
|
const action = (actions.properties[`${prefix}::${actionRecord.Action}`] = {
|
|
67
69
|
$ref: common_1.DEFINITION_LINK_PREFIX + actionDefinition,
|
|
@@ -120,6 +122,22 @@ function findTheRightVisualization(allVisualizations, alias, namespace, viewKey,
|
|
|
120
122
|
}
|
|
121
123
|
return { visualization, targetAnnotation };
|
|
122
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* An annotationPath must be analyzed, to find the right target annotation and visualization
|
|
127
|
+
*
|
|
128
|
+
*/
|
|
129
|
+
function analyzeChartAnnotation(namespace, annotationPath, annotationAVT, viewKey) {
|
|
130
|
+
const visualization = '@UI.Chart';
|
|
131
|
+
const targetAnnotationFullName = `/${namespace}/@${annotationPath}`;
|
|
132
|
+
let chartTitle;
|
|
133
|
+
if (annotationAVT['Title']) {
|
|
134
|
+
chartTitle = annotationAVT['Title'];
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
chartTitle = `Chart View (${viewKey})`;
|
|
138
|
+
}
|
|
139
|
+
return { visualization, targetAnnotation: targetAnnotationFullName, chartTitle };
|
|
140
|
+
}
|
|
123
141
|
/**
|
|
124
142
|
* An annotationPath must be analyzed, to find the right target annotation and visualization
|
|
125
143
|
* @param annotationPath - given annotationPath
|
|
@@ -127,57 +145,76 @@ function findTheRightVisualization(allVisualizations, alias, namespace, viewKey,
|
|
|
127
145
|
* @param viewKey - allows to distinguish the different view types (LR or ALP)
|
|
128
146
|
* @param visualizationType - allows to find the right visualization if there are many.
|
|
129
147
|
* @returns { visualization: string describing the visualization of the annotation,
|
|
130
|
-
* targetAnnotation: the target annotation behind the visualization
|
|
148
|
+
* targetAnnotation: the target annotation behind the visualization
|
|
149
|
+
* namespace: namespace of the annotation,
|
|
150
|
+
* title: title to be shown, derived from the annotation }
|
|
131
151
|
*/
|
|
132
152
|
function analyzeViewAnnotation(annotationPath, uIAnnotations, generateParameters, viewKey, visualizationType) {
|
|
133
153
|
let namespace = undefined;
|
|
154
|
+
let title = `View (${viewKey})`;
|
|
134
155
|
const annotationInManifest = annotationPath === null || annotationPath === void 0 ? void 0 : annotationPath.split(`${common_1.UIVOCABULARY}.`)[1];
|
|
135
156
|
const annotationAVT = annotationInManifest && uIAnnotations[annotationInManifest];
|
|
136
157
|
if (!annotationAVT) {
|
|
137
|
-
return { visualization: undefined, targetAnnotation: undefined, namespace };
|
|
158
|
+
return { visualization: undefined, targetAnnotation: undefined, namespace, title };
|
|
138
159
|
}
|
|
139
160
|
namespace = annotationAVT.fullyQualifiedName.split('@com.sap.vocabularies.UI.v1.')[0];
|
|
140
161
|
const alias = common_1.findAlias(common_1.UIVOCABULARY, generateParameters.serviceAVT);
|
|
141
162
|
if (annotationInManifest.startsWith('PresentationVariant')) {
|
|
142
163
|
const { visualization, targetAnnotation } = findTheRightVisualization(annotationAVT.Visualizations, alias, namespace, viewKey, visualizationType);
|
|
143
|
-
|
|
164
|
+
if (annotationAVT.Text) {
|
|
165
|
+
title = annotationAVT.Text;
|
|
166
|
+
}
|
|
167
|
+
return { visualization, targetAnnotation, namespace, title };
|
|
144
168
|
}
|
|
145
169
|
else if (annotationInManifest.startsWith('SelectionPresentationVariant')) {
|
|
146
170
|
const { visualization, targetAnnotation } = findTheRightVisualization(annotationAVT.PresentationVariant.Visualizations, alias, namespace, viewKey, visualizationType);
|
|
147
|
-
|
|
171
|
+
if (annotationAVT.Text) {
|
|
172
|
+
title = annotationAVT.Text;
|
|
173
|
+
}
|
|
174
|
+
return { visualization, targetAnnotation, namespace, title };
|
|
175
|
+
}
|
|
176
|
+
else if (annotationInManifest.startsWith('SelectionVariant')) {
|
|
177
|
+
const visualization = '@UI.LineItem';
|
|
178
|
+
const targetAnnotation = `/${namespace}/@com.sap.vocabularies.UI.v1.LineItem`;
|
|
179
|
+
title = annotationAVT.Text ? annotationAVT.Text : `Table View (${viewKey})`;
|
|
180
|
+
return { visualization, targetAnnotation, namespace, title };
|
|
148
181
|
}
|
|
149
|
-
else if (annotationInManifest.startsWith(
|
|
182
|
+
else if (annotationInManifest.startsWith('LineItem')) {
|
|
150
183
|
const visualization = '@UI.LineItem';
|
|
151
184
|
const targetAnnotation = `/${namespace}/@${annotationPath}`;
|
|
152
|
-
|
|
185
|
+
title = annotationAVT.Text ? annotationAVT.Text : `Table View (${viewKey})`;
|
|
186
|
+
return { visualization, targetAnnotation, namespace, title };
|
|
153
187
|
}
|
|
154
188
|
else if (annotationInManifest.startsWith('Chart')) {
|
|
155
|
-
const visualization =
|
|
156
|
-
|
|
157
|
-
return { visualization, targetAnnotation, namespace };
|
|
189
|
+
const { visualization, targetAnnotation, chartTitle } = analyzeChartAnnotation(namespace, annotationPath, annotationAVT, viewKey);
|
|
190
|
+
return { visualization, targetAnnotation, namespace, title: chartTitle };
|
|
158
191
|
}
|
|
192
|
+
return { visualization: undefined, targetAnnotation: undefined, namespace, title };
|
|
159
193
|
}
|
|
160
194
|
/**
|
|
161
195
|
* Adds the ALP chart view to the app-specific schema
|
|
162
196
|
* @param {Definition} appSchema - app-specific JSON schema
|
|
163
197
|
* @param targetAnnotation - target annotation of the chart view, as determined by analyzeViewAnnotation
|
|
164
|
-
* @param {Array<Object>} viewsPaths - views' paths' section in the manifest
|
|
165
198
|
* @param annotations - UI annotations, as determined by AVT
|
|
166
199
|
*/
|
|
167
|
-
function addALPChartView(appSchema,
|
|
200
|
+
function addALPChartView(appSchema, chartAnnotationPath, targetAnnotation, annotations) {
|
|
168
201
|
const chartView = appSchema.definitions[v4_1.DefinitionName.ALPChartView];
|
|
169
202
|
appSchema.definitions[v4_1.DefinitionName.ALPChart] = JSON.parse(JSON.stringify(chartView));
|
|
170
203
|
delete appSchema.definitions[v4_1.DefinitionName.ALPChart][v4_1.SchemaTag.isViewNode];
|
|
171
|
-
|
|
204
|
+
if (targetAnnotation) {
|
|
205
|
+
appSchema.definitions[v4_1.DefinitionName.ALPChart][v4_1.SchemaTag.annotationPath] = targetAnnotation;
|
|
206
|
+
}
|
|
172
207
|
appSchema.definitions[v4_1.DefinitionName.ALPChart].properties.annotationPath[v4_1.SchemaTag.hidden] = true;
|
|
173
|
-
|
|
208
|
+
chartView.properties.annotationPath[v4_1.SchemaTag.hidden] = true;
|
|
174
209
|
chartView.additionalProperties = false;
|
|
175
210
|
chartView.description = `Chart (key: primary)`;
|
|
176
211
|
chartView.title = `Chart`;
|
|
177
212
|
chartView.$ref = `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.ALPChart}`;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
213
|
+
if (chartAnnotationPath) {
|
|
214
|
+
const viewAnnotation = chartAnnotationPath.split(v4_1.UIVOCABULARYDOT)[1];
|
|
215
|
+
const pathParts = annotations[viewAnnotation].fullyQualifiedName.split('@');
|
|
216
|
+
chartView[v4_1.SchemaTag.annotationPath] = `/${pathParts[0]}/@${pathParts[1]}`;
|
|
217
|
+
}
|
|
181
218
|
chartView[v4_1.SchemaTag.artifactType] = common_1.ArtifactType.Manifest;
|
|
182
219
|
chartView[v4_1.SchemaTag.key] = 'primary';
|
|
183
220
|
}
|
|
@@ -193,10 +230,9 @@ function addALPViews(appSchema, viewsPaths, entityType, generateParameters, temp
|
|
|
193
230
|
var _a, _b, _c, _d, _e, _f;
|
|
194
231
|
const annotations = entityType.annotations.UI;
|
|
195
232
|
//1. Chart View
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
233
|
+
const chartAnnotationPath = (_c = (_b = (_a = viewsPaths === null || viewsPaths === void 0 ? void 0 : viewsPaths[0]) === null || _a === void 0 ? void 0 : _a['primary']) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c[v4_1.SchemaTag.annotationPath];
|
|
234
|
+
const { visualization, targetAnnotation } = analyzeViewAnnotation(chartAnnotationPath, annotations, generateParameters, 'primary');
|
|
235
|
+
addALPChartView(appSchema, chartAnnotationPath, targetAnnotation, annotations);
|
|
200
236
|
// Copy toolbar
|
|
201
237
|
const schemaIdForActions = `Actions<ALPChart>`;
|
|
202
238
|
appSchema.definitions[v4_1.DefinitionName.ViewChartToolBar].properties.actions['$ref'] =
|
|
@@ -234,10 +270,10 @@ function addALPViews(appSchema, viewsPaths, entityType, generateParameters, temp
|
|
|
234
270
|
let annotationTerm, viewAnnotation;
|
|
235
271
|
if (tableVisualization && tableVisualization.indexOf(v4_1.FacetBase.LineItem) > -1) {
|
|
236
272
|
annotationTerm = tableVisualization.split('.')[1];
|
|
237
|
-
viewAnnotation = viewsPaths[0]['secondary'][0].annotationPath.split(
|
|
273
|
+
viewAnnotation = viewsPaths[0]['secondary'][0].annotationPath.split(v4_1.UIVOCABULARYDOT)[1];
|
|
238
274
|
}
|
|
239
275
|
else if (templateAnnotation) {
|
|
240
|
-
annotationTerm = viewAnnotation = templateAnnotation.split(
|
|
276
|
+
annotationTerm = viewAnnotation = templateAnnotation.split(v4_1.UIVOCABULARYDOT)[1];
|
|
241
277
|
}
|
|
242
278
|
if (annotationTerm) {
|
|
243
279
|
utils_1.addLineItemsType(appSchema, entityType.annotations.UI[annotationTerm], entityType, generateParameters.serviceAVT, v4_1.DefinitionName.LineItems, v4_1.DefinitionName.ViewTableColumn);
|
|
@@ -247,37 +283,145 @@ function addALPViews(appSchema, viewsPaths, entityType, generateParameters, temp
|
|
|
247
283
|
tableView[v4_1.SchemaTag.key] = 'secondary';
|
|
248
284
|
}
|
|
249
285
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
286
|
+
/**
|
|
287
|
+
* Modifies the app schema, adds the right line chart settings
|
|
288
|
+
* @param inputParameters - list of input parameters as collected by the calling instance
|
|
289
|
+
* @param annotations - UI annotations of the given entityType
|
|
290
|
+
* @returns the ID for the chart view in schema
|
|
291
|
+
*/
|
|
292
|
+
function addViewChartDefinitions(inputParameters, annotations) {
|
|
293
|
+
const idForChart = `${v4_1.DefinitionName.LRChartView}<${inputParameters.viewKey}>`;
|
|
294
|
+
inputParameters.appSchema.definitions[idForChart] = JSON.parse(JSON.stringify(inputParameters.appSchema.definitions[v4_1.DefinitionName.LRChartView]));
|
|
295
|
+
delete inputParameters.appSchema.definitions[idForChart][v4_1.SchemaTag.isViewNode];
|
|
296
|
+
inputParameters.appSchema.definitions[idForChart][v4_1.SchemaTag.annotationPath] = inputParameters.targetAnnotation;
|
|
297
|
+
if (inputParameters.navPropName) {
|
|
298
|
+
inputParameters.appSchema.definitions[idForChart]['navigationProperty'] = inputParameters.navPropName;
|
|
257
299
|
}
|
|
258
300
|
//Copy toolbar
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
appSchema.definitions[
|
|
262
|
-
|
|
301
|
+
const idForToolbar = `${v4_1.DefinitionName.ViewChartToolBar}<${inputParameters.viewKey}>`;
|
|
302
|
+
inputParameters.appSchema.definitions[idForToolbar] = JSON.parse(JSON.stringify(inputParameters.appSchema.definitions[v4_1.DefinitionName.ViewChartToolBar]));
|
|
303
|
+
inputParameters.appSchema.definitions[idForChart]['properties'].toolBar.$ref = `${common_1.DEFINITION_LINK_PREFIX}${idForToolbar}`;
|
|
304
|
+
//Copy actions
|
|
305
|
+
const schemaIdForActions = `${v4_1.DefinitionName.Actions}<${inputParameters.viewKey}>`;
|
|
306
|
+
defineActions(inputParameters.appSchema, schemaIdForActions, annotations, inputParameters.targetAnnotation, inputParameters.targetEntityType);
|
|
307
|
+
inputParameters.appSchema.definitions[idForToolbar]['properties'][common_1.PropertyName.actions]['$ref'] = `${common_1.DEFINITION_LINK_PREFIX}${schemaIdForActions}`;
|
|
308
|
+
return idForChart;
|
|
263
309
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
310
|
+
/**
|
|
311
|
+
* Adds the definition of a chart view to the app schema
|
|
312
|
+
* @param inputParameters - list of input parameters as collected by the calling instance
|
|
313
|
+
* @param UIAnnotations - AVT UI annotations of the gven entity type
|
|
314
|
+
* @param appSchema - app schema
|
|
315
|
+
* @param viewsDefinition - the views definition in app schema (MultiTableModeV4)
|
|
316
|
+
* @param viewKey - view key
|
|
317
|
+
* @param title - view title
|
|
318
|
+
*/
|
|
319
|
+
function addViewChart(inputParameters, UIAnnotations, appSchema, viewsDefinition, viewKey, title) {
|
|
320
|
+
const idForChart = addViewChartDefinitions(inputParameters, UIAnnotations);
|
|
321
|
+
appSchema.definitions[idForChart].properties.annotationPath[v4_1.SchemaTag.hidden] = true;
|
|
322
|
+
appSchema.definitions[idForChart].properties.index[v4_1.SchemaTag.hidden] = true;
|
|
323
|
+
appSchema.definitions[idForChart].properties.entitySet[v4_1.SchemaTag.hidden] = true;
|
|
324
|
+
const titleOnHover = `Chart View (key: ${viewKey})`;
|
|
325
|
+
viewsDefinition.properties[viewKey] = {
|
|
326
|
+
$ref: `${common_1.DEFINITION_LINK_PREFIX}${idForChart}`,
|
|
327
|
+
description: title ? title : titleOnHover,
|
|
328
|
+
title: titleOnHover
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Modifies the app schema, adds the right line item settings as derived from the visualization
|
|
333
|
+
* @param inputParameters - list of input parameters as collected by the calling instance
|
|
334
|
+
* @param viewsDefinition - the views definition in app schema (MultiTableModeV4)
|
|
335
|
+
* @param visualization - visualization from the given (S)PV
|
|
336
|
+
* @param templateAnnotation - defaultTemplateAnnotationPath as registered in manifest
|
|
337
|
+
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
338
|
+
*/
|
|
339
|
+
function addViewLineItems(inputParameters, viewsDefinition, visualization, templateAnnotation, generateParameters) {
|
|
340
|
+
const tableId = `${v4_1.DefinitionName.LRTableView}<${inputParameters.viewKey}>`;
|
|
341
|
+
const viewId = `${v4_1.DefinitionName.LineItemsOfView}::${inputParameters.viewKey}`;
|
|
342
|
+
const lrTableView = common_1.parseSchemaDefinition(v4_1.DefinitionName.LRTableView, inputParameters.viewKey, inputParameters.appSchema);
|
|
343
|
+
delete lrTableView[v4_1.SchemaTag.isViewNode];
|
|
344
|
+
lrTableView[v4_1.SchemaTag.annotationPath] = inputParameters.targetAnnotation;
|
|
345
|
+
if (inputParameters.navPropName) {
|
|
346
|
+
lrTableView['navigationProperty'] = inputParameters.navPropName;
|
|
271
347
|
}
|
|
272
348
|
//Copy toolbar
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
349
|
+
common_1.addDefinitionRef(lrTableView.properties.toolBar, v4_1.DefinitionName.ToolBar, viewId);
|
|
350
|
+
const title = `Table View (key: ${inputParameters.viewKey})`;
|
|
351
|
+
viewsDefinition.properties[inputParameters.viewKey] = {
|
|
352
|
+
$ref: `${common_1.DEFINITION_LINK_PREFIX}${tableId}`,
|
|
353
|
+
description: inputParameters.title || title,
|
|
354
|
+
title
|
|
355
|
+
};
|
|
356
|
+
common_1.addDefinitionRef(lrTableView.properties.columns, viewId);
|
|
357
|
+
lrTableView.properties.annotationPath[v4_1.SchemaTag.hidden] = true;
|
|
358
|
+
lrTableView.properties.index[v4_1.SchemaTag.hidden] = true;
|
|
359
|
+
lrTableView.properties.entitySet[v4_1.SchemaTag.hidden] = true;
|
|
360
|
+
const annotationTerm = (visualization === null || visualization === void 0 ? void 0 : visualization.split('.')[1]) || templateAnnotation.split(v4_1.UIVOCABULARYDOT)[1];
|
|
361
|
+
utils_1.addLineItemsType(inputParameters.appSchema, inputParameters.targetEntityType.annotations.UI[annotationTerm], inputParameters.targetEntityType, generateParameters.serviceAVT, viewId, v4_1.DefinitionName.ViewTableColumn);
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Adds the schema tags to a given view
|
|
365
|
+
* @param viewsDefinition - the views definition in app schema (MultiTableModeV4)
|
|
366
|
+
* @param viewKey - key property of the view
|
|
367
|
+
* @param namespace - target namespace for annotations
|
|
368
|
+
* @param view - the given view
|
|
369
|
+
*/
|
|
370
|
+
function addTagsToView(viewsDefinition, viewKey, namespace, view) {
|
|
371
|
+
viewsDefinition.properties[viewKey][v4_1.SchemaTag.isViewNode] = true;
|
|
372
|
+
viewsDefinition.properties[viewKey][v4_1.SchemaTag.annotationPath] = namespace
|
|
373
|
+
? `/${namespace}/@${view[v4_1.SchemaTag.annotationPath]}`
|
|
374
|
+
: undefined;
|
|
375
|
+
viewsDefinition.properties[viewKey][v4_1.SchemaTag.artifactType] = common_1.ArtifactType.Manifest;
|
|
376
|
+
viewsDefinition.properties[viewKey][v4_1.SchemaTag.key] = viewKey;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Adjusts the entity type if a different entity set is maintained for a view
|
|
380
|
+
* @param {EntitySet} entitySet - actual entity set (AVT information)
|
|
381
|
+
* @param view - the current view in manifest
|
|
382
|
+
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
383
|
+
* @param {EntityType} entityType - actual entity type of the page's entitySet
|
|
384
|
+
* @returns the target entity type
|
|
385
|
+
*/
|
|
386
|
+
function getTargetEntityType(entitySet, view, generateParameters, entityType) {
|
|
387
|
+
let targetEntityType = entityType;
|
|
388
|
+
let viewEntitySet = entitySet;
|
|
389
|
+
if (view['entitySet'] && view['entitySet'] !== entitySet.name) {
|
|
390
|
+
viewEntitySet = generateParameters.serviceAVT.entitySets.find((es) => {
|
|
391
|
+
return es.name === view['entitySet'];
|
|
392
|
+
});
|
|
393
|
+
targetEntityType = viewEntitySet.entityType;
|
|
394
|
+
}
|
|
395
|
+
return targetEntityType;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Adds definition parts to a LR View (LineItem/Chart)
|
|
399
|
+
* @param {string} templateAnnotation - defaultTemplateAnnotationPath as registered in manifest
|
|
400
|
+
* @param {string} visualization - visualization of the annotation
|
|
401
|
+
* @param viewsDefinition - the views definition in app schema (MultiTableModeV4)
|
|
402
|
+
* @param {object} commonInputParameters - list of input parameters as collected by the calling instance
|
|
403
|
+
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
404
|
+
* @param {SapUiAppPageV4} v4Page - the given page in manifest
|
|
405
|
+
* @param uiAnnotations - UI annotations of the given entityType
|
|
406
|
+
*/
|
|
407
|
+
function addLRViewParts(templateAnnotation, visualization, viewsDefinition, commonInputParameters, generateParameters, v4Page, uiAnnotations) {
|
|
408
|
+
if (templateAnnotation || (visualization === null || visualization === void 0 ? void 0 : visualization.indexOf(v4_1.Visualization.LineItem)) > -1) {
|
|
409
|
+
//Add Line item view
|
|
410
|
+
addViewLineItems(commonInputParameters, viewsDefinition, visualization, templateAnnotation, generateParameters);
|
|
411
|
+
}
|
|
412
|
+
else if ((visualization === null || visualization === void 0 ? void 0 : visualization.indexOf('Chart')) > -1) {
|
|
413
|
+
//Add Chart view
|
|
414
|
+
addViewChart(commonInputParameters, uiAnnotations, commonInputParameters.appSchema, viewsDefinition, commonInputParameters.viewKey, commonInputParameters.title);
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
const titleOnHover = `View (key: ${commonInputParameters.viewKey})`;
|
|
418
|
+
viewsDefinition.properties[commonInputParameters.viewKey] = {
|
|
419
|
+
description: commonInputParameters.title || titleOnHover,
|
|
420
|
+
title: titleOnHover,
|
|
421
|
+
// Default view - use table view reference as default
|
|
422
|
+
$ref: `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.LRTableView}`
|
|
423
|
+
};
|
|
424
|
+
}
|
|
281
425
|
}
|
|
282
426
|
/**
|
|
283
427
|
* Add list report views to the app-specific schema
|
|
@@ -286,102 +430,39 @@ function copyChartDefinitions(viewKey, appSchema, targetAnnotation, navPropName,
|
|
|
286
430
|
* @param {EntityType} entityType - actual entity type of the page's entitySet
|
|
287
431
|
* @param {EntitySet} entitySet - actual entity set (AVT information)
|
|
288
432
|
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
289
|
-
* @param templateAnnotation - defaultTemplateAnnotationPath as registered in manifest
|
|
433
|
+
* @param {string} templateAnnotation - defaultTemplateAnnotationPath as registered in manifest
|
|
434
|
+
* @param {SapUiAppPageV4} v4Page - the given page in manifest
|
|
290
435
|
*/
|
|
291
|
-
function addLRViews(appSchema, viewsPaths, entityType, entitySet, generateParameters, templateAnnotation) {
|
|
436
|
+
function addLRViews(appSchema, viewsPaths, entityType, entitySet, generateParameters, templateAnnotation, v4Page) {
|
|
292
437
|
var _a;
|
|
293
438
|
if (!viewsPaths) {
|
|
294
439
|
return;
|
|
295
440
|
}
|
|
296
441
|
const viewsDefinition = appSchema.definitions.MultiTableModeV4;
|
|
297
|
-
for (
|
|
298
|
-
const view = viewsPaths[index];
|
|
442
|
+
for (const view of viewsPaths) {
|
|
299
443
|
if (!view[v4_1.SchemaTag.key]) {
|
|
300
444
|
continue;
|
|
301
445
|
}
|
|
302
|
-
let targetEntityType = entityType;
|
|
303
|
-
let viewEntitySet = entitySet;
|
|
304
446
|
let navPropName = undefined;
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
});
|
|
309
|
-
targetEntityType = viewEntitySet.entityType;
|
|
310
|
-
}
|
|
311
|
-
const annotations = targetEntityType.annotations.UI;
|
|
312
|
-
const { visualization, targetAnnotation, namespace } = analyzeViewAnnotation(view === null || view === void 0 ? void 0 : view[v4_1.SchemaTag.annotationPath], annotations, generateParameters, view[v4_1.SchemaTag.key]);
|
|
447
|
+
const targetEntityType = getTargetEntityType(entitySet, view, generateParameters, entityType);
|
|
448
|
+
const uiAnnotations = targetEntityType.annotations.UI;
|
|
449
|
+
const { visualization, targetAnnotation, namespace, title } = analyzeViewAnnotation(view === null || view === void 0 ? void 0 : view[v4_1.SchemaTag.annotationPath], uiAnnotations, generateParameters, view[v4_1.SchemaTag.key]);
|
|
313
450
|
if (view['entitySet']) {
|
|
314
451
|
navPropName = (_a = entityType.navigationProperties.find((np) => {
|
|
315
452
|
return np.targetTypeName === namespace;
|
|
316
453
|
})) === null || _a === void 0 ? void 0 : _a.name;
|
|
317
454
|
}
|
|
318
|
-
//Add Line item view
|
|
319
455
|
const viewKey = common_1.prepareRef(view[v4_1.SchemaTag.key]);
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
};
|
|
331
|
-
appSchema.definitions[tableDefinitionName].properties.annotationPath[v4_1.SchemaTag.hidden] =
|
|
332
|
-
true;
|
|
333
|
-
appSchema.definitions[tableDefinitionName].properties.entitySet[v4_1.SchemaTag.hidden] = true;
|
|
334
|
-
const annotationTerm = visualization
|
|
335
|
-
? visualization.split('.')[1]
|
|
336
|
-
: templateAnnotation.split('com.sap.vocabularies.UI.v1.')[1];
|
|
337
|
-
utils_1.addLineItemsType(appSchema, targetEntityType.annotations.UI[annotationTerm], targetEntityType, generateParameters.serviceAVT, `${v4_1.DefinitionName.LineItemsOfView}::${viewKey}`, v4_1.DefinitionName.ViewTableColumn);
|
|
338
|
-
}
|
|
339
|
-
else if (visualization && visualization.indexOf('Chart') > -1) {
|
|
340
|
-
//Add Chart view
|
|
341
|
-
const idForChart = copyChartDefinitions(viewKey, appSchema, targetAnnotation, navPropName, annotations, targetEntityType);
|
|
342
|
-
appSchema.definitions[idForChart].properties.annotationPath[v4_1.SchemaTag.hidden] = true;
|
|
343
|
-
appSchema.definitions[idForChart].properties.entitySet[v4_1.SchemaTag.hidden] = true;
|
|
344
|
-
viewsDefinition.properties[viewKey] = {
|
|
345
|
-
$ref: `${common_1.DEFINITION_LINK_PREFIX}${idForChart}`,
|
|
346
|
-
description: `Chart View (key: ${viewKey})`,
|
|
347
|
-
title: `Chart View (${viewKey})`
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
viewsDefinition.properties[viewKey] = {
|
|
352
|
-
description: `View (key: ${viewKey})`,
|
|
353
|
-
title: `View (${viewKey})`,
|
|
354
|
-
properties: {},
|
|
355
|
-
additionalProperties: false
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
viewsDefinition.properties[viewKey][v4_1.SchemaTag.isViewNode] = true;
|
|
359
|
-
viewsDefinition.properties[viewKey][v4_1.SchemaTag.propertyIndex] = index;
|
|
360
|
-
viewsDefinition.properties[viewKey][v4_1.SchemaTag.annotationPath] = namespace
|
|
361
|
-
? `/${namespace}/@${view[v4_1.SchemaTag.annotationPath]}`
|
|
362
|
-
: undefined;
|
|
363
|
-
viewsDefinition.properties[viewKey][v4_1.SchemaTag.artifactType] = common_1.ArtifactType.Manifest;
|
|
364
|
-
viewsDefinition.properties[viewKey][v4_1.SchemaTag.key] = viewKey;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Add views to schema (LR or ALP)
|
|
369
|
-
* @param {Definition} appSchema - app-specific JSON schema
|
|
370
|
-
* @param {SapUiAppPageV4} v4Page - actual page in the manifest
|
|
371
|
-
* @param {EntityType} entityType - actual entity type (AVT information)
|
|
372
|
-
* @param {EntitySet} entitySet - actual entity set (AVT information)
|
|
373
|
-
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
374
|
-
*/
|
|
375
|
-
function addViews(appSchema, v4Page, entityType, entitySet, generateParameters) {
|
|
376
|
-
var _a, _b, _c, _d, _e;
|
|
377
|
-
const viewsPaths = (_c = (_b = (_a = v4Page.options) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.views) === null || _c === void 0 ? void 0 : _c.paths;
|
|
378
|
-
const templateAnnotation = (_e = (_d = v4Page.options) === null || _d === void 0 ? void 0 : _d.settings) === null || _e === void 0 ? void 0 : _e.defaultTemplateAnnotationPath;
|
|
379
|
-
if (generateParameters.templateType === common_1.TemplateType.ListReportObjectPageV4) {
|
|
380
|
-
addLRViews(appSchema, viewsPaths, entityType, entitySet, generateParameters, templateAnnotation);
|
|
381
|
-
appSchema.properties['chart'][v4_1.SchemaTag.hidden] = true;
|
|
382
|
-
}
|
|
383
|
-
else if (generateParameters.templateType === common_1.TemplateType.AnalyticalListPageV4) {
|
|
384
|
-
addALPViews(appSchema, viewsPaths, entityType, generateParameters, templateAnnotation);
|
|
456
|
+
const commonInputParameters = {
|
|
457
|
+
viewKey,
|
|
458
|
+
appSchema,
|
|
459
|
+
targetAnnotation,
|
|
460
|
+
navPropName,
|
|
461
|
+
targetEntityType,
|
|
462
|
+
title
|
|
463
|
+
};
|
|
464
|
+
addLRViewParts(templateAnnotation, visualization, viewsDefinition, commonInputParameters, generateParameters, v4Page, uiAnnotations);
|
|
465
|
+
addTagsToView(viewsDefinition, viewKey, namespace, view);
|
|
385
466
|
}
|
|
386
467
|
}
|
|
387
468
|
/**
|
|
@@ -393,43 +474,66 @@ function addViews(appSchema, v4Page, entityType, entitySet, generateParameters)
|
|
|
393
474
|
* @param appSchema - the app-specific JSON schema
|
|
394
475
|
* @param alias - alias definition for the UI vocabulary
|
|
395
476
|
*/
|
|
396
|
-
function adaptTableDefinition(
|
|
397
|
-
var _a, _b
|
|
477
|
+
function adaptTableDefinition(appSchema, viewsPaths, entityType, generateParameters, templateAnnotation, v4Page, alias) {
|
|
478
|
+
var _a, _b;
|
|
398
479
|
//here: tableDefinitionName = DefinitionName.Table
|
|
399
480
|
const tableDefinitionName = utils_1.alignSchemaWithTemplateType(appSchema, generateParameters);
|
|
400
|
-
const templateAnnotation = (_b = (_a = v4Page.options) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.defaultTemplateAnnotationPath;
|
|
401
481
|
if (templateAnnotation) {
|
|
402
482
|
const { visualization, targetAnnotation, namespace } = analyzeViewAnnotation(templateAnnotation, entityType.annotations.UI, generateParameters, undefined, v4_1.Visualization.LineItem);
|
|
403
483
|
if (visualization) {
|
|
404
484
|
const annotationTerm = visualization.split('.')[1];
|
|
405
485
|
const annotationTermInSchema = `${v4_1.DefinitionName.LineItems}OfSPV::${common_1.prepareRef(annotationTerm)}`;
|
|
406
|
-
appSchema.definitions[`${tableDefinitionName}SPV`] = JSON.parse(JSON.stringify(appSchema.definitions[tableDefinitionName]));
|
|
407
|
-
delete
|
|
408
|
-
|
|
409
|
-
appSchema.definitions[tableDefinitionName]['$ref'] = `${common_1.DEFINITION_LINK_PREFIX}${tableDefinitionName}SPV`;
|
|
410
|
-
delete appSchema.definitions[`${tableDefinitionName}`].properties;
|
|
411
|
-
appSchema.definitions[`${tableDefinitionName}`][v4_1.SchemaTag.annotationPath] = `/${namespace}/@${templateAnnotation}`;
|
|
486
|
+
const spvTable = (appSchema.definitions[`${tableDefinitionName}SPV`] = JSON.parse(JSON.stringify(appSchema.definitions[tableDefinitionName])));
|
|
487
|
+
delete spvTable[v4_1.SchemaTag.isViewNode];
|
|
488
|
+
common_1.addDefinitionRef(spvTable.properties.toolBar, v4_1.DefinitionName.ToolBar, annotationTermInSchema);
|
|
412
489
|
// Switch from generic column to specific definition
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
appSchema.definitions[
|
|
490
|
+
spvTable[v4_1.SchemaTag.annotationPath] = targetAnnotation;
|
|
491
|
+
spvTable.properties.columns = {};
|
|
492
|
+
common_1.addDefinitionRef(spvTable.properties.columns, annotationTermInSchema);
|
|
493
|
+
const tableDefinition = appSchema.definitions[tableDefinitionName];
|
|
494
|
+
delete tableDefinition.properties;
|
|
495
|
+
common_1.addDefinitionRef(tableDefinition, `${tableDefinitionName}SPV`);
|
|
496
|
+
tableDefinition[v4_1.SchemaTag.annotationPath] = `/${namespace}/@${templateAnnotation}`;
|
|
417
497
|
const lineItemAnnotation = entityType.annotations.UI[annotationTerm];
|
|
418
498
|
utils_1.addLineItemsType(appSchema, lineItemAnnotation, entityType, generateParameters.serviceAVT, annotationTermInSchema);
|
|
419
499
|
}
|
|
420
500
|
}
|
|
501
|
+
else if (viewsPaths) {
|
|
502
|
+
const tableDefinition = appSchema.definitions[tableDefinitionName];
|
|
503
|
+
delete tableDefinition.properties.toolBar;
|
|
504
|
+
delete tableDefinition.properties.columns;
|
|
505
|
+
}
|
|
421
506
|
else {
|
|
422
507
|
const tableDefinition = appSchema.definitions[tableDefinitionName];
|
|
423
508
|
tableDefinition.properties.toolBar['$ref'] = `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.ToolBarLR}`;
|
|
424
509
|
// Switch from generic column to specific definition
|
|
425
|
-
tableDefinition.properties
|
|
426
|
-
|
|
427
|
-
};
|
|
428
|
-
utils_1.addLineItemsType(appSchema, (_d = (_c = entityType === null || entityType === void 0 ? void 0 : entityType.annotations) === null || _c === void 0 ? void 0 : _c[alias]) === null || _d === void 0 ? void 0 : _d.LineItem, entityType, generateParameters.serviceAVT, v4_1.DefinitionName.LineItems);
|
|
510
|
+
common_1.addDefinitionRef(tableDefinition.properties.columns, v4_1.DefinitionName.LineItems);
|
|
511
|
+
utils_1.addLineItemsType(appSchema, (_b = (_a = entityType === null || entityType === void 0 ? void 0 : entityType.annotations) === null || _a === void 0 ? void 0 : _a[alias]) === null || _b === void 0 ? void 0 : _b.LineItem, entityType, generateParameters.serviceAVT, v4_1.DefinitionName.LineItems);
|
|
429
512
|
}
|
|
430
513
|
}
|
|
431
514
|
/**
|
|
432
|
-
*
|
|
515
|
+
* Add views to schema (LR or ALP)
|
|
516
|
+
* @param {Definition} appSchema - app-specific JSON schema
|
|
517
|
+
* @param {SapUiAppPageV4} v4Page - actual page in the manifest
|
|
518
|
+
* @param {EntityType} entityType - actual entity type (AVT information)
|
|
519
|
+
* @param {EntitySet} entitySet - actual entity set (AVT information)
|
|
520
|
+
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
521
|
+
*/
|
|
522
|
+
function addTableAndViews(appSchema, v4Page, entityType, entitySet, generateParameters, alias) {
|
|
523
|
+
var _a, _b, _c, _d, _e;
|
|
524
|
+
const viewsPaths = (_c = (_b = (_a = v4Page.options) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.views) === null || _c === void 0 ? void 0 : _c.paths;
|
|
525
|
+
const templateAnnotation = (_e = (_d = v4Page.options) === null || _d === void 0 ? void 0 : _d.settings) === null || _e === void 0 ? void 0 : _e.defaultTemplateAnnotationPath;
|
|
526
|
+
if (generateParameters.templateType === common_1.TemplateType.ListReportObjectPageV4) {
|
|
527
|
+
adaptTableDefinition(appSchema, viewsPaths, entityType, generateParameters, templateAnnotation, v4Page, alias);
|
|
528
|
+
addLRViews(appSchema, viewsPaths, entityType, entitySet, generateParameters, templateAnnotation, v4Page);
|
|
529
|
+
appSchema.properties[common_1.PropertyName.chart][v4_1.SchemaTag.hidden] = true;
|
|
530
|
+
}
|
|
531
|
+
else if (generateParameters.templateType === common_1.TemplateType.AnalyticalListPageV4) {
|
|
532
|
+
addALPViews(appSchema, viewsPaths, entityType, generateParameters, templateAnnotation);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Generates an app specific schema for the FE V4 ListReport from the generic schema.
|
|
433
537
|
* Generic types are replaced by information from the app specific annotations.
|
|
434
538
|
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
435
539
|
* @param genericSchema - generic JSON schema of an object page
|
|
@@ -446,7 +550,7 @@ function generateListReportSchemaV4(generateParameters, genericSchema, entitySet
|
|
|
446
550
|
//Add selection fields
|
|
447
551
|
const selectionFieldAnnotation = (_b = (_a = entityType === null || entityType === void 0 ? void 0 : entityType.annotations) === null || _a === void 0 ? void 0 : _a[alias]) === null || _b === void 0 ? void 0 : _b.SelectionFields;
|
|
448
552
|
addSelectionFields(entityType, appSchema, selectionFieldAnnotation);
|
|
449
|
-
appSchema.properties[
|
|
553
|
+
appSchema.properties[common_1.PropertyName.defaultTemplateAnnotationPath][v4_1.SchemaTag.hidden] = true;
|
|
450
554
|
//enum for annotation path as part of QuickVarianSelection
|
|
451
555
|
common_1.addEnumForSingleTabVariant(entityType, appSchema, v4_1.DefinitionName.AnnotationPathAsObject);
|
|
452
556
|
if (generateParameters.manifest) {
|
|
@@ -467,15 +571,10 @@ function generateListReportSchemaV4(generateParameters, genericSchema, entitySet
|
|
|
467
571
|
if (!v4Page) {
|
|
468
572
|
return appSchema;
|
|
469
573
|
}
|
|
470
|
-
|
|
471
|
-
//LR table definition
|
|
472
|
-
adaptTableDefinition(v4Page, entityType, generateParameters, appSchema, alias);
|
|
473
|
-
}
|
|
474
|
-
// Handle LR & ALP views
|
|
475
|
-
addViews(appSchema, v4Page, entityType, entitySet, generateParameters);
|
|
574
|
+
addTableAndViews(appSchema, v4Page, entityType, entitySet, generateParameters, alias);
|
|
476
575
|
}
|
|
477
|
-
delete appSchema.definitions
|
|
478
|
-
delete appSchema.definitions
|
|
576
|
+
delete appSchema.definitions.GenericColumns;
|
|
577
|
+
delete appSchema.definitions.Action;
|
|
479
578
|
return appSchema;
|
|
480
579
|
}
|
|
481
580
|
exports.generateListReportSchemaV4 = generateListReportSchemaV4;
|