@hw-component/table 0.0.9-beta-v6 → 0.0.9-beta-v7

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.
@@ -16,6 +16,7 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
16
16
  affixProps?: AffixProps | false;
17
17
  goTop?: boolean;
18
18
  optionsRender?: (node: React.ReactNode) => React.ReactNode;
19
+ paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
19
20
  }
20
- declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, paginationStyle, headerTitle, options, actionRender, affixProps, goTop, size, optionsRender, ...props }: HTableBodyProps) => JSX.Element;
21
+ declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, paginationStyle, headerTitle, options, actionRender, affixProps, goTop, size, optionsRender, paginationActionRender, ...props }: HTableBodyProps) => JSX.Element;
21
22
  export default _default;
@@ -22,7 +22,7 @@ import AlertMsg from './AlertMsg.js';
22
22
  import Options from './Options/index.js';
23
23
  import HeaderTitle from './HeaderTitle/index.js';
24
24
 
25
- var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender"];
25
+ var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender"];
26
26
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
27
27
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
28
28
  var defaultRender = function defaultRender() {
@@ -56,6 +56,7 @@ var Body = (function (_ref) {
56
56
  goTop = _ref$goTop === void 0 ? true : _ref$goTop,
57
57
  size = _ref.size,
58
58
  optionsRender = _ref.optionsRender,
59
+ paginationActionRender = _ref.paginationActionRender,
59
60
  props = _objectWithoutProperties(_ref, _excluded);
60
61
  var _ref2 = rowSelection || {},
61
62
  selectedRowKeys = _ref2.selectedRowKeys,
@@ -153,7 +154,8 @@ var Body = (function (_ref) {
153
154
  onPageChange: onPageChange,
154
155
  paginationStyle: paginationStyle,
155
156
  affixProps: affixProps,
156
- goTop: goTop
157
+ goTop: goTop,
158
+ actionRender: paginationActionRender
157
159
  }, pagination))]
158
160
  })]
159
161
  });
@@ -2,11 +2,13 @@ import type { PaginationProps } from "antd";
2
2
  import type { ParamsModal } from "../modal";
3
3
  import React from "react";
4
4
  import type { AffixProps } from "antd/lib/affix";
5
+ import { HTableInstance } from "../modal";
5
6
  export interface IPaginationProps extends PaginationProps {
6
7
  onPageChange?: (params: ParamsModal) => void;
7
8
  paginationStyle?: React.CSSProperties;
8
9
  affixProps?: AffixProps | false;
9
10
  goTop?: boolean;
11
+ actionRender?: (tableInstance: HTableInstance) => React.ReactNode;
10
12
  }
11
- declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, ...props }: IPaginationProps) => JSX.Element;
13
+ declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, ...props }: IPaginationProps) => JSX.Element;
12
14
  export default _default;
@@ -19,7 +19,7 @@ import { useClassName } from '../hooks/index.js';
19
19
  import { useState } from 'react';
20
20
  import GoTop from '../GoTop/index.js';
21
21
 
22
- var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop"],
22
+ var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender"],
23
23
  _excluded2 = ["offsetBottom"];
24
24
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
25
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -28,10 +28,12 @@ var HTablePagination = (function (_ref) {
28
28
  paginationStyle = _ref.paginationStyle,
29
29
  affixProps = _ref.affixProps,
30
30
  goTop = _ref.goTop,
31
+ actionRender = _ref.actionRender,
31
32
  props = _objectWithoutProperties(_ref, _excluded);
32
33
  var _useHTableContext = useHTableContext(),
33
34
  contextOnPageChange = _useHTableContext.onPageChange,
34
- data = _useHTableContext.data;
35
+ data = _useHTableContext.data,
36
+ tableInstance = _useHTableContext.tableInstance;
35
37
  var tableOnPageChange = onPageChange || contextOnPageChange;
36
38
  var _ref2 = data || {},
37
39
  size = _ref2.size,
@@ -49,11 +51,14 @@ var HTablePagination = (function (_ref) {
49
51
  return jsx(Fragment, {});
50
52
  }
51
53
  if (affixProps === false) {
52
- return jsx(Row, {
53
- justify: "end",
54
+ return jsxs(Row, {
55
+ justify: "space-between",
56
+ align: "middle",
54
57
  className: className,
55
58
  style: paginationStyle,
56
- children: jsx(Pagination, _objectSpread({
59
+ children: [jsx("div", {
60
+ children: actionRender === null || actionRender === void 0 ? void 0 : actionRender(tableInstance)
61
+ }), jsx(Pagination, _objectSpread({
57
62
  size: "small",
58
63
  showQuickJumper: true,
59
64
  pageSize: pageSize,
@@ -72,7 +77,7 @@ var HTablePagination = (function (_ref) {
72
77
  current: pn
73
78
  });
74
79
  }
75
- }, props))
80
+ }, props))]
76
81
  });
77
82
  }
78
83
  var _ref5 = affixProps || {},
@@ -93,10 +98,13 @@ var HTablePagination = (function (_ref) {
93
98
  }
94
99
  }, afProps), {}, {
95
100
  children: jsxs(Row, {
96
- justify: "end",
101
+ justify: "space-between",
97
102
  className: className,
103
+ align: "middle",
98
104
  style: _objectSpread(_objectSpread({}, paginationStyle), style),
99
- children: [jsx(Pagination, _objectSpread({
105
+ children: [jsx("div", {
106
+ children: actionRender === null || actionRender === void 0 ? void 0 : actionRender(tableInstance)
107
+ }), jsx(Pagination, _objectSpread({
100
108
  size: "small",
101
109
  showQuickJumper: true,
102
110
  pageSize: pageSize,
package/es/modal.d.ts CHANGED
@@ -70,6 +70,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "
70
70
  goTop?: boolean;
71
71
  optionsRender?: (node: React.ReactNode) => React.ReactNode;
72
72
  onFinish?: (value: any) => Promise<any>;
73
+ paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
73
74
  }
74
75
  export interface TableInstance {
75
76
  reload: (params?: ParamsModal) => Promise<any>;
@@ -16,6 +16,7 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
16
16
  affixProps?: AffixProps | false;
17
17
  goTop?: boolean;
18
18
  optionsRender?: (node: React.ReactNode) => React.ReactNode;
19
+ paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
19
20
  }
20
- declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, paginationStyle, headerTitle, options, actionRender, affixProps, goTop, size, optionsRender, ...props }: HTableBodyProps) => JSX.Element;
21
+ declare const _default: ({ configData, pagination, onPageChange, rowSelection, rowKey, emptyRender, errorRender, tableStyle, paginationStyle, headerTitle, options, actionRender, affixProps, goTop, size, optionsRender, paginationActionRender, ...props }: HTableBodyProps) => JSX.Element;
21
22
  export default _default;
@@ -25,7 +25,7 @@ var AlertMsg = require('./AlertMsg.js');
25
25
  var index = require('./Options/index.js');
26
26
  var index$2 = require('./HeaderTitle/index.js');
27
27
 
28
- var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender"];
28
+ var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle", "paginationStyle", "headerTitle", "options", "actionRender", "affixProps", "goTop", "size", "optionsRender", "paginationActionRender"];
29
29
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
30
30
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
31
31
  var defaultRender = function defaultRender() {
@@ -59,6 +59,7 @@ var Body = (function (_ref) {
59
59
  goTop = _ref$goTop === void 0 ? true : _ref$goTop,
60
60
  size = _ref.size,
61
61
  optionsRender = _ref.optionsRender,
62
+ paginationActionRender = _ref.paginationActionRender,
62
63
  props = _objectWithoutProperties(_ref, _excluded);
63
64
  var _ref2 = rowSelection || {},
64
65
  selectedRowKeys = _ref2.selectedRowKeys,
@@ -156,7 +157,8 @@ var Body = (function (_ref) {
156
157
  onPageChange: onPageChange,
157
158
  paginationStyle: paginationStyle,
158
159
  affixProps: affixProps,
159
- goTop: goTop
160
+ goTop: goTop,
161
+ actionRender: paginationActionRender
160
162
  }, pagination))]
161
163
  })]
162
164
  });
@@ -2,11 +2,13 @@ import type { PaginationProps } from "antd";
2
2
  import type { ParamsModal } from "../modal";
3
3
  import React from "react";
4
4
  import type { AffixProps } from "antd/lib/affix";
5
+ import { HTableInstance } from "../modal";
5
6
  export interface IPaginationProps extends PaginationProps {
6
7
  onPageChange?: (params: ParamsModal) => void;
7
8
  paginationStyle?: React.CSSProperties;
8
9
  affixProps?: AffixProps | false;
9
10
  goTop?: boolean;
11
+ actionRender?: (tableInstance: HTableInstance) => React.ReactNode;
10
12
  }
11
- declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, ...props }: IPaginationProps) => JSX.Element;
13
+ declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, ...props }: IPaginationProps) => JSX.Element;
12
14
  export default _default;
@@ -22,7 +22,7 @@ var index = require('../hooks/index.js');
22
22
  var React = require('react');
23
23
  var index$1 = require('../GoTop/index.js');
24
24
 
25
- var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop"],
25
+ var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender"],
26
26
  _excluded2 = ["offsetBottom"];
27
27
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
28
28
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context5, _context6; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(t), !0)).call(_context5, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context6 = ownKeys(Object(t))).call(_context6, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -31,10 +31,12 @@ var HTablePagination = (function (_ref) {
31
31
  paginationStyle = _ref.paginationStyle,
32
32
  affixProps = _ref.affixProps,
33
33
  goTop = _ref.goTop,
34
+ actionRender = _ref.actionRender,
34
35
  props = _objectWithoutProperties(_ref, _excluded);
35
36
  var _useHTableContext = context.useHTableContext(),
36
37
  contextOnPageChange = _useHTableContext.onPageChange,
37
- data = _useHTableContext.data;
38
+ data = _useHTableContext.data,
39
+ tableInstance = _useHTableContext.tableInstance;
38
40
  var tableOnPageChange = onPageChange || contextOnPageChange;
39
41
  var _ref2 = data || {},
40
42
  size = _ref2.size,
@@ -52,11 +54,14 @@ var HTablePagination = (function (_ref) {
52
54
  return jsxRuntime.jsx(jsxRuntime.Fragment, {});
53
55
  }
54
56
  if (affixProps === false) {
55
- return jsxRuntime.jsx(antd.Row, {
56
- justify: "end",
57
+ return jsxRuntime.jsxs(antd.Row, {
58
+ justify: "space-between",
59
+ align: "middle",
57
60
  className: className,
58
61
  style: paginationStyle,
59
- children: jsxRuntime.jsx(antd.Pagination, _objectSpread({
62
+ children: [jsxRuntime.jsx("div", {
63
+ children: actionRender === null || actionRender === void 0 ? void 0 : actionRender(tableInstance)
64
+ }), jsxRuntime.jsx(antd.Pagination, _objectSpread({
60
65
  size: "small",
61
66
  showQuickJumper: true,
62
67
  pageSize: pageSize,
@@ -75,7 +80,7 @@ var HTablePagination = (function (_ref) {
75
80
  current: pn
76
81
  });
77
82
  }
78
- }, props))
83
+ }, props))]
79
84
  });
80
85
  }
81
86
  var _ref5 = affixProps || {},
@@ -96,10 +101,13 @@ var HTablePagination = (function (_ref) {
96
101
  }
97
102
  }, afProps), {}, {
98
103
  children: jsxRuntime.jsxs(antd.Row, {
99
- justify: "end",
104
+ justify: "space-between",
100
105
  className: className,
106
+ align: "middle",
101
107
  style: _objectSpread(_objectSpread({}, paginationStyle), style),
102
- children: [jsxRuntime.jsx(antd.Pagination, _objectSpread({
108
+ children: [jsxRuntime.jsx("div", {
109
+ children: actionRender === null || actionRender === void 0 ? void 0 : actionRender(tableInstance)
110
+ }), jsxRuntime.jsx(antd.Pagination, _objectSpread({
103
111
  size: "small",
104
112
  showQuickJumper: true,
105
113
  pageSize: pageSize,
package/lib/modal.d.ts CHANGED
@@ -70,6 +70,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "
70
70
  goTop?: boolean;
71
71
  optionsRender?: (node: React.ReactNode) => React.ReactNode;
72
72
  onFinish?: (value: any) => Promise<any>;
73
+ paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
73
74
  }
74
75
  export interface TableInstance {
75
76
  reload: (params?: ParamsModal) => Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/table",
3
- "version": "0.0.9-beta-v6",
3
+ "version": "0.0.9-beta-v7",
4
4
  "description": "基于antd二次开发table组件",
5
5
  "keywords": [
6
6
  "table"
@@ -31,6 +31,8 @@ export interface HTableBodyProps
31
31
  affixProps?: AffixProps | false;
32
32
  goTop?: boolean;
33
33
  optionsRender?: (node: React.ReactNode) => React.ReactNode;
34
+ paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
35
+
34
36
  }
35
37
  const defaultRender = () => {
36
38
  return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
@@ -57,6 +59,7 @@ export default ({
57
59
  goTop = true,
58
60
  size,
59
61
  optionsRender,
62
+ paginationActionRender,
60
63
  ...props
61
64
  }: HTableBodyProps) => {
62
65
  // @ts-ignore
@@ -144,6 +147,7 @@ export default ({
144
147
  paginationStyle={paginationStyle}
145
148
  affixProps={affixProps}
146
149
  goTop={goTop}
150
+ actionRender={paginationActionRender}
147
151
  {...pagination}
148
152
  />
149
153
  )}
@@ -6,20 +6,23 @@ import { useClassName } from "../hooks";
6
6
  import React, { useState } from "react";
7
7
  import type { AffixProps } from "antd/lib/affix";
8
8
  import GoTop from "../GoTop";
9
+ import {HTableInstance} from "../modal";
9
10
  export interface IPaginationProps extends PaginationProps {
10
11
  onPageChange?: (params: ParamsModal) => void;
11
12
  paginationStyle?: React.CSSProperties;
12
13
  affixProps?: AffixProps | false;
13
14
  goTop?: boolean;
15
+ actionRender?: (tableInstance: HTableInstance) => React.ReactNode;
14
16
  }
15
17
  export default ({
16
18
  onPageChange,
17
19
  paginationStyle,
18
20
  affixProps,
19
21
  goTop,
22
+ actionRender,
20
23
  ...props
21
24
  }: IPaginationProps) => {
22
- const { onPageChange: contextOnPageChange, data } = useHTableContext();
25
+ const { onPageChange: contextOnPageChange, data,tableInstance } = useHTableContext();
23
26
  const tableOnPageChange = onPageChange || contextOnPageChange;
24
27
  const { size, current, total } = data || {};
25
28
  const pageCurrent = Number.parseInt(current || "1", 10);
@@ -32,7 +35,10 @@ export default ({
32
35
  }
33
36
  if (affixProps === false) {
34
37
  return (
35
- <Row justify={"end"} className={className} style={paginationStyle}>
38
+ <Row justify={"space-between"} align={"middle"} className={className} style={paginationStyle}>
39
+ <div>
40
+ {actionRender?.(tableInstance)}
41
+ </div>
36
42
  <Pagination
37
43
  size={"small"}
38
44
  showQuickJumper={true}
@@ -67,10 +73,14 @@ export default ({
67
73
  {...afProps}
68
74
  >
69
75
  <Row
70
- justify={"end"}
76
+ justify={"space-between"}
71
77
  className={className}
78
+ align={"middle"}
72
79
  style={{ ...paginationStyle, ...style }}
73
80
  >
81
+ <div>
82
+ {actionRender?.(tableInstance)}
83
+ </div>
74
84
  <Pagination
75
85
  size={"small"}
76
86
  showQuickJumper={true}
@@ -103,6 +103,7 @@ export interface HTableProps
103
103
  goTop?: boolean;
104
104
  optionsRender?: (node: React.ReactNode) => React.ReactNode;
105
105
  onFinish?: (value: any) => Promise<any>;
106
+ paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
106
107
  }
107
108
  export interface TableInstance {
108
109
  reload: (params?: ParamsModal) => Promise<any>;
@@ -80,6 +80,9 @@ export default () => {
80
80
  }}
81
81
  headerTitle={<Button type={"primary"}>操作</Button>}
82
82
  options={false}
83
+ paginationActionRender={()=>{
84
+ return <div>你大爷</div>
85
+ }}
83
86
  request={(params) => {
84
87
  console.log(params,".....");
85
88
  const { current = 1 } = params;