@openui5/sap.ui.table 1.123.1 → 1.124.1
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
|
@@ -16,7 +16,7 @@ sap.ui.define([
|
|
|
16
16
|
/**
|
|
17
17
|
* Map from table to its hierarchy mode.
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
const TableToHierarchyModeMap = new window.WeakMap();
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Static collection of utility functions related to grouping of sap.ui.table.Table, ...
|
|
@@ -24,12 +24,12 @@ 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.124.1
|
|
28
28
|
* @namespace
|
|
29
29
|
* @alias sap.ui.table.utils._GroupingUtils
|
|
30
30
|
* @private
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
const GroupingUtils = {
|
|
33
33
|
TableUtils: null, // Avoid cyclic dependency. Will be filled by TableUtils
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -77,7 +77,7 @@ sap.ui.define([
|
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
const sCurrentHierarchyMode = GroupingUtils.getHierarchyMode(oTable);
|
|
81
81
|
|
|
82
82
|
if (sCurrentHierarchyMode !== sMode) {
|
|
83
83
|
TableToHierarchyModeMap.set(oTable, sMode);
|
|
@@ -141,7 +141,7 @@ sap.ui.define([
|
|
|
141
141
|
* @returns {boolean} Whether the table is in a group mode.
|
|
142
142
|
*/
|
|
143
143
|
isInGroupMode: function(oTable) {
|
|
144
|
-
|
|
144
|
+
const sHierarchyMode = GroupingUtils.getHierarchyMode(oTable);
|
|
145
145
|
return sHierarchyMode === GroupingUtils.HierarchyMode.Group || sHierarchyMode === GroupingUtils.HierarchyMode.GroupedTree;
|
|
146
146
|
},
|
|
147
147
|
|
|
@@ -192,7 +192,7 @@ sap.ui.define([
|
|
|
192
192
|
* @returns {boolean} Whether the cell is in a group header row.
|
|
193
193
|
*/
|
|
194
194
|
isInGroupHeaderRow: function(oCellRef) {
|
|
195
|
-
|
|
195
|
+
const oInfo = GroupingUtils.TableUtils.getCellInfo(oCellRef);
|
|
196
196
|
|
|
197
197
|
if (oInfo.isOfType(GroupingUtils.TableUtils.CELLTYPE.ANYCONTENTCELL)) {
|
|
198
198
|
return oInfo.cell.parentElement.classList.contains("sapUiTableGroupHeaderRow");
|
|
@@ -208,7 +208,7 @@ sap.ui.define([
|
|
|
208
208
|
* @returns {boolean} Whether the cell is in a summary row.
|
|
209
209
|
*/
|
|
210
210
|
isInSummaryRow: function(oCellRef) {
|
|
211
|
-
|
|
211
|
+
const oInfo = GroupingUtils.TableUtils.getCellInfo(oCellRef);
|
|
212
212
|
|
|
213
213
|
if (oInfo.isOfType(GroupingUtils.TableUtils.CELLTYPE.ANYCONTENTCELL)) {
|
|
214
214
|
return oInfo.cell.parentElement.classList.contains("sapUiTableSummaryRow");
|
|
@@ -225,12 +225,12 @@ sap.ui.define([
|
|
|
225
225
|
* @private
|
|
226
226
|
*/
|
|
227
227
|
calcGroupIndent: function(oRow) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
const bTreeIndentation = GroupingUtils.getHierarchyMode(oRow.getTable()) === GroupingUtils.HierarchyMode.GroupedTree;
|
|
229
|
+
const bReduceIndentation = !bTreeIndentation && !oRow.isGroupHeader() && !oRow.isTotalSummary();
|
|
230
|
+
const iLevel = oRow.getLevel() - (bReduceIndentation ? 1 : 0);
|
|
231
|
+
let iIndent = 0;
|
|
232
232
|
|
|
233
|
-
for (
|
|
233
|
+
for (let i = 1; i < iLevel; i++) {
|
|
234
234
|
if (i === 1) {
|
|
235
235
|
iIndent = 24;
|
|
236
236
|
} else if (i === 2) {
|
|
@@ -262,12 +262,12 @@ sap.ui.define([
|
|
|
262
262
|
* @private
|
|
263
263
|
*/
|
|
264
264
|
setGroupIndent: function(oRow, iIndent) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
265
|
+
const oDomRefs = oRow.getDomRefs(true);
|
|
266
|
+
const $Row = oDomRefs.row;
|
|
267
|
+
const $RowHdr = oDomRefs.rowHeaderPart;
|
|
268
|
+
const bRTL = oRow.getTable()._bRtlMode;
|
|
269
|
+
const $FirstCellContentInRow = $Row.find("td.sapUiTableCellFirst > .sapUiTableCellInner");
|
|
270
|
+
const $Shield = $RowHdr.find(".sapUiTableGroupShield");
|
|
271
271
|
|
|
272
272
|
if (iIndent <= 0) {
|
|
273
273
|
// No indent -> Remove custom manipulations (see else)
|
|
@@ -293,10 +293,10 @@ sap.ui.define([
|
|
|
293
293
|
* @private
|
|
294
294
|
*/
|
|
295
295
|
setTreeIndent: function(oRow, iIndent) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
296
|
+
const oDomRefs = oRow.getDomRefs(true);
|
|
297
|
+
const $Row = oDomRefs.row;
|
|
298
|
+
const bRTL = oRow.getTable()._bRtlMode;
|
|
299
|
+
const $TreeIcon = $Row.find(".sapUiTableTreeIcon");
|
|
300
300
|
|
|
301
301
|
$TreeIcon.css(bRTL ? "margin-right" : "margin-left", iIndent > 0 ? iIndent + "px" : "");
|
|
302
302
|
},
|
|
@@ -307,17 +307,17 @@ sap.ui.define([
|
|
|
307
307
|
* @param {sap.ui.table.Row} oRow Instance of the row.
|
|
308
308
|
*/
|
|
309
309
|
updateTableRowForGrouping: function(oRow) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
310
|
+
const oTable = oRow.getTable();
|
|
311
|
+
const oDomRefs = oRow.getDomRefs(true);
|
|
312
|
+
const $Row = oDomRefs.row;
|
|
313
|
+
const bIsExpanded = oRow.isExpanded();
|
|
314
|
+
const bIsExpandable = oRow.isExpandable();
|
|
315
315
|
|
|
316
316
|
$Row.toggleClass("sapUiTableSummaryRow", oRow.isSummary());
|
|
317
317
|
|
|
318
318
|
if (GroupingUtils.isInGroupMode(oTable)) {
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
const sTitle = oRow.getTitle();
|
|
320
|
+
const iIndent = GroupingUtils.calcGroupIndent(oRow);
|
|
321
321
|
|
|
322
322
|
oRow.$("groupHeader")
|
|
323
323
|
.toggleClass("sapUiTableGroupIconOpen", bIsExpandable && bIsExpanded)
|
|
@@ -328,17 +328,17 @@ sap.ui.define([
|
|
|
328
328
|
.toggleClass("sapUiTableGroupHeaderRow", oRow.isGroupHeader());
|
|
329
329
|
|
|
330
330
|
if (GroupingUtils.showGroupMenuButton(oTable)) {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
331
|
+
const $Table = oTable.$();
|
|
332
|
+
const iScrollbarWidth = $Table.hasClass("sapUiTableVScr") ? $Table.find(".sapUiTableVSb").width() : 0;
|
|
333
|
+
const $GroupHeaderMenuButton = oDomRefs.rowHeaderPart.find(".sapUiTableGroupMenuButton");
|
|
334
|
+
const iMenuButtonOffset = $Table.width() - $GroupHeaderMenuButton.width() - iScrollbarWidth - 5 - iIndent;
|
|
335
335
|
|
|
336
336
|
$GroupHeaderMenuButton.css(oTable._bRtlMode ? "right" : "left", iMenuButtonOffset + "px");
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
if (GroupingUtils.isInTreeMode(oTable)) {
|
|
341
|
-
|
|
341
|
+
const $TreeIcon = $Row.find(".sapUiTableTreeIcon");
|
|
342
342
|
|
|
343
343
|
if (!bIsExpandable && document.activeElement === $TreeIcon[0]) {
|
|
344
344
|
GroupingUtils.TableUtils.getParentCell(oTable, $TreeIcon[0]).trigger("focus");
|
|
@@ -361,8 +361,8 @@ sap.ui.define([
|
|
|
361
361
|
* @param {sap.ui.table.Row} oRow Instance of the row
|
|
362
362
|
*/
|
|
363
363
|
cleanupTableRowForGrouping: function(oRow) {
|
|
364
|
-
|
|
365
|
-
|
|
364
|
+
const oTable = oRow.getTable();
|
|
365
|
+
const oDomRefs = oRow.getDomRefs(true);
|
|
366
366
|
|
|
367
367
|
if (GroupingUtils.isInGroupMode(oTable)) {
|
|
368
368
|
oDomRefs.row.removeClass("sapUiTableGroupHeaderRow sapUiTableSummaryRow sapUiTableRowIndented");
|
|
@@ -432,11 +432,11 @@ sap.ui.define([
|
|
|
432
432
|
return;
|
|
433
433
|
}
|
|
434
434
|
|
|
435
|
-
|
|
435
|
+
const oBinding = oTable.getBinding();
|
|
436
436
|
|
|
437
437
|
// check for grouping being supported or not (only for client ListBindings!!)
|
|
438
|
-
|
|
439
|
-
|
|
438
|
+
const oGroupBy = Element.getElementById(oTable.getGroupBy());
|
|
439
|
+
const bIsSupported = oGroupBy && oGroupBy.getGrouped() && GroupingUtils.TableUtils.isA(oBinding, "sap.ui.model.ClientListBinding");
|
|
440
440
|
|
|
441
441
|
// only enhance the binding if it has not been done yet and supported!
|
|
442
442
|
if (!bIsSupported || oBinding._modified) {
|
|
@@ -451,24 +451,24 @@ sap.ui.define([
|
|
|
451
451
|
GroupingUtils.setToDefaultGroupMode(oTable);
|
|
452
452
|
|
|
453
453
|
// we use sorting finally to sort the values and afterwards group them
|
|
454
|
-
|
|
454
|
+
const sPropertyName = oGroupBy.getSortProperty();
|
|
455
455
|
oBinding.sort(new Sorter(sPropertyName));
|
|
456
456
|
|
|
457
457
|
// fetch the contexts from the original binding
|
|
458
|
-
|
|
459
|
-
|
|
458
|
+
const iLength = oTable._getTotalRowCount();
|
|
459
|
+
const aContexts = oBinding.getContexts(0, iLength);
|
|
460
460
|
|
|
461
461
|
// add the context information for the group headers which are later on
|
|
462
462
|
// used for displaying the grouping information of each group
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
for (
|
|
466
|
-
|
|
463
|
+
let sKey;
|
|
464
|
+
let iCounter = 0;
|
|
465
|
+
for (let i = iLength - 1; i >= 0; i--) {
|
|
466
|
+
const sNewKey = aContexts[i].getProperty(sPropertyName);
|
|
467
467
|
if (!sKey) {
|
|
468
468
|
sKey = sNewKey;
|
|
469
469
|
}
|
|
470
470
|
if (sKey !== sNewKey) {
|
|
471
|
-
|
|
471
|
+
const oGroupContext = aContexts[i + 1].getModel().getContext("/sap.ui.table.GroupInfo" + i);
|
|
472
472
|
oGroupContext.__groupInfo = {
|
|
473
473
|
oContext: aContexts[i + 1],
|
|
474
474
|
name: sKey,
|
|
@@ -484,7 +484,7 @@ sap.ui.define([
|
|
|
484
484
|
}
|
|
485
485
|
iCounter++;
|
|
486
486
|
}
|
|
487
|
-
|
|
487
|
+
const oGroupContext = aContexts[0].getModel().getContext("/sap.ui.table.GroupInfo");
|
|
488
488
|
oGroupContext.__groupInfo = {
|
|
489
489
|
oContext: aContexts[0],
|
|
490
490
|
name: sKey,
|
|
@@ -505,12 +505,12 @@ sap.ui.define([
|
|
|
505
505
|
});
|
|
506
506
|
|
|
507
507
|
function isGroupHeader(iIndex) {
|
|
508
|
-
|
|
508
|
+
const oContext = aContexts[iIndex];
|
|
509
509
|
return (oContext && oContext.__groupInfo && oContext.__groupInfo.groupHeader) === true;
|
|
510
510
|
}
|
|
511
511
|
|
|
512
512
|
oTable._experimentalGroupingRowState = function(oState) {
|
|
513
|
-
|
|
513
|
+
const oContext = oState.context;
|
|
514
514
|
|
|
515
515
|
if ((oContext && oContext.__groupInfo && oContext.__groupInfo.groupHeader) === true) {
|
|
516
516
|
oState.type = oState.Type.GroupHeader;
|
|
@@ -523,9 +523,9 @@ sap.ui.define([
|
|
|
523
523
|
};
|
|
524
524
|
|
|
525
525
|
oTable._experimentalGroupingExpand = function(oRow) {
|
|
526
|
-
|
|
526
|
+
const iRowIndex = oRow.getIndex();
|
|
527
527
|
if (isGroupHeader(iRowIndex) && !aContexts[iRowIndex].__groupInfo.expanded) {
|
|
528
|
-
for (
|
|
528
|
+
for (let i = 0; i < aContexts[iRowIndex].__childs.length; i++) {
|
|
529
529
|
aContexts.splice(iRowIndex + 1 + i, 0, aContexts[iRowIndex].__childs[i]);
|
|
530
530
|
}
|
|
531
531
|
delete aContexts[iRowIndex].__childs;
|
|
@@ -535,7 +535,7 @@ sap.ui.define([
|
|
|
535
535
|
};
|
|
536
536
|
|
|
537
537
|
oTable._experimentalGroupingCollapse = function(oRow) {
|
|
538
|
-
|
|
538
|
+
const iRowIndex = oRow.getIndex();
|
|
539
539
|
if (isGroupHeader(iRowIndex) && aContexts[iRowIndex].__groupInfo.expanded) {
|
|
540
540
|
aContexts[iRowIndex].__childs = aContexts.splice(iRowIndex + 1, aContexts[iRowIndex].__groupInfo.count);
|
|
541
541
|
aContexts[iRowIndex].__groupInfo.expanded = false;
|
|
@@ -543,7 +543,7 @@ sap.ui.define([
|
|
|
543
543
|
}
|
|
544
544
|
};
|
|
545
545
|
|
|
546
|
-
|
|
546
|
+
const Hook = GroupingUtils.TableUtils.Hook;
|
|
547
547
|
Hook.register(oTable, Hook.Keys.Row.UpdateState, oTable._experimentalGroupingRowState);
|
|
548
548
|
Hook.register(oTable, Hook.Keys.Row.Expand, oTable._experimentalGroupingExpand);
|
|
549
549
|
Hook.register(oTable, Hook.Keys.Row.Collapse, oTable._experimentalGroupingCollapse);
|
|
@@ -559,8 +559,8 @@ sap.ui.define([
|
|
|
559
559
|
* @param {sap.ui.table.Table} oTable Instance of the table.
|
|
560
560
|
*/
|
|
561
561
|
resetExperimentalGrouping: function(oTable) {
|
|
562
|
-
|
|
563
|
-
|
|
562
|
+
const oBinding = oTable.getBinding();
|
|
563
|
+
const Hook = GroupingUtils.TableUtils.Hook;
|
|
564
564
|
|
|
565
565
|
if (oBinding && oBinding._modified) {
|
|
566
566
|
GroupingUtils.setToDefaultFlatMode(oTable);
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(DataType, ChangeReason) {
|
|
9
9
|
"use strict";
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const Hooks = new window.WeakMap();
|
|
12
|
+
const MASTER_HOOK_KEY = {};
|
|
13
|
+
const mKeyMapForExternalUsage = {};
|
|
14
|
+
const mHookMetadataByKey = {};
|
|
15
|
+
const aForbiddenTypes = ["function"];
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Static collection of utility functions providing a table internal hook system.
|
|
@@ -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.124.1
|
|
26
26
|
* @namespace
|
|
27
27
|
* @alias sap.ui.table.utils._HookUtils
|
|
28
28
|
*
|
|
@@ -75,7 +75,7 @@ sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(Da
|
|
|
75
75
|
*
|
|
76
76
|
* @private
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
const HookUtils = {};
|
|
79
79
|
|
|
80
80
|
/*
|
|
81
81
|
* This table internal hooks system is intended to simplify the communication between table modules. Such modules might need to be decoupled from
|
|
@@ -109,7 +109,7 @@ sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(Da
|
|
|
109
109
|
* Forbidden types: "function"
|
|
110
110
|
*/
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
const mHookMetadata = {
|
|
113
113
|
Table: {
|
|
114
114
|
// Called when Table#bindRows or Table#bindAggregation("rows", ...) is called, before Control#bindAggregation.
|
|
115
115
|
BindRows: {
|
|
@@ -251,20 +251,20 @@ sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(Da
|
|
|
251
251
|
* @param {string} sKey The hook to call.
|
|
252
252
|
*/
|
|
253
253
|
HookUtils.call = function(oScope, sKey) {
|
|
254
|
-
|
|
254
|
+
const aHooks = Hooks.get(oScope);
|
|
255
255
|
|
|
256
256
|
if (!isValidScope(oScope) || !isValidKey(sKey)) {
|
|
257
257
|
return;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
|
|
260
|
+
const mHookMetadata = getHookMetadataByKey(sKey);
|
|
261
261
|
|
|
262
262
|
if (aHooks == null) {
|
|
263
263
|
return;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
const aArguments = sanitizeArguments(Array.prototype.slice.call(arguments, 2));
|
|
267
|
+
const bArgumentsValid = validateArguments(mHookMetadata, aArguments);
|
|
268
268
|
|
|
269
269
|
if (!bArgumentsValid) {
|
|
270
270
|
throw new Error("Hook with key " + sKey + " was not called. Invalid arguments passed\n" + oScope);
|
|
@@ -272,8 +272,8 @@ sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(Da
|
|
|
272
272
|
|
|
273
273
|
aHooks.map((oHook) => {
|
|
274
274
|
if (oHook.key === MASTER_HOOK_KEY) {
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
const oCall = {};
|
|
276
|
+
const oHandlerContext = oHook.handlerContext == null ? oHook.target : oHook.handlerContext;
|
|
277
277
|
|
|
278
278
|
oCall[sKey] = aArguments;
|
|
279
279
|
HookUtils.TableUtils.dynamicCall(oHook.target, oCall, oHandlerContext);
|
|
@@ -299,13 +299,13 @@ sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(Da
|
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
let aHooks = Hooks.get(oScope);
|
|
303
303
|
|
|
304
304
|
if (aHooks == null) {
|
|
305
305
|
aHooks = [];
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
|
|
308
|
+
const bMasterHookInstalled = aHooks.some(function(oHook) {
|
|
309
309
|
return oHook.key === MASTER_HOOK_KEY && oHook.target === oTarget && oHook.handlerContext === oThis;
|
|
310
310
|
});
|
|
311
311
|
|
|
@@ -330,14 +330,14 @@ sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(Da
|
|
|
330
330
|
* @param {Object} [oThis] The context of hook handler calls.
|
|
331
331
|
*/
|
|
332
332
|
HookUtils.uninstall = function(oScope, oTarget, oThis) {
|
|
333
|
-
|
|
333
|
+
const aHooks = Hooks.get(oScope);
|
|
334
334
|
|
|
335
335
|
if (aHooks == null || !oTarget) {
|
|
336
336
|
return;
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
for (
|
|
340
|
-
|
|
339
|
+
for (let i = 0; i < aHooks.length; i++) {
|
|
340
|
+
const oHook = aHooks[i];
|
|
341
341
|
|
|
342
342
|
if (oHook.key === MASTER_HOOK_KEY && oHook.target === oTarget && oHook.handlerContext === oThis) {
|
|
343
343
|
aHooks.splice(i, 1);
|
|
@@ -366,7 +366,7 @@ sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(Da
|
|
|
366
366
|
return;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
|
|
369
|
+
let aHooks = Hooks.get(oScope);
|
|
370
370
|
|
|
371
371
|
if (aHooks == null) {
|
|
372
372
|
aHooks = [];
|
|
@@ -392,14 +392,14 @@ sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(Da
|
|
|
392
392
|
* @param {Object} [oThis] The context of hook handler calls.
|
|
393
393
|
*/
|
|
394
394
|
HookUtils.deregister = function(oScope, sKey, fnHandler, oThis) {
|
|
395
|
-
|
|
395
|
+
const aHooks = Hooks.get(oScope);
|
|
396
396
|
|
|
397
397
|
if (aHooks == null) {
|
|
398
398
|
return;
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
for (
|
|
402
|
-
|
|
401
|
+
for (let i = 0; i < aHooks.length; i++) {
|
|
402
|
+
const oHook = aHooks[i];
|
|
403
403
|
|
|
404
404
|
if (oHook.key === sKey && oHook.handler === fnHandler && oHook.handlerContext === oThis) {
|
|
405
405
|
aHooks.splice(i, 1);
|
|
@@ -416,7 +416,7 @@ sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(Da
|
|
|
416
416
|
|
|
417
417
|
function extractKeys(mKeys, mCurrent, sCurrentKey) {
|
|
418
418
|
Object.keys(mCurrent).forEach(function(sProperty) {
|
|
419
|
-
|
|
419
|
+
const sKey = sCurrentKey ? sCurrentKey + "." + sProperty : sProperty;
|
|
420
420
|
|
|
421
421
|
if ("arguments" in mCurrent[sProperty]) {
|
|
422
422
|
aForbiddenTypes.forEach(function(sForbiddenType) {
|
|
@@ -451,7 +451,7 @@ sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(Da
|
|
|
451
451
|
|
|
452
452
|
function sanitizeArguments(aArguments) {
|
|
453
453
|
while (aArguments.length > 0) {
|
|
454
|
-
|
|
454
|
+
const vArgument = aArguments.pop();
|
|
455
455
|
if (vArgument != null) {
|
|
456
456
|
aArguments.push(vArgument);
|
|
457
457
|
break;
|
|
@@ -463,7 +463,7 @@ sap.ui.define(["sap/ui/base/DataType", "sap/ui/model/ChangeReason"], function(Da
|
|
|
463
463
|
|
|
464
464
|
function validateArguments(mHookMetadata, aArguments) {
|
|
465
465
|
return mHookMetadata.arguments.length >= aArguments.length && aArguments.every(function(vValue, iIndex) {
|
|
466
|
-
|
|
466
|
+
const mArgument = mHookMetadata.arguments[iIndex];
|
|
467
467
|
if (typeof mArgument.type === "function") {
|
|
468
468
|
return mArgument.type(vValue);
|
|
469
469
|
}
|
|
@@ -18,9 +18,9 @@ sap.ui.define([
|
|
|
18
18
|
|
|
19
19
|
function onCellFilterSelect(oColumn, oRow) {
|
|
20
20
|
// "this" is the table instance.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const oRowContext = oRow.getRowBindingContext();
|
|
22
|
+
const sFilterProperty = oColumn.getFilterProperty();
|
|
23
|
+
let sFilterValue = oRowContext.getProperty(sFilterProperty);
|
|
24
24
|
|
|
25
25
|
if (sFilterValue != null && typeof sFilterValue !== "string") {
|
|
26
26
|
sFilterValue = sFilterValue.toString();
|
|
@@ -42,12 +42,12 @@ 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.124.1
|
|
46
46
|
* @namespace
|
|
47
47
|
* @alias sap.ui.table.utils._MenuUtils
|
|
48
48
|
* @private
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
const MenuUtils = {
|
|
51
51
|
|
|
52
52
|
TableUtils: null, // Avoid cyclic dependency. Will be filled by TableUtils
|
|
53
53
|
|
|
@@ -65,8 +65,8 @@ sap.ui.define([
|
|
|
65
65
|
* @param {jQuery.Event} oEvent The event object
|
|
66
66
|
*/
|
|
67
67
|
openContextMenu: function(oTable, oEvent) {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const $Cell = MenuUtils.TableUtils.getCell(oTable, oEvent.target);
|
|
69
|
+
const oCellInfo = MenuUtils.TableUtils.getCellInfo($Cell);
|
|
70
70
|
|
|
71
71
|
if (oCellInfo.isOfType(MenuUtils.TableUtils.CELLTYPE.COLUMNHEADER)) {
|
|
72
72
|
oTable.getColumns()[oCellInfo.columnIndex]._openHeaderMenu(oCellInfo.cell);
|
|
@@ -76,8 +76,8 @@ sap.ui.define([
|
|
|
76
76
|
* @deprecated As of version 1.54
|
|
77
77
|
*/
|
|
78
78
|
if (oCellInfo.columnIndex >= 0) {
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
const oRowColCell = MenuUtils.TableUtils.getRowColCell(oTable, oCellInfo.rowIndex, oCellInfo.columnIndex, true);
|
|
80
|
+
const bExecuteDefault = oTable.fireCellContextmenu({
|
|
81
81
|
rowIndex: oRowColCell.row.getIndex(),
|
|
82
82
|
columnIndex: oCellInfo.columnIndex,
|
|
83
83
|
columnId: oRowColCell.column.getId(),
|
|
@@ -107,7 +107,7 @@ sap.ui.define([
|
|
|
107
107
|
* @private
|
|
108
108
|
*/
|
|
109
109
|
_openContentCellContextMenu: function(oTable, oCellInfo, oEvent) {
|
|
110
|
-
|
|
110
|
+
const oRow = oTable.getRows()[oCellInfo.rowIndex];
|
|
111
111
|
|
|
112
112
|
if (oRow.isEmpty()) {
|
|
113
113
|
return;
|
|
@@ -132,12 +132,12 @@ sap.ui.define([
|
|
|
132
132
|
* @private
|
|
133
133
|
*/
|
|
134
134
|
_openCustomContentCellContextMenu: function(oTable, oCellInfo, oEvent) {
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
const oRow = oTable.getRows()[oCellInfo.rowIndex];
|
|
136
|
+
const oContextMenu = oTable.getContextMenu();
|
|
137
137
|
|
|
138
138
|
oContextMenu.setBindingContext(oRow.getRowBindingContext(), oTable.getBindingInfo("rows").model);
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
const bExecuteDefault = oTable.fireBeforeOpenContextMenu({
|
|
141
141
|
rowIndex: oRow.getIndex(),
|
|
142
142
|
columnIndex: oCellInfo.columnIndex >= 0 ? oCellInfo.columnIndex : null,
|
|
143
143
|
contextMenu: oContextMenu
|
|
@@ -161,16 +161,16 @@ sap.ui.define([
|
|
|
161
161
|
* @private
|
|
162
162
|
*/
|
|
163
163
|
_openDefaultContentCellContextMenu: function(oTable, oCellInfo, oEvent) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
const iRowIndex = oCellInfo.rowIndex;
|
|
165
|
+
const oRow = oTable.getRows()[iRowIndex];
|
|
166
|
+
const oColumn = oTable.getColumns()[oCellInfo.columnIndex];
|
|
167
167
|
|
|
168
168
|
if (!oTable._oCellContextMenu) {
|
|
169
169
|
oTable._oCellContextMenu = new Menu(oTable.getId() + "-cellcontextmenu");
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
const sCellFilterMenuItemId = oTable._oCellContextMenu.getId() + "-cellfilter";
|
|
173
|
+
let oCellFilterMenuItem = Element.getElementById(sCellFilterMenuItemId);
|
|
174
174
|
|
|
175
175
|
if (oTable.getEnableCellFilter() && oColumn?.isFilterableByMenu() && !oRow.isGroupHeader() && !oRow.isSummary()) {
|
|
176
176
|
if (!oCellFilterMenuItem) {
|
|
@@ -225,7 +225,7 @@ sap.ui.define([
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
// Destroy the items of the table.
|
|
228
|
-
|
|
228
|
+
const sCellFilterMenuItemId = oTable._oCellContextMenu.getId() + "-cellfilter";
|
|
229
229
|
Element.getElementById(sCellFilterMenuItemId)?.destroy();
|
|
230
230
|
|
|
231
231
|
// We don't want to destroy items which were added, for example, by hooks. The owners of the items are responsible for them.
|