@openui5/sap.ui.webc.main 1.117.1 → 1.119.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/THIRDPARTY.txt +2 -2
- package/package.json +3 -3
- package/src/sap/ui/webc/main/.library +1 -1
- package/src/sap/ui/webc/main/Avatar.js +4 -4
- package/src/sap/ui/webc/main/AvatarGroup.js +4 -4
- package/src/sap/ui/webc/main/Badge.js +4 -4
- package/src/sap/ui/webc/main/Breadcrumbs.js +4 -4
- package/src/sap/ui/webc/main/BreadcrumbsItem.js +4 -4
- package/src/sap/ui/webc/main/BusyIndicator.js +4 -4
- package/src/sap/ui/webc/main/Button.js +6 -6
- package/src/sap/ui/webc/main/Calendar.js +4 -4
- package/src/sap/ui/webc/main/CalendarDate.js +4 -4
- package/src/sap/ui/webc/main/Card.js +4 -4
- package/src/sap/ui/webc/main/CardHeader.js +4 -4
- package/src/sap/ui/webc/main/Carousel.js +4 -4
- package/src/sap/ui/webc/main/CheckBox.js +5 -5
- package/src/sap/ui/webc/main/ColorPalette.js +6 -6
- package/src/sap/ui/webc/main/ColorPaletteItem.js +4 -4
- package/src/sap/ui/webc/main/ColorPalettePopover.js +6 -6
- package/src/sap/ui/webc/main/ColorPicker.js +4 -4
- package/src/sap/ui/webc/main/ComboBox.js +5 -5
- package/src/sap/ui/webc/main/ComboBoxGroupItem.js +4 -4
- package/src/sap/ui/webc/main/ComboBoxItem.js +4 -4
- package/src/sap/ui/webc/main/CustomListItem.js +4 -4
- package/src/sap/ui/webc/main/DatePicker.js +5 -5
- package/src/sap/ui/webc/main/DateRangePicker.js +5 -5
- package/src/sap/ui/webc/main/DateTimePicker.js +5 -5
- package/src/sap/ui/webc/main/Dialog.js +4 -4
- package/src/sap/ui/webc/main/FileUploader.js +5 -5
- package/src/sap/ui/webc/main/GroupHeaderListItem.js +4 -4
- package/src/sap/ui/webc/main/Icon.js +4 -4
- package/src/sap/ui/webc/main/Input.js +7 -7
- package/src/sap/ui/webc/main/Label.js +4 -4
- package/src/sap/ui/webc/main/Link.js +5 -5
- package/src/sap/ui/webc/main/List.js +4 -4
- package/src/sap/ui/webc/main/Menu.js +4 -4
- package/src/sap/ui/webc/main/MenuItem.js +5 -5
- package/src/sap/ui/webc/main/MessageStrip.js +4 -4
- package/src/sap/ui/webc/main/MultiComboBox.js +5 -5
- package/src/sap/ui/webc/main/MultiComboBoxGroupItem.js +4 -4
- package/src/sap/ui/webc/main/MultiComboBoxItem.js +4 -4
- package/src/sap/ui/webc/main/MultiInput.js +7 -7
- package/src/sap/ui/webc/main/Option.js +5 -5
- package/src/sap/ui/webc/main/Panel.js +4 -4
- package/src/sap/ui/webc/main/Popover.js +4 -4
- package/src/sap/ui/webc/main/ProgressIndicator.js +5 -5
- package/src/sap/ui/webc/main/RadioButton.js +5 -5
- package/src/sap/ui/webc/main/RangeSlider.js +5 -5
- package/src/sap/ui/webc/main/RatingIndicator.js +5 -5
- package/src/sap/ui/webc/main/ResponsivePopover.js +4 -4
- package/src/sap/ui/webc/main/SegmentedButton.js +4 -4
- package/src/sap/ui/webc/main/SegmentedButtonItem.js +5 -5
- package/src/sap/ui/webc/main/Select.js +5 -5
- package/src/sap/ui/webc/main/Slider.js +5 -5
- package/src/sap/ui/webc/main/SplitButton.js +5 -5
- package/src/sap/ui/webc/main/StandardListItem.js +4 -4
- package/src/sap/ui/webc/main/StepInput.js +5 -5
- package/src/sap/ui/webc/main/SuggestionGroupItem.js +4 -4
- package/src/sap/ui/webc/main/SuggestionItem.js +4 -4
- package/src/sap/ui/webc/main/Switch.js +5 -5
- package/src/sap/ui/webc/main/Tab.js +5 -5
- package/src/sap/ui/webc/main/TabContainer.js +4 -4
- package/src/sap/ui/webc/main/TabSeparator.js +4 -4
- package/src/sap/ui/webc/main/Table.js +4 -4
- package/src/sap/ui/webc/main/TableCell.js +4 -4
- package/src/sap/ui/webc/main/TableColumn.js +4 -4
- package/src/sap/ui/webc/main/TableGroupRow.js +4 -4
- package/src/sap/ui/webc/main/TableRow.js +4 -4
- package/src/sap/ui/webc/main/TextArea.js +5 -5
- package/src/sap/ui/webc/main/TimePicker.js +5 -5
- package/src/sap/ui/webc/main/Title.js +4 -4
- package/src/sap/ui/webc/main/Toast.js +4 -4
- package/src/sap/ui/webc/main/ToggleButton.js +5 -5
- package/src/sap/ui/webc/main/Token.js +4 -4
- package/src/sap/ui/webc/main/Tree.js +4 -4
- package/src/sap/ui/webc/main/TreeItem.js +4 -4
- package/src/sap/ui/webc/main/TreeItemCustom.js +4 -4
- package/src/sap/ui/webc/main/changeHandler/ChangeLinkTarget.js +1 -1
- package/src/sap/ui/webc/main/library.js +2 -2
- package/src/sap/ui/webc/main/thirdparty/Popover.js +477 -582
- package/src/sap/ui/webc/main/thirdparty/popup-utils/PopoverRegistry.js +127 -135
- package/ui5.yaml +5 -0
@@ -1,139 +1,131 @@
|
|
1
|
-
sap.ui.define([
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
openedRegistry
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
const runUpdateInterval = () => {
|
22
|
-
updateInterval = setInterval(() => {
|
23
|
-
repositionPopovers();
|
24
|
-
closePopoversIfLostFocus();
|
25
|
-
}, intervalTimeout);
|
26
|
-
};
|
27
|
-
const stopUpdateInterval = () => {
|
28
|
-
clearInterval(updateInterval);
|
29
|
-
};
|
30
|
-
const attachGlobalScrollHandler = () => {
|
31
|
-
document.body.addEventListener("scroll", repositionPopovers, {
|
32
|
-
capture: true
|
33
|
-
});
|
34
|
-
};
|
35
|
-
const detachGlobalScrollHandler = () => {
|
36
|
-
document.body.removeEventListener("scroll", repositionPopovers, {
|
37
|
-
capture: true
|
38
|
-
});
|
39
|
-
};
|
40
|
-
const attachScrollHandler = popover => {
|
41
|
-
popover && popover.shadowRoot.addEventListener("scroll", repositionPopovers, {
|
42
|
-
capture: true
|
43
|
-
});
|
44
|
-
};
|
45
|
-
const detachScrollHandler = popover => {
|
46
|
-
popover && popover.shadowRoot.removeEventListener("scroll", repositionPopovers, {
|
47
|
-
capture: true
|
48
|
-
});
|
49
|
-
};
|
50
|
-
const attachGlobalClickHandler = () => {
|
51
|
-
document.addEventListener("mousedown", clickHandler);
|
52
|
-
};
|
53
|
-
const detachGlobalClickHandler = () => {
|
54
|
-
document.removeEventListener("mousedown", clickHandler);
|
55
|
-
};
|
56
|
-
const clickHandler = event => {
|
57
|
-
const openedPopups = (0, _OpenedPopupsRegistry.getOpenedPopups)();
|
58
|
-
if (openedPopups.length === 0) {
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
const isTopPopupPopover = (0, _Popover.instanceOfPopover)(openedPopups[openedPopups.length - 1].instance);
|
62
|
-
if (!isTopPopupPopover) {
|
63
|
-
return;
|
64
|
-
}
|
65
|
-
// loop all open popovers
|
66
|
-
for (let i = openedPopups.length - 1; i !== -1; i--) {
|
67
|
-
const popup = openedPopups[i].instance;
|
68
|
-
// if popup is modal, opener is clicked, popup is dialog skip closing
|
69
|
-
if (popup.isModal || popup.isOpenerClicked(event)) {
|
70
|
-
return;
|
71
|
-
}
|
72
|
-
if ((0, _PopupUtils.isClickInRect)(event, popup.getBoundingClientRect())) {
|
73
|
-
break;
|
74
|
-
}
|
75
|
-
popup.close();
|
76
|
-
}
|
77
|
-
};
|
78
|
-
const addOpenedPopover = instance => {
|
79
|
-
const parentPopovers = getParentPopoversIfNested(instance);
|
80
|
-
(0, _OpenedPopupsRegistry.addOpenedPopup)(instance, parentPopovers);
|
81
|
-
openedRegistry.push({
|
82
|
-
instance,
|
83
|
-
parentPopovers
|
84
|
-
});
|
85
|
-
attachScrollHandler(instance);
|
86
|
-
if (openedRegistry.length === 1) {
|
87
|
-
attachGlobalScrollHandler();
|
88
|
-
attachGlobalClickHandler();
|
89
|
-
runUpdateInterval();
|
90
|
-
}
|
91
|
-
};
|
92
|
-
_exports.addOpenedPopover = addOpenedPopover;
|
93
|
-
const removeOpenedPopover = instance => {
|
94
|
-
const popoversToClose = [instance];
|
95
|
-
for (let i = 0; i < openedRegistry.length; i++) {
|
96
|
-
const indexOfCurrentInstance = openedRegistry[i].parentPopovers.indexOf(instance);
|
97
|
-
if (openedRegistry[i].parentPopovers.length > 0 && indexOfCurrentInstance > -1) {
|
98
|
-
popoversToClose.push(openedRegistry[i].instance);
|
99
|
-
}
|
100
|
-
}
|
101
|
-
for (let i = popoversToClose.length - 1; i >= 0; i--) {
|
102
|
-
for (let j = 0; j < openedRegistry.length; j++) {
|
103
|
-
let indexOfItemToRemove = -1;
|
104
|
-
if (popoversToClose[i] === openedRegistry[j].instance) {
|
105
|
-
indexOfItemToRemove = j;
|
1
|
+
sap.ui.define([
|
2
|
+
'exports',
|
3
|
+
'sap/ui/webc/common/thirdparty/base/util/PopupUtils',
|
4
|
+
'../Popover',
|
5
|
+
'./OpenedPopupsRegistry'
|
6
|
+
], function (_exports, _PopupUtils, _Popover, _OpenedPopupsRegistry) {
|
7
|
+
'use strict';
|
8
|
+
Object.defineProperty(_exports, '__esModule', { value: true });
|
9
|
+
_exports.removeOpenedPopover = _exports.getRegistry = _exports.addOpenedPopover = void 0;
|
10
|
+
let updateInterval;
|
11
|
+
const intervalTimeout = 300;
|
12
|
+
const openedRegistry = [];
|
13
|
+
const repositionPopovers = () => {
|
14
|
+
openedRegistry.forEach(popover => {
|
15
|
+
popover.instance.reposition();
|
16
|
+
});
|
17
|
+
};
|
18
|
+
const closePopoversIfLostFocus = () => {
|
19
|
+
if (document.activeElement.tagName === 'IFRAME') {
|
20
|
+
getRegistry().reverse().forEach(popup => popup.instance.close(false, false, true));
|
106
21
|
}
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
22
|
+
};
|
23
|
+
const runUpdateInterval = () => {
|
24
|
+
updateInterval = setInterval(() => {
|
25
|
+
repositionPopovers();
|
26
|
+
closePopoversIfLostFocus();
|
27
|
+
}, intervalTimeout);
|
28
|
+
};
|
29
|
+
const stopUpdateInterval = () => {
|
30
|
+
clearInterval(updateInterval);
|
31
|
+
};
|
32
|
+
const attachGlobalScrollHandler = () => {
|
33
|
+
document.body.addEventListener('scroll', repositionPopovers, { capture: true });
|
34
|
+
};
|
35
|
+
const detachGlobalScrollHandler = () => {
|
36
|
+
document.body.removeEventListener('scroll', repositionPopovers, { capture: true });
|
37
|
+
};
|
38
|
+
const attachScrollHandler = popover => {
|
39
|
+
popover && popover.shadowRoot.addEventListener('scroll', repositionPopovers, { capture: true });
|
40
|
+
};
|
41
|
+
const detachScrollHandler = popover => {
|
42
|
+
popover && popover.shadowRoot.removeEventListener('scroll', repositionPopovers, { capture: true });
|
43
|
+
};
|
44
|
+
const attachGlobalClickHandler = () => {
|
45
|
+
document.addEventListener('mousedown', clickHandler);
|
46
|
+
};
|
47
|
+
const detachGlobalClickHandler = () => {
|
48
|
+
document.removeEventListener('mousedown', clickHandler);
|
49
|
+
};
|
50
|
+
const clickHandler = event => {
|
51
|
+
const openedPopups = (0, _OpenedPopupsRegistry.getOpenedPopups)();
|
52
|
+
if (openedPopups.length === 0) {
|
53
|
+
return;
|
112
54
|
}
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
detachGlobalScrollHandler();
|
117
|
-
detachGlobalClickHandler();
|
118
|
-
stopUpdateInterval();
|
119
|
-
}
|
120
|
-
};
|
121
|
-
_exports.removeOpenedPopover = removeOpenedPopover;
|
122
|
-
const getRegistry = () => {
|
123
|
-
return openedRegistry;
|
124
|
-
};
|
125
|
-
_exports.getRegistry = getRegistry;
|
126
|
-
const getParentPopoversIfNested = instance => {
|
127
|
-
let currentElement = instance.parentNode;
|
128
|
-
const parentPopovers = [];
|
129
|
-
while (currentElement && currentElement.parentNode) {
|
130
|
-
for (let i = 0; i < openedRegistry.length; i++) {
|
131
|
-
if (currentElement === openedRegistry[i].instance) {
|
132
|
-
parentPopovers.push(currentElement);
|
55
|
+
const isTopPopupPopover = (0, sap.ui.require('sap/ui/webc/main/thirdparty/Popover').instanceOfPopover)(openedPopups[openedPopups.length - 1].instance);
|
56
|
+
if (!isTopPopupPopover) {
|
57
|
+
return;
|
133
58
|
}
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
59
|
+
for (let i = openedPopups.length - 1; i !== -1; i--) {
|
60
|
+
const popup = openedPopups[i].instance;
|
61
|
+
if (popup.isModal || popup.isOpenerClicked(event)) {
|
62
|
+
return;
|
63
|
+
}
|
64
|
+
if ((0, _PopupUtils.isClickInRect)(event, popup.getBoundingClientRect())) {
|
65
|
+
break;
|
66
|
+
}
|
67
|
+
popup.close();
|
68
|
+
}
|
69
|
+
};
|
70
|
+
const addOpenedPopover = instance => {
|
71
|
+
const parentPopovers = getParentPopoversIfNested(instance);
|
72
|
+
(0, _OpenedPopupsRegistry.addOpenedPopup)(instance, parentPopovers);
|
73
|
+
openedRegistry.push({
|
74
|
+
instance,
|
75
|
+
parentPopovers
|
76
|
+
});
|
77
|
+
attachScrollHandler(instance);
|
78
|
+
if (openedRegistry.length === 1) {
|
79
|
+
attachGlobalScrollHandler();
|
80
|
+
attachGlobalClickHandler();
|
81
|
+
runUpdateInterval();
|
82
|
+
}
|
83
|
+
};
|
84
|
+
_exports.addOpenedPopover = addOpenedPopover;
|
85
|
+
const removeOpenedPopover = instance => {
|
86
|
+
const popoversToClose = [instance];
|
87
|
+
for (let i = 0; i < openedRegistry.length; i++) {
|
88
|
+
const indexOfCurrentInstance = openedRegistry[i].parentPopovers.indexOf(instance);
|
89
|
+
if (openedRegistry[i].parentPopovers.length > 0 && indexOfCurrentInstance > -1) {
|
90
|
+
popoversToClose.push(openedRegistry[i].instance);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
for (let i = popoversToClose.length - 1; i >= 0; i--) {
|
94
|
+
for (let j = 0; j < openedRegistry.length; j++) {
|
95
|
+
let indexOfItemToRemove = -1;
|
96
|
+
if (popoversToClose[i] === openedRegistry[j].instance) {
|
97
|
+
indexOfItemToRemove = j;
|
98
|
+
}
|
99
|
+
if (indexOfItemToRemove >= 0) {
|
100
|
+
(0, _OpenedPopupsRegistry.removeOpenedPopup)(openedRegistry[indexOfItemToRemove].instance);
|
101
|
+
detachScrollHandler(openedRegistry[indexOfItemToRemove].instance);
|
102
|
+
const itemToClose = openedRegistry.splice(indexOfItemToRemove, 1);
|
103
|
+
itemToClose[0].instance.close(false, true);
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
if (!openedRegistry.length) {
|
108
|
+
detachGlobalScrollHandler();
|
109
|
+
detachGlobalClickHandler();
|
110
|
+
stopUpdateInterval();
|
111
|
+
}
|
112
|
+
};
|
113
|
+
_exports.removeOpenedPopover = removeOpenedPopover;
|
114
|
+
const getRegistry = () => {
|
115
|
+
return openedRegistry;
|
116
|
+
};
|
117
|
+
_exports.getRegistry = getRegistry;
|
118
|
+
const getParentPopoversIfNested = instance => {
|
119
|
+
let currentElement = instance.parentNode;
|
120
|
+
const parentPopovers = [];
|
121
|
+
while (currentElement && currentElement.parentNode) {
|
122
|
+
for (let i = 0; i < openedRegistry.length; i++) {
|
123
|
+
if (currentElement === openedRegistry[i].instance) {
|
124
|
+
parentPopovers.push(currentElement);
|
125
|
+
}
|
126
|
+
}
|
127
|
+
currentElement = currentElement.parentNode;
|
128
|
+
}
|
129
|
+
return parentPopovers;
|
130
|
+
};
|
139
131
|
});
|
package/ui5.yaml
CHANGED
@@ -48,6 +48,11 @@ customConfiguration:
|
|
48
48
|
"^@ui5\/webcomponents\/dist\/(.*?).js$": "sap/ui/webc/main/thirdparty/$1"
|
49
49
|
reverseAliases: # used by the middleware to serve third-party files as UI5 modules
|
50
50
|
"^/resources/sap/ui/webc/main/thirdparty/(.*?)$": "@ui5/webcomponents/dist/$1"
|
51
|
+
cyclicDependencies:
|
52
|
+
"sap/ui/webc/main/thirdparty/popup-utils/PopoverRegistry":
|
53
|
+
- "sap/ui/webc/main/thirdparty/Popover"
|
54
|
+
"sap/ui/webc/main/thirdparty/Popover":
|
55
|
+
- "sap/ui/webc/main/thirdparty/popup-utils/PopoverRegistry"
|
51
56
|
inputPath: "dist/" # where to find the web components
|
52
57
|
inputPathFilters: # relative to the inputPath, can be inclusive or exclusive(!) filters
|
53
58
|
- "**/*{.js,.json,.css}"
|