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> extends Omit<TableProps<RecordValue>, 'dataSource' | 'title' | 'columns'> {
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, ...restProps } = props;
9
+ const { title, extra, columns, rowSelectionType, tableProps } = props;
10
10
  const store = useListPageStore();
11
- const paginationEle = usePagination(props.pagination);
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
- ...restProps,
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
- ...restProps.rowSelection,
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 { DataTableColumns } from '../../../DataTable';
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;
@@ -36,7 +36,7 @@ const PureListPage = observer((props)=>{
36
36
  children: toolbar.render(store)
37
37
  }),
38
38
  /*#__PURE__*/ jsx(DataTable, {
39
- ...table.tableProps,
39
+ tableProps: table.tableProps,
40
40
  title: table.title,
41
41
  extra: table.extra,
42
42
  columns: table.columns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.118",
3
+ "version": "0.0.120",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",