@hw-component/table 0.0.3-beta-v4 → 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.
@@ -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: _objectSpread({
80
- borderRadius: 4,
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
@@ -0,0 +1,5 @@
1
+ .ant-hw-table-body {
2
+ border-radius: 4px;
3
+ background-color: #fff;
4
+ overflow: hidden;
5
+ }
package/es/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import "./index.less";
1
2
  export { default as HTable } from "./Table";
2
3
  export { default as useHTable } from "./hooks/useHTable";
3
4
  export { default as HTableConfig } from "./TableConfig";
@@ -5,3 +6,4 @@ export { default as TableCustomize } from "./TableCustomize";
5
6
  export { default as HTableBody } from "./HTableBody";
6
7
  export { default as HTableFooter } from "./HTableFooter";
7
8
  export { default as HTableHeader } from "./HTableHeader";
9
+ export { default as HTablePagination } from "./HTablePagination";
package/es/index.js CHANGED
@@ -6,4 +6,5 @@ export { default as TableCustomize } from './TableCustomize.js';
6
6
  export { default as HTableBody } from './HTableBody/index.js';
7
7
  export { default as HTableFooter } from './HTableFooter/index.js';
8
8
  export { default as HTableHeader } from './HTableHeader/index.js';
9
+ export { default as HTablePagination } from './HTablePagination/index.js';
9
10
  // powered by hdj
@@ -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: _objectSpread({
83
- borderRadius: 4,
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
@@ -0,0 +1,5 @@
1
+ .ant-hw-table-body {
2
+ border-radius: 4px;
3
+ background-color: #fff;
4
+ overflow: hidden;
5
+ }
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import "./index.less";
1
2
  export { default as HTable } from "./Table";
2
3
  export { default as useHTable } from "./hooks/useHTable";
3
4
  export { default as HTableConfig } from "./TableConfig";
@@ -5,3 +6,4 @@ export { default as TableCustomize } from "./TableCustomize";
5
6
  export { default as HTableBody } from "./HTableBody";
6
7
  export { default as HTableFooter } from "./HTableFooter";
7
8
  export { default as HTableHeader } from "./HTableHeader";
9
+ export { default as HTablePagination } from "./HTablePagination";
package/lib/index.js CHANGED
@@ -7,6 +7,7 @@ var TableCustomize = require('./TableCustomize.js');
7
7
  var index = require('./HTableBody/index.js');
8
8
  var index$1 = require('./HTableFooter/index.js');
9
9
  var index$2 = require('./HTableHeader/index.js');
10
+ var index$3 = require('./HTablePagination/index.js');
10
11
 
11
12
 
12
13
 
@@ -17,4 +18,5 @@ exports.TableCustomize = TableCustomize.default;
17
18
  exports.HTableBody = index.default;
18
19
  exports.HTableFooter = index$1.default;
19
20
  exports.HTableHeader = index$2.default;
21
+ exports.HTablePagination = index$3.default;
20
22
  // powered by h
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/table",
3
- "version": "0.0.3-beta-v4",
3
+ "version": "0.0.3-beta-v6",
4
4
  "description": "基于antd二次开发table组件",
5
5
  "keywords": [
6
6
  "table"
@@ -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
+ };
@@ -0,0 +1,6 @@
1
+ @import "./styles/local.less";
2
+ .@{ant-prefix}-hw-table-body{
3
+ border-radius: 4px;
4
+ background-color: #fff;
5
+ overflow: hidden;
6
+ }
@@ -1,3 +1,4 @@
1
+ import "./index.less";
1
2
  export { default as HTable } from "./Table";
2
3
  export { default as useHTable } from "./hooks/useHTable";
3
4
  export { default as HTableConfig } from "./TableConfig";
@@ -5,3 +6,4 @@ export { default as TableCustomize } from "./TableCustomize";
5
6
  export { default as HTableBody } from "./HTableBody";
6
7
  export { default as HTableFooter } from "./HTableFooter";
7
8
  export { default as HTableHeader } from "./HTableHeader";
9
+ export { default as HTablePagination } from "./HTablePagination";
@@ -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);
@@ -3,6 +3,7 @@ import {
3
3
  HTableHeader,
4
4
  HTableBody,
5
5
  HTableFooter,
6
+ HTablePagination,
6
7
  } from "../../components";
7
8
 
8
9
  const configData = [
@@ -44,7 +45,8 @@ export default () => {
44
45
  }}
45
46
  >
46
47
  <HTableHeader />
47
- <HTableBody />
48
+ <HTableBody pagination={false} />
49
+ <HTablePagination />
48
50
  <HTableFooter />
49
51
  </TableCustomize>
50
52
  );