@openui5/sap.ui.table 1.139.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/THIRDPARTY.txt +1 -1
- package/package.json +3 -3
- 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 +1 -1
- 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 +3 -13
- package/src/sap/ui/table/TablePersoController.js +1 -1
- package/src/sap/ui/table/TreeTable.js +1 -1
- package/src/sap/ui/table/extensions/Accessibility.js +17 -9
- package/src/sap/ui/table/extensions/AccessibilityRender.js +1 -1
- package/src/sap/ui/table/extensions/DragAndDrop.js +1 -1
- package/src/sap/ui/table/extensions/ExtensionBase.js +1 -1
- package/src/sap/ui/table/extensions/Keyboard.js +1 -1
- package/src/sap/ui/table/extensions/KeyboardDelegate.js +1 -1
- package/src/sap/ui/table/extensions/Pointer.js +1 -1
- package/src/sap/ui/table/extensions/Scrolling.js +1 -1
- package/src/sap/ui/table/extensions/ScrollingIOS.js +1 -1
- package/src/sap/ui/table/extensions/Synchronization.js +1 -1
- package/src/sap/ui/table/i18n/interaction_ar.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_bg.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_ca.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_cnr.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_cs.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_cy.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_da.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_de.xml +2 -2
- package/src/sap/ui/table/i18n/interaction_el.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_en.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_en_GB.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_en_US_saprigi.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_es.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_es_MX.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_et.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_fi.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_fr.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_fr_CA.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_hi.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_hr.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_hu.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_id.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_it.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_iw.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_ja.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_kk.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_ko.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_lt.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_lv.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_mk.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_ms.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_nl.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_no.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_pl.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_pt.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_pt_PT.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_ro.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_ru.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_sh.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_sk.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_sl.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_sr.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_sv.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_th.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_tr.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_uk.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_vi.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_zh_CN.xml +1 -1
- package/src/sap/ui/table/i18n/interaction_zh_TW.xml +1 -1
- 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 +5 -0
- 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 +5 -0
- 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 +7 -2
- 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 +9 -4
- 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 +6 -2
- 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 -412
- 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 +1 -1
- 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
|
@@ -5,28 +5,21 @@
|
|
|
5
5
|
*/
|
|
6
6
|
sap.ui.define([
|
|
7
7
|
"./SelectionPlugin",
|
|
8
|
-
"./SelectionMode",
|
|
9
8
|
"./PluginBase",
|
|
10
|
-
"../
|
|
11
|
-
"../utils/TableUtils",
|
|
12
|
-
"sap/ui/core/Icon",
|
|
13
|
-
"sap/ui/core/IconPool"
|
|
9
|
+
"../utils/TableUtils"
|
|
14
10
|
], function(
|
|
15
11
|
SelectionPlugin,
|
|
16
|
-
SelectionMode,
|
|
17
12
|
PluginBase,
|
|
18
|
-
|
|
19
|
-
TableUtils,
|
|
20
|
-
Icon,
|
|
21
|
-
IconPool
|
|
13
|
+
TableUtils
|
|
22
14
|
) {
|
|
23
15
|
"use strict";
|
|
24
16
|
|
|
25
17
|
const _private = TableUtils.createWeakMapFacade();
|
|
26
18
|
|
|
27
19
|
/**
|
|
20
|
+
* @abstract
|
|
28
21
|
* @class
|
|
29
|
-
*
|
|
22
|
+
* Base class for OData V4 selection plugins. Works only in combination with a {@link sap.ui.model.odata.v4.ODataModel}.
|
|
30
23
|
*
|
|
31
24
|
* The selection of a context that is not selectable is not allowed.
|
|
32
25
|
* The following contexts are not selectable:
|
|
@@ -35,148 +28,56 @@ sap.ui.define([
|
|
|
35
28
|
* <li>Contexts that represent group headers</li>
|
|
36
29
|
* <li>Contexts that contain totals</li>
|
|
37
30
|
* </ul>
|
|
38
|
-
* The selection of multiple contexts in <code>Single</code> selection mode is not allowed.
|
|
39
31
|
*
|
|
40
|
-
*
|
|
41
|
-
* model.
|
|
32
|
+
* All binding-related limitations also apply in the context of this plugin. For details, see {@link sap.ui.model.odata.v4.Context#setSelected}
|
|
33
|
+
* and {@link sap.ui.model.odata.v4.ODataModel#bindList}.
|
|
34
|
+
*
|
|
42
35
|
* @extends sap.ui.table.plugins.SelectionPlugin
|
|
43
36
|
*
|
|
44
37
|
* @author SAP SE
|
|
45
|
-
* @version 1.
|
|
38
|
+
* @version 1.140.0
|
|
46
39
|
*
|
|
47
40
|
* @private
|
|
48
41
|
* @alias sap.ui.table.plugins.ODataV4Selection
|
|
42
|
+
* @see {@link topic:ec55312f796f45e8883810af3b68b46c OData V4: Selection}
|
|
49
43
|
*
|
|
50
44
|
* @borrows sap.ui.table.plugins.PluginBase.findOn as findOn
|
|
51
45
|
*/
|
|
52
46
|
const ODataV4Selection = SelectionPlugin.extend("sap.ui.table.plugins.ODataV4Selection", {
|
|
53
47
|
metadata: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* This property controls whether a single or multiple rows can be selected. It also influences the visual appearance.
|
|
58
|
-
*/
|
|
59
|
-
selectionMode: {type: "sap.ui.table.plugins.SelectionMode", group: "Behavior", defaultValue: SelectionMode.MultiToggle},
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Number of rows which can be selected by the user with one range selection.
|
|
63
|
-
* If the user tries to select more rows than is allowed by the limit, the selection is limited and a notification may be shown
|
|
64
|
-
* (see {@link #getEnableNotification enableNotification}).
|
|
65
|
-
*
|
|
66
|
-
* Accepts positive integer values.
|
|
67
|
-
*
|
|
68
|
-
* If set to 0, the limit is disabled, and the Select All checkbox appears instead of the Deselect All button. The count needs to
|
|
69
|
-
* be available if the limit is disabled. Please refer to {@link sap.ui.model.odata.v4.ODataModel} for information on requesting
|
|
70
|
-
* the count.
|
|
71
|
-
*
|
|
72
|
-
* <b>Note:</b> To avoid severe performance problems, the limit should only be set to 0 in the following cases:
|
|
73
|
-
* <ul>
|
|
74
|
-
* <li>If the model is used in client mode</li>
|
|
75
|
-
* <li>If the entity set is small</li>
|
|
76
|
-
* </ul>
|
|
77
|
-
*
|
|
78
|
-
* In other cases, we recommend to set the limit to at least double the value of the {@link sap.ui.table.Table#getThreshold threshold}
|
|
79
|
-
* property of the related <code>sap.ui.table.Table</code> control.
|
|
80
|
-
*/
|
|
81
|
-
limit: {type: "int", group: "Behavior", defaultValue: 200},
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Enables notifications that are displayed once a selection has been limited.
|
|
85
|
-
*/
|
|
86
|
-
enableNotification: {type: "boolean", group: "Behavior", defaultValue: false},
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Hide the header selector.
|
|
90
|
-
*/
|
|
91
|
-
hideHeaderSelector: {type: "boolean", group: "Appearance", defaultValue: false}
|
|
92
|
-
},
|
|
93
|
-
aggregations: {
|
|
94
|
-
icon: {type: "sap.ui.core.Icon", multiple: false, visibility: "hidden"}
|
|
95
|
-
}
|
|
48
|
+
"abstract": true,
|
|
49
|
+
library: "sap.ui.table"
|
|
96
50
|
}
|
|
97
51
|
});
|
|
98
52
|
|
|
99
53
|
ODataV4Selection.findOn = PluginBase.findOn;
|
|
100
54
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const oIcon = new Icon({src: IconPool.getIconURI(TableUtils.ThemeParameters.checkboxIcon), useIconTooltip: false});
|
|
105
|
-
oIcon.addStyleClass("sapUiTableSelectClear");
|
|
106
|
-
this.setAggregation("icon", oIcon, true);
|
|
107
|
-
|
|
108
|
-
_private(this).bLimitReached = false;
|
|
109
|
-
_private(this).oRangeSelectionStartContext = null;
|
|
110
|
-
};
|
|
111
|
-
|
|
55
|
+
/**
|
|
56
|
+
* @inheritDoc
|
|
57
|
+
*/
|
|
112
58
|
ODataV4Selection.prototype.onActivate = function(oTable) {
|
|
113
59
|
const oBinding = oTable.getBinding();
|
|
114
60
|
|
|
115
61
|
validateBinding(this, oBinding);
|
|
116
62
|
SelectionPlugin.prototype.onActivate.apply(this, arguments);
|
|
117
|
-
oTable.setProperty("selectionMode", this.getSelectionMode());
|
|
118
63
|
attachToBinding(this, oBinding);
|
|
119
64
|
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Table.RowsBound, onTableRowsBound, this);
|
|
120
|
-
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Table.UpdateRows, clearSelectionCache, this);
|
|
121
|
-
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Table.UnbindRows, clearSelectionCache, this);
|
|
122
65
|
};
|
|
123
66
|
|
|
67
|
+
/**
|
|
68
|
+
* @inheritDoc
|
|
69
|
+
*/
|
|
124
70
|
ODataV4Selection.prototype.onDeactivate = function(oTable) {
|
|
125
71
|
SelectionPlugin.prototype.onDeactivate.apply(this, arguments);
|
|
126
|
-
_private(this).bLimitReached = false;
|
|
127
|
-
_private(this).oRangeSelectionStartContext = null;
|
|
128
|
-
oTable.setProperty("selectionMode", library.SelectionMode.None);
|
|
129
72
|
clearTimeout(_private(this).iSelectionChangeTimeout);
|
|
130
73
|
delete _private(this).iSelectionChangeTimeout;
|
|
131
74
|
detachFromBinding(this, oTable.getBinding());
|
|
132
75
|
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.Table.RowsBound, onTableRowsBound, this);
|
|
133
|
-
TableUtils.Hook.deregister(oTable, TableUtils.Hook.Keys.Table.UpdateRows, clearSelectionCache, this);
|
|
134
|
-
TableUtils.Hook.register(oTable, TableUtils.Hook.Keys.Table.UnbindRows, clearSelectionCache, this);
|
|
135
|
-
clearSelectionCache.call(this);
|
|
136
76
|
};
|
|
137
77
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (!this.isActive() || !oContext || !isContextSelectable(oContext)) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (mConfig?.range) {
|
|
147
|
-
extendLastSelectionTo(this, oRow);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (this.isSelected(oRow) === bSelected) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (sSelectionMode === SelectionMode.Single && bSelected) {
|
|
156
|
-
this.clearSelection();
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
oContext.setSelected(bSelected);
|
|
160
|
-
_private(this).oRangeSelectionStartContext = bSelected && sSelectionMode === SelectionMode.MultiToggle ? oContext : null;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
function extendLastSelectionTo(oPlugin, oRow) {
|
|
164
|
-
if (!_private(oPlugin).oRangeSelectionStartContext) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
let iIndexFrom = _private(oPlugin).oRangeSelectionStartContext.getIndex();
|
|
169
|
-
const oContext = TableUtils.getBindingContextOfRow(oRow);
|
|
170
|
-
const iIndexTo = oContext ? oContext.getIndex() : -1;
|
|
171
|
-
|
|
172
|
-
// The start index is already selected in case of range selection, so the range needs to start from the next index.
|
|
173
|
-
if (iIndexFrom !== iIndexTo) {
|
|
174
|
-
iIndexFrom += iIndexTo > iIndexFrom ? 1 : -1;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
select(oPlugin, iIndexFrom, iIndexTo);
|
|
178
|
-
}
|
|
179
|
-
|
|
78
|
+
/**
|
|
79
|
+
* @inheritDoc
|
|
80
|
+
*/
|
|
180
81
|
ODataV4Selection.prototype.isSelected = function(oRow) {
|
|
181
82
|
if (!this.isActive()) {
|
|
182
83
|
return false;
|
|
@@ -185,220 +86,72 @@ sap.ui.define([
|
|
|
185
86
|
return TableUtils.getBindingContextOfRow(oRow)?.isSelected() ?? false;
|
|
186
87
|
};
|
|
187
88
|
|
|
89
|
+
/**
|
|
90
|
+
* @inheritDoc
|
|
91
|
+
*/
|
|
188
92
|
ODataV4Selection.prototype.getSelectedCount = function() {
|
|
189
93
|
if (!this.isActive()) {
|
|
190
94
|
return 0;
|
|
191
95
|
}
|
|
192
96
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return _private(this).iSelectionCount;
|
|
97
|
+
return this.getControl().getBinding()?.getSelectionCount() ?? 0;
|
|
196
98
|
};
|
|
197
99
|
|
|
198
100
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* @param {sap.ui.table.plugins.ODataV4Selection} oPlugin The plugin to getthe number of selectable rows from.
|
|
202
|
-
* @returns {int} The number of selectable rows, or -1 if the number cannot be determined.
|
|
101
|
+
* @inheritDoc
|
|
203
102
|
*/
|
|
204
|
-
function
|
|
205
|
-
const oBinding = oPlugin.getControl().getBinding();
|
|
206
|
-
let iSelectableCount = -1;
|
|
207
|
-
|
|
208
|
-
if (!oBinding || oBinding.getLength() === 0) {
|
|
209
|
-
return 0;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
if (_private(oPlugin).iSelectableCount != null) {
|
|
213
|
-
return _private(oPlugin).iSelectableCount;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (oBinding.getAggregation()) {
|
|
217
|
-
/* In case of data aggregation with visual grouping and sum rows, we cannot determine the number of selectable contexts.
|
|
218
|
-
* The expected behavior is that if all visible selectable rows are selected, the state changes to "everything is selected". For example,
|
|
219
|
-
* the Select All checkbox should then be checked.
|
|
220
|
-
* visible rows = All rows that can be scrolled to. Does not include children of collapsed rows.
|
|
221
|
-
* selectable rows = All visible rows that are not group headers or sums.
|
|
222
|
-
* There are no values available to determine the number of selectable rows. Length, count, and selection count are all based on different
|
|
223
|
-
* criteria.
|
|
224
|
-
* The length would work for hierarchies, but there is nothing to compare it to. For example, selected contexts may be present in
|
|
225
|
-
* collapsed rows, increasing the selection count.
|
|
226
|
-
* We would have to load all contexts and check if all selectable contexts are selected. This would significantly impact performance.
|
|
227
|
-
*
|
|
228
|
-
* If the selection limit is disabled, the Select All checkbox is shown. In this case, not reaching the "everything is selected" state is
|
|
229
|
-
* not an option. Therefore, we have to accept the loss of performance.
|
|
230
|
-
*
|
|
231
|
-
* As a consequence:
|
|
232
|
-
* - The "everything is selected" state is never reached.
|
|
233
|
-
* - If the visible rows in the table are all group headers or sums, the header selector is enabled, but pressing it has no effect.
|
|
234
|
-
* - If the selection limit is disabled, the "everything is selected" state is reached when it shouldn't be if there are invisible
|
|
235
|
-
* selected contexts, for example, in collapsed rows.
|
|
236
|
-
*/
|
|
237
|
-
if (oPlugin._isLimitDisabled()) {
|
|
238
|
-
const aAllCurrentContexts = oBinding.getAllCurrentContexts();
|
|
239
|
-
if (oBinding.getLength() === aAllCurrentContexts.length) {
|
|
240
|
-
iSelectableCount = aAllCurrentContexts.filter(isContextSelectable).length;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
} else if (oBinding.isLengthFinal()) {
|
|
244
|
-
iSelectableCount = oBinding.getLength();
|
|
245
|
-
} // The count is not requested and not all data is loaded.
|
|
246
|
-
|
|
247
|
-
_private(oPlugin).iSelectableCount = iSelectableCount;
|
|
248
|
-
return iSelectableCount;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Changes the current icon and tooltip text of the header selection icon in the given plugin object based on the selection.
|
|
253
|
-
*
|
|
254
|
-
* @param {sap.ui.table.plugins.ODataV4Selection} oPlugin The plugin to change the header selection icon on.
|
|
255
|
-
*/
|
|
256
|
-
function updateHeaderSelectorIcon(oPlugin) {
|
|
257
|
-
if (oPlugin._isLimitDisabled()) {
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
let sIconURI = IconPool.getIconURI(TableUtils.ThemeParameters.checkboxIcon);
|
|
262
|
-
|
|
263
|
-
if (oPlugin.getSelectedCount() > 0) {
|
|
264
|
-
if (areAllRowsSelected(oPlugin)) {
|
|
265
|
-
sIconURI = IconPool.getIconURI(TableUtils.ThemeParameters.allSelectedIcon);
|
|
266
|
-
} else {
|
|
267
|
-
sIconURI = IconPool.getIconURI(TableUtils.ThemeParameters.clearSelectionIcon);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
oPlugin.getAggregation("icon").setSrc(sIconURI);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
ODataV4Selection.prototype.getRenderConfig = function() {
|
|
103
|
+
ODataV4Selection.prototype.clearSelection = function() {
|
|
275
104
|
if (!this.isActive()) {
|
|
276
|
-
return
|
|
105
|
+
return;
|
|
277
106
|
}
|
|
278
107
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const mRenderConfig = {
|
|
282
|
-
headerSelector: {
|
|
283
|
-
type: this._isLimitDisabled() ? "toggle" : "custom",
|
|
284
|
-
icon: this.getAggregation("icon"),
|
|
285
|
-
visible: this.getSelectionMode() === SelectionMode.MultiToggle && !this.getHideHeaderSelector(),
|
|
286
|
-
enabled: getSelectableCount(this) !== 0,
|
|
287
|
-
selected: areAllRowsSelected(this),
|
|
288
|
-
tooltip: this.getSelectedCount() === 0
|
|
289
|
-
? TableUtils.getResourceText("TBL_SELECT_ALL")
|
|
290
|
-
: TableUtils.getResourceText("TBL_DESELECT_ALL")
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
return mRenderConfig;
|
|
108
|
+
this.getControl().getBinding()?.getHeaderContext()?.setSelected(false);
|
|
295
109
|
};
|
|
296
110
|
|
|
297
111
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* @param {sap.ui.table.plugins.ODataV4Selection} oPlugin The selection plugin.
|
|
301
|
-
* @returns {boolean} The state of selection. true - all selected, false - all cleared, undefined - no action
|
|
302
|
-
*/
|
|
303
|
-
function toggleSelectAll(oPlugin) {
|
|
304
|
-
if (areAllRowsSelected(oPlugin)) {
|
|
305
|
-
oPlugin.clearSelection();
|
|
306
|
-
return false;
|
|
307
|
-
} else if (oPlugin._isLimitDisabled()) {
|
|
308
|
-
const oBinding = oPlugin.getControl().getBinding();
|
|
309
|
-
if (oBinding?.getLength()) {
|
|
310
|
-
select(oPlugin, 0, oBinding.getLength() - 1);
|
|
311
|
-
return true;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
return undefined;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Checks if all rows are selected.
|
|
319
|
-
*
|
|
320
|
-
* @param {sap.ui.table.plugins.ODataV4Selection} oPlugin The selection plugin.
|
|
321
|
-
* @returns {boolean} Whether all rows are selected.
|
|
112
|
+
* @inheritDoc
|
|
322
113
|
*/
|
|
323
|
-
function
|
|
324
|
-
const iSelectableCount = getSelectableCount(oPlugin);
|
|
325
|
-
/* Fails to return the correct information if there are selected invisible contexts. For example, if a context is selected and after
|
|
326
|
-
* filtering the table contains 1 row with a different, unselected context -> 1 === 1.
|
|
327
|
-
* We would have to load all contexts and check if all selectable contexts are selected. This would significantly impact performance.
|
|
328
|
-
*/
|
|
329
|
-
return iSelectableCount > 0 && iSelectableCount === oPlugin.getSelectedCount();
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
ODataV4Selection.prototype.onHeaderSelectorPress = function() {
|
|
114
|
+
ODataV4Selection.prototype.getSelectedContexts = function() {
|
|
333
115
|
if (!this.isActive()) {
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
const mRenderConfig = this.getRenderConfig();
|
|
338
|
-
|
|
339
|
-
if (!mRenderConfig.headerSelector.visible || !mRenderConfig.headerSelector.enabled) {
|
|
340
|
-
return;
|
|
116
|
+
return [];
|
|
341
117
|
}
|
|
342
118
|
|
|
343
|
-
|
|
344
|
-
toggleSelectAll(this);
|
|
345
|
-
} else if (mRenderConfig.headerSelector.type === "custom") {
|
|
346
|
-
if (this.getSelectedCount() > 0) {
|
|
347
|
-
this.clearSelection();
|
|
348
|
-
} else {
|
|
349
|
-
const oBinding = this.getControl().getBinding();
|
|
350
|
-
if (oBinding?.getLength() > 0) {
|
|
351
|
-
select(this, 0, oBinding.getLength() - 1);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
119
|
+
return this.getControl().getBinding()?.getAllCurrentContexts().filter((oContext) => oContext.isSelected()) ?? [];
|
|
355
120
|
};
|
|
356
121
|
|
|
122
|
+
/**
|
|
123
|
+
* @inheritDoc
|
|
124
|
+
*/
|
|
357
125
|
ODataV4Selection.prototype.onKeyboardShortcut = function(sType, oEvent) {
|
|
358
126
|
if (!this.isActive()) {
|
|
359
127
|
return;
|
|
360
128
|
}
|
|
361
129
|
|
|
362
|
-
if (sType === "
|
|
363
|
-
if (this.getSelectionMode() !== SelectionMode.MultiToggle) {
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
if (this._isLimitDisabled()) {
|
|
368
|
-
if (toggleSelectAll(this) === false) {
|
|
369
|
-
oEvent.setMarked("sapUiTableClearAll");
|
|
370
|
-
}
|
|
371
|
-
} else {
|
|
372
|
-
const oBinding = this.getControl().getBinding();
|
|
373
|
-
if (oBinding?.getLength() > 0) {
|
|
374
|
-
select(this, 0, oBinding.getLength() - 1);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
} else if (sType === "clear") { // ctrl + shift + a
|
|
130
|
+
if (sType === "clear") { // ctrl + shift + a
|
|
378
131
|
this.clearSelection();
|
|
379
132
|
oEvent.setMarked("sapUiTableClearAll");
|
|
380
133
|
}
|
|
381
134
|
};
|
|
382
135
|
|
|
383
|
-
ODataV4Selection.prototype.
|
|
384
|
-
|
|
136
|
+
ODataV4Selection.prototype.isContextSelectable = function(oContext) {
|
|
137
|
+
const oBinding = oContext.getBinding();
|
|
138
|
+
const bIsHeaderContext = oContext === oBinding.getHeaderContext();
|
|
385
139
|
|
|
386
|
-
if
|
|
387
|
-
|
|
140
|
+
// To avoid compatibility issues if support is added.
|
|
141
|
+
// Allowing to select the header context, sums, and group headers might affect UI, behavior, and settings.
|
|
142
|
+
|
|
143
|
+
if (bIsHeaderContext) {
|
|
144
|
+
return false;
|
|
388
145
|
}
|
|
389
146
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
147
|
+
const bIsLeaf = oContext.getProperty("@$ui5.node.isExpanded") === undefined;
|
|
148
|
+
const bIsTotal = oContext.getProperty("@$ui5.node.isTotal");
|
|
149
|
+
const bIsHierarchy = "hierarchyQualifier" in (oBinding.getAggregation() || {});
|
|
393
150
|
|
|
394
|
-
return
|
|
151
|
+
return bIsHierarchy || (bIsLeaf && !bIsTotal);
|
|
395
152
|
};
|
|
396
153
|
|
|
397
|
-
ODataV4Selection.prototype.
|
|
398
|
-
this.setProperty("limit", iLimit);
|
|
399
|
-
_private(this).bLimitReached = false;
|
|
400
|
-
return this;
|
|
401
|
-
};
|
|
154
|
+
ODataV4Selection.prototype.validateSelection = function(aContextsToValidate) {};
|
|
402
155
|
|
|
403
156
|
/**
|
|
404
157
|
* Validates the given binding for the specified plugin.
|
|
@@ -430,7 +183,6 @@ sap.ui.define([
|
|
|
430
183
|
* @param {object} [oContext] The specific context to validate. If not provided, all selected contexts are validated.
|
|
431
184
|
* @throws {Error} If the header context is selected.
|
|
432
185
|
* @throws {Error} If a context that is not selectable is selected.
|
|
433
|
-
* @throws {Error} If multiple contexts are selected in 'Single' selection mode.
|
|
434
186
|
*/
|
|
435
187
|
function validateSelection(oPlugin, oBinding, oContext) {
|
|
436
188
|
const oHeaderContext = oBinding.getHeaderContext();
|
|
@@ -447,20 +199,12 @@ sap.ui.define([
|
|
|
447
199
|
}
|
|
448
200
|
|
|
449
201
|
for (const oContext of aContextsToValidate) {
|
|
450
|
-
|
|
451
|
-
if (oContext === oHeaderContext) {
|
|
452
|
-
throw new Error("Header context must not be selected");
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// To avoid compatibility issues if support is added. Handling selected sums and group headers might affect UI, behavior, and settings.
|
|
456
|
-
if (!isContextSelectable(oContext)) {
|
|
202
|
+
if (!oPlugin.isContextSelectable(oContext)) {
|
|
457
203
|
throw new Error(`Context ${oContext} is not allowed to be selected`);
|
|
458
204
|
}
|
|
459
205
|
}
|
|
460
206
|
|
|
461
|
-
|
|
462
|
-
throw new Error("Multiple contexts selected. Cannot select more than one context in selection mode 'Single'");
|
|
463
|
-
}
|
|
207
|
+
oPlugin.validateSelection(aContextsToValidate);
|
|
464
208
|
}
|
|
465
209
|
|
|
466
210
|
function onTableRowsBound(oBinding) {
|
|
@@ -479,8 +223,6 @@ sap.ui.define([
|
|
|
479
223
|
function onBindingSelectionChanged(oEvent) {
|
|
480
224
|
const oContext = oEvent.getParameter("context");
|
|
481
225
|
|
|
482
|
-
clearSelectionCache.call(this);
|
|
483
|
-
|
|
484
226
|
try {
|
|
485
227
|
validateSelection(this, oContext.getBinding(), oContext);
|
|
486
228
|
} catch (oError) {
|
|
@@ -498,108 +240,5 @@ sap.ui.define([
|
|
|
498
240
|
}, 0);
|
|
499
241
|
}
|
|
500
242
|
|
|
501
|
-
function clearSelectionCache() {
|
|
502
|
-
delete _private(this).aSelectedContexts; // Delete the cached selected contexts to force a recalculation.
|
|
503
|
-
delete _private(this).iSelectionCount; // Delete the cached selection count to force a recalculation.
|
|
504
|
-
delete _private(this).iSelectableCount; // Delete the cached selectable count to force a recalculation.
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Checks whether the limit is disabled.
|
|
509
|
-
*
|
|
510
|
-
* @returns {boolean} Whether the limit is disabled.
|
|
511
|
-
* @private
|
|
512
|
-
*/
|
|
513
|
-
ODataV4Selection.prototype._isLimitDisabled = function() {
|
|
514
|
-
return this.getLimit() === 0;
|
|
515
|
-
};
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
* Calculates the correct start and end index for the range selection, loads the corresponding contexts and sets the selected state.
|
|
519
|
-
*
|
|
520
|
-
* @param {sap.ui.table.plugins.ODataV4Selection} oPlugin The selection plugin.
|
|
521
|
-
* @param {int} iIndexFrom The start index of the range selection.
|
|
522
|
-
* @param {int} iIndexTo The end index of the range selection.
|
|
523
|
-
*/
|
|
524
|
-
function select(oPlugin, iIndexFrom, iIndexTo) {
|
|
525
|
-
const oTable = oPlugin.getControl();
|
|
526
|
-
const iLimit = oPlugin.getLimit();
|
|
527
|
-
const bUpwardSelection = iIndexTo < iIndexFrom; // Indicates whether the selection is made from bottom to top.
|
|
528
|
-
let iGetContextsStartIndex = bUpwardSelection ? iIndexTo : iIndexFrom;
|
|
529
|
-
let iGetContextsLength = Math.abs(iIndexTo - iIndexFrom) + 1;
|
|
530
|
-
|
|
531
|
-
if (!oPlugin._isLimitDisabled()) {
|
|
532
|
-
_private(oPlugin).bLimitReached = iGetContextsLength > iLimit;
|
|
533
|
-
|
|
534
|
-
if (_private(oPlugin).bLimitReached) {
|
|
535
|
-
if (bUpwardSelection) {
|
|
536
|
-
iIndexTo = iIndexFrom - iLimit + 1;
|
|
537
|
-
iGetContextsStartIndex = iIndexTo;
|
|
538
|
-
} else {
|
|
539
|
-
iIndexTo = iIndexFrom + iLimit - 1;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
// The table will be scrolled one row further to make it transparent for the user where the selection ends.
|
|
543
|
-
// load the extra row here to avoid additional batch request.
|
|
544
|
-
iGetContextsLength = iLimit + 1;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
TableUtils.loadContexts(oTable.getBinding(), iGetContextsStartIndex, iGetContextsLength).then(function(aContexts) {
|
|
549
|
-
aContexts.forEach(function(oContext) {
|
|
550
|
-
if (!isContextSelectable(oContext) || oContext.isSelected()) {
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
if (bUpwardSelection && oContext.getIndex() >= iIndexTo || oContext.getIndex() <= iIndexTo) {
|
|
554
|
-
oContext.setSelected(true);
|
|
555
|
-
}
|
|
556
|
-
if (oContext.getIndex() === iIndexTo) {
|
|
557
|
-
_private(oPlugin).oRangeSelectionStartContext = oContext;
|
|
558
|
-
}
|
|
559
|
-
});
|
|
560
|
-
|
|
561
|
-
if (_private(oPlugin).bLimitReached) {
|
|
562
|
-
TableUtils.scrollTableToIndex(oTable, iIndexTo, bUpwardSelection).then(function() {
|
|
563
|
-
if (oPlugin.getEnableNotification()) {
|
|
564
|
-
TableUtils.showNotificationPopoverAtIndex(oTable, iIndexTo, oPlugin.getLimit());
|
|
565
|
-
}
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
function isContextSelectable(oContext) {
|
|
572
|
-
const oBinding = oContext.getBinding();
|
|
573
|
-
const bIsHeaderContext = oContext === oBinding.getHeaderContext();
|
|
574
|
-
const bIsLeaf = oContext.getProperty("@$ui5.node.isExpanded") === undefined;
|
|
575
|
-
const bIsTotal = oContext.getProperty("@$ui5.node.isTotal");
|
|
576
|
-
const bIsHierarchy = "hierarchyQualifier" in (oBinding.getAggregation() || {});
|
|
577
|
-
|
|
578
|
-
return !bIsHeaderContext && (bIsHierarchy || (bIsLeaf && !bIsTotal));
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
ODataV4Selection.prototype.clearSelection = function() {
|
|
582
|
-
if (!this.isActive()) {
|
|
583
|
-
return;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
this.getControl().getBinding()?.getHeaderContext()?.setSelected(false);
|
|
587
|
-
};
|
|
588
|
-
|
|
589
|
-
ODataV4Selection.prototype.getSelectedContexts = function() {
|
|
590
|
-
if (!this.isActive()) {
|
|
591
|
-
return [];
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
_private(this).aSelectedContexts ??= this.getControl().getBinding()?.getAllCurrentContexts().filter((oContext) => oContext.isSelected()) ?? [];
|
|
595
|
-
_private(this).iSelectionCount = _private(this).aSelectedContexts.length;
|
|
596
|
-
|
|
597
|
-
return _private(this).aSelectedContexts;
|
|
598
|
-
};
|
|
599
|
-
|
|
600
|
-
ODataV4Selection.prototype.onThemeChanged = function() {
|
|
601
|
-
updateHeaderSelectorIcon(this);
|
|
602
|
-
};
|
|
603
|
-
|
|
604
243
|
return ODataV4Selection;
|
|
605
244
|
});
|