cerxos-ui 0.0.9 → 0.0.10
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 +7 -12
- package/fesm2022/cerxos-ui.mjs.map +1 -1
- package/package.json +1 -1
package/fesm2022/cerxos-ui.mjs
CHANGED
|
@@ -206,26 +206,21 @@ 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 menuWidth = menuRect?.width ?? 160;
|
|
213
|
+
const menuHeight = menuRect?.height ?? 0;
|
|
219
214
|
let top = rect.bottom + offset;
|
|
220
|
-
let left = this.align === 'end' ? rect.right -
|
|
221
|
-
if (top +
|
|
222
|
-
top = rect.top -
|
|
215
|
+
let left = this.align === 'end' ? rect.right - menuWidth : rect.left;
|
|
216
|
+
if (top + menuHeight > window.innerHeight) {
|
|
217
|
+
top = rect.top - menuHeight - offset;
|
|
223
218
|
}
|
|
224
219
|
if (top < offset) {
|
|
225
220
|
top = offset;
|
|
226
221
|
}
|
|
227
|
-
if (left +
|
|
228
|
-
left = Math.max(offset, window.innerWidth -
|
|
222
|
+
if (left + menuWidth > window.innerWidth - offset) {
|
|
223
|
+
left = Math.max(offset, window.innerWidth - menuWidth - offset);
|
|
229
224
|
}
|
|
230
225
|
if (left < offset) {
|
|
231
226
|
left = offset;
|