listpage-next 0.0.118 → 0.0.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,11 +3,12 @@ import { ColumnType } from 'antd/es/table';
|
|
|
3
3
|
import { ListPageStore } from '../../context/listpage';
|
|
4
4
|
import { ColumnRender } from '../../../DataTable/components/Render';
|
|
5
5
|
import { ComponentProps, ComponentType } from '../../../DataTable/typings';
|
|
6
|
-
export interface DataTableProps<RecordValue extends Record<string, any> = any>
|
|
6
|
+
export interface DataTableProps<RecordValue extends Record<string, any> = any> {
|
|
7
7
|
title?: React.ReactNode;
|
|
8
8
|
rowSelectionType?: 'checkbox' | 'radio';
|
|
9
9
|
extra?: React.ReactNode | ((ctx: ListPageStore<any, RecordValue>) => React.ReactNode);
|
|
10
10
|
columns?: ListPageTableColumn<RecordValue>[];
|
|
11
|
+
tableProps?: Omit<TableProps<RecordValue>, 'dataSource' | 'title' | 'columns'>;
|
|
11
12
|
}
|
|
12
13
|
export interface ListPageTableColumn<RecordValue extends Record<string, any> = any, FilterValue = any> extends ColumnType<RecordValue> {
|
|
13
14
|
component?: ComponentType | ColumnRender<RecordValue, ListPageStore<FilterValue, RecordValue>>;
|
|
@@ -6,9 +6,9 @@ import { TableContainer } from "../../../DataTable/index.js";
|
|
|
6
6
|
import { usePagination } from "../../hooks/usePagination.js";
|
|
7
7
|
import { useColumns } from "../../hooks/useColumns.js";
|
|
8
8
|
const DataTable = observer((props)=>{
|
|
9
|
-
const { title, extra, columns, rowSelectionType,
|
|
9
|
+
const { title, extra, columns, rowSelectionType, tableProps } = props;
|
|
10
10
|
const store = useListPageStore();
|
|
11
|
-
const paginationEle = usePagination(
|
|
11
|
+
const paginationEle = usePagination(tableProps?.pagination);
|
|
12
12
|
const newColumns = useColumns(columns);
|
|
13
13
|
const extraEle = 'function' == typeof extra ? extra(store) : extra;
|
|
14
14
|
return /*#__PURE__*/ jsxs(Card, {
|
|
@@ -23,14 +23,14 @@ const DataTable = observer((props)=>{
|
|
|
23
23
|
/*#__PURE__*/ jsx(TableContainer, {
|
|
24
24
|
children: /*#__PURE__*/ jsx(Table, {
|
|
25
25
|
bordered: false,
|
|
26
|
-
...
|
|
26
|
+
...tableProps,
|
|
27
27
|
columns: newColumns,
|
|
28
28
|
loading: store.loadingData,
|
|
29
29
|
dataSource: store.dataSource,
|
|
30
30
|
pagination: false,
|
|
31
31
|
rowSelection: rowSelectionType && {
|
|
32
32
|
preserveSelectedRowKeys: true,
|
|
33
|
-
...
|
|
33
|
+
...tableProps?.rowSelection,
|
|
34
34
|
type: rowSelectionType,
|
|
35
35
|
selectedRowKeys: store.selection.selectedRowKeys,
|
|
36
36
|
onChange: store.onSelectChange
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { TableProps } from 'antd';
|
|
3
2
|
import { FloatRender, ListPageStore, TableRequest } from '../../context/listpage';
|
|
4
3
|
import { FilterFormOption } from '../../../FilterGroup';
|
|
5
|
-
import {
|
|
4
|
+
import { DataTableProps } from './DataTable';
|
|
6
5
|
import { HeaderProps } from '../../hooks/useHeader';
|
|
7
6
|
export interface ListPageProps<FilterValue = any, RecordValue extends Record<string, any> = any> {
|
|
8
7
|
storageKey?: string;
|
|
@@ -25,12 +24,7 @@ export interface ListPageProps<FilterValue = any, RecordValue extends Record<str
|
|
|
25
24
|
toolbar?: {
|
|
26
25
|
render: (ctx: ListPageStore<FilterValue, RecordValue>) => ReactNode;
|
|
27
26
|
};
|
|
28
|
-
table:
|
|
29
|
-
columns: DataTableColumns<RecordValue, ListPageStore>[];
|
|
30
|
-
title?: React.ReactNode;
|
|
31
|
-
extra?: React.ReactNode;
|
|
32
|
-
tableProps?: Omit<TableProps<RecordValue>, 'dataSource' | 'title' | 'columns'>;
|
|
33
|
-
};
|
|
27
|
+
table: DataTableProps<RecordValue>;
|
|
34
28
|
}
|
|
35
29
|
export declare const PureListPage: ((props: ListPageProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
36
30
|
displayName: string;
|