@sap/ux-specification 1.90.24 → 1.90.27
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 +80 -1
- 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 +10 -10
- package/dist/schemas/v2/ListReportConfig.json +15 -15
- package/dist/schemas/v2/ObjectPageConfig.json +204 -20
- package/dist/schemas/v4/ListReportConfig.json +33 -3
- package/dist/schemas/v4/ObjectPageConfig.json +36 -0
- package/dist/scripts/to-json-schema.js +1 -1
- package/dist/scripts/to-json-schema.js.map +1 -1
- package/dist/specification/v2/index-min.js +1 -1
- package/dist/src/apiTypes.d.ts +2 -1
- package/dist/src/project.d.ts +1 -0
- package/dist/src/project.js +13 -5
- package/dist/src/project.js.map +1 -1
- package/dist/src/specification/v2/controls/Action.d.ts +6 -4
- package/dist/src/specification/v2/controls/ObjectPageHeader.d.ts +3 -2
- package/dist/src/specification/v2/controls/ObjectPageSection.d.ts +40 -7
- package/dist/src/specification/v2/controls/ObjectPageSection.js.map +1 -1
- package/dist/src/specification/v2/controls/ObjectPageTable.d.ts +5 -3
- package/dist/src/specification/v2/controls/ObjectPageTable.js.map +1 -1
- package/dist/src/specification/v2/controls/Table.d.ts +7 -4
- 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 +8 -0
- package/dist/src/specification/v4/pages/ListReportConfig.d.ts +6 -1
- package/dist/src/specification/v4/webapp/manifest/sapUiPageV4.d.ts +1 -0
- package/dist/src/specification/v4/webapp/manifest/sapUiPageV4.js.map +1 -1
- package/dist/src/sync/common/decoration/control.d.ts +1 -1
- package/dist/src/sync/common/decoration/control.js +27 -22
- package/dist/src/sync/common/decoration/control.js.map +1 -1
- package/dist/src/sync/common/generate/objectPage.d.ts +5 -4
- package/dist/src/sync/common/generate/objectPage.js +67 -66
- package/dist/src/sync/common/generate/objectPage.js.map +1 -1
- package/dist/src/sync/common/generate/utils.d.ts +54 -13
- package/dist/src/sync/common/generate/utils.js +140 -47
- package/dist/src/sync/common/generate/utils.js.map +1 -1
- package/dist/src/sync/common/import/utils.d.ts +3 -2
- package/dist/src/sync/common/import/utils.js +11 -6
- package/dist/src/sync/common/import/utils.js.map +1 -1
- 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 +105 -26
- package/dist/src/sync/common/types.js +101 -22
- package/dist/src/sync/common/types.js.map +1 -1
- package/dist/src/sync/common/utils.d.ts +17 -12
- package/dist/src/sync/common/utils.js +132 -88
- package/dist/src/sync/common/utils.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Action.d.ts +12 -10
- package/dist/src/sync/v2/export/controls/Action.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/FormAction.d.ts +9 -7
- package/dist/src/sync/v2/export/controls/FormAction.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Fragment.js +2 -2
- package/dist/src/sync/v2/export/controls/Fragment.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageFooterAction.d.ts +6 -4
- package/dist/src/sync/v2/export/controls/ObjectPageFooterAction.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageHeader.d.ts +3 -2
- package/dist/src/sync/v2/export/controls/ObjectPageHeader.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.d.ts +6 -4
- package/dist/src/sync/v2/export/controls/ObjectPageHeaderAction.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 +5 -3
- package/dist/src/sync/v2/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/src/sync/v2/export/controls/ObjectPageToolBarAction.d.ts +6 -4
- package/dist/src/sync/v2/export/controls/ObjectPageToolBarAction.js.map +1 -1
- package/dist/src/sync/v2/export/controls/Table.d.ts +6 -3
- package/dist/src/sync/v2/export/controls/Table.js +89 -48
- package/dist/src/sync/v2/export/controls/Table.js.map +1 -1
- package/dist/src/sync/v2/export/controls/TableColumn.d.ts +12 -10
- package/dist/src/sync/v2/export/controls/TableColumn.js.map +1 -1
- package/dist/src/sync/v2/export/export.d.ts +0 -1
- package/dist/src/sync/v2/export/export.js +222 -160
- package/dist/src/sync/v2/export/export.js.map +1 -1
- package/dist/src/sync/v2/export/exportPage.js +35 -34
- package/dist/src/sync/v2/export/exportPage.js.map +1 -1
- package/dist/src/sync/v2/export/manifest.d.ts +22 -0
- package/dist/src/sync/v2/export/manifest.js +77 -36
- 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 +10 -10
- package/dist/src/sync/v2/generate/analyticalListReport.js.map +1 -1
- 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 +57 -43
- package/dist/src/sync/v2/generate/objectPage.js.map +1 -1
- package/dist/src/sync/v2/generate/utils.d.ts +5 -4
- package/dist/src/sync/v2/generate/utils.js +73 -69
- 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 +6 -6
- package/dist/src/sync/v2/import/common/index.js.map +1 -1
- package/dist/src/sync/v2/import/pages/objectPage.js +93 -101
- package/dist/src/sync/v2/import/pages/objectPage.js.map +1 -1
- package/dist/src/sync/v2/import/pages/overviewPage.js +1 -1
- package/dist/src/sync/v2/import/pages/overviewPage.js.map +1 -1
- package/dist/src/sync/v2/import/utils.js +1 -1
- package/dist/src/sync/v2/import/utils.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 +68 -19
- package/dist/src/sync/v4/application.js.map +1 -1
- package/dist/src/sync/v4/export/controls/ObjectPageTable.js +6 -18
- package/dist/src/sync/v4/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/src/sync/v4/export/controls/Table.d.ts +8 -1
- package/dist/src/sync/v4/export/controls/Table.js +110 -86
- 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 +285 -150
- 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/ListReport.d.ts +1 -0
- package/dist/src/sync/v4/export/pages/ListReport.js +7 -0
- package/dist/src/sync/v4/export/pages/ListReport.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.js +304 -156
- 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 +286 -148
- 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 +54 -37
- 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.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 +7 -7
- package/dist/src/sync/v4/utils/utils.js +44 -34
- package/dist/src/sync/v4/utils/utils.js.map +1 -1
- package/dist/test/unit/export/manifest.test.d.ts +1 -0
- package/package.json +3 -3
|
@@ -19,7 +19,7 @@ function addSelectionFields(entityType, appSchema, selectionFieldsAnnotation) {
|
|
|
19
19
|
const selectionFieldsDefinition = appSchema['definitions'].SelectionFields;
|
|
20
20
|
selectionFieldsDefinition.additionalProperties = false;
|
|
21
21
|
selectionFieldsDefinition.properties = {};
|
|
22
|
-
selectionFieldsDefinition.annotationPath = common_1.createAnnotationPath(entityType.fullyQualifiedName, "com.sap.vocabularies.UI.v1.SelectionFields" /* SelectionFields */);
|
|
22
|
+
selectionFieldsDefinition[v4_1.SchemaTag.annotationPath] = common_1.createAnnotationPath(entityType.fullyQualifiedName, "com.sap.vocabularies.UI.v1.SelectionFields" /* SelectionFields */);
|
|
23
23
|
if (!selectionFieldsAnnotation) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -31,11 +31,11 @@ function addSelectionFields(entityType, appSchema, selectionFieldsAnnotation) {
|
|
|
31
31
|
description = common_1.getLabelForPropertyPath(selectionField, entityType);
|
|
32
32
|
}
|
|
33
33
|
selectionFieldsDefinition['properties'][fieldDefinition] = {
|
|
34
|
-
$ref: common_1.DEFINITION_LINK_PREFIX + fieldDefinition
|
|
35
|
-
propertyIndex: i
|
|
34
|
+
$ref: common_1.DEFINITION_LINK_PREFIX + fieldDefinition
|
|
36
35
|
};
|
|
36
|
+
selectionFieldsDefinition['properties'][fieldDefinition][v4_1.SchemaTag.propertyIndex] = i;
|
|
37
37
|
const dataType = common_1.determineDataType(selectionField);
|
|
38
|
-
appSchema['definitions'][fieldDefinition] = Object.assign({ type: 'object', properties: {}, description, annotationPath: `${selectionFieldsDefinition.annotationPath}/${i}`, isViewNode: true, additionalProperties: false, annotationType: selectionField === null || selectionField === void 0 ? void 0 : selectionField.type }, (dataType && { dataType }));
|
|
38
|
+
appSchema['definitions'][fieldDefinition] = Object.assign({ type: 'object', properties: {}, description, annotationPath: `${selectionFieldsDefinition[v4_1.SchemaTag.annotationPath]}/${i}`, isViewNode: true, additionalProperties: false, annotationType: selectionField === null || selectionField === void 0 ? void 0 : selectionField.type }, (dataType && { dataType }));
|
|
39
39
|
i++;
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -52,7 +52,8 @@ function convertVisualization(visualization, alias) {
|
|
|
52
52
|
return visualization;
|
|
53
53
|
}
|
|
54
54
|
function defineActions(appSchema, schemaIdForActions, annotations, targetAnnotation, entityType) {
|
|
55
|
-
|
|
55
|
+
appSchema.definitions[schemaIdForActions] = JSON.parse(JSON.stringify(appSchema.definitions['Actions']));
|
|
56
|
+
const actions = appSchema.definitions[schemaIdForActions];
|
|
56
57
|
actions.properties = {};
|
|
57
58
|
actions.additionalProperties = false;
|
|
58
59
|
const chartAnnotation = annotations[targetAnnotation === null || targetAnnotation === void 0 ? void 0 : targetAnnotation.split(`${common_1.UIVOCABULARY}.`)[1]];
|
|
@@ -60,32 +61,34 @@ function defineActions(appSchema, schemaIdForActions, annotations, targetAnnotat
|
|
|
60
61
|
let i = 0;
|
|
61
62
|
chartAnnotation.Actions.forEach((actionRecord) => {
|
|
62
63
|
const actionDefinition = common_1.prepareRef(`${v4_1.DefinitionName.ChartToolBarAction}<${actionRecord.Action}>`);
|
|
63
|
-
const description = common_1.
|
|
64
|
+
const description = common_1.getDataFieldDescription(actionRecord, entityType);
|
|
64
65
|
const prefix = actionRecord.$Type.split(`${common_1.UIVOCABULARY}.`)[1];
|
|
65
|
-
actions
|
|
66
|
+
const action = (actions.properties[`${prefix}::${actionRecord.Action}`] = {
|
|
66
67
|
$ref: common_1.DEFINITION_LINK_PREFIX + actionDefinition,
|
|
67
|
-
description
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
description
|
|
69
|
+
});
|
|
70
|
+
//Add tags
|
|
71
|
+
action[v4_1.SchemaTag.propertyIndex] = i;
|
|
72
|
+
action[v4_1.SchemaTag.annotationType] = actionRecord.$Type;
|
|
73
|
+
action[v4_1.SchemaTag.annotationPath] = `/${actionRecord.fullyQualifiedName}`;
|
|
72
74
|
//as ChartToolBarAction is an empty objec, copy ViewToolBarAction and remove properties
|
|
73
|
-
appSchema
|
|
74
|
-
appSchema
|
|
75
|
-
appSchema
|
|
75
|
+
appSchema.definitions[actionDefinition] = JSON.parse(JSON.stringify(appSchema.definitions[v4_1.DefinitionName.ViewToolBarAction]));
|
|
76
|
+
appSchema.definitions[actionDefinition].properties = {};
|
|
77
|
+
appSchema.definitions[actionDefinition][v4_1.SchemaTag.annotationPath] = actionRecord.fullyQualifiedName;
|
|
76
78
|
i++;
|
|
77
79
|
});
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
/**
|
|
81
|
-
* Finds the right visualization for
|
|
82
|
-
* @param viewKey - view key (primary, secondary, or anything else)
|
|
83
|
+
* Finds the right visualization for a given view
|
|
83
84
|
* @param allVisualizations - list of visualizations for the given (S)PV
|
|
84
85
|
* @param alias - alias definition for the relevant namespace
|
|
85
86
|
* @param namespace - namespace for the UI annotations
|
|
87
|
+
* @param viewKey - view key: primary, secondary, or anything else; may also be undefined. The first visualization is taken in this case.
|
|
88
|
+
* @param visualizationType - allows to find the right visualization if there are many.
|
|
86
89
|
* @returns the value of the first fitting visualization
|
|
87
90
|
*/
|
|
88
|
-
function findTheRightVisualization(
|
|
91
|
+
function findTheRightVisualization(allVisualizations, alias, namespace, viewKey, visualizationType) {
|
|
89
92
|
var _a;
|
|
90
93
|
let visualization, visualizationObject, targetAnnotation;
|
|
91
94
|
if (allVisualizations) {
|
|
@@ -96,11 +99,16 @@ function findTheRightVisualization(viewKey, allVisualizations, alias, namespace)
|
|
|
96
99
|
}
|
|
97
100
|
else if (viewKey === 'secondary') {
|
|
98
101
|
visualizationObject = allVisualizations.find((vis) => {
|
|
99
|
-
return vis['value'].indexOf(
|
|
102
|
+
return vis['value'].indexOf(v4_1.FacetBase.LineItem) > -1;
|
|
100
103
|
});
|
|
101
104
|
}
|
|
102
105
|
else {
|
|
103
|
-
|
|
106
|
+
if (visualizationType) {
|
|
107
|
+
visualizationObject = allVisualizations.find((v) => v['value'].indexOf(visualizationType) > -1);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
visualizationObject = allVisualizations[0];
|
|
111
|
+
}
|
|
104
112
|
}
|
|
105
113
|
visualization = convertVisualization(visualizationObject === null || visualizationObject === void 0 ? void 0 : visualizationObject['value'], alias);
|
|
106
114
|
if ((_a = visualizationObject === null || visualizationObject === void 0 ? void 0 : visualizationObject['$target']) === null || _a === void 0 ? void 0 : _a.fullyQualifiedName) {
|
|
@@ -113,70 +121,120 @@ function findTheRightVisualization(viewKey, allVisualizations, alias, namespace)
|
|
|
113
121
|
return { visualization, targetAnnotation };
|
|
114
122
|
}
|
|
115
123
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
124
|
+
* An annotationPath must be analyzed, to find the right target annotation and visualization
|
|
125
|
+
*
|
|
126
|
+
*/
|
|
127
|
+
function analyzeChartAnnotation(namespace, annotationPath, annotationAVT, viewKey, uIAnnotations) {
|
|
128
|
+
const visualization = '@UI.Chart';
|
|
129
|
+
const targetAnnotationFullName = `/${namespace}/@${annotationPath}`;
|
|
130
|
+
let chartTitle;
|
|
131
|
+
if (annotationAVT.Text) {
|
|
132
|
+
chartTitle = annotationAVT.Text;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
const targetAnnotationArray = annotationPath.split('.');
|
|
136
|
+
const targetAnnotation = uIAnnotations[targetAnnotationArray[targetAnnotationArray.length - 1]];
|
|
137
|
+
if (targetAnnotation.Title) {
|
|
138
|
+
chartTitle = targetAnnotation.Title;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
chartTitle = `Chart View (${viewKey})`;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return { visualization, targetAnnotation: targetAnnotationFullName, chartTitle };
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* An annotationPath must be analyzed, to find the right target annotation and visualization
|
|
148
|
+
* @param annotationPath - given annotationPath
|
|
118
149
|
* @param uIAnnotations - annotations of UI namespace of the given entityType
|
|
119
|
-
* @param viewKey - allows to distinguish the different view or
|
|
150
|
+
* @param viewKey - allows to distinguish the different view types (LR or ALP)
|
|
151
|
+
* @param visualizationType - allows to find the right visualization if there are many.
|
|
120
152
|
* @returns { visualization: string describing the visualization of the annotation,
|
|
121
|
-
* targetAnnotation: the target annotation behind the visualization
|
|
153
|
+
* targetAnnotation: the target annotation behind the visualization
|
|
154
|
+
* namespace: namespace of the annotation,
|
|
155
|
+
* title: title to be shown, derived from the annotation }
|
|
122
156
|
*/
|
|
123
|
-
function analyzeViewAnnotation(
|
|
124
|
-
var _a;
|
|
157
|
+
function analyzeViewAnnotation(annotationPath, uIAnnotations, generateParameters, viewKey, visualizationType) {
|
|
125
158
|
let namespace = undefined;
|
|
126
|
-
|
|
127
|
-
const
|
|
159
|
+
let title = `View (${viewKey})`;
|
|
160
|
+
const annotationInManifest = annotationPath === null || annotationPath === void 0 ? void 0 : annotationPath.split(`${common_1.UIVOCABULARY}.`)[1];
|
|
161
|
+
const annotationAVT = annotationInManifest && uIAnnotations[annotationInManifest];
|
|
128
162
|
if (!annotationAVT) {
|
|
129
|
-
return { visualization: undefined, targetAnnotation: undefined, namespace };
|
|
163
|
+
return { visualization: undefined, targetAnnotation: undefined, namespace, title };
|
|
130
164
|
}
|
|
131
165
|
namespace = annotationAVT.fullyQualifiedName.split('@com.sap.vocabularies.UI.v1.')[0];
|
|
132
166
|
const alias = common_1.findAlias(common_1.UIVOCABULARY, generateParameters.serviceAVT);
|
|
133
167
|
if (annotationInManifest.startsWith('PresentationVariant')) {
|
|
134
|
-
const { visualization, targetAnnotation } = findTheRightVisualization(
|
|
135
|
-
|
|
168
|
+
const { visualization, targetAnnotation } = findTheRightVisualization(annotationAVT.Visualizations, alias, namespace, viewKey, visualizationType);
|
|
169
|
+
if (annotationAVT.Text) {
|
|
170
|
+
title = annotationAVT.Text;
|
|
171
|
+
}
|
|
172
|
+
return { visualization, targetAnnotation, namespace, title };
|
|
136
173
|
}
|
|
137
174
|
else if (annotationInManifest.startsWith('SelectionPresentationVariant')) {
|
|
138
|
-
const { visualization, targetAnnotation } = findTheRightVisualization(
|
|
139
|
-
|
|
175
|
+
const { visualization, targetAnnotation } = findTheRightVisualization(annotationAVT.PresentationVariant.Visualizations, alias, namespace, viewKey, visualizationType);
|
|
176
|
+
if (annotationAVT.Text) {
|
|
177
|
+
title = annotationAVT.Text;
|
|
178
|
+
}
|
|
179
|
+
return { visualization, targetAnnotation, namespace, title };
|
|
180
|
+
}
|
|
181
|
+
else if (annotationInManifest.startsWith('SelectionVariant')) {
|
|
182
|
+
const visualization = '@UI.LineItem';
|
|
183
|
+
const targetAnnotation = `/${namespace}/@com.sap.vocabularies.UI.v1.LineItem`;
|
|
184
|
+
title = annotationAVT.Text ? annotationAVT.Text : `Table View (${viewKey})`;
|
|
185
|
+
return { visualization, targetAnnotation, namespace, title };
|
|
140
186
|
}
|
|
141
187
|
else if (annotationInManifest.startsWith('LineItem')) {
|
|
142
188
|
const visualization = '@UI.LineItem';
|
|
143
|
-
const targetAnnotation = `/${namespace}/@${
|
|
144
|
-
|
|
189
|
+
const targetAnnotation = `/${namespace}/@${annotationPath}`;
|
|
190
|
+
title = annotationAVT.Text ? annotationAVT.Text : `Table View (${viewKey})`;
|
|
191
|
+
return { visualization, targetAnnotation, namespace, title };
|
|
145
192
|
}
|
|
146
193
|
else if (annotationInManifest.startsWith('Chart')) {
|
|
147
|
-
const visualization =
|
|
148
|
-
|
|
149
|
-
return { visualization, targetAnnotation, namespace };
|
|
194
|
+
const { visualization, targetAnnotation, chartTitle } = analyzeChartAnnotation(namespace, annotationPath, annotationAVT, viewKey, uIAnnotations);
|
|
195
|
+
return { visualization, targetAnnotation, namespace, title: chartTitle };
|
|
150
196
|
}
|
|
197
|
+
return { visualization: undefined, targetAnnotation: undefined, namespace, title };
|
|
151
198
|
}
|
|
152
199
|
/**
|
|
153
|
-
*
|
|
200
|
+
* Adds the ALP chart view to the app-specific schema
|
|
201
|
+
* @param {Definition} appSchema - app-specific JSON schema
|
|
202
|
+
* @param targetAnnotation - target annotation of the chart view, as determined by analyzeViewAnnotation
|
|
203
|
+
* @param {Array<Object>} viewsPaths - views' paths' section in the manifest
|
|
204
|
+
* @param annotations - UI annotations, as determined by AVT
|
|
205
|
+
*/
|
|
206
|
+
function addALPChartView(appSchema, targetAnnotation, viewsPaths, annotations) {
|
|
207
|
+
const chartView = appSchema.definitions[v4_1.DefinitionName.ALPChartView];
|
|
208
|
+
appSchema.definitions[v4_1.DefinitionName.ALPChart] = JSON.parse(JSON.stringify(chartView));
|
|
209
|
+
delete appSchema.definitions[v4_1.DefinitionName.ALPChart][v4_1.SchemaTag.isViewNode];
|
|
210
|
+
appSchema.definitions[v4_1.DefinitionName.ALPChart][v4_1.SchemaTag.annotationPath] = targetAnnotation;
|
|
211
|
+
appSchema.definitions[v4_1.DefinitionName.ALPChart].properties.annotationPath[v4_1.SchemaTag.hidden] = true;
|
|
212
|
+
delete chartView.properties;
|
|
213
|
+
chartView.additionalProperties = false;
|
|
214
|
+
chartView.description = `Chart (key: primary)`;
|
|
215
|
+
chartView.title = `Chart`;
|
|
216
|
+
chartView.$ref = `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.ALPChart}`;
|
|
217
|
+
const viewAnnotation = viewsPaths[0]['primary'][0].annotationPath.split(v4_1.UIVOCABULARYDOT)[1];
|
|
218
|
+
const pathParts = annotations[viewAnnotation].fullyQualifiedName.split('@');
|
|
219
|
+
chartView[v4_1.SchemaTag.annotationPath] = `/${pathParts[0]}/@${pathParts[1]}`;
|
|
220
|
+
chartView[v4_1.SchemaTag.artifactType] = common_1.ArtifactType.Manifest;
|
|
221
|
+
chartView[v4_1.SchemaTag.key] = 'primary';
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Adds the ALP views to the app-specific schema
|
|
154
225
|
* @param {Definition} appSchema - app-specific JSON schema
|
|
155
226
|
* @param {Array<Object>} viewsPaths - views' paths' section in the manifest
|
|
156
227
|
* @param {EntityType} entityType - actual entity type of the page's entitySet
|
|
157
228
|
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
229
|
+
* @param templateAnnotation - defaultTemplateAnnotationPath as registered in manifest
|
|
158
230
|
*/
|
|
159
|
-
function addALPViews(appSchema, viewsPaths, entityType, generateParameters) {
|
|
160
|
-
var _a, _b, _c, _d;
|
|
231
|
+
function addALPViews(appSchema, viewsPaths, entityType, generateParameters, templateAnnotation) {
|
|
232
|
+
var _a, _b, _c, _d, _e, _f;
|
|
161
233
|
const annotations = entityType.annotations.UI;
|
|
162
234
|
//1. Chart View
|
|
163
|
-
const { visualization, targetAnnotation } = analyzeViewAnnotation((_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], annotations, generateParameters, 'primary');
|
|
235
|
+
const { visualization, targetAnnotation } = analyzeViewAnnotation((_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], annotations, generateParameters, 'primary');
|
|
164
236
|
if (visualization && visualization.indexOf('Chart') > -1) {
|
|
165
|
-
|
|
166
|
-
appSchema.definitions[v4_1.DefinitionName.ALPChart] = JSON.parse(JSON.stringify(chartView));
|
|
167
|
-
delete appSchema.definitions[v4_1.DefinitionName.ALPChart]['isViewNode'];
|
|
168
|
-
appSchema.definitions[v4_1.DefinitionName.ALPChart]['annotationPath'] = targetAnnotation;
|
|
169
|
-
appSchema.definitions[v4_1.DefinitionName.ALPChart].properties.annotationPath['hidden'] = true;
|
|
170
|
-
delete chartView.properties;
|
|
171
|
-
chartView.additionalProperties = false;
|
|
172
|
-
chartView.description = `Chart (key: primary)`;
|
|
173
|
-
chartView.title = `Chart`;
|
|
174
|
-
chartView.$ref = `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.ALPChart}`;
|
|
175
|
-
const viewAnnotation = viewsPaths[0]['primary'][0].annotationPath.split('com.sap.vocabularies.UI.v1.')[1];
|
|
176
|
-
const pathParts = annotations[viewAnnotation].fullyQualifiedName.split('@');
|
|
177
|
-
chartView['annotationPath'] = `/${pathParts[0]}/@${pathParts[1]}`;
|
|
178
|
-
chartView['artifactType'] = common_1.ArtifactType.Manifest;
|
|
179
|
-
chartView['key'] = 'primary';
|
|
237
|
+
addALPChartView(appSchema, targetAnnotation, viewsPaths, annotations);
|
|
180
238
|
}
|
|
181
239
|
// Copy toolbar
|
|
182
240
|
const schemaIdForActions = `Actions<ALPChart>`;
|
|
@@ -184,23 +242,23 @@ function addALPViews(appSchema, viewsPaths, entityType, generateParameters) {
|
|
|
184
242
|
common_1.DEFINITION_LINK_PREFIX + schemaIdForActions;
|
|
185
243
|
defineActions(appSchema, schemaIdForActions, annotations, targetAnnotation, entityType);
|
|
186
244
|
//2. Table View
|
|
187
|
-
const { visualization: tableVisualization, targetAnnotation: target } = analyzeViewAnnotation((
|
|
245
|
+
const { visualization: tableVisualization, targetAnnotation: target } = analyzeViewAnnotation((_f = (_e = (_d = viewsPaths === null || viewsPaths === void 0 ? void 0 : viewsPaths[0]) === null || _d === void 0 ? void 0 : _d['secondary']) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f[v4_1.SchemaTag.annotationPath], annotations, generateParameters, 'secondary');
|
|
188
246
|
const tableDefinitionName = utils_1.alignSchemaWithTemplateType(appSchema, generateParameters);
|
|
189
247
|
const tableDefinition = appSchema.definitions[tableDefinitionName];
|
|
190
|
-
if (tableVisualization) {
|
|
248
|
+
if (tableVisualization || templateAnnotation) {
|
|
191
249
|
tableDefinition.properties.toolBar['$ref'] = `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.ToolBarLR}`;
|
|
192
250
|
// Switch from generic column to specific definition
|
|
193
251
|
tableDefinition.properties['columns'] = {
|
|
194
|
-
$ref: common_1.DEFINITION_LINK_PREFIX +
|
|
252
|
+
$ref: common_1.DEFINITION_LINK_PREFIX + v4_1.DefinitionName.LineItems
|
|
195
253
|
};
|
|
196
|
-
tableDefinition.properties.annotationPath[
|
|
254
|
+
tableDefinition.properties.annotationPath[v4_1.SchemaTag.hidden] = true;
|
|
197
255
|
}
|
|
198
256
|
else {
|
|
199
257
|
tableDefinition.properties = {};
|
|
200
258
|
}
|
|
201
259
|
const tableView = appSchema.definitions[v4_1.DefinitionName.ALPTableView];
|
|
202
260
|
appSchema.definitions[v4_1.DefinitionName.ALPTable] = JSON.parse(JSON.stringify(tableView));
|
|
203
|
-
delete appSchema.definitions[v4_1.DefinitionName.ALPTable][
|
|
261
|
+
delete appSchema.definitions[v4_1.DefinitionName.ALPTable][v4_1.SchemaTag.isViewNode];
|
|
204
262
|
tableView.additionalProperties = false;
|
|
205
263
|
tableView.description = `Table (key: secondary)`;
|
|
206
264
|
tableView.title = `Table`;
|
|
@@ -208,51 +266,116 @@ function addALPViews(appSchema, viewsPaths, entityType, generateParameters) {
|
|
|
208
266
|
delete tableView.properties;
|
|
209
267
|
tableView.$ref = `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.ALPTable}`;
|
|
210
268
|
}
|
|
211
|
-
else {
|
|
269
|
+
else if (!templateAnnotation) {
|
|
212
270
|
tableView.properties = {};
|
|
213
271
|
}
|
|
214
|
-
tableView[
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
272
|
+
tableView[v4_1.SchemaTag.artifactType] = common_1.ArtifactType.Manifest;
|
|
273
|
+
let annotationTerm, viewAnnotation;
|
|
274
|
+
if (tableVisualization && tableVisualization.indexOf(v4_1.FacetBase.LineItem) > -1) {
|
|
275
|
+
annotationTerm = tableVisualization.split('.')[1];
|
|
276
|
+
viewAnnotation = viewsPaths[0]['secondary'][0].annotationPath.split(v4_1.UIVOCABULARYDOT)[1];
|
|
277
|
+
}
|
|
278
|
+
else if (templateAnnotation) {
|
|
279
|
+
annotationTerm = viewAnnotation = templateAnnotation.split(v4_1.UIVOCABULARYDOT)[1];
|
|
280
|
+
}
|
|
281
|
+
if (annotationTerm) {
|
|
282
|
+
utils_1.addLineItemsType(appSchema, entityType.annotations.UI[annotationTerm], entityType, generateParameters.serviceAVT, v4_1.DefinitionName.LineItems, v4_1.DefinitionName.ViewTableColumn);
|
|
283
|
+
appSchema.definitions[v4_1.DefinitionName.ALPTable][v4_1.SchemaTag.annotationPath] = target;
|
|
220
284
|
const pathParts = annotations[viewAnnotation].fullyQualifiedName.split('@');
|
|
221
|
-
tableView[
|
|
222
|
-
tableView[
|
|
285
|
+
tableView[v4_1.SchemaTag.annotationPath] = `/${pathParts[0]}/@${pathParts[1]}`;
|
|
286
|
+
tableView[v4_1.SchemaTag.key] = 'secondary';
|
|
223
287
|
}
|
|
224
288
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
289
|
+
/**
|
|
290
|
+
* Modifies the app schema, adds the right line chart settings
|
|
291
|
+
* @param inputParameters - list of input paramaters as collected by the calling instance
|
|
292
|
+
* @param annotations - UI annotations of the given entityType
|
|
293
|
+
* @returns the ID for the chart view in schema
|
|
294
|
+
*/
|
|
295
|
+
function addViewChartDefinitions(inputParameters, annotations) {
|
|
296
|
+
const idForChart = `${v4_1.DefinitionName.LRChartView}<${inputParameters.viewKey}>`;
|
|
297
|
+
inputParameters.appSchema.definitions[idForChart] = JSON.parse(JSON.stringify(inputParameters.appSchema.definitions[v4_1.DefinitionName.LRChartView]));
|
|
298
|
+
delete inputParameters.appSchema.definitions[idForChart][v4_1.SchemaTag.isViewNode];
|
|
299
|
+
inputParameters.appSchema.definitions[idForChart][v4_1.SchemaTag.annotationPath] = inputParameters.targetAnnotation;
|
|
300
|
+
if (inputParameters.navPropName) {
|
|
301
|
+
inputParameters.appSchema.definitions[idForChart]['navigationProperty'] = inputParameters.navPropName;
|
|
232
302
|
}
|
|
233
303
|
//Copy toolbar
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
appSchema.definitions[
|
|
237
|
-
|
|
304
|
+
const idForToolbar = `${v4_1.DefinitionName.ViewChartToolBar}<${inputParameters.viewKey}>`;
|
|
305
|
+
inputParameters.appSchema.definitions[idForToolbar] = JSON.parse(JSON.stringify(inputParameters.appSchema.definitions[v4_1.DefinitionName.ViewChartToolBar]));
|
|
306
|
+
inputParameters.appSchema.definitions[idForChart]['properties'].toolBar.$ref = `${common_1.DEFINITION_LINK_PREFIX}${idForToolbar}`;
|
|
307
|
+
//Copy actions
|
|
308
|
+
const schemaIdForActions = `${v4_1.DefinitionName.Actions}<${inputParameters.viewKey}>`;
|
|
309
|
+
defineActions(inputParameters.appSchema, schemaIdForActions, annotations, inputParameters.targetAnnotation, inputParameters.targetEntityType);
|
|
310
|
+
inputParameters.appSchema.definitions[idForToolbar]['properties'][common_1.PropertyName.actions]['$ref'] = `${common_1.DEFINITION_LINK_PREFIX}${schemaIdForActions}`;
|
|
311
|
+
return idForChart;
|
|
238
312
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Modifies the app schema, adds the right line item settings as derived from the visualization
|
|
315
|
+
* @param inputParameters - list of input paramaters as collected by the calling instance
|
|
316
|
+
* @param viewsDefinition - the views definitio in app schema (MultiTableModeV4)
|
|
317
|
+
* @param visualization - visualization from the given (S)PV
|
|
318
|
+
* @param templateAnnotation - defaultTemplateAnnotationPath as registered in manifest
|
|
319
|
+
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
320
|
+
*/
|
|
321
|
+
function addViewLineItems(inputParameters, viewsDefinition, visualization, templateAnnotation, generateParameters) {
|
|
322
|
+
const idForTable = `${v4_1.DefinitionName.LRTableView}<${inputParameters.viewKey}>`;
|
|
323
|
+
inputParameters.appSchema.definitions[idForTable] = JSON.parse(JSON.stringify(inputParameters.appSchema.definitions[v4_1.DefinitionName.LRTableView]));
|
|
324
|
+
delete inputParameters.appSchema.definitions[idForTable][v4_1.SchemaTag.isViewNode];
|
|
325
|
+
inputParameters.appSchema.definitions[idForTable][v4_1.SchemaTag.annotationPath] = inputParameters.targetAnnotation;
|
|
326
|
+
if (inputParameters.navPropName) {
|
|
327
|
+
inputParameters.appSchema.definitions[idForTable]['navigationProperty'] = inputParameters.navPropName;
|
|
246
328
|
}
|
|
247
329
|
//Copy toolbar
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
appSchema.definitions[
|
|
255
|
-
|
|
330
|
+
inputParameters.appSchema.definitions[idForTable]['properties'].toolBar.$ref = `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.ToolBar}<${v4_1.DefinitionName.LineItemsOfView}::${inputParameters.viewKey}>`;
|
|
331
|
+
viewsDefinition.properties[inputParameters.viewKey] = {
|
|
332
|
+
$ref: `${common_1.DEFINITION_LINK_PREFIX}${idForTable}`,
|
|
333
|
+
description: `Table View (key: ${inputParameters.viewKey})`,
|
|
334
|
+
title: inputParameters.title
|
|
335
|
+
};
|
|
336
|
+
inputParameters.appSchema.definitions[idForTable].properties.columns = {
|
|
337
|
+
$ref: `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.LineItemsOfView}::${inputParameters.viewKey}`
|
|
338
|
+
};
|
|
339
|
+
inputParameters.appSchema.definitions[idForTable].properties.annotationPath[v4_1.SchemaTag.hidden] =
|
|
340
|
+
true;
|
|
341
|
+
inputParameters.appSchema.definitions[idForTable].properties.index[v4_1.SchemaTag.hidden] = true;
|
|
342
|
+
inputParameters.appSchema.definitions[idForTable].properties.entitySet[v4_1.SchemaTag.hidden] = true;
|
|
343
|
+
const annotationTerm = visualization ? visualization.split('.')[1] : templateAnnotation.split(v4_1.UIVOCABULARYDOT)[1];
|
|
344
|
+
utils_1.addLineItemsType(inputParameters.appSchema, inputParameters.targetEntityType.annotations.UI[annotationTerm], inputParameters.targetEntityType, generateParameters.serviceAVT, `${v4_1.DefinitionName.LineItemsOfView}::${inputParameters.viewKey}`, v4_1.DefinitionName.ViewTableColumn);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Adds the schema tags to a given view
|
|
348
|
+
* @param viewsDefinition - the views definitio in app schema (MultiTableModeV4)
|
|
349
|
+
* @param viewKey - key property of the view
|
|
350
|
+
* @param namespace - target namespace for annotations
|
|
351
|
+
* @param view - the given view
|
|
352
|
+
*/
|
|
353
|
+
function addTagsToView(viewsDefinition, viewKey, namespace, view) {
|
|
354
|
+
viewsDefinition.properties[viewKey][v4_1.SchemaTag.isViewNode] = true;
|
|
355
|
+
viewsDefinition.properties[viewKey][v4_1.SchemaTag.annotationPath] = namespace
|
|
356
|
+
? `/${namespace}/@${view[v4_1.SchemaTag.annotationPath]}`
|
|
357
|
+
: undefined;
|
|
358
|
+
viewsDefinition.properties[viewKey][v4_1.SchemaTag.artifactType] = common_1.ArtifactType.Manifest;
|
|
359
|
+
viewsDefinition.properties[viewKey][v4_1.SchemaTag.key] = viewKey;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Adjusts the entity type if a different entity set is maintained for a view
|
|
363
|
+
* @param {EntitySet} entitySet - actual entity set (AVT information)
|
|
364
|
+
* @param view - the current view in manifest
|
|
365
|
+
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
366
|
+
* @param {EntityType} entityType - actual entity type of the page's entitySet
|
|
367
|
+
* @returns the target entity type
|
|
368
|
+
*/
|
|
369
|
+
function getTargetEntityType(entitySet, view, generateParameters, entityType) {
|
|
370
|
+
let targetEntityType = entityType;
|
|
371
|
+
let viewEntitySet = entitySet;
|
|
372
|
+
if (view['entitySet'] && view['entitySet'] !== entitySet.name) {
|
|
373
|
+
viewEntitySet = generateParameters.serviceAVT.entitySets.find((es) => {
|
|
374
|
+
return es.name === view['entitySet'];
|
|
375
|
+
});
|
|
376
|
+
targetEntityType = viewEntitySet.entityType;
|
|
377
|
+
}
|
|
378
|
+
return targetEntityType;
|
|
256
379
|
}
|
|
257
380
|
/**
|
|
258
381
|
* Add list report views to the app-specific schema
|
|
@@ -261,78 +384,62 @@ function copyChartDefinitions(viewKey, appSchema, targetAnnotation, navPropName,
|
|
|
261
384
|
* @param {EntityType} entityType - actual entity type of the page's entitySet
|
|
262
385
|
* @param {EntitySet} entitySet - actual entity set (AVT information)
|
|
263
386
|
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
387
|
+
* @param templateAnnotation - defaultTemplateAnnotationPath as registered in manifest
|
|
264
388
|
*/
|
|
265
|
-
function addLRViews(appSchema, viewsPaths, entityType, entitySet, generateParameters) {
|
|
389
|
+
function addLRViews(appSchema, viewsPaths, entityType, entitySet, generateParameters, templateAnnotation) {
|
|
266
390
|
var _a;
|
|
267
391
|
if (!viewsPaths) {
|
|
268
392
|
return;
|
|
269
393
|
}
|
|
270
394
|
const viewsDefinition = appSchema.definitions.MultiTableModeV4;
|
|
271
|
-
for (
|
|
272
|
-
|
|
273
|
-
if (!view['key']) {
|
|
395
|
+
for (const view of viewsPaths) {
|
|
396
|
+
if (!view[v4_1.SchemaTag.key]) {
|
|
274
397
|
continue;
|
|
275
398
|
}
|
|
276
|
-
const viewKey = view['key'].replace('#', '::');
|
|
277
|
-
let targetEntityType = entityType;
|
|
278
|
-
let viewEntitySet = entitySet;
|
|
279
399
|
let navPropName = undefined;
|
|
280
|
-
|
|
281
|
-
viewEntitySet = generateParameters.serviceAVT.entitySets.find((es) => {
|
|
282
|
-
return es.name === view['entitySet'];
|
|
283
|
-
});
|
|
284
|
-
targetEntityType = viewEntitySet.entityType;
|
|
285
|
-
}
|
|
400
|
+
const targetEntityType = getTargetEntityType(entitySet, view, generateParameters, entityType);
|
|
286
401
|
const annotations = targetEntityType.annotations.UI;
|
|
287
|
-
const { visualization, targetAnnotation, namespace } = analyzeViewAnnotation(view, annotations, generateParameters, view[
|
|
402
|
+
const { visualization, targetAnnotation, namespace, title } = analyzeViewAnnotation(view === null || view === void 0 ? void 0 : view[v4_1.SchemaTag.annotationPath], annotations, generateParameters, view[v4_1.SchemaTag.key]);
|
|
288
403
|
if (view['entitySet']) {
|
|
289
404
|
navPropName = (_a = entityType.navigationProperties.find((np) => {
|
|
290
405
|
return np.targetTypeName === namespace;
|
|
291
406
|
})) === null || _a === void 0 ? void 0 : _a.name;
|
|
292
407
|
}
|
|
408
|
+
const viewKey = common_1.prepareRef(view[v4_1.SchemaTag.key]);
|
|
409
|
+
const commonInputParameters = {
|
|
410
|
+
viewKey,
|
|
411
|
+
appSchema,
|
|
412
|
+
targetAnnotation,
|
|
413
|
+
navPropName,
|
|
414
|
+
targetEntityType,
|
|
415
|
+
title
|
|
416
|
+
};
|
|
293
417
|
//Add Line item view
|
|
294
|
-
if (visualization && visualization.indexOf(
|
|
418
|
+
if (templateAnnotation || (visualization && visualization.indexOf(v4_1.Visualization.LineItem) > -1)) {
|
|
295
419
|
//Copy table
|
|
296
|
-
|
|
297
|
-
viewsDefinition.properties[viewKey] = {
|
|
298
|
-
$ref: `${common_1.DEFINITION_LINK_PREFIX}${idForTable}`,
|
|
299
|
-
description: `Table View (key: ${viewKey})`,
|
|
300
|
-
title: `Table View (${viewKey})`
|
|
301
|
-
};
|
|
302
|
-
appSchema['definitions'][idForTable].properties.columns = {
|
|
303
|
-
$ref: `${common_1.DEFINITION_LINK_PREFIX}LineItemsOfView::${viewKey}`
|
|
304
|
-
};
|
|
305
|
-
appSchema['definitions'][idForTable].properties.annotationPath['hidden'] = true;
|
|
306
|
-
appSchema['definitions'][idForTable].properties.entitySet['hidden'] = true;
|
|
307
|
-
const annotationTerm = visualization.split('.')[1];
|
|
308
|
-
utils_1.addLineItemsType(appSchema, targetEntityType.annotations.UI[annotationTerm], targetEntityType, generateParameters.serviceAVT, v4_1.DefinitionName.ViewTableColumn, `LineItemsOfView::${viewKey}`);
|
|
420
|
+
addViewLineItems(commonInputParameters, viewsDefinition, visualization, templateAnnotation, generateParameters);
|
|
309
421
|
}
|
|
310
422
|
else if (visualization && visualization.indexOf('Chart') > -1) {
|
|
311
423
|
//Add Chart view
|
|
312
|
-
const idForChart =
|
|
313
|
-
appSchema
|
|
314
|
-
appSchema
|
|
424
|
+
const idForChart = addViewChartDefinitions(commonInputParameters, annotations);
|
|
425
|
+
appSchema.definitions[idForChart].properties.annotationPath[v4_1.SchemaTag.hidden] = true;
|
|
426
|
+
appSchema.definitions[idForChart].properties.index[v4_1.SchemaTag.hidden] = true;
|
|
427
|
+
appSchema.definitions[idForChart].properties.entitySet[v4_1.SchemaTag.hidden] = true;
|
|
315
428
|
viewsDefinition.properties[viewKey] = {
|
|
316
429
|
$ref: `${common_1.DEFINITION_LINK_PREFIX}${idForChart}`,
|
|
317
430
|
description: `Chart View (key: ${viewKey})`,
|
|
318
|
-
title
|
|
431
|
+
title
|
|
319
432
|
};
|
|
320
433
|
}
|
|
321
434
|
else {
|
|
322
435
|
viewsDefinition.properties[viewKey] = {
|
|
323
436
|
description: `View (key: ${viewKey})`,
|
|
324
|
-
title
|
|
325
|
-
|
|
326
|
-
|
|
437
|
+
title,
|
|
438
|
+
// Default view - use table view reference as default
|
|
439
|
+
$ref: `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.LRTableView}`
|
|
327
440
|
};
|
|
328
441
|
}
|
|
329
|
-
viewsDefinition
|
|
330
|
-
viewsDefinition.properties[viewKey]['propertyIndex'] = index;
|
|
331
|
-
viewsDefinition.properties[viewKey]['annotationPath'] = namespace
|
|
332
|
-
? `/${namespace}/@${view['annotationPath']}`
|
|
333
|
-
: undefined;
|
|
334
|
-
viewsDefinition.properties[viewKey]['artifactType'] = common_1.ArtifactType.Manifest;
|
|
335
|
-
viewsDefinition.properties[viewKey]['key'] = viewKey;
|
|
442
|
+
addTagsToView(viewsDefinition, viewKey, namespace, view);
|
|
336
443
|
}
|
|
337
444
|
}
|
|
338
445
|
/**
|
|
@@ -344,14 +451,59 @@ function addLRViews(appSchema, viewsPaths, entityType, entitySet, generateParame
|
|
|
344
451
|
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
345
452
|
*/
|
|
346
453
|
function addViews(appSchema, v4Page, entityType, entitySet, generateParameters) {
|
|
347
|
-
var _a, _b, _c;
|
|
454
|
+
var _a, _b, _c, _d, _e;
|
|
348
455
|
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;
|
|
456
|
+
const templateAnnotation = (_e = (_d = v4Page.options) === null || _d === void 0 ? void 0 : _d.settings) === null || _e === void 0 ? void 0 : _e.defaultTemplateAnnotationPath;
|
|
349
457
|
if (generateParameters.templateType === common_1.TemplateType.ListReportObjectPageV4) {
|
|
350
|
-
addLRViews(appSchema, viewsPaths, entityType, entitySet, generateParameters);
|
|
351
|
-
appSchema.properties[
|
|
458
|
+
addLRViews(appSchema, viewsPaths, entityType, entitySet, generateParameters, templateAnnotation);
|
|
459
|
+
appSchema.properties[common_1.PropertyName.chart][v4_1.SchemaTag.hidden] = true;
|
|
352
460
|
}
|
|
353
461
|
else if (generateParameters.templateType === common_1.TemplateType.AnalyticalListPageV4) {
|
|
354
|
-
addALPViews(appSchema, viewsPaths, entityType, generateParameters);
|
|
462
|
+
addALPViews(appSchema, viewsPaths, entityType, generateParameters, templateAnnotation);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Adapts the table definition in schema.
|
|
467
|
+
* If defaultTemplateAnnotationPath is present, evaluates the SelectionPresentationVariant.
|
|
468
|
+
* @param {SapUiAppPageV4} v4Page - the given page in manifest
|
|
469
|
+
* @param {EntityType} entityType - the current entity type, as defined in AVT
|
|
470
|
+
* @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
|
|
471
|
+
* @param appSchema - the app-specific JSON schema
|
|
472
|
+
* @param alias - alias definition for the UI vocabulary
|
|
473
|
+
*/
|
|
474
|
+
function adaptTableDefinition(v4Page, entityType, generateParameters, appSchema, alias) {
|
|
475
|
+
var _a, _b, _c, _d;
|
|
476
|
+
//here: tableDefinitionName = DefinitionName.Table
|
|
477
|
+
const tableDefinitionName = utils_1.alignSchemaWithTemplateType(appSchema, generateParameters);
|
|
478
|
+
const templateAnnotation = (_b = (_a = v4Page.options) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.defaultTemplateAnnotationPath;
|
|
479
|
+
if (templateAnnotation) {
|
|
480
|
+
const { visualization, targetAnnotation, namespace } = analyzeViewAnnotation(templateAnnotation, entityType.annotations.UI, generateParameters, undefined, v4_1.Visualization.LineItem);
|
|
481
|
+
if (visualization) {
|
|
482
|
+
const annotationTerm = visualization.split('.')[1];
|
|
483
|
+
const annotationTermInSchema = `${v4_1.DefinitionName.LineItems}OfSPV::${common_1.prepareRef(annotationTerm)}`;
|
|
484
|
+
appSchema.definitions[`${tableDefinitionName}SPV`] = JSON.parse(JSON.stringify(appSchema.definitions[tableDefinitionName]));
|
|
485
|
+
delete appSchema.definitions[`${tableDefinitionName}SPV`][v4_1.SchemaTag.isViewNode];
|
|
486
|
+
appSchema.definitions[`${tableDefinitionName}SPV`].properties['toolBar']['$ref'] = `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.ToolBar}<${annotationTermInSchema}>`;
|
|
487
|
+
appSchema.definitions[tableDefinitionName]['$ref'] = `${common_1.DEFINITION_LINK_PREFIX}${tableDefinitionName}SPV`;
|
|
488
|
+
delete appSchema.definitions[`${tableDefinitionName}`].properties;
|
|
489
|
+
appSchema.definitions[`${tableDefinitionName}`][v4_1.SchemaTag.annotationPath] = `/${namespace}/@${templateAnnotation}`;
|
|
490
|
+
// Switch from generic column to specific definition
|
|
491
|
+
appSchema.definitions[`${tableDefinitionName}SPV`].properties['columns'] = {
|
|
492
|
+
$ref: `${common_1.DEFINITION_LINK_PREFIX}${annotationTermInSchema}`
|
|
493
|
+
};
|
|
494
|
+
appSchema.definitions[`${tableDefinitionName}SPV`][v4_1.SchemaTag.annotationPath] = targetAnnotation;
|
|
495
|
+
const lineItemAnnotation = entityType.annotations.UI[annotationTerm];
|
|
496
|
+
utils_1.addLineItemsType(appSchema, lineItemAnnotation, entityType, generateParameters.serviceAVT, annotationTermInSchema);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
const tableDefinition = appSchema.definitions[tableDefinitionName];
|
|
501
|
+
tableDefinition.properties.toolBar['$ref'] = `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.ToolBarLR}`;
|
|
502
|
+
// Switch from generic column to specific definition
|
|
503
|
+
tableDefinition.properties['columns'] = {
|
|
504
|
+
$ref: common_1.DEFINITION_LINK_PREFIX + v4_1.DefinitionName.LineItems
|
|
505
|
+
};
|
|
506
|
+
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);
|
|
355
507
|
}
|
|
356
508
|
}
|
|
357
509
|
/**
|
|
@@ -365,24 +517,16 @@ function addViews(appSchema, v4Page, entityType, entitySet, generateParameters)
|
|
|
365
517
|
* @returns {object} application-specific schema of the list report
|
|
366
518
|
*/
|
|
367
519
|
function generateListReportSchemaV4(generateParameters, genericSchema, entitySet, templateName) {
|
|
368
|
-
var _a, _b
|
|
520
|
+
var _a, _b;
|
|
369
521
|
const appSchema = JSON.parse(JSON.stringify(genericSchema));
|
|
370
522
|
const entityType = entitySet === null || entitySet === void 0 ? void 0 : entitySet.entityType;
|
|
371
523
|
const alias = common_1.findAlias(common_1.UIVOCABULARY, generateParameters.serviceAVT);
|
|
372
524
|
//Add selection fields
|
|
373
525
|
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;
|
|
374
526
|
addSelectionFields(entityType, appSchema, selectionFieldAnnotation);
|
|
527
|
+
appSchema.properties[common_1.PropertyName.defaultTemplateAnnotationPath][v4_1.SchemaTag.hidden] = true;
|
|
528
|
+
//enum for annotation path as part of QuickVarianSelection
|
|
375
529
|
common_1.addEnumForSingleTabVariant(entityType, appSchema, v4_1.DefinitionName.AnnotationPathAsObject);
|
|
376
|
-
if (generateParameters.templateType === common_1.TemplateType.ListReportObjectPageV4) {
|
|
377
|
-
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);
|
|
378
|
-
const tableDefinitionName = utils_1.alignSchemaWithTemplateType(appSchema, generateParameters);
|
|
379
|
-
const tableDefinition = appSchema.definitions[tableDefinitionName];
|
|
380
|
-
tableDefinition.properties.toolBar['$ref'] = `${common_1.DEFINITION_LINK_PREFIX}${v4_1.DefinitionName.ToolBarLR}`;
|
|
381
|
-
// Switch from generic column to specific definition
|
|
382
|
-
tableDefinition.properties['columns'] = {
|
|
383
|
-
$ref: common_1.DEFINITION_LINK_PREFIX + 'LineItems'
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
530
|
if (generateParameters.manifest) {
|
|
387
531
|
//Find page in targets
|
|
388
532
|
const pages = generateParameters.manifest[__1.ManifestSection.ui5].routing.targets;
|
|
@@ -401,11 +545,15 @@ function generateListReportSchemaV4(generateParameters, genericSchema, entitySet
|
|
|
401
545
|
if (!v4Page) {
|
|
402
546
|
return appSchema;
|
|
403
547
|
}
|
|
548
|
+
if (generateParameters.templateType === common_1.TemplateType.ListReportObjectPageV4) {
|
|
549
|
+
//LR table definition
|
|
550
|
+
adaptTableDefinition(v4Page, entityType, generateParameters, appSchema, alias);
|
|
551
|
+
}
|
|
404
552
|
// Handle LR & ALP views
|
|
405
553
|
addViews(appSchema, v4Page, entityType, entitySet, generateParameters);
|
|
406
554
|
}
|
|
407
|
-
delete appSchema.definitions
|
|
408
|
-
delete appSchema.definitions
|
|
555
|
+
delete appSchema.definitions.GenericColumns;
|
|
556
|
+
delete appSchema.definitions.Action;
|
|
409
557
|
return appSchema;
|
|
410
558
|
}
|
|
411
559
|
exports.generateListReportSchemaV4 = generateListReportSchemaV4;
|