@kep-platform/basic-component 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,5 +18,5 @@ export declare function Popup(props: {
18
18
  trigger?: TriggerType;
19
19
  content?: ReactNode;
20
20
  onVisibleChange?: (visible: boolean) => void;
21
- }): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
21
+ }): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
22
22
  export default PopupBox;
@@ -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?: PaginationType, sorter?: SorterDesc, fitler?: FilterDesc) => void;
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 {};
@@ -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
- _onChange2 = _ref3.onChange,
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 key = column.key;
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
- _onChange2 === null || _onChange2 === void 0 || _onChange2(undefined, undefined, newFilterValues);
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,14 +420,18 @@ 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
- _onChange2 === null || _onChange2 === void 0 || _onChange2(_objectSpread(_objectSpread({}, pagination), {}, {
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
430
430
  }));
431
431
  }
432
- })));
432
+ })), /*#__PURE__*/React.createElement("pre", null, JSON.stringify({
433
+ pagination: pagination,
434
+ sorterController: sorterController,
435
+ filterValues: filterValues
436
+ }, null, 4)));
433
437
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kep-platform/basic-component",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
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.1",
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": "63be39dfc99f519d873b7da30a3d4ee291122f48"
90
+ "gitHead": "d6167a607e46012935e3ee7e301c3714be7fffc0"
91
91
  }