listpage-next 0.0.122 → 0.0.124
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/AsyncButton/index.d.ts +2 -0
- package/dist/components/AsyncButton/index.js +22 -0
- package/dist/components/Page/components/ListPage/v2.d.ts +3 -0
- package/dist/components/Page/components/ListPage/v2.js +2 -1
- package/dist/components/Page/context/listpage.d.ts +1 -0
- package/dist/components/Page/context/listpage.js +4 -0
- package/dist/components/Page/hooks/useSelectionTools.js +1 -1
- package/dist/components/Page/index.d.ts +1 -0
- package/dist/components/Page/index.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "antd";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
const AsyncButton = (props)=>{
|
|
5
|
+
const { onClick, ...rest } = props;
|
|
6
|
+
const [loading, setLoading] = useState(false);
|
|
7
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
8
|
+
...rest,
|
|
9
|
+
loading: loading,
|
|
10
|
+
onClick: async (e)=>{
|
|
11
|
+
try {
|
|
12
|
+
setLoading(true);
|
|
13
|
+
await onClick?.(e);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
throw error;
|
|
16
|
+
} finally{
|
|
17
|
+
setLoading(false);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export { AsyncButton };
|
|
@@ -4,6 +4,9 @@ import { FilterFormOption } from '../../../FilterGroup';
|
|
|
4
4
|
import { DataTableProps } from './DataTable';
|
|
5
5
|
import { HeaderProps } from '../../hooks/useHeader';
|
|
6
6
|
export interface ListPageProps<FilterValue = any, RecordValue extends Record<string, any> = any> {
|
|
7
|
+
styles?: {
|
|
8
|
+
page?: React.CSSProperties;
|
|
9
|
+
};
|
|
7
10
|
storageKey?: string;
|
|
8
11
|
request: TableRequest<FilterValue, RecordValue>;
|
|
9
12
|
floats?: {
|
|
@@ -9,7 +9,7 @@ import { useFloat } from "../../hooks/useFloat.js";
|
|
|
9
9
|
import { DataTable } from "./DataTable.js";
|
|
10
10
|
import { useHeader } from "../../hooks/useHeader.js";
|
|
11
11
|
const PureListPage = observer((props)=>{
|
|
12
|
-
const { header, filter, toolbar, table } = props;
|
|
12
|
+
const { header, filter, toolbar, table, styles } = props;
|
|
13
13
|
const store = useListPageStore();
|
|
14
14
|
const floatEle = useFloat();
|
|
15
15
|
const headerEle = useHeader(header);
|
|
@@ -22,6 +22,7 @@ const PureListPage = observer((props)=>{
|
|
|
22
22
|
store.filters
|
|
23
23
|
]);
|
|
24
24
|
return /*#__PURE__*/ jsxs(ListPageContainer, {
|
|
25
|
+
style: styles?.page,
|
|
25
26
|
children: [
|
|
26
27
|
headerEle,
|
|
27
28
|
filter && /*#__PURE__*/ jsx(FilterSection, {
|
|
@@ -43,6 +43,7 @@ export declare class ListPageStore<FilterValue = any, RecordValue extends Record
|
|
|
43
43
|
updatePage(page: number, pageSize: number): void;
|
|
44
44
|
fetchTableData(): Promise<void>;
|
|
45
45
|
onSelectChange: (selectedRowKeys: Key[], selectedRows: RecordValue[]) => void;
|
|
46
|
+
clearSelection(): void;
|
|
46
47
|
refreshTable(): void;
|
|
47
48
|
}
|
|
48
49
|
export declare const ListPageProvider: ({ children, initialValues, request, storageKey, floats, }: {
|
|
@@ -77,6 +77,10 @@ class ListPageStore {
|
|
|
77
77
|
this.selection.selectedRowKeys = selectedRowKeys;
|
|
78
78
|
this.selection.selectedRows = selectedRows;
|
|
79
79
|
};
|
|
80
|
+
clearSelection() {
|
|
81
|
+
this.selection.selectedRowKeys = [];
|
|
82
|
+
this.selection.selectedRows = [];
|
|
83
|
+
}
|
|
80
84
|
refreshTable() {
|
|
81
85
|
this.fetchTableData();
|
|
82
86
|
}
|
|
@@ -5,3 +5,4 @@ export { usePageContext } from './context/page';
|
|
|
5
5
|
export { ListPage as ListPagePro, type ListPageProps as ListPageProProps, } from './components/ListPage/v2';
|
|
6
6
|
export { type ListPageTableColumn } from './components/ListPage/DataTable';
|
|
7
7
|
export { type TableRequest } from './context/listpage';
|
|
8
|
+
export { ListPageStore as ListPageContext } from './context/listpage';
|
|
@@ -3,4 +3,5 @@ import { ListPage } from "./components/ListPage/index.js";
|
|
|
3
3
|
import { PageLoading } from "./components/Loading/index.js";
|
|
4
4
|
import { usePageContext } from "./context/page.js";
|
|
5
5
|
import { ListPage as v2_js_ListPage } from "./components/ListPage/v2.js";
|
|
6
|
-
|
|
6
|
+
import { ListPageStore } from "./context/listpage.js";
|
|
7
|
+
export { ListPage, ListPageStore as ListPageContext, v2_js_ListPage as ListPagePro, PageContainer, PageLoading, usePageContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './components/InfiniteList';
|
|
|
5
5
|
export * from './components/Menu';
|
|
6
6
|
export * from './components/DataTable';
|
|
7
7
|
export * from './components/AsyncSelect';
|
|
8
|
+
export * from './components/AsyncButton';
|
|
8
9
|
export * from './features/JsonEditor';
|
|
9
10
|
export * from './features/ChatClient';
|
|
10
11
|
export * from './http-client';
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./components/InfiniteList/index.js";
|
|
|
5
5
|
export * from "./components/Menu/index.js";
|
|
6
6
|
export * from "./components/DataTable/index.js";
|
|
7
7
|
export * from "./components/AsyncSelect/index.js";
|
|
8
|
+
export * from "./components/AsyncButton/index.js";
|
|
8
9
|
export * from "./features/JsonEditor/index.js";
|
|
9
10
|
export * from "./features/ChatClient/index.js";
|
|
10
11
|
export * from "./http-client/index.js";
|