Skip to content

Commit 7c73beb

Browse files
authored
fix: fixed an error caused by dragging under the headerCell slot. (#7291)
* fix: fix headerCell slots * perf: optimize table columnTitle type
1 parent 0cbf3ca commit 7c73beb

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Diff for: components/table/hooks/useColumns.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import devWarning from '../../vc-util/devWarning';
2-
import { renderSlot } from 'vue';
32
import type { Ref } from 'vue';
43
import type { ContextSlots } from '../context';
54
import type { TransformColumns, ColumnsType } from '../interface';
65
import { SELECTION_COLUMN } from './useSelection';
76
import { EXPAND_COLUMN } from '../../vc-table';
7+
import { customRenderSlot } from '../../_util/vnode';
88

99
function fillSlots<RecordType>(columns: ColumnsType<RecordType>, contextSlots: Ref<ContextSlots>) {
1010
const $slots = contextSlots.value;
@@ -27,7 +27,7 @@ function fillSlots<RecordType>(columns: ColumnsType<RecordType>, contextSlots: R
2727
});
2828

2929
if (contextSlots.value.headerCell && !column.slots?.title) {
30-
cloneColumn.title = renderSlot(
30+
cloneColumn.title = customRenderSlot(
3131
contextSlots.value,
3232
'headerCell',
3333
{

Diff for: components/table/interface.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type { Breakpoint } from '../_util/responsiveObserve';
1313
import type { INTERNAL_SELECTION_ITEM } from './hooks/useSelection';
1414
import type { VueNode } from '../_util/type';
1515
import { tuple } from '../_util/type';
16-
import type { CSSProperties } from 'vue';
16+
import type { CSSProperties, VNodeArrayChildren } from 'vue';
1717
// import { TableAction } from './Table';
1818

1919
export type { GetRowKey, ExpandableConfig };
@@ -68,7 +68,10 @@ export interface ColumnTitleProps<RecordType> {
6868
filters?: Record<string, FilterValue>;
6969
}
7070

71-
export type ColumnTitle<RecordType> = VueNode | ((props: ColumnTitleProps<RecordType>) => VueNode);
71+
type ColumnTitleNode = VueNode | VNodeArrayChildren;
72+
export type ColumnTitle<RecordType> =
73+
| ColumnTitleNode
74+
| ((props: ColumnTitleProps<RecordType>) => ColumnTitleNode);
7275

7376
export type FilterValue = (Key | boolean)[];
7477
export type FilterKey = Key[] | null;

0 commit comments

Comments
 (0)