@sap/ux-specification 1.84.128 → 1.84.129

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 (202) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/documentation/v2/v2-AnalyticalListPage.html +2 -2
  3. package/dist/documentation/v2/v2-ApplicationV2.html +2 -2
  4. package/dist/documentation/v2/v2-ListReport.html +2 -2
  5. package/dist/documentation/v2/v2-ListReportNew.html +2 -2
  6. package/dist/documentation/v2/v2-ObjectPage.html +2 -2
  7. package/dist/documentation/v2/v2-OverviewPage.html +2 -2
  8. package/dist/documentation/v4/v4-ApplicationV4.html +2 -2
  9. package/dist/documentation/v4/v4-ListReport.html +2 -2
  10. package/dist/documentation/v4/v4-ObjectPage.html +2 -2
  11. package/dist/index-min.js +177 -177
  12. package/dist/index-min.js.map +4 -4
  13. package/dist/schemas/v2/ApplicationV2.json +22 -2
  14. package/dist/schemas/v2/ListReportNewConfig.json +45 -0
  15. package/dist/schemas/v2/ObjectPageConfig.json +12 -5
  16. package/dist/schemas/v4/ApplicationV4.json +10 -11
  17. package/dist/specification/package.json +16 -15
  18. package/dist/specification/scripts/schema/to-json-schema.d.ts.map +1 -1
  19. package/dist/specification/scripts/schema/to-json-schema.js +23 -13
  20. package/dist/specification/scripts/schema/to-json-schema.js.map +1 -1
  21. package/dist/specification/src/sync/common/decoration/decorators.d.ts +72 -4
  22. package/dist/specification/src/sync/common/decoration/decorators.d.ts.map +1 -1
  23. package/dist/specification/src/sync/common/decoration/decorators.js +145 -8
  24. package/dist/specification/src/sync/common/decoration/decorators.js.map +1 -1
  25. package/dist/specification/src/sync/common/distTagEvaluator.d.ts +7 -0
  26. package/dist/specification/src/sync/common/distTagEvaluator.d.ts.map +1 -1
  27. package/dist/specification/src/sync/common/distTagEvaluator.js +10 -0
  28. package/dist/specification/src/sync/common/distTagEvaluator.js.map +1 -1
  29. package/dist/specification/src/sync/common/generate/utils.d.ts +17 -7
  30. package/dist/specification/src/sync/common/generate/utils.d.ts.map +1 -1
  31. package/dist/specification/src/sync/common/generate/utils.js +38 -22
  32. package/dist/specification/src/sync/common/generate/utils.js.map +1 -1
  33. package/dist/specification/src/sync/common/i18n.json +5 -4
  34. package/dist/specification/src/sync/common/utils.d.ts +39 -0
  35. package/dist/specification/src/sync/common/utils.d.ts.map +1 -1
  36. package/dist/specification/src/sync/common/utils.js +94 -3
  37. package/dist/specification/src/sync/common/utils.js.map +1 -1
  38. package/dist/specification/src/sync/v2/application.d.ts +1 -0
  39. package/dist/specification/src/sync/v2/application.d.ts.map +1 -1
  40. package/dist/specification/src/sync/v2/application.js +18 -0
  41. package/dist/specification/src/sync/v2/application.js.map +1 -1
  42. package/dist/specification/src/sync/v2/export/controls/ObjectPageTable.d.ts.map +1 -1
  43. package/dist/specification/src/sync/v2/export/exportPage.d.ts.map +1 -1
  44. package/dist/specification/src/sync/v2/export/exportPage.js +15 -4
  45. package/dist/specification/src/sync/v2/export/exportPage.js.map +1 -1
  46. package/dist/specification/src/sync/v2/export/exportPageGeneric.d.ts.map +1 -1
  47. package/dist/specification/src/sync/v2/export/exportPageGeneric.js +5 -2
  48. package/dist/specification/src/sync/v2/export/exportPageGeneric.js.map +1 -1
  49. package/dist/specification/src/sync/v2/export/factory.d.ts +26 -0
  50. package/dist/specification/src/sync/v2/export/factory.d.ts.map +1 -1
  51. package/dist/specification/src/sync/v2/export/factory.js +3 -3
  52. package/dist/specification/src/sync/v2/export/factory.js.map +1 -1
  53. package/dist/specification/src/sync/v2/export/pages/ObjectPage.d.ts +1 -0
  54. package/dist/specification/src/sync/v2/export/pages/ObjectPage.d.ts.map +1 -1
  55. package/dist/specification/src/sync/v2/export/pages/ObjectPage.js +11 -0
  56. package/dist/specification/src/sync/v2/export/pages/ObjectPage.js.map +1 -1
  57. package/dist/specification/src/sync/v2/generate/listReport.d.ts.map +1 -1
  58. package/dist/specification/src/sync/v2/generate/listReport.js +44 -0
  59. package/dist/specification/src/sync/v2/generate/listReport.js.map +1 -1
  60. package/dist/specification/src/sync/v2/generate/objectPage.d.ts.map +1 -1
  61. package/dist/specification/src/sync/v2/generate/objectPage.js +86 -31
  62. package/dist/specification/src/sync/v2/generate/objectPage.js.map +1 -1
  63. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiViewSingleTable.d.ts +22 -0
  64. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiViewSingleTable.d.ts.map +1 -0
  65. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiViewSingleTable.js +124 -0
  66. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiViewSingleTable.js.map +1 -0
  67. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.d.ts +1 -0
  68. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.d.ts.map +1 -1
  69. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.js +4 -0
  70. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.js.map +1 -1
  71. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/index.d.ts +1 -0
  72. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/index.d.ts.map +1 -1
  73. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/index.js +1 -0
  74. package/dist/specification/src/sync/v2/genericSchemaHandling/controls/index.js.map +1 -1
  75. package/dist/specification/src/sync/v2/import/pages/overviewPage.d.ts.map +1 -1
  76. package/dist/specification/src/sync/v2/import/pages/overviewPage.js +4 -0
  77. package/dist/specification/src/sync/v2/import/pages/overviewPage.js.map +1 -1
  78. package/dist/specification/src/sync/v2/utils.d.ts +17 -1
  79. package/dist/specification/src/sync/v2/utils.d.ts.map +1 -1
  80. package/dist/specification/src/sync/v2/utils.js +57 -0
  81. package/dist/specification/src/sync/v2/utils.js.map +1 -1
  82. package/dist/specification/src/sync/v4/export/pages/ListReport.d.ts.map +1 -1
  83. package/dist/specification/src/sync/v4/export/pages/ListReport.js +2 -1
  84. package/dist/specification/src/sync/v4/export/pages/ListReport.js.map +1 -1
  85. package/dist/specification/src/sync/v4/generate/ListReportUtils.d.ts +74 -0
  86. package/dist/specification/src/sync/v4/generate/ListReportUtils.d.ts.map +1 -0
  87. package/dist/specification/src/sync/v4/generate/ListReportUtils.js +262 -0
  88. package/dist/specification/src/sync/v4/generate/ListReportUtils.js.map +1 -0
  89. package/dist/specification/src/sync/v4/generate/listReport.d.ts +61 -2
  90. package/dist/specification/src/sync/v4/generate/listReport.d.ts.map +1 -1
  91. package/dist/specification/src/sync/v4/generate/listReport.js +92 -94
  92. package/dist/specification/src/sync/v4/generate/listReport.js.map +1 -1
  93. package/dist/specification/src/sync/v4/generate/objectPage.d.ts.map +1 -1
  94. package/dist/specification/src/sync/v4/generate/objectPage.js +7 -7
  95. package/dist/specification/src/sync/v4/generate/objectPage.js.map +1 -1
  96. package/dist/specification/src/sync/v4/sync-rules/App.d.ts +141 -0
  97. package/dist/specification/src/sync/v4/sync-rules/App.d.ts.map +1 -0
  98. package/dist/specification/src/sync/v4/sync-rules/App.js +208 -0
  99. package/dist/specification/src/sync/v4/sync-rules/App.js.map +1 -0
  100. package/dist/specification/src/sync/v4/sync-rules/AppSchema.d.ts +193 -0
  101. package/dist/specification/src/sync/v4/sync-rules/AppSchema.d.ts.map +1 -0
  102. package/dist/specification/src/sync/v4/sync-rules/AppSchema.js +384 -0
  103. package/dist/specification/src/sync/v4/sync-rules/AppSchema.js.map +1 -0
  104. package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts +172 -0
  105. package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts.map +1 -0
  106. package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js +410 -0
  107. package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js.map +1 -0
  108. package/dist/specification/src/sync/v4/sync-rules/Page.d.ts +70 -0
  109. package/dist/specification/src/sync/v4/sync-rules/Page.d.ts.map +1 -0
  110. package/dist/specification/src/sync/v4/sync-rules/Page.js +73 -0
  111. package/dist/specification/src/sync/v4/sync-rules/Page.js.map +1 -0
  112. package/dist/specification/src/sync/v4/sync-rules/utils.d.ts +9 -0
  113. package/dist/specification/src/sync/v4/sync-rules/utils.d.ts.map +1 -0
  114. package/dist/specification/src/sync/v4/sync-rules/utils.js +43 -0
  115. package/dist/specification/src/sync/v4/sync-rules/utils.js.map +1 -0
  116. package/dist/specification/src/sync/v4/utils/utils.d.ts +6 -29
  117. package/dist/specification/src/sync/v4/utils/utils.d.ts.map +1 -1
  118. package/dist/specification/src/sync/v4/utils/utils.js +7 -54
  119. package/dist/specification/src/sync/v4/utils/utils.js.map +1 -1
  120. package/dist/types/src/common/Application.d.ts +3 -0
  121. package/dist/types/src/common/Application.d.ts.map +1 -1
  122. package/dist/types/src/common/Application.js +4 -0
  123. package/dist/types/src/common/Application.js.map +1 -1
  124. package/dist/types/src/common/types.d.ts +105 -1
  125. package/dist/types/src/common/types.d.ts.map +1 -1
  126. package/dist/types/src/common/types.js +2 -0
  127. package/dist/types/src/common/types.js.map +1 -1
  128. package/dist/types/src/common/webapp/manifest/Manifest.d.ts +1 -1
  129. package/dist/types/src/common/webapp/manifest/Manifest.d.ts.map +1 -1
  130. package/dist/types/src/v2/application.d.ts +18 -0
  131. package/dist/types/src/v2/application.d.ts.map +1 -1
  132. package/dist/types/src/v2/controls/Action.d.ts +12 -0
  133. package/dist/types/src/v2/controls/Action.d.ts.map +1 -1
  134. package/dist/types/src/v2/controls/AnalyticalListPageChart.d.ts +1 -0
  135. package/dist/types/src/v2/controls/AnalyticalListPageChart.d.ts.map +1 -1
  136. package/dist/types/src/v2/controls/AnalyticalListPageKPI.d.ts +1 -0
  137. package/dist/types/src/v2/controls/AnalyticalListPageKPI.d.ts.map +1 -1
  138. package/dist/types/src/v2/controls/Card.d.ts +13 -0
  139. package/dist/types/src/v2/controls/Card.d.ts.map +1 -1
  140. package/dist/types/src/v2/controls/Card.js.map +1 -1
  141. package/dist/types/src/v2/controls/Field.d.ts +1 -0
  142. package/dist/types/src/v2/controls/Field.d.ts.map +1 -1
  143. package/dist/types/src/v2/controls/FilterBar.d.ts +6 -0
  144. package/dist/types/src/v2/controls/FilterBar.d.ts.map +1 -1
  145. package/dist/types/src/v2/controls/FilterBar.js.map +1 -1
  146. package/dist/types/src/v2/controls/Header.d.ts +1 -0
  147. package/dist/types/src/v2/controls/Header.d.ts.map +1 -1
  148. package/dist/types/src/v2/controls/ObjectPageChart.d.ts +1 -0
  149. package/dist/types/src/v2/controls/ObjectPageChart.d.ts.map +1 -1
  150. package/dist/types/src/v2/controls/ObjectPageFooter.d.ts +2 -0
  151. package/dist/types/src/v2/controls/ObjectPageFooter.d.ts.map +1 -1
  152. package/dist/types/src/v2/controls/ObjectPageForm.d.ts +1 -0
  153. package/dist/types/src/v2/controls/ObjectPageForm.d.ts.map +1 -1
  154. package/dist/types/src/v2/controls/ObjectPageHeader.d.ts +1 -0
  155. package/dist/types/src/v2/controls/ObjectPageHeader.d.ts.map +1 -1
  156. package/dist/types/src/v2/controls/ObjectPageHeaderSection.d.ts +3 -0
  157. package/dist/types/src/v2/controls/ObjectPageHeaderSection.d.ts.map +1 -1
  158. package/dist/types/src/v2/controls/ObjectPageLayout.d.ts +1 -0
  159. package/dist/types/src/v2/controls/ObjectPageLayout.d.ts.map +1 -1
  160. package/dist/types/src/v2/controls/ObjectPageSection.d.ts +13 -0
  161. package/dist/types/src/v2/controls/ObjectPageSection.d.ts.map +1 -1
  162. package/dist/types/src/v2/controls/ObjectPageSection.js.map +1 -1
  163. package/dist/types/src/v2/controls/ObjectPageTable.d.ts +10 -4
  164. package/dist/types/src/v2/controls/ObjectPageTable.d.ts.map +1 -1
  165. package/dist/types/src/v2/controls/ObjectPageToolBar.d.ts +2 -0
  166. package/dist/types/src/v2/controls/ObjectPageToolBar.d.ts.map +1 -1
  167. package/dist/types/src/v2/controls/Table.d.ts +28 -0
  168. package/dist/types/src/v2/controls/Table.d.ts.map +1 -1
  169. package/dist/types/src/v2/controls/Table.js.map +1 -1
  170. package/dist/types/src/v2/controls/ToolBar.d.ts +1 -0
  171. package/dist/types/src/v2/controls/ToolBar.d.ts.map +1 -1
  172. package/dist/types/src/v2/pages/AnalyticalListPageConfigV2.d.ts +1 -0
  173. package/dist/types/src/v2/pages/AnalyticalListPageConfigV2.d.ts.map +1 -1
  174. package/dist/types/src/v2/pages/ObjectPageConfigV2.d.ts +10 -1
  175. package/dist/types/src/v2/pages/ObjectPageConfigV2.d.ts.map +1 -1
  176. package/dist/types/src/v2/pages/OverviewPageConfigV2.d.ts +4 -0
  177. package/dist/types/src/v2/pages/OverviewPageConfigV2.d.ts.map +1 -1
  178. package/dist/types/src/v4/controls/FilterBar.d.ts +2 -0
  179. package/dist/types/src/v4/controls/FilterBar.d.ts.map +1 -1
  180. package/dist/types/src/v4/controls/ObjectPageFooter.d.ts +1 -0
  181. package/dist/types/src/v4/controls/ObjectPageFooter.d.ts.map +1 -1
  182. package/dist/types/src/v4/controls/ObjectPageHeader.d.ts +1 -0
  183. package/dist/types/src/v4/controls/ObjectPageHeader.d.ts.map +1 -1
  184. package/dist/types/src/v4/controls/ObjectPageHeaderSection.d.ts +4 -0
  185. package/dist/types/src/v4/controls/ObjectPageHeaderSection.d.ts.map +1 -1
  186. package/dist/types/src/v4/controls/ObjectPageLayout.d.ts +1 -0
  187. package/dist/types/src/v4/controls/ObjectPageLayout.d.ts.map +1 -1
  188. package/dist/types/src/v4/controls/ObjectPageSection.d.ts +15 -0
  189. package/dist/types/src/v4/controls/ObjectPageSection.d.ts.map +1 -1
  190. package/dist/types/src/v4/controls/ObjectPageSection.js.map +1 -1
  191. package/dist/types/src/v4/controls/ObjectPageTable.d.ts +2 -0
  192. package/dist/types/src/v4/controls/ObjectPageTable.d.ts.map +1 -1
  193. package/dist/types/src/v4/controls/ObjectPageTable.js.map +1 -1
  194. package/dist/types/src/v4/controls/ObjectPageToolBar.d.ts +3 -0
  195. package/dist/types/src/v4/controls/ObjectPageToolBar.d.ts.map +1 -1
  196. package/dist/types/src/v4/controls/Table.d.ts +15 -0
  197. package/dist/types/src/v4/controls/Table.d.ts.map +1 -1
  198. package/dist/types/src/v4/controls/ToolBar.d.ts +6 -0
  199. package/dist/types/src/v4/controls/ToolBar.d.ts.map +1 -1
  200. package/dist/types/src/v4/webapp/manifest/ManifestSettings.d.ts +22 -0
  201. package/dist/types/src/v4/webapp/manifest/ManifestSettings.d.ts.map +1 -1
  202. package/package.json +16 -15
@@ -0,0 +1,262 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TableAndViews = exports.FilterBar = exports.GeneralListReportSettings = exports.BaseConstruct = void 0;
7
+ const __1 = require("../../..");
8
+ const utils_1 = require("../utils/utils");
9
+ const listReport_1 = require("./listReport");
10
+ const listReport_2 = require("./listReport");
11
+ const common_1 = require("../../common");
12
+ const i18next_1 = __importDefault(require("i18next"));
13
+ class BaseConstruct {
14
+ /**
15
+ * Constructor for BaseConstruct.
16
+ *
17
+ * @param schema - the application schema
18
+ * @param page - the page object
19
+ * @param logger - optional extension logger
20
+ */
21
+ constructor(schema, page, logger) {
22
+ this.schema = schema;
23
+ this.page = page;
24
+ this.logger = logger;
25
+ }
26
+ }
27
+ exports.BaseConstruct = BaseConstruct;
28
+ /**
29
+ * Add general settings to schema (LR or ALP).
30
+ *
31
+ * - Adds Selection-(PresentationVariant) related enums to the schema.
32
+ */
33
+ class GeneralListReportSettings extends BaseConstruct {
34
+ /**
35
+ * Constructor for general settings of ListReport.
36
+ *
37
+ * @param schema - the application schema
38
+ * @param page - the page object
39
+ * @param logger - optional extension logger
40
+ */
41
+ constructor(schema, page, logger) {
42
+ super(schema, page, logger);
43
+ //enum for annotation path as part of QuickVariantSelection
44
+ (0, common_1.addEnumForSingleTabVariant)(page.entity.type, schema.getSchema(), __1.DefinitionName.AnnotationPathAsObject);
45
+ }
46
+ }
47
+ exports.GeneralListReportSettings = GeneralListReportSettings;
48
+ /**
49
+ * Add filter bar to schema (LR or ALP).
50
+ */
51
+ class FilterBar extends BaseConstruct {
52
+ /**
53
+ * Constructor for FilterBar.
54
+ *
55
+ * @param schema - the application schema
56
+ * @param page - the page object
57
+ * @param logger - optional extension logger
58
+ */
59
+ constructor(schema, page, logger) {
60
+ super(schema, page, logger);
61
+ }
62
+ /**
63
+ * Instantiates the FilterBar and adds the filterBar to the schema.
64
+ */
65
+ instantiate() {
66
+ this.addFilterBar(this.page.getEntityType(), this.schema, this.page.getPage(), this.page.getApp().getUIVocabularyAlias() || 'UI');
67
+ }
68
+ /**
69
+ * Adds filter bar to schema (LR or ALP).
70
+ *
71
+ * @param entityType - the entity type
72
+ * @param schema - the application schema
73
+ * @param v4Page - the actual page in the manifest
74
+ * @param alias - alias definition for the UI vocabulary
75
+ */
76
+ addFilterBar(entityType, schema, v4Page, alias) {
77
+ const selectionFields = alias && entityType?.annotations?.[alias]?.SelectionFields;
78
+ (0, listReport_2.addSelectionFields)(entityType, schema.getSchema(), selectionFields);
79
+ }
80
+ }
81
+ exports.FilterBar = FilterBar;
82
+ /**
83
+ * Adjusts the entity type if a different entity set is maintained for a view.
84
+ *
85
+ * @param {EntitySet} entitySet - actual entity set (AVT information)
86
+ * @param view - the current view in manifest
87
+ * @param page - the page object
88
+ * @returns the target entity type
89
+ */
90
+ function getTargetEntityType(entitySet, view, page) {
91
+ let targetEntityType = page.getEntityType();
92
+ let viewEntitySet = entitySet;
93
+ if (view['entitySet'] && view['entitySet'] !== entitySet.name) {
94
+ viewEntitySet = page
95
+ .getApp()
96
+ .getAVT()
97
+ ?.entitySets.find((es) => {
98
+ return es.name === view['entitySet'];
99
+ });
100
+ targetEntityType = viewEntitySet.entityType;
101
+ }
102
+ return targetEntityType;
103
+ }
104
+ /**
105
+ * Adapts the table definition in schema.
106
+ * Evaluates the path depending on if defaultTemplateAnnotationPath or Selection-/PresentationVariant is present.
107
+ *
108
+ * @param schema - the app-specific JSON schema
109
+ * @param page - the page object
110
+ * @param templateAnnotation - defaultTemplateAnnotationPath as registered in manifest
111
+ * @param tableDefinitionName - The name of the table definition in the schema
112
+ */
113
+ function adaptTableDefinition(schema, page, templateAnnotation, tableDefinitionName) {
114
+ const logger = page.getApp().getLogger();
115
+ //here: tableDefinitionName = DefinitionName.Table
116
+ const tableDefinition = schema.getDefinition(tableDefinitionName);
117
+ const { visualization, targetAnnotation, namespace } = (0, listReport_2.analyzeViewAnnotation)(templateAnnotation, page.getUIAnnotations(), undefined, __1.Visualization.LineItem, page.getApp().getLogger());
118
+ if (visualization) {
119
+ const annotationTerm = visualization.split('.')[1];
120
+ const annotationTermInSchema = `${__1.DefinitionName.LineItems}OfSPV::${(0, common_1.prepareRef)(annotationTerm)}`;
121
+ const spvTable = schema.cloneDefinition(tableDefinitionName, `${tableDefinitionName}SPV`);
122
+ schema.setPropertyRef(spvTable, ['properties', 'toolBar'], `${__1.DefinitionName.ToolBar}<${annotationTermInSchema}>`);
123
+ // Switch from generic column to specific definition
124
+ // schema.setProperty(spvTable, ['properties', 'columns'], {});
125
+ schema.setProperty(spvTable, [__1.SchemaTag.annotationPath], targetAnnotation);
126
+ schema.setPropertyRef(spvTable, ['properties', 'columns'], annotationTermInSchema);
127
+ schema.setDefinitionRef(tableDefinition, `${tableDefinitionName}SPV`);
128
+ schema.removeProperty(spvTable, __1.SchemaTag.isViewNode);
129
+ schema.removeProperty(tableDefinition, 'properties');
130
+ schema.setProperty(tableDefinition, [__1.SchemaTag.annotationPath], `/${namespace}/@${templateAnnotation}`);
131
+ const lineItemAnnotation = page.getUIAnnotations()[annotationTerm];
132
+ if (!lineItemAnnotation) {
133
+ (0, __1.log)(logger, {
134
+ severity: "error" /* LogSeverity.Error */,
135
+ message: i18next_1.default.t('NOTARGET', { target: annotationTerm })
136
+ });
137
+ }
138
+ const dataForLineItem = {
139
+ isObjectPage: false,
140
+ appSchema: schema.getSchema(),
141
+ lineItemAnnotation,
142
+ entityType: page.entity.type,
143
+ oDataServiceAVT: page.getApp().getAVT(),
144
+ lineItemId: annotationTermInSchema
145
+ };
146
+ (0, utils_1.addLineItemsTypeToSchema)(dataForLineItem);
147
+ }
148
+ else {
149
+ schema.setPropertyRef(tableDefinition, ['properties', 'toolBar'], `${__1.DefinitionName.ToolBarLR}`);
150
+ schema.setPropertyRef(tableDefinition, ['properties', 'columns'], `${__1.DefinitionName.LineItems}`);
151
+ // Switch from generic column to specific definition
152
+ const lineItemAnnotation = page.getUIAnnotations()?.LineItem;
153
+ if (!lineItemAnnotation && !page.getPage().options?.settings?.views?.paths) {
154
+ (0, __1.log)(logger, {
155
+ severity: "error" /* LogSeverity.Error */,
156
+ message: i18next_1.default.t('NOLINEITEMS')
157
+ });
158
+ }
159
+ const dataForLineItem = {
160
+ isObjectPage: false,
161
+ appSchema: schema.getSchema(),
162
+ lineItemAnnotation,
163
+ entityType: page.entity.type,
164
+ oDataServiceAVT: page.getApp().getAVT(),
165
+ lineItemId: __1.DefinitionName.LineItems
166
+ };
167
+ (0, utils_1.addLineItemsTypeToSchema)(dataForLineItem);
168
+ }
169
+ // Add "manifestPath" for table properties
170
+ (0, listReport_1.addManifestPathsToPropertiesLR)(schema.getSchema(), tableDefinitionName, tableDefinition, {
171
+ pageName: page.getPage().id,
172
+ manifest: page.getApp().getManifest(),
173
+ targetAnnotation
174
+ });
175
+ }
176
+ /**
177
+ * Add list report views to the app-specific schema.
178
+ *
179
+ * @param schema - app-specific JSON schema
180
+ * @param viewsPaths - views' paths' section in the manifest
181
+ * @param page - the given page in manifest
182
+ * @param tableDefinitionName - The name of the table definition in the schema
183
+ */
184
+ function addLRViews(schema, viewsPaths, page, tableDefinitionName) {
185
+ const tableDefinition = schema.getDefinition(tableDefinitionName);
186
+ tableDefinition.properties = {
187
+ annotationPath: tableDefinition.properties.annotationPath,
188
+ initialLoad: tableDefinition.properties.initialLoad,
189
+ views: tableDefinition.properties.views
190
+ };
191
+ const viewsDefinition = schema.getDefinition(__1.DefinitionName.MultiTableModeV4);
192
+ for (const view of viewsPaths) {
193
+ if (!view[__1.SchemaTag.key]) {
194
+ continue;
195
+ }
196
+ let navPropName = undefined;
197
+ const targetEntityType = getTargetEntityType(page.entity.set, view, page);
198
+ const uiAnnotations = targetEntityType?.annotations.UI;
199
+ const { visualization, targetAnnotation, namespace, title } = (0, listReport_2.analyzeViewAnnotation)(view?.[__1.SchemaTag.annotationPath], uiAnnotations, view[__1.SchemaTag.key], undefined, page.getApp().getLogger());
200
+ if (view['entitySet']) {
201
+ navPropName = page.getEntityType().navigationProperties.find((np) => {
202
+ return np.targetTypeName === namespace;
203
+ })?.name;
204
+ }
205
+ const viewKey = (0, common_1.prepareRef)(view[__1.SchemaTag.key]);
206
+ const commonInputParameters = {
207
+ viewKey,
208
+ appSchema: schema.getSchema(),
209
+ targetAnnotation,
210
+ navPropName,
211
+ targetEntityType,
212
+ title,
213
+ entitySet: view['entitySet']
214
+ };
215
+ (0, listReport_2.addLRViewParts)(visualization, viewsDefinition, commonInputParameters, { serviceAVT: page.getApp().getAVT(), entityType: targetEntityType, logger: page.getApp().getLogger() }, page, uiAnnotations, view);
216
+ (0, listReport_2.addTagsToView)(viewsDefinition, viewKey, namespace, view);
217
+ }
218
+ }
219
+ class TableAndViews extends BaseConstruct {
220
+ /**
221
+ * Constructor for TableAndViews.
222
+ *
223
+ * @param schema - the application schema
224
+ * @param page - the page object
225
+ * @param logger - optional extension logger
226
+ */
227
+ constructor(schema, page, logger) {
228
+ super(schema, page, logger);
229
+ }
230
+ addTableAndViews() {
231
+ const views = this.page.getPage().options?.settings?.views;
232
+ const defaultAnnotation = (0, listReport_2.getDefaultAnnotationPath)(this.page.getPage(), this.page.getEntityType(), this.page.getTemplate().type);
233
+ const tableDefinitionName = (0, utils_1.alignSchemaWithTemplateType)(this.schema.getSchema(), this.page.getTemplate().type);
234
+ if (this.page.getTemplate().type === __1.TemplateType.ListReportObjectPageV4) {
235
+ this.schema.hide(this.schema.getRootProperty([__1.PropertyName.chart]));
236
+ adaptTableDefinition(this.schema, this.page, defaultAnnotation, tableDefinitionName);
237
+ if (!views) {
238
+ this.schema.setProperty(__1.DefinitionName.MultiTableModeV4, ['properties'], {});
239
+ }
240
+ else if (views.paths) {
241
+ this.schema.cleanup(['LineItems', 'ToolBar<LineItems>', 'Actions<LineItems>']);
242
+ addLRViews(this.schema, views.paths, this.page, tableDefinitionName);
243
+ }
244
+ }
245
+ else if (this.page.getTemplate().type === __1.TemplateType.AnalyticalListPageV4) {
246
+ const generateParameters = {
247
+ logger: this.logger,
248
+ entityType: this.page.getEntityType(),
249
+ serviceAVT: this.page.getApp().getAVT()
250
+ };
251
+ (0, listReport_2.addALPViews)(this.schema.getSchema(), views?.paths, generateParameters, defaultAnnotation, this.page.getPage(), tableDefinitionName);
252
+ }
253
+ }
254
+ /**
255
+ * Instantiates the TableAndViews and adds them to the schema.
256
+ */
257
+ instantiate() {
258
+ this.addTableAndViews();
259
+ }
260
+ }
261
+ exports.TableAndViews = TableAndViews;
262
+ //# sourceMappingURL=ListReportUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListReportUtils.js","sourceRoot":"","sources":["../../../../../../src/sync/v4/generate/ListReportUtils.ts"],"names":[],"mappings":";;;;;;AACA,gCAAkH;AAElH,0CAAuF;AACvF,6CAA8D;AAG9D,6CAOsB;AAItB,yCAA8G;AAC9G,sDAA8B;AAG9B,MAAa,aAAa;IAKtB;;;;;;OAMG;IACH,YAAY,MAAiB,EAAE,IAAU,EAAE,MAAwB;QAC/D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AAjBD,sCAiBC;AAED;;;;GAIG;AACH,MAAa,yBAA0B,SAAQ,aAAa;IACxD;;;;;;OAMG;IACH,YAAY,MAAiB,EAAE,IAAU,EAAE,MAAwB;QAC/D,KA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AC;IACL,CAAC;IACD;;OAEG;IACH,WAAW;QACP,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC5B,CAAC;CACJ;AApDD,sCAoDC"}
@@ -1,8 +1,10 @@
1
- import { Visualization } from '@sap/ux-specification-types';
2
- import type { GenerateAppSchemaParameters, ExtensionLogger } from '@sap/ux-specification-types';
1
+ import { TemplateType, Visualization } from '@sap/ux-specification-types';
2
+ import type { v4, GenerateAppSchemaParameters, ExtensionLogger } from '@sap/ux-specification-types';
3
3
  import type { AnnotationTerm, EntitySet, EntityType } from '@sap-ux/vocabularies-types';
4
4
  import type { SelectionFields } from '@sap-ux/vocabularies-types/vocabularies/UI';
5
+ import { type ManifestPathParams } from '../../common';
5
6
  import type { Definition } from 'typescript-json-schema';
7
+ import { Page } from '../sync-rules/Page';
6
8
  /**
7
9
  * Adds the selection fields to the app schema, as properties of the FilterBar
8
10
  * @param {EntityType} entityType - the entity type as part of the AVT ConvertedMetadata
@@ -29,6 +31,63 @@ export declare function analyzeViewAnnotation(annotationPath: string, uIAnnotati
29
31
  namespace: string;
30
32
  title: string;
31
33
  };
34
+ /**
35
+ * Adds the ALP views to the app-specific schema
36
+ * @param {Definition} appSchema - app-specific JSON schema
37
+ * @param {Array<Object>} viewsPaths - views' paths' section in the manifest
38
+ * @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
39
+ * @param {string} templateAnnotation - defaultTemplateAnnotationPath as registered in manifest
40
+ * @param {SapUiAppPageV4} v4Page - actual page in the manifest
41
+ */
42
+ export declare function addALPViews(appSchema: Definition, viewsPaths: Array<object>, generateParameters: GenerateAppSchemaParameters, templateAnnotation: string, v4Page: v4.SapUiAppPageV4, tableDefinitionName: string): void;
43
+ export type ViewsParameters = {
44
+ viewKey: string;
45
+ appSchema: Definition;
46
+ targetAnnotation: string;
47
+ navPropName: string;
48
+ targetEntityType: EntityType;
49
+ title: string;
50
+ entitySet?: string;
51
+ };
52
+ /**
53
+ * Adds the schema tags to a given view
54
+ * @param viewsDefinition - the views definition in app schema (MultiTableModeV4)
55
+ * @param viewKey - key property of the view
56
+ * @param namespace - target namespace for annotations
57
+ * @param view - the given view
58
+ */
59
+ export declare function addTagsToView(viewsDefinition: Definition, viewKey: string, namespace: string, view: object): void;
60
+ /**
61
+ * Adds definition parts to a LR View (LineItem/Chart)
62
+ * @param {string} templateAnnotation - defaultTemplateAnnotationPath as registered in manifest
63
+ * @param {string} visualization - visualization of the annotation
64
+ * @param viewsDefinition - the views definition in app schema (MultiTableModeV4)
65
+ * @param commonInputParameters - list of input parameters as collected by the calling instance
66
+ * @param generateParameters - list of API input parameters
67
+ * @param generateParameters.serviceAVT - OData service AVT information
68
+ * @param generateParameters.entityType - entity type of the current page
69
+ * @param generateParameters.logger - extension logger
70
+ * @param page - the current page object
71
+ * @param uiAnnotations - UI annotations of the given entityType
72
+ * @param view - the given view
73
+ */
74
+ export declare function addLRViewParts(visualization: string, viewsDefinition: Definition, commonInputParameters: ViewsParameters, { serviceAVT, entityType, logger }: Partial<GenerateAppSchemaParameters>, page: Page, uiAnnotations: object, view: object): void;
75
+ /**
76
+ * Checks for the default annotation path to use for LR table
77
+ * @param {SapUiAppPageV4} v4Page - actual page in the manifest
78
+ * @param {EntityType} entityType - actual entity type (AVT information)
79
+ * @returns {string} annotation term
80
+ */
81
+ export declare function getDefaultAnnotationPath(v4Page: v4.SapUiAppPageV4, entityType: EntityType, templateType: TemplateType): string | undefined;
82
+ /**
83
+ * Adds 'manifestPath' to each property in a definition based on metadata sync rules.
84
+ *
85
+ * @param appSchema - Full schema.
86
+ * @param definitionName - The name of the definition/class whose properties are being processed.
87
+ * @param definition - The definition object containing property schemas.
88
+ * @param pathParams - Additional context required to compute manifest paths.
89
+ */
90
+ export declare function addManifestPathsToPropertiesLR(appSchema: Definition, definitionName: string | undefined, definition: Definition, pathParams: ManifestPathParams): void;
32
91
  /**
33
92
  * Generates an app specific schema for the FE V4 ListReport from the generic schema.
34
93
  * Generic types are replaced by information from the app specific annotations.
@@ -1 +1 @@
1
- {"version":3,"file":"listReport.d.ts","sourceRoot":"","sources":["../../../../../../src/sync/v4/generate/listReport.ts"],"names":[],"mappings":"AAQA,OAAO,EAKH,aAAa,EAWhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAM,2BAA2B,EAAE,eAAe,EAAY,MAAM,6BAA6B,CAAC;AAC9G,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,KAAK,EAAoC,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAmBpH,OAAO,KAAK,EAAE,UAAU,EAAuB,MAAM,wBAAwB,CAAC;AAS9E;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAC9B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,UAAU,EACrB,yBAAyB,EAAE,cAAc,CAAC,eAAe,CAAC,EAC1D,yBAAyB,CAAC,EAAE,UAAU,GACvC,UAAU,CAqDZ;AAsID;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACjC,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,EAChB,iBAAiB,CAAC,EAAE,aAAa,EACjC,MAAM,CAAC,EAAE,eAAe,GACzB;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAgDvF;AA8rBD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACtC,kBAAkB,EAAE,2BAA2B,EAC/C,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,MAAM,GACrB,MAAM,CA2CR"}
1
+ {"version":3,"file":"listReport.d.ts","sourceRoot":"","sources":["../../../../../../src/sync/v4/generate/listReport.ts"],"names":[],"mappings":"AAEA,OAAO,EAGH,YAAY,EACZ,aAAa,EAUhB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SAAS,EAAE,UAAU,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,UAAU,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAmKF;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,eAAe,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAQ1G;AAyCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC1B,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,UAAU,EAC3B,qBAAqB,EAAE,eAAe,EACtC,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,2BAA2B,CAAC,EACxE,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,QAgDf;AAmKD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACpC,MAAM,EAAE,EAAE,CAAC,cAAc,EACzB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,GAC3B,MAAM,GAAG,SAAS,CAapB;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC1C,SAAS,EAAE,UAAU,EACrB,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,kBAAkB,GAC/B,IAAI,CAaN;AA+ED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACtC,kBAAkB,EAAE,2BAA2B,EAC/C,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,MAAM,GACrB,MAAM,CAQR"}
@@ -5,12 +5,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.addSelectionFields = addSelectionFields;
7
7
  exports.analyzeViewAnnotation = analyzeViewAnnotation;
8
+ exports.addALPViews = addALPViews;
9
+ exports.addTagsToView = addTagsToView;
10
+ exports.addLRViewParts = addLRViewParts;
11
+ exports.getDefaultAnnotationPath = getDefaultAnnotationPath;
12
+ exports.addManifestPathsToPropertiesLR = addManifestPathsToPropertiesLR;
8
13
  exports.generateListReportSchemaV4 = generateListReportSchemaV4;
9
14
  const utils_1 = require("../utils/utils");
10
15
  const ux_specification_types_1 = require("@sap/ux-specification-types");
11
16
  const i18next_1 = __importDefault(require("i18next"));
12
17
  const extensionLogger_1 = require("../../../extensionLogger");
13
18
  const common_1 = require("../../common");
19
+ const Page_1 = require("../sync-rules/Page");
20
+ const App_1 = require("../sync-rules/App");
21
+ const AppSchema_1 = require("../sync-rules/AppSchema");
22
+ const ListReportUtils_1 = require("./ListReportUtils");
14
23
  const ROOT_PROPERTIES_ORDER = ['filterBar', 'chart', 'table'];
15
24
  const UILINEITEM = '@UI.LineItem';
16
25
  /**
@@ -250,7 +259,7 @@ function addALPChartView(appSchema, chartAnnotationPath, targetAnnotation, annot
250
259
  }
251
260
  else {
252
261
  // Add message about unexisting annotation path
253
- (0, common_1.addMessageToSchema)(chartView, i18next_1.default.t('UNEXISTING_ANNOTATION_PATH'));
262
+ (0, common_1.addMessageToSchema)(chartView, { text: i18next_1.default.t('UNEXISTING_ANNOTATION_PATH') });
254
263
  }
255
264
  }
256
265
  chartView[ux_specification_types_1.SchemaTag.artifactType] = ux_specification_types_1.ArtifactType.Manifest;
@@ -407,10 +416,10 @@ function createEmptyProperties(definition) {
407
416
  * @param {string} visualization - The visualization format or mode for the line items, used to determine the associated annotations.
408
417
  * @param {string} templateAnnotation - The template annotation to infer metadata for the line items.
409
418
  * @param {GenerateAppSchemaParameters} generateParameters - Parameters essential for schema generation, including OData service metadata.
410
- * @param {v4.SapUiAppPageV4} v4Page - The V4 application page configuration where adjustments and schema changes will apply.
419
+ * @param {Page} page - The page object representing the context in which the view is being generated.
411
420
  * @returns {void} No return value.
412
421
  */
413
- function addViewLineItems(inputParameters, viewsDefinition, visualization, templateAnnotation, generateParameters, v4Page) {
422
+ function addViewLineItems(inputParameters, viewsDefinition, visualization, templateAnnotation, { serviceAVT, entityType }, page) {
414
423
  const tableId = `${ux_specification_types_1.DefinitionName.LRTableView}<${inputParameters.viewKey}>`;
415
424
  const viewId = `${ux_specification_types_1.DefinitionName.LineItemsOfView}::${inputParameters.viewKey}`;
416
425
  const lrTableView = (0, common_1.parseSchemaDefinition)(ux_specification_types_1.DefinitionName.LRTableView, inputParameters.viewKey, inputParameters.appSchema);
@@ -440,9 +449,8 @@ function addViewLineItems(inputParameters, viewsDefinition, visualization, templ
440
449
  appSchema: inputParameters.appSchema,
441
450
  lineItemAnnotation: inputParameters.targetEntityType?.annotations.UI[annotationTerm],
442
451
  entityType: inputParameters.targetEntityType,
443
- oDataServiceAVT: generateParameters.serviceAVT,
444
- lineItemId: viewId,
445
- entitySet: lrTableView['entitySet']
452
+ oDataServiceAVT: serviceAVT,
453
+ lineItemId: viewId
446
454
  };
447
455
  let columnDefinitionName = ux_specification_types_1.DefinitionName.ViewTableColumn;
448
456
  // handle basic columns and basic actions for view with different entity set (remove properties)
@@ -459,8 +467,8 @@ function addViewLineItems(inputParameters, viewsDefinition, visualization, templ
459
467
  (0, utils_1.addLineItemsTypeToSchema)(dataForLineItem, columnDefinitionName);
460
468
  // Add "manifestPath" for table properties
461
469
  addManifestPathsToPropertiesLR(inputParameters.appSchema, ux_specification_types_1.DefinitionName.LRTableView, lrTableView, {
462
- pageName: v4Page.id,
463
- manifest: generateParameters.manifest,
470
+ pageName: page.getPage().id,
471
+ manifest: page.getApp().manifest,
464
472
  targetAnnotation: inputParameters.targetAnnotation
465
473
  });
466
474
  }
@@ -518,16 +526,19 @@ function handleViewProperties(definition, validProperties) {
518
526
  * @param {string} templateAnnotation - defaultTemplateAnnotationPath as registered in manifest
519
527
  * @param {string} visualization - visualization of the annotation
520
528
  * @param viewsDefinition - the views definition in app schema (MultiTableModeV4)
521
- * @param {object} commonInputParameters - list of input parameters as collected by the calling instance
522
- * @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
523
- * @param {SapUiAppPageV4} v4Page - the given page in manifest
524
- * @param {object} uiAnnotations - UI annotations of the given entityType
525
- * @param {object} view - the given view
529
+ * @param commonInputParameters - list of input parameters as collected by the calling instance
530
+ * @param generateParameters - list of API input parameters
531
+ * @param generateParameters.serviceAVT - OData service AVT information
532
+ * @param generateParameters.entityType - entity type of the current page
533
+ * @param generateParameters.logger - extension logger
534
+ * @param page - the current page object
535
+ * @param uiAnnotations - UI annotations of the given entityType
536
+ * @param view - the given view
526
537
  */
527
- function addLRViewParts(visualization, viewsDefinition, commonInputParameters, generateParameters, v4Page, uiAnnotations, view) {
538
+ function addLRViewParts(visualization, viewsDefinition, commonInputParameters, { serviceAVT, entityType, logger }, page, uiAnnotations, view) {
528
539
  if (visualization?.indexOf(ux_specification_types_1.Visualization.LineItem) > -1) {
529
540
  //Add Line item view
530
- addViewLineItems(commonInputParameters, viewsDefinition, visualization, commonInputParameters.targetAnnotation, generateParameters, v4Page);
541
+ addViewLineItems(commonInputParameters, viewsDefinition, visualization, commonInputParameters.targetAnnotation, { serviceAVT, entityType }, page);
531
542
  if (view['entitySet'] !== undefined) {
532
543
  // handle root properties of current view if entity set is different
533
544
  handleViewProperties(commonInputParameters.appSchema.definitions[`${ux_specification_types_1.DefinitionName.LRTableView}<${view['key']}>`], ['visible']);
@@ -557,14 +568,15 @@ function addLRViewParts(visualization, viewsDefinition, commonInputParameters, g
557
568
  }
558
569
  }
559
570
  /**
560
- * Add list report views to the app-specific schema
561
- * @param {Definition} appSchema - app-specific JSON schema
562
- * @param {Array<Object>} viewsPaths - views' paths' section in the manifest
563
- * @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
564
- * @param {string} templateAnnotation - defaultTemplateAnnotationPath as registered in manifest
565
- * @param {SapUiAppPageV4} v4Page - the given page in manifest
571
+ * Add list report views to the app-specific schema.
572
+ *
573
+ * @param appSchema - app-specific JSON schema
574
+ * @param viewsPaths - views' paths' section in the manifest
575
+ * @param generateParameters - list of API input parameters
576
+ * @param page - the current page object
577
+ * @param tableDefinitionName - The name of the table definition in the schema
566
578
  */
567
- function addLRViews(appSchema, viewsPaths, generateParameters, v4Page, tableDefinitionName) {
579
+ function addLRViews(appSchema, viewsPaths, generateParameters, page, tableDefinitionName) {
568
580
  const tableDefinition = appSchema.definitions[tableDefinitionName];
569
581
  tableDefinition.properties = {
570
582
  annotationPath: tableDefinition.properties.annotationPath,
@@ -595,7 +607,7 @@ function addLRViews(appSchema, viewsPaths, generateParameters, v4Page, tableDefi
595
607
  title,
596
608
  entitySet: view['entitySet']
597
609
  };
598
- addLRViewParts(visualization, viewsDefinition, commonInputParameters, generateParameters, v4Page, uiAnnotations, view);
610
+ addLRViewParts(visualization, viewsDefinition, commonInputParameters, generateParameters, page, uiAnnotations, view);
599
611
  addTagsToView(viewsDefinition, viewKey, namespace, view);
600
612
  }
601
613
  }
@@ -691,40 +703,13 @@ function getDefaultAnnotationPath(v4Page, entityType, templateType) {
691
703
  entityType?.annotations.UI?.PresentationVariant?.term);
692
704
  }
693
705
  }
694
- /**
695
- * Add views to schema (LR or ALP)
696
- * @param {Definition} appSchema - app-specific JSON schema
697
- * @param {SapUiAppPageV4} v4Page - actual page in the manifest
698
- * @param {GenerateAppSchemaParameters} generateParameters - list of API input parameters
699
- */
700
- function addTableAndViews(appSchema, v4Page, generateParameters, alias) {
701
- const viewsPaths = v4Page.options?.settings?.views?.paths;
702
- const defaultAnnotation = getDefaultAnnotationPath(v4Page, generateParameters.entityType, generateParameters.templateType);
703
- const tableDefinitionName = (0, utils_1.alignSchemaWithTemplateType)(appSchema, generateParameters);
704
- if (generateParameters.templateType === ux_specification_types_1.TemplateType.ListReportObjectPageV4) {
705
- adaptTableDefinition(appSchema, generateParameters, defaultAnnotation, v4Page, alias, tableDefinitionName);
706
- if (viewsPaths) {
707
- delete appSchema.definitions['LineItems'];
708
- delete appSchema.definitions['ToolBar<LineItems>'];
709
- delete appSchema.definitions['Actions<LineItems>'];
710
- addLRViews(appSchema, viewsPaths, generateParameters, v4Page, tableDefinitionName);
711
- }
712
- else if (!v4Page.options?.settings?.views) {
713
- appSchema.definitions.MultiTableModeV4.properties = {};
714
- }
715
- appSchema.properties[ux_specification_types_1.PropertyName.chart][ux_specification_types_1.SchemaTag.hidden] = true;
716
- }
717
- else if (generateParameters.templateType === ux_specification_types_1.TemplateType.AnalyticalListPageV4) {
718
- addALPViews(appSchema, viewsPaths, generateParameters, defaultAnnotation, v4Page, tableDefinitionName);
719
- }
720
- }
721
706
  /**
722
707
  * Adds 'manifestPath' to each property in a definition based on metadata sync rules.
723
708
  *
724
- * @param {string} appSchema - Full schema.
725
- * @param {string} definitionName - The name of the definition/class whose properties are being processed.
726
- * @param {Definition} definition - The definition object containing property schemas.
727
- * @param {ListReportManifestPathParams} pathParams - Additional context required to compute manifest paths.
709
+ * @param appSchema - Full schema.
710
+ * @param definitionName - The name of the definition/class whose properties are being processed.
711
+ * @param definition - The definition object containing property schemas.
712
+ * @param pathParams - Additional context required to compute manifest paths.
728
713
  */
729
714
  function addManifestPathsToPropertiesLR(appSchema, definitionName, definition, pathParams) {
730
715
  let targetAnnotation = undefined;
@@ -744,8 +729,8 @@ function addManifestPathsToPropertiesLR(appSchema, definitionName, definition, p
744
729
  /**
745
730
  * Adds 'manifestPath' to static nodes in schema.
746
731
  *
747
- * @param {string} appSchema - Full schema.
748
- * @param {ListReportManifestPathParams} pathParams - Additional context required to compute manifest paths.
732
+ * @param appSchema - Full schema.
733
+ * @param pathParams - Additional context required to compute manifest paths.
749
734
  */
750
735
  function addManifestPathsToStaticNodes(appSchema, pathParams) {
751
736
  // Root level - rules stored on page class level
@@ -759,6 +744,52 @@ function addManifestPathsToStaticNodes(appSchema, pathParams) {
759
744
  }
760
745
  }
761
746
  }
747
+ /**
748
+ * Class to generate the List Report page schema.
749
+ */
750
+ class ListReportPage {
751
+ /**
752
+ * Constructor for ListReportPage.
753
+ *
754
+ * @param generateParameters - parameters for generating the app schema
755
+ * @param schema - generic JSON schema of the List Report page
756
+ * @param templateName - name of the template
757
+ * @param contextPath - context path of the page
758
+ */
759
+ constructor(generateParameters, schema, templateName) {
760
+ this.schema = new AppSchema_1.AppSchema(schema);
761
+ this.app = (0, App_1.createApp)(generateParameters.manifest, generateParameters.serviceAVT, generateParameters.logger);
762
+ this.page = new Page_1.Page(this.app, { name: templateName, type: generateParameters.templateType }, generateParameters.entitySet);
763
+ }
764
+ /**
765
+ * Cleans up the schema by hiding specific properties and removing unnecessary definitions.
766
+ */
767
+ cleanup() {
768
+ this.schema.hide(this.schema.getRootProperty([ux_specification_types_1.PropertyName.defaultTemplateAnnotationPath]));
769
+ this.schema.cleanup(['GenericColumns', 'Action']);
770
+ (0, common_1.updatePropertyIndices)(this.schema.getSchema(), ROOT_PROPERTIES_ORDER);
771
+ }
772
+ /**
773
+ * Generates the finalized schema for the List Report page.
774
+ *
775
+ * @returns The finalized schema for List Report page
776
+ */
777
+ generate() {
778
+ new ListReportUtils_1.GeneralListReportSettings(this.schema, this.page, this.app.getLogger());
779
+ if (!this.page.getPage()) {
780
+ return this.schema.finalize();
781
+ }
782
+ new ListReportUtils_1.FilterBar(this.schema, this.page, this.app.getLogger()).instantiate();
783
+ new ListReportUtils_1.TableAndViews(this.schema, this.page, this.app.getLogger()).instantiate();
784
+ // Add "manifestPath" for properties in static nodes
785
+ addManifestPathsToStaticNodes(this.schema.getSchema(), {
786
+ pageName: this.page.getPage().id,
787
+ manifest: this.app.getManifest()
788
+ });
789
+ this.cleanup();
790
+ return this.schema.finalize();
791
+ }
792
+ }
762
793
  /**
763
794
  * Generates an app specific schema for the FE V4 ListReport from the generic schema.
764
795
  * Generic types are replaced by information from the app specific annotations.
@@ -770,44 +801,11 @@ function addManifestPathsToStaticNodes(appSchema, pathParams) {
770
801
  * @returns {object} application-specific schema of the list report
771
802
  */
772
803
  function generateListReportSchemaV4(generateParameters, genericSchema, entitySet, templateName) {
773
- const appSchema = JSON.parse(JSON.stringify(genericSchema));
774
- const entityType = entitySet?.entityType;
775
- const alias = generateParameters.serviceAVT && (0, common_1.findAlias)(ux_specification_types_1.UIVOCABULARY, generateParameters.serviceAVT);
776
- //Add selection fields
777
- const selectionFieldAnnotation = alias && entityType?.annotations?.[alias]?.SelectionFields;
778
- addSelectionFields(entityType, appSchema, selectionFieldAnnotation);
779
- appSchema.properties[ux_specification_types_1.PropertyName.defaultTemplateAnnotationPath][ux_specification_types_1.SchemaTag.hidden] = true;
780
- //enum for annotation path as part of QuickVariantSelection
781
- (0, common_1.addEnumForSingleTabVariant)(entityType, appSchema, ux_specification_types_1.DefinitionName.AnnotationPathAsObject);
782
- if (generateParameters.manifest) {
783
- //Find page in targets
784
- const pages = generateParameters.manifest[ux_specification_types_1.ManifestSection.ui5].routing
785
- .targets;
786
- if (!pages) {
787
- (0, extensionLogger_1.log)(generateParameters.logger, {
788
- severity: "error" /* LogSeverity.Error */,
789
- message: i18next_1.default.t('NOPAGES', { appId: generateParameters.manifest['sap.app']['id'] }),
790
- location: {
791
- path: ux_specification_types_1.MANIFESTPATH,
792
- range: [ux_specification_types_1.ManifestSection.generic]
793
- }
794
- });
795
- return appSchema;
796
- }
797
- const v4Page = (0, utils_1.findPageV4)(pages, templateName, entitySet, generateParameters.logger);
798
- if (!v4Page) {
799
- return appSchema;
800
- }
801
- addTableAndViews(appSchema, v4Page, generateParameters, alias);
802
- // Add "manifestPath" for properties in static nodes
803
- addManifestPathsToStaticNodes(appSchema, {
804
- pageName: v4Page.id,
805
- manifest: generateParameters.manifest
806
- });
804
+ const listReport = new ListReportPage(generateParameters, genericSchema, templateName);
805
+ if (!listReport.app.getManifest()) {
806
+ listReport.cleanup();
807
+ return listReport.schema.finalize();
807
808
  }
808
- delete appSchema.definitions.GenericColumns;
809
- delete appSchema.definitions.Action;
810
- (0, common_1.updatePropertyIndices)(appSchema, ROOT_PROPERTIES_ORDER);
811
- return appSchema;
809
+ return listReport.generate();
812
810
  }
813
811
  //# sourceMappingURL=listReport.js.map