fix(leads): keep the filter panel from shifting the page
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -360,7 +360,7 @@ function place() {
|
|||||||
|
|
||||||
function liftAboveOverlays() {
|
function liftAboveOverlays() {
|
||||||
let z = 120;
|
let z = 120;
|
||||||
for (const el of document.querySelectorAll('.ant-modal-wrap, .ant-drawer, .ant-popover')) {
|
for (const el of document.querySelectorAll('.ant-modal-wrap, .ant-drawer, .ant-popover, [data-lead-filter]')) {
|
||||||
const zi = Number.parseInt(window.getComputedStyle(el).zIndex, 10);
|
const zi = Number.parseInt(window.getComputedStyle(el).zIndex, 10);
|
||||||
if (Number.isFinite(zi)) z = Math.max(z, zi + 20);
|
if (Number.isFinite(zi)) z = Math.max(z, zi + 20);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import {
|
|||||||
Modal,
|
Modal,
|
||||||
Modal as AModal,
|
Modal as AModal,
|
||||||
Pagination as APagination,
|
Pagination as APagination,
|
||||||
Popover as APopover,
|
|
||||||
RadioButton as ARadioButton,
|
RadioButton as ARadioButton,
|
||||||
RadioGroup as ARadioGroup,
|
RadioGroup as ARadioGroup,
|
||||||
Row as ARow,
|
Row as ARow,
|
||||||
@@ -340,6 +339,20 @@ function toggleFilterSection(name: NonNullable<typeof filterSection.value>) {
|
|||||||
const filterAnchor = ref<HTMLElement | null>(null);
|
const filterAnchor = ref<HTMLElement | null>(null);
|
||||||
const filterPopoverMaxHeight = ref('min(70vh, 32rem)');
|
const filterPopoverMaxHeight = ref('min(70vh, 32rem)');
|
||||||
|
|
||||||
|
const filterPanelStyle = computed(() => ({
|
||||||
|
position: 'absolute' as const,
|
||||||
|
top: 'calc(100% + 6px)',
|
||||||
|
insetInlineStart: '0',
|
||||||
|
zIndex: 1050,
|
||||||
|
width: 'min(20rem, calc(100vw - 1.5rem))',
|
||||||
|
maxHeight: filterPopoverMaxHeight.value,
|
||||||
|
overflow: 'auto',
|
||||||
|
background: token.value.colorBgElevated,
|
||||||
|
borderRadius: `${token.value.borderRadiusLG}px`,
|
||||||
|
boxShadow: token.value.boxShadowSecondary,
|
||||||
|
padding: `${token.value.paddingSM}px`,
|
||||||
|
}));
|
||||||
|
|
||||||
function placeFilterPopover() {
|
function placeFilterPopover() {
|
||||||
const el = filterAnchor.value;
|
const el = filterAnchor.value;
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
@@ -347,18 +360,26 @@ function placeFilterPopover() {
|
|||||||
filterPopoverMaxHeight.value = `${Math.max(220, space)}px`;
|
filterPopoverMaxHeight.value = `${Math.max(220, space)}px`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFilterPopover(open: boolean) {
|
function onFilterDocPointer(event: Event) {
|
||||||
if (!open && document.getElementById('jalali-picker')) return;
|
const target = event.target;
|
||||||
if (open) placeFilterPopover();
|
if (!(target instanceof Node)) return;
|
||||||
moreFiltersOpen.value = open;
|
if (filterAnchor.value?.contains(target)) return;
|
||||||
if (open) {
|
if (document.getElementById('jalali-picker')?.contains(target)) return;
|
||||||
window.addEventListener('resize', placeFilterPopover);
|
moreFiltersOpen.value = false;
|
||||||
window.addEventListener('scroll', placeFilterPopover, true);
|
filterSection.value = null;
|
||||||
} else {
|
document.removeEventListener('pointerdown', onFilterDocPointer, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleFilterPopover() {
|
||||||
|
if (moreFiltersOpen.value) {
|
||||||
|
moreFiltersOpen.value = false;
|
||||||
filterSection.value = null;
|
filterSection.value = null;
|
||||||
window.removeEventListener('resize', placeFilterPopover);
|
document.removeEventListener('pointerdown', onFilterDocPointer, true);
|
||||||
window.removeEventListener('scroll', placeFilterPopover, true);
|
return;
|
||||||
}
|
}
|
||||||
|
placeFilterPopover();
|
||||||
|
moreFiltersOpen.value = true;
|
||||||
|
document.addEventListener('pointerdown', onFilterDocPointer, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dateFacetLabel(value: string) {
|
function dateFacetLabel(value: string) {
|
||||||
@@ -1531,13 +1552,12 @@ onMounted(async () => {
|
|||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
stopImportPoll();
|
stopImportPoll();
|
||||||
revokeLogoUrls();
|
revokeLogoUrls();
|
||||||
window.removeEventListener('resize', placeFilterPopover);
|
document.removeEventListener('pointerdown', onFilterDocPointer, true);
|
||||||
window.removeEventListener('scroll', placeFilterPopover, true);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<a-row :gutter="[16, 16]" @click="closePopups">
|
<a-row :gutter="[16, 16]" align="top" :style="{ alignContent: 'flex-start' }" @click="closePopups">
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-flex justify="space-between" align="center" wrap="wrap" :gap="token.marginSM">
|
<a-flex justify="space-between" align="center" wrap="wrap" :gap="token.marginSM">
|
||||||
<a-typography-title :level="3" :style="{ margin: 0 }">لیدها</a-typography-title>
|
<a-typography-title :level="3" :style="{ margin: 0 }">لیدها</a-typography-title>
|
||||||
@@ -1712,38 +1732,29 @@ onBeforeUnmount(() => {
|
|||||||
</a-button>
|
</a-button>
|
||||||
</template>
|
</template>
|
||||||
</a-input-search>
|
</a-input-search>
|
||||||
<div ref="filterAnchor" :style="isMobile ? { width: '100%' } : undefined">
|
<div
|
||||||
<a-popover
|
ref="filterAnchor"
|
||||||
:open="moreFiltersOpen"
|
:style="{ position: 'relative', width: isMobile ? '100%' : undefined }"
|
||||||
trigger="click"
|
>
|
||||||
placement="bottomRight"
|
<a-button
|
||||||
:arrow="false"
|
:block="isMobile"
|
||||||
:auto-adjust-overflow="false"
|
:style="mobileFilterBadgeCount
|
||||||
:overlay-inner-style="{
|
? {
|
||||||
width: 'min(20rem, calc(100vw - 1.5rem))',
|
borderColor: token.colorPrimary,
|
||||||
maxHeight: filterPopoverMaxHeight,
|
color: token.colorPrimary,
|
||||||
overflow: 'auto',
|
background: token.colorPrimaryBg,
|
||||||
}"
|
}
|
||||||
@open-change="onFilterPopover"
|
: undefined"
|
||||||
|
@click.stop="toggleFilterPopover"
|
||||||
>
|
>
|
||||||
<a-button
|
<a-flex align="center" justify="center" :gap="6">
|
||||||
:block="isMobile"
|
<FilterOutlined />
|
||||||
:style="mobileFilterBadgeCount
|
<span>{{ filterBtnLabel }}</span>
|
||||||
? {
|
<DownOutlined />
|
||||||
borderColor: token.colorPrimary,
|
</a-flex>
|
||||||
color: token.colorPrimary,
|
</a-button>
|
||||||
background: token.colorPrimaryBg,
|
<div v-if="moreFiltersOpen" data-lead-filter :style="filterPanelStyle" @click.stop>
|
||||||
}
|
<a-flex vertical :gap="10">
|
||||||
: undefined"
|
|
||||||
>
|
|
||||||
<a-flex align="center" justify="center" :gap="6">
|
|
||||||
<FilterOutlined />
|
|
||||||
<span>{{ filterBtnLabel }}</span>
|
|
||||||
<DownOutlined />
|
|
||||||
</a-flex>
|
|
||||||
</a-button>
|
|
||||||
<template #content>
|
|
||||||
<a-flex vertical :gap="10" @click.stop>
|
|
||||||
<div v-for="facet in textFacets" :key="facet.key">
|
<div v-for="facet in textFacets" :key="facet.key">
|
||||||
<div
|
<div
|
||||||
role="button"
|
role="button"
|
||||||
@@ -1926,8 +1937,7 @@ onBeforeUnmount(() => {
|
|||||||
پاک کردن فیلترها
|
پاک کردن فیلترها
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-flex>
|
</a-flex>
|
||||||
</template>
|
</div>
|
||||||
</a-popover>
|
|
||||||
</div>
|
</div>
|
||||||
<a-select
|
<a-select
|
||||||
:value="sort"
|
:value="sort"
|
||||||
|
|||||||
Reference in New Issue
Block a user