@magicbe/antd-crud 0.0.59 → 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/Table.js +3 -2
- package/dist/interface.d.ts +4 -4
- package/package.json +1 -1
package/dist/components/Table.js
CHANGED
|
@@ -181,14 +181,15 @@ var Table = React.forwardRef(function (_a, ref) {
|
|
|
181
181
|
type: selectionType,
|
|
182
182
|
});
|
|
183
183
|
}, [selectionType]);
|
|
184
|
-
var loadRecords = function (params) {
|
|
184
|
+
var loadRecords = function (params, filter, sorter, extra) {
|
|
185
185
|
var _a;
|
|
186
186
|
if (params === void 0) { params = {}; }
|
|
187
|
+
if (filter === void 0) { filter = {}; }
|
|
187
188
|
setLoading(true);
|
|
188
189
|
var filter_data = (_a = filter_ref === null || filter_ref === void 0 ? void 0 : filter_ref.current) === null || _a === void 0 ? void 0 : _a.form.getFieldsValue();
|
|
189
190
|
if (!getSources)
|
|
190
191
|
return console.warn("getSources is not defined");
|
|
191
|
-
getSources(Object.assign({}, params, filter_data)).then(function (_a) {
|
|
192
|
+
getSources(Object.assign({}, params, filter_data), filter, sorter, extra).then(function (_a) {
|
|
192
193
|
var total = _a.total, sources = _a.sources, page = _a.page, size = _a.size;
|
|
193
194
|
setSources(sources);
|
|
194
195
|
setTotal(total);
|
package/dist/interface.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type CheckboxGroupProps } from "antd/es/checkbox";
|
|
|
3
3
|
import { FormInstance, Rule } from "antd/es/form";
|
|
4
4
|
import { PasswordProps, TextAreaProps } from "antd/es/input";
|
|
5
5
|
import { type RadioGroupProps } from "antd/es/radio";
|
|
6
|
-
import { RowSelectionType, type ColumnType as AntdColumnType } from "antd/es/table/interface";
|
|
6
|
+
import { RowSelectionType, SorterResult, TableCurrentDataSource, TablePaginationConfig, type ColumnType as AntdColumnType } from "antd/es/table/interface";
|
|
7
7
|
import React from "react";
|
|
8
8
|
export type AnyObject = Record<PropertyKey, any>;
|
|
9
9
|
/**字段列 */
|
|
@@ -112,7 +112,7 @@ export interface GetSourceFunctionParams extends Record<string, any> {
|
|
|
112
112
|
pageSize?: number;
|
|
113
113
|
}
|
|
114
114
|
/**获取数据的方法 */
|
|
115
|
-
export type getSourceFunction<RecordType = AnyObject> = (params?: GetSourceFunctionParams) => Promise<Source<RecordType>>;
|
|
115
|
+
export type getSourceFunction<RecordType = AnyObject> = (params?: GetSourceFunctionParams, filter?: Record<string, any>, sorter?: SorterResult<RecordType> | SorterResult<RecordType>[], extra?: TableCurrentDataSource<RecordType>) => Promise<Source<RecordType>>;
|
|
116
116
|
export interface Selection<RecordType = AnyObject> {
|
|
117
117
|
keys?: React.Key[];
|
|
118
118
|
rows?: RecordType[];
|
|
@@ -167,7 +167,7 @@ export interface DrawerProps {
|
|
|
167
167
|
/**主体参数 */
|
|
168
168
|
export interface ContentProps<RecordType = AnyObject> extends Omit<AntdTableProps<RecordType>, "columns" | "pagination" | "dataSource" | "loading" | "rowSelection"> {
|
|
169
169
|
columns?: ColumnType<RecordType>[];
|
|
170
|
-
getSources?: getSourceFunction
|
|
170
|
+
getSources?: getSourceFunction<RecordType>;
|
|
171
171
|
add?: add;
|
|
172
172
|
del?: del;
|
|
173
173
|
edit?: edit;
|
|
@@ -208,7 +208,7 @@ export type getPageData = () => ({
|
|
|
208
208
|
current?: number;
|
|
209
209
|
pageSize?: number;
|
|
210
210
|
});
|
|
211
|
-
export type loadRecords = (params?: any) => void;
|
|
211
|
+
export type loadRecords = (params: TablePaginationConfig, filter?: Record<string, any>, sorter?: SorterResult | SorterResult[], extra?: TableCurrentDataSource) => void;
|
|
212
212
|
export type getRecords<T = AnyObject> = () => T[];
|
|
213
213
|
export interface TableRef<RecordType = AnyObject> {
|
|
214
214
|
getPageData: getPageData;
|