@openui5/sap.ui.table 1.123.1 → 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
|
@@ -20,33 +20,33 @@ sap.ui.define([
|
|
|
20
20
|
"use strict";
|
|
21
21
|
|
|
22
22
|
// shortcuts
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const SelectionMode = library.SelectionMode;
|
|
24
|
+
const SelectionBehavior = library.SelectionBehavior;
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
const KNOWNCLICKABLECONTROLS = [
|
|
27
27
|
"sapMBtnBase", "sapMInputBase", "sapMLnk", "sapMSlt",
|
|
28
28
|
"sapMCb", "sapMRI", "sapMSegBBtn", "sapUiIconPointer", "sapMBtnIcon", "sapMObjStatusActive"];
|
|
29
29
|
|
|
30
30
|
/*
|
|
31
31
|
* Provides utility functions used this extension
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
const ExtensionHelper = {
|
|
34
34
|
|
|
35
35
|
/*
|
|
36
36
|
* Returns the pageX and pageY position of the given mouse/touch event.
|
|
37
37
|
*/
|
|
38
38
|
_getEventPosition: function(oEvent, oTable) {
|
|
39
|
-
|
|
39
|
+
const oPosition = getTouchObject(oEvent) || oEvent;
|
|
40
40
|
|
|
41
41
|
function getTouchObject(oTouchEvent) {
|
|
42
42
|
if (!oTable._isTouchEvent(oTouchEvent)) {
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
const aTouchEventObjectNames = ["touches", "targetTouches", "changedTouches"];
|
|
47
47
|
|
|
48
|
-
for (
|
|
49
|
-
|
|
48
|
+
for (let i = 0; i < aTouchEventObjectNames.length; i++) {
|
|
49
|
+
const sTouchEventObjectName = aTouchEventObjectNames[i];
|
|
50
50
|
|
|
51
51
|
if (oEvent[sTouchEventObjectName] && oEvent[sTouchEventObjectName][0]) {
|
|
52
52
|
return oEvent[sTouchEventObjectName][0];
|
|
@@ -59,8 +59,6 @@ sap.ui.define([
|
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
oPosition = getTouchObject(oEvent) || oEvent;
|
|
63
|
-
|
|
64
62
|
return {x: oPosition.pageX, y: oPosition.pageY};
|
|
65
63
|
},
|
|
66
64
|
|
|
@@ -79,11 +77,11 @@ sap.ui.define([
|
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
// Special handling for known clickable controls
|
|
82
|
-
|
|
80
|
+
const oClickedControl = Element.closestTo($Target[0]);
|
|
83
81
|
if (oClickedControl) {
|
|
84
|
-
|
|
82
|
+
const $ClickedControl = oClickedControl.$();
|
|
85
83
|
if ($ClickedControl.length) {
|
|
86
|
-
for (
|
|
84
|
+
for (let i = 0; i < KNOWNCLICKABLECONTROLS.length; i++) {
|
|
87
85
|
if ($ClickedControl.hasClass(KNOWNCLICKABLECONTROLS[i])) {
|
|
88
86
|
return typeof oClickedControl.getEnabled === "function" ? oClickedControl.getEnabled() : true;
|
|
89
87
|
}
|
|
@@ -99,7 +97,7 @@ sap.ui.define([
|
|
|
99
97
|
*/
|
|
100
98
|
_handleClickSelection: function(oEvent, $Cell, oTable) {
|
|
101
99
|
TableUtils.toggleRowSelection(oTable, $Cell, null, function(oRow) {
|
|
102
|
-
|
|
100
|
+
const oSelectionPlugin = oTable._getSelectionPlugin();
|
|
103
101
|
|
|
104
102
|
if (oEvent.shiftKey) { // Range
|
|
105
103
|
oSelectionPlugin.setSelected(oRow, true, {range: true});
|
|
@@ -115,7 +113,7 @@ sap.ui.define([
|
|
|
115
113
|
/*
|
|
116
114
|
* Provides helper functionality (e.g. drag&drop capabilities) for column resizing.
|
|
117
115
|
*/
|
|
118
|
-
|
|
116
|
+
const ColumnResizeHelper = {
|
|
119
117
|
|
|
120
118
|
/*
|
|
121
119
|
* Initializes the drag&drop for resizing
|
|
@@ -130,8 +128,8 @@ sap.ui.define([
|
|
|
130
128
|
oTable._iColumnResizeStart = ExtensionHelper._getEventPosition(oEvent, oTable).x;
|
|
131
129
|
oTable.$().toggleClass("sapUiTableResizing", true);
|
|
132
130
|
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
const $Document = jQuery(document);
|
|
132
|
+
const bTouch = oTable._isTouchEvent(oEvent);
|
|
135
133
|
|
|
136
134
|
oTable._$colResize = oTable.$("rsz");
|
|
137
135
|
|
|
@@ -147,15 +145,15 @@ sap.ui.define([
|
|
|
147
145
|
* Drops the previous dragged column resize bar and recalculates the new column width.
|
|
148
146
|
*/
|
|
149
147
|
exitColumnResizing: function(oEvent) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
148
|
+
const iLocationX = ExtensionHelper._getEventPosition(oEvent, this).x;
|
|
149
|
+
const oColumn = this._getVisibleColumns()[this._iLastHoveredVisibleColumnIndex];
|
|
150
|
+
const $RelevantColumnElement = this.$().find("th[data-sap-ui-colid=\"" + oColumn.getId() + "\"]"); // Consider span and multi-header
|
|
151
|
+
const iColumnWidth = $RelevantColumnElement[0].offsetWidth; // the width of the column with padding and border
|
|
152
|
+
const iInnerWidth = $RelevantColumnElement.width(); // the content width of the column without padding and border
|
|
153
|
+
const iPaddingAndBorder = iColumnWidth - iInnerWidth;
|
|
154
|
+
const iDeltaX = iLocationX - ($RelevantColumnElement.offset().left + (this._bRtlMode ? 0 : iColumnWidth));
|
|
155
|
+
const iCalculatedColumnWidth = Math.round(iColumnWidth + iDeltaX * (this._bRtlMode ? -1 : 1)) - iPaddingAndBorder;
|
|
156
|
+
const iNewColumnWidth = Math.max(iCalculatedColumnWidth, TableUtils.Column.getMinColumnWidth());
|
|
159
157
|
|
|
160
158
|
ColumnResizeHelper._resizeColumn(this, this._iLastHoveredVisibleColumnIndex, this._bColumnResizerMoved ? iNewColumnWidth : null);
|
|
161
159
|
},
|
|
@@ -164,9 +162,9 @@ sap.ui.define([
|
|
|
164
162
|
* Handler for the move events while dragging the column resize bar.
|
|
165
163
|
*/
|
|
166
164
|
onMouseMoveWhileColumnResizing: function(oEvent) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
165
|
+
const iLocationX = ExtensionHelper._getEventPosition(oEvent, this).x;
|
|
166
|
+
const iRszOffsetLeft = this.$().find(".sapUiTableCnt").offset().left;
|
|
167
|
+
const iRszLeft = Math.floor(iLocationX - iRszOffsetLeft);
|
|
170
168
|
|
|
171
169
|
if (!this._bColumnResizerMoved && Math.abs(iLocationX - this._iColumnResizeStart) >= 5) {
|
|
172
170
|
this._bColumnResizerMoved = true;
|
|
@@ -193,7 +191,7 @@ sap.ui.define([
|
|
|
193
191
|
oTable.$().toggleClass("sapUiTableResizing", false);
|
|
194
192
|
oTable._enableTextSelection();
|
|
195
193
|
|
|
196
|
-
|
|
194
|
+
const $Document = jQuery(document);
|
|
197
195
|
$Document.off("touchmove.sapUiTableColumnResize");
|
|
198
196
|
$Document.off("touchend.sapUiTableColumnResize");
|
|
199
197
|
$Document.off("mousemove.sapUiTableColumnResize");
|
|
@@ -204,8 +202,8 @@ sap.ui.define([
|
|
|
204
202
|
* Cleans up the state which is created while resize a column via drag&drop and recalculates the new column width.
|
|
205
203
|
*/
|
|
206
204
|
_resizeColumn: function(oTable, iColIndex, iNewWidth) {
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
const aVisibleColumns = oTable._getVisibleColumns();
|
|
206
|
+
let oColumn;
|
|
209
207
|
|
|
210
208
|
if (iColIndex >= 0 && iColIndex < aVisibleColumns.length) {
|
|
211
209
|
oColumn = aVisibleColumns[iColIndex];
|
|
@@ -224,8 +222,8 @@ sap.ui.define([
|
|
|
224
222
|
* Experimental feature.
|
|
225
223
|
*/
|
|
226
224
|
doAutoResizeColumn: function(oTable, iColIndex) {
|
|
227
|
-
|
|
228
|
-
|
|
225
|
+
const aVisibleColumns = oTable._getVisibleColumns();
|
|
226
|
+
let oColumn;
|
|
229
227
|
|
|
230
228
|
if (iColIndex >= 0 && iColIndex < aVisibleColumns.length) {
|
|
231
229
|
oColumn = aVisibleColumns[iColIndex];
|
|
@@ -233,7 +231,7 @@ sap.ui.define([
|
|
|
233
231
|
return;
|
|
234
232
|
}
|
|
235
233
|
|
|
236
|
-
|
|
234
|
+
const iNewWidth = ColumnResizeHelper._calculateAutomaticColumnWidth.apply(oTable, [oColumn, iColIndex]);
|
|
237
235
|
if (iNewWidth) {
|
|
238
236
|
ColumnResizeHelper._resizeColumn(oTable, iColIndex, iNewWidth);
|
|
239
237
|
}
|
|
@@ -250,19 +248,19 @@ sap.ui.define([
|
|
|
250
248
|
*/
|
|
251
249
|
_calculateAutomaticColumnWidth: function(oCol, iColIndex) {
|
|
252
250
|
oCol = oCol || this.getColumns()[iColIndex];
|
|
253
|
-
|
|
254
|
-
|
|
251
|
+
const $this = this.$();
|
|
252
|
+
const $hiddenArea = jQuery("<div>").addClass("sapUiTableHiddenSizeDetector sapUiTableHeaderDataCell sapUiTableDataCell");
|
|
255
253
|
$this.append($hiddenArea);
|
|
256
254
|
|
|
257
255
|
// Create a copy of all visible cells in the column, including the header cells without colspan
|
|
258
|
-
|
|
256
|
+
const $cells = $this.find("td[data-sap-ui-colid = \"" + oCol.getId() + "\"]:not([colspan])")
|
|
259
257
|
.filter(function(index, element) {
|
|
260
|
-
return element.style.display
|
|
258
|
+
return element.style.display !== "none";
|
|
261
259
|
}).children().clone();
|
|
262
260
|
$cells.removeAttr("id"); // remove all id attributes
|
|
263
261
|
|
|
264
262
|
// Determine the column width
|
|
265
|
-
|
|
263
|
+
let iWidth = $hiddenArea.append($cells).width() + 4; // widest cell + 4px for borders, padding and rounding
|
|
266
264
|
iWidth = Math.min(iWidth, $this.find(".sapUiTableCnt").width()); // no wider as the table
|
|
267
265
|
iWidth = Math.max(iWidth + 4, TableUtils.Column.getMinColumnWidth()); // not to small
|
|
268
266
|
|
|
@@ -277,18 +275,19 @@ sap.ui.define([
|
|
|
277
275
|
initColumnTracking: function(oTable) {
|
|
278
276
|
// attach mousemove listener to update resizer position
|
|
279
277
|
oTable.$().find(".sapUiTableCtrlScr, .sapUiTableCtrlScrFixed").on("mousemove", function(oEvent) {
|
|
280
|
-
|
|
278
|
+
const oDomRef = this.getDomRef("sapUiTableCnt");
|
|
279
|
+
|
|
281
280
|
if (!oDomRef || this._bIsColumnResizerMoving) {
|
|
282
281
|
return;
|
|
283
282
|
}
|
|
284
283
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
const iPositionX = oEvent.clientX;
|
|
285
|
+
const iTableRect = oDomRef.getBoundingClientRect();
|
|
286
|
+
let iLastHoveredColumn = 0;
|
|
287
|
+
let iResizerPositionX = this._bRtlMode ? 10000 : -10000;
|
|
289
288
|
|
|
290
|
-
for (
|
|
291
|
-
|
|
289
|
+
for (let i = 0; i < this._aTableHeaders.length; i++) {
|
|
290
|
+
const oTableHeaderRect = this._aTableHeaders[i].getBoundingClientRect();
|
|
292
291
|
if (this._bRtlMode) {
|
|
293
292
|
// 5px for resizer width
|
|
294
293
|
if ((iPositionX < oTableHeaderRect.right - 5) && (iPositionX >= oTableHeaderRect.left)) {
|
|
@@ -306,7 +305,7 @@ sap.ui.define([
|
|
|
306
305
|
}
|
|
307
306
|
}
|
|
308
307
|
|
|
309
|
-
|
|
308
|
+
const oColumn = this._getVisibleColumns()[iLastHoveredColumn];
|
|
310
309
|
if (oColumn && oColumn.getResizable()) {
|
|
311
310
|
this.$("rsz").css("left", iResizerPositionX + "px");
|
|
312
311
|
this._iLastHoveredVisibleColumnIndex = iLastHoveredColumn;
|
|
@@ -318,21 +317,21 @@ sap.ui.define([
|
|
|
318
317
|
/*
|
|
319
318
|
* Provides drag&drop capabilities for column reordering.
|
|
320
319
|
*/
|
|
321
|
-
|
|
320
|
+
const ReorderHelper = {
|
|
322
321
|
|
|
323
322
|
/*
|
|
324
323
|
* Initializes the drag&drop for reordering
|
|
325
324
|
*/
|
|
326
325
|
initReordering: function(oTable, iColIndex, oEvent) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
326
|
+
const oColumn = oTable.getColumns()[iColIndex];
|
|
327
|
+
const $Col = oColumn.$();
|
|
328
|
+
const $Table = oTable.$();
|
|
330
329
|
|
|
331
330
|
oTable._disableTextSelection();
|
|
332
331
|
$Table.addClass("sapUiTableDragDrop");
|
|
333
332
|
|
|
334
333
|
// Initialize the Ghost
|
|
335
|
-
|
|
334
|
+
const $Ghost = $Col.clone();
|
|
336
335
|
$Ghost.find("*").addBack($Ghost).removeAttr("id")
|
|
337
336
|
.removeAttr("data-sap-ui")
|
|
338
337
|
.removeAttr("tabindex");
|
|
@@ -351,7 +350,7 @@ sap.ui.define([
|
|
|
351
350
|
$Table.find("td[data-sap-ui-colid='" + oColumn.getId() + "']").toggleClass("sapUiTableColReorderFade", true);
|
|
352
351
|
|
|
353
352
|
// Initialize the Indicator where to insert
|
|
354
|
-
|
|
353
|
+
const $Indicator = jQuery("<div id='" + oTable.getId()
|
|
355
354
|
+ "-roind' class='sapUiTableColReorderIndicator'><div class='sapUiTableColReorderIndicatorArrow'></div><div class='sapUiTableColReorderIndicatorInner'></div></div>");
|
|
356
355
|
$Indicator.appendTo(oTable.getDomRef("sapUiTableCnt"));
|
|
357
356
|
oTable._$ReorderIndicator = oTable.getDomRef("roind");
|
|
@@ -360,8 +359,8 @@ sap.ui.define([
|
|
|
360
359
|
oTable._iDnDColIndex = iColIndex;
|
|
361
360
|
|
|
362
361
|
// Bind the event handlers
|
|
363
|
-
|
|
364
|
-
|
|
362
|
+
const $Document = jQuery(document);
|
|
363
|
+
const bTouch = oTable._isTouchEvent(oEvent);
|
|
365
364
|
$Document.on((bTouch ? "touchend" : "mouseup") + ".sapUiColumnMove", ReorderHelper.exitReordering.bind(oTable));
|
|
366
365
|
$Document.on((bTouch ? "touchmove" : "mousemove") + ".sapUiColumnMove", ReorderHelper.onMouseMoveWhileReordering.bind(oTable));
|
|
367
366
|
},
|
|
@@ -371,16 +370,16 @@ sap.ui.define([
|
|
|
371
370
|
* Reposition the ghost.
|
|
372
371
|
*/
|
|
373
372
|
onMouseMoveWhileReordering: function(oEvent) {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
373
|
+
const oEventPosition = ExtensionHelper._getEventPosition(oEvent, this);
|
|
374
|
+
const iLocationX = oEventPosition.x;
|
|
375
|
+
const iLocationY = oEventPosition.y;
|
|
376
|
+
const iOldColPos = this._iNewColPos;
|
|
378
377
|
|
|
379
378
|
this._iNewColPos = this._iDnDColIndex;
|
|
380
379
|
|
|
381
380
|
oEvent.preventDefault(); // Avoid default actions e.g. scrolling on mobile devices
|
|
382
381
|
|
|
383
|
-
|
|
382
|
+
const oPos = ReorderHelper.findColumnForPosition(this, iLocationX);
|
|
384
383
|
|
|
385
384
|
if (!oPos || !oPos.id) {
|
|
386
385
|
//Special handling for dummy column (in case the other columns does not occupy the whole space),
|
|
@@ -390,12 +389,12 @@ sap.ui.define([
|
|
|
390
389
|
}
|
|
391
390
|
|
|
392
391
|
// do scroll if needed
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
392
|
+
const iScrollTriggerAreaWidth = 40;
|
|
393
|
+
const oScrollArea = this.getDomRef("sapUiTableColHdrScr");
|
|
394
|
+
const $ScrollArea = jQuery(oScrollArea);
|
|
395
|
+
const oScrollAreaRect = oScrollArea.getBoundingClientRect();
|
|
396
|
+
const iScrollAreaWidth = $ScrollArea.outerWidth();
|
|
397
|
+
const iScrollAreaScrollLeft = this._bRtlMode ? $ScrollArea.scrollLeftRTL() : $ScrollArea.scrollLeft();
|
|
399
398
|
|
|
400
399
|
this._bReorderScroll = false;
|
|
401
400
|
|
|
@@ -421,9 +420,9 @@ sap.ui.define([
|
|
|
421
420
|
return;
|
|
422
421
|
}
|
|
423
422
|
|
|
424
|
-
if (oPos.before || (oPos.after && oPos.index
|
|
423
|
+
if (oPos.before || (oPos.after && oPos.index === this._iDnDColIndex)) {
|
|
425
424
|
this._iNewColPos = oPos.index;
|
|
426
|
-
} else if (oPos.after && oPos.index
|
|
425
|
+
} else if (oPos.after && oPos.index !== this._iDnDColIndex) {
|
|
427
426
|
this._iNewColPos = oPos.index + 1;
|
|
428
427
|
}
|
|
429
428
|
|
|
@@ -438,11 +437,11 @@ sap.ui.define([
|
|
|
438
437
|
* Ends the column reordering process via drag&drop.
|
|
439
438
|
*/
|
|
440
439
|
exitReordering: function(oEvent) {
|
|
441
|
-
|
|
442
|
-
|
|
440
|
+
const iOldIndex = this._iDnDColIndex;
|
|
441
|
+
const iNewIndex = this._iNewColPos;
|
|
443
442
|
|
|
444
443
|
// Unbind the event handlers
|
|
445
|
-
|
|
444
|
+
const $Document = jQuery(document);
|
|
446
445
|
$Document.off("touchmove.sapUiColumnMove");
|
|
447
446
|
$Document.off("touchend.sapUiColumnMove");
|
|
448
447
|
$Document.off("mousemove.sapUiColumnMove");
|
|
@@ -469,9 +468,9 @@ sap.ui.define([
|
|
|
469
468
|
* Finds the column which belongs to the current x position and returns information about this column.
|
|
470
469
|
*/
|
|
471
470
|
findColumnForPosition: function(oTable, iLocationX) {
|
|
472
|
-
|
|
471
|
+
let oHeaderDomRef; let $HeaderDomRef; let oRect; let iWidth; let oPos; let bBefore; let bAfter;
|
|
473
472
|
|
|
474
|
-
for (
|
|
473
|
+
for (let i = 0; i < oTable._aTableHeaders.length; i++) {
|
|
475
474
|
oHeaderDomRef = oTable._aTableHeaders[i];
|
|
476
475
|
$HeaderDomRef = jQuery(oHeaderDomRef);
|
|
477
476
|
oRect = oHeaderDomRef.getBoundingClientRect();
|
|
@@ -507,13 +506,13 @@ sap.ui.define([
|
|
|
507
506
|
oTable._mTimeouts.horizontalReorderScrollTimerId = null;
|
|
508
507
|
}
|
|
509
508
|
if (oTable._bReorderScroll) {
|
|
510
|
-
|
|
509
|
+
let iStep = bForward ? 30 : -30;
|
|
511
510
|
if (oTable._bRtlMode) {
|
|
512
511
|
iStep = (-1) * iStep;
|
|
513
512
|
}
|
|
514
513
|
oTable._mTimeouts.horizontalReorderScrollTimerId = setTimeout(ReorderHelper.doScroll.bind(oTable, oTable, bForward), 60);
|
|
515
|
-
|
|
516
|
-
|
|
514
|
+
const $Scr = oTable.$("sapUiTableColHdrScr");
|
|
515
|
+
const ScrollLeft = oTable._bRtlMode ? "scrollLeftRTL" : "scrollLeft";
|
|
517
516
|
$Scr[ScrollLeft]($Scr[ScrollLeft]() + iStep);
|
|
518
517
|
}
|
|
519
518
|
},
|
|
@@ -527,7 +526,7 @@ sap.ui.define([
|
|
|
527
526
|
return;
|
|
528
527
|
}
|
|
529
528
|
|
|
530
|
-
|
|
529
|
+
let iLeft = oPos.left - oTable.getDomRef().getBoundingClientRect().left;
|
|
531
530
|
if (oTable._bRtlMode && oPos.before || !oTable._bRtlMode && oPos.after) {
|
|
532
531
|
iLeft = iLeft + oPos.width;
|
|
533
532
|
}
|
|
@@ -542,7 +541,7 @@ sap.ui.define([
|
|
|
542
541
|
/*
|
|
543
542
|
* Provides the event handling for the row hover effect.
|
|
544
543
|
*/
|
|
545
|
-
|
|
544
|
+
const RowHoverHandler = {
|
|
546
545
|
|
|
547
546
|
ROWAREAS: [
|
|
548
547
|
".sapUiTableRowSelectionCell", ".sapUiTableRowActionCell", ".sapUiTableCtrlFixed > tbody > .sapUiTableTr",
|
|
@@ -550,7 +549,7 @@ sap.ui.define([
|
|
|
550
549
|
],
|
|
551
550
|
|
|
552
551
|
initRowHovering: function(oTable) {
|
|
553
|
-
|
|
552
|
+
const $Table = oTable.$();
|
|
554
553
|
RowHoverHandler.ROWAREAS.forEach(function(sRowArea) {
|
|
555
554
|
RowHoverHandler._initRowHoveringForArea(oTable, $Table, sRowArea);
|
|
556
555
|
});
|
|
@@ -566,8 +565,8 @@ sap.ui.define([
|
|
|
566
565
|
|
|
567
566
|
_onHover: function(oTable, $Table, sArea, oElem) {
|
|
568
567
|
if ((oTable.getSelectionMode() !== SelectionMode.None && oTable.getSelectionBehavior() !== SelectionBehavior.RowSelector) || oTable.hasListeners("cellClick")) {
|
|
569
|
-
|
|
570
|
-
|
|
568
|
+
const iIndex = $Table.find(sArea).index(oElem);
|
|
569
|
+
const oRow = oTable.getRows()[iIndex];
|
|
571
570
|
|
|
572
571
|
if (oRow) {
|
|
573
572
|
oRow._setHovered(true);
|
|
@@ -576,8 +575,8 @@ sap.ui.define([
|
|
|
576
575
|
},
|
|
577
576
|
|
|
578
577
|
_onUnhover: function(oTable, $Table, sArea, oElem) {
|
|
579
|
-
|
|
580
|
-
|
|
578
|
+
const iIndex = $Table.find(sArea).index(oElem);
|
|
579
|
+
const oRow = oTable.getRows()[iIndex];
|
|
581
580
|
|
|
582
581
|
if (oRow) {
|
|
583
582
|
oRow._setHovered(false);
|
|
@@ -590,16 +589,16 @@ sap.ui.define([
|
|
|
590
589
|
* Event handling of touch and mouse events.
|
|
591
590
|
* "this" in the function context is the table instance.
|
|
592
591
|
*/
|
|
593
|
-
|
|
592
|
+
const ExtensionDelegate = {
|
|
594
593
|
|
|
595
594
|
onmousedown: function(oEvent) {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
595
|
+
const oPointerExtension = this._getPointerExtension();
|
|
596
|
+
const $Cell = TableUtils.getCell(this, oEvent.target);
|
|
597
|
+
const oCellInfo = TableUtils.getCellInfo($Cell);
|
|
598
|
+
const $Target = jQuery(oEvent.target);
|
|
599
|
+
let oColumn;
|
|
600
|
+
let oMenu;
|
|
601
|
+
let bMenuOpen;
|
|
603
602
|
|
|
604
603
|
// check whether item navigation should be reapplied from scratch
|
|
605
604
|
this._getKeyboardExtension().initItemNavigation();
|
|
@@ -611,7 +610,7 @@ sap.ui.define([
|
|
|
611
610
|
ColumnResizeHelper.initColumnResizing(this, oEvent);
|
|
612
611
|
|
|
613
612
|
} else if ($Target.hasClass("sapUiTableColResizer")) { // mousedown on mobile column resize button
|
|
614
|
-
|
|
613
|
+
const iColumnIndex = $Target.closest(".sapUiTableHeaderCell").attr("data-sap-ui-colindex");
|
|
615
614
|
this._iLastHoveredVisibleColumnIndex = this._getVisibleColumns().indexOf(this.getColumns()[iColumnIndex]);
|
|
616
615
|
ColumnResizeHelper.initColumnResizing(this, oEvent);
|
|
617
616
|
|
|
@@ -692,17 +691,17 @@ sap.ui.define([
|
|
|
692
691
|
return;
|
|
693
692
|
}
|
|
694
693
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
694
|
+
const $Target = jQuery(oEvent.target);
|
|
695
|
+
const $Cell = TableUtils.getCell(this, oEvent.target);
|
|
696
|
+
const oCellInfo = TableUtils.getCellInfo($Cell);
|
|
697
|
+
const oRow = this.getRows()[oCellInfo.rowIndex];
|
|
699
698
|
|
|
700
699
|
if (!oCellInfo.isOfType(TableUtils.CELLTYPE.ANY)) {
|
|
701
700
|
return;
|
|
702
701
|
}
|
|
703
702
|
|
|
704
703
|
if (oCellInfo.isOfType(TableUtils.CELLTYPE.COLUMNHEADER)) {
|
|
705
|
-
|
|
704
|
+
const oPointerExtension = this._getPointerExtension();
|
|
706
705
|
|
|
707
706
|
if (oPointerExtension._bShowMenu) {
|
|
708
707
|
TableUtils.Menu.openContextMenu(this, oEvent);
|
|
@@ -724,7 +723,7 @@ sap.ui.define([
|
|
|
724
723
|
return;
|
|
725
724
|
}
|
|
726
725
|
|
|
727
|
-
|
|
726
|
+
const sSelectedText = window.getSelection().toString();
|
|
728
727
|
if (!oEvent.shiftKey && sSelectedText.length > 0 && sSelectedText !== "\n") {
|
|
729
728
|
Log.debug("DOM Selection detected -> Click event on table skipped, Target: " + oEvent.target);
|
|
730
729
|
return;
|
|
@@ -739,7 +738,7 @@ sap.ui.define([
|
|
|
739
738
|
},
|
|
740
739
|
|
|
741
740
|
oncontextmenu: function(oEvent) {
|
|
742
|
-
|
|
741
|
+
const oPointerExtension = this._getPointerExtension();
|
|
743
742
|
|
|
744
743
|
if (oPointerExtension._bShowDefaultMenu) {
|
|
745
744
|
oEvent.setMarked("sapUiTableHandledByPointerExtension");
|
|
@@ -766,12 +765,12 @@ sap.ui.define([
|
|
|
766
765
|
* @class Extension for sap.ui.table.Table which handles mouse and touch related things.
|
|
767
766
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
768
767
|
* @author SAP SE
|
|
769
|
-
* @version 1.
|
|
768
|
+
* @version 1.124.0
|
|
770
769
|
* @constructor
|
|
771
770
|
* @private
|
|
772
771
|
* @alias sap.ui.table.extensions.Pointer
|
|
773
772
|
*/
|
|
774
|
-
|
|
773
|
+
const PointerExtension = ExtensionBase.extend("sap.ui.table.extensions.Pointer",
|
|
775
774
|
/** @lends sap.ui.table.extensions.Pointer.prototype */ {
|
|
776
775
|
/**
|
|
777
776
|
* @override
|
|
@@ -786,7 +785,7 @@ sap.ui.define([
|
|
|
786
785
|
|
|
787
786
|
oTable._iLastHoveredVisibleColumnIndex = 0;
|
|
788
787
|
oTable._bIsColumnResizerMoving = false;
|
|
789
|
-
oTable._iFirstReorderableIndex = sTableType
|
|
788
|
+
oTable._iFirstReorderableIndex = sTableType === ExtensionBase.TABLETYPES.TREE ? 1 : 0;
|
|
790
789
|
|
|
791
790
|
return "PointerExtension";
|
|
792
791
|
},
|
|
@@ -796,7 +795,7 @@ sap.ui.define([
|
|
|
796
795
|
* @inheritDoc
|
|
797
796
|
*/
|
|
798
797
|
_attachEvents: function() {
|
|
799
|
-
|
|
798
|
+
const oTable = this.getTable();
|
|
800
799
|
if (oTable) {
|
|
801
800
|
// Initialize the basic event handling for column resizing.
|
|
802
801
|
ColumnResizeHelper.initColumnTracking(oTable);
|
|
@@ -809,9 +808,9 @@ sap.ui.define([
|
|
|
809
808
|
* @inheritDoc
|
|
810
809
|
*/
|
|
811
810
|
_detachEvents: function() {
|
|
812
|
-
|
|
811
|
+
const oTable = this.getTable();
|
|
813
812
|
if (oTable) {
|
|
814
|
-
|
|
813
|
+
const $Table = oTable.$();
|
|
815
814
|
|
|
816
815
|
// Cleans up the basic event handling for column resizing (and others).
|
|
817
816
|
$Table.find(".sapUiTableCtrlScr, .sapUiTableCtrlScrFixed").off();
|
|
@@ -842,7 +841,7 @@ sap.ui.define([
|
|
|
842
841
|
* @param {int} iColIndex The index of the column to resize.
|
|
843
842
|
*/
|
|
844
843
|
doAutoResizeColumn: function(iColIndex) {
|
|
845
|
-
|
|
844
|
+
const oTable = this.getTable();
|
|
846
845
|
if (oTable) {
|
|
847
846
|
ColumnResizeHelper.doAutoResizeColumn(oTable, iColIndex);
|
|
848
847
|
}
|
|
@@ -855,7 +854,7 @@ sap.ui.define([
|
|
|
855
854
|
* @param {jQuery.Event} oEvent The event object.
|
|
856
855
|
*/
|
|
857
856
|
doReorderColumn: function(iColIndex, oEvent) {
|
|
858
|
-
|
|
857
|
+
const oTable = this.getTable();
|
|
859
858
|
if (oTable && TableUtils.Column.isColumnMovable(oTable.getColumns()[iColIndex])) {
|
|
860
859
|
// Starting column drag & drop. We wait 200ms to make sure it is no click on the column to open the menu.
|
|
861
860
|
oTable._mTimeouts.delayedColumnReorderTimerId = setTimeout(function() {
|
|
@@ -870,7 +869,7 @@ sap.ui.define([
|
|
|
870
869
|
*/
|
|
871
870
|
destroy: function() {
|
|
872
871
|
// Deregister the delegates
|
|
873
|
-
|
|
872
|
+
const oTable = this.getTable();
|
|
874
873
|
if (oTable) {
|
|
875
874
|
oTable.removeEventDelegate(this._delegate);
|
|
876
875
|
}
|