@hw-component/table 0.0.3-beta-v5 → 0.0.3-beta-v6
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/HTableBody/index.js +4 -5
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.js +25 -0
- package/es/index.css +5 -0
- package/es/index.d.ts +1 -0
- package/lib/HTableBody/index.js +6 -7
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +26 -0
- package/lib/index.css +5 -0
- package/lib/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/HTableBody/index.tsx +3 -4
- package/src/components/hooks/index.ts +14 -0
- package/src/components/index.less +6 -0
- package/src/components/index.tsx +1 -0
- package/src/components/styles/local.less +1 -0
- package/src/pages/Table/index.tsx +0 -4
package/es/HTableBody/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { useHTableContext } from '../context.js';
|
|
|
17
17
|
import { ConfigProvider, Empty } from 'antd';
|
|
18
18
|
import { useHTableConfigContext } from '../TableConfig.js';
|
|
19
19
|
import HTablePagination from '../HTablePagination/index.js';
|
|
20
|
+
import { useClassName } from '../hooks/index.js';
|
|
20
21
|
|
|
21
22
|
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle"];
|
|
22
23
|
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; }
|
|
@@ -75,12 +76,10 @@ var Body = (function (_ref) {
|
|
|
75
76
|
records: records,
|
|
76
77
|
rowKey: rowKey
|
|
77
78
|
});
|
|
79
|
+
var className = useClassName("hw-table-body");
|
|
78
80
|
return jsx("div", {
|
|
79
|
-
style:
|
|
80
|
-
|
|
81
|
-
overflow: "hidden"
|
|
82
|
-
}, tableStyle),
|
|
83
|
-
className: "hw_table_body",
|
|
81
|
+
style: tableStyle,
|
|
82
|
+
className: "hw_table_body ".concat(className),
|
|
84
83
|
children: jsxs(ConfigProvider, {
|
|
85
84
|
renderEmpty: function renderEmpty() {
|
|
86
85
|
if (error) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useClassName: (className: string | string[]) => string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import 'core-js/modules/es.array.join.js';
|
|
3
|
+
import _Array$isArray from '@babel/runtime-corejs3/core-js/array/is-array';
|
|
4
|
+
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js/instance/map';
|
|
5
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js/instance/concat';
|
|
6
|
+
import { useContext, useMemo } from 'react';
|
|
7
|
+
import { ConfigContext } from 'antd/es/config-provider';
|
|
8
|
+
|
|
9
|
+
var useClassName = function useClassName(className) {
|
|
10
|
+
var config = useContext(ConfigContext);
|
|
11
|
+
return useMemo(function () {
|
|
12
|
+
var _context2;
|
|
13
|
+
if (_Array$isArray(className)) {
|
|
14
|
+
var classNames = _mapInstanceProperty(className).call(className, function (item) {
|
|
15
|
+
var _context;
|
|
16
|
+
return _concatInstanceProperty(_context = "".concat(config.getPrefixCls(), "-")).call(_context, item);
|
|
17
|
+
});
|
|
18
|
+
return classNames.join(" ");
|
|
19
|
+
}
|
|
20
|
+
return _concatInstanceProperty(_context2 = "".concat(config.getPrefixCls(), "-")).call(_context2, className);
|
|
21
|
+
}, [className]);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { useClassName };
|
|
25
|
+
// powered by hdj
|
package/es/index.css
ADDED
package/es/index.d.ts
CHANGED
package/lib/HTableBody/index.js
CHANGED
|
@@ -19,7 +19,8 @@ var hooks = require('./hooks.js');
|
|
|
19
19
|
var context = require('../context.js');
|
|
20
20
|
var antd = require('antd');
|
|
21
21
|
var TableConfig = require('../TableConfig.js');
|
|
22
|
-
var index = require('../HTablePagination/index.js');
|
|
22
|
+
var index$1 = require('../HTablePagination/index.js');
|
|
23
|
+
var index = require('../hooks/index.js');
|
|
23
24
|
|
|
24
25
|
var _excluded = ["configData", "pagination", "onPageChange", "rowSelection", "rowKey", "emptyRender", "errorRender", "tableStyle"];
|
|
25
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; }
|
|
@@ -78,12 +79,10 @@ var Body = (function (_ref) {
|
|
|
78
79
|
records: records,
|
|
79
80
|
rowKey: rowKey
|
|
80
81
|
});
|
|
82
|
+
var className = index.useClassName("hw-table-body");
|
|
81
83
|
return jsxRuntime.jsx("div", {
|
|
82
|
-
style:
|
|
83
|
-
|
|
84
|
-
overflow: "hidden"
|
|
85
|
-
}, tableStyle),
|
|
86
|
-
className: "hw_table_body",
|
|
84
|
+
style: tableStyle,
|
|
85
|
+
className: "hw_table_body ".concat(className),
|
|
87
86
|
children: jsxRuntime.jsxs(antd.ConfigProvider, {
|
|
88
87
|
renderEmpty: function renderEmpty() {
|
|
89
88
|
if (error) {
|
|
@@ -106,7 +105,7 @@ var Body = (function (_ref) {
|
|
|
106
105
|
rowKey: rowKey,
|
|
107
106
|
dataSource: records,
|
|
108
107
|
pagination: false
|
|
109
|
-
})), pagination !== false && jsxRuntime.jsx(index.default, _objectSpread({
|
|
108
|
+
})), pagination !== false && jsxRuntime.jsx(index$1.default, _objectSpread({
|
|
110
109
|
onPageChange: onPageChange
|
|
111
110
|
}, pagination))]
|
|
112
111
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useClassName: (className: string | string[]) => string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/es.array.join.js');
|
|
4
|
+
var _Array$isArray = require('@babel/runtime-corejs3/core-js/array/is-array');
|
|
5
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/map');
|
|
6
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/concat');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var configProvider = require('antd/es/config-provider');
|
|
9
|
+
|
|
10
|
+
var useClassName = function useClassName(className) {
|
|
11
|
+
var config = React.useContext(configProvider.ConfigContext);
|
|
12
|
+
return React.useMemo(function () {
|
|
13
|
+
var _context2;
|
|
14
|
+
if (_Array$isArray(className)) {
|
|
15
|
+
var classNames = _mapInstanceProperty(className).call(className, function (item) {
|
|
16
|
+
var _context;
|
|
17
|
+
return _concatInstanceProperty(_context = "".concat(config.getPrefixCls(), "-")).call(_context, item);
|
|
18
|
+
});
|
|
19
|
+
return classNames.join(" ");
|
|
20
|
+
}
|
|
21
|
+
return _concatInstanceProperty(_context2 = "".concat(config.getPrefixCls(), "-")).call(_context2, className);
|
|
22
|
+
}, [className]);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.useClassName = useClassName;
|
|
26
|
+
// powered by h
|
package/lib/index.css
ADDED
package/lib/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import { ConfigProvider, Empty } from "antd";
|
|
|
8
8
|
import type { HTableInstance } from "../modal";
|
|
9
9
|
import { useHTableConfigContext } from "../TableConfig";
|
|
10
10
|
import HTablePagination from "../HTablePagination";
|
|
11
|
+
import { useClassName } from "../hooks";
|
|
11
12
|
interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource"> {
|
|
12
13
|
configData?: ConfigDataModal;
|
|
13
14
|
onPageChange?: (params: ParamsModal) => void;
|
|
@@ -57,11 +58,9 @@ export default ({
|
|
|
57
58
|
rowOnChange(key, rowData);
|
|
58
59
|
};
|
|
59
60
|
useSynchronousKeys({ selectedRowKeys, records, rowKey });
|
|
61
|
+
const className = useClassName("hw-table-body");
|
|
60
62
|
return (
|
|
61
|
-
<div
|
|
62
|
-
style={{ borderRadius: 4, overflow: "hidden", ...tableStyle }}
|
|
63
|
-
className="hw_table_body"
|
|
64
|
-
>
|
|
63
|
+
<div style={tableStyle} className={`hw_table_body ${className}`}>
|
|
65
64
|
<ConfigProvider
|
|
66
65
|
renderEmpty={() => {
|
|
67
66
|
if (error) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useContext, useMemo } from "react";
|
|
2
|
+
import { ConfigContext } from "antd/es/config-provider";
|
|
3
|
+
export const useClassName = (className: string | string[]) => {
|
|
4
|
+
const config = useContext(ConfigContext);
|
|
5
|
+
return useMemo(() => {
|
|
6
|
+
if (Array.isArray(className)) {
|
|
7
|
+
const classNames = className.map((item) => {
|
|
8
|
+
return `${config.getPrefixCls()}-${item}`;
|
|
9
|
+
});
|
|
10
|
+
return classNames.join(" ");
|
|
11
|
+
}
|
|
12
|
+
return `${config.getPrefixCls()}-${className}`;
|
|
13
|
+
}, [className]);
|
|
14
|
+
};
|
package/src/components/index.tsx
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@ant-prefix: ant;
|
|
@@ -22,10 +22,6 @@ export default () => {
|
|
|
22
22
|
<HTable
|
|
23
23
|
configData={configData}
|
|
24
24
|
rowKey={"id"}
|
|
25
|
-
headerStyle={{ borderRadius: 0 }}
|
|
26
|
-
tableStyle={{ borderRadius: 0, background: "#fff" }}
|
|
27
|
-
spaceSize={0}
|
|
28
|
-
footerStyle={{ marginTop: 20 }}
|
|
29
25
|
table={hTable}
|
|
30
26
|
actionRender={(allCheck, selectedRowKeys, xjTable) => {
|
|
31
27
|
console.log(allCheck, selectedRowKeys, xjTable);
|