@hw-component/table 0.0.1-beta-v5 → 0.0.1-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.
@@ -1,5 +1,7 @@
1
1
  // welcome to hoo hoo hoo
2
2
  import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
3
+ import _Number$parseInt from '@babel/runtime-corejs3/core-js/number/parse-int';
4
+ import _Number$isNaN from '@babel/runtime-corejs3/core-js/number/is-nan';
3
5
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
4
6
  import { Typography, Card, Row, Space, Button, Affix } from 'antd';
5
7
  import { useHTableContext } from '../context.js';
@@ -14,13 +16,17 @@ var Footer = (function (_ref) {
14
16
  data = _useHTableContext.data,
15
17
  selectedRowData = _useHTableContext.selectedRowData,
16
18
  tableInstance = _useHTableContext.tableInstance;
19
+ _useHTableContext.error;
17
20
  var _useState = useState(false),
18
21
  _useState2 = _slicedToArray(_useState, 2),
19
22
  allCheck = _useState2[0],
20
23
  setAllCheck = _useState2[1];
21
24
  var _ref2 = data || {},
22
- total = _ref2.total;
23
- var num = allCheck ? total : 0;
25
+ _ref2$total = _ref2.total,
26
+ total = _ref2$total === void 0 ? "0" : _ref2$total;
27
+ var totalNum = _Number$parseInt(total, 10);
28
+ var showTotalNum = _Number$isNaN(totalNum) ? 0 : totalNum;
29
+ var num = allCheck ? showTotalNum : 0;
24
30
  if (footerRender) {
25
31
  return jsx(Fragment, {
26
32
  children: footerRender(tableInstance, selectedRowData, data)
@@ -38,6 +44,7 @@ var Footer = (function (_ref) {
38
44
  children: [jsx(Button, {
39
45
  type: "primary",
40
46
  ghost: true,
47
+ disabled: num == 0,
41
48
  style: {
42
49
  padding: "4px 24px",
43
50
  borderRadius: "4px"
package/es/modal.d.ts CHANGED
@@ -39,7 +39,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request"> {
39
39
  hideHeader?: boolean;
40
40
  }
41
41
  export interface TableInstance {
42
- reload: (params: ParamsModal) => void;
42
+ reload: (params?: ParamsModal) => void;
43
43
  setSelectedRowData: (keys: React.Key[], data: any) => void;
44
44
  }
45
45
  export interface HTableInstance {
@@ -3,6 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
6
+ var _Number$parseInt = require('@babel/runtime-corejs3/core-js/number/parse-int');
7
+ var _Number$isNaN = require('@babel/runtime-corejs3/core-js/number/is-nan');
6
8
  var jsxRuntime = require('react/jsx-runtime');
7
9
  var antd = require('antd');
8
10
  var context = require('../context.js');
@@ -17,13 +19,17 @@ var Footer = (function (_ref) {
17
19
  data = _useHTableContext.data,
18
20
  selectedRowData = _useHTableContext.selectedRowData,
19
21
  tableInstance = _useHTableContext.tableInstance;
22
+ _useHTableContext.error;
20
23
  var _useState = React.useState(false),
21
24
  _useState2 = _slicedToArray(_useState, 2),
22
25
  allCheck = _useState2[0],
23
26
  setAllCheck = _useState2[1];
24
27
  var _ref2 = data || {},
25
- total = _ref2.total;
26
- var num = allCheck ? total : 0;
28
+ _ref2$total = _ref2.total,
29
+ total = _ref2$total === void 0 ? "0" : _ref2$total;
30
+ var totalNum = _Number$parseInt(total, 10);
31
+ var showTotalNum = _Number$isNaN(totalNum) ? 0 : totalNum;
32
+ var num = allCheck ? showTotalNum : 0;
27
33
  if (footerRender) {
28
34
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
29
35
  children: footerRender(tableInstance, selectedRowData, data)
@@ -41,6 +47,7 @@ var Footer = (function (_ref) {
41
47
  children: [jsxRuntime.jsx(antd.Button, {
42
48
  type: "primary",
43
49
  ghost: true,
50
+ disabled: num == 0,
44
51
  style: {
45
52
  padding: "4px 24px",
46
53
  borderRadius: "4px"
package/lib/modal.d.ts CHANGED
@@ -39,7 +39,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request"> {
39
39
  hideHeader?: boolean;
40
40
  }
41
41
  export interface TableInstance {
42
- reload: (params: ParamsModal) => void;
42
+ reload: (params?: ParamsModal) => void;
43
43
  setSelectedRowData: (keys: React.Key[], data: any) => void;
44
44
  }
45
45
  export interface HTableInstance {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/table",
3
- "version": "0.0.1-beta-v5",
3
+ "version": "0.0.1-beta-v7",
4
4
  "description": "基于antd二次开发table组件",
5
5
  "keywords": [
6
6
  "table"
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@ant-design/pro-table": "2.70.0",
34
- "@hw-component/form": "0.0.9-beta-v8",
34
+ "@hw-component/form": "0.0.9-beta-v9",
35
35
  "ahooks": "2.10.9",
36
36
  "antd": "4.20.7",
37
37
  "core-js": "3",
@@ -15,10 +15,12 @@ interface IFooterProps {
15
15
  ) => React.ReactNode;
16
16
  }
17
17
  export default ({ actionRender, footerRender }: IFooterProps) => {
18
- const { data, selectedRowData, tableInstance } = useHTableContext();
18
+ const { data, selectedRowData, tableInstance,error } = useHTableContext();
19
19
  const [allCheck, setAllCheck] = useState<boolean>(false);
20
- const { total } = data || {};
21
- const num = allCheck ? total : 0;
20
+ const { total="0" } = data || {};
21
+ const totalNum=Number.parseInt(total,10);
22
+ const showTotalNum=Number.isNaN(totalNum)?0:totalNum;
23
+ const num = allCheck ? showTotalNum:0;
22
24
  if (footerRender) {
23
25
  return <>{footerRender(tableInstance, selectedRowData, data)}</>;
24
26
  }
@@ -29,6 +31,7 @@ export default ({ actionRender, footerRender }: IFooterProps) => {
29
31
  <Button
30
32
  type={"primary"}
31
33
  ghost
34
+ disabled={num==0}
32
35
  style={{ padding: "4px 24px", borderRadius: "4px" }}
33
36
  onClick={() => {
34
37
  setAllCheck(!allCheck);
@@ -59,7 +59,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request"> {
59
59
  hideHeader?: boolean;
60
60
  }
61
61
  export interface TableInstance {
62
- reload: (params: ParamsModal) => void;
62
+ reload: (params?: ParamsModal) => void;
63
63
  setSelectedRowData: (keys: React.Key[], data: any) => void;
64
64
  }
65
65
  export interface HTableInstance {