@hw-component/table 1.9.34 → 1.9.36
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/.eslintcache +1 -1
- package/es/HTableBody/index.d.ts +3 -1
- package/es/HTablePagination/index.d.ts +3 -2
- package/es/HTablePagination/index.js +31 -33
- package/es/modal.d.ts +3 -1
- package/es/render/Text.d.ts +0 -1
- package/es/render/config.d.ts +1 -1
- package/es/render/config.js +4 -0
- package/lib/HTableBody/index.d.ts +3 -1
- package/lib/HTablePagination/index.d.ts +3 -2
- package/lib/HTablePagination/index.js +31 -33
- package/lib/modal.d.ts +3 -1
- package/lib/render/Text.d.ts +0 -1
- package/lib/render/config.d.ts +1 -1
- package/lib/render/config.js +4 -0
- package/package.json +1 -1
- package/src/components/HTableBody/RowSelection.tsx +10 -16
- package/src/components/HTableBody/hooks.tsx +14 -11
- package/src/components/HTableBody/index.tsx +3 -2
- package/src/components/HTableHeader/defaultSubComponent.tsx +17 -15
- package/src/components/HTablePagination/index.tsx +9 -7
- package/src/components/Table.tsx +4 -4
- package/src/components/modal.ts +3 -1
- package/src/components/render/config.tsx +4 -0
- package/src/pages/ModalTable/index.tsx +9 -5
- package/src/pages/Table/index.tsx +8 -3
package/es/HTableBody/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { ProTableProps } from "@ant-design/pro-table";
|
|
2
2
|
import type { ActionRenderFn, ConfigDataModal, ParamsModal, HTableInstance, HRowSelection } from "../modal";
|
|
3
3
|
import React from "react";
|
|
4
|
+
import { IPaginationProps } from "../HTablePagination";
|
|
4
5
|
import type { AffixProps } from "antd/lib/affix";
|
|
5
6
|
import type { OptionConfig } from "@ant-design/pro-table/lib/components/ToolBar";
|
|
6
7
|
export interface OptionModal extends OptionConfig {
|
|
7
8
|
settingRender?: () => React.ReactNode;
|
|
8
9
|
}
|
|
9
|
-
export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource" | "rowSelection" | "options"> {
|
|
10
|
+
export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource" | "rowSelection" | "options" | "pagination"> {
|
|
10
11
|
configData?: ConfigDataModal;
|
|
11
12
|
onPageChange?: (params: ParamsModal) => void;
|
|
12
13
|
emptyRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
@@ -22,6 +23,7 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
|
|
|
22
23
|
localSorter?: boolean;
|
|
23
24
|
options?: OptionModal | false;
|
|
24
25
|
table?: HTableInstance;
|
|
26
|
+
pagination?: IPaginationProps | false;
|
|
25
27
|
}
|
|
26
28
|
declare const _default: (bodyProps: HTableBodyProps) => JSX.Element;
|
|
27
29
|
export default _default;
|
|
@@ -2,13 +2,14 @@ import type { PaginationProps } from "antd";
|
|
|
2
2
|
import type { ParamsModal, HTableInstance } from "../modal";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import type { AffixProps } from "antd/lib/affix";
|
|
5
|
-
export interface IPaginationProps extends PaginationProps {
|
|
5
|
+
export interface IPaginationProps extends Omit<PaginationProps, "showTotal"> {
|
|
6
6
|
onPageChange?: (params: ParamsModal) => void;
|
|
7
7
|
paginationStyle?: React.CSSProperties;
|
|
8
8
|
affixProps?: AffixProps | false;
|
|
9
9
|
goTop?: boolean;
|
|
10
10
|
actionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
11
11
|
table?: HTableInstance;
|
|
12
|
+
showTotal?: false | PaginationProps["showTotal"];
|
|
12
13
|
}
|
|
13
|
-
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, table, ...props }: IPaginationProps) => JSX.Element;
|
|
14
|
+
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, table, showTotal, ...props }: IPaginationProps) => JSX.Element;
|
|
14
15
|
export default _default;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
// welcome to hoo hoo hoo
|
|
2
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
5
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
6
|
+
import _Number$parseInt from '@babel/runtime-corejs3/core-js-stable/number/parse-int';
|
|
2
7
|
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
3
8
|
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
4
9
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
@@ -7,11 +12,6 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
|
|
|
7
12
|
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
8
13
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
9
14
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
10
|
-
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
11
|
-
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
12
|
-
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
13
|
-
import _Number$parseInt from '@babel/runtime-corejs3/core-js-stable/number/parse-int';
|
|
14
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
15
15
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
16
16
|
import { Row, Pagination, Affix } from 'antd';
|
|
17
17
|
import { useHTableContext } from '../context.js';
|
|
@@ -20,18 +20,27 @@ import { useState } from 'react';
|
|
|
20
20
|
import GoTop from '../GoTop/index.js';
|
|
21
21
|
import { useHTableConfigContext } from '../TableConfig.js';
|
|
22
22
|
|
|
23
|
-
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender", "table"],
|
|
23
|
+
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender", "table", "showTotal"],
|
|
24
24
|
_excluded2 = ["offsetBottom"];
|
|
25
25
|
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; }
|
|
26
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
27
|
+
var defaultShowTotal = function defaultShowTotal(totalNum, _ref) {
|
|
28
|
+
var _context, _context2;
|
|
29
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
30
|
+
showCurrent = _ref2[0],
|
|
31
|
+
showCurrentEnd = _ref2[1];
|
|
32
|
+
return _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "\u7B2C".concat(showCurrent, "-")).call(_context2, showCurrentEnd, "/\u603B\u5171")).call(_context, totalNum, "\u6761");
|
|
33
|
+
};
|
|
34
|
+
var HTablePagination = (function (_ref3) {
|
|
35
|
+
var onPageChange = _ref3.onPageChange,
|
|
36
|
+
paginationStyle = _ref3.paginationStyle,
|
|
37
|
+
affixProps = _ref3.affixProps,
|
|
38
|
+
goTop = _ref3.goTop,
|
|
39
|
+
actionRender = _ref3.actionRender,
|
|
40
|
+
table = _ref3.table,
|
|
41
|
+
_ref3$showTotal = _ref3.showTotal,
|
|
42
|
+
showTotal = _ref3$showTotal === void 0 ? defaultShowTotal : _ref3$showTotal,
|
|
43
|
+
props = _objectWithoutProperties(_ref3, _excluded);
|
|
35
44
|
var _useHTableContext = useHTableContext(),
|
|
36
45
|
contextOnPageChange = _useHTableContext.onPageChange,
|
|
37
46
|
data = _useHTableContext.data,
|
|
@@ -42,10 +51,10 @@ var HTablePagination = (function (_ref) {
|
|
|
42
51
|
defaultPaginationStyle = _useHTableConfigConte.paginationStyle;
|
|
43
52
|
var tableInstance = table || contextTableInstance;
|
|
44
53
|
var tableOnPageChange = onPageChange || contextOnPageChange;
|
|
45
|
-
var
|
|
46
|
-
size =
|
|
47
|
-
current =
|
|
48
|
-
total =
|
|
54
|
+
var _ref4 = data || {},
|
|
55
|
+
size = _ref4.size,
|
|
56
|
+
current = _ref4.current,
|
|
57
|
+
total = _ref4.total;
|
|
49
58
|
var pageCurrent = _Number$parseInt(current || "1", 10);
|
|
50
59
|
var pageSize = _Number$parseInt(size || "10", 10);
|
|
51
60
|
var pageTotal = _Number$parseInt(total || "0", 10);
|
|
@@ -54,6 +63,7 @@ var HTablePagination = (function (_ref) {
|
|
|
54
63
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
64
|
style = _useState2[0],
|
|
56
65
|
setStyle = _useState2[1];
|
|
66
|
+
var cuShowTotal = showTotal === false ? undefined : showTotal;
|
|
57
67
|
if (!data) {
|
|
58
68
|
return jsx(Fragment, {});
|
|
59
69
|
}
|
|
@@ -70,13 +80,7 @@ var HTablePagination = (function (_ref) {
|
|
|
70
80
|
showQuickJumper: true,
|
|
71
81
|
pageSize: pageSize,
|
|
72
82
|
current: pageCurrent,
|
|
73
|
-
showTotal:
|
|
74
|
-
var _context, _context2;
|
|
75
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
76
|
-
showCurrent = _ref4[0],
|
|
77
|
-
showCurrentEnd = _ref4[1];
|
|
78
|
-
return _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "\u7B2C".concat(showCurrent, "-")).call(_context2, showCurrentEnd, "/\u603B\u5171")).call(_context, totalNum, "\u6761");
|
|
79
|
-
},
|
|
83
|
+
showTotal: cuShowTotal,
|
|
80
84
|
total: pageTotal,
|
|
81
85
|
onChange: function onChange(pn, ps) {
|
|
82
86
|
tableOnPageChange({
|
|
@@ -116,13 +120,7 @@ var HTablePagination = (function (_ref) {
|
|
|
116
120
|
showQuickJumper: true,
|
|
117
121
|
pageSize: pageSize,
|
|
118
122
|
current: pageCurrent,
|
|
119
|
-
showTotal:
|
|
120
|
-
var _context3, _context4;
|
|
121
|
-
var _ref7 = _slicedToArray(_ref6, 2),
|
|
122
|
-
showCurrent = _ref7[0],
|
|
123
|
-
showCurrentEnd = _ref7[1];
|
|
124
|
-
return _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = "\u7B2C".concat(showCurrent, "-")).call(_context4, showCurrentEnd, "/\u603B\u5171")).call(_context3, totalNum, "\u6761");
|
|
125
|
-
},
|
|
123
|
+
showTotal: cuShowTotal,
|
|
126
124
|
total: pageTotal,
|
|
127
125
|
onChange: function onChange(pn, ps) {
|
|
128
126
|
tableOnPageChange({
|
package/es/modal.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { TableProps } from "antd/lib/table";
|
|
|
8
8
|
import type { AffixProps } from "antd/lib/affix";
|
|
9
9
|
import type { OptionModal } from "./HTableBody";
|
|
10
10
|
import type { DrawerProps } from "antd";
|
|
11
|
+
import type { IPaginationProps } from "@/components/HTablePagination";
|
|
11
12
|
export interface RowObj {
|
|
12
13
|
keys?: React.Key[];
|
|
13
14
|
rowData?: any[];
|
|
@@ -47,7 +48,7 @@ export interface RowSelectionOuter {
|
|
|
47
48
|
export type HRowSelection = RowSelectionOuter & (TableProps<any>["rowSelection"] & {
|
|
48
49
|
alwaysShowAlert?: boolean;
|
|
49
50
|
});
|
|
50
|
-
export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "dataSource" | "rowSelection"> {
|
|
51
|
+
export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "dataSource" | "rowSelection" | "pagination"> {
|
|
51
52
|
request?: (params: ParamsModal) => Promise<ResultModal>;
|
|
52
53
|
configData: ConfigDataModal;
|
|
53
54
|
searchSpan?: ColProps;
|
|
@@ -79,6 +80,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "
|
|
|
79
80
|
labelWidth?: number;
|
|
80
81
|
hideLabel?: boolean;
|
|
81
82
|
options?: OptionModal | false;
|
|
83
|
+
pagination?: IPaginationProps;
|
|
82
84
|
}
|
|
83
85
|
interface ColCheckResultKeys {
|
|
84
86
|
keys?: string[];
|
package/es/render/Text.d.ts
CHANGED
package/es/render/config.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const _default: {
|
|
|
5
5
|
date: (config: ConfigItemModal, itemData: any) => string;
|
|
6
6
|
tags: (config: ConfigItemModal, itemData: any, index: number, tableInstance: HTableInstance) => "-" | JSX.Element;
|
|
7
7
|
copy: (config: ConfigItemModal, itemData: any) => "-" | JSX.Element;
|
|
8
|
-
link: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
|
8
|
+
link: (config: ConfigItemModal, itemData: any) => "-" | JSX.Element;
|
|
9
9
|
text: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
|
10
10
|
image: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
|
11
11
|
avatar: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
package/es/render/config.js
CHANGED
|
@@ -86,6 +86,10 @@ var linkRender = function linkRender(config, itemData) {
|
|
|
86
86
|
if (typeof href === "function") {
|
|
87
87
|
hrefUrl = href(itemData);
|
|
88
88
|
}
|
|
89
|
+
var relUrl = hrefUrl || tableVal;
|
|
90
|
+
if (!relUrl) {
|
|
91
|
+
return "-";
|
|
92
|
+
}
|
|
89
93
|
return jsx(Link, {
|
|
90
94
|
href: hrefUrl || tableVal,
|
|
91
95
|
target: target,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { ProTableProps } from "@ant-design/pro-table";
|
|
2
2
|
import type { ActionRenderFn, ConfigDataModal, ParamsModal, HTableInstance, HRowSelection } from "../modal";
|
|
3
3
|
import React from "react";
|
|
4
|
+
import { IPaginationProps } from "../HTablePagination";
|
|
4
5
|
import type { AffixProps } from "antd/lib/affix";
|
|
5
6
|
import type { OptionConfig } from "@ant-design/pro-table/lib/components/ToolBar";
|
|
6
7
|
export interface OptionModal extends OptionConfig {
|
|
7
8
|
settingRender?: () => React.ReactNode;
|
|
8
9
|
}
|
|
9
|
-
export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource" | "rowSelection" | "options"> {
|
|
10
|
+
export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource" | "rowSelection" | "options" | "pagination"> {
|
|
10
11
|
configData?: ConfigDataModal;
|
|
11
12
|
onPageChange?: (params: ParamsModal) => void;
|
|
12
13
|
emptyRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
@@ -22,6 +23,7 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
|
|
|
22
23
|
localSorter?: boolean;
|
|
23
24
|
options?: OptionModal | false;
|
|
24
25
|
table?: HTableInstance;
|
|
26
|
+
pagination?: IPaginationProps | false;
|
|
25
27
|
}
|
|
26
28
|
declare const _default: (bodyProps: HTableBodyProps) => JSX.Element;
|
|
27
29
|
export default _default;
|
|
@@ -2,13 +2,14 @@ import type { PaginationProps } from "antd";
|
|
|
2
2
|
import type { ParamsModal, HTableInstance } from "../modal";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import type { AffixProps } from "antd/lib/affix";
|
|
5
|
-
export interface IPaginationProps extends PaginationProps {
|
|
5
|
+
export interface IPaginationProps extends Omit<PaginationProps, "showTotal"> {
|
|
6
6
|
onPageChange?: (params: ParamsModal) => void;
|
|
7
7
|
paginationStyle?: React.CSSProperties;
|
|
8
8
|
affixProps?: AffixProps | false;
|
|
9
9
|
goTop?: boolean;
|
|
10
10
|
actionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
11
11
|
table?: HTableInstance;
|
|
12
|
+
showTotal?: false | PaginationProps["showTotal"];
|
|
12
13
|
}
|
|
13
|
-
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, table, ...props }: IPaginationProps) => JSX.Element;
|
|
14
|
+
declare const _default: ({ onPageChange, paginationStyle, affixProps, goTop, actionRender, table, showTotal, ...props }: IPaginationProps) => JSX.Element;
|
|
14
15
|
export default _default;
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
8
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
9
|
+
var _Number$parseInt = require('@babel/runtime-corejs3/core-js-stable/number/parse-int');
|
|
5
10
|
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
6
11
|
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
7
12
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
@@ -10,11 +15,6 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
10
15
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
11
16
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
12
17
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
|
-
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
|
-
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
15
|
-
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
16
|
-
var _Number$parseInt = require('@babel/runtime-corejs3/core-js-stable/number/parse-int');
|
|
17
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
18
18
|
var jsxRuntime = require('react/jsx-runtime');
|
|
19
19
|
var antd = require('antd');
|
|
20
20
|
var context = require('../context.js');
|
|
@@ -23,18 +23,27 @@ var React = require('react');
|
|
|
23
23
|
var index$1 = require('../GoTop/index.js');
|
|
24
24
|
var TableConfig = require('../TableConfig.js');
|
|
25
25
|
|
|
26
|
-
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender", "table"],
|
|
26
|
+
var _excluded = ["onPageChange", "paginationStyle", "affixProps", "goTop", "actionRender", "table", "showTotal"],
|
|
27
27
|
_excluded2 = ["offsetBottom"];
|
|
28
28
|
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; }
|
|
29
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
30
|
+
var defaultShowTotal = function defaultShowTotal(totalNum, _ref) {
|
|
31
|
+
var _context, _context2;
|
|
32
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
33
|
+
showCurrent = _ref2[0],
|
|
34
|
+
showCurrentEnd = _ref2[1];
|
|
35
|
+
return _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "\u7B2C".concat(showCurrent, "-")).call(_context2, showCurrentEnd, "/\u603B\u5171")).call(_context, totalNum, "\u6761");
|
|
36
|
+
};
|
|
37
|
+
var HTablePagination = (function (_ref3) {
|
|
38
|
+
var onPageChange = _ref3.onPageChange,
|
|
39
|
+
paginationStyle = _ref3.paginationStyle,
|
|
40
|
+
affixProps = _ref3.affixProps,
|
|
41
|
+
goTop = _ref3.goTop,
|
|
42
|
+
actionRender = _ref3.actionRender,
|
|
43
|
+
table = _ref3.table,
|
|
44
|
+
_ref3$showTotal = _ref3.showTotal,
|
|
45
|
+
showTotal = _ref3$showTotal === void 0 ? defaultShowTotal : _ref3$showTotal,
|
|
46
|
+
props = _objectWithoutProperties(_ref3, _excluded);
|
|
38
47
|
var _useHTableContext = context.useHTableContext(),
|
|
39
48
|
contextOnPageChange = _useHTableContext.onPageChange,
|
|
40
49
|
data = _useHTableContext.data,
|
|
@@ -45,10 +54,10 @@ var HTablePagination = (function (_ref) {
|
|
|
45
54
|
defaultPaginationStyle = _useHTableConfigConte.paginationStyle;
|
|
46
55
|
var tableInstance = table || contextTableInstance;
|
|
47
56
|
var tableOnPageChange = onPageChange || contextOnPageChange;
|
|
48
|
-
var
|
|
49
|
-
size =
|
|
50
|
-
current =
|
|
51
|
-
total =
|
|
57
|
+
var _ref4 = data || {},
|
|
58
|
+
size = _ref4.size,
|
|
59
|
+
current = _ref4.current,
|
|
60
|
+
total = _ref4.total;
|
|
52
61
|
var pageCurrent = _Number$parseInt(current || "1", 10);
|
|
53
62
|
var pageSize = _Number$parseInt(size || "10", 10);
|
|
54
63
|
var pageTotal = _Number$parseInt(total || "0", 10);
|
|
@@ -57,6 +66,7 @@ var HTablePagination = (function (_ref) {
|
|
|
57
66
|
_useState2 = _slicedToArray(_useState, 2),
|
|
58
67
|
style = _useState2[0],
|
|
59
68
|
setStyle = _useState2[1];
|
|
69
|
+
var cuShowTotal = showTotal === false ? undefined : showTotal;
|
|
60
70
|
if (!data) {
|
|
61
71
|
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
62
72
|
}
|
|
@@ -73,13 +83,7 @@ var HTablePagination = (function (_ref) {
|
|
|
73
83
|
showQuickJumper: true,
|
|
74
84
|
pageSize: pageSize,
|
|
75
85
|
current: pageCurrent,
|
|
76
|
-
showTotal:
|
|
77
|
-
var _context, _context2;
|
|
78
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
79
|
-
showCurrent = _ref4[0],
|
|
80
|
-
showCurrentEnd = _ref4[1];
|
|
81
|
-
return _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "\u7B2C".concat(showCurrent, "-")).call(_context2, showCurrentEnd, "/\u603B\u5171")).call(_context, totalNum, "\u6761");
|
|
82
|
-
},
|
|
86
|
+
showTotal: cuShowTotal,
|
|
83
87
|
total: pageTotal,
|
|
84
88
|
onChange: function onChange(pn, ps) {
|
|
85
89
|
tableOnPageChange({
|
|
@@ -119,13 +123,7 @@ var HTablePagination = (function (_ref) {
|
|
|
119
123
|
showQuickJumper: true,
|
|
120
124
|
pageSize: pageSize,
|
|
121
125
|
current: pageCurrent,
|
|
122
|
-
showTotal:
|
|
123
|
-
var _context3, _context4;
|
|
124
|
-
var _ref7 = _slicedToArray(_ref6, 2),
|
|
125
|
-
showCurrent = _ref7[0],
|
|
126
|
-
showCurrentEnd = _ref7[1];
|
|
127
|
-
return _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = "\u7B2C".concat(showCurrent, "-")).call(_context4, showCurrentEnd, "/\u603B\u5171")).call(_context3, totalNum, "\u6761");
|
|
128
|
-
},
|
|
126
|
+
showTotal: cuShowTotal,
|
|
129
127
|
total: pageTotal,
|
|
130
128
|
onChange: function onChange(pn, ps) {
|
|
131
129
|
tableOnPageChange({
|
package/lib/modal.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { TableProps } from "antd/lib/table";
|
|
|
8
8
|
import type { AffixProps } from "antd/lib/affix";
|
|
9
9
|
import type { OptionModal } from "./HTableBody";
|
|
10
10
|
import type { DrawerProps } from "antd";
|
|
11
|
+
import type { IPaginationProps } from "@/components/HTablePagination";
|
|
11
12
|
export interface RowObj {
|
|
12
13
|
keys?: React.Key[];
|
|
13
14
|
rowData?: any[];
|
|
@@ -47,7 +48,7 @@ export interface RowSelectionOuter {
|
|
|
47
48
|
export type HRowSelection = RowSelectionOuter & (TableProps<any>["rowSelection"] & {
|
|
48
49
|
alwaysShowAlert?: boolean;
|
|
49
50
|
});
|
|
50
|
-
export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "dataSource" | "rowSelection"> {
|
|
51
|
+
export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "dataSource" | "rowSelection" | "pagination"> {
|
|
51
52
|
request?: (params: ParamsModal) => Promise<ResultModal>;
|
|
52
53
|
configData: ConfigDataModal;
|
|
53
54
|
searchSpan?: ColProps;
|
|
@@ -79,6 +80,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "
|
|
|
79
80
|
labelWidth?: number;
|
|
80
81
|
hideLabel?: boolean;
|
|
81
82
|
options?: OptionModal | false;
|
|
83
|
+
pagination?: IPaginationProps;
|
|
82
84
|
}
|
|
83
85
|
interface ColCheckResultKeys {
|
|
84
86
|
keys?: string[];
|
package/lib/render/Text.d.ts
CHANGED
package/lib/render/config.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const _default: {
|
|
|
5
5
|
date: (config: ConfigItemModal, itemData: any) => string;
|
|
6
6
|
tags: (config: ConfigItemModal, itemData: any, index: number, tableInstance: HTableInstance) => "-" | JSX.Element;
|
|
7
7
|
copy: (config: ConfigItemModal, itemData: any) => "-" | JSX.Element;
|
|
8
|
-
link: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
|
8
|
+
link: (config: ConfigItemModal, itemData: any) => "-" | JSX.Element;
|
|
9
9
|
text: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
|
10
10
|
image: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
|
11
11
|
avatar: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
package/lib/render/config.js
CHANGED
|
@@ -89,6 +89,10 @@ var linkRender = function linkRender(config, itemData) {
|
|
|
89
89
|
if (typeof href === "function") {
|
|
90
90
|
hrefUrl = href(itemData);
|
|
91
91
|
}
|
|
92
|
+
var relUrl = hrefUrl || tableVal;
|
|
93
|
+
if (!relUrl) {
|
|
94
|
+
return "-";
|
|
95
|
+
}
|
|
92
96
|
return jsxRuntime.jsx(Link, {
|
|
93
97
|
href: hrefUrl || tableVal,
|
|
94
98
|
target: target,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useHTableContext } from "../context";
|
|
2
2
|
import { Checkbox, Dropdown, Menu } from "antd";
|
|
3
|
-
import {useEffect, useMemo} from "react";
|
|
3
|
+
import { useEffect, useMemo } from "react";
|
|
4
4
|
import type { HRowSelection } from "../modal";
|
|
5
5
|
export const RowSelectionTitle = ({
|
|
6
6
|
allPageCheck = true,
|
|
@@ -119,38 +119,32 @@ export const RowSelectionBox = ({
|
|
|
119
119
|
const { selectedRowData, rowOnChange, rowKey = "id" } = useHTableContext();
|
|
120
120
|
const { rowData = [], keys = [] } = selectedRowData;
|
|
121
121
|
const key = typeof rowKey === "function" ? rowKey(data, index) : data[rowKey];
|
|
122
|
-
const add=()=>{
|
|
122
|
+
const add = () => {
|
|
123
123
|
const newKeys = [...keys];
|
|
124
124
|
const newRowData = [...rowData];
|
|
125
125
|
newKeys.push(key);
|
|
126
126
|
newRowData.push(data);
|
|
127
127
|
rowOnChange(newKeys, newRowData);
|
|
128
128
|
onChange?.(newKeys, newRowData);
|
|
129
|
-
}
|
|
130
|
-
const cancel=()=>{
|
|
129
|
+
};
|
|
130
|
+
const cancel = () => {
|
|
131
131
|
const newKeys = [...keys];
|
|
132
|
-
const newRowData=[...rowData];
|
|
132
|
+
const newRowData = [...rowData];
|
|
133
133
|
const keyIndex = newKeys.indexOf(key);
|
|
134
134
|
newKeys.splice(keyIndex, 1);
|
|
135
|
-
newRowData.splice(keyIndex,1);
|
|
135
|
+
newRowData.splice(keyIndex, 1);
|
|
136
136
|
rowOnChange(newKeys, newRowData);
|
|
137
137
|
onChange?.(newKeys, newRowData);
|
|
138
|
-
}
|
|
138
|
+
};
|
|
139
139
|
const check = (e) => {
|
|
140
140
|
const checked = e.target.checked;
|
|
141
141
|
if (checked) {
|
|
142
142
|
add();
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
cancel()
|
|
145
|
+
cancel();
|
|
146
146
|
};
|
|
147
147
|
const { disabled = false } = getCheckboxProps?.(data) || {};
|
|
148
|
-
const checked=keys.indexOf(key) !== -1;
|
|
149
|
-
return
|
|
150
|
-
<Checkbox
|
|
151
|
-
checked={checked}
|
|
152
|
-
onChange={check}
|
|
153
|
-
disabled={disabled}
|
|
154
|
-
/>
|
|
155
|
-
);
|
|
148
|
+
const checked = keys.indexOf(key) !== -1;
|
|
149
|
+
return <Checkbox checked={checked} onChange={check} disabled={disabled} />;
|
|
156
150
|
};
|
|
@@ -90,19 +90,22 @@ export const useSynchronousKeys = ({
|
|
|
90
90
|
rowKey,
|
|
91
91
|
}: FilterKeysModal) => {
|
|
92
92
|
const { rowOnChange } = useHTableContext();
|
|
93
|
-
const findId=(key)=>{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
const findId = (key) => {
|
|
94
|
+
const msRecords = records as any[];
|
|
95
|
+
const rowIndex = msRecords.findIndex((item, index) => {
|
|
96
|
+
const id =
|
|
97
|
+
typeof rowKey === "function"
|
|
98
|
+
? rowKey(item, index)
|
|
99
|
+
: item[rowKey as string];
|
|
100
|
+
return id === key;
|
|
101
|
+
});
|
|
102
|
+
return msRecords[rowIndex];
|
|
103
|
+
};
|
|
101
104
|
useEffect(() => {
|
|
102
105
|
if (selectedRowKeys && records && rowKey) {
|
|
103
|
-
const resultData= selectedRowKeys.map((key)=>{
|
|
104
|
-
|
|
105
|
-
})
|
|
106
|
+
const resultData = selectedRowKeys.map((key) => {
|
|
107
|
+
return findId(key);
|
|
108
|
+
});
|
|
106
109
|
rowOnChange(selectedRowKeys, resultData);
|
|
107
110
|
}
|
|
108
111
|
}, [selectedRowKeys, records, rowKey]);
|
|
@@ -17,7 +17,7 @@ import { useHTableContext } from "../context";
|
|
|
17
17
|
import React from "react";
|
|
18
18
|
import { ConfigProvider, Empty, Alert, Space } from "antd";
|
|
19
19
|
import { useHTableConfigContext } from "../TableConfig";
|
|
20
|
-
import HTablePagination from "../HTablePagination";
|
|
20
|
+
import HTablePagination, {IPaginationProps} from "../HTablePagination";
|
|
21
21
|
import { useClassName } from "../hooks";
|
|
22
22
|
import AlertMsg from "./AlertMsg";
|
|
23
23
|
import type { AffixProps } from "antd/lib/affix";
|
|
@@ -31,7 +31,7 @@ export interface OptionModal extends OptionConfig {
|
|
|
31
31
|
export interface HTableBodyProps
|
|
32
32
|
extends Omit<
|
|
33
33
|
ProTableProps<any, any>,
|
|
34
|
-
"dataSource" | "rowSelection" | "options"
|
|
34
|
+
"dataSource" | "rowSelection" | "options"|"pagination"
|
|
35
35
|
> {
|
|
36
36
|
configData?: ConfigDataModal;
|
|
37
37
|
onPageChange?: (params: ParamsModal) => void;
|
|
@@ -51,6 +51,7 @@ export interface HTableBodyProps
|
|
|
51
51
|
localSorter?: boolean;
|
|
52
52
|
options?: OptionModal | false;
|
|
53
53
|
table?: HTableInstance;
|
|
54
|
+
pagination?:IPaginationProps|false;
|
|
54
55
|
}
|
|
55
56
|
const defaultRender = () => {
|
|
56
57
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
|
@@ -7,7 +7,7 @@ import type { RowProps } from "antd/lib/grid/row";
|
|
|
7
7
|
import { useHeaderContext } from "./Context";
|
|
8
8
|
interface IProps {
|
|
9
9
|
form: HFormInstance;
|
|
10
|
-
render?:(node:React.ReactNode[])=>React.ReactNode;
|
|
10
|
+
render?: (node: React.ReactNode[]) => React.ReactNode;
|
|
11
11
|
}
|
|
12
12
|
const OpenComponent = () => {
|
|
13
13
|
const { headerOpen, setHeaderOpen } = useHTableContext();
|
|
@@ -35,7 +35,7 @@ const OpenComponent = () => {
|
|
|
35
35
|
</>
|
|
36
36
|
);
|
|
37
37
|
};
|
|
38
|
-
export const DefaultSubComponent = ({ form
|
|
38
|
+
export const DefaultSubComponent = ({ form, render }: IProps) => {
|
|
39
39
|
const { loading, headerOpen } = useHTableContext();
|
|
40
40
|
const { onReset } = useHeaderContext();
|
|
41
41
|
const hide = typeof headerOpen === "undefined";
|
|
@@ -53,17 +53,20 @@ export const DefaultSubComponent = ({ form ,render}: IProps) => {
|
|
|
53
53
|
style: {},
|
|
54
54
|
};
|
|
55
55
|
}, [headerOpen, hide]);
|
|
56
|
-
const subBtn=
|
|
56
|
+
const subBtn = (
|
|
57
|
+
<Button
|
|
57
58
|
type={"primary"}
|
|
58
59
|
style={{ borderRadius: 4 }}
|
|
59
60
|
loading={loading}
|
|
60
61
|
onClick={() => {
|
|
61
62
|
form.submit();
|
|
62
63
|
}}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
>
|
|
65
|
+
查询
|
|
66
|
+
</Button>
|
|
67
|
+
);
|
|
68
|
+
const resetBtn = (
|
|
69
|
+
<Button
|
|
67
70
|
style={{ borderRadius: 4 }}
|
|
68
71
|
onClick={() => {
|
|
69
72
|
if (onReset) {
|
|
@@ -72,14 +75,13 @@ export const DefaultSubComponent = ({ form ,render}: IProps) => {
|
|
|
72
75
|
}
|
|
73
76
|
form.resetFieldsInitValue();
|
|
74
77
|
}}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</>
|
|
78
|
+
>
|
|
79
|
+
重置
|
|
80
|
+
</Button>
|
|
81
|
+
);
|
|
82
|
+
const showMoreBtn = hide ? null : <OpenComponent />;
|
|
83
|
+
if (render) {
|
|
84
|
+
return <>{render([subBtn, resetBtn, showMoreBtn])}</>;
|
|
83
85
|
}
|
|
84
86
|
return (
|
|
85
87
|
<Row
|