|
|
@ -16,6 +16,7 @@ import type {
|
|
|
|
ExpandedRowRender,
|
|
|
|
ExpandedRowRender,
|
|
|
|
RenderExpandIcon,
|
|
|
|
RenderExpandIcon,
|
|
|
|
TransformCellText,
|
|
|
|
TransformCellText,
|
|
|
|
|
|
|
|
DefaultRecordType,
|
|
|
|
} from './interface';
|
|
|
|
} from './interface';
|
|
|
|
import Body from './Body';
|
|
|
|
import Body from './Body';
|
|
|
|
import useColumns from './hooks/useColumns';
|
|
|
|
import useColumns from './hooks/useColumns';
|
|
|
@ -65,7 +66,7 @@ const EMPTY_SCROLL_TARGET = {};
|
|
|
|
|
|
|
|
|
|
|
|
export const INTERNAL_HOOKS = 'rc-table-internal-hook';
|
|
|
|
export const INTERNAL_HOOKS = 'rc-table-internal-hook';
|
|
|
|
|
|
|
|
|
|
|
|
export interface TableProps<RecordType = unknown> {
|
|
|
|
export interface TableProps<RecordType = DefaultRecordType> {
|
|
|
|
prefixCls?: string;
|
|
|
|
prefixCls?: string;
|
|
|
|
data?: RecordType[];
|
|
|
|
data?: RecordType[];
|
|
|
|
columns?: ColumnsType<RecordType>;
|
|
|
|
columns?: ColumnsType<RecordType>;
|
|
|
@ -143,7 +144,7 @@ export interface TableProps<RecordType = unknown> {
|
|
|
|
transformCellText?: TransformCellText<RecordType>;
|
|
|
|
transformCellText?: TransformCellText<RecordType>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default defineComponent<TableProps>({
|
|
|
|
export default defineComponent<TableProps<DefaultRecordType>>({
|
|
|
|
name: 'Table',
|
|
|
|
name: 'Table',
|
|
|
|
inheritAttrs: false,
|
|
|
|
inheritAttrs: false,
|
|
|
|
props: [
|
|
|
|
props: [
|
|
|
@ -190,7 +191,6 @@ export default defineComponent<TableProps>({
|
|
|
|
setup(props, { attrs, slots, emit }) {
|
|
|
|
setup(props, { attrs, slots, emit }) {
|
|
|
|
const mergedData = computed(() => props.data || EMPTY_DATA);
|
|
|
|
const mergedData = computed(() => props.data || EMPTY_DATA);
|
|
|
|
const hasData = computed(() => !!mergedData.value.length);
|
|
|
|
const hasData = computed(() => !!mergedData.value.length);
|
|
|
|
|
|
|
|
|
|
|
|
// ==================== Customize =====================
|
|
|
|
// ==================== Customize =====================
|
|
|
|
const mergedComponents = computed(() =>
|
|
|
|
const mergedComponents = computed(() =>
|
|
|
|
mergeObject<TableComponents<any>>(props.components, {}),
|
|
|
|
mergeObject<TableComponents<any>>(props.components, {}),
|
|
|
|