@sap/ux-specification 1.90.25 → 1.90.28

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