mirror of
https://github.com/vbenjs/gf-vben-admin.git
synced 2025-01-24 04:10:20 +08:00
fix(table): fix tableSettings popup in fullscreen mode
修复全屏模式下的表格设置组件的弹出层配置
This commit is contained in:
parent
a5a9b3fb34
commit
dce3fb0f20
@ -8,6 +8,7 @@
|
|||||||
trigger="click"
|
trigger="click"
|
||||||
@visibleChange="handleVisibleChange"
|
@visibleChange="handleVisibleChange"
|
||||||
:overlayClassName="`${prefixCls}__cloumn-list`"
|
:overlayClassName="`${prefixCls}__cloumn-list`"
|
||||||
|
:getPopupContainer="getPopupContainer"
|
||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<div :class="`${prefixCls}__popover-title`">
|
<div :class="`${prefixCls}__popover-title`">
|
||||||
@ -47,7 +48,11 @@
|
|||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
|
|
||||||
<Tooltip placement="bottomLeft" :mouseLeaveDelay="0.4">
|
<Tooltip
|
||||||
|
placement="bottomLeft"
|
||||||
|
:mouseLeaveDelay="0.4"
|
||||||
|
:getPopupContainer="getPopupContainer"
|
||||||
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
{{ t('component.table.settingFixedLeft') }}
|
{{ t('component.table.settingFixedLeft') }}
|
||||||
</template>
|
</template>
|
||||||
@ -64,7 +69,11 @@
|
|||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Divider type="vertical" />
|
<Divider type="vertical" />
|
||||||
<Tooltip placement="bottomLeft" :mouseLeaveDelay="0.4">
|
<Tooltip
|
||||||
|
placement="bottomLeft"
|
||||||
|
:mouseLeaveDelay="0.4"
|
||||||
|
:getPopupContainer="getPopupContainer"
|
||||||
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
{{ t('component.table.settingFixedRight') }}
|
{{ t('component.table.settingFixedRight') }}
|
||||||
</template>
|
</template>
|
||||||
@ -109,8 +118,8 @@
|
|||||||
import { useTableContext } from '../../hooks/useTableContext';
|
import { useTableContext } from '../../hooks/useTableContext';
|
||||||
import { useDesign } from '/@/hooks/web/useDesign';
|
import { useDesign } from '/@/hooks/web/useDesign';
|
||||||
import { useSortable } from '/@/hooks/web/useSortable';
|
import { useSortable } from '/@/hooks/web/useSortable';
|
||||||
import { isNullAndUnDef } from '/@/utils/is';
|
import { isFunction, isNullAndUnDef } from '/@/utils/is';
|
||||||
import { getPopupContainer } from '/@/utils';
|
import { getPopupContainer as getParentContainer } from '/@/utils';
|
||||||
import { omit } from 'lodash-es';
|
import { omit } from 'lodash-es';
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
@ -140,7 +149,7 @@
|
|||||||
},
|
},
|
||||||
emits: ['columns-change'],
|
emits: ['columns-change'],
|
||||||
|
|
||||||
setup(_, { emit }) {
|
setup(_, { emit, attrs }) {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const table = useTableContext();
|
const table = useTableContext();
|
||||||
|
|
||||||
@ -350,6 +359,12 @@
|
|||||||
emit('columns-change', data);
|
emit('columns-change', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPopupContainer() {
|
||||||
|
return isFunction(attrs.getPopupContainer)
|
||||||
|
? attrs.getPopupContainer()
|
||||||
|
: getParentContainer();
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
t,
|
t,
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
|
@ -1,20 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="table-settings">
|
<div class="table-settings">
|
||||||
<RedoSetting v-if="getSetting.redo" />
|
<RedoSetting v-if="getSetting.redo" :getPopupContainer="getTableContainer" />
|
||||||
<SizeSetting v-if="getSetting.size" />
|
<SizeSetting v-if="getSetting.size" :getPopupContainer="getTableContainer" />
|
||||||
<ColumnSetting v-if="getSetting.setting" @columns-change="handleColumnChange" />
|
<ColumnSetting
|
||||||
<FullScreenSetting v-if="getSetting.fullScreen" />
|
v-if="getSetting.setting"
|
||||||
|
@columns-change="handleColumnChange"
|
||||||
|
:getPopupContainer="getTableContainer"
|
||||||
|
/>
|
||||||
|
<FullScreenSetting v-if="getSetting.fullScreen" :getPopupContainer="getTableContainer" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PropType } from 'vue';
|
import type { PropType } from 'vue';
|
||||||
import type { TableSetting, ColumnChangeParam } from '../../types/table';
|
import type { TableSetting, ColumnChangeParam } from '../../types/table';
|
||||||
import { defineComponent, computed } from 'vue';
|
import { defineComponent, computed, unref } from 'vue';
|
||||||
import ColumnSetting from './ColumnSetting.vue';
|
import ColumnSetting from './ColumnSetting.vue';
|
||||||
import SizeSetting from './SizeSetting.vue';
|
import SizeSetting from './SizeSetting.vue';
|
||||||
import RedoSetting from './RedoSetting.vue';
|
import RedoSetting from './RedoSetting.vue';
|
||||||
import FullScreenSetting from './FullScreenSetting.vue';
|
import FullScreenSetting from './FullScreenSetting.vue';
|
||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
|
import { useTableContext } from '../../hooks/useTableContext';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'TableSetting',
|
name: 'TableSetting',
|
||||||
@ -33,6 +38,7 @@
|
|||||||
emits: ['columns-change'],
|
emits: ['columns-change'],
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const table = useTableContext();
|
||||||
|
|
||||||
const getSetting = computed((): TableSetting => {
|
const getSetting = computed((): TableSetting => {
|
||||||
return {
|
return {
|
||||||
@ -48,7 +54,11 @@
|
|||||||
emit('columns-change', data);
|
emit('columns-change', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { getSetting, t, handleColumnChange };
|
function getTableContainer() {
|
||||||
|
return table ? unref(table.wrapRef) : document.body;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { getSetting, t, handleColumnChange, getTableContainer };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user