fix: fixed an error caused by dragging under the `headerCell` slot. (#7291)

* fix: fix headerCell slots

* perf: optimize table columnTitle type
pull/7335/head
Carl Chen 2024-01-30 12:06:45 +08:00 committed by GitHub
parent 0cbf3ca354
commit 7c73beb309
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View File

@ -1,10 +1,10 @@
import devWarning from '../../vc-util/devWarning';
import { renderSlot } from 'vue';
import type { Ref } from 'vue';
import type { ContextSlots } from '../context';
import type { TransformColumns, ColumnsType } from '../interface';
import { SELECTION_COLUMN } from './useSelection';
import { EXPAND_COLUMN } from '../../vc-table';
import { customRenderSlot } from '../../_util/vnode';
function fillSlots<RecordType>(columns: ColumnsType<RecordType>, contextSlots: Ref<ContextSlots>) {
const $slots = contextSlots.value;
@ -27,7 +27,7 @@ function fillSlots<RecordType>(columns: ColumnsType<RecordType>, contextSlots: R
});
if (contextSlots.value.headerCell && !column.slots?.title) {
cloneColumn.title = renderSlot(
cloneColumn.title = customRenderSlot(
contextSlots.value,
'headerCell',
{

View File

@ -13,7 +13,7 @@ import type { Breakpoint } from '../_util/responsiveObserve';
import type { INTERNAL_SELECTION_ITEM } from './hooks/useSelection';
import type { VueNode } from '../_util/type';
import { tuple } from '../_util/type';
import type { CSSProperties } from 'vue';
import type { CSSProperties, VNodeArrayChildren } from 'vue';
// import { TableAction } from './Table';
export type { GetRowKey, ExpandableConfig };
@ -68,7 +68,10 @@ export interface ColumnTitleProps<RecordType> {
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 FilterKey = Key[] | null;