@kep-platform/basic-component 0.3.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ export declare const Column: import("styled-components/dist/types").IStyledCompo
|
|
15
15
|
title?: React.ReactNode;
|
16
16
|
index?: number | undefined;
|
17
17
|
itemRender?: import("../@types/type").ListItemRender | undefined;
|
18
|
-
} & Omit<React.HtmlHTMLAttributes<HTMLLIElement>, "title">, Omit<ColumnType, "
|
18
|
+
} & Omit<React.HtmlHTMLAttributes<HTMLLIElement>, "title">, Omit<ColumnType, "dataIndex" | "render"> & {
|
19
19
|
key: React.Key;
|
20
20
|
title?: React.ReactNode;
|
21
21
|
index?: number | undefined;
|
package/dist/Table/Table.d.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import React, { ReactNode } from 'react';
|
2
2
|
import { ColumnType, PaginationType, RowSelection, Sorter } from '../@types/type';
|
3
|
-
type SorterDesc = Record<string, Sorter>;
|
4
3
|
type FilterDesc = Record<string, string>;
|
5
4
|
export type Scroll = {
|
6
5
|
y?: number;
|
@@ -13,7 +12,7 @@ export type TableProps = {
|
|
13
12
|
actions?: ReactNode[];
|
14
13
|
title?: ReactNode;
|
15
14
|
scroll?: Scroll;
|
16
|
-
onChange?: (pagination
|
15
|
+
onChange?: (pagination: PaginationType | false, sorter: SorterController, fitler?: FilterDesc) => void;
|
17
16
|
headerRender?: (column: ColumnType) => ReactNode;
|
18
17
|
groupBy?: string;
|
19
18
|
pagination?: PaginationType | false;
|
@@ -23,5 +22,9 @@ export type TableProps = {
|
|
23
22
|
tableContentRef?: React.RefObject<HTMLDivElement>;
|
24
23
|
virtual?: boolean;
|
25
24
|
};
|
25
|
+
type SorterController = {
|
26
|
+
columnKey: string;
|
27
|
+
sorterType: Sorter;
|
28
|
+
} | null;
|
26
29
|
export default function Table({ columns, dataSource, rowKey, scroll, onChange, headerRender, pagination: outerPagination, empty, rowSelection, multiple, tableContentRef, }: TableProps): React.JSX.Element;
|
27
30
|
export {};
|
package/dist/Table/Table.js
CHANGED
@@ -158,7 +158,7 @@ export default function Table(_ref3) {
|
|
158
158
|
dataSource = _ref3.dataSource,
|
159
159
|
rowKey = _ref3.rowKey,
|
160
160
|
scroll = _ref3.scroll,
|
161
|
-
|
161
|
+
_onChange = _ref3.onChange,
|
162
162
|
headerRender = _ref3.headerRender,
|
163
163
|
outerPagination = _ref3.pagination,
|
164
164
|
_ref3$empty = _ref3.empty,
|
@@ -277,16 +277,16 @@ export default function Table(_ref3) {
|
|
277
277
|
data[dataIndex] = /*#__PURE__*/React.createElement(ColumnTitleController, {
|
278
278
|
column: column,
|
279
279
|
onSorterChange: function onSorterChange(sorter) {
|
280
|
-
var
|
281
|
-
_onChange2 === null || _onChange2 === void 0 || _onChange2(undefined, _defineProperty({}, key, sorter), undefined);
|
282
|
-
setSorterController({
|
280
|
+
var newSorterController = {
|
283
281
|
columnKey: column.key,
|
284
282
|
sorterType: sorter
|
285
|
-
}
|
283
|
+
};
|
284
|
+
_onChange === null || _onChange === void 0 || _onChange(pagination, newSorterController, filterValues);
|
285
|
+
setSorterController(newSorterController);
|
286
286
|
},
|
287
287
|
onFilterValueChange: function onFilterValueChange(value) {
|
288
288
|
var newFilterValues = _objectSpread(_objectSpread({}, filterValues), {}, _defineProperty({}, dataIndex, value));
|
289
|
-
|
289
|
+
_onChange === null || _onChange === void 0 || _onChange(pagination, sorterController, newFilterValues);
|
290
290
|
setFilterValues(newFilterValues);
|
291
291
|
},
|
292
292
|
title: (headerRender === null || headerRender === void 0 ? void 0 : headerRender(column)) || column.title,
|
@@ -297,7 +297,7 @@ export default function Table(_ref3) {
|
|
297
297
|
});
|
298
298
|
});
|
299
299
|
return data;
|
300
|
-
}, [formatedColumns, sorterController, filterValues]);
|
300
|
+
}, [formatedColumns, sorterController, filterValues, pagination]);
|
301
301
|
var boxShadowBox = useRef(null);
|
302
302
|
var headerColumns = useMemo(function () {
|
303
303
|
return formatedColumns.map(function (column) {
|
@@ -420,10 +420,10 @@ export default function Table(_ref3) {
|
|
420
420
|
total: (pagination === null || pagination === void 0 ? void 0 : pagination.total) || dataSource.length,
|
421
421
|
justifyContent: "right",
|
422
422
|
onChange: function onChange(current, pageSize) {
|
423
|
-
|
423
|
+
_onChange === null || _onChange === void 0 || _onChange(_objectSpread(_objectSpread({}, pagination), {}, {
|
424
424
|
current: current,
|
425
425
|
pageSize: pageSize
|
426
|
-
}));
|
426
|
+
}), sorterController, filterValues);
|
427
427
|
setPagination(_objectSpread(_objectSpread({}, pagination), {}, {
|
428
428
|
current: current,
|
429
429
|
pageSize: pageSize
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@kep-platform/basic-component",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.3",
|
4
4
|
"description": "A react library developed with dumi",
|
5
5
|
"license": "MIT",
|
6
6
|
"module": "dist/index.js",
|
@@ -47,7 +47,7 @@
|
|
47
47
|
},
|
48
48
|
"dependencies": {
|
49
49
|
"@ant-design/icons": "^5.3.7",
|
50
|
-
"@kep-platform/hooks": "^0.3.
|
50
|
+
"@kep-platform/hooks": "^0.3.2",
|
51
51
|
"color": "^4.2.3",
|
52
52
|
"rc-pagination": "^4.1.0"
|
53
53
|
},
|
@@ -87,5 +87,5 @@
|
|
87
87
|
"authors": [
|
88
88
|
"less-step-jss 1599925910@qq.com"
|
89
89
|
],
|
90
|
-
"gitHead": "
|
90
|
+
"gitHead": "47400a54c0869fc2cb16e689b4f0be6a72745f77"
|
91
91
|
}
|