fix: fixed an error caused by dragging under the `headerCell` slot. (#7291)
* fix: fix headerCell slots * perf: optimize table columnTitle typepull/7335/head
parent
0cbf3ca354
commit
7c73beb309
|
@ -1,10 +1,10 @@
|
||||||
import devWarning from '../../vc-util/devWarning';
|
import devWarning from '../../vc-util/devWarning';
|
||||||
import { renderSlot } from 'vue';
|
|
||||||
import type { Ref } from 'vue';
|
import type { Ref } from 'vue';
|
||||||
import type { ContextSlots } from '../context';
|
import type { ContextSlots } from '../context';
|
||||||
import type { TransformColumns, ColumnsType } from '../interface';
|
import type { TransformColumns, ColumnsType } from '../interface';
|
||||||
import { SELECTION_COLUMN } from './useSelection';
|
import { SELECTION_COLUMN } from './useSelection';
|
||||||
import { EXPAND_COLUMN } from '../../vc-table';
|
import { EXPAND_COLUMN } from '../../vc-table';
|
||||||
|
import { customRenderSlot } from '../../_util/vnode';
|
||||||
|
|
||||||
function fillSlots<RecordType>(columns: ColumnsType<RecordType>, contextSlots: Ref<ContextSlots>) {
|
function fillSlots<RecordType>(columns: ColumnsType<RecordType>, contextSlots: Ref<ContextSlots>) {
|
||||||
const $slots = contextSlots.value;
|
const $slots = contextSlots.value;
|
||||||
|
@ -27,7 +27,7 @@ function fillSlots<RecordType>(columns: ColumnsType<RecordType>, contextSlots: R
|
||||||
});
|
});
|
||||||
|
|
||||||
if (contextSlots.value.headerCell && !column.slots?.title) {
|
if (contextSlots.value.headerCell && !column.slots?.title) {
|
||||||
cloneColumn.title = renderSlot(
|
cloneColumn.title = customRenderSlot(
|
||||||
contextSlots.value,
|
contextSlots.value,
|
||||||
'headerCell',
|
'headerCell',
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ import type { Breakpoint } from '../_util/responsiveObserve';
|
||||||
import type { INTERNAL_SELECTION_ITEM } from './hooks/useSelection';
|
import type { INTERNAL_SELECTION_ITEM } from './hooks/useSelection';
|
||||||
import type { VueNode } from '../_util/type';
|
import type { VueNode } from '../_util/type';
|
||||||
import { tuple } from '../_util/type';
|
import { tuple } from '../_util/type';
|
||||||
import type { CSSProperties } from 'vue';
|
import type { CSSProperties, VNodeArrayChildren } from 'vue';
|
||||||
// import { TableAction } from './Table';
|
// import { TableAction } from './Table';
|
||||||
|
|
||||||
export type { GetRowKey, ExpandableConfig };
|
export type { GetRowKey, ExpandableConfig };
|
||||||
|
@ -68,7 +68,10 @@ export interface ColumnTitleProps<RecordType> {
|
||||||
filters?: Record<string, FilterValue>;
|
filters?: Record<string, FilterValue>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ColumnTitle<RecordType> = VueNode | ((props: ColumnTitleProps<RecordType>) => VueNode);
|
type ColumnTitleNode = VueNode | VNodeArrayChildren;
|
||||||
|
export type ColumnTitle<RecordType> =
|
||||||
|
| ColumnTitleNode
|
||||||
|
| ((props: ColumnTitleProps<RecordType>) => ColumnTitleNode);
|
||||||
|
|
||||||
export type FilterValue = (Key | boolean)[];
|
export type FilterValue = (Key | boolean)[];
|
||||||
export type FilterKey = Key[] | null;
|
export type FilterKey = Key[] | null;
|
||||||
|
|
Loading…
Reference in New Issue