Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_handleActionsOverflow() {
const rightContainerRect = this.shadowRoot.querySelector(".sapWCShellBarOverflowContainerRight").getBoundingClientRect();
const icons = this.shadowRoot.querySelectorAll(".sapWCShellBarIconButton:not(.sapWCShellBarOverflowIcon):not(.sapWCShellBarUnsetIcon)");
const isRTL = getRTL();
let overflowCount = [].filter.call(icons, icon => {
const iconRect = icon.getBoundingClientRect();
if (isRTL) {
return (iconRect.left + iconRect.width) > (rightContainerRect.left + rightContainerRect.width);
}
return iconRect.left < rightContainerRect.left;
});
overflowCount = overflowCount.length;
const items = this._getAllItems(!!overflowCount);
items.map(item => {
_handleSearchIconPress(event) {
const searchField = this.shadowRoot.querySelector(`#${this._id}-searchfield-wrapper`);
const triggeredByOverflow = event.target.tagName.toLowerCase() === "ui5-li";
const overflowButton = this.shadowRoot.querySelector(".sapWCShellBarOverflowIcon");
const overflowButtonRect = overflowButton.getBoundingClientRect();
const isRTL = getRTL();
let right = "";
if (isRTL) {
right = `${(triggeredByOverflow ? overflowButton.offsetLeft : event.target.offsetLeft) + overflowButtonRect.width}px`;
} else {
right = `calc(100% - ${triggeredByOverflow ? overflowButton.offsetLeft : event.target.offsetLeft}px)`;
}
this._searchField = Object.assign({}, this._searchField, {
"right": right,
});
this._showBlockLayer = true;
setTimeout(() => {
const inputSlot = searchField.children[0];
static calculate(state) {
const hiddenIcons = state._itemsInfo.filter(info => {
const isHidden = (info.classes.indexOf("sapWCShellBarHiddenIcon") !== -1);
const isSet = info.classes.indexOf("sapWCShellBarUnsetIcon") === -1;
const isOverflowIcon = info.classes.indexOf("sapWCShellBarOverflowIcon") !== -1;
return isHidden && isSet && !isOverflowIcon;
});
const isRTL = getRTL();
const interactiveLogo = state._breakpointSize === "S";
return {
ctr: state,
_hiddenIcons: hiddenIcons,
popoverHorizontalAlign: isRTL ? "Left" : "Right",
interactiveLogo,
showArrowDown: state.primaryTitle || (state.logo && interactiveLogo),
styles: {
searchField: {
[isRTL ? "left" : "right"]: state._searchField.right,
"top": `${parseInt(state._searchField.top)}px`,
},
},
classes: {
wrapper: {
get popoverHorizontalAlign() {
return getRTL() ? "Left" : "Right";
}
get styles() {
return {
searchField: {
[getRTL() ? "left" : "right"]: this._searchField.right,
"top": `${parseInt(this._searchField.top)}px`,
},
};
}