@openui5/sap.ui.mdc 1.130.1 → 1.131.1

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 (162) hide show
  1. package/THIRDPARTY.txt +1 -1
  2. package/package.json +4 -4
  3. package/src/sap/ui/mdc/.library +1 -1
  4. package/src/sap/ui/mdc/ActionToolbar.js +1 -1
  5. package/src/sap/ui/mdc/Chart.js +62 -25
  6. package/src/sap/ui/mdc/ChartDelegate.js +17 -14
  7. package/src/sap/ui/mdc/Control.js +1 -1
  8. package/src/sap/ui/mdc/DefaultTypeMap.js +1 -1
  9. package/src/sap/ui/mdc/Element.js +1 -1
  10. package/src/sap/ui/mdc/Field.js +43 -15
  11. package/src/sap/ui/mdc/FilterBar.js +1 -1
  12. package/src/sap/ui/mdc/FilterField.js +2 -2
  13. package/src/sap/ui/mdc/Link.js +1 -1
  14. package/src/sap/ui/mdc/LinkDelegate.js +1 -1
  15. package/src/sap/ui/mdc/MultiValueField.js +3 -4
  16. package/src/sap/ui/mdc/Table.js +183 -36
  17. package/src/sap/ui/mdc/TableDelegate.js +40 -18
  18. package/src/sap/ui/mdc/ValueHelp.js +1 -1
  19. package/src/sap/ui/mdc/actiontoolbar/ActionToolbarAction.js +1 -2
  20. package/src/sap/ui/mdc/chart/ChartImplementationContainer.js +1 -1
  21. package/src/sap/ui/mdc/chart/ChartSelectionDetails.js +1 -1
  22. package/src/sap/ui/mdc/chart/PropertyHelper.js +1 -1
  23. package/src/sap/ui/mdc/chart/ToolbarControlFactory.js +1 -1
  24. package/src/sap/ui/mdc/condition/Condition.js +1 -1
  25. package/src/sap/ui/mdc/condition/ConditionConverter.js +1 -1
  26. package/src/sap/ui/mdc/condition/ConditionModel.js +1 -1
  27. package/src/sap/ui/mdc/condition/FilterConverter.js +1 -1
  28. package/src/sap/ui/mdc/condition/FilterOperatorUtil.js +361 -54
  29. package/src/sap/ui/mdc/condition/Operator.js +1 -1
  30. package/src/sap/ui/mdc/condition/OperatorDynamicDateOption.js +1 -1
  31. package/src/sap/ui/mdc/condition/RangeOperator.js +1 -1
  32. package/src/sap/ui/mdc/enums/ActionToolbarActionAlignment.js +0 -1
  33. package/src/sap/ui/mdc/enums/OperatorName.js +127 -1
  34. package/src/sap/ui/mdc/field/ConditionType.js +1 -1
  35. package/src/sap/ui/mdc/field/ConditionTypeMixin.js +1 -1
  36. package/src/sap/ui/mdc/field/ConditionsType.js +1 -1
  37. package/src/sap/ui/mdc/field/CustomFieldInfo.js +1 -1
  38. package/src/sap/ui/mdc/field/DynamicDateRangeConditionsType.js +1 -1
  39. package/src/sap/ui/mdc/field/FieldBase.js +1 -1
  40. package/src/sap/ui/mdc/field/FieldBaseDelegate.js +2 -2
  41. package/src/sap/ui/mdc/field/FieldInfoBase.js +1 -1
  42. package/src/sap/ui/mdc/field/FieldInput.js +1 -1
  43. package/src/sap/ui/mdc/field/FieldInputRenderUtil.js +1 -1
  44. package/src/sap/ui/mdc/field/FieldMultiInput.js +1 -1
  45. package/src/sap/ui/mdc/field/ListFieldHelpItem.js +1 -1
  46. package/src/sap/ui/mdc/field/MultiValueFieldDelegate.js +0 -1
  47. package/src/sap/ui/mdc/field/MultiValueFieldItem.js +1 -2
  48. package/src/sap/ui/mdc/field/TokenDisplay.js +1 -1
  49. package/src/sap/ui/mdc/field/TokenizerDisplay.js +1 -1
  50. package/src/sap/ui/mdc/filterbar/FilterBarBase.js +1 -1
  51. package/src/sap/ui/mdc/filterbar/PropertyHelper.js +1 -1
  52. package/src/sap/ui/mdc/filterbar/p13n/AdaptationFilterBar.js +1 -1
  53. package/src/sap/ui/mdc/filterbar/vh/CollectiveSearchSelect.js +4 -1
  54. package/src/sap/ui/mdc/filterbar/vh/FilterBar.js +5 -2
  55. package/src/sap/ui/mdc/flexibility/Chart.flexibility.js +1 -1
  56. package/src/sap/ui/mdc/flexibility/FilterBar.flexibility.js +1 -1
  57. package/src/sap/ui/mdc/flexibility/FilterItemFlex.js +1 -1
  58. package/src/sap/ui/mdc/flexibility/actiontoolbar/CombineAction.js +1 -2
  59. package/src/sap/ui/mdc/flexibility/actiontoolbar/SplitAction.js +1 -2
  60. package/src/sap/ui/mdc/library.js +2 -2
  61. package/src/sap/ui/mdc/link/Factory.js +1 -1
  62. package/src/sap/ui/mdc/link/LinkItem.js +1 -1
  63. package/src/sap/ui/mdc/link/Panel.js +1 -1
  64. package/src/sap/ui/mdc/link/PanelItem.js +1 -1
  65. package/src/sap/ui/mdc/link/SemanticObjectMapping.js +1 -1
  66. package/src/sap/ui/mdc/link/SemanticObjectMappingItem.js +1 -1
  67. package/src/sap/ui/mdc/link/SemanticObjectUnavailableAction.js +1 -1
  68. package/src/sap/ui/mdc/messagebundle.properties +12 -148
  69. package/src/sap/ui/mdc/messagebundle_ar.properties +6 -96
  70. package/src/sap/ui/mdc/messagebundle_bg.properties +6 -96
  71. package/src/sap/ui/mdc/messagebundle_ca.properties +6 -96
  72. package/src/sap/ui/mdc/messagebundle_cnr.properties +6 -96
  73. package/src/sap/ui/mdc/messagebundle_cs.properties +6 -96
  74. package/src/sap/ui/mdc/messagebundle_cy.properties +6 -96
  75. package/src/sap/ui/mdc/messagebundle_da.properties +6 -96
  76. package/src/sap/ui/mdc/messagebundle_de.properties +6 -96
  77. package/src/sap/ui/mdc/messagebundle_el.properties +6 -96
  78. package/src/sap/ui/mdc/messagebundle_en.properties +6 -96
  79. package/src/sap/ui/mdc/messagebundle_en_GB.properties +6 -96
  80. package/src/sap/ui/mdc/messagebundle_en_US_saprigi.properties +6 -98
  81. package/src/sap/ui/mdc/messagebundle_es.properties +7 -97
  82. package/src/sap/ui/mdc/messagebundle_es_MX.properties +6 -96
  83. package/src/sap/ui/mdc/messagebundle_et.properties +6 -96
  84. package/src/sap/ui/mdc/messagebundle_fi.properties +6 -96
  85. package/src/sap/ui/mdc/messagebundle_fr.properties +6 -96
  86. package/src/sap/ui/mdc/messagebundle_fr_CA.properties +6 -96
  87. package/src/sap/ui/mdc/messagebundle_hi.properties +6 -96
  88. package/src/sap/ui/mdc/messagebundle_hr.properties +6 -96
  89. package/src/sap/ui/mdc/messagebundle_hu.properties +6 -96
  90. package/src/sap/ui/mdc/messagebundle_id.properties +6 -96
  91. package/src/sap/ui/mdc/messagebundle_it.properties +6 -96
  92. package/src/sap/ui/mdc/messagebundle_iw.properties +6 -96
  93. package/src/sap/ui/mdc/messagebundle_ja.properties +6 -96
  94. package/src/sap/ui/mdc/messagebundle_kk.properties +6 -96
  95. package/src/sap/ui/mdc/messagebundle_ko.properties +6 -96
  96. package/src/sap/ui/mdc/messagebundle_lt.properties +6 -96
  97. package/src/sap/ui/mdc/messagebundle_lv.properties +6 -96
  98. package/src/sap/ui/mdc/messagebundle_mk.properties +6 -96
  99. package/src/sap/ui/mdc/messagebundle_ms.properties +6 -96
  100. package/src/sap/ui/mdc/messagebundle_nl.properties +7 -97
  101. package/src/sap/ui/mdc/messagebundle_no.properties +6 -96
  102. package/src/sap/ui/mdc/messagebundle_pl.properties +9 -99
  103. package/src/sap/ui/mdc/messagebundle_pt.properties +6 -96
  104. package/src/sap/ui/mdc/messagebundle_pt_PT.properties +6 -96
  105. package/src/sap/ui/mdc/messagebundle_ro.properties +6 -96
  106. package/src/sap/ui/mdc/messagebundle_ru.properties +13 -103
  107. package/src/sap/ui/mdc/messagebundle_sh.properties +6 -96
  108. package/src/sap/ui/mdc/messagebundle_sk.properties +6 -96
  109. package/src/sap/ui/mdc/messagebundle_sl.properties +6 -96
  110. package/src/sap/ui/mdc/messagebundle_sr.properties +6 -96
  111. package/src/sap/ui/mdc/messagebundle_sv.properties +6 -96
  112. package/src/sap/ui/mdc/messagebundle_th.properties +6 -96
  113. package/src/sap/ui/mdc/messagebundle_tr.properties +6 -96
  114. package/src/sap/ui/mdc/messagebundle_uk.properties +6 -96
  115. package/src/sap/ui/mdc/messagebundle_vi.properties +6 -96
  116. package/src/sap/ui/mdc/messagebundle_zh_CN.properties +6 -96
  117. package/src/sap/ui/mdc/messagebundle_zh_TW.properties +6 -96
  118. package/src/sap/ui/mdc/mixin/AdaptationMixin.js +1 -1
  119. package/src/sap/ui/mdc/mixin/DelegateMixin.js +1 -1
  120. package/src/sap/ui/mdc/mixin/FilterIntegrationMixin.js +1 -1
  121. package/src/sap/ui/mdc/mixin/PromiseMixin.js +1 -1
  122. package/src/sap/ui/mdc/mixin/PropertyHelperMixin.js +1 -1
  123. package/src/sap/ui/mdc/odata/TypeMap.js +1 -1
  124. package/src/sap/ui/mdc/odata/v4/TableDelegate.js +239 -197
  125. package/src/sap/ui/mdc/odata/v4/TypeMap.js +1 -1
  126. package/src/sap/ui/mdc/odata/v4/vizChart/ChartDelegate.js +19 -19
  127. package/src/sap/ui/mdc/p13n/PropertyHelper.js +1 -1
  128. package/src/sap/ui/mdc/p13n/panels/ChartItemPanel.js +12 -19
  129. package/src/sap/ui/mdc/table/Column.js +3 -0
  130. package/src/sap/ui/mdc/table/ColumnSettings.js +1 -1
  131. package/src/sap/ui/mdc/table/CreationRow.js +1 -1
  132. package/src/sap/ui/mdc/table/DragDropConfig.js +1 -1
  133. package/src/sap/ui/mdc/table/GridTableType.js +3 -1
  134. package/src/sap/ui/mdc/table/PropertyHelper.js +14 -1
  135. package/src/sap/ui/mdc/table/ResponsiveColumnSettings.js +1 -1
  136. package/src/sap/ui/mdc/table/RowActionItem.js +1 -1
  137. package/src/sap/ui/mdc/table/RowSettings.js +3 -2
  138. package/src/sap/ui/mdc/table/TableSettings.js +26 -3
  139. package/src/sap/ui/mdc/table/V4AnalyticsPropertyHelper.js +32 -41
  140. package/src/sap/ui/mdc/table/utils/Personalization.js +1 -1
  141. package/src/sap/ui/mdc/ushell/SemanticObjectMapping.js +1 -1
  142. package/src/sap/ui/mdc/ushell/SemanticObjectMappingItem.js +1 -1
  143. package/src/sap/ui/mdc/ushell/SemanticObjectUnavailableAction.js +1 -1
  144. package/src/sap/ui/mdc/util/InfoBar.js +2 -1
  145. package/src/sap/ui/mdc/util/PromiseCache.js +1 -1
  146. package/src/sap/ui/mdc/util/PropertyHelper.js +1 -1
  147. package/src/sap/ui/mdc/valuehelp/CollectiveSearchSelect.js +2 -10
  148. package/src/sap/ui/mdc/valuehelp/Dialog.js +1 -1
  149. package/src/sap/ui/mdc/valuehelp/FilterBar.js +1 -1
  150. package/src/sap/ui/mdc/valuehelp/Popover.js +1 -1
  151. package/src/sap/ui/mdc/valuehelp/base/Container.js +1 -1
  152. package/src/sap/ui/mdc/valuehelp/base/Content.js +1 -1
  153. package/src/sap/ui/mdc/valuehelp/base/DefineConditionPanel.js +30 -32
  154. package/src/sap/ui/mdc/valuehelp/base/DialogTab.js +1 -1
  155. package/src/sap/ui/mdc/valuehelp/base/FilterableListContent.js +1 -1
  156. package/src/sap/ui/mdc/valuehelp/base/ListContent.js +1 -1
  157. package/src/sap/ui/mdc/valuehelp/content/Bool.js +1 -1
  158. package/src/sap/ui/mdc/valuehelp/content/Conditions.js +1 -1
  159. package/src/sap/ui/mdc/valuehelp/content/FixedList.js +6 -1
  160. package/src/sap/ui/mdc/valuehelp/content/FixedListItem.js +1 -1
  161. package/src/sap/ui/mdc/valuehelp/content/MDCTable.js +1 -1
  162. package/src/sap/ui/mdc/valuehelp/content/MTable.js +17 -4
@@ -15,8 +15,7 @@ sap.ui.define([
15
15
  "sap/m/plugins/PluginBase",
16
16
  "sap/ui/core/Lib",
17
17
  "sap/ui/core/format/ListFormat",
18
- "sap/ui/core/message/MessageType",
19
- "sap/ui/base/ManagedObjectObserver"
18
+ "sap/ui/core/message/MessageType"
20
19
  ], (
21
20
  TableDelegate,
22
21
  V4AnalyticsPropertyHelper,
@@ -28,13 +27,10 @@ sap.ui.define([
28
27
  PluginBase,
29
28
  Lib,
30
29
  ListFormat,
31
- MessageType,
32
- ManagedObjectObserver
30
+ MessageType
33
31
  ) => {
34
32
  "use strict";
35
33
 
36
- const TableMap = new window.WeakMap(); // To store table-related information for easy access in the delegate.
37
-
38
34
  /**
39
35
  * Base delegate for {@link sap.ui.mdc.Table} and <code>ODataV4</code>. Extend this object in your project to use all functionalities of the
40
36
  * table. For more information, please see {@link module:sap/ui/mdc/TableDelegate}.
@@ -164,6 +160,11 @@ sap.ui.define([
164
160
  * @override
165
161
  */
166
162
  Delegate.updateBinding = function(oTable, oBindingInfo, oBinding, mSettings) {
163
+ // Custom $$aggregation is not supported if analytical features are enabled.
164
+ if (isAnalyticsEnabled(oTable)) {
165
+ updateAggregation(oTable, oBindingInfo);
166
+ }
167
+
167
168
  if (!oBinding || oBinding.getPath() != oBindingInfo.path) {
168
169
  this.rebind(oTable, oBindingInfo);
169
170
  return;
@@ -178,16 +179,7 @@ sap.ui.define([
178
179
  oRootBinding.suspend();
179
180
  }
180
181
 
181
- // Multiple setAggregation calls with different parameters can lead to an unnecessary request. For example, if the aggregation is set
182
- // to undefined and then to the previous value, it's basically a refresh.
183
- // Custom $$aggregation is not supported in analytical scenarios.
184
-
185
- if (isAnalyticsEnabled(oTable)) {
186
- setAggregation(oTable, oBindingInfo);
187
- } else {
188
- oBinding.setAggregation(oBindingInfo.parameters?.$$aggregation);
189
- }
190
-
182
+ oBinding.setAggregation(oBindingInfo.parameters?.$$aggregation);
191
183
  oBinding.changeParameters((() => {
192
184
  const mParameters = {...oBindingInfo.parameters};
193
185
  delete mParameters.$$aggregation;
@@ -213,54 +205,28 @@ sap.ui.define([
213
205
  }
214
206
  };
215
207
 
216
- /**
217
- * @inheritDoc
218
- */
219
- Delegate.rebind = function(oTable, oBindingInfo) {
220
- setAggregation(oTable, oBindingInfo);
221
- TableDelegate.rebind.apply(this, arguments);
222
- };
223
-
224
- /**
225
- * Expands all rows.
226
- *
227
- * @param {sap.ui.mdc.Table} oTable Instance of the table
228
- * @throws {Error} If
229
- * <ul>
230
- * <li>the table type is not {@link sap.ui.mdc.table.TreeTableType TreeTable}</li>
231
- * <li>{@link sap.ui.model.odata.v4.ODataListBinding#setAggregation} throws an error</li>
232
- * <li>{@link sap.ui.model.odata.v4.ODataListBinding#refresh} throws an error</li>
233
- * </ul>
234
- * @protected
235
- * @override
236
- */
237
- Delegate.expandAllRows = function(oTable) {
238
- if (!this.getSupportedFeatures(oTable).expandAllRows) {
239
- throw Error("Unsupported operation: Not supported for the current table type");
240
- }
241
-
242
- expandRowsToLevel(oTable, Number.MAX_SAFE_INTEGER);
243
- };
244
-
245
- /**
246
- * Collapses all rows.
247
- *
248
- * @param {sap.ui.mdc.Table} oTable Instance of the table
249
- * @throws {Error} If
250
- * <ul>
251
- * <li>the table type is not {@link sap.ui.mdc.table.TreeTableType TreeTable}</li>
252
- * <li>{@link sap.ui.model.odata.v4.ODataListBinding#setAggregation} throws an error</li>
253
- * <li>{@link sap.ui.model.odata.v4.ODataListBinding#refresh} throws an error</li>
254
- * </ul>
255
- * @protected
256
- * @override
257
- */
258
- Delegate.collapseAllRows = function(oTable) {
259
- if (!this.getSupportedFeatures(oTable).collapseAllRows) {
260
- throw Error("Unsupported operation: Not supported for the current table type");
208
+ Delegate.fetchExpandAndCollapseConfiguration = function(oTable) {
209
+ if (!oTable._isOfType(TableType.TreeTable)) {
210
+ return Promise.resolve({});
261
211
  }
262
212
 
263
- expandRowsToLevel(oTable, 1);
213
+ return Promise.resolve({
214
+ expandAll: function(oTable) {
215
+ expandRowsToLevel(oTable, Number.MAX_SAFE_INTEGER);
216
+ },
217
+ collapseAll: function(oTable) {
218
+ expandRowsToLevel(oTable, 1);
219
+ },
220
+ expandAllFromNode: function(oTable, oContext) {
221
+ oContext.expand(Number.MAX_SAFE_INTEGER);
222
+ },
223
+ collapseAllFromNode: function(oTable, oContext) {
224
+ oContext.collapse(true);
225
+ },
226
+ isNodeExpanded: function(oTable, oContext) {
227
+ return oContext.getProperty("@$ui5.node.isExpanded");
228
+ }
229
+ });
264
230
  };
265
231
 
266
232
  function expandRowsToLevel(oTable, iLevel) {
@@ -291,8 +257,8 @@ sap.ui.define([
291
257
  * If a property is complex, the properties it references are taken into account.<br>
292
258
  * If <code>autoExpandSelect</code> of the {@link sap.ui.model.odata.v4.ODataModel} is not enabled, this method must return an empty array.
293
259
  * If the table type is {@link sap.ui.mdc.table.GridTableType GridTable} and <code>p13nMode</code> <code>Group</code> or <code>p13nMode</code>
294
- * <code>Aggregate</code> is enabled, referenced properties, for example, properties that are referenced via <code>text</code> or
295
- * <code>unit</code>, are also included in the result. Please also see the restrictions in the description of the {@link module:sap/ui/mdc/odata/v4/TableDelegate TableDelegate}.<br>
260
+ * <code>Aggregate</code> is enabled, also see the restrictions in the description of the
261
+ * {@link module:sap/ui/mdc/odata/v4/TableDelegate TableDelegate}.<br>
296
262
  * For more information about properties, see {@link sap.ui.mdc.odata.v4.TablePropertyInfo PropertyInfo}.
297
263
  *
298
264
  * @param {sap.ui.mdc.Table} oTable Instance of the table
@@ -308,7 +274,6 @@ sap.ui.define([
308
274
  */
309
275
  Delegate.getSupportedFeatures = function(oTable) {
310
276
  const mSupportedFeatures = TableDelegate.getSupportedFeatures.apply(this, arguments);
311
- const bIsTreeTable = oTable._isOfType(TableType.TreeTable);
312
277
 
313
278
  if (oTable._isOfType(TableType.Table)) {
314
279
  const aP13nModes = mSupportedFeatures.p13nModes;
@@ -322,9 +287,7 @@ sap.ui.define([
322
287
  }
323
288
 
324
289
  return {
325
- ...mSupportedFeatures,
326
- expandAllRows: bIsTreeTable,
327
- collapseAllRows: bIsTreeTable
290
+ ...mSupportedFeatures
328
291
  };
329
292
  };
330
293
 
@@ -444,17 +407,26 @@ sap.ui.define([
444
407
  /**
445
408
  * @inheritDoc
446
409
  */
447
- Delegate.initializeContent = function(oTable) {
448
- return TableDelegate.initializeContent.apply(this, arguments).then(() => {
449
- if (!TableMap.has(oTable)) {
450
- TableMap.set(oTable, {});
451
- }
452
- return configureInnerTable(oTable);
453
- }).then(() => {
454
- setAggregation(oTable);
455
- });
410
+ Delegate.initializeContent = async function(oTable) {
411
+ await TableDelegate.initializeContent.apply(this, arguments);
412
+
413
+ if (oTable._isOfType(TableType.Table)) {
414
+ await configureGridTable(oTable);
415
+ }
456
416
  };
457
417
 
418
+ async function configureGridTable(oTable) {
419
+ const [V4AggregationPlugin] = await loadModules("sap/ui/table/plugins/V4Aggregation");
420
+
421
+ oTable._oTable.addDependent(new V4AggregationPlugin({
422
+ groupHeaderFormatter: function(oContext) {
423
+ const aGroupedPropertyKeys = oTable._getGroupedProperties().map((mGroupLevel) => mGroupLevel.name);
424
+ const sGroupLevelKey = aGroupedPropertyKeys[oContext.getProperty("@$ui5.node.level") - 1];
425
+ return oTable.getControlDelegate().formatGroupHeader(oTable, oContext, sGroupLevelKey);
426
+ }
427
+ }));
428
+ }
429
+
458
430
  /**
459
431
  * @inheritDoc
460
432
  */
@@ -538,39 +510,29 @@ sap.ui.define([
538
510
  };
539
511
 
540
512
  /**
541
- * Updates the aggregation info if the plugin is enabled.
513
+ * Sets the $$aggregation binding parameter to the binding info and updates the table, for example, to prepare it for displaying the grand total.
542
514
  *
543
515
  * @param {sap.ui.mdc.Table} oTable Instance of the table
544
516
  * @param {sap.ui.base.ManagedObject.AggregationBindingInfo} [oBindingInfo] The binding info object to be used to bind the table to the model
545
517
  */
546
- function setAggregation(oTable, oBindingInfo) {
547
- const oPlugin = TableMap.get(oTable).plugin;
518
+ function updateAggregation(oTable, oBindingInfo) {
519
+ const mAggregation = create$$Aggregation(oTable);
520
+ const sSearch = oBindingInfo.parameters.$search;
548
521
 
549
- if (!oPlugin || oPlugin.isDestroyed()) {
550
- return;
522
+ if (mAggregation && sSearch) {
523
+ delete oBindingInfo.parameters.$search;
524
+ mAggregation.search = sSearch;
551
525
  }
552
526
 
553
- const aInResultPropertyKeys = Array.from(new Set([
554
- ...getVisiblePropertyKeys(oTable),
555
- ...getInResultPropertyKeys(oTable)
556
- ]));
557
- const aGroupLevels = oTable._getGroupedProperties().map((mGroupLevel) => mGroupLevel.name);
558
- const aAggregates = Object.keys(oTable._getAggregatedProperties());
559
- const mColumnState = getColumnState(oTable, aAggregates);
560
- const sSearch = oBindingInfo?.parameters["$search"];
527
+ oBindingInfo.parameters.$$aggregation = mAggregation;
561
528
 
562
- if (sSearch) {
563
- delete oBindingInfo.parameters["$search"];
564
- }
565
-
566
- oPlugin.setAggregationInfo({
567
- visible: aInResultPropertyKeys,
568
- groupLevels: aGroupLevels,
569
- grandTotal: aAggregates,
570
- subtotals: aAggregates,
571
- columnState: mColumnState,
572
- search: sSearch
529
+ const bHasGrandTotal = Object.keys(mAggregation?.aggregate || {}).some((sKey) => {
530
+ return mAggregation.aggregate[sKey].grandTotal;
573
531
  });
532
+ oTable.getModel("$sap.ui.mdc.Table").setProperty("/@custom/hasGrandTotal", bHasGrandTotal);
533
+
534
+ const V4AggregationPlugin = PluginBase.getPlugin(oTable._oTable, "sap.ui.table.plugins.V4Aggregation");
535
+ V4AggregationPlugin?.declareColumnsHavingTotals(getColumnsWithTotals(oTable).map((oColumn) => oColumn.getInnerColumn()));
574
536
  }
575
537
 
576
538
  function getVisiblePropertyKeys(oTable) {
@@ -581,45 +543,26 @@ sap.ui.define([
581
543
  return getSimplePropertyKeys(oTable, oTable.getControlDelegate().getInResultPropertyKeys(oTable));
582
544
  }
583
545
 
584
- function getColumnState(oTable, aAggregatedPropertyNames) {
585
- const mColumnState = {};
586
-
587
- oTable.getColumns().forEach((oColumn) => {
588
- let sInnerColumnId = oColumn.getId() + "-innerColumn";
589
- const aAggregatedProperties = getAggregatedColumnProperties(oTable, oColumn, aAggregatedPropertyNames);
590
- const bColumnIsAggregated = aAggregatedProperties.length > 0;
546
+ function getColumnsWithTotals(oTable) {
547
+ const aTotaledPropertyKeys = Object.keys(oTable._getAggregatedProperties());
548
+ const oColumnsWithTotals = new Set();
591
549
 
592
- if (sInnerColumnId in mColumnState) {
593
- // If there already is a state for this column, it is a unit column that inherited the state from the amount column.
594
- // The values in the state may be overridden from false to true, but not the other way around.
595
- mColumnState[sInnerColumnId].subtotals = bColumnIsAggregated || mColumnState[sInnerColumnId].subtotals;
596
- mColumnState[sInnerColumnId].grandTotal = bColumnIsAggregated || mColumnState[sInnerColumnId].grandTotal;
597
- return;
598
- }
599
-
600
- mColumnState[sInnerColumnId] = {
601
- subtotals: bColumnIsAggregated,
602
- grandTotal: bColumnIsAggregated
603
- };
550
+ for (const oColumn of oTable.getColumns()) {
551
+ const aRelevantColumnProperties = getColumnProperties(oTable, oColumn).filter((oProperty) => {
552
+ return aTotaledPropertyKeys.includes(oProperty.name);
553
+ });
554
+ const bColumnHasTotals = aRelevantColumnProperties.length > 0;
604
555
 
605
- findUnitColumns(oTable, aAggregatedProperties).forEach((oUnitColumn) => {
606
- sInnerColumnId = oUnitColumn.getId() + "-innerColumn";
556
+ if (bColumnHasTotals) {
557
+ oColumnsWithTotals.add(oColumn);
607
558
 
608
- if (sInnerColumnId in mColumnState) {
609
- // If there already is a state for this column, it is a unit column that inherited the state from the amount column.
610
- // The values in the state may be overridden from false to true, but not the other way around.
611
- mColumnState[sInnerColumnId].subtotals = bColumnIsAggregated || mColumnState[sInnerColumnId].subtotals;
612
- mColumnState[sInnerColumnId].grandTotal = bColumnIsAggregated || mColumnState[sInnerColumnId].grandTotal;
613
- } else {
614
- mColumnState[sInnerColumnId] = {
615
- subtotals: bColumnIsAggregated,
616
- grandTotal: bColumnIsAggregated
617
- };
618
- }
619
- });
620
- });
559
+ findUnitColumns(oTable, aRelevantColumnProperties).forEach((oUnitColumn) => {
560
+ oColumnsWithTotals.add(oUnitColumn);
561
+ });
562
+ }
563
+ }
621
564
 
622
- return mColumnState;
565
+ return Array.from(oColumnsWithTotals);
623
566
  }
624
567
 
625
568
  // TODO: Move this to TablePropertyHelper for reuse?
@@ -651,24 +594,18 @@ sap.ui.define([
651
594
  }
652
595
  }
653
596
 
654
- function getAggregatedColumnProperties(oTable, oColumn, aAggregatedProperties) {
655
- return getColumnProperties(oTable, oColumn).filter((oProperty) => {
656
- return aAggregatedProperties.includes(oProperty.name);
657
- });
658
- }
659
-
660
597
  function findUnitColumns(oTable, aProperties) {
661
- const aUnitProperties = [];
598
+ const aUnitPropertyKeys = [];
662
599
 
663
600
  aProperties.forEach((oProperty) => {
664
- if (oProperty.unitProperty) {
665
- aUnitProperties.push(oProperty.unitProperty);
601
+ if (oProperty.unit) {
602
+ aUnitPropertyKeys.push(oProperty.unit);
666
603
  }
667
604
  });
668
605
 
669
606
  return oTable.getColumns().filter((oColumn) => {
670
607
  return getColumnProperties(oTable, oColumn).some((oProperty) => {
671
- return aUnitProperties.includes(oProperty);
608
+ return aUnitPropertyKeys.includes(oProperty.key);
672
609
  });
673
610
  });
674
611
  }
@@ -702,7 +639,7 @@ sap.ui.define([
702
639
  * @private
703
640
  */
704
641
  function mergeValidationResults(oBaseState, oValidationState) {
705
- const oSeverity = { Error: 1, Warning: 2, Information: 3, None: 4 };
642
+ const oSeverity = {Error: 1, Warning: 2, Information: 3, None: 4};
706
643
 
707
644
  if (!oValidationState || oSeverity[oValidationState.validation] - oSeverity[oBaseState.validation] > 0) {
708
645
  return oBaseState;
@@ -720,75 +657,180 @@ sap.ui.define([
720
657
  */
721
658
  function isAnalyticsEnabled(oTable) {
722
659
  return oTable._isOfType(TableType.Table) && (oTable.getGroupConditions() || oTable.isGroupingEnabled() ||
723
- oTable.getAggregateConditions() || oTable.isAggregationEnabled());
660
+ oTable.getAggregateConditions() || oTable.isAggregationEnabled());
724
661
  }
725
662
 
726
- /**
727
- * Configures the inner table to support the personalization settings of the table.
728
- *
729
- * @param {sap.ui.mdc.Table} oTable Instance of the table
730
- * @return {Promise} A <code>Promise</code> that resolves when the inner table is configured
731
- */
732
- function configureInnerTable(oTable) {
733
- if (oTable._isOfType(TableType.Table)) {
734
- return (isAnalyticsEnabled(oTable) ? enableGridTablePlugin(oTable) : disableGridTablePlugin(oTable)).then(() => {
735
- return setUpTableObserver(oTable);
736
- });
663
+ function create$$Aggregation(oTable) {
664
+ const aVisiblePropertyKeys = getVisiblePropertyKeys(oTable);
665
+
666
+ if (aVisiblePropertyKeys.length === 0) {
667
+ return undefined;
737
668
  }
738
- return Promise.resolve();
669
+
670
+ const oPropertyHelper = oTable.getPropertyHelper();
671
+ const aGroupedPropertyKeys = oTable._getGroupedProperties().map((mGroupLevel) => mGroupLevel.name);
672
+ const aTotaledPropertyKeys = Object.keys(oTable._getAggregatedProperties());
673
+ const mAggregation = {
674
+ group: {},
675
+ groupLevels: [],
676
+ aggregate: {},
677
+ grandTotalAtBottomOnly: true,
678
+ subtotalsAtBottomOnly: true
679
+ };
680
+
681
+ // Add key properties to prevent data aggregation on leafs.
682
+ addKeyPropertiesTo$$Aggregation(mAggregation, oTable);
683
+
684
+ addInResultPropertiesTo$$Aggregation(mAggregation, oTable);
685
+
686
+ // We need to consider group levels as visible properties, to add them in the query properly if they have additional properties.
687
+ aGroupedPropertyKeys.forEach((sPropertyKey) => {
688
+ if (aVisiblePropertyKeys.indexOf(sPropertyKey) < 0) {
689
+ aVisiblePropertyKeys.push(sPropertyKey);
690
+ }
691
+ });
692
+
693
+ for (const sPropertyKey of aVisiblePropertyKeys) {
694
+ const oProperty = oPropertyHelper.getProperty(sPropertyKey);
695
+
696
+ if (!oProperty.extension.technicallyGroupable && !oProperty.extension.technicallyAggregatable) {
697
+ continue;
698
+ }
699
+
700
+ // Skip text property if its ID is visible.
701
+ const oAdditionalProperty = oPropertyHelper.getProperty(oProperty.extension.additionalProperties?.[0]);
702
+ if (oAdditionalProperty?.text === oProperty.key && aVisiblePropertyKeys.includes(oAdditionalProperty.key)) {
703
+ continue;
704
+ }
705
+
706
+ if (oProperty.extension.technicallyGroupable) {
707
+ mAggregation.group[oProperty.path] = {};
708
+ }
709
+
710
+ if (oProperty.extension.technicallyAggregatable) {
711
+ mAggregation.aggregate[oProperty.path] = {};
712
+
713
+ if (aTotaledPropertyKeys.includes(oProperty.key)) {
714
+ mAggregation.aggregate[oProperty.path].grandTotal = true;
715
+ mAggregation.aggregate[oProperty.path].subtotals = true;
716
+ }
717
+
718
+ if (oProperty.unit) {
719
+ const oUnitPropertyInfo = oPropertyHelper.getProperty(oProperty.unit);
720
+ if (oUnitPropertyInfo) {
721
+ mAggregation.aggregate[oProperty.path].unit = oUnitPropertyInfo.path;
722
+ }
723
+ }
724
+
725
+ if (!oProperty.extension.additionalProperties?.length && oProperty.extension.customAggregate?.contextDefiningProperties) {
726
+ oProperty.extension.customAggregate.contextDefiningProperties.forEach((sContextDefiningPropertyKey) => {
727
+ const oDefiningPropertyInfo = oPropertyHelper.getProperty(sContextDefiningPropertyKey);
728
+ if (oDefiningPropertyInfo) {
729
+ mAggregation.group[oDefiningPropertyInfo.path] = {};
730
+ }
731
+ });
732
+ }
733
+ }
734
+
735
+ const aAdditionalPropertyPaths = getAdditionalPropertyPaths(oProperty, oPropertyHelper);
736
+
737
+ if (oProperty.extension.technicallyAggregatable) {
738
+ for (const sPropertyPath of aAdditionalPropertyPaths) {
739
+ mAggregation.group[sPropertyPath] = {};
740
+ }
741
+ } else if (oProperty.extension.technicallyGroupable && oProperty.path in mAggregation.group) {
742
+ mAggregation.group[oProperty.path].additionally = aAdditionalPropertyPaths;
743
+ }
744
+ }
745
+
746
+ // Visual grouping (expandable groups)
747
+ aGroupedPropertyKeys.forEach((sPropertyKey) => {
748
+ const oProperty = oPropertyHelper.getProperty(sPropertyKey);
749
+ if (oProperty) {
750
+ mAggregation.groupLevels.push(oProperty.path);
751
+ }
752
+ });
753
+
754
+ if (!Object.keys(mAggregation.group).length && !Object.keys(mAggregation.aggregate).length) {
755
+ return undefined;
756
+ }
757
+
758
+ sanitize$$Aggregation(mAggregation);
759
+
760
+ return mAggregation;
739
761
  }
740
762
 
741
- function enableGridTablePlugin(oTable) {
742
- const mTableMap = TableMap.get(oTable);
743
- let oPlugin = mTableMap.plugin;
763
+ function getAdditionalPropertyPaths(oProperty, oPropertyHelper) {
764
+ const oPropertyPaths = new Set();
744
765
 
745
- if (oPlugin && !oPlugin.isDestroyed()) {
746
- oPlugin.activate();
747
- return Promise.resolve();
766
+ if (oProperty.text) {
767
+ const oTextProperty = oPropertyHelper.getProperty(oProperty.text);
768
+ oPropertyPaths.add(oTextProperty.path);
748
769
  }
749
770
 
750
- // The property helper is initialized after the table "initialized" promise resolves. So we can only wait for the property helper.
751
- return Promise.all([
752
- oTable.awaitPropertyHelper(), loadModules("sap/ui/table/plugins/V4Aggregation")
753
- ]).then((aResult) => {
754
- const V4AggregationPlugin = aResult[1][0];
755
- const oDelegate = oTable.getControlDelegate();
771
+ for (const sPropertyKey of oProperty.extension.additionalProperties ?? []) {
772
+ const oAdditionalProperty = oPropertyHelper.getProperty(sPropertyKey);
773
+ oPropertyPaths.add(oAdditionalProperty.path);
774
+ }
756
775
 
757
- oPlugin = new V4AggregationPlugin({
758
- groupHeaderFormatter: function(oContext, sProperty) {
759
- return oDelegate.formatGroupHeader(oTable, oContext, sProperty);
760
- }
761
- });
762
- oPlugin.setPropertyInfos(oTable.getPropertyHelper().getPropertiesForPlugin());
763
- oTable.propertiesFinalized().then(() => {
764
- oPlugin.setPropertyInfos(oTable.getPropertyHelper().getPropertiesForPlugin());
765
- });
766
- oTable._oTable.addDependent(oPlugin);
767
- mTableMap.plugin = oPlugin;
776
+ return Array.from(oPropertyPaths);
777
+ }
778
+
779
+ function addKeyPropertiesTo$$Aggregation(mAggregation, oTable) {
780
+ oTable.getPropertyHelper().getProperties().forEach((oProperty) => {
781
+ if (oProperty.isKey) {
782
+ mAggregation.group[oProperty.path] = {};
783
+ }
768
784
  });
769
785
  }
770
786
 
771
- function disableGridTablePlugin(oTable) {
772
- const mTableMap = TableMap.get(oTable);
787
+ function addInResultPropertiesTo$$Aggregation(mAggregation, oTable) {
788
+ const oPropertyHelper = oTable.getPropertyHelper();
789
+
790
+ for (const sPropertyKey of getInResultPropertyKeys(oTable)) {
791
+ const oProperty = oPropertyHelper.getProperty(sPropertyKey);
773
792
 
774
- if (mTableMap.plugin) {
775
- mTableMap.plugin.deactivate();
793
+ if (oProperty.extension.technicallyGroupable) {
794
+ mAggregation.group[oProperty.path] = {};
795
+ } else if (oProperty.extension.technicallyAggregatable) {
796
+ mAggregation.aggregate[oProperty.path] = {};
797
+ }
776
798
  }
799
+ }
777
800
 
778
- return Promise.resolve();
801
+ function sanitize$$Aggregation(mAggregation) {
802
+ dedupe$$AggregationGroupAndAggregate(mAggregation); // A property must not be in both "group" and "aggregate".
803
+ dedupe$$AggregationAdditionally(mAggregation); // A property must not be in "group" if it is in "group.additionally".
779
804
  }
780
805
 
781
- function setUpTableObserver(oTable) {
782
- const mTableMap = TableMap.get(oTable);
806
+ function dedupe$$AggregationGroupAndAggregate(mAggregation) {
807
+ for (const sPath in mAggregation.group) {
808
+ if (sPath in mAggregation.aggregate) {
809
+ // To get the totals, the property needs to be in "aggregate".
810
+ if (mAggregation.aggregate[sPath].grandTotal || mAggregation.aggregate[sPath].subtotals) {
811
+ delete mAggregation.group[sPath];
812
+ } else {
813
+ delete mAggregation.aggregate[sPath];
814
+ }
815
+ }
816
+ }
817
+ }
783
818
 
784
- if (!mTableMap.observer) {
785
- mTableMap.observer = new ManagedObjectObserver((oChange) => {
786
- configureInnerTable(oTable);
787
- });
819
+ function dedupe$$AggregationAdditionally(mAggregation) {
820
+ const oAllAdditionalPropertyPaths = new Set();
788
821
 
789
- mTableMap.observer.observe(oTable, {
790
- properties: ["p13nMode", "groupConditions", "aggregateConditions"]
791
- });
822
+ for (const sPath in mAggregation.group) {
823
+ mAggregation.group[sPath].additionally?.forEach((sPath) => oAllAdditionalPropertyPaths.add(sPath));
824
+ }
825
+
826
+ // If the table is visually grouped by a property (the property is in groupLevels), its additional properties also need to be available in the
827
+ // group header context. For this, they need to be in "additionally" of the grouped property and therefore have to be removed from "group".
828
+ // If that leads to missing (additional) properties, the issue is unsupported nesting of additional properties. If X has additional property
829
+ // Y, and Y has additional property Z, then Z must be an additional property of X as well.
830
+ for (const sPath of oAllAdditionalPropertyPaths) {
831
+ if (sPath in mAggregation.group) {
832
+ delete mAggregation.group[sPath];
833
+ }
792
834
  }
793
835
  }
794
836
 
@@ -47,7 +47,7 @@ sap.ui.define([
47
47
  * </ul>
48
48
  *
49
49
  * @author SAP SE
50
- * @version 1.130.1
50
+ * @version 1.131.1
51
51
  * @public
52
52
  * @since 1.114.0
53
53
  * @namespace