Skip to content

Commit

Permalink
docs(data-table): virtual scroll x related props
Browse files Browse the repository at this point in the history
  • Loading branch information
07akioni committed Sep 24, 2024
1 parent 442228e commit 3045265
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
7 changes: 6 additions & 1 deletion src/data-table/demos/enUS/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ export-csv.vue
| expanded-row-keys | `Array<string \| number>` | `undefined` | Expanded row keys. | |
| filter-icon-popover-props | `PopoverProps` | `{ trigger: click, placement: bottom }` | Filter icon's Popover attribute of the button, See [Popover props](popover#Popover-Props) | 2.39.0 |
| flex-height | `boolean` | `false` | Whether to make table body's height auto fit table area height. Make it enabled will make `table-layout` always set to `'fixed'`. | |
| header-height | `number` | `28` | Header height value when `virtual-scroll-header` is enabled. | NEXT_VERSION |
| height-for-row | `(rowData: object, index: number) => number` | `undefined` | Height configuration function for each row of the table. It must be used with `virtual-scroll-x`. If it's not configured, each rows height would be set to `min-row-height`. | NEXT_VERSION |
| indent | `number` | `16` | Indent of row content when using tree data. | |
| loading | `boolean` | `false` | Whether to display loading status. | |
| max-height | `number \| string` | `undefined` | The max-height of the table content. Can be a CSS value. | |
| min-height | `number \| string` | `undefined` | The min-height of the table content. Can be a CSS value. | |
| min-row-height | `number` | `28` | Min row height of the table when `virtual-scroll` or `virtual-scroll-x` is enabled. Each row's height must be larger than its value. | NEXT_VERSION |
| paginate-single-page | `boolean` | `true` | Whether show pagination data is less than one page. | 2.28.0 |
| pagination | `false \| object` | `false` | See [Pagination props](pagination#Pagination-Props) | |
| pagination-behavior-on-filter | `'first' \| 'current'` | `'current'` | The behavior of pagination after filter state is changed. `'first'` means returning to first page on filter, `'current'` means keep at current page on filter. | 2.28.3 |
Expand All @@ -106,7 +109,9 @@ export-csv.vue
| summary | `DataTableCreateSummary` | `undefined` | Data of table summary row. For types, see <n-a href="#DataTableCreateSummary-Type">DataTableCreateSummary Type</n-a>. | |
| summary-placement | `'top' \| 'bottom'` | `'bottom'` | Summary rows placement. | 2.33.3 |
| table-layout | `'auto' \| 'fixed'` | `'auto'` | Style `table-layout` of the table. When `ellipsis` or `max-height` or `flex-height` are set, it will always be `'fixed'` regardless of what you set. | |
| virtual-scroll | `boolean` | `false` | Whether to use virtual scroll to deal with large data. Make sure `max-height` is set before using it. When `virtual-scroll` is `true`, `rowSpan` will not take effect. | |
| virtual-scroll | `boolean` | `false` | Whether to use virtual scrolling to deal with large data. Make sure `max-height` is set before using it. When `virtual-scroll` is `true`, `rowSpan` will not take effect. | |
| virtual-scroll-header | `boolean` | `false` | Whether to use virtual scrolling in table header. If there are too many columns, you can enable the prop. You must configure `header-height` at the same time. Enabling the prop will disable header cells that cross columns & rows. | NEXT_VERSION |
| virtual-scroll-x | `boolean` | `false` | Whether to use horizontal virtual scrolling in table body. If there are too many columns, you can enable the prop. Enabling the prop will disable body cells that cross columns & rows. If the prop is enabled, every column should have `width` prop configured and `virtual-scroll`, `scroll-x`, `min-row-height`, `height-for-row`, `virtual-scroll-header` (optional), `header-height` (optional) props should be configured at the same time. You can refer to <n-a href="#virtual-x.vue">the example</n-a>. | NEXT_VERSION |
| on-load | `(rowData: object) => Promise<void>` | `undefined` | Callback of async tree data expanding. | 2.27.0 |
| on-scroll | `(e: Event) => void` | `undefined` | Callback of table body scrolling. | 2.29.1 |
| on-update:checked-row-keys | `(keys: Array<string \| number>, rows: object[], meta: { row: object \| undefined, action: 'check' \| 'uncheck' \| 'checkAll' \| 'uncheckAll' }) => void` | `undefined` | The callback function triggered when the checked-row-keys value changes. | `rows` 2.30.5, `meta` 2.33.4 |
Expand Down
7 changes: 6 additions & 1 deletion src/data-table/demos/zhCN/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,15 @@ rtl-debug.vue
| default-expanded-row-keys | `Array<string \| number>` | `[]` | 默认展开行的 key 值 | |
| default-expand-all | `boolean` | `false` | 是否默认展开全部可展开的行,不可在异步展开行时使用 | 2.30.4 |
| expanded-row-keys | `Array<string \| number>` | `undefined` | 展开行的 key 值 | |
| indent | `number` | `16` | 使用树形数据时行内容的缩进 | |
| filter-icon-popover-props | `PopoverProps` | `{ trigger: click, placement: bottom }` | 过滤按钮的 Popover 属性,属性参考 [Popover props](popover#Popover-Props) | 2.39.0 |
| flex-height | `boolean` | `false` | 是否让表格主体的高度自动适应整个表格区域的高度,打开这个选项会让 `table-layout` 始终为 `'fixed'` | |
| header-height | `number` | `28` | 在开启 `virtual-scroll-header` 属性的情况下,表头的高度 | NEXT_VERSION |
| height-for-row | `(rowData: object, index: number) => number` | `undefined` | 每行高度的配置函数,必须配合 `virtual-scroll-x` 使用,如果不进行配置,每一行的高度会被设为 `min-row-height` | NEXT_VERSION |
| indent | `number` | `16` | 使用树形数据时行内容的缩进 | |
| loading | `boolean` | `false` | 是否显示 loading 状态 | |
| max-height | `number \| string` | `undefined` | 表格内容的最大高度,可以是 CSS 属性值 | |
| min-height | `number \| string` | `undefined` | 表格内容的最低高度,可以是 CSS 属性值 | |
| min-row-height | `number` | `28` | 在开启 `virtual-scroll``virtual-scroll-x` 的情况下,每一行的最小高度,所有的行的高度必须比这个值更大 | NEXT_VERSION |
| paginate-single-page | `boolean` | `true` | 当表格数据只有一页时是否显示分页面 | 2.28.0 |
| pagination | `false \| object` | `false` | 属性参考 [Pagination props](pagination#Pagination-Props) | |
| pagination-behavior-on-filter | `'first' \| 'current'` | `'current'` | 过滤操作后页面的状态,`'first'` 为回到首页,`'current'` 为停留在当前页 | 2.28.3 |
Expand All @@ -118,6 +121,8 @@ rtl-debug.vue
| summary-placement | `'top' \| 'bottom'` | `'bottom'` | 总结栏的位置 | 2.33.3 |
| table-layout | `'auto' \| 'fixed'` | `'auto'` | 表格的 `table-layout` 样式属性,在设定 `ellipsis``max-height` 的情况下固定为 `'fixed'` | |
| virtual-scroll | `boolean` | `false` | 是否开启虚拟滚动,应对大规模数据,开启前请设定好 `max-height`。当 `virtual-scroll``true` 时,`rowSpan` 将不生效 | |
| virtual-scroll-header | `boolean` | `false` | 是否打开表头的虚拟滚动,如果横向列太多,可以考虑打开此属性,打开此属性会导致表头单元格跨行列的功能不可用,同时必须要配置 `header-height` | NEXT_VERSION |
| virtual-scroll-x | `boolean` | `false` | 是否打开表主体的横向虚拟滚动,如果横向列太多,可以考虑打开此属性,打开此属性会导致单元格跨行列的功能不可用,此属性开启时,必须要和 `virtual-scroll``scroll-x``min-row-height``height-for-row``virtual-scroll-header``header-height` 属性配合使用,同时每一列必须都配置 `width` 属性,你可以参考 <n-a href="#virtual-x.vue">完整的例子</n-a> | NEXT_VERSION |
| on-load | `(rowData: object) => Promise<void>` | `undefined` | 异步展开树形数据的回调 | 2.27.0 |
| on-scroll | `(e: Event) => void` | `undefined` | 表格主体滚动的回调 | 2.29.1 |
| on-update:checked-row-keys | `(keys: Array<string \| number>, rows: object[], meta: { row: object \| undefined, action: 'check' \| 'uncheck' \| 'checkAll' \| 'uncheckAll' }) => void` | `undefined` | checked-row-keys 值改变时触发的回调函数 | `rows` 2.30.5, `meta` 2.33.4 |
Expand Down
2 changes: 1 addition & 1 deletion src/data-table/src/TableParts/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ export default defineComponent({
<VirtualList
ref="virtualListRef"
items={displayedData}
itemSize={this.minRowHeight || 28}
itemSize={this.minRowHeight}
visibleItemsTag={VirtualListItemWrapper}
visibleItemsProps={{
clsPrefix: mergedClsPrefix,
Expand Down
2 changes: 1 addition & 1 deletion src/data-table/src/TableParts/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ export default defineComponent({
style={{ height: pxfy(headerHeight) }}
onScroll={this.handleTableHeaderScroll}
columns={cols}
itemSize={headerHeight || 28}
itemSize={headerHeight}
showScrollbar={false}
items={[{}]}
itemResizable={false}
Expand Down
8 changes: 4 additions & 4 deletions src/data-table/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ export const dataTableProps = {
virtualScroll: Boolean,
virtualScrollX: Boolean,
virtualScrollHeader: Boolean,
headerHeight: Number,
headerHeight: { type: Number, default: 28 },
heightForRow: Function as PropType<DataTableHeightForRow>,
minRowHeight: Number,
minRowHeight: { type: Number, default: 28 },
tableLayout: {
type: String as PropType<'auto' | 'fixed'>,
default: 'auto'
Expand Down Expand Up @@ -396,10 +396,10 @@ export interface DataTableInjection {
rawPaginatedDataRef: Ref<InternalRowData[]>
virtualScrollRef: Ref<boolean>
virtualScrollXRef: Ref<boolean>
minRowHeightRef: Ref<number | undefined>
minRowHeightRef: Ref<number>
heightForRowRef: Ref<DataTableHeightForRow | undefined>
virtualScrollHeaderRef: Ref<boolean>
headerHeightRef: Ref<number | undefined>
headerHeightRef: Ref<number>
bodyWidthRef: Ref<number | null>
mergedTableLayoutRef: Ref<'auto' | 'fixed'>
maxHeightRef: Ref<string | number | undefined>
Expand Down

0 comments on commit 3045265

Please sign in to comment.