@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
|
@@ -24,7 +24,7 @@ sap.ui.define([
|
|
|
24
24
|
*
|
|
25
25
|
* @type {WeakMapConstructor}
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
const ColumnToVisibilitySubmenuItemMap = new window.WeakMap();
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Constructor for a new ColumnMenu.
|
|
@@ -40,7 +40,7 @@ sap.ui.define([
|
|
|
40
40
|
* @class
|
|
41
41
|
* The column menu provides all common actions that can be performed on a column.
|
|
42
42
|
* @extends sap.ui.unified.Menu
|
|
43
|
-
* @version 1.
|
|
43
|
+
* @version 1.124.0
|
|
44
44
|
*
|
|
45
45
|
* @constructor
|
|
46
46
|
* @public
|
|
@@ -48,7 +48,7 @@ sap.ui.define([
|
|
|
48
48
|
*
|
|
49
49
|
* @deprecated As of version 1.117, use the {@link sap.m.table.columnmenu.Menu} instead.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
const ColumnMenu = Menu.extend("sap.ui.table.ColumnMenu", /** @lends sap.ui.table.ColumnMenu.prototype */ {
|
|
52
52
|
metadata: {
|
|
53
53
|
library: "sap.ui.table"
|
|
54
54
|
},
|
|
@@ -107,12 +107,12 @@ sap.ui.define([
|
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
ColumnMenu.prototype._getColumn = function() {
|
|
110
|
-
|
|
110
|
+
const oParent = this.getParent();
|
|
111
111
|
return TableUtils.isA(oParent, "sap.ui.table.Column") ? oParent : null;
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
ColumnMenu.prototype._getTable = function() {
|
|
115
|
-
|
|
115
|
+
const oColumn = this._getColumn();
|
|
116
116
|
return oColumn ? oColumn._getTable() : null;
|
|
117
117
|
};
|
|
118
118
|
|
|
@@ -125,7 +125,7 @@ sap.ui.define([
|
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
ColumnMenu.prototype._removeColumnVisibilityFromAggregation = function() {
|
|
128
|
-
|
|
128
|
+
const oTable = this._getTable();
|
|
129
129
|
if (!oTable || oTable._oColumnVisibilityMenuItem) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
@@ -186,11 +186,11 @@ sap.ui.define([
|
|
|
186
186
|
* @private
|
|
187
187
|
*/
|
|
188
188
|
ColumnMenu.prototype._addSortMenuItem = function(bDesc) {
|
|
189
|
-
|
|
189
|
+
const oColumn = this._getColumn();
|
|
190
190
|
|
|
191
191
|
if (oColumn.isSortableByMenu()) {
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
const sDir = bDesc ? "desc" : "asc";
|
|
193
|
+
const sIcon = bDesc ? "sort-descending" : "sort-ascending";
|
|
194
194
|
|
|
195
195
|
this.addItem(this._createMenuItem(
|
|
196
196
|
sDir,
|
|
@@ -208,11 +208,11 @@ sap.ui.define([
|
|
|
208
208
|
* @private
|
|
209
209
|
*/
|
|
210
210
|
ColumnMenu.prototype._addFilterMenuItem = function() {
|
|
211
|
-
|
|
211
|
+
const oColumn = this._getColumn();
|
|
212
212
|
|
|
213
213
|
if (oColumn.isFilterableByMenu()) {
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
const oTable = oColumn.getParent();
|
|
215
|
+
const bCustomFilterEnabled = oTable && oTable.getEnableCustomFilter();
|
|
216
216
|
|
|
217
217
|
if (bCustomFilterEnabled) {
|
|
218
218
|
this.addItem(this._createMenuItem(
|
|
@@ -244,17 +244,17 @@ sap.ui.define([
|
|
|
244
244
|
* @private
|
|
245
245
|
*/
|
|
246
246
|
ColumnMenu.prototype._addGroupMenuItem = function() {
|
|
247
|
-
|
|
247
|
+
const oColumn = this._getColumn();
|
|
248
248
|
|
|
249
249
|
if (oColumn.isGroupableByMenu()) {
|
|
250
|
-
|
|
250
|
+
const oTable = this._getTable();
|
|
251
251
|
|
|
252
252
|
this.addItem(this._createMenuItem(
|
|
253
253
|
"group",
|
|
254
254
|
"TBL_GROUP",
|
|
255
255
|
null,
|
|
256
256
|
function() {
|
|
257
|
-
|
|
257
|
+
let oDomRef;
|
|
258
258
|
oTable.setGroupBy(oColumn);
|
|
259
259
|
|
|
260
260
|
if (TableUtils.isNoDataVisible(oTable)) {
|
|
@@ -276,13 +276,13 @@ sap.ui.define([
|
|
|
276
276
|
* @private
|
|
277
277
|
*/
|
|
278
278
|
ColumnMenu.prototype._addFreezeMenuItem = function() {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
const oColumn = this._getColumn();
|
|
280
|
+
const oTable = this._getTable();
|
|
281
|
+
const bColumnFreezeEnabled = oTable && oTable.getEnableColumnFreeze();
|
|
282
282
|
|
|
283
283
|
if (bColumnFreezeEnabled) {
|
|
284
|
-
|
|
285
|
-
|
|
284
|
+
const iColumnIndex = oColumn.getIndex();
|
|
285
|
+
const bIsFixedColumn = iColumnIndex + TableUtils.Column.getHeaderSpan(oColumn) === oTable.getComputedFixedColumnCount();
|
|
286
286
|
|
|
287
287
|
this.addItem(this._createMenuItem(
|
|
288
288
|
"freeze",
|
|
@@ -290,7 +290,7 @@ sap.ui.define([
|
|
|
290
290
|
null,
|
|
291
291
|
function() {
|
|
292
292
|
// forward the event
|
|
293
|
-
|
|
293
|
+
const bExecuteDefault = oTable.fireColumnFreeze({
|
|
294
294
|
column: oColumn
|
|
295
295
|
});
|
|
296
296
|
|
|
@@ -312,13 +312,13 @@ sap.ui.define([
|
|
|
312
312
|
* @private
|
|
313
313
|
*/
|
|
314
314
|
ColumnMenu.prototype._addColumnVisibilityMenuItem = function() {
|
|
315
|
-
|
|
315
|
+
const oTable = this._getTable();
|
|
316
316
|
|
|
317
317
|
if (oTable && oTable.getShowColumnVisibilityMenu()) {
|
|
318
318
|
if (!oTable._oColumnVisibilityMenuItem || oTable._oColumnVisibilityMenuItem.bIsDestroyed) {
|
|
319
319
|
oTable._oColumnVisibilityMenuItem = this._createMenuItem("column-visibilty", "TBL_COLUMNS");
|
|
320
320
|
|
|
321
|
-
|
|
321
|
+
const oColumnVisibiltyMenu = new Menu(oTable._oColumnVisibilityMenuItem.getId() + "-menu");
|
|
322
322
|
oTable._oColumnVisibilityMenuItem.setSubmenu(oColumnVisibiltyMenu);
|
|
323
323
|
}
|
|
324
324
|
|
|
@@ -334,17 +334,17 @@ sap.ui.define([
|
|
|
334
334
|
* @private
|
|
335
335
|
*/
|
|
336
336
|
ColumnMenu.prototype._createColumnVisibilityMenuItem = function(oColumn) {
|
|
337
|
-
|
|
338
|
-
|
|
337
|
+
const oTable = this._getTable();
|
|
338
|
+
const sText = TableUtils.Column.getHeaderText(oColumn);
|
|
339
339
|
|
|
340
340
|
return new MenuItem({
|
|
341
341
|
text: sText,
|
|
342
342
|
icon: oColumn.getVisible() ? "sap-icon://accept" : null,
|
|
343
343
|
ariaLabelledBy: [oTable.getId() + (oColumn.getVisible() ? "-ariahidecolmenu" : "-ariashowcolmenu")],
|
|
344
344
|
select: jQuery.proxy(function(oEvent) {
|
|
345
|
-
|
|
345
|
+
const bVisible = !oColumn.getVisible();
|
|
346
346
|
if (bVisible || TableUtils.getVisibleColumnCount(oTable) > 1) {
|
|
347
|
-
|
|
347
|
+
let bExecuteDefault = true;
|
|
348
348
|
if (TableUtils.isA(oTable, "sap.ui.table.Table")) {
|
|
349
349
|
bExecuteDefault = oTable.fireColumnVisibility({
|
|
350
350
|
column: oColumn,
|
|
@@ -353,7 +353,7 @@ sap.ui.define([
|
|
|
353
353
|
}
|
|
354
354
|
if (bExecuteDefault) {
|
|
355
355
|
if (oTable.getFocusDomRef().getAttribute("id") === oColumn.getId()) {
|
|
356
|
-
|
|
356
|
+
const aVisibleColumns = oTable._getVisibleColumns();
|
|
357
357
|
aVisibleColumns[Math.min(aVisibleColumns.indexOf(oColumn) + 1, TableUtils.getVisibleColumnCount(oTable) - 2)].focus();
|
|
358
358
|
}
|
|
359
359
|
oColumn.setVisible(bVisible);
|
|
@@ -407,10 +407,10 @@ sap.ui.define([
|
|
|
407
407
|
* @private
|
|
408
408
|
*/
|
|
409
409
|
ColumnMenu.prototype._setFilterValue = function(sValue) {
|
|
410
|
-
|
|
411
|
-
|
|
410
|
+
const oColumn = this.getParent();
|
|
411
|
+
const oTable = (oColumn ? oColumn.getParent() : undefined);
|
|
412
412
|
|
|
413
|
-
|
|
413
|
+
const oFilterField = Element.getElementById(this.getId() + "-filter");
|
|
414
414
|
if (oFilterField && oFilterField.setValue && (oTable && !oTable.getEnableCustomFilter())) {
|
|
415
415
|
oFilterField.setValue(sValue);
|
|
416
416
|
}
|
|
@@ -424,10 +424,10 @@ sap.ui.define([
|
|
|
424
424
|
* @private
|
|
425
425
|
*/
|
|
426
426
|
ColumnMenu.prototype._setFilterState = function(sFilterState) {
|
|
427
|
-
|
|
428
|
-
|
|
427
|
+
const oColumn = this.getParent();
|
|
428
|
+
const oTable = (oColumn ? oColumn.getParent() : undefined);
|
|
429
429
|
|
|
430
|
-
|
|
430
|
+
const oFilterField = Element.getElementById(this.getId() + "-filter");
|
|
431
431
|
if (oFilterField && oFilterField.setValueState && (oTable && !oTable.getEnableCustomFilter())) {
|
|
432
432
|
oFilterField.setValueState(sFilterState);
|
|
433
433
|
}
|
|
@@ -435,10 +435,10 @@ sap.ui.define([
|
|
|
435
435
|
};
|
|
436
436
|
|
|
437
437
|
function getSortedColumns(oTable) {
|
|
438
|
-
|
|
438
|
+
let aColumns = oTable.getColumns();
|
|
439
439
|
|
|
440
440
|
if (oTable.getColumnVisibilityMenuSorter && typeof oTable.getColumnVisibilityMenuSorter === "function") {
|
|
441
|
-
|
|
441
|
+
const oSorter = oTable.getColumnVisibilityMenuSorter();
|
|
442
442
|
if (typeof oSorter === "function") {
|
|
443
443
|
aColumns = aColumns.sort(oSorter);
|
|
444
444
|
}
|
|
@@ -449,9 +449,9 @@ sap.ui.define([
|
|
|
449
449
|
// is column set to invisible by analytical metadata
|
|
450
450
|
function isAnalyticalColumnInvisible(oBinding, oColumn) {
|
|
451
451
|
if (oColumn.isA("sap.ui.table.AnalyticalColumn")) {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
452
|
+
const oQueryResult = oBinding.getAnalyticalQueryResult();
|
|
453
|
+
const oEntityType = oQueryResult.getEntityType();
|
|
454
|
+
const oMetadata = oBinding.getModel().getProperty("/#" + oEntityType.getTypeDescription().name + "/" + oColumn.getLeadingProperty() + "/sap:visible");
|
|
455
455
|
|
|
456
456
|
if (oMetadata && (oMetadata.value === "false" || oMetadata.value === false)) {
|
|
457
457
|
return true;
|
|
@@ -461,24 +461,24 @@ sap.ui.define([
|
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
ColumnMenu.prototype._updateColumnVisibilityMenuItem = function() {
|
|
464
|
-
|
|
464
|
+
const oTable = this._getTable();
|
|
465
465
|
if (!oTable || !oTable._oColumnVisibilityMenuItem) {
|
|
466
466
|
return;
|
|
467
467
|
}
|
|
468
468
|
|
|
469
|
-
|
|
469
|
+
const oSubmenu = oTable._oColumnVisibilityMenuItem.getSubmenu();
|
|
470
470
|
if (!oSubmenu) {
|
|
471
471
|
return;
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
474
|
+
const aColumns = getSortedColumns(oTable);
|
|
475
|
+
let aSubmenuItems = oSubmenu.getItems();
|
|
476
|
+
const aVisibleColumns = oTable._getVisibleColumns();
|
|
477
|
+
const oBinding = oTable.getBinding();
|
|
478
|
+
const bAnalyticalBinding = TableUtils.isA(oBinding, "sap.ui.model.analytics.AnalyticalBinding");
|
|
479
479
|
|
|
480
|
-
for (
|
|
481
|
-
|
|
480
|
+
for (let i = 0; i < aColumns.length; i++) {
|
|
481
|
+
const oColumn = aColumns[i];
|
|
482
482
|
|
|
483
483
|
if (bAnalyticalBinding) {
|
|
484
484
|
if (isAnalyticalColumnInvisible(oBinding, oColumn)) {
|
|
@@ -486,22 +486,22 @@ sap.ui.define([
|
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
-
|
|
489
|
+
let oItem = ColumnToVisibilitySubmenuItemMap.get(oColumn);
|
|
490
490
|
|
|
491
491
|
if (!oItem || oItem.bIsDestroyed) {
|
|
492
|
-
|
|
492
|
+
oItem = this._createColumnVisibilityMenuItem(oColumn);
|
|
493
493
|
oSubmenu.insertItem(oItem, i);
|
|
494
494
|
ColumnToVisibilitySubmenuItemMap.set(oColumn, oItem);
|
|
495
495
|
} else {
|
|
496
|
-
|
|
496
|
+
const iIndex = aSubmenuItems.indexOf(oItem);
|
|
497
497
|
if (i !== iIndex) {
|
|
498
498
|
oSubmenu.removeItem(oItem);
|
|
499
499
|
oSubmenu.insertItem(oItem, i);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
-
|
|
504
|
-
|
|
503
|
+
const bVisible = aVisibleColumns.indexOf(oColumn) > -1;
|
|
504
|
+
const sIcon = bVisible ? "sap-icon://accept" : "";
|
|
505
505
|
aSubmenuItems = oSubmenu.getItems();
|
|
506
506
|
aSubmenuItems[i].setProperty("icon", sIcon);
|
|
507
507
|
aSubmenuItems[i].setEnabled(!bVisible || aVisibleColumns.length > 1);
|
|
@@ -509,7 +509,7 @@ sap.ui.define([
|
|
|
509
509
|
aSubmenuItems[i].addAriaLabelledBy(oTable.getId() + (bVisible ? "-ariahidecolmenu" : "-ariashowcolmenu"));
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
-
for (
|
|
512
|
+
for (let i = aSubmenuItems.length; i > aColumns.length; i--) {
|
|
513
513
|
aSubmenuItems[i - 1].destroy();
|
|
514
514
|
}
|
|
515
515
|
};
|
|
@@ -32,14 +32,14 @@ sap.ui.define([
|
|
|
32
32
|
* <code>sap.ui.commons</code> library.
|
|
33
33
|
* @extends sap.ui.core.Control
|
|
34
34
|
* @author SAP SE
|
|
35
|
-
* @version 1.
|
|
35
|
+
* @version 1.124.0
|
|
36
36
|
*
|
|
37
37
|
* @constructor
|
|
38
38
|
* @private
|
|
39
39
|
* @ui5-restricted sap.ui.mdc
|
|
40
40
|
* @alias sap.ui.table.CreationRow
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
const CreationRow = Control.extend("sap.ui.table.CreationRow", /** @lends sap.ui.table.CreationRow.prototype */ {
|
|
43
43
|
metadata: {
|
|
44
44
|
library: "sap.ui.table",
|
|
45
45
|
properties: {
|
|
@@ -86,8 +86,8 @@ sap.ui.define([
|
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
CreationRow.prototype.setVisible = function(bVisible) {
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
const bVisibleBefore = this.getVisible();
|
|
90
|
+
const oTable = this.getTable();
|
|
91
91
|
|
|
92
92
|
this.setProperty("visible", bVisible);
|
|
93
93
|
|
|
@@ -115,7 +115,7 @@ sap.ui.define([
|
|
|
115
115
|
* @public
|
|
116
116
|
*/
|
|
117
117
|
CreationRow.prototype.resetFocus = function() {
|
|
118
|
-
|
|
118
|
+
const oInteractiveElement = TableUtils.getFirstInteractiveElement(this);
|
|
119
119
|
|
|
120
120
|
if (oInteractiveElement) {
|
|
121
121
|
oInteractiveElement.focus();
|
|
@@ -133,7 +133,7 @@ sap.ui.define([
|
|
|
133
133
|
* @inheritDoc
|
|
134
134
|
*/
|
|
135
135
|
CreationRow.prototype.getFocusDomRef = function() {
|
|
136
|
-
|
|
136
|
+
const oInteractiveElement = TableUtils.getFirstInteractiveElement(this);
|
|
137
137
|
|
|
138
138
|
if (oInteractiveElement) {
|
|
139
139
|
return oInteractiveElement;
|
|
@@ -149,7 +149,7 @@ sap.ui.define([
|
|
|
149
149
|
* @private
|
|
150
150
|
*/
|
|
151
151
|
CreationRow.prototype._fireApply = function() {
|
|
152
|
-
|
|
152
|
+
let bFocusSet = false;
|
|
153
153
|
|
|
154
154
|
if (this.fireApply()) {
|
|
155
155
|
bFocusSet = this.resetFocus();
|
|
@@ -164,7 +164,7 @@ sap.ui.define([
|
|
|
164
164
|
* asynchronously.
|
|
165
165
|
*/
|
|
166
166
|
function setEventMarkedAndFireApplyAsync(oCreationRow, oEvent) {
|
|
167
|
-
|
|
167
|
+
const oFocusedElement = document.activeElement;
|
|
168
168
|
|
|
169
169
|
oCreationRow.getTable().getDomRef("focusDummy").focus();
|
|
170
170
|
oEvent.setMarked();
|
|
@@ -229,10 +229,10 @@ sap.ui.define([
|
|
|
229
229
|
* @private
|
|
230
230
|
*/
|
|
231
231
|
CreationRow.prototype._getToolbar = function() {
|
|
232
|
-
|
|
232
|
+
let oToolbar = this.getToolbar();
|
|
233
233
|
|
|
234
234
|
if (!oToolbar) {
|
|
235
|
-
|
|
235
|
+
let oDefaultToolbar = this.getAggregation("_defaultToolbar");
|
|
236
236
|
|
|
237
237
|
if (!oDefaultToolbar) {
|
|
238
238
|
oDefaultToolbar = createDefaultToolbar(this);
|
|
@@ -258,8 +258,7 @@ sap.ui.define([
|
|
|
258
258
|
* @private
|
|
259
259
|
*/
|
|
260
260
|
CreationRow.prototype._updateDefaultToolbar = function() {
|
|
261
|
-
|
|
262
|
-
var oApplyButton;
|
|
261
|
+
const oDefaultToolbar = this.getAggregation("_defaultToolbar");
|
|
263
262
|
|
|
264
263
|
if (this.getToolbar()) {
|
|
265
264
|
// No need to update the default toolbar if a custom toolbar is used.
|
|
@@ -273,7 +272,8 @@ sap.ui.define([
|
|
|
273
272
|
return;
|
|
274
273
|
}
|
|
275
274
|
|
|
276
|
-
oApplyButton = oDefaultToolbar.getContent()[1];
|
|
275
|
+
const oApplyButton = oDefaultToolbar.getContent()[1];
|
|
276
|
+
|
|
277
277
|
oApplyButton.setEnabled(this.getApplyEnabled());
|
|
278
278
|
oDefaultToolbar.data("sap-ui-table-invalid", null);
|
|
279
279
|
};
|
|
@@ -286,8 +286,8 @@ sap.ui.define([
|
|
|
286
286
|
* @private
|
|
287
287
|
*/
|
|
288
288
|
CreationRow.prototype._getCell = function(iColumnIndex) {
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
const aCells = this.getCells();
|
|
290
|
+
const oCell = aCells.filter(function(oCell) {
|
|
291
291
|
return Column.ofCell(oCell).getIndex() === iColumnIndex;
|
|
292
292
|
})[0];
|
|
293
293
|
|
|
@@ -306,9 +306,9 @@ sap.ui.define([
|
|
|
306
306
|
* @private
|
|
307
307
|
*/
|
|
308
308
|
CreationRow.prototype._getCellDomRef = function(iColumnIndex) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
309
|
+
const oCell = this._getCell(iColumnIndex);
|
|
310
|
+
const oCellContent = oCell ? oCell.getDomRef() : null;
|
|
311
|
+
const $Cell = TableUtils.getCell(this.getTable(), oCellContent, true);
|
|
312
312
|
|
|
313
313
|
if (!$Cell) {
|
|
314
314
|
return null;
|
|
@@ -326,8 +326,8 @@ sap.ui.define([
|
|
|
326
326
|
* @private
|
|
327
327
|
*/
|
|
328
328
|
CreationRow.prototype._focusCell = function(iColumnIndex) {
|
|
329
|
-
|
|
330
|
-
|
|
329
|
+
const oCellDomRef = this._getCellDomRef(iColumnIndex);
|
|
330
|
+
const $InteractiveElements = TableUtils.getInteractiveElements(oCellDomRef);
|
|
331
331
|
|
|
332
332
|
if ($InteractiveElements) {
|
|
333
333
|
$InteractiveElements[0].focus();
|
|
@@ -348,17 +348,17 @@ sap.ui.define([
|
|
|
348
348
|
* @private
|
|
349
349
|
*/
|
|
350
350
|
CreationRow.prototype._takeOverKeyboardHandling = function(oEvent) {
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
const oTable = this.getTable();
|
|
352
|
+
const oTableDomRef = oTable ? oTable.getDomRef() : null;
|
|
353
353
|
|
|
354
354
|
if (!oTableDomRef || !oTableDomRef.contains(document.activeElement)) {
|
|
355
355
|
// Keyboard handling will not be taken over if the table is not rendered or the focus is not inside the table.
|
|
356
356
|
return false;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
359
|
+
const oCell = TableUtils.getCell(this.getTable(), document.activeElement);
|
|
360
|
+
const oCellInfo = TableUtils.getCellInfo(oCell);
|
|
361
|
+
let bFocusSet = false;
|
|
362
362
|
|
|
363
363
|
if (oCellInfo.columnIndex != null && oCellInfo.columnIndex >= 0) {
|
|
364
364
|
// If the currently focused element is a table cell with a column index information, the keyboard handling will only be taken over if the
|
|
@@ -381,18 +381,18 @@ sap.ui.define([
|
|
|
381
381
|
* @private
|
|
382
382
|
*/
|
|
383
383
|
CreationRow.prototype._update = function() {
|
|
384
|
-
|
|
384
|
+
const oTable = this.getTable();
|
|
385
385
|
|
|
386
386
|
if (!oTable) {
|
|
387
387
|
this.removeAllCells();
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
|
|
391
|
+
const aColumns = oTable.getColumns();
|
|
392
392
|
|
|
393
393
|
this.removeAllCells();
|
|
394
394
|
|
|
395
|
-
for (
|
|
395
|
+
for (let i = 0, l = aColumns.length; i < l; i++) {
|
|
396
396
|
if (aColumns[i].getVisible()) {
|
|
397
397
|
this.addCell(aColumns[i].getTemplateClone(i, "Creation"));
|
|
398
398
|
}
|
|
@@ -406,7 +406,7 @@ sap.ui.define([
|
|
|
406
406
|
* @private
|
|
407
407
|
*/
|
|
408
408
|
CreationRow.prototype.getTable = function() {
|
|
409
|
-
|
|
409
|
+
const oParent = this.getParent();
|
|
410
410
|
return TableUtils.isA(oParent, "sap.ui.table.Table") ? oParent : null;
|
|
411
411
|
};
|
|
412
412
|
|
|
@@ -18,7 +18,7 @@ sap.ui.define([
|
|
|
18
18
|
* @namespace
|
|
19
19
|
* @alias sap.ui.table.CreationRowRenderer
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
const CreationRowRenderer = {
|
|
22
22
|
apiVersion: 2
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -29,7 +29,7 @@ sap.ui.define([
|
|
|
29
29
|
* @param {sap.ui.table.CreationRow} oCreationRow The <code>CreationRow</code> that should be rendered
|
|
30
30
|
*/
|
|
31
31
|
CreationRowRenderer.render = function(oRm, oCreationRow) {
|
|
32
|
-
|
|
32
|
+
const oTable = oCreationRow.getTable();
|
|
33
33
|
|
|
34
34
|
if (!oTable) {
|
|
35
35
|
return;
|
|
@@ -106,9 +106,9 @@ sap.ui.define([
|
|
|
106
106
|
// This method is very similar to TableRenderer.renderTableControlCnt, but could not be reused without bloating it up heavily. A reusable
|
|
107
107
|
// solution requires major refactoring.
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
const iStartColumnIndex = bFixedTable ? 0 : oTable.getComputedFixedColumnCount();
|
|
110
|
+
const iEndColumnIndex = bFixedTable ? oTable.getComputedFixedColumnCount() : oTable.getColumns().length;
|
|
111
|
+
const oCreationRow = oTable.getCreationRow();
|
|
112
112
|
|
|
113
113
|
oRm.openStart("table");
|
|
114
114
|
oTable._getAccRenderExtension().writeAriaAttributesFor(oRm, oTable, "CREATIONROW_TABLE");
|
|
@@ -121,12 +121,12 @@ sap.ui.define([
|
|
|
121
121
|
oRm.class("sapUiTableCtrlCol");
|
|
122
122
|
oRm.openEnd();
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
124
|
+
const aColumns = oTable.getColumns();
|
|
125
|
+
const aColumnParams = new Array(iEndColumnIndex);
|
|
126
|
+
let iColumnIndex;
|
|
127
|
+
let oColumn;
|
|
128
|
+
let bRenderDummyColumn = !bFixedTable && iEndColumnIndex > iStartColumnIndex;
|
|
129
|
+
let oColParam;
|
|
130
130
|
|
|
131
131
|
for (iColumnIndex = iStartColumnIndex; iColumnIndex < iEndColumnIndex; iColumnIndex++) {
|
|
132
132
|
oColumn = aColumns[iColumnIndex];
|
|
@@ -134,7 +134,7 @@ sap.ui.define([
|
|
|
134
134
|
shouldRender: !!(oColumn && oColumn.shouldRender())
|
|
135
135
|
};
|
|
136
136
|
if (oColParam.shouldRender) {
|
|
137
|
-
|
|
137
|
+
let sWidth = oColumn.getWidth();
|
|
138
138
|
if (TableUtils.isVariableWidth(sWidth)) {
|
|
139
139
|
// if some of the columns have variable width, they serve as the dummy column
|
|
140
140
|
// and take available place. Do not render a dummy column in this case.
|
|
@@ -180,8 +180,8 @@ sap.ui.define([
|
|
|
180
180
|
oRm.class("sapUiTableTr");
|
|
181
181
|
oRm.openEnd();
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
const aCells = oCreationRow.getCells();
|
|
184
|
+
const aVisibleColumns = TableRenderer.getColumnsToRender(oTable, iStartColumnIndex, iEndColumnIndex);
|
|
185
185
|
|
|
186
186
|
for (iColumnIndex = iStartColumnIndex; iColumnIndex < iEndColumnIndex; iColumnIndex++) {
|
|
187
187
|
oColumn = aColumns[iColumnIndex];
|
|
@@ -191,13 +191,13 @@ sap.ui.define([
|
|
|
191
191
|
oRm.openStart("td");
|
|
192
192
|
oRm.attr("data-sap-ui-colid", oColumn.getId());
|
|
193
193
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
194
|
+
const oCell = oCreationRow._getCell(iColumnIndex);
|
|
195
|
+
const nColumns = aVisibleColumns.length;
|
|
196
|
+
const bIsFirstColumn = nColumns > 0 && aVisibleColumns[0] === oColumn;
|
|
197
|
+
const bIsLastColumn = nColumns > 0 && aVisibleColumns[nColumns - 1] === oColumn;
|
|
198
|
+
const iLastFixedColumnIndex = TableRenderer.getLastFixedColumnIndex(oTable);
|
|
199
|
+
const bIsLastFixedColumn = bFixedTable & iLastFixedColumnIndex === iColumnIndex;
|
|
200
|
+
const sHAlign = Renderer.getTextAlign(oColumn.getHAlign(), oCell && oCell.getTextDirection && oCell.getTextDirection());
|
|
201
201
|
|
|
202
202
|
oRm.style("text-align", sHAlign);
|
|
203
203
|
|