You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
7.0 KiB
1 line
7.0 KiB
|
2 years ago
|
{"version":3,"file":"table.mjs","sources":["../../../../../../packages/components/table-v2/src/table.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-plus/utils'\nimport {\n virtualizedGridProps,\n virtualizedScrollbarProps,\n} from '@element-plus/components/virtual-list'\nimport {\n classType,\n columns,\n dataType,\n expandKeys,\n fixedDataType,\n requiredNumber,\n rowKey,\n} from './common'\nimport { tableV2RowProps } from './row'\nimport { tableV2HeaderProps } from './header'\nimport { tableV2GridProps } from './grid'\n\nimport type { CSSProperties, ExtractPropTypes } from 'vue'\nimport type { SortOrder } from './constants'\nimport type {\n Column,\n ColumnCommonParams,\n DataGetter,\n KeyType,\n RowCommonParams,\n SortBy,\n SortState,\n} from './types'\n\n/**\n * Param types\n */\nexport type ColumnSortParams<T> = {\n column: Column<T>\n key: KeyType\n order: SortOrder\n}\n\n/**\n * Renderer/Getter types\n */\n\nexport type ExtraCellPropGetter<T> = (\n params: ColumnCommonParams<T> &\n RowCommonParams & { cellData: T; rowData: any }\n) => any\n\nexport type ExtractHeaderPropGetter<T> = (params: {\n columns: Column<T>[]\n headerIndex: number\n}) => any\n\nexport type ExtractHeaderCellPropGetter<T> = (\n params: ColumnCommonParams<T> & { headerIndex: number }\n) => any\n\nexport type ExtractRowPropGetter<T> = (\n params: { columns: Column<T>[] } & RowCommonParams\n) => any\n\nexport type HeaderClassNameGetter<T> = (params: {\n columns: Column<T>[]\n headerIndex: number\n}) => string\n\nexport type RowClassNameGetter<T> = (\n params: { columns: Column<T>[] } & RowCommonParams\n) => string\n\n/**\n * Handler types\n */\nexport type ColumnSortHandler<T> = (params: ColumnSortParams<T>) => void\nexport type ColumnResizeHandler<T> = (column: Column<T>, width: number) => void\nexport type ExpandedRowsChangeHandler = (expandedRowKeys: KeyType[]) => void\n\nexport const tableV2Props = buildProps({\n cache: tableV2GridProps.cache,\n estimatedRowHeight: tableV2RowProps.estimatedRowHeight,\n rowKey,\n // Header attributes\n headerClass: {\n type: definePropType<string | HeaderClassNameGetter<any>>([\n String,\n Function,\n ]),\n },\n headerProps: {\n type: definePropType<any | ExtractHeaderPropGetter<any>>([\n Object,\n Function,\n ]),\n },\n headerCellProps: {\n type: definePropType<any | ExtractHeaderCellPropGetter<any>>([\n Object,\n Function,\n ]),\n },\n headerHeight: tableV2HeaderProps.headerHeight,\n /**\n * Footer attributes\n */\n footerHeight: {\n type: Number,\n default: 0,\n },\n /**\n * Row attributes\n */\n rowClass: {\n type: definePropType<string | RowClassNameGetter<any>>([String, Function]),\n },\n rowProps: {\n type: definePropType<ExtractRowPropGetter<any> | any>([Object, Function]),\n },\n rowHeight: {\n type: Number,\n default: 50,\n },\n\n /**\n * Cell attributes\n */\n cellProps: {\n type: definePropType<Record<string, any> | ExtraCellPropGetter<any>>([\n Object,\n Function,\n ]),\n },\n /**\n * Data models\n */\n columns,\n data: dataType,\n dataGetter: {\n type: definePropType<DataGetter<any>>(Function),\n },\n fixedData: fixedDataType,\n /**\n * Expanded keys\n */\n expandColumnKey: tableV2RowProps.expandColumnKey,\n expandedRowKeys: expandKeys,\n defaultExpandedRowKeys: expandKeys,\n\n /**\n * Attributes\n */\n class: classType,\n // disabled: Boolean,\n fixed: Boolean,\n style: {\n type: definePropType<CSSProperties>(Object),\n },\n width: requiredNumber,\n height: requiredNumber,\n maxHeight: Number,\n useIsScrolling: Boolean,\n indentSize: {\n type: Number,\n default: 12,\n },\n iconSize: {\n type: Number,\n default: 12,\n },\n hScrollbarSize: virtualizedGridProps.hScrollbarSize,\n vScrollbarSize: virtualizedGridProps.vScrollbarSize,\n scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,\n\n /**\n * Sorting\n */\n sortBy: {\n type: definePropType<SortBy>(Obje
|