@openui5/sap.ui.table 1.123.0 → 1.124.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/.eslintrc.json +9 -1
- package/package.json +3 -3
- package/src/sap/ui/table/.library +1 -1
- package/src/sap/ui/table/AnalyticalColumn.js +40 -40
- package/src/sap/ui/table/AnalyticalColumnMenu.js +11 -11
- package/src/sap/ui/table/AnalyticalTable.js +107 -107
- package/src/sap/ui/table/Column.js +83 -83
- package/src/sap/ui/table/ColumnMenu.js +54 -54
- package/src/sap/ui/table/CreationRow.js +29 -29
- package/src/sap/ui/table/CreationRowRenderer.js +21 -21
- package/src/sap/ui/table/Row.js +55 -56
- package/src/sap/ui/table/RowAction.js +27 -27
- package/src/sap/ui/table/RowActionItem.js +7 -7
- package/src/sap/ui/table/RowActionRenderer.js +3 -3
- package/src/sap/ui/table/RowSettings.js +28 -37
- package/src/sap/ui/table/Table.js +263 -266
- package/src/sap/ui/table/TablePersoController.js +46 -46
- package/src/sap/ui/table/TableRenderer.js +112 -113
- package/src/sap/ui/table/TreeTable.js +16 -16
- package/src/sap/ui/table/designtime/Table.designtime.js +2 -2
- package/src/sap/ui/table/extensions/Accessibility.js +185 -181
- package/src/sap/ui/table/extensions/AccessibilityRender.js +15 -15
- package/src/sap/ui/table/extensions/DragAndDrop.js +47 -47
- package/src/sap/ui/table/extensions/ExtensionBase.js +9 -9
- package/src/sap/ui/table/extensions/Keyboard.js +40 -40
- package/src/sap/ui/table/extensions/KeyboardDelegate.js +257 -264
- package/src/sap/ui/table/extensions/Pointer.js +108 -109
- package/src/sap/ui/table/extensions/Scrolling.js +289 -285
- package/src/sap/ui/table/extensions/ScrollingIOS.js +50 -50
- package/src/sap/ui/table/extensions/Synchronization.js +32 -32
- package/src/sap/ui/table/library.js +12 -12
- package/src/sap/ui/table/menus/ColumnHeaderMenuAdapter.js +9 -9
- package/src/sap/ui/table/menus/LegacyColumnMenuAdapter.js +35 -37
- package/src/sap/ui/table/menus/MobileColumnHeaderMenuAdapter.js +23 -23
- package/src/sap/ui/table/messagebundle_sh.properties +9 -9
- package/src/sap/ui/table/plugins/BindingSelection.js +26 -25
- package/src/sap/ui/table/plugins/MultiSelectionPlugin.js +77 -32
- package/src/sap/ui/table/plugins/ODataV4Selection.js +81 -35
- package/src/sap/ui/table/plugins/PluginBase.js +12 -12
- package/src/sap/ui/table/plugins/SelectionModelSelection.js +13 -12
- package/src/sap/ui/table/plugins/SelectionPlugin.js +3 -3
- package/src/sap/ui/table/plugins/V4Aggregation.js +38 -38
- package/src/sap/ui/table/rowmodes/Auto.js +59 -61
- package/src/sap/ui/table/rowmodes/Fixed.js +18 -18
- package/src/sap/ui/table/rowmodes/Interactive.js +42 -44
- package/src/sap/ui/table/rowmodes/RowMode.js +64 -63
- package/src/sap/ui/table/rowmodes/Type.js +1 -1
- package/src/sap/ui/table/rowmodes/Variable.js +4 -4
- package/src/sap/ui/table/rules/Accessibility.support.js +15 -16
- package/src/sap/ui/table/rules/Binding.support.js +11 -11
- package/src/sap/ui/table/rules/ColumnTemplate.support.js +10 -10
- package/src/sap/ui/table/rules/Plugins.support.js +7 -7
- package/src/sap/ui/table/rules/Rows.support.js +29 -29
- package/src/sap/ui/table/rules/TableHelper.support.js +10 -10
- package/src/sap/ui/table/themes/base/library.source.less +2 -0
- package/src/sap/ui/table/utils/TableUtils.js +130 -128
- package/src/sap/ui/table/utils/_BindingUtils.js +7 -7
- package/src/sap/ui/table/utils/_ColumnUtils.js +98 -97
- package/src/sap/ui/table/utils/_GroupingUtils.js +56 -56
- package/src/sap/ui/table/utils/_HookUtils.js +26 -26
- package/src/sap/ui/table/utils/_MenuUtils.js +19 -19
|
@@ -11,12 +11,12 @@ sap.ui.define([
|
|
|
11
11
|
"use strict";
|
|
12
12
|
|
|
13
13
|
// Shortcuts
|
|
14
|
-
|
|
14
|
+
const SelectionMode = library.SelectionMode;
|
|
15
15
|
|
|
16
16
|
/*
|
|
17
17
|
* Renders a hidden element with the given id, text and css classes.
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
const _writeAccText = function(oRm, sParentId, sId, sText, aCSSClasses) {
|
|
20
20
|
aCSSClasses = aCSSClasses || [];
|
|
21
21
|
aCSSClasses.push("sapUiInvisibleText");
|
|
22
22
|
|
|
@@ -44,12 +44,12 @@ sap.ui.define([
|
|
|
44
44
|
* @class Extension for sap.ui.table.TableRenderer which handles ACC related things.
|
|
45
45
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
46
46
|
* @author SAP SE
|
|
47
|
-
* @version 1.
|
|
47
|
+
* @version 1.124.0
|
|
48
48
|
* @constructor
|
|
49
49
|
* @private
|
|
50
50
|
* @alias sap.ui.table.extensions.AccessibilityRender
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
const AccRenderExtension = ExtensionBase.extend("sap.ui.table.extensions.AccessibilityRender",
|
|
53
53
|
/** @lends sap.ui.table.extensions.AccessibilityRender.prototype */ {
|
|
54
54
|
/**
|
|
55
55
|
* @override
|
|
@@ -72,7 +72,7 @@ sap.ui.define([
|
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
const sTableId = oTable.getId();
|
|
76
76
|
|
|
77
77
|
oRm.openStart("div");
|
|
78
78
|
oRm.class("sapUiTableHiddenTexts");
|
|
@@ -119,11 +119,11 @@ sap.ui.define([
|
|
|
119
119
|
// aria description for column with required content
|
|
120
120
|
_writeAccText(oRm, sTableId, "ariarequired", TableUtils.getResourceText("TBL_COL_REQUIRED"));
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
const oSelectionMode = oTable.getSelectionMode();
|
|
123
123
|
if (oSelectionMode !== SelectionMode.None) {
|
|
124
124
|
// aria description for selection mode in table
|
|
125
125
|
_writeAccText(oRm, sTableId, "ariaselection",
|
|
126
|
-
TableUtils.getResourceText(oSelectionMode
|
|
126
|
+
TableUtils.getResourceText(oSelectionMode === SelectionMode.MultiToggle ? "TBL_TABLE_SELECTION_MULTI" : "TBL_TABLE_SELECTION_SINGLE"));
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
if (oTable.getComputedFixedColumnCount() > 0) {
|
|
@@ -149,15 +149,15 @@ sap.ui.define([
|
|
|
149
149
|
* @public
|
|
150
150
|
*/
|
|
151
151
|
writeAriaAttributesFor: function(oRm, oTable, sType, mParams) {
|
|
152
|
-
|
|
152
|
+
const oExtension = oTable._getAccExtension();
|
|
153
153
|
|
|
154
154
|
if (!oExtension.getAccMode()) {
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
const mAttributes = oExtension.getAriaAttributesFor(sType, mParams);
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
let oValue; let sKey;
|
|
161
161
|
for (sKey in mAttributes) {
|
|
162
162
|
oValue = mAttributes[sKey];
|
|
163
163
|
if (Array.isArray(oValue)) {
|
|
@@ -183,9 +183,9 @@ sap.ui.define([
|
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
const bIsSelected = oTable._getSelectionPlugin().isSelected(oRow);
|
|
187
|
+
const mKeyboardTexts = oTable._getAccExtension().getKeyboardTexts();
|
|
188
|
+
const sText = bIsSelected ? mKeyboardTexts.rowDeselect : mKeyboardTexts.rowSelect;
|
|
189
189
|
|
|
190
190
|
_writeAccText(oRm, oRow.getId(), "rowselecttext", oRow.isEmpty() ? "" : sText, ["sapUiTableAriaRowSel"]);
|
|
191
191
|
},
|
|
@@ -205,8 +205,8 @@ sap.ui.define([
|
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
|
|
208
|
+
const oRowSettings = oRow.getAggregation("_settings");
|
|
209
|
+
const sHighlightText = oRowSettings._getHighlightText();
|
|
210
210
|
|
|
211
211
|
_writeAccText(oRm, oRow.getId(), "highlighttext", sHighlightText);
|
|
212
212
|
},
|
|
@@ -10,10 +10,10 @@ sap.ui.define([
|
|
|
10
10
|
], function(ExtensionBase, TableUtils, CoreLibrary) {
|
|
11
11
|
"use strict";
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const SESSION_DATA_KEY_NAMESPACE = "sap.ui.table";
|
|
14
|
+
const DropPosition = CoreLibrary.dnd.DropPosition;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const ExtensionHelper = {
|
|
17
17
|
/**
|
|
18
18
|
* Gets the session data from the drag session. To get the session data that is shared by all table instances, do not specify a key.
|
|
19
19
|
*
|
|
@@ -59,34 +59,34 @@ sap.ui.define([
|
|
|
59
59
|
},
|
|
60
60
|
|
|
61
61
|
scrollVertically: TableUtils.throttle(function(oTable, bDown, iBase, iPercentage) {
|
|
62
|
-
|
|
62
|
+
const oVerticalScrollbar = oTable._getScrollExtension().getVerticalScrollbar();
|
|
63
63
|
oVerticalScrollbar.scrollTop += this.calculateScrollDistance(iBase, iPercentage) * (bDown ? 1 : -1);
|
|
64
64
|
}, 50),
|
|
65
65
|
|
|
66
66
|
scrollHorizontally: TableUtils.throttle(function(oTable, bRight, iBase, iPercentage) {
|
|
67
|
-
|
|
67
|
+
const oHorizontalScrollbar = oTable._getScrollExtension().getHorizontalScrollbar();
|
|
68
68
|
oHorizontalScrollbar.scrollLeft += this.calculateScrollDistance(iBase, iPercentage) * (bRight ? 1 : -1);
|
|
69
69
|
}, 50),
|
|
70
70
|
|
|
71
71
|
calculateScrollDistance: function(iBase, iPercentage) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
const iMinDistance = 2;
|
|
73
|
+
const iMaxDistance = 50;
|
|
74
|
+
const nRate = iPercentage / iBase;
|
|
75
75
|
|
|
76
76
|
return Math.max(iMinDistance, Math.round(iMaxDistance * nRate));
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
const ExtensionDelegate = {
|
|
81
81
|
ondragstart: function(oEvent) {
|
|
82
|
-
|
|
82
|
+
const oDragSession = oEvent.dragSession;
|
|
83
83
|
|
|
84
84
|
if (!oDragSession || !oDragSession.getDragControl()) {
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
const oDraggedControl = oDragSession.getDragControl();
|
|
89
|
+
const oSessionData = {};
|
|
90
90
|
|
|
91
91
|
if (oDraggedControl.isA("sap.ui.table.Row")) {
|
|
92
92
|
if (oDraggedControl.isEmpty() || oDraggedControl.isGroupHeader() || oDraggedControl.isSummary()) {
|
|
@@ -103,15 +103,15 @@ sap.ui.define([
|
|
|
103
103
|
},
|
|
104
104
|
|
|
105
105
|
ondragenter: function(oEvent) {
|
|
106
|
-
|
|
106
|
+
const oDragSession = oEvent.dragSession;
|
|
107
107
|
|
|
108
108
|
if (!oDragSession || !oDragSession.getDropControl()) {
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
let oSessionData = ExtensionHelper.getInstanceSessionData(oDragSession, this);
|
|
113
|
+
const oDraggedControl = oDragSession.getDragControl();
|
|
114
|
+
const oDropControl = oDragSession.getDropControl();
|
|
115
115
|
|
|
116
116
|
if (!oSessionData) {
|
|
117
117
|
oSessionData = {};
|
|
@@ -125,9 +125,9 @@ sap.ui.define([
|
|
|
125
125
|
* - Group header rows
|
|
126
126
|
* - Sum rows
|
|
127
127
|
*/
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
const oDraggedRowContext = oSessionData.draggedRowContext;
|
|
129
|
+
const oDropRowContext = oDropControl.getRowBindingContext();
|
|
130
|
+
const sDropPosition = oDragSession.getDropInfo().getDropPosition();
|
|
131
131
|
|
|
132
132
|
if ((oDropControl.isEmpty() && sDropPosition === DropPosition.On && TableUtils.hasData(this)) // On empty row, table has data
|
|
133
133
|
|| (oDraggedRowContext && oDraggedRowContext === oDropRowContext) // The dragged row itself
|
|
@@ -138,7 +138,7 @@ sap.ui.define([
|
|
|
138
138
|
// If dragging over an empty row with a drop position other than "On", the drop control should be the first non-empty row. If
|
|
139
139
|
// all rows are empty, the drop target should be the table to perform a drop in aggregation.
|
|
140
140
|
if (!oDropRowContext) {
|
|
141
|
-
|
|
141
|
+
const oLastNonEmptyRow = this.getRows()[TableUtils.getNonEmptyRowCount(this) - 1];
|
|
142
142
|
oDragSession.setDropControl(oLastNonEmptyRow || this);
|
|
143
143
|
}
|
|
144
144
|
|
|
@@ -146,8 +146,8 @@ sap.ui.define([
|
|
|
146
146
|
// always need to be updated. The only exception is when all rows are empty. In this case a "drop in aggregation" will be
|
|
147
147
|
// performed, for which no indicator adjustment is necessary.
|
|
148
148
|
if (oDragSession.getDropControl() !== this) {
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
const bVerticalScrollbarVisible = this.getDomRef().classList.contains("sapUiTableVScr");
|
|
150
|
+
const mTableCntRect = this.getDomRef("sapUiTableCnt").getBoundingClientRect();
|
|
151
151
|
oDragSession.setIndicatorConfig({
|
|
152
152
|
width: mTableCntRect.width - (bVerticalScrollbarVisible ? 16 : 0),
|
|
153
153
|
left: mTableCntRect.left + (this._bRtlMode && bVerticalScrollbarVisible ? 16 : 0)
|
|
@@ -155,7 +155,7 @@ sap.ui.define([
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
} else if (oDropControl.isA("sap.ui.table.Column")) {
|
|
158
|
-
|
|
158
|
+
const iTargetColumnIndex = TableUtils.getCellInfo(TableUtils.getCell(this, oEvent.target)).columnIndex;
|
|
159
159
|
|
|
160
160
|
if (oDraggedControl.isA("sap.ui.table.Column")
|
|
161
161
|
&& !TableUtils.Column.isColumnMovableTo(oDraggedControl, iTargetColumnIndex, true)) {
|
|
@@ -163,7 +163,7 @@ sap.ui.define([
|
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
const mTableCntRect = this.getDomRef("sapUiTableCnt").getBoundingClientRect();
|
|
167
167
|
oDragSession.setIndicatorConfig({
|
|
168
168
|
height: mTableCntRect.height - (this._getScrollExtension().isHorizontalScrollbarVisible() ? 16 : 0)
|
|
169
169
|
});
|
|
@@ -182,8 +182,8 @@ sap.ui.define([
|
|
|
182
182
|
// It is unlikely, that during a drag&drop action the horizontal scrollbar appears or disappears,
|
|
183
183
|
// therefore the vertical scroll edge only needs to be set once.
|
|
184
184
|
if (!oSessionData.verticalScrollEdge) {
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
const iPageYOffset = window.pageYOffset;
|
|
186
|
+
const mVerticalScrollRect = this.getDomRef("table").getBoundingClientRect();
|
|
187
187
|
oSessionData.verticalScrollEdge = {
|
|
188
188
|
bottom: mVerticalScrollRect.bottom + iPageYOffset,
|
|
189
189
|
top: mVerticalScrollRect.top + iPageYOffset
|
|
@@ -192,8 +192,8 @@ sap.ui.define([
|
|
|
192
192
|
|
|
193
193
|
// Because the vertical scrollbar can appear after expanding rows on "longdragover",
|
|
194
194
|
// the horizontal scroll edge always needs to be updated.
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
const iPageXOffset = window.pageXOffset;
|
|
196
|
+
const mHorizontalScrollRect = this.getDomRef("sapUiTableCtrlScr").getBoundingClientRect();
|
|
197
197
|
oSessionData.horizontalScrollEdge = {
|
|
198
198
|
left: mHorizontalScrollRect.left + iPageXOffset,
|
|
199
199
|
right: mHorizontalScrollRect.right + iPageXOffset
|
|
@@ -203,28 +203,28 @@ sap.ui.define([
|
|
|
203
203
|
},
|
|
204
204
|
|
|
205
205
|
ondragover: function(oEvent) {
|
|
206
|
-
|
|
206
|
+
const oDragSession = oEvent.dragSession;
|
|
207
207
|
|
|
208
208
|
if (!oDragSession) {
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
const oSessionData = ExtensionHelper.getInstanceSessionData(oDragSession, this);
|
|
213
213
|
|
|
214
214
|
if (!oSessionData) {
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
218
|
+
const iThreshold = 50;
|
|
219
|
+
const oDropControl = oDragSession.getDropControl();
|
|
220
|
+
const oScrollExtension = this._getScrollExtension();
|
|
221
|
+
const oVerticalScrollbar = oScrollExtension.getVerticalScrollbar();
|
|
222
|
+
const oHorizontalScrollbar = oScrollExtension.getHorizontalScrollbar();
|
|
223
|
+
const oVerticalScrollEdge = oSessionData.verticalScrollEdge;
|
|
224
|
+
const oHorizontalScrollEdge = oSessionData.horizontalScrollEdge;
|
|
225
225
|
|
|
226
226
|
if (oVerticalScrollEdge && oVerticalScrollbar && oDropControl !== this) {
|
|
227
|
-
|
|
227
|
+
const iPageY = oEvent.pageY;
|
|
228
228
|
|
|
229
229
|
if (iPageY >= oVerticalScrollEdge.top - iThreshold && iPageY <= oVerticalScrollEdge.top + iThreshold) {
|
|
230
230
|
ExtensionHelper.scrollVertically(this, false, iThreshold * 2, oVerticalScrollEdge.top + iThreshold - iPageY);
|
|
@@ -234,7 +234,7 @@ sap.ui.define([
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
if (oHorizontalScrollEdge && oHorizontalScrollbar && oDropControl !== this) {
|
|
237
|
-
|
|
237
|
+
const iPageX = oEvent.pageX;
|
|
238
238
|
|
|
239
239
|
if (iPageX >= oHorizontalScrollEdge.left - iThreshold && iPageX <= oHorizontalScrollEdge.left + iThreshold) {
|
|
240
240
|
ExtensionHelper.scrollHorizontally(this, false, iThreshold * 2, oHorizontalScrollEdge.left + iThreshold - iPageX);
|
|
@@ -245,16 +245,16 @@ sap.ui.define([
|
|
|
245
245
|
},
|
|
246
246
|
|
|
247
247
|
onlongdragover: function(oEvent) {
|
|
248
|
-
|
|
248
|
+
const oDragSession = oEvent.dragSession;
|
|
249
249
|
|
|
250
250
|
if (!oDragSession) {
|
|
251
251
|
return;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
254
|
+
const $Cell = TableUtils.getCell(this, oEvent.target);
|
|
255
|
+
const iRowIndex = TableUtils.getCellInfo($Cell).rowIndex;
|
|
256
|
+
const oRow = iRowIndex == null ? null : this.getRows()[iRowIndex];
|
|
257
|
+
const oDropControl = oDragSession.getDropControl();
|
|
258
258
|
|
|
259
259
|
if (oRow && (oDropControl === oRow || !oDropControl)) {
|
|
260
260
|
oRow.expand();
|
|
@@ -274,12 +274,12 @@ sap.ui.define([
|
|
|
274
274
|
*
|
|
275
275
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
276
276
|
* @author SAP SE
|
|
277
|
-
* @version 1.
|
|
277
|
+
* @version 1.124.0
|
|
278
278
|
* @constructor
|
|
279
279
|
* @private
|
|
280
280
|
* @alias sap.ui.table.extensions.DragAndDrop
|
|
281
281
|
*/
|
|
282
|
-
|
|
282
|
+
const DragAndDropExtension = ExtensionBase.extend("sap.ui.table.extensions.DragAndDrop",
|
|
283
283
|
/** @lends sap.ui.table.extensions.DragAndDrop.prototype */ {
|
|
284
284
|
/**
|
|
285
285
|
* @override
|
|
@@ -308,7 +308,7 @@ sap.ui.define([
|
|
|
308
308
|
* @inheritDoc
|
|
309
309
|
*/
|
|
310
310
|
destroy: function() {
|
|
311
|
-
|
|
311
|
+
const oTable = this.getTable();
|
|
312
312
|
|
|
313
313
|
if (oTable) {
|
|
314
314
|
oTable.removeEventDelegate(this._oDelegate);
|
|
@@ -19,12 +19,12 @@ sap.ui.define([
|
|
|
19
19
|
* @abstract
|
|
20
20
|
* @extends sap.ui.base.Object
|
|
21
21
|
* @author SAP SE
|
|
22
|
-
* @version 1.
|
|
22
|
+
* @version 1.124.0
|
|
23
23
|
* @constructor
|
|
24
24
|
* @private
|
|
25
25
|
* @alias sap.ui.table.extensions.ExtensionBase
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
const ExtensionBase = BaseObject.extend("sap.ui.table.extensions.ExtensionBase", /** @lends sap.ui.table.extensions.ExtensionBase.prototype */ {
|
|
28
28
|
/**
|
|
29
29
|
* Instance of the table this extension is applied to.
|
|
30
30
|
*
|
|
@@ -62,11 +62,11 @@ sap.ui.define([
|
|
|
62
62
|
this._type = ExtensionBase.TABLETYPES.ANALYTICAL;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
const sExtensionName = this._init(this._table, this._type, this._settings);
|
|
66
66
|
|
|
67
67
|
// Attach a getter to the table to get the instance of this extension.
|
|
68
68
|
if (sExtensionName) {
|
|
69
|
-
|
|
69
|
+
const that = this;
|
|
70
70
|
oTable["_get" + sExtensionName] = function() { return that; };
|
|
71
71
|
}
|
|
72
72
|
},
|
|
@@ -156,7 +156,7 @@ sap.ui.define([
|
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
for (
|
|
159
|
+
for (let i = 0; i < oTable._aExtensions.length; i++) {
|
|
160
160
|
oTable._aExtensions[i]._attachEvents();
|
|
161
161
|
}
|
|
162
162
|
};
|
|
@@ -173,7 +173,7 @@ sap.ui.define([
|
|
|
173
173
|
if (!oTable._aExtensions) {
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
for (
|
|
176
|
+
for (let i = 0; i < oTable._aExtensions.length; i++) {
|
|
177
177
|
oTable._aExtensions[i]._detachEvents();
|
|
178
178
|
}
|
|
179
179
|
};
|
|
@@ -193,7 +193,7 @@ sap.ui.define([
|
|
|
193
193
|
return null;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
const oExtension = new ExtensionClass(oTable, mSettings);
|
|
197
197
|
if (!oTable._aExtensions) {
|
|
198
198
|
oTable._aExtensions = [];
|
|
199
199
|
}
|
|
@@ -212,7 +212,7 @@ sap.ui.define([
|
|
|
212
212
|
if (!oTable._bExtensionsInitialized || !oTable._aExtensions) {
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
|
-
for (
|
|
215
|
+
for (let i = 0; i < oTable._aExtensions.length; i++) {
|
|
216
216
|
oTable._aExtensions[i].destroy();
|
|
217
217
|
}
|
|
218
218
|
delete oTable._aExtensions;
|
|
@@ -232,7 +232,7 @@ sap.ui.define([
|
|
|
232
232
|
return false;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
for (
|
|
235
|
+
for (let i = 0; i < oTable._aExtensions.length; i++) {
|
|
236
236
|
if (oTable._aExtensions[i].getMetadata().getName() === sExtensionFullName) {
|
|
237
237
|
return true;
|
|
238
238
|
}
|
|
@@ -29,9 +29,9 @@ sap.ui.define([
|
|
|
29
29
|
* Allows to selectively forward the events to the item navigation.
|
|
30
30
|
* "this" in the function context is the table instance
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
const ItemNavigationDelegate = {
|
|
33
33
|
_forward: function(oTable, oEvent) {
|
|
34
|
-
|
|
34
|
+
const oIN = oTable._getItemNavigation();
|
|
35
35
|
|
|
36
36
|
if (oIN != null
|
|
37
37
|
&& !oTable._getKeyboardExtension().isItemNavigationSuspended()
|
|
@@ -60,7 +60,7 @@ sap.ui.define([
|
|
|
60
60
|
* Event handling which is independent of the used keyboard delegate.
|
|
61
61
|
* "this" in the function context is the table instance.
|
|
62
62
|
*/
|
|
63
|
-
|
|
63
|
+
const ExtensionDelegate = {
|
|
64
64
|
onBeforeRendering: function(oEvent) {
|
|
65
65
|
/*
|
|
66
66
|
* In a normal rendering, the process is as follows:
|
|
@@ -82,7 +82,7 @@ sap.ui.define([
|
|
|
82
82
|
this._oStoredFocusInfo = this.getFocusInfo();
|
|
83
83
|
},
|
|
84
84
|
onAfterRendering: function(oEvent) {
|
|
85
|
-
|
|
85
|
+
const bRenderedRows = oEvent && oEvent.isMarked("renderRows");
|
|
86
86
|
|
|
87
87
|
this._getKeyboardExtension().invalidateItemNavigation();
|
|
88
88
|
|
|
@@ -99,7 +99,7 @@ sap.ui.define([
|
|
|
99
99
|
delete this._oStoredFocusInfo;
|
|
100
100
|
},
|
|
101
101
|
onfocusin: function(oEvent) {
|
|
102
|
-
|
|
102
|
+
const oExtension = this._getKeyboardExtension();
|
|
103
103
|
|
|
104
104
|
if (!oExtension._bIgnoreFocusIn) {
|
|
105
105
|
ExtensionHelper.initItemNavigation(this._getKeyboardExtension());
|
|
@@ -119,7 +119,7 @@ sap.ui.define([
|
|
|
119
119
|
/*
|
|
120
120
|
* Provides utility functions used this extension
|
|
121
121
|
*/
|
|
122
|
-
|
|
122
|
+
const ExtensionHelper = {
|
|
123
123
|
initItemNavigation: function(oExtension, bSkipInitFocusedIndex) {
|
|
124
124
|
if (ExtensionHelper.isItemNavigationInvalid(oExtension)) {
|
|
125
125
|
ExtensionHelper._initItemNavigation(oExtension, bSkipInitFocusedIndex);
|
|
@@ -131,23 +131,23 @@ sap.ui.define([
|
|
|
131
131
|
* TabIndexes are set by the ItemNavigation.
|
|
132
132
|
*/
|
|
133
133
|
_initItemNavigation: function(oExtension, bSkipInitFocusedIndex) {
|
|
134
|
-
|
|
134
|
+
const oTable = oExtension.getTable();
|
|
135
135
|
|
|
136
136
|
if (!oTable) {
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
140
|
+
const $Table = oTable.$();
|
|
141
|
+
const iRowCount = oTable.getRows().length;
|
|
142
|
+
let iColumnCount = TableUtils.getVisibleColumnCount(oTable);
|
|
143
|
+
const bHasRowHeader = TableUtils.hasRowHeader(oTable);
|
|
144
|
+
const bHasRowActions = TableUtils.hasRowActions(oTable);
|
|
145
|
+
const bHasFixedColumns = TableUtils.hasFixedColumns(oTable);
|
|
146
|
+
let i;
|
|
147
147
|
|
|
148
148
|
// create the list of item dom refs
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
let aItemDomRefs = [];
|
|
150
|
+
let aRowHdrDomRefs; let aRowActionDomRefs; let $topLeft; let $middleLeft; let $bottomLeft;
|
|
151
151
|
|
|
152
152
|
if (bHasFixedColumns) {
|
|
153
153
|
$topLeft = $Table.find(".sapUiTableCtrlFixed.sapUiTableCtrlRowFixed:not(.sapUiTableCHT)");
|
|
@@ -155,9 +155,9 @@ sap.ui.define([
|
|
|
155
155
|
$bottomLeft = $Table.find(".sapUiTableCtrlFixed.sapUiTableCtrlRowFixedBottom:not(.sapUiTableCHT)");
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
const $topRight = $Table.find(".sapUiTableCtrlScroll.sapUiTableCtrlRowFixed:not(.sapUiTableCHT)");
|
|
159
|
+
const $middleRight = $Table.find(".sapUiTableCtrlScroll.sapUiTableCtrlRowScroll:not(.sapUiTableCHT)");
|
|
160
|
+
const $bottomRight = $Table.find(".sapUiTableCtrlScroll.sapUiTableCtrlRowFixedBottom:not(.sapUiTableCHT)");
|
|
161
161
|
|
|
162
162
|
if (bHasRowHeader) {
|
|
163
163
|
aRowHdrDomRefs = $Table.find(".sapUiTableRowSelectionCell").get();
|
|
@@ -192,13 +192,13 @@ sap.ui.define([
|
|
|
192
192
|
|
|
193
193
|
// add the column headers and select all
|
|
194
194
|
if (oTable.getColumnHeaderVisible()) {
|
|
195
|
-
|
|
195
|
+
let aHeaderDomRefs = [];
|
|
196
196
|
|
|
197
197
|
// Returns the .sapUiTableColHdr elements (.sapUiTableColHdrCnt .sapUiTableCtrlFixed .sapUiTableColHdrTr)
|
|
198
|
-
|
|
198
|
+
const $FixedHeaders = $Table.find(".sapUiTableCHT.sapUiTableCtrlFixed>tbody>tr");
|
|
199
199
|
// Returns the .sapUiTableColHdr elements (.sapUiTableColHdrCnt .sapUiTableCtrlScr .sapUiTableColHdrTr)
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
const $ScrollHeaders = $Table.find(".sapUiTableCHT.sapUiTableCtrlScroll>tbody>tr");
|
|
201
|
+
const iHeaderRowCount = TableUtils.getHeaderRowCount(oTable);
|
|
202
202
|
|
|
203
203
|
for (i = 0; i < iHeaderRowCount; i++) {
|
|
204
204
|
if (bHasRowHeader) {
|
|
@@ -227,7 +227,7 @@ sap.ui.define([
|
|
|
227
227
|
oExtension._itemNavigation = new ItemNavigation();
|
|
228
228
|
oExtension._itemNavigation.setTableMode(true);
|
|
229
229
|
oExtension._itemNavigation.attachEvent(ItemNavigation.Events.AfterFocus, function(oEvent) {
|
|
230
|
-
|
|
230
|
+
const oInfo = TableUtils.getFocusedItemInfo(oTable);
|
|
231
231
|
oInfo.header = TableUtils.getHeaderRowCount(oTable);
|
|
232
232
|
oInfo.domRef = null; //Do not keep dom references
|
|
233
233
|
|
|
@@ -267,12 +267,12 @@ sap.ui.define([
|
|
|
267
267
|
* @class Extension for sap.ui.table.Table which handles keyboard related things.
|
|
268
268
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
269
269
|
* @author SAP SE
|
|
270
|
-
* @version 1.
|
|
270
|
+
* @version 1.124.0
|
|
271
271
|
* @constructor
|
|
272
272
|
* @private
|
|
273
273
|
* @alias sap.ui.table.extensions.Keyboard
|
|
274
274
|
*/
|
|
275
|
-
|
|
275
|
+
const KeyboardExtension = ExtensionBase.extend("sap.ui.table.extensions.Keyboard",
|
|
276
276
|
/** @lends sap.ui.table.extensions.Keyboard.prototype */ {
|
|
277
277
|
/**
|
|
278
278
|
* @override
|
|
@@ -322,7 +322,7 @@ sap.ui.define([
|
|
|
322
322
|
*/
|
|
323
323
|
destroy: function() {
|
|
324
324
|
// Deregister the delegates
|
|
325
|
-
|
|
325
|
+
const oTable = this.getTable();
|
|
326
326
|
if (oTable) {
|
|
327
327
|
oTable.removeEventDelegate(ExtensionDelegate);
|
|
328
328
|
oTable.removeEventDelegate(this._delegate);
|
|
@@ -400,8 +400,8 @@ sap.ui.define([
|
|
|
400
400
|
* @param {HTMLElement} oPreviousFocusRef The previously focused element.
|
|
401
401
|
*/
|
|
402
402
|
KeyboardExtension.prototype.updateNoDataAndOverlayFocus = function() {
|
|
403
|
-
|
|
404
|
-
|
|
403
|
+
const oTable = this.getTable();
|
|
404
|
+
const oActiveElement = document.activeElement;
|
|
405
405
|
|
|
406
406
|
if (!oTable || !oTable.getDomRef()) {
|
|
407
407
|
return;
|
|
@@ -449,7 +449,7 @@ sap.ui.define([
|
|
|
449
449
|
|
|
450
450
|
function restoreFocusToDataCell(oTable, oKeyboardExtension) {
|
|
451
451
|
if (!jQuery(oKeyboardExtension._oLastFocus.Ref).hasClass("sapUiTableCell")) {
|
|
452
|
-
|
|
452
|
+
const oParentCell = TableUtils.getParentCell(oTable, oKeyboardExtension._oLastFocus.Ref);
|
|
453
453
|
|
|
454
454
|
if (oParentCell && oParentCell[0] && jQuery(oParentCell[0]).hasClass("sapUiTableCell")) {
|
|
455
455
|
oParentCell[0].focus();
|
|
@@ -504,10 +504,10 @@ sap.ui.define([
|
|
|
504
504
|
* @returns {sap.ui.table.utils.TableUtils.FocusedItemInfo} The cell info of the last focused cell.
|
|
505
505
|
*/
|
|
506
506
|
KeyboardExtension.prototype.getLastFocusedCellInfo = function() {
|
|
507
|
-
|
|
508
|
-
if (!this._oLastFocusedCellInfo || this._oLastFocusedCellInfo.header
|
|
509
|
-
|
|
510
|
-
|
|
507
|
+
const iHeader = TableUtils.getHeaderRowCount(this.getTable());
|
|
508
|
+
if (!this._oLastFocusedCellInfo || this._oLastFocusedCellInfo.header !== iHeader) {
|
|
509
|
+
const oInfo = TableUtils.getFocusedItemInfo(this.getTable());
|
|
510
|
+
const iDfltIdx = ExtensionHelper.getInitialItemNavigationIndex(this);
|
|
511
511
|
|
|
512
512
|
return {
|
|
513
513
|
cellInRow: iDfltIdx,
|
|
@@ -542,17 +542,17 @@ sap.ui.define([
|
|
|
542
542
|
return;
|
|
543
543
|
}
|
|
544
544
|
|
|
545
|
-
|
|
546
|
-
|
|
545
|
+
const oTable = this.getTable();
|
|
546
|
+
const oCellInfo = TableUtils.getCellInfo(oElement);
|
|
547
547
|
|
|
548
548
|
if (oCellInfo.isOfType(TableUtils.CELLTYPE.ANY) && oTable) {
|
|
549
|
-
|
|
549
|
+
const $Elem = jQuery(oElement);
|
|
550
550
|
|
|
551
|
-
if ($Elem.attr("tabindex")
|
|
552
|
-
|
|
551
|
+
if ($Elem.attr("tabindex") !== "0") {
|
|
552
|
+
const oItemNav = oTable._getItemNavigation();
|
|
553
553
|
|
|
554
554
|
if (oItemNav && oItemNav.aItemDomRefs) {
|
|
555
|
-
for (
|
|
555
|
+
for (let i = 0; i < oItemNav.aItemDomRefs.length; i++) {
|
|
556
556
|
if (oItemNav.aItemDomRefs[i]) {
|
|
557
557
|
oItemNav.aItemDomRefs[i].setAttribute("tabindex", "-1");
|
|
558
558
|
}
|