listpage-next 0.0.58 → 0.0.60
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/DataTable/components/DataTable.d.ts +1 -1
- package/dist/components/DataTable/components/DataTable.js +7 -8
- package/dist/components/FilterGroup/components/FilterForm/index.js +2 -0
- package/dist/context/float.js +4 -1
- package/dist/demos/demo6.js +39 -18
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DataTableContext, DataTableProps } from "../typings";
|
|
2
1
|
import { Ref } from "react";
|
|
2
|
+
import { DataTableContext, DataTableProps } from "../typings";
|
|
3
3
|
export declare const DataTable: <Record = any>(props: DataTableProps<Record> & {
|
|
4
4
|
tableRef?: Ref<DataTableContext>;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { forwardRef, useImperativeHandle } from "react";
|
|
3
3
|
import { Card, Pagination, Table } from "antd";
|
|
4
|
+
import styled_components from "styled-components";
|
|
4
5
|
import { useColumns } from "../hooks/useColumns.js";
|
|
5
6
|
import { useData } from "../hooks/useData.js";
|
|
6
7
|
import { FloatProvider, useFloatContext } from "../../../context/index.js";
|
|
7
|
-
import { forwardRef, useImperativeHandle } from "react";
|
|
8
|
-
import { omit } from "lodash";
|
|
9
8
|
const PaginationContainer = styled_components.div`
|
|
10
9
|
padding: 12px 16px 12px 0;
|
|
11
10
|
border-top: 1px solid #f0f0f0;
|
|
@@ -70,16 +69,16 @@ const DataTableComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
70
69
|
});
|
|
71
70
|
});
|
|
72
71
|
const DataTable = (props)=>{
|
|
72
|
+
const { tableRef, ...restProps } = props;
|
|
73
73
|
if (!props.floats) return /*#__PURE__*/ jsx(DataTableComponent, {
|
|
74
|
-
...
|
|
74
|
+
...restProps,
|
|
75
|
+
ref: tableRef
|
|
75
76
|
});
|
|
76
77
|
return /*#__PURE__*/ jsx(FloatProvider, {
|
|
77
78
|
floats: props.floats,
|
|
78
79
|
children: /*#__PURE__*/ jsx(DataTableComponent, {
|
|
79
|
-
...
|
|
80
|
-
|
|
81
|
-
]),
|
|
82
|
-
ref: props.tableRef
|
|
80
|
+
...restProps,
|
|
81
|
+
ref: tableRef
|
|
83
82
|
})
|
|
84
83
|
});
|
|
85
84
|
};
|
|
@@ -28,6 +28,8 @@ const FilterForm = ({ options, initialValues, onSubmit, onReset })=>{
|
|
|
28
28
|
};
|
|
29
29
|
const handleReset = ()=>{
|
|
30
30
|
formRef.current?.resetFields();
|
|
31
|
+
const values = formRef.current?.getFieldsValue();
|
|
32
|
+
onSubmit?.(cleanUpFormValues(values));
|
|
31
33
|
onReset?.();
|
|
32
34
|
};
|
|
33
35
|
return /*#__PURE__*/ jsxs(Form, {
|
package/dist/context/float.js
CHANGED
|
@@ -3,7 +3,10 @@ import { cloneElement, createContext, useCallback, useContext, useRef, useState
|
|
|
3
3
|
const FloatContext = /*#__PURE__*/ createContext(void 0);
|
|
4
4
|
const useFloatContext = ()=>{
|
|
5
5
|
const context = useContext(FloatContext);
|
|
6
|
-
if (!context)
|
|
6
|
+
if (!context) return {
|
|
7
|
+
showFloat: ()=>{},
|
|
8
|
+
hideFloat: ()=>{}
|
|
9
|
+
};
|
|
7
10
|
return context;
|
|
8
11
|
};
|
|
9
12
|
const FloatProvider = (props)=>{
|
package/dist/demos/demo6.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Switch } from "antd";
|
|
3
3
|
import { DataTable } from "../components/DataTable/index.js";
|
|
4
|
+
import { useRef } from "react";
|
|
4
5
|
const columns = [
|
|
5
6
|
{
|
|
6
7
|
key: 'enable',
|
|
@@ -54,22 +55,42 @@ const request = async (params)=>{
|
|
|
54
55
|
pageSize: pageSize
|
|
55
56
|
};
|
|
56
57
|
};
|
|
57
|
-
const Demo6 = ()
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
58
|
+
const Demo6 = ()=>{
|
|
59
|
+
const ref = useRef(null);
|
|
60
|
+
const handleRefresh = ()=>{
|
|
61
|
+
if (ref.current) ref.current.refresh();
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
64
|
+
children: [
|
|
65
|
+
/*#__PURE__*/ jsx("div", {
|
|
66
|
+
style: {
|
|
67
|
+
marginBottom: 16
|
|
68
|
+
},
|
|
69
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
70
|
+
onClick: handleRefresh,
|
|
71
|
+
children: "刷新表格"
|
|
72
|
+
})
|
|
73
|
+
}),
|
|
74
|
+
/*#__PURE__*/ jsx(DataTable, {
|
|
75
|
+
tableRef: ref,
|
|
76
|
+
scroll: {
|
|
77
|
+
y: 300
|
|
78
|
+
},
|
|
79
|
+
title: "测试标题",
|
|
80
|
+
extra: /*#__PURE__*/ jsx(Button, {
|
|
81
|
+
children: "操作"
|
|
82
|
+
}),
|
|
83
|
+
columns: columns,
|
|
84
|
+
request: request,
|
|
85
|
+
pagination: {
|
|
86
|
+
showSizeChanger: true,
|
|
87
|
+
defaultPageSize: 10,
|
|
88
|
+
showTotal (total, range) {
|
|
89
|
+
return `共${total}条数据`;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
]
|
|
74
94
|
});
|
|
95
|
+
};
|
|
75
96
|
export { Demo6 };
|