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.
@@ -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
- if (!menuRect) {
217
- return;
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 - menuRect.width : rect.left;
221
- if (top + menuRect.height > window.innerHeight) {
222
- top = rect.top - menuRect.height - offset;
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 + menuRect.width > window.innerWidth - offset) {
228
- left = Math.max(offset, window.innerWidth - menuRect.width - offset);
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;