@tplc/wot
Version:
70 lines (65 loc) • 1.63 kB
text/typescript
/*
* @Author: weisheng
* @Date: 2024-03-15 11:36:12
* @LastEditTime: 2024-07-18 19:02:32
* @LastEditors: weisheng
* @Description:
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-table\types.ts
* 记得注释
*/
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue'
import {
baseProps,
makeBooleanProp,
makeNumberProp,
makeRequiredProp,
makeStringProp,
} from '../common/props'
import type { TableColumnProps } from '../wd-table-col/types'
export const tableProps = {
...baseProps,
/**
* 显示的数据
*/
data: makeRequiredProp(Array<Record<string, any>>),
/**
* 是否带有边框
*/
border: makeBooleanProp(true),
/**
* 是否为斑马纹 table
*/
stripe: makeBooleanProp(true),
/**
* Table 的高度
*/
height: makeStringProp('80vh'),
/**
* 行高
*/
rowHeight: makeNumberProp(50),
/**
* 是否显示表头
*/
showHeader: makeBooleanProp(true),
/**
* 是否超出2行隐藏
*/
ellipsis: makeBooleanProp(true),
/**
* 是否显示索引列
*/
index: {
type: [Object, Boolean] as PropType<boolean | Omit<Partial<TableColumnProps>, 'prop'>>,
default: false,
},
}
export type TableProps = ExtractPropTypes<typeof tableProps>
export type TableProvide = {
props: Omit<TableProps, 'index' | 'customStyle' | 'customClass'>
scrollLeft: number
rowClick: (index: number) => void
getIsLastFixed: (column: { fixed: boolean; prop: string }) => boolean
getFixedStyle: (index: number, style: CSSProperties) => CSSProperties
}
export const TABLE_KEY: symbol = Symbol('wd-table')