Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/data-table/src/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export default defineComponent({
scrollXRef: computed(() => props.scrollX),
rowsRef,
colsRef,
captionRef: toRef(props, 'caption'),
paginatedDataRef,
leftActiveFixedColKeyRef,
leftActiveFixedChildrenColKeysRef,
Expand Down
9 changes: 8 additions & 1 deletion src/data-table/src/TableParts/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function flatten(

const VirtualListItemWrapper = defineComponent({
props: {
caption: String,
clsPrefix: {
type: String,
required: true
Expand All @@ -125,14 +126,15 @@ const VirtualListItemWrapper = defineComponent({
onMouseleave: Function as PropType<(e: MouseEvent) => void>
},
render() {
const { clsPrefix, id, cols, onMouseenter, onMouseleave } = this
const { caption, clsPrefix, id, cols, onMouseenter, onMouseleave } = this
return (
<table
style={{ tableLayout: 'fixed' }}
class={`${clsPrefix}-data-table-table`}
onMouseenter={onMouseenter}
onMouseleave={onMouseleave}
>
{caption ? <caption>{caption}</caption> : null}
<colgroup>
{cols.map(col => (
<col key={col.key} style={col.style}></col>
Expand Down Expand Up @@ -202,6 +204,7 @@ export default defineComponent({
handleTableBodyScroll,
doCheck,
doUncheck,
captionRef,
renderCell
} = inject(dataTableInjectionKey)!
const NConfigProvider = inject(configProviderInjectionKey)
Expand Down Expand Up @@ -526,6 +529,7 @@ export default defineComponent({
handleRadioUpdateChecked,
handleUpdateExpanded,
renderCell,
caption: captionRef,
...exposedMethods
}
},
Expand Down Expand Up @@ -584,6 +588,7 @@ export default defineComponent({
// coordinate to related hover keys
const cordKey: Record<number, Record<number, RowKey[]>> = {}
const {
caption,
cols,
paginatedDataAndInfo,
mergedTheme,
Expand Down Expand Up @@ -1043,6 +1048,7 @@ export default defineComponent({
tableLayout: this.mergedTableLayout
}}
>
{caption ? <caption>{caption}</caption> : null}
<colgroup>
{cols.map(col => (
<col key={col.key} style={col.style}></col>
Expand Down Expand Up @@ -1080,6 +1086,7 @@ export default defineComponent({
itemSize={this.minRowHeight}
visibleItemsTag={VirtualListItemWrapper}
visibleItemsProps={{
caption,
clsPrefix: mergedClsPrefix,
id: componentId,
cols,
Expand Down
Loading
Loading