UNPKG

4.15 kBTypeScriptView Raw
1/**
2 * Feature:
3 * - fixed not need to set width
4 * - support `rowExpandable` to config row expand logic
5 * - add `summary` to support `() => ReactNode`
6 *
7 * Update:
8 * - `dataIndex` is `array[]` now
9 * - `expandable` wrap all the expand related props
10 *
11 * Removed:
12 * - expandIconAsCell
13 * - useFixedHeader
14 * - rowRef
15 * - columns[number].onCellClick
16 * - onRowClick
17 * - onRowDoubleClick
18 * - onRowMouseEnter
19 * - onRowMouseLeave
20 * - getBodyWrapper
21 * - bodyStyle
22 *
23 * Deprecated:
24 * - All expanded props, move into expandable
25 */
26import type { CompareProps } from '@rc-component/context/lib/Immutable';
27import * as React from 'react';
28import { EXPAND_COLUMN, INTERNAL_HOOKS } from './constant';
29import { FooterComponents } from './Footer';
30import type { ColumnsType, ColumnType, DefaultRecordType, Direction, ExpandableConfig, GetComponentProps, GetRowKey, LegacyExpandableProps, PanelRender, Reference, RowClassName, TableComponents, TableLayout, TableSticky } from './interface';
31import Column from './sugar/Column';
32import ColumnGroup from './sugar/ColumnGroup';
33export declare const DEFAULT_PREFIX = "rc-table";
34export interface TableProps<RecordType = any> extends Omit<LegacyExpandableProps<RecordType>, 'showExpandColumn'> {
35 prefixCls?: string;
36 className?: string;
37 style?: React.CSSProperties;
38 children?: React.ReactNode;
39 data?: readonly RecordType[];
40 columns?: ColumnsType<RecordType>;
41 rowKey?: string | keyof RecordType | GetRowKey<RecordType>;
42 tableLayout?: TableLayout;
43 scroll?: {
44 x?: number | true | string;
45 y?: number | string;
46 };
47 /** Config expand rows */
48 expandable?: ExpandableConfig<RecordType>;
49 indentSize?: number;
50 rowClassName?: string | RowClassName<RecordType>;
51 footer?: PanelRender<RecordType>;
52 summary?: (data: readonly RecordType[]) => React.ReactNode;
53 caption?: React.ReactNode;
54 id?: string;
55 showHeader?: boolean;
56 components?: TableComponents<RecordType>;
57 onRow?: GetComponentProps<RecordType>;
58 onHeaderRow?: GetComponentProps<readonly ColumnType<RecordType>[]>;
59 emptyText?: React.ReactNode | (() => React.ReactNode);
60 direction?: Direction;
61 sticky?: boolean | TableSticky;
62 rowHoverable?: boolean;
63 onScroll?: React.UIEventHandler<HTMLDivElement>;
64 /**
65 * @private Internal usage, may remove by refactor. Should always use `columns` instead.
66 *
67 * !!! DO NOT USE IN PRODUCTION ENVIRONMENT !!!
68 */
69 internalHooks?: string;
70 /**
71 * @private Internal usage, may remove by refactor. Should always use `columns` instead.
72 *
73 * !!! DO NOT USE IN PRODUCTION ENVIRONMENT !!!
74 */
75 transformColumns?: (columns: ColumnsType<RecordType>) => ColumnsType<RecordType>;
76 /**
77 * @private Internal usage, may remove by refactor.
78 *
79 * !!! DO NOT USE IN PRODUCTION ENVIRONMENT !!!
80 */
81 tailor?: boolean;
82 /**
83 * @private Internal usage, may remove by refactor.
84 *
85 * !!! DO NOT USE IN PRODUCTION ENVIRONMENT !!!
86 */
87 getContainerWidth?: (ele: HTMLElement, width: number) => number;
88 /**
89 * @private Internal usage, may remove by refactor.
90 *
91 * !!! DO NOT USE IN PRODUCTION ENVIRONMENT !!!
92 */
93 internalRefs?: {
94 body: React.MutableRefObject<HTMLDivElement>;
95 };
96}
97declare function Table<RecordType extends DefaultRecordType>(tableProps: TableProps<RecordType>, ref: React.Ref<Reference>): React.JSX.Element;
98export type ForwardGenericTable = (<RecordType extends DefaultRecordType = any>(props: TableProps<RecordType> & React.RefAttributes<Reference>) => React.ReactElement) & {
99 displayName?: string;
100};
101export declare function genTable(shouldTriggerRender?: CompareProps<typeof Table>): ForwardGenericTable;
102declare const ImmutableTable: ForwardGenericTable;
103type ImmutableTableType = typeof ImmutableTable & {
104 EXPAND_COLUMN: typeof EXPAND_COLUMN;
105 INTERNAL_HOOKS: typeof INTERNAL_HOOKS;
106 Column: typeof Column;
107 ColumnGroup: typeof ColumnGroup;
108 Summary: typeof FooterComponents;
109};
110declare const _default: ImmutableTableType;
111export default _default;
112
\No newline at end of file