diff --git a/apps/web/src/components/DataAccessEditor.vue b/apps/web/src/components/DataAccessEditor.vue index ea166e9..b415694 100644 --- a/apps/web/src/components/DataAccessEditor.vue +++ b/apps/web/src/components/DataAccessEditor.vue @@ -1,17 +1,6 @@ + + diff --git a/apps/web/src/components/DataAccessPolicyPanel.vue b/apps/web/src/components/DataAccessPolicyPanel.vue index ca1409d..831e8e8 100644 --- a/apps/web/src/components/DataAccessPolicyPanel.vue +++ b/apps/web/src/components/DataAccessPolicyPanel.vue @@ -1,15 +1,5 @@ + + diff --git a/apps/web/src/components/JalaliDateInput.vue b/apps/web/src/components/JalaliDateInput.vue index 19ab228..6b165f6 100644 --- a/apps/web/src/components/JalaliDateInput.vue +++ b/apps/web/src/components/JalaliDateInput.vue @@ -6,7 +6,7 @@ import { ClockCircleOutlined, LeftOutlined, RightOutlined, -} from '@/icons/ant-bridge'; +} from '@ant-design/icons-vue'; import { addJalaliMonths, dateToJalali, @@ -58,6 +58,8 @@ const hourColRef = ref(null); const minuteColRef = ref(null); const top = ref(0); const left = ref(0); +/** بالای مودال Ant (حدود ۱۰۰۰) تا تقویم پشت پنجره نماند */ +const popupZ = ref(120); const todayJ = dateToJalali(new Date()); const cursor = ref<{ jy: number; jm: number }>({ jy: todayJ.jy, jm: todayJ.jm }); const draftHour = ref(9); @@ -325,16 +327,32 @@ function place() { const panel = panelRef.value; if (!trigger) return; const rect = trigger.getBoundingClientRect(); - const width = panel?.offsetWidth || (props.mode === 'time' ? (isMobile.value ? 340 : 280) : 320); - const height = panel?.offsetHeight || (props.mode === 'time' ? (isMobile.value ? 460 : 320) : 360); + const width = + panel?.offsetWidth || + (props.mode === 'time' ? (isMobile.value ? 340 : 280) : 328); + const height = + panel?.offsetHeight || + (props.mode === 'time' ? (isMobile.value ? 460 : 320) : 340); + const margin = 8; let nextLeft = rect.left; if (getComputedStyle(document.documentElement).direction === 'rtl') { nextLeft = rect.right - width; } - nextLeft = Math.min(Math.max(8, nextLeft), window.innerWidth - width - 8); - let nextTop = rect.bottom + 8; - if (nextTop + height > window.innerHeight - 8) { - nextTop = Math.max(8, rect.top - height - 8); + nextLeft = Math.min( + Math.max(margin, nextLeft), + Math.max(margin, window.innerWidth - width - margin), + ); + const spaceBelow = window.innerHeight - rect.bottom - margin * 2; + const spaceAbove = rect.top - margin * 2; + let nextTop: number; + if (height <= spaceBelow) { + nextTop = rect.bottom + margin; + } else if (height <= spaceAbove) { + nextTop = rect.top - height - margin; + } else if (spaceBelow >= spaceAbove) { + nextTop = Math.max(margin, window.innerHeight - height - margin); + } else { + nextTop = margin; } left.value = nextLeft; top.value = nextTop; @@ -360,6 +378,7 @@ async function show() { calView.value = props.startView; clockFace.value = 'hour'; syncViewport(); + liftAboveOverlays(); open.value = true; await nextTick(); place(); @@ -554,7 +573,7 @@ onBeforeUnmount(() => { 'is-desktop': !isMobile, }" role="dialog" - :style="{ top: `${top}px`, left: `${left}px` }" + :style="{ top: `${top}px`, left: `${left}px`, zIndex: popupZ }" >