@openui5/sap.ui.table 1.138.0 → 1.140.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/REUSE.toml +8 -1
- package/THIRDPARTY.txt +72 -66
- package/package.json +4 -4
- package/src/sap/ui/table/.library +1 -1
- package/src/sap/ui/table/AnalyticalColumn.js +1 -1
- package/src/sap/ui/table/AnalyticalColumnMenu.js +1 -1
- package/src/sap/ui/table/AnalyticalTable.js +5 -9
- package/src/sap/ui/table/Column.js +1 -1
- package/src/sap/ui/table/ColumnMenu.js +1 -1
- package/src/sap/ui/table/CreationRow.js +1 -1
- package/src/sap/ui/table/Row.js +1 -1
- package/src/sap/ui/table/RowAction.js +1 -1
- package/src/sap/ui/table/RowActionItem.js +1 -1
- package/src/sap/ui/table/RowSettings.js +1 -1
- package/src/sap/ui/table/Table.js +7 -16
- package/src/sap/ui/table/TablePersoController.js +1 -1
- package/src/sap/ui/table/TableRenderer.js +2 -8
- package/src/sap/ui/table/TreeTable.js +2 -2
- package/src/sap/ui/table/extensions/Accessibility.js +55 -58
- package/src/sap/ui/table/extensions/AccessibilityRender.js +2 -2
- package/src/sap/ui/table/extensions/DragAndDrop.js +2 -2
- package/src/sap/ui/table/extensions/ExtensionBase.js +3 -33
- package/src/sap/ui/table/extensions/Keyboard.js +3 -3
- package/src/sap/ui/table/extensions/KeyboardDelegate.js +13 -26
- package/src/sap/ui/table/extensions/Pointer.js +2 -3
- package/src/sap/ui/table/extensions/Scrolling.js +2 -2
- package/src/sap/ui/table/extensions/ScrollingIOS.js +1 -1
- package/src/sap/ui/table/extensions/Synchronization.js +2 -2
- package/src/sap/ui/table/i18n/interaction.xml +4 -4
- package/src/sap/ui/table/i18n/interaction_ar.xml +23 -20
- package/src/sap/ui/table/i18n/interaction_bg.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_ca.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_cnr.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_cs.xml +10 -7
- package/src/sap/ui/table/i18n/interaction_cy.xml +9 -6
- package/src/sap/ui/table/i18n/interaction_da.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_de.xml +9 -6
- package/src/sap/ui/table/i18n/interaction_el.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_en.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_en_GB.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_en_US_saprigi.xml +3 -3
- package/src/sap/ui/table/i18n/interaction_es.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_es_MX.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_et.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_fi.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_fr.xml +9 -6
- package/src/sap/ui/table/i18n/interaction_fr_CA.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_hi.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_hr.xml +14 -11
- package/src/sap/ui/table/i18n/interaction_hu.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_id.xml +9 -6
- package/src/sap/ui/table/i18n/interaction_it.xml +9 -6
- package/src/sap/ui/table/i18n/interaction_iw.xml +15 -12
- package/src/sap/ui/table/i18n/interaction_ja.xml +9 -6
- package/src/sap/ui/table/i18n/interaction_kk.xml +10 -7
- package/src/sap/ui/table/i18n/interaction_ko.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_lt.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_lv.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_mk.xml +10 -7
- package/src/sap/ui/table/i18n/interaction_ms.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_nl.xml +10 -7
- package/src/sap/ui/table/i18n/interaction_no.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_pl.xml +10 -7
- package/src/sap/ui/table/i18n/interaction_pt.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_pt_PT.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_ro.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_ru.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_sh.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_sk.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_sl.xml +9 -6
- package/src/sap/ui/table/i18n/interaction_sr.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_sv.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_th.xml +11 -8
- package/src/sap/ui/table/i18n/interaction_tr.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_uk.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_vi.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_zh_CN.xml +8 -5
- package/src/sap/ui/table/i18n/interaction_zh_TW.xml +12 -9
- package/src/sap/ui/table/library.js +27 -11
- package/src/sap/ui/table/menus/AnalyticalTableContextMenu.js +1 -1
- package/src/sap/ui/table/menus/ColumnHeaderMenuAdapter.js +1 -1
- package/src/sap/ui/table/menus/ContextMenu.js +1 -1
- package/src/sap/ui/table/menus/MobileColumnHeaderMenuAdapter.js +2 -2
- package/src/sap/ui/table/messagebundle.properties +7 -0
- package/src/sap/ui/table/messagebundle_ar.properties +5 -0
- package/src/sap/ui/table/messagebundle_bg.properties +5 -0
- package/src/sap/ui/table/messagebundle_ca.properties +5 -0
- package/src/sap/ui/table/messagebundle_cnr.properties +5 -0
- package/src/sap/ui/table/messagebundle_cs.properties +7 -2
- package/src/sap/ui/table/messagebundle_cy.properties +6 -1
- package/src/sap/ui/table/messagebundle_da.properties +5 -0
- package/src/sap/ui/table/messagebundle_de.properties +11 -6
- package/src/sap/ui/table/messagebundle_el.properties +5 -0
- package/src/sap/ui/table/messagebundle_en.properties +5 -0
- package/src/sap/ui/table/messagebundle_en_GB.properties +5 -0
- package/src/sap/ui/table/messagebundle_en_US_saprigi.properties +5 -0
- package/src/sap/ui/table/messagebundle_es.properties +6 -1
- package/src/sap/ui/table/messagebundle_es_MX.properties +5 -0
- package/src/sap/ui/table/messagebundle_et.properties +5 -0
- package/src/sap/ui/table/messagebundle_fi.properties +6 -1
- package/src/sap/ui/table/messagebundle_fr.properties +7 -2
- package/src/sap/ui/table/messagebundle_fr_CA.properties +7 -2
- package/src/sap/ui/table/messagebundle_hi.properties +5 -0
- package/src/sap/ui/table/messagebundle_hr.properties +5 -0
- package/src/sap/ui/table/messagebundle_hu.properties +5 -0
- package/src/sap/ui/table/messagebundle_id.properties +7 -2
- package/src/sap/ui/table/messagebundle_it.properties +5 -0
- package/src/sap/ui/table/messagebundle_iw.properties +5 -0
- package/src/sap/ui/table/messagebundle_ja.properties +6 -1
- package/src/sap/ui/table/messagebundle_kk.properties +5 -0
- package/src/sap/ui/table/messagebundle_ko.properties +5 -0
- package/src/sap/ui/table/messagebundle_lt.properties +5 -0
- package/src/sap/ui/table/messagebundle_lv.properties +8 -3
- package/src/sap/ui/table/messagebundle_mk.properties +7 -2
- package/src/sap/ui/table/messagebundle_ms.properties +7 -2
- package/src/sap/ui/table/messagebundle_nl.properties +6 -1
- package/src/sap/ui/table/messagebundle_no.properties +5 -0
- package/src/sap/ui/table/messagebundle_pl.properties +5 -0
- package/src/sap/ui/table/messagebundle_pt.properties +5 -0
- package/src/sap/ui/table/messagebundle_pt_PT.properties +6 -1
- package/src/sap/ui/table/messagebundle_ro.properties +7 -2
- package/src/sap/ui/table/messagebundle_ru.properties +10 -5
- package/src/sap/ui/table/messagebundle_sh.properties +5 -0
- package/src/sap/ui/table/messagebundle_sk.properties +5 -0
- package/src/sap/ui/table/messagebundle_sl.properties +5 -0
- package/src/sap/ui/table/messagebundle_sr.properties +5 -0
- package/src/sap/ui/table/messagebundle_sv.properties +5 -0
- package/src/sap/ui/table/messagebundle_th.properties +5 -0
- package/src/sap/ui/table/messagebundle_tr.properties +5 -0
- package/src/sap/ui/table/messagebundle_uk.properties +5 -0
- package/src/sap/ui/table/messagebundle_vi.properties +5 -0
- package/src/sap/ui/table/messagebundle_zh_CN.properties +5 -0
- package/src/sap/ui/table/messagebundle_zh_TW.properties +7 -2
- package/src/sap/ui/table/plugins/BindingSelection.js +1 -1
- package/src/sap/ui/table/plugins/MultiSelectionPlugin.js +24 -11
- package/src/sap/ui/table/plugins/{V4Aggregation.js → ODataV4Aggregation.js} +51 -70
- package/src/sap/ui/table/plugins/ODataV4Hierarchy.js +91 -0
- package/src/sap/ui/table/plugins/ODataV4MultiLevel.js +100 -0
- package/src/sap/ui/table/plugins/ODataV4MultiSelection.js +489 -0
- package/src/sap/ui/table/plugins/ODataV4Selection.js +51 -419
- package/src/sap/ui/table/plugins/ODataV4SingleSelection.js +120 -0
- package/src/sap/ui/table/plugins/PluginBase.js +1 -1
- package/src/sap/ui/table/plugins/SelectionModelSelection.js +1 -1
- package/src/sap/ui/table/plugins/SelectionPlugin.js +18 -16
- package/src/sap/ui/table/rowmodes/Auto.js +1 -1
- package/src/sap/ui/table/rowmodes/Fixed.js +1 -1
- package/src/sap/ui/table/rowmodes/Interactive.js +1 -1
- package/src/sap/ui/table/rowmodes/RowMode.js +1 -1
- package/src/sap/ui/table/rowmodes/Variable.js +1 -1
- package/src/sap/ui/table/utils/TableUtils.js +1 -1
- package/src/sap/ui/table/utils/_ColumnUtils.js +13 -11
- package/src/sap/ui/table/utils/_GroupingUtils.js +1 -1
- package/src/sap/ui/table/utils/_HookUtils.js +1 -1
- package/src/sap/ui/table/utils/_MenuUtils.js +1 -1
- package/src/sap/ui/table/plugins/SelectionMode.js +0 -35
|
@@ -49,10 +49,14 @@ sap.ui.define([
|
|
|
49
49
|
* This plugin is intended for server-side models and multi-selection mode. Range selections, including Select All, only work properly if the
|
|
50
50
|
* count is known. Make sure the model/binding is configured to request the count from the service.
|
|
51
51
|
* For ease of use, client-side models and single selection are also supported.
|
|
52
|
+
*
|
|
53
|
+
* With ODataV4, use the {@link sap.ui.table.plugins.ODataV4MultiSelection ODataV4MultiSelection} plugin or the
|
|
54
|
+
* {@link sap.ui.table.plugins.ODataV4SingleSelection ODataV4SingleSelection} plugin instead of this one.
|
|
55
|
+
*
|
|
52
56
|
* @extends sap.ui.table.plugins.SelectionPlugin
|
|
53
57
|
*
|
|
54
58
|
* @author SAP SE
|
|
55
|
-
* @version 1.
|
|
59
|
+
* @version 1.140.0
|
|
56
60
|
*
|
|
57
61
|
* @public
|
|
58
62
|
* @since 1.64
|
|
@@ -140,6 +144,7 @@ sap.ui.define([
|
|
|
140
144
|
MultiSelectionPlugin.prototype.onActivate = function(oTable) {
|
|
141
145
|
SelectionPlugin.prototype.onActivate.apply(this, arguments);
|
|
142
146
|
this.oInnerSelectionPlugin = createInnerSelectionPlugin(oTable);
|
|
147
|
+
this.oInnerSelectionPlugin.setSelectionMode(this.getSelectionMode());
|
|
143
148
|
this.oInnerSelectionPlugin.attachSelectionChange(this._onSelectionChange, this);
|
|
144
149
|
attachToBinding(this, oTable.getBinding());
|
|
145
150
|
oTable.addAggregation("_hiddenDependents", this.oInnerSelectionPlugin);
|
|
@@ -161,7 +166,7 @@ sap.ui.define([
|
|
|
161
166
|
*/
|
|
162
167
|
MultiSelectionPlugin.prototype.onDeactivate = function(oTable) {
|
|
163
168
|
SelectionPlugin.prototype.onDeactivate.apply(this, arguments);
|
|
164
|
-
oTable.setProperty("selectionMode", SelectionMode.None);
|
|
169
|
+
oTable.setProperty("selectionMode", library.SelectionMode.None);
|
|
165
170
|
detachFromBinding(this, oTable.getBinding());
|
|
166
171
|
this.oInnerSelectionPlugin?.destroy();
|
|
167
172
|
delete this.oInnerSelectionPlugin;
|
|
@@ -261,18 +266,14 @@ sap.ui.define([
|
|
|
261
266
|
}
|
|
262
267
|
|
|
263
268
|
MultiSelectionPlugin.prototype.setSelectionMode = function(sSelectionMode) {
|
|
264
|
-
|
|
269
|
+
this.setProperty("selectionMode", sSelectionMode, true);
|
|
265
270
|
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if (this.oInnerSelectionPlugin) {
|
|
271
|
-
this.oInnerSelectionPlugin.setSelectionMode(sSelectionMode);
|
|
271
|
+
if (!this.isActive()) {
|
|
272
|
+
return this;
|
|
272
273
|
}
|
|
273
274
|
|
|
274
|
-
this.setProperty("selectionMode", sSelectionMode);
|
|
275
|
-
|
|
275
|
+
this.getControl().setProperty("selectionMode", sSelectionMode);
|
|
276
|
+
this.oInnerSelectionPlugin.setSelectionMode(sSelectionMode);
|
|
276
277
|
updateHeaderSelectorIcon(this);
|
|
277
278
|
|
|
278
279
|
return this;
|
|
@@ -325,6 +326,10 @@ sap.ui.define([
|
|
|
325
326
|
* @public
|
|
326
327
|
*/
|
|
327
328
|
MultiSelectionPlugin.prototype.selectAll = function(oEventPayload) {
|
|
329
|
+
if (!this.isActive()) {
|
|
330
|
+
return Promise.reject(new Error("Plugin is disabled"));
|
|
331
|
+
}
|
|
332
|
+
|
|
328
333
|
if (!this._bLimitDisabled) {
|
|
329
334
|
return Promise.reject(new Error("Not possible if the limit is enabled"));
|
|
330
335
|
}
|
|
@@ -418,6 +423,10 @@ sap.ui.define([
|
|
|
418
423
|
const oTable = this.getControl();
|
|
419
424
|
const sSelectionMode = this.getSelectionMode();
|
|
420
425
|
|
|
426
|
+
if (!this.isActive()) {
|
|
427
|
+
return Promise.reject(new Error("Plugin is disabled"));
|
|
428
|
+
}
|
|
429
|
+
|
|
421
430
|
if (sSelectionMode === SelectionMode.None) {
|
|
422
431
|
return Promise.reject(new Error("SelectionMode is '" + SelectionMode.None + "'"));
|
|
423
432
|
}
|
|
@@ -477,6 +486,10 @@ sap.ui.define([
|
|
|
477
486
|
const oTable = this.getControl();
|
|
478
487
|
const sSelectionMode = this.getSelectionMode();
|
|
479
488
|
|
|
489
|
+
if (!this.isActive()) {
|
|
490
|
+
return Promise.reject(new Error("Plugin is disabled"));
|
|
491
|
+
}
|
|
492
|
+
|
|
480
493
|
if (sSelectionMode === SelectionMode.None) {
|
|
481
494
|
return Promise.reject(new Error("SelectionMode is '" + SelectionMode.None + "'"));
|
|
482
495
|
}
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
sap.ui.define([
|
|
7
|
+
"./ODataV4MultiLevel",
|
|
7
8
|
"./PluginBase",
|
|
8
9
|
"../utils/TableUtils"
|
|
9
10
|
], function(
|
|
11
|
+
ODataV4MultiLevel,
|
|
10
12
|
PluginBase,
|
|
11
13
|
TableUtils
|
|
12
14
|
) {
|
|
@@ -14,22 +16,24 @@ sap.ui.define([
|
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* @class
|
|
17
|
-
* Integrates the
|
|
18
|
-
*
|
|
19
|
+
* Integrates the information about the data structure of the {@link sap.ui.model.odata.v4.ODataListBinding} and the table. The table is enabled
|
|
20
|
+
* to visualize grouped data with summary rows. Works only in combination with a {@link sap.ui.model.odata.v4.ODataModel}.
|
|
21
|
+
*
|
|
22
|
+
* For details about data aggregation, see {@link sap.ui.model.odata.v4.ODataListBinding#setAggregation}.
|
|
19
23
|
*
|
|
20
|
-
* This plugin only works in combination with a <code>sap.ui.model.odata.v4.ODataModel</code>. Do not add it to a table that is bound to another
|
|
21
|
-
* model.
|
|
22
24
|
* @extends sap.ui.core.Element
|
|
23
25
|
*
|
|
24
26
|
* @author SAP SE
|
|
25
|
-
* @version 1.
|
|
27
|
+
* @version 1.140.0
|
|
26
28
|
*
|
|
27
|
-
* @
|
|
28
|
-
* @
|
|
29
|
+
* @public
|
|
30
|
+
* @since 1.140
|
|
31
|
+
* @alias sap.ui.table.plugins.ODataV4Aggregation
|
|
32
|
+
* @see {@link topic:7d914317c0b64c23824bf932cc8a4ae1 OData V4: Data Aggregation and Recursive Hierarchy}
|
|
29
33
|
*
|
|
30
34
|
* @borrows sap.ui.table.plugins.PluginBase.findOn as findOn
|
|
31
35
|
*/
|
|
32
|
-
const
|
|
36
|
+
const ODataV4Aggregation = ODataV4MultiLevel.extend("sap.ui.table.plugins.ODataV4Aggregation", {
|
|
33
37
|
metadata: {
|
|
34
38
|
library: "sap.ui.table",
|
|
35
39
|
properties: {
|
|
@@ -39,57 +43,63 @@ sap.ui.define([
|
|
|
39
43
|
enabled: {type: "boolean", defaultValue: true}, // TODO: Inherited from private PluginBase. Remove once PluginBase is public.
|
|
40
44
|
|
|
41
45
|
/**
|
|
42
|
-
*
|
|
46
|
+
* Provides a custom group header title.
|
|
47
|
+
*
|
|
48
|
+
* This function is called for each group header row in the table. It receives the binding context of the row and the group level
|
|
49
|
+
* property path according to <code>groupLevels</code> in {@link sap.ui.model.odata.v4.ODataListBinding#setAggregation}).
|
|
50
|
+
* The function must return a string that is used as the title of the group header row.
|
|
51
|
+
*
|
|
52
|
+
* Function signature: <code>groupHeaderFormatter(oContext: sap.ui.model.odata.v4.Context, sPropertyPath: string): string</code>
|
|
43
53
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
54
|
+
* @example
|
|
55
|
+
* groupHeaderFormatter: function(oContext, sPropertyPath) {
|
|
56
|
+
* // Get the value of the group header property
|
|
57
|
+
* const sGroupHeaderValue = oContext.getProperty(sPropertyPath);
|
|
58
|
+
* // Format the value as a string
|
|
59
|
+
* return `Group: ${sGroupHeaderValue}`;
|
|
60
|
+
* }
|
|
46
61
|
*/
|
|
47
62
|
groupHeaderFormatter: {type: "function"}
|
|
48
63
|
}
|
|
49
64
|
}
|
|
50
65
|
});
|
|
51
66
|
|
|
52
|
-
|
|
67
|
+
ODataV4Aggregation.findOn = PluginBase.findOn;
|
|
53
68
|
|
|
54
69
|
/**
|
|
55
70
|
* @override
|
|
56
71
|
* @inheritDoc
|
|
57
72
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @override
|
|
64
|
-
* @inheritDoc
|
|
65
|
-
*/
|
|
66
|
-
V4Aggregation.prototype.onActivate = function(oTable) {
|
|
67
|
-
validateBinding(oTable.getBinding());
|
|
68
|
-
updateTableHierarchyMode(oTable);
|
|
69
|
-
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Table.RowsBound, validateBinding);
|
|
70
|
-
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Table.RefreshRows, onTableRefreshRows, this);
|
|
73
|
+
ODataV4Aggregation.prototype.onActivate = function(oTable) {
|
|
74
|
+
ODataV4MultiLevel.prototype.onActivate.apply(this, arguments);
|
|
75
|
+
validateBinding.call(this);
|
|
76
|
+
TableUtils.Grouping.setHierarchyMode(oTable, TableUtils.Grouping.HierarchyMode.Group);
|
|
71
77
|
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Row.UpdateState, updateRowState, this);
|
|
72
|
-
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.
|
|
73
|
-
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Row.Collapse, collapseRow, this);
|
|
78
|
+
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Table.RefreshRows, validateBinding, this);
|
|
74
79
|
};
|
|
75
80
|
|
|
76
81
|
/**
|
|
77
82
|
* @override
|
|
78
83
|
* @inheritDoc
|
|
79
84
|
*/
|
|
80
|
-
|
|
85
|
+
ODataV4Aggregation.prototype.onDeactivate = function(oTable) {
|
|
86
|
+
ODataV4MultiLevel.prototype.onDeactivate.apply(this, arguments);
|
|
81
87
|
for (const oColumn of oTable.getColumns()) {
|
|
82
88
|
oColumn._setCellContentVisibilitySettings();
|
|
83
89
|
}
|
|
84
|
-
TableUtils.Grouping.setHierarchyMode(oTable, TableUtils.Grouping.HierarchyMode.Flat);
|
|
85
|
-
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.Table.RowsBound, validateBinding);
|
|
86
|
-
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.Table.RefreshRows, onTableRefreshRows, this);
|
|
87
90
|
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.Row.UpdateState, updateRowState, this);
|
|
88
|
-
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.
|
|
89
|
-
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.Row.Collapse, collapseRow, this);
|
|
91
|
+
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.Table.RefreshRows, validateBinding, this);
|
|
90
92
|
};
|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Declares the columns that have totals. Columns with totals show the data in the group header row and the summary row. Columns without totals
|
|
96
|
+
* do not show the data in the group header row and the summary row.
|
|
97
|
+
*
|
|
98
|
+
* @param {Array} aColumnsWithTotals The columns that display totals
|
|
99
|
+
* @private
|
|
100
|
+
* @ui5-restricted sap.ui.mdc.odata.v4.TableDelegate
|
|
101
|
+
*/
|
|
102
|
+
ODataV4Aggregation.prototype.declareColumnsHavingTotals = function(aColumnsWithTotals) {
|
|
93
103
|
const aColumns = this.getControl()?.getColumns() ?? [];
|
|
94
104
|
|
|
95
105
|
for (const oColumn of aColumns) {
|
|
@@ -102,25 +112,12 @@ sap.ui.define([
|
|
|
102
112
|
}
|
|
103
113
|
};
|
|
104
114
|
|
|
105
|
-
function validateBinding(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (!oBinding.getModel().isA("sap.ui.model.odata.v4.ODataModel")) {
|
|
111
|
-
throw new Error("Model must be sap.ui.model.odata.v4.ODataModel");
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function onTableRefreshRows() {
|
|
116
|
-
updateTableHierarchyMode(this.getControl());
|
|
117
|
-
}
|
|
115
|
+
function validateBinding() {
|
|
116
|
+
const oBinding = this.getControl()?.getBinding();
|
|
117
|
+
const mAggregation = oBinding?.getAggregation();
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
TableUtils.Grouping.setHierarchyMode(oTable, TableUtils.Grouping.HierarchyMode.Tree);
|
|
122
|
-
} else {
|
|
123
|
-
TableUtils.Grouping.setHierarchyMode(oTable, TableUtils.Grouping.HierarchyMode.Group);
|
|
119
|
+
if (oBinding && (!mAggregation || "hierarchyQualifier" in mAggregation)) {
|
|
120
|
+
throw new Error("Only data aggregation is supported");
|
|
124
121
|
}
|
|
125
122
|
}
|
|
126
123
|
|
|
@@ -141,7 +138,7 @@ sap.ui.define([
|
|
|
141
138
|
oState.level = iLevel + 1; // In the binding context, summary rows are one level higher than needed in the table.
|
|
142
139
|
oState.expandable = false; // In the binding context, the total summary (grand total) is expanded.
|
|
143
140
|
} else if (bIsGroupHeader) {
|
|
144
|
-
oState.type = oState.Type.GroupHeader;
|
|
141
|
+
oState.type = oState.Type.GroupHeader;
|
|
145
142
|
setGroupHeaderTitle(oState, this.getGroupHeaderFormatter());
|
|
146
143
|
}
|
|
147
144
|
}
|
|
@@ -168,21 +165,5 @@ sap.ui.define([
|
|
|
168
165
|
}
|
|
169
166
|
}
|
|
170
167
|
|
|
171
|
-
|
|
172
|
-
const oBindingContext = TableUtils.getBindingContextOfRow(oRow);
|
|
173
|
-
|
|
174
|
-
if (oBindingContext) {
|
|
175
|
-
oBindingContext.expand();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function collapseRow(oRow) {
|
|
180
|
-
const oBindingContext = TableUtils.getBindingContextOfRow(oRow);
|
|
181
|
-
|
|
182
|
-
if (oBindingContext) {
|
|
183
|
-
oBindingContext.collapse();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return V4Aggregation;
|
|
168
|
+
return ODataV4Aggregation;
|
|
188
169
|
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2025 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
sap.ui.define([
|
|
7
|
+
"./ODataV4MultiLevel",
|
|
8
|
+
"./PluginBase",
|
|
9
|
+
"../utils/TableUtils"
|
|
10
|
+
], function(
|
|
11
|
+
ODataV4MultiLevel,
|
|
12
|
+
PluginBase,
|
|
13
|
+
TableUtils
|
|
14
|
+
) {
|
|
15
|
+
"use strict";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @class
|
|
19
|
+
* Integrates the information about the data structure of the {@link sap.ui.model.odata.v4.ODataListBinding} and the table. The table is enabled
|
|
20
|
+
* to visualize hierarchical data. Works only in combination with a {@link sap.ui.model.odata.v4.ODataModel}.
|
|
21
|
+
*
|
|
22
|
+
* For details about hierarchies, see {@link sap.ui.model.odata.v4.ODataListBinding#setAggregation}.
|
|
23
|
+
*
|
|
24
|
+
* @extends sap.ui.core.Element
|
|
25
|
+
*
|
|
26
|
+
* @author SAP SE
|
|
27
|
+
* @version 1.140.0
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
* @since 1.140
|
|
31
|
+
* @alias sap.ui.table.plugins.ODataV4Hierarchy
|
|
32
|
+
* @see {@link topic:7d914317c0b64c23824bf932cc8a4ae1 OData V4: Data Aggregation and Recursive Hierarchy}
|
|
33
|
+
*
|
|
34
|
+
* @borrows sap.ui.table.plugins.PluginBase.findOn as findOn
|
|
35
|
+
*/
|
|
36
|
+
const ODataV4Hierarchy = ODataV4MultiLevel.extend("sap.ui.table.plugins.ODataV4Hierarchy", {
|
|
37
|
+
metadata: {
|
|
38
|
+
library: "sap.ui.table",
|
|
39
|
+
properties: {
|
|
40
|
+
/**
|
|
41
|
+
* Indicates whether this plugin is enabled.
|
|
42
|
+
*/
|
|
43
|
+
enabled: {type: "boolean", defaultValue: true} // TODO: Inherited from private PluginBase. Remove once PluginBase is public.
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
ODataV4Hierarchy.findOn = PluginBase.findOn;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @override
|
|
52
|
+
* @inheritDoc
|
|
53
|
+
*/
|
|
54
|
+
ODataV4Hierarchy.prototype.onActivate = function(oTable) {
|
|
55
|
+
ODataV4MultiLevel.prototype.onActivate.apply(this, arguments);
|
|
56
|
+
validateBinding.call(this);
|
|
57
|
+
TableUtils.Grouping.setHierarchyMode(oTable, TableUtils.Grouping.HierarchyMode.Tree);
|
|
58
|
+
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Row.UpdateState, updateRowState, this);
|
|
59
|
+
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Table.RefreshRows, validateBinding, this);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @override
|
|
64
|
+
* @inheritDoc
|
|
65
|
+
*/
|
|
66
|
+
ODataV4Hierarchy.prototype.onDeactivate = function(oTable) {
|
|
67
|
+
ODataV4MultiLevel.prototype.onDeactivate.apply(this, arguments);
|
|
68
|
+
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.Row.UpdateState, updateRowState, this);
|
|
69
|
+
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.Table.RefreshRows, validateBinding, this);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
function validateBinding() {
|
|
73
|
+
const oBinding = this.getControl()?.getBinding();
|
|
74
|
+
const mAggregation = oBinding?.getAggregation();
|
|
75
|
+
|
|
76
|
+
if (oBinding && (!mAggregation || !("hierarchyQualifier" in mAggregation))) {
|
|
77
|
+
throw new Error("Only data aggregation is supported");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function updateRowState(oState) {
|
|
82
|
+
const vIsExpanded = oState.context.getProperty("@$ui5.node.isExpanded");
|
|
83
|
+
const bIsNode = vIsExpanded !== undefined;
|
|
84
|
+
|
|
85
|
+
oState.level = oState.context.getProperty("@$ui5.node.level") ?? 1;
|
|
86
|
+
oState.expandable = bIsNode;
|
|
87
|
+
oState.expanded = vIsExpanded;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return ODataV4Hierarchy;
|
|
91
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2025 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
sap.ui.define([
|
|
7
|
+
"./PluginBase",
|
|
8
|
+
"../utils/TableUtils"
|
|
9
|
+
], function(
|
|
10
|
+
PluginBase,
|
|
11
|
+
TableUtils
|
|
12
|
+
) {
|
|
13
|
+
"use strict";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @abstract
|
|
17
|
+
* @class
|
|
18
|
+
* Base class for OData V4 plugins that integrate the table with the bindings aggregation and hierarchy features. Works only in combination with
|
|
19
|
+
* a {@link sap.ui.model.odata.v4.ODataModel}.
|
|
20
|
+
*
|
|
21
|
+
* @extends sap.ui.table.plugins.PluginBase
|
|
22
|
+
*
|
|
23
|
+
* @author SAP SE
|
|
24
|
+
* @version 1.140.0
|
|
25
|
+
*
|
|
26
|
+
* @private
|
|
27
|
+
* @alias sap.ui.table.plugins.ODataV4MultiLevel
|
|
28
|
+
* @see {@link topic:7d914317c0b64c23824bf932cc8a4ae1 OData V4: Data Aggregation and Recursive Hierarchy}
|
|
29
|
+
*
|
|
30
|
+
* @borrows sap.ui.table.plugins.PluginBase.findOn as findOn
|
|
31
|
+
*/
|
|
32
|
+
const ODataV4MultiLevel = PluginBase.extend("sap.ui.table.plugins.ODataV4MultiLevel", {
|
|
33
|
+
metadata: {
|
|
34
|
+
"abstract": true,
|
|
35
|
+
library: "sap.ui.table"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
ODataV4MultiLevel.findOn = PluginBase.findOn;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @override
|
|
43
|
+
* @inheritDoc
|
|
44
|
+
*/
|
|
45
|
+
ODataV4MultiLevel.prototype.isApplicable = function(oControl) {
|
|
46
|
+
return PluginBase.prototype.isApplicable.apply(this, arguments) && oControl.getMetadata().getName() === "sap.ui.table.Table";
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @override
|
|
51
|
+
* @inheritDoc
|
|
52
|
+
*/
|
|
53
|
+
ODataV4MultiLevel.prototype.onActivate = function(oTable) {
|
|
54
|
+
PluginBase.prototype.onActivate.apply(this, arguments);
|
|
55
|
+
validateBinding(oTable.getBinding());
|
|
56
|
+
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Table.RowsBound, validateBinding);
|
|
57
|
+
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Row.Expand, expandRow, this);
|
|
58
|
+
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Row.Collapse, collapseRow, this);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @override
|
|
63
|
+
* @inheritDoc
|
|
64
|
+
*/
|
|
65
|
+
ODataV4MultiLevel.prototype.onDeactivate = function(oTable) {
|
|
66
|
+
PluginBase.prototype.onDeactivate.apply(this, arguments);
|
|
67
|
+
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.Table.RowsBound, validateBinding);
|
|
68
|
+
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.Row.Expand, expandRow, this);
|
|
69
|
+
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.Row.Collapse, collapseRow, this);
|
|
70
|
+
TableUtils.Grouping.setHierarchyMode(oTable, TableUtils.Grouping.HierarchyMode.Flat);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
function validateBinding(oBinding) {
|
|
74
|
+
if (!oBinding) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!oBinding.getModel().isA("sap.ui.model.odata.v4.ODataModel")) {
|
|
79
|
+
throw new Error("Model must be sap.ui.model.odata.v4.ODataModel");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function expandRow(oRow) {
|
|
84
|
+
const oBindingContext = TableUtils.getBindingContextOfRow(oRow);
|
|
85
|
+
|
|
86
|
+
if (oBindingContext) {
|
|
87
|
+
oBindingContext.expand();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function collapseRow(oRow) {
|
|
92
|
+
const oBindingContext = TableUtils.getBindingContextOfRow(oRow);
|
|
93
|
+
|
|
94
|
+
if (oBindingContext) {
|
|
95
|
+
oBindingContext.collapse();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return ODataV4MultiLevel;
|
|
100
|
+
});
|