@openui5/sap.ui.table 1.105.1 → 1.107.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 +20 -17
- package/THIRDPARTY.txt +31 -21
- package/package.json +3 -3
- package/src/sap/ui/table/.library +1 -1
- package/src/sap/ui/table/AnalyticalColumn.js +20 -3
- package/src/sap/ui/table/AnalyticalColumnMenu.js +19 -15
- package/src/sap/ui/table/AnalyticalTable.js +1 -17
- package/src/sap/ui/table/Column.js +102 -50
- package/src/sap/ui/table/ColumnMenu.js +19 -5
- package/src/sap/ui/table/CreationRow.js +1 -2
- package/src/sap/ui/table/Row.js +1 -3
- package/src/sap/ui/table/RowAction.js +1 -2
- package/src/sap/ui/table/RowActionItem.js +1 -2
- package/src/sap/ui/table/RowSettings.js +1 -2
- package/src/sap/ui/table/Table.js +77 -44
- package/src/sap/ui/table/TablePersoController.js +6 -5
- package/src/sap/ui/table/TableRenderer.js +7 -6
- package/src/sap/ui/table/TreeTable.js +2 -10
- package/src/sap/ui/table/extensions/Accessibility.js +37 -24
- package/src/sap/ui/table/extensions/AccessibilityRender.js +3 -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 -6
- package/src/sap/ui/table/extensions/Pointer.js +4 -2
- 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 +46 -7
- package/src/sap/ui/table/library.js +10 -16
- package/src/sap/ui/table/menus/ColumnHeaderMenuAdapter.js +224 -0
- package/src/sap/ui/table/menus/MobileColumnHeaderMenuAdapter.js +428 -0
- package/src/sap/ui/table/messagebundle.properties +6 -0
- package/src/sap/ui/table/messagebundle_ar.properties +4 -0
- package/src/sap/ui/table/messagebundle_bg.properties +4 -0
- package/src/sap/ui/table/messagebundle_ca.properties +4 -0
- package/src/sap/ui/table/messagebundle_cs.properties +4 -0
- package/src/sap/ui/table/messagebundle_cy.properties +4 -0
- package/src/sap/ui/table/messagebundle_da.properties +4 -0
- package/src/sap/ui/table/messagebundle_de.properties +4 -0
- package/src/sap/ui/table/messagebundle_el.properties +4 -0
- package/src/sap/ui/table/messagebundle_en.properties +4 -0
- package/src/sap/ui/table/messagebundle_en_GB.properties +4 -0
- package/src/sap/ui/table/messagebundle_en_US_sappsd.properties +4 -0
- package/src/sap/ui/table/messagebundle_en_US_saprigi.properties +4 -0
- package/src/sap/ui/table/messagebundle_en_US_saptrc.properties +4 -0
- package/src/sap/ui/table/messagebundle_es.properties +4 -0
- package/src/sap/ui/table/messagebundle_es_MX.properties +4 -0
- package/src/sap/ui/table/messagebundle_et.properties +4 -0
- package/src/sap/ui/table/messagebundle_fi.properties +4 -0
- package/src/sap/ui/table/messagebundle_fr.properties +4 -0
- package/src/sap/ui/table/messagebundle_fr_CA.properties +4 -0
- package/src/sap/ui/table/messagebundle_hi.properties +4 -0
- package/src/sap/ui/table/messagebundle_hr.properties +4 -0
- package/src/sap/ui/table/messagebundle_hu.properties +4 -0
- package/src/sap/ui/table/messagebundle_id.properties +4 -0
- package/src/sap/ui/table/messagebundle_it.properties +4 -0
- package/src/sap/ui/table/messagebundle_iw.properties +4 -0
- package/src/sap/ui/table/messagebundle_ja.properties +4 -0
- package/src/sap/ui/table/messagebundle_kk.properties +4 -0
- package/src/sap/ui/table/messagebundle_ko.properties +4 -0
- package/src/sap/ui/table/messagebundle_lt.properties +4 -0
- package/src/sap/ui/table/messagebundle_lv.properties +4 -0
- package/src/sap/ui/table/messagebundle_ms.properties +4 -0
- package/src/sap/ui/table/messagebundle_nl.properties +4 -0
- package/src/sap/ui/table/messagebundle_no.properties +4 -0
- package/src/sap/ui/table/messagebundle_pl.properties +4 -0
- package/src/sap/ui/table/messagebundle_pt.properties +4 -0
- package/src/sap/ui/table/messagebundle_pt_PT.properties +4 -0
- package/src/sap/ui/table/messagebundle_ro.properties +4 -0
- package/src/sap/ui/table/messagebundle_ru.properties +4 -0
- package/src/sap/ui/table/messagebundle_sh.properties +4 -0
- package/src/sap/ui/table/messagebundle_sk.properties +4 -0
- package/src/sap/ui/table/messagebundle_sl.properties +4 -0
- package/src/sap/ui/table/messagebundle_sv.properties +5 -1
- package/src/sap/ui/table/messagebundle_th.properties +4 -0
- package/src/sap/ui/table/messagebundle_tr.properties +4 -0
- package/src/sap/ui/table/messagebundle_uk.properties +4 -0
- package/src/sap/ui/table/messagebundle_vi.properties +4 -0
- package/src/sap/ui/table/messagebundle_zh_CN.properties +4 -0
- package/src/sap/ui/table/messagebundle_zh_TW.properties +4 -0
- package/src/sap/ui/table/plugins/BindingSelection.js +1 -1
- package/src/sap/ui/table/plugins/PluginBase.js +1 -2
- package/src/sap/ui/table/plugins/SelectionModelSelection.js +1 -1
- package/src/sap/ui/table/plugins/SelectionPlugin.js +1 -2
- package/src/sap/ui/table/plugins/V4Aggregation.js +13 -16
- package/src/sap/ui/table/rowmodes/AutoRowMode.js +1 -2
- package/src/sap/ui/table/rowmodes/FixedRowMode.js +1 -2
- package/src/sap/ui/table/rowmodes/InteractiveRowMode.js +1 -2
- package/src/sap/ui/table/rowmodes/RowMode.js +1 -2
- package/src/sap/ui/table/rowmodes/VariableRowMode.js +1 -2
- package/src/sap/ui/table/utils/TableUtils.js +12 -30
- package/src/sap/ui/table/utils/_BindingUtils.js +1 -1
- package/src/sap/ui/table/utils/_ColumnUtils.js +38 -12
- 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 +19 -21
|
@@ -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.107.0
|
|
271
271
|
* @constructor
|
|
272
272
|
* @private
|
|
273
273
|
* @alias sap.ui.table.extensions.Keyboard
|
|
@@ -11,8 +11,9 @@ sap.ui.define([
|
|
|
11
11
|
"sap/ui/base/Object",
|
|
12
12
|
"sap/ui/Device",
|
|
13
13
|
"sap/ui/events/KeyCodes",
|
|
14
|
-
"sap/ui/thirdparty/jquery"
|
|
15
|
-
|
|
14
|
+
"sap/ui/thirdparty/jquery",
|
|
15
|
+
"sap/ui/core/Configuration"
|
|
16
|
+
], function(TableUtils, library, BaseObject, Device, KeyCodes, jQuery, Configuration) {
|
|
16
17
|
"use strict";
|
|
17
18
|
|
|
18
19
|
// Shortcuts
|
|
@@ -64,7 +65,7 @@ sap.ui.define([
|
|
|
64
65
|
*
|
|
65
66
|
* @extends sap.ui.base.Object
|
|
66
67
|
* @author SAP SE
|
|
67
|
-
* @version 1.
|
|
68
|
+
* @version 1.107.0
|
|
68
69
|
* @constructor
|
|
69
70
|
* @private
|
|
70
71
|
* @alias sap.ui.table.extensions.KeyboardDelegate
|
|
@@ -249,7 +250,7 @@ sap.ui.define([
|
|
|
249
250
|
}
|
|
250
251
|
|
|
251
252
|
var oCellInfo = TableUtils.getCellInfo(TableUtils.getCell(oTable, oEvent.target));
|
|
252
|
-
var bIsRTL =
|
|
253
|
+
var bIsRTL = Configuration.getRTL();
|
|
253
254
|
|
|
254
255
|
if (!oCellInfo.isOfType(CellType.COLUMNHEADER) || !bIsRTL) {
|
|
255
256
|
return;
|
|
@@ -1555,7 +1556,7 @@ sap.ui.define([
|
|
|
1555
1556
|
}
|
|
1556
1557
|
|
|
1557
1558
|
var oCellInfo = TableUtils.getCellInfo(oEvent.target);
|
|
1558
|
-
var bIsRTL =
|
|
1559
|
+
var bIsRTL = Configuration.getRTL();
|
|
1559
1560
|
|
|
1560
1561
|
if (KeyboardDelegate._isKeyCombination(oEvent, null, ModKey.SHIFT)) {
|
|
1561
1562
|
|
|
@@ -1634,7 +1635,7 @@ sap.ui.define([
|
|
|
1634
1635
|
}
|
|
1635
1636
|
|
|
1636
1637
|
var oCellInfo = TableUtils.getCellInfo(oEvent.target);
|
|
1637
|
-
var bIsRTL =
|
|
1638
|
+
var bIsRTL = Configuration.getRTL();
|
|
1638
1639
|
|
|
1639
1640
|
if (KeyboardDelegate._isKeyCombination(oEvent, null, ModKey.SHIFT)) {
|
|
1640
1641
|
/* Range Selection */
|
|
@@ -723,7 +723,9 @@ sap.ui.define([
|
|
|
723
723
|
|
|
724
724
|
if (oCellInfo.isOfType(TableUtils.CELLTYPE.COLUMNHEADER)) {
|
|
725
725
|
var oPointerExtension = this._getPointerExtension();
|
|
726
|
-
|
|
726
|
+
var oColumn = this.getColumns()[oCellInfo.columnIndex];
|
|
727
|
+
|
|
728
|
+
if (oPointerExtension._bShowMenu && !oColumn._isMenuOpen()) {
|
|
727
729
|
TableUtils.Menu.openContextMenu(this, oEvent.target);
|
|
728
730
|
delete oPointerExtension._bShowMenu;
|
|
729
731
|
}
|
|
@@ -796,7 +798,7 @@ sap.ui.define([
|
|
|
796
798
|
* @class Extension for sap.ui.table.Table which handles mouse and touch related things.
|
|
797
799
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
798
800
|
* @author SAP SE
|
|
799
|
-
* @version 1.
|
|
801
|
+
* @version 1.107.0
|
|
800
802
|
* @constructor
|
|
801
803
|
* @private
|
|
802
804
|
* @alias sap.ui.table.extensions.Pointer
|
|
@@ -2256,7 +2256,7 @@ sap.ui.define([
|
|
|
2256
2256
|
* @class Extension for sap.ui.table.Table which handles scrolling.
|
|
2257
2257
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
2258
2258
|
* @author SAP SE
|
|
2259
|
-
* @version 1.
|
|
2259
|
+
* @version 1.107.0
|
|
2260
2260
|
* @constructor
|
|
2261
2261
|
* @private
|
|
2262
2262
|
* @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.107.0
|
|
31
31
|
* @constructor
|
|
32
32
|
* @private
|
|
33
33
|
* @alias sap.ui.table.extensions.ScrollingIOS
|
|
@@ -45,12 +45,50 @@ sap.ui.define([
|
|
|
45
45
|
|
|
46
46
|
addVerticalScrollingListener: function(mConfig) {
|
|
47
47
|
var oTable = this.getTable();
|
|
48
|
+
var oSyncExtension = oTable._getSyncExtension();
|
|
48
49
|
var oScrollExtension = oTable._getScrollExtension();
|
|
49
|
-
var
|
|
50
|
+
var mOptions = {scrollDirection: oScrollExtension.constructor.ScrollDirection.VERTICAL};
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
ExtensionHelper.removeVerticalScrollingListener.call(this);
|
|
53
|
+
|
|
54
|
+
if (!mConfig) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (mConfig.wheelAreas) {
|
|
59
|
+
oSyncExtension._mMouseWheelEventListener = oScrollExtension.registerForMouseWheel(mConfig.wheelAreas, mOptions);
|
|
60
|
+
oSyncExtension._mMouseWheelEventListener.areas = mConfig.wheelAreas;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (mConfig.touchAreas) {
|
|
64
|
+
oSyncExtension._mTouchEventListener = oScrollExtension.registerForTouch(mConfig.touchAreas, mOptions);
|
|
65
|
+
oSyncExtension._mTouchEventListener.areas = mConfig.touchAreas;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
removeVerticalScrollingListener: function() {
|
|
70
|
+
var oTable = this.getTable();
|
|
71
|
+
var oSyncExtension = oTable._getSyncExtension();
|
|
72
|
+
|
|
73
|
+
function removeEventListener(aTargets, mEventListenerMap) {
|
|
74
|
+
for (var sEventName in mEventListenerMap) {
|
|
75
|
+
var fnListener = mEventListenerMap[sEventName];
|
|
76
|
+
if (fnListener) {
|
|
77
|
+
for (var i = 0; i < aTargets.length; i++) {
|
|
78
|
+
aTargets[i].removeEventListener(sEventName, fnListener);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (oSyncExtension._mMouseWheelEventListener) {
|
|
85
|
+
removeEventListener(oSyncExtension._mMouseWheelEventListener.areas, oSyncExtension._mMouseWheelEventListener);
|
|
86
|
+
delete oSyncExtension._mMouseWheelEventListener;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (oSyncExtension._mTouchEventListener) {
|
|
90
|
+
removeEventListener(oSyncExtension._mTouchEventListener.areas, oSyncExtension._mTouchEventListener);
|
|
91
|
+
delete oSyncExtension._mTouchEventListener;
|
|
54
92
|
}
|
|
55
93
|
},
|
|
56
94
|
|
|
@@ -142,7 +180,7 @@ sap.ui.define([
|
|
|
142
180
|
* @class Extension for sap.ui.table.Table that allows synchronization with a table.
|
|
143
181
|
* @extends sap.ui.table.extensions.ExtensionBase
|
|
144
182
|
* @author SAP SE
|
|
145
|
-
* @version 1.
|
|
183
|
+
* @version 1.107.0
|
|
146
184
|
* @constructor
|
|
147
185
|
* @private
|
|
148
186
|
* @alias sap.ui.table.extensions.Synchronization
|
|
@@ -160,6 +198,7 @@ sap.ui.define([
|
|
|
160
198
|
syncRowSelection: ExtensionHelper.setRowSelection.bind(this),
|
|
161
199
|
syncRowHover: ExtensionHelper.setRowHover.bind(this),
|
|
162
200
|
registerVerticalScrolling: ExtensionHelper.addVerticalScrollingListener.bind(this),
|
|
201
|
+
deregisterVerticalScrolling: ExtensionHelper.removeVerticalScrollingListener.bind(this),
|
|
163
202
|
placeVerticalScrollbarAt: ExtensionHelper.placeVerticalScrollbarAt.bind(this),
|
|
164
203
|
renderHorizontalScrollbar: ExtensionHelper.renderHorizontalScrollbar.bind(this)
|
|
165
204
|
};
|
|
@@ -180,6 +219,7 @@ sap.ui.define([
|
|
|
180
219
|
oTable.removeEventDelegate(this._delegate);
|
|
181
220
|
}
|
|
182
221
|
|
|
222
|
+
ExtensionHelper.removeVerticalScrollingListener.call(this);
|
|
183
223
|
this._delegate = null;
|
|
184
224
|
this._oPublicInterface = null;
|
|
185
225
|
|
|
@@ -278,6 +318,7 @@ sap.ui.define([
|
|
|
278
318
|
* <li>syncRowSelection: function(index:int, selected:boolean):void</li>
|
|
279
319
|
* <li>syncRowHover: function(index:int, selected:boolean):void</li>
|
|
280
320
|
* <li>registerVerticalScrolling: function({wheelAreas:HTMLElement[], touchAreas:HTMLElement[]}):void</li>
|
|
321
|
+
* <li>deregisterVerticalScrolling: function():void</li>
|
|
281
322
|
* <li>placeVerticalScrollbarAt: function(container:HTMLElement):void</li>
|
|
282
323
|
* <li>renderHorizontalScrollbar: function(renderManager:sap.ui.core.RenderManager, id:string, scrollWidth:int):void</li>
|
|
283
324
|
* </ul>
|
|
@@ -289,8 +330,6 @@ sap.ui.define([
|
|
|
289
330
|
* The <code>Synchronization</code> extension has no mechanisms to avoid infinite synchronization loops. This means that the
|
|
290
331
|
* <code>Synchronization</code> extension can also call the corresponding hook if a synchronization method of this interface is used. It is the
|
|
291
332
|
* responsibility of the user of the synchronization interface to avoid endless loops.
|
|
292
|
-
* Registering HTMLElements for event handling by the table (e.g. via <code>registerVerticalScrolling</code>) can cause memory leaks. To avoid
|
|
293
|
-
* this, make sure to avoid registering the same elements multiple times.
|
|
294
333
|
*
|
|
295
334
|
* @example
|
|
296
335
|
* // Add a row selection hook.
|
|
@@ -20,13 +20,13 @@ sap.ui.define(['sap/ui/core/Core', 'sap/ui/model/TreeAutoExpandMode',
|
|
|
20
20
|
* @namespace
|
|
21
21
|
* @alias sap.ui.table
|
|
22
22
|
* @author SAP SE
|
|
23
|
-
* @version 1.
|
|
23
|
+
* @version 1.107.0
|
|
24
24
|
* @since 0.8
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
27
|
var thisLib = sap.ui.getCore().initLibrary({
|
|
28
28
|
name : "sap.ui.table",
|
|
29
|
-
version: "1.
|
|
29
|
+
version: "1.107.0",
|
|
30
30
|
dependencies : ["sap.ui.core","sap.ui.unified"],
|
|
31
31
|
designtime: "sap/ui/table/designtime/library.designtime",
|
|
32
32
|
types: [
|
|
@@ -80,10 +80,9 @@ sap.ui.define(['sap/ui/core/Core', 'sap/ui/model/TreeAutoExpandMode',
|
|
|
80
80
|
/**
|
|
81
81
|
* Navigation mode of the table
|
|
82
82
|
*
|
|
83
|
-
* @version 1.
|
|
83
|
+
* @version 1.107.0
|
|
84
84
|
* @enum {string}
|
|
85
85
|
* @public
|
|
86
|
-
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
|
|
87
86
|
*/
|
|
88
87
|
thisLib.NavigationMode = {
|
|
89
88
|
|
|
@@ -108,10 +107,9 @@ sap.ui.define(['sap/ui/core/Core', 'sap/ui/model/TreeAutoExpandMode',
|
|
|
108
107
|
/**
|
|
109
108
|
* Row Action types.
|
|
110
109
|
*
|
|
111
|
-
* @version 1.
|
|
110
|
+
* @version 1.107.0
|
|
112
111
|
* @enum {string}
|
|
113
112
|
* @public
|
|
114
|
-
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
|
|
115
113
|
*/
|
|
116
114
|
thisLib.RowActionType = {
|
|
117
115
|
|
|
@@ -139,10 +137,9 @@ sap.ui.define(['sap/ui/core/Core', 'sap/ui/model/TreeAutoExpandMode',
|
|
|
139
137
|
/**
|
|
140
138
|
* Selection behavior of the table
|
|
141
139
|
*
|
|
142
|
-
* @version 1.
|
|
140
|
+
* @version 1.107.0
|
|
143
141
|
* @enum {string}
|
|
144
142
|
* @public
|
|
145
|
-
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
|
|
146
143
|
*/
|
|
147
144
|
thisLib.SelectionBehavior = {
|
|
148
145
|
|
|
@@ -170,10 +167,9 @@ sap.ui.define(['sap/ui/core/Core', 'sap/ui/model/TreeAutoExpandMode',
|
|
|
170
167
|
/**
|
|
171
168
|
* Selection mode of the table
|
|
172
169
|
*
|
|
173
|
-
* @version 1.
|
|
170
|
+
* @version 1.107.0
|
|
174
171
|
* @enum {string}
|
|
175
172
|
* @public
|
|
176
|
-
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
|
|
177
173
|
*/
|
|
178
174
|
thisLib.SelectionMode = {
|
|
179
175
|
|
|
@@ -208,10 +204,9 @@ sap.ui.define(['sap/ui/core/Core', 'sap/ui/model/TreeAutoExpandMode',
|
|
|
208
204
|
/**
|
|
209
205
|
* Sort order of a column
|
|
210
206
|
*
|
|
211
|
-
* @version 1.
|
|
207
|
+
* @version 1.107.0
|
|
212
208
|
* @enum {string}
|
|
213
209
|
* @public
|
|
214
|
-
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
|
|
215
210
|
*/
|
|
216
211
|
thisLib.SortOrder = {
|
|
217
212
|
|
|
@@ -233,10 +228,9 @@ sap.ui.define(['sap/ui/core/Core', 'sap/ui/model/TreeAutoExpandMode',
|
|
|
233
228
|
/**
|
|
234
229
|
* VisibleRowCountMode of the table
|
|
235
230
|
*
|
|
236
|
-
* @version 1.
|
|
231
|
+
* @version 1.107.0
|
|
237
232
|
* @enum {string}
|
|
238
233
|
* @public
|
|
239
|
-
* @ui5-metamodel This enumeration also will be described in the UI5 (legacy) designtime metamodel
|
|
240
234
|
*/
|
|
241
235
|
thisLib.VisibleRowCountMode = {
|
|
242
236
|
|
|
@@ -265,7 +259,7 @@ sap.ui.define(['sap/ui/core/Core', 'sap/ui/model/TreeAutoExpandMode',
|
|
|
265
259
|
*
|
|
266
260
|
* Contains IDs of shared DOM references, which should be accessible to inheriting controls via getDomRef() function.
|
|
267
261
|
*
|
|
268
|
-
* @version 1.
|
|
262
|
+
* @version 1.107.0
|
|
269
263
|
* @enum {string}
|
|
270
264
|
* @public
|
|
271
265
|
*/
|
|
@@ -363,7 +357,7 @@ sap.ui.define(['sap/ui/core/Core', 'sap/ui/model/TreeAutoExpandMode',
|
|
|
363
357
|
*
|
|
364
358
|
* This is an alias for {@link sap.ui.model.TreeAutoExpandMode} and kept for compatibility reasons.
|
|
365
359
|
*
|
|
366
|
-
* @version 1.
|
|
360
|
+
* @version 1.107.0
|
|
367
361
|
* @typedef {sap.ui.model.TreeAutoExpandMode}
|
|
368
362
|
* @public
|
|
369
363
|
*/
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
"../utils/TableUtils",
|
|
9
|
+
"sap/ui/base/Object",
|
|
10
|
+
"sap/ui/base/EventProvider",
|
|
11
|
+
"sap/ui/base/ManagedObjectObserver"
|
|
12
|
+
], function(
|
|
13
|
+
TableUtils,
|
|
14
|
+
BaseObject,
|
|
15
|
+
EventProvider,
|
|
16
|
+
ManagedObjectObserver
|
|
17
|
+
) {
|
|
18
|
+
"use strict";
|
|
19
|
+
|
|
20
|
+
var oAdapterRegistry = new window.Map();
|
|
21
|
+
var mAdapterMapping = {
|
|
22
|
+
"sap.m.table.columnmenu.Menu": "MobileColumnHeaderMenuAdapter"
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Constructor for a new ColumnHeaderMenuAdapter.
|
|
27
|
+
*
|
|
28
|
+
* @class
|
|
29
|
+
* Base class that provides methods to map and reuse the column menu instance between multiple columns.
|
|
30
|
+
*
|
|
31
|
+
* @extends sap.ui.base.Object
|
|
32
|
+
* @author SAP SE
|
|
33
|
+
* @version 1.107.0
|
|
34
|
+
* @private
|
|
35
|
+
* @alias sap.ui.table.menus.ColumnHeaderMenuAdapter
|
|
36
|
+
*/
|
|
37
|
+
var ColumnHeaderMenuAdapter = BaseObject.extend("sap.ui.table.menus.ColumnHeaderMenuAdapter", /** @lends sap.ui.table.menus.ColumnHeaderMenuAdapter.prototype */ {
|
|
38
|
+
constructor: function() {
|
|
39
|
+
BaseObject.apply(this, arguments);
|
|
40
|
+
|
|
41
|
+
this._mInjectionTarget = null;
|
|
42
|
+
|
|
43
|
+
// The menu is just associated with the column. There is no automatic notification about the destruction of the menu.
|
|
44
|
+
this._oColumnHeaderMenuObserver = new ManagedObjectObserver(function(oChange) {
|
|
45
|
+
this.onAfterMenuDestroyed(oChange.object);
|
|
46
|
+
}.bind(this));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Activates an adapter for the column and links them, if there is an adapter for the menu type the column is associated with. The adapter adds
|
|
52
|
+
* items to the menu based on the column configuration. Should be called before the menu is opened. The menu should then be opened after the
|
|
53
|
+
* returned <code>Promise</code> resolves, to make sure it already contains all items.
|
|
54
|
+
* Activation is required again before opening the menu, if the column is associated with a menu of a different type, or the column
|
|
55
|
+
* configuration that affects the added menu items is changed. In other cases, a repeated activation is not required, but possible. However,
|
|
56
|
+
* depending on the concrete adapter implementation this might cause unnecessary overhead.
|
|
57
|
+
*
|
|
58
|
+
* @see sap.ui.table.menus.ColumnHeaderMenuAdapter.unlink
|
|
59
|
+
* @param {sap.ui.table.Column} oColumn The column for which to activate an adapter
|
|
60
|
+
* @returns {Promise} A promise that resolves once the adapter is activated and the menu items are modified
|
|
61
|
+
*/
|
|
62
|
+
ColumnHeaderMenuAdapter.activateFor = function(oColumn) {
|
|
63
|
+
var oColumnHeaderMenu = oColumn.getHeaderMenuInstance();
|
|
64
|
+
var sAdapterName = getAdapterName(oColumnHeaderMenu);
|
|
65
|
+
var mRegistryData;
|
|
66
|
+
|
|
67
|
+
if (!sAdapterName || !oColumn._getTable()) {
|
|
68
|
+
return Promise.resolve();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Unlink column from other adapters. Can be necessary if the column is associated with a different menu of another type.
|
|
72
|
+
oAdapterRegistry.forEach(function(_mRegistryData, _sAdapterName) {
|
|
73
|
+
if (_sAdapterName !== sAdapterName) {
|
|
74
|
+
unlink(oColumn, _sAdapterName);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
if (!oAdapterRegistry.has(sAdapterName)) {
|
|
79
|
+
mRegistryData = {
|
|
80
|
+
adapter: requireAdapter(sAdapterName).then(function(Adapter) {
|
|
81
|
+
mRegistryData = oAdapterRegistry.get(sAdapterName);
|
|
82
|
+
mRegistryData.adapter = new Adapter();
|
|
83
|
+
mRegistryData.adapter._injectMenuItems(mRegistryData.activeFor.getHeaderMenuInstance(), mRegistryData.activeFor);
|
|
84
|
+
}),
|
|
85
|
+
columns: [oColumn],
|
|
86
|
+
activeFor: oColumn
|
|
87
|
+
};
|
|
88
|
+
oAdapterRegistry.set(sAdapterName, mRegistryData);
|
|
89
|
+
} else {
|
|
90
|
+
mRegistryData = oAdapterRegistry.get(sAdapterName);
|
|
91
|
+
mRegistryData.activeFor = oColumn;
|
|
92
|
+
|
|
93
|
+
if (!mRegistryData.columns.includes(oColumn)) {
|
|
94
|
+
mRegistryData.columns.push(oColumn);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (mRegistryData.adapter instanceof Promise) {
|
|
99
|
+
return mRegistryData.adapter;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
mRegistryData.adapter._injectMenuItems(oColumnHeaderMenu, oColumn);
|
|
103
|
+
|
|
104
|
+
return Promise.resolve();
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Unlinks the column from the adapter. If a column does no longer need an adapter, for example because it is destroyed, it needs to be unlinked
|
|
109
|
+
* for proper cleanup.
|
|
110
|
+
*
|
|
111
|
+
* @param {sap.ui.table.Column} oColumn The column for the mapping to be removed
|
|
112
|
+
*/
|
|
113
|
+
ColumnHeaderMenuAdapter.unlink = function(oColumn) {
|
|
114
|
+
unlink(oColumn);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
ColumnHeaderMenuAdapter.prototype._injectMenuItems = function(oColumnHeaderMenu, oColumn) {
|
|
118
|
+
this._removeMenuItems();
|
|
119
|
+
this._oColumnHeaderMenuObserver.observe(oColumnHeaderMenu, {destroy: true});
|
|
120
|
+
this.injectMenuItems(oColumnHeaderMenu, oColumn);
|
|
121
|
+
this._mInjectionTarget = {
|
|
122
|
+
column: oColumn,
|
|
123
|
+
menu: oColumnHeaderMenu
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
ColumnHeaderMenuAdapter.prototype._removeMenuItems = function() {
|
|
128
|
+
if (!this._mInjectionTarget) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
this.removeMenuItems(this._mInjectionTarget.menu);
|
|
133
|
+
this._mInjectionTarget = null;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* This hook is called when menu items should be added to the column menu.
|
|
138
|
+
*
|
|
139
|
+
* @param {sap.ui.core.IColumnHeaderMenu} oColumnHeaderMenu Instance of the column menu
|
|
140
|
+
* @param {sap.ui.table.Column} oColumn Instance of the column
|
|
141
|
+
*/
|
|
142
|
+
ColumnHeaderMenuAdapter.prototype.injectMenuItems = function(oColumnHeaderMenu, oColumn) {};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* This hook is called when menu items should be removed from the column menu.
|
|
146
|
+
*
|
|
147
|
+
* @param {sap.ui.core.IColumnHeaderMenu} oColumnHeaderMenu
|
|
148
|
+
*/
|
|
149
|
+
ColumnHeaderMenuAdapter.prototype.removeMenuItems = function(oColumnHeaderMenu) {};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* This hook is called after the column menu and injected menu items are destroyed.
|
|
153
|
+
*
|
|
154
|
+
* @param {sap.ui.core.IColumnHeaderMenu} oColumnHeaderMenu
|
|
155
|
+
*/
|
|
156
|
+
ColumnHeaderMenuAdapter.prototype.onAfterMenuDestroyed = function(oColumnHeaderMenu) {};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Destroys the instance of the <code>ColumnHeaderMenuAdapter</code> and the change observer
|
|
160
|
+
*/
|
|
161
|
+
ColumnHeaderMenuAdapter.prototype.destroy = function() {
|
|
162
|
+
BaseObject.prototype.destroy.apply(this, arguments);
|
|
163
|
+
this._removeMenuItems();
|
|
164
|
+
this._oColumnHeaderMenuObserver.disconnect();
|
|
165
|
+
delete this._oColumnHeaderMenuObserver;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
function requireAdapter(sAdapterName) {
|
|
169
|
+
return new Promise(function(resolve, reject) {
|
|
170
|
+
sap.ui.require(["sap/ui/table/menus/" + sAdapterName], function(Module) {
|
|
171
|
+
resolve(Module);
|
|
172
|
+
}, function(oError) {
|
|
173
|
+
reject(oError);
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function getAdapterName(oColumnHeaderMenu) {
|
|
179
|
+
for (var sMenuType in mAdapterMapping) {
|
|
180
|
+
if (TableUtils.isA(oColumnHeaderMenu, sMenuType)) {
|
|
181
|
+
return mAdapterMapping[sMenuType];
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return "";
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function unlink(oColumn, sAdapterName) {
|
|
189
|
+
var mRegistryData;
|
|
190
|
+
|
|
191
|
+
if (sAdapterName) {
|
|
192
|
+
mRegistryData = oAdapterRegistry.get(sAdapterName);
|
|
193
|
+
} else {
|
|
194
|
+
oAdapterRegistry.forEach(function(_mRegistryData, _sAdapterName) {
|
|
195
|
+
if (_mRegistryData.columns.includes(oColumn)) {
|
|
196
|
+
mRegistryData = _mRegistryData;
|
|
197
|
+
sAdapterName = _sAdapterName;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
if (!mRegistryData) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (mRegistryData.adapter instanceof Promise) {
|
|
208
|
+
mRegistryData.adapter.then(function() {
|
|
209
|
+
unlink(oColumn, sAdapterName);
|
|
210
|
+
});
|
|
211
|
+
} else {
|
|
212
|
+
if (mRegistryData.columns.includes(oColumn)) {
|
|
213
|
+
mRegistryData.columns.splice(mRegistryData.columns.indexOf(oColumn), 1);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (mRegistryData.columns.length === 0) {
|
|
217
|
+
mRegistryData.adapter.destroy();
|
|
218
|
+
oAdapterRegistry.delete(sAdapterName);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return ColumnHeaderMenuAdapter;
|
|
224
|
+
});
|