cerxos-ui 0.0.9 → 0.0.11
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/fesm2022/cerxos-ui.mjs +9 -12
- package/fesm2022/cerxos-ui.mjs.map +1 -1
- package/package.json +1 -1
package/fesm2022/cerxos-ui.mjs
CHANGED
|
@@ -206,26 +206,23 @@ class CxsActionMenuComponent {
|
|
|
206
206
|
}
|
|
207
207
|
const rect = trigger.getBoundingClientRect();
|
|
208
208
|
const offset = 8;
|
|
209
|
-
this.menuPosition = {
|
|
210
|
-
top: rect.bottom + offset,
|
|
211
|
-
left: rect.left
|
|
212
|
-
};
|
|
213
209
|
setTimeout(() => {
|
|
214
210
|
const menuEl = this.menu?.nativeElement;
|
|
215
211
|
const menuRect = menuEl?.getBoundingClientRect();
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
212
|
+
const measuredWidth = menuRect?.width ?? 0;
|
|
213
|
+
const measuredHeight = menuRect?.height ?? 0;
|
|
214
|
+
const menuWidth = measuredWidth > 1 ? measuredWidth : 160;
|
|
215
|
+
const menuHeight = measuredHeight > 1 ? measuredHeight : 0;
|
|
219
216
|
let top = rect.bottom + offset;
|
|
220
|
-
let left = this.align === 'end' ? rect.right -
|
|
221
|
-
if (top +
|
|
222
|
-
top = rect.top -
|
|
217
|
+
let left = this.align === 'end' ? rect.right - menuWidth : rect.left;
|
|
218
|
+
if (top + menuHeight > window.innerHeight) {
|
|
219
|
+
top = rect.top - menuHeight - offset;
|
|
223
220
|
}
|
|
224
221
|
if (top < offset) {
|
|
225
222
|
top = offset;
|
|
226
223
|
}
|
|
227
|
-
if (left +
|
|
228
|
-
left = Math.max(offset, window.innerWidth -
|
|
224
|
+
if (left + menuWidth > window.innerWidth - offset) {
|
|
225
|
+
left = Math.max(offset, window.innerWidth - menuWidth - offset);
|
|
229
226
|
}
|
|
230
227
|
if (left < offset) {
|
|
231
228
|
left = offset;
|