@hw-component/table 0.0.1-beta-v9 → 0.0.2-beta-v2
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/es/Body/index.js +1 -0
- package/es/Footer/index.js +1 -0
- package/es/Header/index.d.ts +1 -1
- package/es/Header/index.js +1 -0
- package/es/Table.d.ts +1 -1
- package/es/Table.js +3 -1
- package/es/modal.d.ts +1 -0
- package/lib/Body/index.js +1 -0
- package/lib/Footer/index.js +1 -0
- package/lib/Header/index.d.ts +1 -1
- package/lib/Header/index.js +1 -0
- package/lib/Table.d.ts +1 -1
- package/lib/Table.js +3 -1
- package/lib/modal.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/Body/index.tsx +6 -3
- package/src/components/Footer/index.tsx +7 -4
- package/src/components/Header/index.tsx +4 -3
- package/src/components/Table.tsx +16 -6
- package/src/components/modal.ts +5 -4
- package/src/pages/Test/index.tsx +3 -3
package/es/Body/index.js
CHANGED
package/es/Footer/index.js
CHANGED
package/es/Header/index.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ interface IHeaderProps {
|
|
|
8
8
|
loading?: boolean;
|
|
9
9
|
headerStyle?: React.CSSProperties;
|
|
10
10
|
}
|
|
11
|
-
declare const _default: ({ configData, onFinish, searchSpan, loading, headerStyle }: IHeaderProps) => JSX.Element;
|
|
11
|
+
declare const _default: ({ configData, onFinish, searchSpan, loading, headerStyle, }: IHeaderProps) => JSX.Element;
|
|
12
12
|
export default _default;
|
package/es/Header/index.js
CHANGED
package/es/Table.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { HTableProps } from "./modal";
|
|
2
|
-
declare const _default: ({ request, configData, searchSpan, table, actionRender, footerRender, hideHeader, headerStyle, footerStyle, tableStyle, action, spaceSize, ...props }: HTableProps) => JSX.Element;
|
|
2
|
+
declare const _default: ({ request, configData, searchSpan, table, actionRender, footerRender, hideHeader, headerStyle, footerStyle, tableStyle, action, spaceSize, className, ...props }: HTableProps) => JSX.Element;
|
|
3
3
|
export default _default;
|
package/es/Table.js
CHANGED
|
@@ -20,7 +20,7 @@ import useRowObj from './hooks/useRowObj.js';
|
|
|
20
20
|
import { HTableContext } from './context.js';
|
|
21
21
|
import { Space } from 'antd';
|
|
22
22
|
|
|
23
|
-
var _excluded = ["request", "configData", "searchSpan", "table", "actionRender", "footerRender", "hideHeader", "headerStyle", "footerStyle", "tableStyle", "action", "spaceSize"],
|
|
23
|
+
var _excluded = ["request", "configData", "searchSpan", "table", "actionRender", "footerRender", "hideHeader", "headerStyle", "footerStyle", "tableStyle", "action", "spaceSize", "className"],
|
|
24
24
|
_excluded2 = ["size", "current"];
|
|
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
26
|
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; }
|
|
@@ -42,6 +42,7 @@ var Table = (function (_ref) {
|
|
|
42
42
|
action = _ref$action === void 0 ? {} : _ref$action,
|
|
43
43
|
_ref$spaceSize = _ref.spaceSize,
|
|
44
44
|
spaceSize = _ref$spaceSize === void 0 ? 20 : _ref$spaceSize,
|
|
45
|
+
className = _ref.className,
|
|
45
46
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
46
47
|
var saveParams = useMemo(function () {
|
|
47
48
|
return {
|
|
@@ -96,6 +97,7 @@ var Table = (function (_ref) {
|
|
|
96
97
|
style: {
|
|
97
98
|
width: "100%"
|
|
98
99
|
},
|
|
100
|
+
className: className,
|
|
99
101
|
children: [!hideHeader && jsx(Header, {
|
|
100
102
|
configData: configData,
|
|
101
103
|
onFinish: run,
|
package/es/modal.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request"> {
|
|
|
43
43
|
tableStyle?: React.CSSProperties;
|
|
44
44
|
footerStyle?: React.CSSProperties;
|
|
45
45
|
spaceSize?: number;
|
|
46
|
+
className?: string;
|
|
46
47
|
}
|
|
47
48
|
export interface TableInstance {
|
|
48
49
|
reload: (params?: ParamsModal) => void;
|
package/lib/Body/index.js
CHANGED
package/lib/Footer/index.js
CHANGED
package/lib/Header/index.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ interface IHeaderProps {
|
|
|
8
8
|
loading?: boolean;
|
|
9
9
|
headerStyle?: React.CSSProperties;
|
|
10
10
|
}
|
|
11
|
-
declare const _default: ({ configData, onFinish, searchSpan, loading, headerStyle }: IHeaderProps) => JSX.Element;
|
|
11
|
+
declare const _default: ({ configData, onFinish, searchSpan, loading, headerStyle, }: IHeaderProps) => JSX.Element;
|
|
12
12
|
export default _default;
|
package/lib/Header/index.js
CHANGED
package/lib/Table.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { HTableProps } from "./modal";
|
|
2
|
-
declare const _default: ({ request, configData, searchSpan, table, actionRender, footerRender, hideHeader, headerStyle, footerStyle, tableStyle, action, spaceSize, ...props }: HTableProps) => JSX.Element;
|
|
2
|
+
declare const _default: ({ request, configData, searchSpan, table, actionRender, footerRender, hideHeader, headerStyle, footerStyle, tableStyle, action, spaceSize, className, ...props }: HTableProps) => JSX.Element;
|
|
3
3
|
export default _default;
|
package/lib/Table.js
CHANGED
|
@@ -23,7 +23,7 @@ var useRowObj = require('./hooks/useRowObj.js');
|
|
|
23
23
|
var context = require('./context.js');
|
|
24
24
|
var antd = require('antd');
|
|
25
25
|
|
|
26
|
-
var _excluded = ["request", "configData", "searchSpan", "table", "actionRender", "footerRender", "hideHeader", "headerStyle", "footerStyle", "tableStyle", "action", "spaceSize"],
|
|
26
|
+
var _excluded = ["request", "configData", "searchSpan", "table", "actionRender", "footerRender", "hideHeader", "headerStyle", "footerStyle", "tableStyle", "action", "spaceSize", "className"],
|
|
27
27
|
_excluded2 = ["size", "current"];
|
|
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
29
|
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; }
|
|
@@ -45,6 +45,7 @@ var Table = (function (_ref) {
|
|
|
45
45
|
action = _ref$action === void 0 ? {} : _ref$action,
|
|
46
46
|
_ref$spaceSize = _ref.spaceSize,
|
|
47
47
|
spaceSize = _ref$spaceSize === void 0 ? 20 : _ref$spaceSize,
|
|
48
|
+
className = _ref.className,
|
|
48
49
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
49
50
|
var saveParams = React.useMemo(function () {
|
|
50
51
|
return {
|
|
@@ -99,6 +100,7 @@ var Table = (function (_ref) {
|
|
|
99
100
|
style: {
|
|
100
101
|
width: "100%"
|
|
101
102
|
},
|
|
103
|
+
className: className,
|
|
102
104
|
children: [!hideHeader && jsxRuntime.jsx(index.default, {
|
|
103
105
|
configData: configData,
|
|
104
106
|
onFinish: run,
|
package/lib/modal.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request"> {
|
|
|
43
43
|
tableStyle?: React.CSSProperties;
|
|
44
44
|
footerStyle?: React.CSSProperties;
|
|
45
45
|
spaceSize?: number;
|
|
46
|
+
className?: string;
|
|
46
47
|
}
|
|
47
48
|
export interface TableInstance {
|
|
48
49
|
reload: (params?: ParamsModal) => void;
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource"> {
|
|
|
16
16
|
tableInstance: HTableInstance,
|
|
17
17
|
error: Error
|
|
18
18
|
) => React.ReactNode;
|
|
19
|
-
tableStyle?:React.CSSProperties;
|
|
19
|
+
tableStyle?: React.CSSProperties;
|
|
20
20
|
}
|
|
21
21
|
const defaultRender = () => {
|
|
22
22
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
|
@@ -30,7 +30,7 @@ export default ({
|
|
|
30
30
|
rowKey = "id",
|
|
31
31
|
emptyRender,
|
|
32
32
|
errorRender,
|
|
33
|
-
|
|
33
|
+
tableStyle,
|
|
34
34
|
...props
|
|
35
35
|
}: HTableBodyProps) => {
|
|
36
36
|
// @ts-ignore
|
|
@@ -51,7 +51,10 @@ export default ({
|
|
|
51
51
|
};
|
|
52
52
|
useSynchronousKeys({ selectedRowKeys, records, rowKey });
|
|
53
53
|
return (
|
|
54
|
-
<div
|
|
54
|
+
<div
|
|
55
|
+
style={{ borderRadius: 4, overflow: "hidden", ...tableStyle }}
|
|
56
|
+
className="hw_table_body"
|
|
57
|
+
>
|
|
55
58
|
<ConfigProvider
|
|
56
59
|
renderEmpty={() => {
|
|
57
60
|
if (error) {
|
|
@@ -13,10 +13,9 @@ interface IFooterProps {
|
|
|
13
13
|
selectedRowData: RowObj,
|
|
14
14
|
data?: ResultModal
|
|
15
15
|
) => React.ReactNode;
|
|
16
|
-
footerStyle?:React.CSSProperties
|
|
17
|
-
|
|
16
|
+
footerStyle?: React.CSSProperties;
|
|
18
17
|
}
|
|
19
|
-
export default ({ actionRender, footerRender
|
|
18
|
+
export default ({ actionRender, footerRender, footerStyle }: IFooterProps) => {
|
|
20
19
|
const { data, selectedRowData, tableInstance, error } = useHTableContext();
|
|
21
20
|
const [allCheck, setAllCheck] = useState<boolean>(false);
|
|
22
21
|
const { total = "0" } = data || {};
|
|
@@ -27,7 +26,11 @@ export default ({ actionRender, footerRender ,footerStyle}: IFooterProps) => {
|
|
|
27
26
|
return <>{footerRender(tableInstance, selectedRowData, data)}</>;
|
|
28
27
|
}
|
|
29
28
|
const dom = (
|
|
30
|
-
<Card
|
|
29
|
+
<Card
|
|
30
|
+
style={{ borderRadius: 4, ...footerStyle }}
|
|
31
|
+
bordered={false}
|
|
32
|
+
className="hw_table_footer"
|
|
33
|
+
>
|
|
31
34
|
<Row justify="space-between">
|
|
32
35
|
<Space size={20}>
|
|
33
36
|
<Button
|
|
@@ -12,7 +12,7 @@ interface IHeaderProps {
|
|
|
12
12
|
onFinish: (value: Record<string, any>) => Promise<any>;
|
|
13
13
|
searchSpan?: ColProps;
|
|
14
14
|
loading?: boolean;
|
|
15
|
-
headerStyle?:React.CSSProperties
|
|
15
|
+
headerStyle?: React.CSSProperties;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export default ({
|
|
@@ -20,7 +20,7 @@ export default ({
|
|
|
20
20
|
onFinish,
|
|
21
21
|
searchSpan = { span: 6 },
|
|
22
22
|
loading,
|
|
23
|
-
|
|
23
|
+
headerStyle,
|
|
24
24
|
}: IHeaderProps) => {
|
|
25
25
|
const { tableInstance } = useHTableContext();
|
|
26
26
|
const { form } = tableInstance;
|
|
@@ -32,8 +32,9 @@ export default ({
|
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<Card
|
|
35
|
-
style={{ borderRadius: 4
|
|
35
|
+
style={{ borderRadius: 4, ...headerStyle }}
|
|
36
36
|
bordered={false}
|
|
37
|
+
className="hw_table_header"
|
|
37
38
|
bodyStyle={{ paddingBottom: 0 }}
|
|
38
39
|
>
|
|
39
40
|
<HForm
|
package/src/components/Table.tsx
CHANGED
|
@@ -16,11 +16,12 @@ export default ({
|
|
|
16
16
|
actionRender,
|
|
17
17
|
footerRender,
|
|
18
18
|
hideHeader,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
headerStyle = {},
|
|
20
|
+
footerStyle = {},
|
|
21
|
+
tableStyle = {},
|
|
22
22
|
action = {},
|
|
23
|
-
|
|
23
|
+
spaceSize = 20,
|
|
24
|
+
className,
|
|
24
25
|
...props
|
|
25
26
|
}: HTableProps) => {
|
|
26
27
|
const saveParams = useMemo(() => {
|
|
@@ -58,7 +59,12 @@ export default ({
|
|
|
58
59
|
error,
|
|
59
60
|
}}
|
|
60
61
|
>
|
|
61
|
-
<Space
|
|
62
|
+
<Space
|
|
63
|
+
size={spaceSize}
|
|
64
|
+
direction={"vertical"}
|
|
65
|
+
style={{ width: "100%" }}
|
|
66
|
+
className={className}
|
|
67
|
+
>
|
|
62
68
|
{!hideHeader && (
|
|
63
69
|
<Header
|
|
64
70
|
configData={configData}
|
|
@@ -78,7 +84,11 @@ export default ({
|
|
|
78
84
|
{...props}
|
|
79
85
|
/>
|
|
80
86
|
{footerRender !== false && (
|
|
81
|
-
<Footer
|
|
87
|
+
<Footer
|
|
88
|
+
actionRender={actionRender}
|
|
89
|
+
footerRender={footerRender}
|
|
90
|
+
footerStyle={footerStyle}
|
|
91
|
+
/>
|
|
82
92
|
)}
|
|
83
93
|
</Space>
|
|
84
94
|
</HTableContext.Provider>
|
package/src/components/modal.ts
CHANGED
|
@@ -59,10 +59,11 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request"> {
|
|
|
59
59
|
footerRender?: FooterRenderFn | false;
|
|
60
60
|
hideHeader?: boolean;
|
|
61
61
|
action?: Record<string, actionFn>;
|
|
62
|
-
headerStyle?:React.CSSProperties;
|
|
63
|
-
tableStyle?:React.CSSProperties;
|
|
64
|
-
footerStyle?:React.CSSProperties
|
|
65
|
-
spaceSize?:number;
|
|
62
|
+
headerStyle?: React.CSSProperties;
|
|
63
|
+
tableStyle?: React.CSSProperties;
|
|
64
|
+
footerStyle?: React.CSSProperties;
|
|
65
|
+
spaceSize?: number;
|
|
66
|
+
className?: string;
|
|
66
67
|
}
|
|
67
68
|
export interface TableInstance {
|
|
68
69
|
reload: (params?: ParamsModal) => void;
|
package/src/pages/Test/index.tsx
CHANGED
|
@@ -28,10 +28,10 @@ export default () => {
|
|
|
28
28
|
<HTable
|
|
29
29
|
configData={configData}
|
|
30
30
|
rowKey={"id"}
|
|
31
|
-
headerStyle={{borderRadius:0}}
|
|
32
|
-
tableStyle={{borderRadius:0,background:"#fff"}}
|
|
31
|
+
headerStyle={{ borderRadius: 0 }}
|
|
32
|
+
tableStyle={{ borderRadius: 0, background: "#fff" }}
|
|
33
33
|
spaceSize={0}
|
|
34
|
-
footerStyle={{marginTop:20}}
|
|
34
|
+
footerStyle={{ marginTop: 20 }}
|
|
35
35
|
table={hTable}
|
|
36
36
|
actionRender={(allCheck, selectedRowKeys, xjTable) => {
|
|
37
37
|
console.log(allCheck, selectedRowKeys, xjTable);
|