Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
02b434b
chore: add test page
TeodorTaushanov Nov 5, 2025
ceab536
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 5, 2025
4f1068a
chore: improve test page
TeodorTaushanov Nov 6, 2025
5f08774
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 6, 2025
d5f7f45
chore: render the resize corner icon
TeodorTaushanov Nov 6, 2025
d33a75f
chore: add ResizeHandlePlacement
TeodorTaushanov Nov 7, 2025
438208b
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 7, 2025
1882499
chore: add some resizing structure
TeodorTaushanov Nov 7, 2025
ae3b66b
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 10, 2025
ef6b0cd
chore: calc resizeHandlePlacement
TeodorTaushanov Nov 10, 2025
a167b86
chore: improve calculations
TeodorTaushanov Nov 10, 2025
7f946d3
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 10, 2025
6398e8e
chore: handle min sizes
TeodorTaushanov Nov 11, 2025
666b5d1
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 11, 2025
1161353
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 12, 2025
bb5f509
fix: resize icon placing in rtl mode
TeodorTaushanov Nov 13, 2025
1a05a21
fix: resize positioning when centered
TeodorTaushanov Nov 14, 2025
98d4d7d
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 14, 2025
bf1d23d
fix: fix re-resizing
TeodorTaushanov Nov 14, 2025
48abe1b
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 17, 2025
090e002
fix: clicking outside the resize handle icon
TeodorTaushanov Nov 17, 2025
c27c937
fix: lint error
TeodorTaushanov Nov 17, 2025
99b6fe9
chore: rename props
TeodorTaushanov Nov 17, 2025
a49c512
chore: add tests
TeodorTaushanov Nov 18, 2025
605912f
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 18, 2025
41cf755
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 18, 2025
19a4c91
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 18, 2025
0d7339b
chore: fix tests
TeodorTaushanov Nov 18, 2025
ad0f12c
chore: improve tests
TeodorTaushanov Nov 19, 2025
f1942bd
chore: improve tests
TeodorTaushanov Nov 19, 2025
506eac9
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 19, 2025
27c237d
Merge remote-tracking branch 'origin/main' into popover_resize
TeodorTaushanov Nov 20, 2025
a3dbd62
chore: override styles like in the Dialog
TeodorTaushanov Nov 20, 2025
6d543d9
chore: add public sample
TeodorTaushanov Nov 20, 2025
5161217
chore: fix typo
TeodorTaushanov Nov 20, 2025
5bb57bf
chore: improve public sample
TeodorTaushanov Nov 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
979 changes: 979 additions & 0 deletions packages/main/cypress/specs/PopoverResize.cy.tsx

Large diffs are not rendered by default.

332 changes: 324 additions & 8 deletions packages/main/src/Popover.ts

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions packages/main/src/PopoverTemplate.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Icon from "./Icon.js";
import resizeCorner from "@ui5/webcomponents-icons/dist/resize-corner.js";
import type Popover from "./Popover.js";
import PopupTemplate from "./PopupTemplate.js";
import Title from "./Title.js";
Expand Down Expand Up @@ -32,5 +34,13 @@ function afterContent(this: Popover) {
<slot name="footer"></slot>
</footer>
}

{this._showResizeHandle &&
<div class="ui5-popover-resize-handle"
onMouseDown={this._onResizeMouseDown}
>
<Icon name={resizeCorner} />
</div>
}
</>);
}
3 changes: 1 addition & 2 deletions packages/main/src/popup-utils/PopoverRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { isClickInRect } from "@ui5/webcomponents-base/dist/util/PopupUtils.js";
import type { Interval } from "@ui5/webcomponents-base/dist/types.js";
import getActiveElement from "@ui5/webcomponents-base/dist/util/getActiveElement.js";
import getParentElement from "@ui5/webcomponents-base/dist/util/getParentElement.js";
Expand Down Expand Up @@ -100,7 +99,7 @@ const clickHandler = (event: MouseEvent) => {
return;
}

if (isClickInRect(event, popup.getBoundingClientRect())) {
if ((popup as Popover).isClicked(event)) {
break;
}

Expand Down
16 changes: 0 additions & 16 deletions packages/main/src/themes/Dialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,6 @@
color: var(--sapButton_Lite_TextColor);
}

::slotted([slot="footer"]) {
height: var(--_ui5_dialog_footer_height);
}

::slotted([slot="footer"][ui5-bar][design="Footer"]) {
border-top: none;
}

::slotted([slot="header"][ui5-bar]) {
box-shadow: none;
}

::slotted([slot="footer"][ui5-toolbar]) {
border: 0;
}

:host::backdrop {
background-color: var(--_ui5_popup_block_layer_background);
opacity: var(--_ui5_popup_block_layer_opacity);
Expand Down
77 changes: 77 additions & 0 deletions packages/main/src/themes/Popover.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,80 @@
:host([modal]) .ui5-block-layer {
display: block;
}

/* resize handle */

.ui5-popover-resize-handle {
position: absolute;
width: 1.5rem;
height: 1.5rem;
border-radius: 50%;
z-index: 1;
}

.ui5-popover-resize-handle [ui5-icon] {
position: absolute;
width: 1rem;
height: 1rem;
cursor: inherit;
color: var(--sapButton_Lite_TextColor);
--rotAngle: 0;
--scaleX: 1;
transform: rotate(var(--rotAngle)) scaleX(var(--scaleX));
}

.ui5-popover-rtl .ui5-popover-resize-handle [ui5-icon] {
--scaleX: -1;
}

.ui5-popover-resize-handle-top-right .ui5-popover-resize-handle {
top: -0.5rem;
right: -0.5rem;
cursor: ne-resize;
}

.ui5-popover-resize-handle-top-right .ui5-popover-resize-handle [ui5-icon] {
bottom: 0;
left: 0;
--rotAngle: 270deg;
}

.ui5-popover-resize-handle-top-left .ui5-popover-resize-handle {
top: -0.5rem;
left: -0.5rem;
cursor: nw-resize;
}

.ui5-popover-resize-handle-top-left .ui5-popover-resize-handle [ui5-icon] {
bottom: 0;
right: 0;
--rotAngle: 180deg;
}

.ui5-popover-resize-handle-bottom-left .ui5-popover-resize-handle {
bottom: -0.5rem;
left: -0.5rem;
cursor: ne-resize;
}

.ui5-popover-resize-handle-bottom-left .ui5-popover-resize-handle [ui5-icon] {
top: 0;
right: 0;
--rotAngle: 90deg;
}

.ui5-popover-resize-handle-bottom-right .ui5-popover-resize-handle {
bottom: -0.5rem;
right: -0.5rem;
cursor: nw-resize;
}

.ui5-popover-resize-handle-bottom-right .ui5-popover-resize-handle [ui5-icon] {
top: 0;
left: 0;
}

.ui5-popover-resizing,
.ui5-popover-resizing * {
user-select: none !important;
}
16 changes: 16 additions & 0 deletions packages/main/src/themes/PopupsCommon.css
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,19 @@
padding-left: var(--_ui5_popup_header_footer_padding_xl);
padding-right: var(--_ui5_popup_header_footer_padding_xl);
}

::slotted([slot="footer"]) {
height: var(--_ui5_popup_footer_height);
}

::slotted([slot="footer"][ui5-bar][design="Footer"]) {
border-top: none;
}

::slotted([slot="header"][ui5-bar]) {
box-shadow: none;
}

::slotted([slot="footer"][ui5-toolbar]) {
border: 0;
}
8 changes: 6 additions & 2 deletions packages/main/src/themes/base/sizes-parameters.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@
--_ui5_datetime_timeview_phonemode_clocks_width: 24.5rem;
--_ui5_datetime_dateview_phonemode_margin_bottom: 0;

/* Popup */
--_ui5_popup_footer_height: 2.75rem;

/* Dialog */
--_ui5_dialog_content_min_height: 2.75rem;
--_ui5_dialog_footer_height: 2.75rem;

--_ui5_input_inner_padding: 0 0.625rem;
--_ui5_input_inner_padding_with_icon: 0 0.25rem 0 0.625rem;
Expand Down Expand Up @@ -265,9 +267,11 @@
--_ui5_datetime_timeview_phonemode_clocks_width: 21.125rem;
--_ui5_datetime_dateview_phonemode_margin_bottom: 3.125rem;

/* Popup */
--_ui5_popup_footer_height: 2.5rem;

/* Dialog */
--_ui5_dialog_content_min_height: 2.5rem;
--_ui5_dialog_footer_height: 2.5rem;

/* Form */
--_ui5_form_item_min_height: 2rem;
Expand Down
94 changes: 94 additions & 0 deletions packages/main/test/pages/PopoverResize.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<!DOCTYPE html>
<html class="popover1auto">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Popover Resize</title>

<script data-ui5-config type="application/json">
{
"language": "EN",
"libs": "sap.ui.webc.main"
}
</script>
<script src="%VITE_BUNDLE_PATH%" type="module"></script>
<link rel="stylesheet" type="text/css" href="./styles/PopoverResize.css">
<script>
document.addEventListener('DOMContentLoaded', function () {
buttonId.onclick = function () {
popoverId.open = true;
};

placementSwitch.addEventListener("ui5-selection-change", event => {
popoverId.placement = event.detail.selectedItems[0].getAttribute("data-ui5-value");
});

hAlignSwitch.addEventListener("ui5-selection-change", event => {
popoverId.horizontalAlign = event.detail.selectedItems[0].getAttribute("data-ui5-value");
});

vAlignSwitch.addEventListener("ui5-selection-change", event => {
popoverId.verticalAlign = event.detail.selectedItems[0].getAttribute("data-ui5-value");
});

hideArrowSwitch.addEventListener("ui5-change", event => {
popoverId.hideArrow = hideArrowSwitch.checked;
})
});
</script>
</head>

<body class="sapUiSizeCompact">
<div class="pageContainer">
<ui5-title level="H1">Popover Resize</ui5-title>
<div class="popoverSettings">
<div>
<ui5-label for="placementSwitch" show-colon>Placement</ui5-label>
<ui5-segmented-button id="placementSwitch">
<ui5-segmented-button-item data-ui5-value="Start">Start</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="End" selected>End</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Top">Top</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Bottom">Bottom</ui5-segmented-button-item>
</ui5-segmented-button>
</div>
<div>
<ui5-label for="hAlignSwitch" show-colon>Horizontal Align</ui5-label>
<ui5-segmented-button id="hAlignSwitch">
<ui5-segmented-button-item data-ui5-value="Center" selected>Center</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Start">Start</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="End">End</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Stretch">Stretch</ui5-segmented-button-item>
</ui5-segmented-button>
</div>
<div>
<ui5-label for="vAlignSwitch" show-colon>Vertical Align</ui5-label>
<ui5-segmented-button id="vAlignSwitch">
<ui5-segmented-button-item data-ui5-value="Center" selected>Center</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Top">Top</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Bottom">Bottom</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Stretch">Stretch</ui5-segmented-button-item>
</ui5-segmented-button>
</div>
<div>
<ui5-label for="hideArrowSwitch" show-colon>Hide Arrow</ui5-label>
<ui5-switch id="hideArrowSwitch"></ui5-switch>
</div>
</div>
<div class="popoverOpenerContainer">
<ui5-button id="buttonId">Open Popover</ui5-button>
<ui5-popover id="popoverId"
resizable
opener="buttonId"
header-text="Popover">
<div>
This is a Popover control.
</div>
<ui5-bar slot="footer" design="Footer">
<ui5-button design="Emphasized" id="closeDialogStateButton" slot="endContent">OK</ui5-button>
</ui5-bar>
</ui5-popover>
</div>
</div>
</body>
</html>
94 changes: 94 additions & 0 deletions packages/main/test/pages/PopoverResizeRTL.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<!DOCTYPE html>
<html class="popover1auto" dir="rtl">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Popover Resize in RTL mode</title>

<script data-ui5-config type="application/json">
{
"language": "EN",
"libs": "sap.ui.webc.main"
}
</script>
<script src="%VITE_BUNDLE_PATH%" type="module"></script>
<link rel="stylesheet" type="text/css" href="./styles/PopoverResize.css">
<script>
document.addEventListener('DOMContentLoaded', function () {
buttonId.onclick = function () {
popoverId.open = true;
};

placementSwitch.addEventListener("ui5-selection-change", event => {
popoverId.placement = event.detail.selectedItems[0].getAttribute("data-ui5-value");
});

hAlignSwitch.addEventListener("ui5-selection-change", event => {
popoverId.horizontalAlign = event.detail.selectedItems[0].getAttribute("data-ui5-value");
});

vAlignSwitch.addEventListener("ui5-selection-change", event => {
popoverId.verticalAlign = event.detail.selectedItems[0].getAttribute("data-ui5-value");
});

hideArrowSwitch.addEventListener("ui5-change", event => {
popoverId.hideArrow = hideArrowSwitch.checked;
})
});
</script>
</head>

<body class="sapUiSizeCompact">
<div class="pageContainer">
<ui5-title level="H1">Popover Resize</ui5-title>
<div class="popoverSettings">
<div>
<ui5-label for="placementSwitch" show-colon>Placement</ui5-label>
<ui5-segmented-button id="placementSwitch">
<ui5-segmented-button-item data-ui5-value="Start">Start</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="End" selected>End</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Top">Top</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Bottom">Bottom</ui5-segmented-button-item>
</ui5-segmented-button>
</div>
<div>
<ui5-label for="hAlignSwitch" show-colon>Horizontal Align</ui5-label>
<ui5-segmented-button id="hAlignSwitch">
<ui5-segmented-button-item data-ui5-value="Center" selected>Center</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Start">Start</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="End">End</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Stretch">Stretch</ui5-segmented-button-item>
</ui5-segmented-button>
</div>
<div>
<ui5-label for="vAlignSwitch" show-colon>Vertical Align</ui5-label>
<ui5-segmented-button id="vAlignSwitch">
<ui5-segmented-button-item data-ui5-value="Center" selected>Center</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Top">Top</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Bottom">Bottom</ui5-segmented-button-item>
<ui5-segmented-button-item data-ui5-value="Stretch">Stretch</ui5-segmented-button-item>
</ui5-segmented-button>
</div>
<div>
<ui5-label for="hideArrowSwitch" show-colon>Hide Arrow</ui5-label>
<ui5-switch id="hideArrowSwitch"></ui5-switch>
</div>
</div>
<div class="popoverOpenerContainer">
<ui5-button id="buttonId">Open Popover</ui5-button>
<ui5-popover id="popoverId"
resizable
opener="buttonId"
header-text="Popover">
<div>
This is a Popover control.
</div>
<ui5-bar slot="footer" design="Footer">
<ui5-button design="Emphasized" id="closeDialogStateButton" slot="endContent">OK</ui5-button>
</ui5-bar>
</ui5-popover>
</div>
</div>
</body>
</html>
Loading
Loading