@openui5/sap.ui.integration 1.132.0 → 1.133.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 +2 -2
- package/LICENSES/LicenseRef-Unicode-3.0.txt +39 -0
- package/THIRDPARTY.txt +54 -66
- package/package.json +7 -7
- package/src/sap/ui/integration/.library +1 -1
- package/src/sap/ui/integration/ActionDefinition.js +1 -1
- package/src/sap/ui/integration/Designtime.js +1 -1
- package/src/sap/ui/integration/Extension.js +1 -1
- package/src/sap/ui/integration/Host.js +1 -1
- package/src/sap/ui/integration/cards/AdaptiveContent.js +1 -1
- package/src/sap/ui/integration/cards/AnalyticalContent.js +9 -2
- package/src/sap/ui/integration/cards/AnalyticsCloudContent.js +8 -1
- package/src/sap/ui/integration/cards/BaseContent.js +30 -2
- package/src/sap/ui/integration/cards/BaseContentRenderer.js +1 -1
- package/src/sap/ui/integration/cards/BaseListContent.js +1 -1
- package/src/sap/ui/integration/cards/CalendarContent.js +6 -6
- package/src/sap/ui/integration/cards/ComponentContent.js +1 -1
- package/src/sap/ui/integration/cards/Footer.js +137 -13
- package/src/sap/ui/integration/cards/Header.js +1 -1
- package/src/sap/ui/integration/cards/ListContent.js +1 -1
- package/src/sap/ui/integration/cards/NumericHeader.js +1 -1
- package/src/sap/ui/integration/cards/ObjectContent.js +1 -1
- package/src/sap/ui/integration/cards/TableContent.js +1 -1
- package/src/sap/ui/integration/cards/TimelineContent.js +1 -1
- package/src/sap/ui/integration/cards/WebPageContent.js +8 -1
- package/src/sap/ui/integration/cards/WebPageContentRenderer.js +3 -1
- package/src/sap/ui/integration/cards/actions/CardActions.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputChoiceSet.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputDate.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputNumber.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputText.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputToggle.js +1 -1
- package/src/sap/ui/integration/cards/filters/BaseFilter.js +1 -1
- package/src/sap/ui/integration/cards/filters/ComboBoxFilter.js +1 -1
- package/src/sap/ui/integration/cards/filters/DateRangeFilter.js +1 -1
- package/src/sap/ui/integration/cards/filters/FilterBar.js +1 -1
- package/src/sap/ui/integration/cards/filters/FilterBarFactory.js +1 -1
- package/src/sap/ui/integration/cards/filters/SearchFilter.js +1 -1
- package/src/sap/ui/integration/cards/filters/SelectFilter.js +1 -1
- package/src/sap/ui/integration/cards/list/MicrochartsResizeHelper.js +1 -1
- package/src/sap/ui/integration/controls/ActionsStrip.js +22 -1
- package/src/sap/ui/integration/controls/ActionsToolbar.js +1 -1
- package/src/sap/ui/integration/controls/BlockingMessage.js +1 -1
- package/src/sap/ui/integration/controls/ComboBox.js +1 -1
- package/src/sap/ui/integration/controls/ImageWithOverlay.js +1 -1
- package/src/sap/ui/integration/controls/ListContentItem.js +1 -1
- package/src/sap/ui/integration/controls/Microchart.js +1 -1
- package/src/sap/ui/integration/controls/MicrochartLegend.js +1 -1
- package/src/sap/ui/integration/controls/ObjectStatus.js +1 -1
- package/src/sap/ui/integration/delegate/OverflowHandler.js +131 -0
- package/src/sap/ui/integration/delegate/Paginator.js +4 -27
- package/src/sap/ui/integration/delegate/PreventKeyboardScrolling.js +120 -0
- package/src/sap/ui/integration/designtime/baseEditor/BaseEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/PropertyEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/PropertyEditors.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/BasePropertyEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/PropertyEditorFactory.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/arrayEditor/ArrayEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/codeEditor/CodeEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/dateEditor/DateEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/dateTimeEditor/DateTimeEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/enumStringEditor/EnumStringEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/groupEditor/GroupEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/iconEditor/IconEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/iconEditor/IsInIconPool.validator.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/integerEditor/IntegerEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/jsonEditor/JsonEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/listEditor/ListEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/mapEditor/MapEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/multiSelectEditor/MultiSelectEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/numberEditor/NumberEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/objectArrayEditor/ObjectArrayEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/selectEditor/SelectEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/separatorEditor/SeparatorEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/stringEditor/StringEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/textAreaEditor/TextAreaEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/util/binding/ObjectBinding.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/util/unset.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsBoolean.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsDate.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsInteger.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsNumber.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsSelectedKey.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsStringList.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsUniqueKey.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsUniqueList.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsValidBinding.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/MaxLength.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/NotABinding.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/ValidatorRegistry.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/complexMapEditor/ComplexMapEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/destinationsEditor/DestinationsEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/filtersEditor/FiltersEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/iconEditor/IconEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/parametersEditor/ParametersEditor.js +1 -1
- package/src/sap/ui/integration/designtime/editor/Card.js +1 -1
- package/src/sap/ui/integration/designtime/editor/CardEditor.js +21 -3
- package/src/sap/ui/integration/designtime/editor/CardPreview.js +1 -1
- package/src/sap/ui/integration/editor/Editor.js +2 -2
- package/src/sap/ui/integration/editor/EditorResourceBundles.js +1 -1
- package/src/sap/ui/integration/editor/Extension.js +1 -1
- package/src/sap/ui/integration/editor/Manifest.js +1 -1
- package/src/sap/ui/integration/editor/Settings.js +1 -1
- package/src/sap/ui/integration/editor/fields/BaseField.js +1 -1
- package/src/sap/ui/integration/editor/fields/BooleanField.js +1 -1
- package/src/sap/ui/integration/editor/fields/DateField.js +1 -1
- package/src/sap/ui/integration/editor/fields/DateTimeField.js +1 -1
- package/src/sap/ui/integration/editor/fields/DestinationField.js +1 -1
- package/src/sap/ui/integration/editor/fields/GroupField.js +1 -1
- package/src/sap/ui/integration/editor/fields/IntegerField.js +1 -1
- package/src/sap/ui/integration/editor/fields/NumberField.js +1 -1
- package/src/sap/ui/integration/editor/fields/ObjectField.js +1 -1
- package/src/sap/ui/integration/editor/fields/ObjectListField.js +1 -1
- package/src/sap/ui/integration/editor/fields/StringField.js +1 -1
- package/src/sap/ui/integration/editor/fields/StringListField.js +1 -1
- package/src/sap/ui/integration/editor/fields/fragment/Controller.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/ColorSelect.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/IconSelect.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/ImageSelect.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/ShapeSelect.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/VizBase.js +1 -1
- package/src/sap/ui/integration/extensions/OAuth3LO.js +1 -1
- package/src/sap/ui/integration/library-bootstrap.js +6 -8
- package/src/sap/ui/integration/library.js +34 -2
- package/src/sap/ui/integration/model/ContextModel.js +1 -1
- package/src/sap/ui/integration/model/ObservableModel.js +1 -1
- package/src/sap/ui/integration/schemas/sap-card.json +10 -3
- package/src/sap/ui/integration/themes/base/Card.less +5 -3
- package/src/sap/ui/integration/themes/base/Footer.less +21 -0
- package/src/sap/ui/integration/themes/base/ObjectContent.less +1 -1
- package/src/sap/ui/integration/util/AnalyticsCloudHelper.js +1 -1
- package/src/sap/ui/integration/util/BaseFactory.js +1 -1
- package/src/sap/ui/integration/util/BindingHelper.js +1 -1
- package/src/sap/ui/integration/util/BindingResolver.js +1 -1
- package/src/sap/ui/integration/util/CardObserver.js +1 -1
- package/src/sap/ui/integration/util/ComboBoxHelper.js +1 -1
- package/src/sap/ui/integration/util/ContentFactory.js +3 -2
- package/src/sap/ui/integration/util/CsrfTokenHandler.js +1 -1
- package/src/sap/ui/integration/util/DataProvider.js +1 -1
- package/src/sap/ui/integration/util/DataProviderFactory.js +1 -1
- package/src/sap/ui/integration/util/Destinations.js +1 -1
- package/src/sap/ui/integration/util/DisplayVariants.js +1 -1
- package/src/sap/ui/integration/util/ErrorHandler.js +1 -1
- package/src/sap/ui/integration/util/ExtensionDataProvider.js +1 -1
- package/src/sap/ui/integration/util/Form.js +1 -1
- package/src/sap/ui/integration/util/HeaderFactory.js +1 -28
- package/src/sap/ui/integration/util/JSONBindingHelper.js +1 -1
- package/src/sap/ui/integration/util/LoadingProvider.js +1 -1
- package/src/sap/ui/integration/util/Manifest.js +1 -1
- package/src/sap/ui/integration/util/OAuth3LOHelper.js +1 -1
- package/src/sap/ui/integration/util/RequestDataProvider.js +1 -1
- package/src/sap/ui/integration/util/ServiceDataProvider.js +1 -1
- package/src/sap/ui/integration/util/ServiceManager.js +1 -1
- package/src/sap/ui/integration/util/SkeletonCard.js +1 -1
- package/src/sap/ui/integration/util/SorterHelper.js +1 -1
- package/src/sap/ui/integration/util/Utils.js +1 -1
- package/src/sap/ui/integration/util/Validators.js +1 -1
- package/src/sap/ui/integration/util/openCardDialog.js +10 -2
- package/src/sap/ui/integration/util/openCardShowMore.js +50 -0
- package/src/sap/ui/integration/widgets/Card.js +46 -24
- package/LICENSES/Unicode-DFS-2015.txt +0 -51
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2025 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
sap.ui.define([
|
|
7
|
+
"sap/ui/base/Object",
|
|
8
|
+
"sap/ui/integration/delegate/PreventKeyboardScrolling"
|
|
9
|
+
], function (
|
|
10
|
+
BaseObject,
|
|
11
|
+
PreventKeyboardScrolling
|
|
12
|
+
) {
|
|
13
|
+
"use strict";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Constructor for a new <code>OverflowHandler</code>.
|
|
17
|
+
*
|
|
18
|
+
* @class
|
|
19
|
+
* Handles the card's and its content's overflowing. Determines the need for a "Show More" button and overlay gradient.
|
|
20
|
+
*
|
|
21
|
+
* @extends sap.ui.base.Object
|
|
22
|
+
*
|
|
23
|
+
* @author SAP SE
|
|
24
|
+
* @version 1.133.0
|
|
25
|
+
*
|
|
26
|
+
* @constructor
|
|
27
|
+
* @param {sap.ui.integration.cards.BaseContent} oContent The card content.
|
|
28
|
+
* @private
|
|
29
|
+
* @alias sap.ui.integration.delegate.OverflowHandler
|
|
30
|
+
*/
|
|
31
|
+
const OverflowHandler = BaseObject.extend("sap.ui.integration.delegate.OverflowHandler", {
|
|
32
|
+
constructor: function (oContent) {
|
|
33
|
+
BaseObject.call(this);
|
|
34
|
+
this._oContent = oContent;
|
|
35
|
+
this._bIsOverflowing = false;
|
|
36
|
+
|
|
37
|
+
this._oDelegate = {
|
|
38
|
+
onAfterRendering: this._onAfterRendering.bind(this)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
OverflowHandler.prototype.attach = function () {
|
|
44
|
+
this._oContent.addEventDelegate(this._oDelegate);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
OverflowHandler.prototype.destroy = function () {
|
|
48
|
+
BaseObject.prototype.destroy.apply(this, arguments);
|
|
49
|
+
|
|
50
|
+
if (this._oPreventKeyboardScrolling) {
|
|
51
|
+
this._oPreventKeyboardScrolling.destroy();
|
|
52
|
+
this._oPreventKeyboardScrolling = null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (this._oHeightObserver) {
|
|
56
|
+
this._oHeightObserver.disconnect();
|
|
57
|
+
this._oHeightObserver = null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
this._oContent.removeEventDelegate(this._oDelegate);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
OverflowHandler.prototype._onAfterRendering = function () {
|
|
64
|
+
const oContentSection = this._getContentSection();
|
|
65
|
+
const oInnerContent = this._getInnerContent();
|
|
66
|
+
if (!oContentSection || !oInnerContent) {
|
|
67
|
+
// not fully rendered yet
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (this._oHeightObserver) {
|
|
72
|
+
this._oHeightObserver.disconnect();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
this._oHeightObserver = new ResizeObserver(() => {
|
|
76
|
+
this._resize();
|
|
77
|
+
});
|
|
78
|
+
this._oHeightObserver.observe(oContentSection);
|
|
79
|
+
this._oHeightObserver.observe(oInnerContent);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
OverflowHandler.prototype._resize = function () {
|
|
83
|
+
const bIsOverflowing = this._isOverflowing();
|
|
84
|
+
|
|
85
|
+
if (bIsOverflowing === this._bIsOverflowing) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
this._bIsOverflowing = bIsOverflowing;
|
|
90
|
+
|
|
91
|
+
const oCard = this._oContent.getCardInstance();
|
|
92
|
+
|
|
93
|
+
oCard.getCardFooter().setShowMoreButton(bIsOverflowing);
|
|
94
|
+
oCard.toggleStyleClass("sapUiIntCardIsOverflowing", bIsOverflowing);
|
|
95
|
+
|
|
96
|
+
if (bIsOverflowing && !this._oPreventKeyboardScrolling) {
|
|
97
|
+
this._oPreventKeyboardScrolling = new PreventKeyboardScrolling(this._oContent);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// @todo replace this with individual hiding of all elements which are not visible
|
|
101
|
+
this._oPreventKeyboardScrolling?.toggle(bIsOverflowing);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
OverflowHandler.prototype._getContentSection = function () {
|
|
105
|
+
const oCard = this._oContent.getCardInstance();
|
|
106
|
+
|
|
107
|
+
return oCard?.getDomRef("contentSection");
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
OverflowHandler.prototype._getInnerContent = function () {
|
|
111
|
+
const oContent = this._oContent;
|
|
112
|
+
|
|
113
|
+
let oInnerContent = oContent.getAggregation("_content")?.getDomRef();
|
|
114
|
+
|
|
115
|
+
if (!oInnerContent) {
|
|
116
|
+
// some contents do not have _content aggregation, so we use the first child
|
|
117
|
+
oInnerContent = oContent.getDomRef()?.firstChild;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return oInnerContent;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
OverflowHandler.prototype._isOverflowing = function () {
|
|
124
|
+
const iHeight = this._getContentSection()?.getBoundingClientRect().height;
|
|
125
|
+
const iHeightInner = this._getInnerContent()?.getBoundingClientRect().height;
|
|
126
|
+
|
|
127
|
+
return iHeightInner > iHeight;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
return OverflowHandler;
|
|
131
|
+
});
|
|
@@ -5,17 +5,15 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
|
-
"sap/base/util/uid",
|
|
9
8
|
"sap/ui/base/ManagedObject",
|
|
10
9
|
"sap/ui/integration/util/BindingResolver",
|
|
11
|
-
"sap/ui/integration/util/
|
|
10
|
+
"sap/ui/integration/util/openCardShowMore",
|
|
12
11
|
"sap/ui/integration/util/Utils",
|
|
13
12
|
"sap/m/BusyIndicator"
|
|
14
13
|
], (
|
|
15
|
-
uid,
|
|
16
14
|
ManagedObject,
|
|
17
15
|
BindingResolver,
|
|
18
|
-
|
|
16
|
+
openCardShowMore,
|
|
19
17
|
Utils,
|
|
20
18
|
BusyIndicator
|
|
21
19
|
) => {
|
|
@@ -32,7 +30,7 @@ sap.ui.define([
|
|
|
32
30
|
* @extends sap.ui.base.ManagedObject
|
|
33
31
|
*
|
|
34
32
|
* @author SAP SE
|
|
35
|
-
* @version 1.
|
|
33
|
+
* @version 1.133.0
|
|
36
34
|
*
|
|
37
35
|
* @constructor
|
|
38
36
|
* @ui5-restricted
|
|
@@ -99,15 +97,7 @@ sap.ui.define([
|
|
|
99
97
|
|
|
100
98
|
Paginator.prototype.openDialog = function() {
|
|
101
99
|
const oCard = this.getCard();
|
|
102
|
-
|
|
103
|
-
openCardDialog(
|
|
104
|
-
oCard,
|
|
105
|
-
{
|
|
106
|
-
manifest: this._createManifest(),
|
|
107
|
-
baseUrl: oCard.getBaseUrl(),
|
|
108
|
-
showCloseButton: true
|
|
109
|
-
}
|
|
110
|
-
);
|
|
100
|
+
openCardShowMore(oCard);
|
|
111
101
|
};
|
|
112
102
|
|
|
113
103
|
Paginator.prototype.isServerSide = function() {
|
|
@@ -268,18 +258,5 @@ sap.ui.define([
|
|
|
268
258
|
return Math.max(0, this._iPageCount - 1);
|
|
269
259
|
};
|
|
270
260
|
|
|
271
|
-
Paginator.prototype._createManifest = function() {
|
|
272
|
-
const oCard = this.getCard();
|
|
273
|
-
const oManifest = oCard.getManifestEntry("/");
|
|
274
|
-
|
|
275
|
-
oManifest["sap.app"].id = oManifest["sap.app"].id + uid();
|
|
276
|
-
|
|
277
|
-
oCard.getAggregation("_filterBar")?._getFilters().forEach((oFilter) => {
|
|
278
|
-
oFilter.writeValueToConfiguration(oManifest["sap.card"].configuration.filters[oFilter.getKey()]);
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
return oManifest;
|
|
282
|
-
};
|
|
283
|
-
|
|
284
261
|
return Paginator;
|
|
285
262
|
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2025 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
sap.ui.define([
|
|
7
|
+
"sap/ui/base/Object"
|
|
8
|
+
], function (
|
|
9
|
+
BaseObject
|
|
10
|
+
) {
|
|
11
|
+
"use strict";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Constructor for a new <code>PreventKeyboardScrolling</code>.
|
|
15
|
+
*
|
|
16
|
+
* @class
|
|
17
|
+
* Prevents the card's content from scrolling with the arrows or tab. Handles where the tab should go when the content is overflowing.
|
|
18
|
+
*
|
|
19
|
+
* @extends sap.ui.base.Object
|
|
20
|
+
*
|
|
21
|
+
* @author SAP SE
|
|
22
|
+
* @version 1.133.0
|
|
23
|
+
*
|
|
24
|
+
* @constructor
|
|
25
|
+
* @param {sap.ui.integration.cards.BaseContent} oContent The card content.
|
|
26
|
+
* @private
|
|
27
|
+
* @alias sap.ui.integration.delegate.PreventKeyboardScrolling
|
|
28
|
+
*/
|
|
29
|
+
const PreventKeyboardScrolling = BaseObject.extend("sap.ui.integration.delegate.PreventKeyboardScrolling", {
|
|
30
|
+
constructor: function (oContent) {
|
|
31
|
+
BaseObject.call(this);
|
|
32
|
+
this._oContent = oContent;
|
|
33
|
+
|
|
34
|
+
this._cardKeydownBound = this._cardKeydown.bind(this);
|
|
35
|
+
this._scrollBound = this._scroll.bind(this);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
PreventKeyboardScrolling.prototype.destroy = function () {
|
|
40
|
+
BaseObject.prototype.destroy.apply(this, arguments);
|
|
41
|
+
|
|
42
|
+
this.detach();
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
PreventKeyboardScrolling.prototype.toggle = function (bAttach) {
|
|
46
|
+
if (bAttach) {
|
|
47
|
+
this.attach();
|
|
48
|
+
} else {
|
|
49
|
+
this.detach();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
PreventKeyboardScrolling.prototype.attach = function () {
|
|
54
|
+
const oCardRef = this._oContent.getCardInstance()?.getDomRef();
|
|
55
|
+
const oContentSection = this._getContentSection();
|
|
56
|
+
|
|
57
|
+
oCardRef.addEventListener("keydown", this._cardKeydownBound);
|
|
58
|
+
|
|
59
|
+
oContentSection.addEventListener("scroll", this._scrollBound);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
PreventKeyboardScrolling.prototype.detach = function () {
|
|
63
|
+
const oCardRef = this._oContent.getCardInstance()?.getDomRef();
|
|
64
|
+
const oContentSection = this._getContentSection();
|
|
65
|
+
|
|
66
|
+
oCardRef?.removeEventListener("keydown", this._cardKeydownBound);
|
|
67
|
+
oContentSection?.removeEventListener("scroll", this._scrollBound);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
PreventKeyboardScrolling.prototype._getContentSection = function () {
|
|
71
|
+
const oCard = this._oContent.getCardInstance();
|
|
72
|
+
|
|
73
|
+
return oCard?.getDomRef("contentSection");
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
PreventKeyboardScrolling.prototype._cardKeydown = function () {
|
|
77
|
+
this._oLastFocusedElement = document.activeElement;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
PreventKeyboardScrolling.prototype._scroll = function () {
|
|
81
|
+
const oContent = this._oContent;
|
|
82
|
+
const oCard = oContent.getCardInstance();
|
|
83
|
+
const oCardRef = oCard.getDomRef();
|
|
84
|
+
const oContentSection = this._getContentSection();
|
|
85
|
+
|
|
86
|
+
// prevents the focus to move the scroll
|
|
87
|
+
oContentSection.scrollTop = 0;
|
|
88
|
+
|
|
89
|
+
const oFooter = oCard.getCardFooter();
|
|
90
|
+
if (!oFooter || !oFooter.getDomRef()) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// moves the focus to the first button from the footer
|
|
95
|
+
const oFirstItem = oFooter.getFirstFocusableItem();
|
|
96
|
+
if (!oFirstItem) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
oFirstItem.focus();
|
|
101
|
+
|
|
102
|
+
// shift + tab returns the focus on the previous selected item
|
|
103
|
+
const oFirstItemRef = oFirstItem.getDomRef();
|
|
104
|
+
const fnHandleFocusBack = (oEvent) => {
|
|
105
|
+
// shift + tab
|
|
106
|
+
if (oEvent.shiftKey && oEvent.keyCode == 9) {
|
|
107
|
+
this._oLastFocusedElement?.focus();
|
|
108
|
+
oEvent.preventDefault();
|
|
109
|
+
|
|
110
|
+
oFirstItemRef?.removeEventListener("keydown", fnHandleFocusBack);
|
|
111
|
+
oCardRef?.addEventListener("keydown", this._cardKeydownBound);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
oCardRef.removeEventListener("keydown", this._cardKeydownBound);
|
|
116
|
+
oFirstItemRef.addEventListener("keydown", fnHandleFocusBack);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return PreventKeyboardScrolling;
|
|
120
|
+
});
|