2022-04-10 14:05:12 +08:00
|
|
|
import { buildProps, definePropType } from '@element-plus/utils'
|
2022-04-18 15:53:03 +08:00
|
|
|
import {
|
|
|
|
virtualizedGridProps,
|
|
|
|
virtualizedListProps,
|
|
|
|
} from '@element-plus/components/virtual-list'
|
2022-04-10 14:05:12 +08:00
|
|
|
import {
|
|
|
|
classType,
|
|
|
|
columns,
|
|
|
|
dataType,
|
|
|
|
fixedDataType,
|
|
|
|
requiredNumber,
|
|
|
|
styleType,
|
|
|
|
} from './common'
|
|
|
|
import { tableV2HeaderProps } from './header'
|
|
|
|
import { tableV2RowProps } from './row'
|
|
|
|
|
|
|
|
import type { ExtractPropTypes } from 'vue'
|
|
|
|
|
2022-04-13 15:24:17 +08:00
|
|
|
export type onRowRenderedParams = {
|
|
|
|
rowCacheStart: number
|
|
|
|
rowCacheEnd: number
|
|
|
|
rowVisibleStart: number
|
|
|
|
rowVisibleEnd: number
|
|
|
|
}
|
|
|
|
|
2022-04-10 14:05:12 +08:00
|
|
|
export const tableV2GridProps = buildProps({
|
|
|
|
columns,
|
|
|
|
data: dataType,
|
|
|
|
fixedData: fixedDataType,
|
|
|
|
estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Size related attributes
|
|
|
|
*/
|
|
|
|
width: requiredNumber,
|
|
|
|
height: requiredNumber,
|
|
|
|
|
|
|
|
headerWidth: requiredNumber,
|
|
|
|
headerHeight: tableV2HeaderProps.headerHeight,
|
|
|
|
|
|
|
|
bodyWidth: requiredNumber,
|
|
|
|
rowHeight: requiredNumber,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Special attributes
|
|
|
|
*/
|
|
|
|
cache: virtualizedListProps.cache,
|
|
|
|
useIsScrolling: Boolean,
|
2022-04-18 15:53:03 +08:00
|
|
|
scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
|
|
|
|
scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
|
|
|
|
scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
|
2022-04-10 14:05:12 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* CSS attributes
|
|
|
|
*/
|
|
|
|
class: classType,
|
|
|
|
style: styleType,
|
|
|
|
containerStyle: styleType,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Event handlers
|
|
|
|
*/
|
2022-04-13 22:21:47 +08:00
|
|
|
onRowsRendered: {
|
2022-04-13 15:24:17 +08:00
|
|
|
type: definePropType<(params: onRowRenderedParams) => void>(Function),
|
2022-04-10 14:05:12 +08:00
|
|
|
},
|
|
|
|
onScroll: {
|
|
|
|
type: definePropType<(...args: any[]) => void>(Function),
|
|
|
|
},
|
|
|
|
} as const)
|
|
|
|
|
|
|
|
export type TableV2GridProps = ExtractPropTypes<typeof tableV2GridProps>
|