@openui5/sap.ui.table 1.124.0 → 1.125.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/.reuse/dep5 +5 -0
- package/THIRDPARTY.txt +7 -0
- 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 +34 -7
- 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 +8 -6
- package/src/sap/ui/table/TablePersoController.js +1 -1
- package/src/sap/ui/table/TableRenderer.js +1 -2
- package/src/sap/ui/table/TreeTable.js +1 -1
- package/src/sap/ui/table/extensions/Accessibility.js +1 -1
- 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 +7 -5
- package/src/sap/ui/table/extensions/Pointer.js +14 -88
- 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/library.js +11 -11
- package/src/sap/ui/table/menus/ColumnHeaderMenuAdapter.js +1 -1
- package/src/sap/ui/table/menus/MobileColumnHeaderMenuAdapter.js +1 -1
- package/src/sap/ui/table/plugins/BindingSelection.js +7 -3
- package/src/sap/ui/table/plugins/MultiSelectionPlugin.js +5 -4
- package/src/sap/ui/table/plugins/ODataV4Selection.js +4 -0
- package/src/sap/ui/table/plugins/PluginBase.js +1 -1
- package/src/sap/ui/table/plugins/SelectionModelSelection.js +6 -2
- package/src/sap/ui/table/plugins/SelectionPlugin.js +1 -1
- package/src/sap/ui/table/plugins/V4Aggregation.js +1 -1
- 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 +2 -2
- package/src/sap/ui/table/rowmodes/Variable.js +1 -1
- package/src/sap/ui/table/utils/TableUtils.js +4 -5
- package/src/sap/ui/table/utils/_BindingUtils.js +1 -1
- package/src/sap/ui/table/utils/_ColumnUtils.js +161 -37
- 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/.reuse/dep5
CHANGED
|
@@ -50,6 +50,11 @@ Copyright: Mario Heiderich
|
|
|
50
50
|
License: Apache-2.0
|
|
51
51
|
Comment: these files belong to: purify.js
|
|
52
52
|
|
|
53
|
+
Files: src/sap.m/test/sap/m/qunit/_thirdparty/qunit-composite.css src/sap.m/test/sap/m/qunit/_thirdparty/qunit-composite.js
|
|
54
|
+
Copyright: jQuery Foundation and other contributors, https://jquery.org/
|
|
55
|
+
License: MIT
|
|
56
|
+
Comment: these files belong to: QUnit Composite 2.0.0
|
|
57
|
+
|
|
53
58
|
|
|
54
59
|
# Library: sap.ui.codeeditor:
|
|
55
60
|
|
package/THIRDPARTY.txt
CHANGED
|
@@ -12,6 +12,13 @@ License: Apache-2.0
|
|
|
12
12
|
License Text: https://github.com/SAP/openui5/blob/master/LICENSES/Apache-2.0.txt
|
|
13
13
|
Contained in: src/sap.m/src/sap/m/_thirdparty/purify.js
|
|
14
14
|
|
|
15
|
+
Component: QUnit Composite 2.0.0, version: 2.0.0
|
|
16
|
+
Copyright: jQuery Foundation and other contributors, https://jquery.org/
|
|
17
|
+
License: MIT
|
|
18
|
+
License Text: https://github.com/SAP/openui5/blob/master/LICENSES/MIT.txt
|
|
19
|
+
Contained in: src/sap.m/test/sap/m/qunit/_thirdparty/qunit-composite.css
|
|
20
|
+
src/sap.m/test/sap/m/qunit/_thirdparty/qunit-composite.js
|
|
21
|
+
|
|
15
22
|
|
|
16
23
|
Library: sap.ui.codeeditor:
|
|
17
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openui5/sap.ui.table",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.125.0",
|
|
4
4
|
"description": "OpenUI5 UI Library sap.ui.table",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "https://github.com/SAP/openui5.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@openui5/sap.ui.core": "1.
|
|
18
|
-
"@openui5/sap.ui.unified": "1.
|
|
17
|
+
"@openui5/sap.ui.core": "1.125.0",
|
|
18
|
+
"@openui5/sap.ui.unified": "1.125.0"
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<copyright>OpenUI5
|
|
7
7
|
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
8
8
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.</copyright>
|
|
9
|
-
<version>1.
|
|
9
|
+
<version>1.125.0</version>
|
|
10
10
|
|
|
11
11
|
<documentation>Table-like controls, mainly for desktop scenarios.</documentation>
|
|
12
12
|
|
|
@@ -63,7 +63,7 @@ sap.ui.define([
|
|
|
63
63
|
* @class
|
|
64
64
|
* The column allows you to define column specific properties that will be applied when rendering the table.
|
|
65
65
|
* @extends sap.ui.core.Element
|
|
66
|
-
* @version 1.
|
|
66
|
+
* @version 1.125.0
|
|
67
67
|
*
|
|
68
68
|
* @constructor
|
|
69
69
|
* @public
|
|
@@ -261,12 +261,10 @@ sap.ui.define([
|
|
|
261
261
|
headerSpan: {type: "any", group: "Behavior", defaultValue: 1},
|
|
262
262
|
|
|
263
263
|
/**
|
|
264
|
-
* Enables auto-resizing of the column on double
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
* sap.ui.commons.TextView, sap.ui.commons.Label, sap.ui.commons.Link and sap.ui.commons.TextField,
|
|
269
|
-
* sap.ui.commons.Checkbox, sap.m.CheckBox</code>
|
|
264
|
+
* Enables auto-resizing of the column on double-clicking the resize bar, if the column is resizable depending on the
|
|
265
|
+
* <code>resizable</code> property.
|
|
266
|
+
* See {@link #autoResize} for details about the auto-resize feature.
|
|
267
|
+
*
|
|
270
268
|
* @since 1.21.1
|
|
271
269
|
*/
|
|
272
270
|
autoResizable: {type: "boolean", group: "Behavior", defaultValue: false}
|
|
@@ -1293,6 +1291,35 @@ sap.ui.define([
|
|
|
1293
1291
|
return CellMap.get(oCell) || null;
|
|
1294
1292
|
};
|
|
1295
1293
|
|
|
1294
|
+
/**
|
|
1295
|
+
* The column is resized to the width of the widest cell content that is currently displayed.
|
|
1296
|
+
* This can be the content of a column header cell, or a data cell.
|
|
1297
|
+
* Only rows that are currently scrolled into view are taken into consideration.
|
|
1298
|
+
* The content of cells that span multiple columns is not taken into consideration, for example, if the <code>headerSpan</code> property is used.
|
|
1299
|
+
*
|
|
1300
|
+
* The width might not be accurate if the cell content is not rendered yet, for example, because the data is still being loaded.
|
|
1301
|
+
*
|
|
1302
|
+
* This behavior only works if the cell content is one of the following controls:
|
|
1303
|
+
* <ul>
|
|
1304
|
+
* <li><code>sap.m.Text</code></li>
|
|
1305
|
+
* <li><code>sap.m.Label</code></li>
|
|
1306
|
+
* <li><code>sap.m.Link</code></li>
|
|
1307
|
+
* <li><code>sap.m.CheckBox</code></li>
|
|
1308
|
+
* </ul>
|
|
1309
|
+
* Otherwise, the width might not be accurate either. This includes cases where the listed control is wrapped in another control.
|
|
1310
|
+
*
|
|
1311
|
+
* @throws {Error} If the column is not rendered
|
|
1312
|
+
* @public
|
|
1313
|
+
* @since 1.125
|
|
1314
|
+
*/
|
|
1315
|
+
Column.prototype.autoResize = function() {
|
|
1316
|
+
if (!this.getDomRef()) {
|
|
1317
|
+
throw new Error("Column is not rendered");
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
TableUtils.Column.autoResizeColumn(this);
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1296
1323
|
return Column;
|
|
1297
1324
|
|
|
1298
1325
|
});
|
package/src/sap/ui/table/Row.js
CHANGED
|
@@ -35,7 +35,7 @@ sap.ui.define([
|
|
|
35
35
|
* If more action items are available as the available space allows to display an overflow mechanism is provided.
|
|
36
36
|
* This control must only be used in the context of the <code>sap.ui.table.Table</code> control to define row actions.
|
|
37
37
|
* @extends sap.ui.core.Control
|
|
38
|
-
* @version 1.
|
|
38
|
+
* @version 1.125.0
|
|
39
39
|
*
|
|
40
40
|
* @constructor
|
|
41
41
|
* @public
|
|
@@ -27,7 +27,7 @@ sap.ui.define([
|
|
|
27
27
|
* The <code>RowSettings</code> control allows you to configure a row.
|
|
28
28
|
* You can only use this control in the context of the <code>sap.ui.table.Table</code> control to define row settings.
|
|
29
29
|
* @extends sap.ui.core.Element
|
|
30
|
-
* @version 1.
|
|
30
|
+
* @version 1.125.0
|
|
31
31
|
*
|
|
32
32
|
* @constructor
|
|
33
33
|
* @public
|
|
@@ -100,7 +100,7 @@ sap.ui.define([
|
|
|
100
100
|
* the data model and binding being used.
|
|
101
101
|
* </p>
|
|
102
102
|
* @extends sap.ui.core.Control
|
|
103
|
-
* @version 1.
|
|
103
|
+
* @version 1.125.0
|
|
104
104
|
*
|
|
105
105
|
* @constructor
|
|
106
106
|
* @public
|
|
@@ -2628,9 +2628,15 @@ sap.ui.define([
|
|
|
2628
2628
|
* @param {int} iColIndex The index of the column in the list of visible columns.
|
|
2629
2629
|
* @function
|
|
2630
2630
|
* @public
|
|
2631
|
+
* @deprecated As of version 1.125, replaced by {@link sap.ui.table.Column#autoResize}
|
|
2631
2632
|
*/
|
|
2632
2633
|
Table.prototype.autoResizeColumn = function(iColIndex) {
|
|
2633
|
-
this.
|
|
2634
|
+
const aVisibleColumns = this._getVisibleColumns();
|
|
2635
|
+
const oColumn = aVisibleColumns[iColIndex];
|
|
2636
|
+
|
|
2637
|
+
if (oColumn?.getResizable() && oColumn?.getAutoResizable()) {
|
|
2638
|
+
oColumn.autoResize();
|
|
2639
|
+
}
|
|
2634
2640
|
};
|
|
2635
2641
|
|
|
2636
2642
|
// =============================================================================
|
|
@@ -3175,10 +3181,6 @@ sap.ui.define([
|
|
|
3175
3181
|
|
|
3176
3182
|
$SelectAll.toggleClass("sapUiTableSelAll", !bAllRowsSelected);
|
|
3177
3183
|
this._getAccExtension().setSelectAllState(bAllRowsSelected);
|
|
3178
|
-
|
|
3179
|
-
const sSelectAllResourceTextID = bAllRowsSelected ? "TBL_DESELECT_ALL" : "TBL_SELECT_ALL";
|
|
3180
|
-
const sTitle = TableUtils.getResourceText(sSelectAllResourceTextID);
|
|
3181
|
-
$SelectAll.attr('title', sTitle);
|
|
3182
3184
|
} else if (mRenderConfig.headerSelector.type === "custom") {
|
|
3183
3185
|
$SelectAll.toggleClass("sapUiTableSelAllDisabled", !mRenderConfig.headerSelector.enabled);
|
|
3184
3186
|
|
|
@@ -436,8 +436,7 @@ sap.ui.define([
|
|
|
436
436
|
const bAllRowsSelected = mRenderConfig.headerSelector.selected;
|
|
437
437
|
|
|
438
438
|
if (mRenderConfig.headerSelector.type === "toggle") {
|
|
439
|
-
|
|
440
|
-
rm.attr("title", TableUtils.getResourceText(sTitle));
|
|
439
|
+
rm.attr("title", TableUtils.getResourceText("TBL_SELECT_ALL"));
|
|
441
440
|
} else if (mRenderConfig.headerSelector.type === "custom") {
|
|
442
441
|
const sTitle = mRenderConfig.headerSelector.tooltip;
|
|
443
442
|
rm.attr("title", sTitle);
|
|
@@ -969,7 +969,7 @@ sap.ui.define([
|
|
|
969
969
|
* @class Extension for sap.ui.table.Table which handles ACC related things.
|
|
970
970
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
971
971
|
* @author SAP SE
|
|
972
|
-
* @version 1.
|
|
972
|
+
* @version 1.125.0
|
|
973
973
|
* @constructor
|
|
974
974
|
* @private
|
|
975
975
|
* @alias sap.ui.table.extensions.Accessibility
|
|
@@ -44,7 +44,7 @@ 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.125.0
|
|
48
48
|
* @constructor
|
|
49
49
|
* @private
|
|
50
50
|
* @alias sap.ui.table.extensions.AccessibilityRender
|
|
@@ -267,7 +267,7 @@ 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.125.0
|
|
271
271
|
* @constructor
|
|
272
272
|
* @private
|
|
273
273
|
* @alias sap.ui.table.extensions.Keyboard
|
|
@@ -65,7 +65,7 @@ sap.ui.define([
|
|
|
65
65
|
*
|
|
66
66
|
* @extends sap.ui.base.Object
|
|
67
67
|
* @author SAP SE
|
|
68
|
-
* @version 1.
|
|
68
|
+
* @version 1.125.0
|
|
69
69
|
* @constructor
|
|
70
70
|
* @private
|
|
71
71
|
* @alias sap.ui.table.extensions.KeyboardDelegate
|
|
@@ -1117,13 +1117,14 @@ sap.ui.define([
|
|
|
1117
1117
|
} else if (KeyboardDelegate._isKeyCombination(oEvent, KeyCodes.A, ModKey.CTRL)) {
|
|
1118
1118
|
oEvent.preventDefault(); // Prevent full page text selection.
|
|
1119
1119
|
|
|
1120
|
-
if (oCellInfo.isOfType(CellType.ANYCONTENTCELL | CellType.COLUMNROWHEADER)
|
|
1120
|
+
if (oCellInfo.isOfType(CellType.ANYCONTENTCELL | CellType.COLUMNROWHEADER)) {
|
|
1121
1121
|
oSelectionPlugin.onKeyboardShortcut("toggle", oEvent);
|
|
1122
1122
|
}
|
|
1123
1123
|
|
|
1124
1124
|
// Ctrl+Shift+A: Deselect all.
|
|
1125
1125
|
} else if (KeyboardDelegate._isKeyCombination(oEvent, KeyCodes.A, ModKey.CTRL + ModKey.SHIFT)) {
|
|
1126
1126
|
if (oCellInfo.isOfType(CellType.ANYCONTENTCELL | CellType.COLUMNROWHEADER)) {
|
|
1127
|
+
oEvent.preventDefault();
|
|
1127
1128
|
oSelectionPlugin.onKeyboardShortcut("clear", oEvent);
|
|
1128
1129
|
}
|
|
1129
1130
|
|
|
@@ -1651,8 +1652,8 @@ sap.ui.define([
|
|
|
1651
1652
|
iColumnSpanWidth += TableUtils.Column.getColumnWidth(this, i);
|
|
1652
1653
|
}
|
|
1653
1654
|
|
|
1654
|
-
|
|
1655
|
-
|
|
1655
|
+
const oColumn = this.getColumns()[oCellInfo.columnIndex];
|
|
1656
|
+
TableUtils.Column.resizeColumn(this, oColumn, iColumnSpanWidth + iResizeDelta, true, oCellInfo.columnSpan);
|
|
1656
1657
|
preventItemNavigation(oEvent);
|
|
1657
1658
|
}
|
|
1658
1659
|
|
|
@@ -1722,7 +1723,8 @@ sap.ui.define([
|
|
|
1722
1723
|
iColumnSpanWidth += TableUtils.Column.getColumnWidth(this, i);
|
|
1723
1724
|
}
|
|
1724
1725
|
|
|
1725
|
-
|
|
1726
|
+
const oColumn = this.getColumns()[oCellInfo.columnIndex];
|
|
1727
|
+
TableUtils.Column.resizeColumn(this, oColumn, iColumnSpanWidth + iResizeDelta, true, oCellInfo.columnSpan);
|
|
1726
1728
|
|
|
1727
1729
|
preventItemNavigation(oEvent);
|
|
1728
1730
|
|
|
@@ -155,7 +155,8 @@ sap.ui.define([
|
|
|
155
155
|
const iCalculatedColumnWidth = Math.round(iColumnWidth + iDeltaX * (this._bRtlMode ? -1 : 1)) - iPaddingAndBorder;
|
|
156
156
|
const iNewColumnWidth = Math.max(iCalculatedColumnWidth, TableUtils.Column.getMinColumnWidth());
|
|
157
157
|
|
|
158
|
-
ColumnResizeHelper.
|
|
158
|
+
ColumnResizeHelper._cleanupColumResizing(this);
|
|
159
|
+
TableUtils.Column.resizeColumn(this, oColumn, this._bColumnResizerMoved ? iNewColumnWidth : null);
|
|
159
160
|
},
|
|
160
161
|
|
|
161
162
|
/*
|
|
@@ -179,8 +180,10 @@ sap.ui.define([
|
|
|
179
180
|
}
|
|
180
181
|
},
|
|
181
182
|
|
|
182
|
-
|
|
183
|
-
* Cleans up the state which is created while
|
|
183
|
+
/**
|
|
184
|
+
* Cleans up the state which is created while resizing a column via drag&drop.
|
|
185
|
+
*
|
|
186
|
+
* @param {sap.ui.table.Table} oTable Instance of the table
|
|
184
187
|
*/
|
|
185
188
|
_cleanupColumResizing: function(oTable) {
|
|
186
189
|
if (oTable._$colResize) {
|
|
@@ -198,77 +201,6 @@ sap.ui.define([
|
|
|
198
201
|
$Document.off("mouseup.sapUiTableColumnResize");
|
|
199
202
|
},
|
|
200
203
|
|
|
201
|
-
/*
|
|
202
|
-
* Cleans up the state which is created while resize a column via drag&drop and recalculates the new column width.
|
|
203
|
-
*/
|
|
204
|
-
_resizeColumn: function(oTable, iColIndex, iNewWidth) {
|
|
205
|
-
const aVisibleColumns = oTable._getVisibleColumns();
|
|
206
|
-
let oColumn;
|
|
207
|
-
|
|
208
|
-
if (iColIndex >= 0 && iColIndex < aVisibleColumns.length) {
|
|
209
|
-
oColumn = aVisibleColumns[iColIndex];
|
|
210
|
-
if (iNewWidth != null) {
|
|
211
|
-
TableUtils.Column.resizeColumn(oTable, oTable.indexOfColumn(oColumn), iNewWidth);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
ColumnResizeHelper._cleanupColumResizing(oTable);
|
|
216
|
-
oColumn.focus();
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
/*
|
|
220
|
-
* Computes the optimal width for a column and changes the width if the auto resize feature is activated for the column.
|
|
221
|
-
*
|
|
222
|
-
* Experimental feature.
|
|
223
|
-
*/
|
|
224
|
-
doAutoResizeColumn: function(oTable, iColIndex) {
|
|
225
|
-
const aVisibleColumns = oTable._getVisibleColumns();
|
|
226
|
-
let oColumn;
|
|
227
|
-
|
|
228
|
-
if (iColIndex >= 0 && iColIndex < aVisibleColumns.length) {
|
|
229
|
-
oColumn = aVisibleColumns[iColIndex];
|
|
230
|
-
if (!oColumn.getAutoResizable() || !oColumn.getResizable()) {
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
const iNewWidth = ColumnResizeHelper._calculateAutomaticColumnWidth.apply(oTable, [oColumn, iColIndex]);
|
|
235
|
-
if (iNewWidth) {
|
|
236
|
-
ColumnResizeHelper._resizeColumn(oTable, iColIndex, iNewWidth);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
/*
|
|
242
|
-
* Calculates the widest content width of the currently visible column cells including headers.
|
|
243
|
-
* Headers with column span are not taken into account.
|
|
244
|
-
* @param {sap.ui.table.Column} oCol the column
|
|
245
|
-
* @param {int} iColIndex index of the column
|
|
246
|
-
* @returns {int} iWidth calculated column width
|
|
247
|
-
* @private
|
|
248
|
-
*/
|
|
249
|
-
_calculateAutomaticColumnWidth: function(oCol, iColIndex) {
|
|
250
|
-
oCol = oCol || this.getColumns()[iColIndex];
|
|
251
|
-
const $this = this.$();
|
|
252
|
-
const $hiddenArea = jQuery("<div>").addClass("sapUiTableHiddenSizeDetector sapUiTableHeaderDataCell sapUiTableDataCell");
|
|
253
|
-
$this.append($hiddenArea);
|
|
254
|
-
|
|
255
|
-
// Create a copy of all visible cells in the column, including the header cells without colspan
|
|
256
|
-
const $cells = $this.find("td[data-sap-ui-colid = \"" + oCol.getId() + "\"]:not([colspan])")
|
|
257
|
-
.filter(function(index, element) {
|
|
258
|
-
return element.style.display !== "none";
|
|
259
|
-
}).children().clone();
|
|
260
|
-
$cells.removeAttr("id"); // remove all id attributes
|
|
261
|
-
|
|
262
|
-
// Determine the column width
|
|
263
|
-
let iWidth = $hiddenArea.append($cells).width() + 4; // widest cell + 4px for borders, padding and rounding
|
|
264
|
-
iWidth = Math.min(iWidth, $this.find(".sapUiTableCnt").width()); // no wider as the table
|
|
265
|
-
iWidth = Math.max(iWidth + 4, TableUtils.Column.getMinColumnWidth()); // not to small
|
|
266
|
-
|
|
267
|
-
$hiddenArea.remove();
|
|
268
|
-
|
|
269
|
-
return iWidth;
|
|
270
|
-
},
|
|
271
|
-
|
|
272
204
|
/*
|
|
273
205
|
* Initialize the event listener for positioning the column resize bar and computing the currently hovered column.
|
|
274
206
|
*/
|
|
@@ -678,7 +610,13 @@ sap.ui.define([
|
|
|
678
610
|
ondblclick: function(oEvent) {
|
|
679
611
|
if (Device.system.desktop && oEvent.target === this.getDomRef("rsz")) {
|
|
680
612
|
oEvent.preventDefault();
|
|
681
|
-
ColumnResizeHelper.
|
|
613
|
+
ColumnResizeHelper._cleanupColumResizing(this);
|
|
614
|
+
|
|
615
|
+
const oColumn = this._getVisibleColumns()[this._iLastHoveredVisibleColumnIndex];
|
|
616
|
+
|
|
617
|
+
if (oColumn.getAutoResizable()) {
|
|
618
|
+
oColumn.autoResize();
|
|
619
|
+
}
|
|
682
620
|
}
|
|
683
621
|
},
|
|
684
622
|
|
|
@@ -765,7 +703,7 @@ sap.ui.define([
|
|
|
765
703
|
* @class Extension for sap.ui.table.Table which handles mouse and touch related things.
|
|
766
704
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
767
705
|
* @author SAP SE
|
|
768
|
-
* @version 1.
|
|
706
|
+
* @version 1.125.0
|
|
769
707
|
* @constructor
|
|
770
708
|
* @private
|
|
771
709
|
* @alias sap.ui.table.extensions.Pointer
|
|
@@ -835,18 +773,6 @@ sap.ui.define([
|
|
|
835
773
|
this._KNOWNCLICKABLECONTROLS = KNOWNCLICKABLECONTROLS;
|
|
836
774
|
},
|
|
837
775
|
|
|
838
|
-
/**
|
|
839
|
-
* Resizes the given column to its optimal width if the auto resize feature is available for this column.
|
|
840
|
-
*
|
|
841
|
-
* @param {int} iColIndex The index of the column to resize.
|
|
842
|
-
*/
|
|
843
|
-
doAutoResizeColumn: function(iColIndex) {
|
|
844
|
-
const oTable = this.getTable();
|
|
845
|
-
if (oTable) {
|
|
846
|
-
ColumnResizeHelper.doAutoResizeColumn(oTable, iColIndex);
|
|
847
|
-
}
|
|
848
|
-
},
|
|
849
|
-
|
|
850
776
|
/**
|
|
851
777
|
* Initialize the basic event handling for column reordering and starts the reordering.
|
|
852
778
|
*
|
|
@@ -2268,7 +2268,7 @@ sap.ui.define([
|
|
|
2268
2268
|
* @class Extension for sap.ui.table.Table which handles scrolling.
|
|
2269
2269
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
2270
2270
|
* @author SAP SE
|
|
2271
|
-
* @version 1.
|
|
2271
|
+
* @version 1.125.0
|
|
2272
2272
|
* @constructor
|
|
2273
2273
|
* @private
|
|
2274
2274
|
* @alias sap.ui.table.extensions.Scrolling
|
|
@@ -27,7 +27,7 @@ sap.ui.define([
|
|
|
27
27
|
* @class Extension for sap.ui.table.Table which handles the scrollbar on iOS.
|
|
28
28
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
29
29
|
* @author SAP SE
|
|
30
|
-
* @version 1.
|
|
30
|
+
* @version 1.125.0
|
|
31
31
|
* @constructor
|
|
32
32
|
* @private
|
|
33
33
|
* @alias sap.ui.table.extensions.ScrollingIOS
|
|
@@ -185,7 +185,7 @@ sap.ui.define([
|
|
|
185
185
|
* @class Extension for sap.ui.table.Table that allows synchronization with a table.
|
|
186
186
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
187
187
|
* @author SAP SE
|
|
188
|
-
* @version 1.
|
|
188
|
+
* @version 1.125.0
|
|
189
189
|
* @constructor
|
|
190
190
|
* @private
|
|
191
191
|
* @alias sap.ui.table.extensions.Synchronization
|
|
@@ -27,14 +27,14 @@ sap.ui.define([
|
|
|
27
27
|
* @namespace
|
|
28
28
|
* @alias sap.ui.table
|
|
29
29
|
* @author SAP SE
|
|
30
|
-
* @version 1.
|
|
30
|
+
* @version 1.125.0
|
|
31
31
|
* @since 0.8
|
|
32
32
|
* @public
|
|
33
33
|
*/
|
|
34
34
|
const thisLib = Library.init({
|
|
35
35
|
name: "sap.ui.table",
|
|
36
36
|
apiVersion: 2,
|
|
37
|
-
version: "1.
|
|
37
|
+
version: "1.125.0",
|
|
38
38
|
dependencies: ["sap.ui.core", "sap.ui.unified"],
|
|
39
39
|
designtime: "sap/ui/table/designtime/library.designtime",
|
|
40
40
|
types: [
|
|
@@ -96,7 +96,7 @@ sap.ui.define([
|
|
|
96
96
|
/**
|
|
97
97
|
* Navigation mode of the table
|
|
98
98
|
*
|
|
99
|
-
* @version 1.
|
|
99
|
+
* @version 1.125.0
|
|
100
100
|
* @enum {string}
|
|
101
101
|
* @deprecated As of version 1.38, the concept has been discarded.
|
|
102
102
|
* @public
|
|
@@ -127,7 +127,7 @@ sap.ui.define([
|
|
|
127
127
|
/**
|
|
128
128
|
* Row Action types.
|
|
129
129
|
*
|
|
130
|
-
* @version 1.
|
|
130
|
+
* @version 1.125.0
|
|
131
131
|
* @enum {string}
|
|
132
132
|
* @public
|
|
133
133
|
*/
|
|
@@ -158,7 +158,7 @@ sap.ui.define([
|
|
|
158
158
|
/**
|
|
159
159
|
* Selection behavior of the table
|
|
160
160
|
*
|
|
161
|
-
* @version 1.
|
|
161
|
+
* @version 1.125.0
|
|
162
162
|
* @enum {string}
|
|
163
163
|
* @public
|
|
164
164
|
*/
|
|
@@ -189,7 +189,7 @@ sap.ui.define([
|
|
|
189
189
|
/**
|
|
190
190
|
* Selection mode of the table
|
|
191
191
|
*
|
|
192
|
-
* @version 1.
|
|
192
|
+
* @version 1.125.0
|
|
193
193
|
* @enum {string}
|
|
194
194
|
* @public
|
|
195
195
|
*/
|
|
@@ -227,7 +227,7 @@ sap.ui.define([
|
|
|
227
227
|
/**
|
|
228
228
|
* Sort order of a column
|
|
229
229
|
*
|
|
230
|
-
* @version 1.
|
|
230
|
+
* @version 1.125.0
|
|
231
231
|
* @enum {string}
|
|
232
232
|
* @public
|
|
233
233
|
* @deprecated As of version 1.120, replaced with <code>sap.ui.core.SortOrder</code>
|
|
@@ -254,7 +254,7 @@ sap.ui.define([
|
|
|
254
254
|
/**
|
|
255
255
|
* VisibleRowCountMode of the table
|
|
256
256
|
*
|
|
257
|
-
* @version 1.
|
|
257
|
+
* @version 1.125.0
|
|
258
258
|
* @enum {string}
|
|
259
259
|
* @deprecated As of version 1.119, see the <code>rowMode</code> aggregation of <code>sap.ui.table.Table</code> for more details.
|
|
260
260
|
* @public
|
|
@@ -299,7 +299,7 @@ sap.ui.define([
|
|
|
299
299
|
*
|
|
300
300
|
* Contains IDs of shared DOM references, which should be accessible to inheriting controls via getDomRef() function.
|
|
301
301
|
*
|
|
302
|
-
* @version 1.
|
|
302
|
+
* @version 1.125.0
|
|
303
303
|
* @enum {string}
|
|
304
304
|
* @public
|
|
305
305
|
*/
|
|
@@ -400,7 +400,7 @@ sap.ui.define([
|
|
|
400
400
|
*
|
|
401
401
|
* This is an alias for {@link sap.ui.model.TreeAutoExpandMode} and kept for compatibility reasons.
|
|
402
402
|
*
|
|
403
|
-
* @version 1.
|
|
403
|
+
* @version 1.125.0
|
|
404
404
|
* @typedef {sap.ui.model.TreeAutoExpandMode}
|
|
405
405
|
* @public
|
|
406
406
|
* @deprecated As of version 1.120, replaced by <code>sap.ui.model.TreeAutoExpandMode</code>
|
|
@@ -414,7 +414,7 @@ sap.ui.define([
|
|
|
414
414
|
/**
|
|
415
415
|
* Mode of a selection plugin
|
|
416
416
|
*
|
|
417
|
-
* @version 1.
|
|
417
|
+
* @version 1.125.0
|
|
418
418
|
* @enum {string}
|
|
419
419
|
* @private
|
|
420
420
|
*/
|
|
@@ -21,7 +21,7 @@ sap.ui.define([
|
|
|
21
21
|
*
|
|
22
22
|
* @class Implements the selection methods for TreeTable and AnalyticalTable
|
|
23
23
|
* @extends sap.ui.table.plugins.SelectionPlugin
|
|
24
|
-
* @version 1.
|
|
24
|
+
* @version 1.125.0
|
|
25
25
|
* @constructor
|
|
26
26
|
* @private
|
|
27
27
|
* @alias sap.ui.table.plugins.BindingSelection
|
|
@@ -98,7 +98,11 @@ sap.ui.define([
|
|
|
98
98
|
|
|
99
99
|
function toggleSelectAll(oPlugin) {
|
|
100
100
|
const oTable = oPlugin.getTable();
|
|
101
|
-
let bSelectAll;
|
|
101
|
+
let bSelectAll;
|
|
102
|
+
|
|
103
|
+
if (oPlugin.getSelectionMode() !== SelectionMode.MultiToggle) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
102
106
|
|
|
103
107
|
// in order to fire the rowSelectionChanged event, the SourceRowIndex mus be set to -1
|
|
104
108
|
// to indicate that the selection was changed by user interaction
|
|
@@ -299,7 +303,7 @@ let bSelectAll;
|
|
|
299
303
|
* @inheritDoc
|
|
300
304
|
*/
|
|
301
305
|
BindingSelection.prototype.selectAll = function() {
|
|
302
|
-
if (this.getSelectionMode()
|
|
306
|
+
if (this.getSelectionMode() !== SelectionMode.MultiToggle) {
|
|
303
307
|
return;
|
|
304
308
|
}
|
|
305
309
|
|
|
@@ -209,15 +209,16 @@ sap.ui.define([
|
|
|
209
209
|
|
|
210
210
|
MultiSelectionPlugin.prototype.onKeyboardShortcut = function(sType, oEvent) {
|
|
211
211
|
if (sType === "toggle") { // ctrl + a
|
|
212
|
+
if (this.getSelectionMode() !== SelectionMode.MultiToggle) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
212
216
|
if (this._bLimitDisabled) {
|
|
213
217
|
if (!toggleSelection(this)) {
|
|
214
218
|
oEvent?.setMarked("sapUiTableClearAll");
|
|
215
219
|
}
|
|
216
220
|
} else {
|
|
217
|
-
|
|
218
|
-
if (sSelectionMode === SelectionMode.MultiToggle) {
|
|
219
|
-
this.addSelectionInterval(0, this._getHighestSelectableIndex());
|
|
220
|
-
}
|
|
221
|
+
this.addSelectionInterval(0, this._getHighestSelectableIndex());
|
|
221
222
|
}
|
|
222
223
|
} else if (sType === "clear") { // ctrl + shift + a
|
|
223
224
|
this.clearSelection();
|
|
@@ -278,6 +278,10 @@ sap.ui.define([
|
|
|
278
278
|
|
|
279
279
|
ODataV4Selection.prototype.onKeyboardShortcut = function(sType, oEvent) {
|
|
280
280
|
if (sType === "toggle") { // ctrl + a
|
|
281
|
+
if (this.getSelectionMode() !== SelectionMode.MultiToggle) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
281
285
|
if (this._isLimitDisabled()) {
|
|
282
286
|
if (toggleSelectAll(this) === false) {
|
|
283
287
|
oEvent?.setMarked("sapUiTableClearAll");
|
|
@@ -23,7 +23,7 @@ sap.ui.define([
|
|
|
23
23
|
*
|
|
24
24
|
* @class Implements the selection methods for a Table
|
|
25
25
|
* @extends sap.ui.table.plugins.SelectionPlugin
|
|
26
|
-
* @version 1.
|
|
26
|
+
* @version 1.125.0
|
|
27
27
|
* @constructor
|
|
28
28
|
* @private
|
|
29
29
|
* @alias sap.ui.table.plugins.SelectionModelSelection
|
|
@@ -133,7 +133,11 @@ sap.ui.define([
|
|
|
133
133
|
|
|
134
134
|
function toggleSelectAll(oPlugin) {
|
|
135
135
|
const oTable = oPlugin.getTable();
|
|
136
|
-
let bSelectAll;
|
|
136
|
+
let bSelectAll;
|
|
137
|
+
|
|
138
|
+
if (oPlugin.getSelectionMode() !== SelectionMode.MultiToggle) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
137
141
|
|
|
138
142
|
// in order to fire the rowSelectionChanged event, the SourceRowIndex mus be set to -1
|
|
139
143
|
// to indicate that the selection was changed by user interaction
|
|
@@ -32,7 +32,7 @@ sap.ui.define([
|
|
|
32
32
|
* @class TODO (don't forget to document fixed row count restrictions because fixed rows are set by this plugin)
|
|
33
33
|
* @extends sap.ui.table.plugins.PluginBase
|
|
34
34
|
* @author SAP SE
|
|
35
|
-
* @version 1.
|
|
35
|
+
* @version 1.125.0
|
|
36
36
|
* @private
|
|
37
37
|
* @since 1.76
|
|
38
38
|
* @ui5-restricted sap.ui.mdc
|
|
@@ -39,7 +39,7 @@ sap.ui.define([
|
|
|
39
39
|
* @public
|
|
40
40
|
*
|
|
41
41
|
* @author SAP SE
|
|
42
|
-
* @version 1.
|
|
42
|
+
* @version 1.125.0
|
|
43
43
|
*/
|
|
44
44
|
const InteractiveRowMode = RowMode.extend("sap.ui.table.rowmodes.Interactive", /** @lends sap.ui.table.rowmodes.Interactive.prototype */ {
|
|
45
45
|
metadata: {
|
|
@@ -37,7 +37,7 @@ sap.ui.define([
|
|
|
37
37
|
* @public
|
|
38
38
|
*
|
|
39
39
|
* @author SAP SE
|
|
40
|
-
* @version 1.
|
|
40
|
+
* @version 1.125.0
|
|
41
41
|
*/
|
|
42
42
|
const RowMode = Element.extend("sap.ui.table.rowmodes.RowMode", /** @lends sap.ui.table.rowmodes.RowMode.prototype */ {
|
|
43
43
|
metadata: {
|
|
@@ -571,7 +571,7 @@ sap.ui.define([
|
|
|
571
571
|
}
|
|
572
572
|
|
|
573
573
|
const aRows = createRows(oTable, iRowCount);
|
|
574
|
-
let oRow;
|
|
574
|
+
let oRow;
|
|
575
575
|
|
|
576
576
|
for (let i = 0; i < aRows.length; i++) {
|
|
577
577
|
oRow = aRows[i];
|
|
@@ -214,7 +214,7 @@ sap.ui.define([
|
|
|
214
214
|
* Static collection of utility functions related to the sap.ui.table.Table, ...
|
|
215
215
|
*
|
|
216
216
|
* @author SAP SE
|
|
217
|
-
* @version 1.
|
|
217
|
+
* @version 1.125.0
|
|
218
218
|
* @namespace
|
|
219
219
|
* @alias sap.ui.table.utils.TableUtils
|
|
220
220
|
* @private
|
|
@@ -1381,11 +1381,10 @@ sap.ui.define([
|
|
|
1381
1381
|
* Gets the first interactive element in the data cells of a row.
|
|
1382
1382
|
*
|
|
1383
1383
|
* @param {sap.ui.table.Row|sap.ui.table.CreationRow} oRow
|
|
1384
|
-
* @param {boolean} [
|
|
1385
|
-
* into consideration
|
|
1384
|
+
* @param {boolean} [bRowActionCell=false] Whether the row action cell is taken into consideration
|
|
1386
1385
|
* @return {HTMLElement|null} The first interactive DOM element
|
|
1387
1386
|
*/
|
|
1388
|
-
getFirstInteractiveElement: function(oRow,
|
|
1387
|
+
getFirstInteractiveElement: function(oRow, bRowActionCell) {
|
|
1389
1388
|
if (!oRow) {
|
|
1390
1389
|
return null;
|
|
1391
1390
|
}
|
|
@@ -1393,7 +1392,7 @@ sap.ui.define([
|
|
|
1393
1392
|
const oTable = oRow.getTable();
|
|
1394
1393
|
const aCells = oRow.getCells();
|
|
1395
1394
|
|
|
1396
|
-
if (
|
|
1395
|
+
if (bRowActionCell === true && TableUtils.hasRowActions(oTable)) {
|
|
1397
1396
|
aCells.push(oRow.getRowAction());
|
|
1398
1397
|
}
|
|
1399
1398
|
|
|
@@ -14,7 +14,7 @@ sap.ui.define([], function() {
|
|
|
14
14
|
* Note: Do not access the functions of this helper directly, but via <code>sap.ui.table.utils.TableUtils.Binding...</code>
|
|
15
15
|
*
|
|
16
16
|
* @author SAP SE
|
|
17
|
-
* @version 1.
|
|
17
|
+
* @version 1.125.0
|
|
18
18
|
* @namespace
|
|
19
19
|
* @alias sap.ui.table.utils._BindingUtils
|
|
20
20
|
* @private
|
|
@@ -18,7 +18,7 @@ sap.ui.define([
|
|
|
18
18
|
* Note: Do not access the functions of this helper directly, but via <code>sap.ui.table.utils.TableUtils.Column...</code>
|
|
19
19
|
*
|
|
20
20
|
* @author SAP SE
|
|
21
|
-
* @version 1.
|
|
21
|
+
* @version 1.125.0
|
|
22
22
|
* @namespace
|
|
23
23
|
* @alias sap.ui.table.utils._ColumnUtils
|
|
24
24
|
* @private
|
|
@@ -400,7 +400,8 @@ sap.ui.define([
|
|
|
400
400
|
* @returns {boolean} Whether the column can be moved to another position.
|
|
401
401
|
*/
|
|
402
402
|
isColumnMovable: function(oColumn, bIgnoreReorderingProperty) {
|
|
403
|
-
const oTable = oColumn.
|
|
403
|
+
const oTable = oColumn._getTable();
|
|
404
|
+
|
|
404
405
|
if (!oTable || (!oTable.getEnableColumnReordering() && !bIgnoreReorderingProperty)) {
|
|
405
406
|
// Column reordering is not active at all
|
|
406
407
|
return false;
|
|
@@ -430,7 +431,7 @@ sap.ui.define([
|
|
|
430
431
|
* @private
|
|
431
432
|
*/
|
|
432
433
|
normalizeColumnMoveTargetIndex: function(oColumn, iNewIndex) {
|
|
433
|
-
const oTable = oColumn.
|
|
434
|
+
const oTable = oColumn._getTable();
|
|
434
435
|
const iCurrentIndex = oTable.indexOfColumn(oColumn);
|
|
435
436
|
const aColumns = oTable.getColumns();
|
|
436
437
|
|
|
@@ -460,7 +461,7 @@ sap.ui.define([
|
|
|
460
461
|
* @returns {boolean} Whether the column can be moved to the desired position.
|
|
461
462
|
*/
|
|
462
463
|
isColumnMovableTo: function(oColumn, iNewIndex, bIgnoreReorderingProperty) {
|
|
463
|
-
const oTable = oColumn.
|
|
464
|
+
const oTable = oColumn._getTable();
|
|
464
465
|
|
|
465
466
|
if (!oTable || iNewIndex === undefined || !ColumnUtils.isColumnMovable(oColumn, bIgnoreReorderingProperty)) {
|
|
466
467
|
// Column is not movable at all
|
|
@@ -510,7 +511,7 @@ sap.ui.define([
|
|
|
510
511
|
return false;
|
|
511
512
|
}
|
|
512
513
|
|
|
513
|
-
const oTable = oColumn.
|
|
514
|
+
const oTable = oColumn._getTable();
|
|
514
515
|
const iCurrentIndex = oTable.indexOfColumn(oColumn);
|
|
515
516
|
|
|
516
517
|
if (iNewIndex === iCurrentIndex) {
|
|
@@ -558,6 +559,60 @@ sap.ui.define([
|
|
|
558
559
|
return Device.system.desktop ? 48 : 88;
|
|
559
560
|
},
|
|
560
561
|
|
|
562
|
+
/**
|
|
563
|
+
* Resizes the given column to its optimal width.
|
|
564
|
+
* Cleans up the state which is created while resizing a column via drag&drop
|
|
565
|
+
* and sets the new width to the column.
|
|
566
|
+
*
|
|
567
|
+
* @param {sap.ui.table.Column} oColumn The column which should be resized
|
|
568
|
+
* @private
|
|
569
|
+
*/
|
|
570
|
+
autoResizeColumn: function(oColumn) {
|
|
571
|
+
const oTable = oColumn._getTable();
|
|
572
|
+
const sCurrentWidth = oColumn.getWidth();
|
|
573
|
+
const iNewWidth = ColumnUtils._calculateColumnWidth(oColumn);
|
|
574
|
+
|
|
575
|
+
if (iNewWidth + "px" !== sCurrentWidth) {
|
|
576
|
+
ColumnUtils.resizeColumn(oTable, oColumn, iNewWidth);
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Calculates the widest content width of the currently visible column cells including headers.
|
|
582
|
+
* Headers with column span are not taken into account.
|
|
583
|
+
*
|
|
584
|
+
* @param {sap.ui.table.Column} oColumn The column control
|
|
585
|
+
* @returns {int} iWidth Calculated column width
|
|
586
|
+
* @private
|
|
587
|
+
*/
|
|
588
|
+
_calculateColumnWidth: function(oColumn) {
|
|
589
|
+
const oTableElement = oColumn._getTable().getDomRef();
|
|
590
|
+
const oHiddenArea = document.createElement("div");
|
|
591
|
+
|
|
592
|
+
oHiddenArea.classList.add("sapUiTableHiddenSizeDetector", "sapUiTableHeaderDataCell", "sapUiTableDataCell");
|
|
593
|
+
oTableElement.appendChild(oHiddenArea);
|
|
594
|
+
|
|
595
|
+
// Create a copy of all visible cells in the column, including the header cells without colspan
|
|
596
|
+
const aCells = Array.from(oTableElement.querySelectorAll(`td[data-sap-ui-colid="${oColumn.getId()}"]:not([colspan])`))
|
|
597
|
+
.filter((element) => !element.classList.contains("sapUiTableHidden"))
|
|
598
|
+
.map((element) => element.firstElementChild.cloneNode(true));
|
|
599
|
+
|
|
600
|
+
aCells.forEach((cell) => {
|
|
601
|
+
cell.removeAttribute('id');
|
|
602
|
+
oHiddenArea.appendChild(cell);
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
// Determine the column width
|
|
606
|
+
let iWidth = oHiddenArea.getBoundingClientRect().width + 4; // widest cell + 4px for borders and rounding
|
|
607
|
+
const iTableWidth = oTableElement.querySelector('.sapUiTableCnt').getBoundingClientRect().width;
|
|
608
|
+
iWidth = Math.min(iWidth, iTableWidth); // no wider as the table
|
|
609
|
+
iWidth = Math.max(iWidth, ColumnUtils.getMinColumnWidth()); // not too small
|
|
610
|
+
|
|
611
|
+
oTableElement.removeChild(oHiddenArea);
|
|
612
|
+
|
|
613
|
+
return Math.round(iWidth);
|
|
614
|
+
},
|
|
615
|
+
|
|
561
616
|
/**
|
|
562
617
|
* Resizes one or more visible columns to the specified amount of pixels.
|
|
563
618
|
*
|
|
@@ -571,25 +626,53 @@ sap.ui.define([
|
|
|
571
626
|
* and execution of the default action is prevented in the event handler.
|
|
572
627
|
*
|
|
573
628
|
* @param {sap.ui.table.Table} oTable Instance of the table.
|
|
574
|
-
* @param {int}
|
|
629
|
+
* @param {int} oColumn The column which should be resized
|
|
575
630
|
* @param {int} iWidth The width in pixel to set the column or column span to. Must be greater than 0.
|
|
576
631
|
* @param {boolean} [bFireEvent=true] Whether the ColumnResize event should be fired. The event will be fired for every resized column.
|
|
577
632
|
* @param {int} [iColumnSpan=1] The span of columns to resize beginning from <code>iColumnIndex</code>.
|
|
578
633
|
* @returns {boolean} Returns <code>true</code>, if at least one column has been resized.
|
|
579
634
|
*/
|
|
580
|
-
resizeColumn: function(oTable,
|
|
581
|
-
if (!oTable ||
|
|
582
|
-
iColumnIndex == null || iColumnIndex < 0 ||
|
|
635
|
+
resizeColumn: function(oTable, oColumn, iWidth, bFireEvent = true, iColumnSpan = 1) {
|
|
636
|
+
if (!oTable || !oColumn ||
|
|
583
637
|
iWidth == null || iWidth <= 0) {
|
|
584
638
|
return false;
|
|
585
639
|
}
|
|
586
|
-
|
|
587
|
-
|
|
640
|
+
|
|
641
|
+
const aVisibleColumns = ColumnUtils._getVisibleColumnsInSpan(oTable, oColumn.getIndex(), iColumnSpan);
|
|
642
|
+
const aResizableColumns = ColumnUtils._getResizableColumns(aVisibleColumns);
|
|
643
|
+
|
|
644
|
+
if (aResizableColumns.length === 0) {
|
|
645
|
+
return false;
|
|
588
646
|
}
|
|
589
|
-
|
|
590
|
-
|
|
647
|
+
|
|
648
|
+
const iSpanWidth = ColumnUtils._calculateSpanWidth(oTable, aVisibleColumns);
|
|
649
|
+
|
|
650
|
+
if (!ColumnUtils.TableUtils.isFixedColumn(oTable, oColumn.getIndex())) {
|
|
651
|
+
ColumnUtils._fixAutoColumns(oTable, aResizableColumns);
|
|
591
652
|
}
|
|
592
653
|
|
|
654
|
+
const iPixelDelta = iWidth - iSpanWidth;
|
|
655
|
+
return ColumnUtils._performResize(oTable, aResizableColumns, iPixelDelta, bFireEvent);
|
|
656
|
+
},
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Returns an <code>Array</code> of visible columns inside the resized column by the number of <code>iColumnSpan</code>.
|
|
660
|
+
* The <code>iColumnSpan</code> is used when the table has multiple headers and one of this header gets
|
|
661
|
+
* resized via keyboard. If due so we resize all columns represented in the <code>iColumnSpan</code> uniformly.
|
|
662
|
+
*
|
|
663
|
+
* Assuming iColumnIndex = 1 and iColumnSpan = 2
|
|
664
|
+
* |-- --|-- Multi Header --|-- --|
|
|
665
|
+
* |-- --|-- Span 2 --|-- --|
|
|
666
|
+
* |-- Column A --|-- Column B --|-- Column C --|-- Column D --|
|
|
667
|
+
* |-- Index 0 --|-- Index 1 --|-- Index 2 --|-- Inddex 3 --|
|
|
668
|
+
*
|
|
669
|
+
* @param {sap.ui.table.Table} oTable Instance of the table
|
|
670
|
+
* @param {int} iColumnIndex Starting column index
|
|
671
|
+
* @param {int} iColumnSpan Number of columns within the header span beginning from <code>iColumnIndex</code>
|
|
672
|
+
* @returns {sap.ui.table.Column[]} aVisibleColumns Array of visible columns
|
|
673
|
+
* @private
|
|
674
|
+
*/
|
|
675
|
+
_getVisibleColumnsInSpan: function(oTable, iColumnIndex, iColumnSpan) {
|
|
593
676
|
const aColumns = oTable.getColumns();
|
|
594
677
|
if (iColumnIndex >= aColumns.length || !aColumns[iColumnIndex].getVisible()) {
|
|
595
678
|
return false;
|
|
@@ -608,48 +691,89 @@ sap.ui.define([
|
|
|
608
691
|
}
|
|
609
692
|
}
|
|
610
693
|
}
|
|
694
|
+
return aVisibleColumns;
|
|
695
|
+
},
|
|
611
696
|
|
|
697
|
+
/**
|
|
698
|
+
* Returns an <code>Array</code> of <code>sap.ui.table.Column</code> which property
|
|
699
|
+
* <code>resizable</code> is set to <code>true</code>.
|
|
700
|
+
*
|
|
701
|
+
* @param {sap.ui.table.Column[]} aVisibleColumns Array of visible columns
|
|
702
|
+
* @returns {sap.ui.table.Column[]} aResizableColumns Array of resizable columns
|
|
703
|
+
* @private
|
|
704
|
+
*/
|
|
705
|
+
_getResizableColumns: function(aVisibleColumns) {
|
|
612
706
|
const aResizableColumns = [];
|
|
707
|
+
|
|
613
708
|
for (let i = 0; i < aVisibleColumns.length; i++) {
|
|
614
709
|
const oVisibleColumn = aVisibleColumns[i];
|
|
615
710
|
if (oVisibleColumn.getResizable()) {
|
|
616
711
|
aResizableColumns.push(oVisibleColumn);
|
|
617
712
|
}
|
|
618
713
|
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
714
|
+
return aResizableColumns;
|
|
715
|
+
},
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Fix Columns with property <code>{@link sap.ui.table.Column#getWidth} = auto<code>.
|
|
719
|
+
* If a column was resized in the scrollable area:
|
|
720
|
+
* Set minimum widths of all columns with variable width except those in aResizableColumns.
|
|
721
|
+
* As a result, flexible columns cannot shrink smaller as their current width after the resize
|
|
722
|
+
* (see {@link sap.ui.table.Table#setMinColWidths}).
|
|
723
|
+
*
|
|
724
|
+
* @param {sap.ui.table.Table} oTable Instance of the table
|
|
725
|
+
* @param {sap.ui.table.Column[]} aResizableColumns Array of resizable columns
|
|
726
|
+
*/
|
|
727
|
+
_fixAutoColumns: function(oTable, aResizableColumns) {
|
|
728
|
+
const oTableElement = oTable.getDomRef();
|
|
729
|
+
|
|
730
|
+
oTable._getVisibleColumns().forEach(function(oColumn) {
|
|
731
|
+
const sWidth = oColumn.getWidth();
|
|
732
|
+
let $columnElement;
|
|
733
|
+
|
|
734
|
+
if (oTableElement && aResizableColumns.indexOf(oColumn) < 0 && ColumnUtils.TableUtils.isVariableWidth(sWidth)) {
|
|
735
|
+
$columnElement = oTableElement.querySelector("th[data-sap-ui-colid=\"" + oColumn.getId() + "\"]");
|
|
736
|
+
if ($columnElement) {
|
|
737
|
+
oColumn._minWidth = Math.max($columnElement.offsetWidth, ColumnUtils.getMinColumnWidth());
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
},
|
|
622
742
|
|
|
743
|
+
/**
|
|
744
|
+
* Calculate and returns the actual width of the header span which is getting resized.
|
|
745
|
+
* The amount is a sum of the column widths of all columns within in the header span.
|
|
746
|
+
*
|
|
747
|
+
* @param {sap.ui.table.Table} oTable Instance of the table
|
|
748
|
+
* @param {sap.ui.table.Column[]} aVisibleColumns Array of visible columns within the header span
|
|
749
|
+
* @returns {int} iSpanWidth The width of the resizing header span
|
|
750
|
+
* @private
|
|
751
|
+
*/
|
|
752
|
+
_calculateSpanWidth: function(oTable, aVisibleColumns) {
|
|
623
753
|
let iSpanWidth = 0;
|
|
624
754
|
for (let i = 0; i < aVisibleColumns.length; i++) {
|
|
625
755
|
const oVisibleColumn = aVisibleColumns[i];
|
|
626
756
|
iSpanWidth += ColumnUtils.getColumnWidth(oTable, oVisibleColumn.getIndex());
|
|
627
757
|
}
|
|
628
758
|
|
|
629
|
-
|
|
759
|
+
return iSpanWidth;
|
|
760
|
+
},
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Sets the new width to one or more columns.
|
|
764
|
+
*
|
|
765
|
+
* @param {sap.ui.table.Table} oTable Instance of the table
|
|
766
|
+
* @param {sap.ui.table.Column[]} aResizableColumns Array of resizable columns
|
|
767
|
+
* @param {int} iPixelDelta The new calculated width which should be destributed by the number of <code>aResizableColumns</code>
|
|
768
|
+
* @param {boolean} bFireEvent Whether the ColumnResize event should be fired. The event will be fired for every resized column.
|
|
769
|
+
* @returns {boolean} Returns <code>true</code>, if at least one column has been resized.
|
|
770
|
+
*/
|
|
771
|
+
_performResize: function(oTable, aResizableColumns, iPixelDelta, bFireEvent) {
|
|
772
|
+
// when resizing a header span the new width must be destributed by the number of underlying columns
|
|
773
|
+
// of course when resizing a single column via D&D iPixelDelta is automatically the new column width
|
|
630
774
|
let iSharedPixelDelta = Math.round(iPixelDelta / aResizableColumns.length);
|
|
631
775
|
let bResizeWasPerformed = false;
|
|
632
776
|
|
|
633
|
-
const oTableElement = oTable.getDomRef();
|
|
634
|
-
|
|
635
|
-
// Fix Auto Columns if a column in the scrollable area was resized:
|
|
636
|
-
// Set minimum widths of all columns with variable width except those in aResizableColumns.
|
|
637
|
-
// As a result, flexible columns cannot shrink smaller as their current width after the resize
|
|
638
|
-
// (see setMinColWidths in Table.js).
|
|
639
|
-
if (!ColumnUtils.TableUtils.isFixedColumn(oTable, iColumnIndex)) {
|
|
640
|
-
oTable._getVisibleColumns().forEach(function(col) {
|
|
641
|
-
const width = col.getWidth();
|
|
642
|
-
let colElement;
|
|
643
|
-
|
|
644
|
-
if (oTableElement && aResizableColumns.indexOf(col) < 0 && ColumnUtils.TableUtils.isVariableWidth(width)) {
|
|
645
|
-
colElement = oTableElement.querySelector("th[data-sap-ui-colid=\"" + col.getId() + "\"]");
|
|
646
|
-
if (colElement) {
|
|
647
|
-
col._minWidth = Math.max(colElement.offsetWidth, ColumnUtils.getMinColumnWidth());
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
|
|
653
777
|
// Resize all resizable columns. Share the width change (pixel delta) between them.
|
|
654
778
|
for (let i = 0; i < aResizableColumns.length; i++) {
|
|
655
779
|
const oResizableColumn = aResizableColumns[i];
|
|
@@ -24,7 +24,7 @@ sap.ui.define([
|
|
|
24
24
|
* Note: Do not access the functions of this helper directly, but via <code>sap.ui.table.utils.TableUtils.Grouping...</code>
|
|
25
25
|
*
|
|
26
26
|
* @author SAP SE
|
|
27
|
-
* @version 1.
|
|
27
|
+
* @version 1.125.0
|
|
28
28
|
* @namespace
|
|
29
29
|
* @alias sap.ui.table.utils._GroupingUtils
|
|
30
30
|
* @private
|
|
@@ -22,7 +22,7 @@ sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(Da
|
|
|
22
22
|
* - There is no concept for public or protected hooks. Never expose a hook directly, only indirectly as can be seen in the examples.
|
|
23
23
|
*
|
|
24
24
|
* @author SAP SE
|
|
25
|
-
* @version 1.
|
|
25
|
+
* @version 1.125.0
|
|
26
26
|
* @namespace
|
|
27
27
|
* @alias sap.ui.table.utils._HookUtils
|
|
28
28
|
*
|
|
@@ -42,7 +42,7 @@ sap.ui.define([
|
|
|
42
42
|
* Note: Do not access the functions of this helper directly, but via <code>sap.ui.table.utils.TableUtils.Menu...</code>
|
|
43
43
|
*
|
|
44
44
|
* @author SAP SE
|
|
45
|
-
* @version 1.
|
|
45
|
+
* @version 1.125.0
|
|
46
46
|
* @namespace
|
|
47
47
|
* @alias sap.ui.table.utils._MenuUtils
|
|
48
48
|
* @private
|