From 8bd7e9cbd999be5180cd24226a9a8f8d2c862af6 Mon Sep 17 00:00:00 2001 From: AI Engineer Date: Mon, 25 May 2026 12:28:19 +0800 Subject: [PATCH] fix(ui): prevent column menu from overflowing screen boundaries --- src/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 664a7bf..e19f7f5 100644 --- a/src/index.js +++ b/src/index.js @@ -121,7 +121,10 @@ Component.register('DataTable', container => { state.activeField = field; state.activeFieldId = field.id; menu.style.display = 'block'; const rect = btn.getBoundingClientRect(), rootRect = container.getBoundingClientRect(); - menu.style.left = (rect.right - rootRect.left - (menu.offsetWidth || 260)) + 'px'; + const menuWidth = menu.offsetWidth || 260; + let leftPos = rect.right - rootRect.left - menuWidth; + if (leftPos < 0) leftPos = Math.max(0, rect.left - rootRect.left); + menu.style.left = leftPos + 'px'; menu.style.top = (rect.bottom - rootRect.top + 5) + 'px'; const onGlobalClick = (ev) => {