listpage-next 0.0.113 → 0.0.115
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.
- package/dist/components/Page/components/ListPage/DataTable.d.ts +8 -2
- package/dist/components/Page/components/ListPage/styles.js +3 -1
- package/dist/components/Page/components/ListPage/v2.d.ts +2 -3
- package/dist/components/Page/context/listpage.d.ts +4 -3
- package/dist/components/Page/context/listpage.js +2 -0
- package/dist/components/Page/hooks/useFloat.d.ts +1 -1
- package/dist/components/Page/hooks/useFloat.js +6 -2
- package/dist/components/Page/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { TableProps } from 'antd';
|
|
2
2
|
import { ListPageStore } from '../../context/listpage';
|
|
3
|
-
import {
|
|
3
|
+
import { ComponentProps, ComponentType } from '../../../DataTable/typings';
|
|
4
|
+
import { ColumnType } from 'antd/es/table';
|
|
5
|
+
import { ColumnRender } from '../../../DataTable/components/Render';
|
|
4
6
|
export interface DataTableProps<Record = any> extends Omit<TableProps<Record>, 'dataSource' | 'title' | 'columns'> {
|
|
5
7
|
title?: React.ReactNode;
|
|
6
8
|
extra?: React.ReactNode;
|
|
7
|
-
columns?:
|
|
9
|
+
columns?: ListPageTableColumn<Record>[];
|
|
10
|
+
}
|
|
11
|
+
export interface ListPageTableColumn<Record = any> extends ColumnType<Record> {
|
|
12
|
+
component?: ComponentType | ColumnRender<Record, ListPageStore>;
|
|
13
|
+
props?: ComponentProps;
|
|
8
14
|
}
|
|
9
15
|
export declare const DataTable: ((props: DataTableProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
10
16
|
displayName: string;
|
|
@@ -23,7 +23,9 @@ const Title = styled_components.div`
|
|
|
23
23
|
`;
|
|
24
24
|
const FilterSection = styled_components.div`
|
|
25
25
|
background: #fff;
|
|
26
|
-
padding:
|
|
26
|
+
padding: 24px 32px;
|
|
27
|
+
border-radius: 8px;
|
|
28
|
+
border: 0.5px solid #f0f0f0;
|
|
27
29
|
`;
|
|
28
30
|
const ToolbarSection = styled_components.div``;
|
|
29
31
|
const BodySection = styled_components.div`
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { TableProps } from 'antd';
|
|
3
|
-
import { ListPageStore, TableRequest } from '../../context/listpage';
|
|
3
|
+
import { FloatRender, ListPageStore, TableRequest } from '../../context/listpage';
|
|
4
4
|
import { FilterFormOption } from '../../../FilterGroup';
|
|
5
5
|
import { DataTableColumns } from '../../../DataTable';
|
|
6
|
-
import { FloatComponentProps } from '../../../../context';
|
|
7
6
|
export interface ListPageProps<FilterValue = any, RecordValue extends Record<string, any> = any> {
|
|
8
7
|
request: TableRequest<FilterValue, RecordValue>;
|
|
9
8
|
floats?: {
|
|
10
9
|
key: string;
|
|
11
|
-
render:
|
|
10
|
+
render: FloatRender<RecordValue>;
|
|
12
11
|
}[];
|
|
13
12
|
initialValues?: {
|
|
14
13
|
filterValues?: FilterValue;
|
|
@@ -2,12 +2,13 @@ import { JSX, ReactNode } from 'react';
|
|
|
2
2
|
import { FloatComponentProps } from '../../../context';
|
|
3
3
|
import { BaseQueryParams, PaginationData } from '../../../http-client/types';
|
|
4
4
|
export type TableRequest<FilterValue = any, RecordValue = any> = (pageParams: BaseQueryParams, filterValues: FilterValue) => Promise<PaginationData<RecordValue>>;
|
|
5
|
+
export type FloatRender<RecordValue extends Record<string, any> = any> = (props: FloatComponentProps<RecordValue>) => JSX.Element;
|
|
5
6
|
export declare class ListPageStore<FilterValue = any, RecordValue extends Record<string, any> = any> {
|
|
6
7
|
filters: FilterValue;
|
|
7
8
|
tableDataRequest: TableRequest<FilterValue, RecordValue>;
|
|
8
9
|
floats: {
|
|
9
10
|
key: string;
|
|
10
|
-
render:
|
|
11
|
+
render: FloatRender<RecordValue>;
|
|
11
12
|
}[];
|
|
12
13
|
visibleFloat?: {
|
|
13
14
|
key: string;
|
|
@@ -23,7 +24,7 @@ export declare class ListPageStore<FilterValue = any, RecordValue extends Record
|
|
|
23
24
|
};
|
|
24
25
|
constructor(initialValues: any | undefined, request: TableRequest<FilterValue, RecordValue>, floats: {
|
|
25
26
|
key: string;
|
|
26
|
-
render:
|
|
27
|
+
render: FloatRender<RecordValue>;
|
|
27
28
|
}[]);
|
|
28
29
|
submitFiltersChange(value?: FilterValue): void;
|
|
29
30
|
showFloat(key: string, record: any, onCloseCallback?: () => void): void;
|
|
@@ -41,7 +42,7 @@ export declare const ListPageProvider: ({ children, initialValues, request, floa
|
|
|
41
42
|
};
|
|
42
43
|
floats?: {
|
|
43
44
|
key: string;
|
|
44
|
-
render:
|
|
45
|
+
render: FloatRender<any>;
|
|
45
46
|
}[];
|
|
46
47
|
request: TableRequest<any, any>;
|
|
47
48
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useFloat():
|
|
1
|
+
export declare function useFloat(): false | import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useMemo } from "react";
|
|
2
3
|
import { useListPageStore } from "../context/listpage.js";
|
|
3
4
|
function useFloat() {
|
|
4
5
|
const store = useListPageStore();
|
|
5
6
|
const visibleFloat = store.visibleFloat;
|
|
6
7
|
const floatEle = useMemo(()=>{
|
|
7
|
-
const
|
|
8
|
+
const Component = store.floats.find((f)=>f.key === visibleFloat?.key)?.render;
|
|
8
9
|
const props = {
|
|
9
10
|
record: visibleFloat?.record,
|
|
10
11
|
onClose: ()=>{
|
|
@@ -13,7 +14,10 @@ function useFloat() {
|
|
|
13
14
|
},
|
|
14
15
|
visible: true
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
+
if (!Component) return false;
|
|
18
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
17
21
|
}, [
|
|
18
22
|
visibleFloat,
|
|
19
23
|
store
|
|
@@ -3,3 +3,4 @@ export { ListPage, type ListPageProps } from './components/ListPage';
|
|
|
3
3
|
export { PageLoading } from './components/Loading';
|
|
4
4
|
export { usePageContext } from './context/page';
|
|
5
5
|
export { ListPage as ListPagePro, type ListPageProps as ListPageProProps, } from './components/ListPage/v2';
|
|
6
|
+
export { type ListPageTableColumn } from './components/ListPage/DataTable';
|