@hw-component/table 1.6.8 → 1.6.9

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.
Files changed (34) hide show
  1. package/es/DialogTable/DwTable.d.ts +3 -0
  2. package/es/DialogTable/DwTable.js +121 -0
  3. package/es/{ModalTable/index.js → DialogTable/ModalTable.js} +2 -2
  4. package/es/index.css +3 -0
  5. package/es/index.d.ts +3 -2
  6. package/es/index.js +3 -2
  7. package/es/modal.d.ts +9 -0
  8. package/lib/DialogTable/DwTable.d.ts +3 -0
  9. package/lib/DialogTable/DwTable.js +124 -0
  10. package/lib/{ModalTable/index.js → DialogTable/ModalTable.js} +2 -2
  11. package/lib/index.css +3 -0
  12. package/lib/index.d.ts +3 -2
  13. package/lib/index.js +5 -3
  14. package/lib/modal.d.ts +9 -0
  15. package/package.json +1 -1
  16. package/src/components/DialogTable/DwTable.tsx +90 -0
  17. package/src/components/index.less +3 -0
  18. package/src/components/index.tsx +3 -2
  19. package/src/components/modal.ts +10 -0
  20. package/src/pages/DwTable/index.tsx +152 -0
  21. package/src/routes.tsx +7 -0
  22. /package/es/{ModalTable → DialogTable}/Content.d.ts +0 -0
  23. /package/es/{ModalTable → DialogTable}/Content.js +0 -0
  24. /package/es/{ModalTable/index.d.ts → DialogTable/ModalTable.d.ts} +0 -0
  25. /package/es/{ModalTable → DialogTable}/hooks.d.ts +0 -0
  26. /package/es/{ModalTable → DialogTable}/hooks.js +0 -0
  27. /package/lib/{ModalTable → DialogTable}/Content.d.ts +0 -0
  28. /package/lib/{ModalTable → DialogTable}/Content.js +0 -0
  29. /package/lib/{ModalTable/index.d.ts → DialogTable/ModalTable.d.ts} +0 -0
  30. /package/lib/{ModalTable → DialogTable}/hooks.d.ts +0 -0
  31. /package/lib/{ModalTable → DialogTable}/hooks.js +0 -0
  32. /package/src/components/{ModalTable → DialogTable}/Content.tsx +0 -0
  33. /package/src/components/{ModalTable/index.tsx → DialogTable/ModalTable.tsx} +0 -0
  34. /package/src/components/{ModalTable → DialogTable}/hooks.ts +0 -0
@@ -0,0 +1,3 @@
1
+ import type { DwTableProps } from "../modal";
2
+ declare const _default: ({ configData: configDataProps, request: requestProps, tableProps, dialogTable, visible, bodyStyle, onClose, afterVisibleChange, contentRender, width, ...props }: DwTableProps) => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,121 @@
1
+ // welcome to hoo hoo hoo
2
+ import _Object$keys from '@babel/runtime-corejs3/core-js/object/keys';
3
+ import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js/object/get-own-property-symbols';
4
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js/instance/filter';
5
+ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptor';
6
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/for-each';
7
+ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
8
+ import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
9
+ import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
10
+ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
11
+ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
12
+ import { jsx } from 'react/jsx-runtime';
13
+ import { Drawer } from 'antd';
14
+ import { useVisible, useTableProps, useCurrentTable } from './hooks.js';
15
+ import Content from './Content.js';
16
+ import { CloseOutlined } from '@ant-design/icons';
17
+ import { useClassName } from '../hooks/index.js';
18
+
19
+ var _excluded = ["configData", "request", "tableProps", "dialogTable", "visible", "bodyStyle", "onClose", "afterVisibleChange", "contentRender", "width"];
20
+ 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; }
21
+ 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; }
22
+ var DwTable = (function (_ref) {
23
+ var configDataProps = _ref.configData,
24
+ requestProps = _ref.request,
25
+ _ref$tableProps = _ref.tableProps,
26
+ tableProps = _ref$tableProps === void 0 ? {} : _ref$tableProps,
27
+ dialogTable = _ref.dialogTable,
28
+ _ref$visible = _ref.visible,
29
+ visible = _ref$visible === void 0 ? false : _ref$visible,
30
+ _ref$bodyStyle = _ref.bodyStyle,
31
+ bodyStyle = _ref$bodyStyle === void 0 ? {} : _ref$bodyStyle,
32
+ _onClose = _ref.onClose,
33
+ _afterVisibleChange = _ref.afterVisibleChange,
34
+ contentRender = _ref.contentRender,
35
+ _ref$width = _ref.width,
36
+ width = _ref$width === void 0 ? 666 : _ref$width,
37
+ props = _objectWithoutProperties(_ref, _excluded);
38
+ var _useVisible = useVisible(visible),
39
+ modalVisible = _useVisible.modalVisible,
40
+ setModalVisible = _useVisible.setModalVisible;
41
+ var className = useClassName('hw-table-pointer-not-hover');
42
+ var _useTableProps = useTableProps(_objectSpread(_objectSpread({}, props), {}, {
43
+ configData: configDataProps,
44
+ request: requestProps
45
+ })),
46
+ modalTableParams = _useTableProps.modalTableParams,
47
+ setModalTableParams = _useTableProps.setModalTableParams;
48
+ var currentTable = useCurrentTable({
49
+ show: function show(showParams) {
50
+ if (showParams) {
51
+ setModalTableParams(function (oldParams) {
52
+ var configData = oldParams.configData,
53
+ request = oldParams.request,
54
+ title = oldParams.title,
55
+ oldP = oldParams.params;
56
+ var _showParams$title = showParams.title,
57
+ showTitle = _showParams$title === void 0 ? title : _showParams$title,
58
+ _showParams$configDat = showParams.configData,
59
+ showConfigData = _showParams$configDat === void 0 ? configData : _showParams$configDat,
60
+ _showParams$request = showParams.request,
61
+ showReq = _showParams$request === void 0 ? request : _showParams$request,
62
+ _showParams$params = showParams.params,
63
+ params = _showParams$params === void 0 ? oldP : _showParams$params;
64
+ currentTable.params = params;
65
+ return {
66
+ title: showTitle,
67
+ request: showReq,
68
+ configData: showConfigData,
69
+ params: params
70
+ };
71
+ });
72
+ }
73
+ setModalVisible(true);
74
+ },
75
+ hide: function hide() {
76
+ setModalVisible(false);
77
+ },
78
+ dialogTable: dialogTable
79
+ });
80
+ var configData = modalTableParams.configData,
81
+ request = modalTableParams.request,
82
+ title = modalTableParams.title,
83
+ params = modalTableParams.params;
84
+ var req = request ? function (reqParams) {
85
+ return request(_objectSpread(_objectSpread({}, params), reqParams));
86
+ } : undefined;
87
+ return jsx(Drawer, _objectSpread(_objectSpread({}, props), {}, {
88
+ visible: modalVisible,
89
+ onClose: function onClose(e) {
90
+ setModalVisible(false);
91
+ _onClose === null || _onClose === void 0 || _onClose(e);
92
+ },
93
+ destroyOnClose: true,
94
+ title: title,
95
+ closable: false,
96
+ extra: jsx(CloseOutlined, {
97
+ className: className
98
+ }),
99
+ width: width,
100
+ bodyStyle: _objectSpread({
101
+ padding: 0,
102
+ paddingBottom: 12
103
+ }, bodyStyle),
104
+ afterVisibleChange: function afterVisibleChange(visible) {
105
+ if (!visible) {
106
+ currentTable.form.resetFields();
107
+ }
108
+ _afterVisibleChange === null || _afterVisibleChange === void 0 || _afterVisibleChange(visible);
109
+ },
110
+ children: jsx(Content, {
111
+ contentRender: contentRender,
112
+ tableProps: tableProps,
113
+ configData: configData || [],
114
+ dialogTable: currentTable,
115
+ request: req
116
+ })
117
+ }));
118
+ });
119
+
120
+ export { DwTable as default };
121
+ // powered by hdj
@@ -17,7 +17,7 @@ import Content from './Content.js';
17
17
  var _excluded = ["configData", "request", "tableProps", "dialogTable", "visible", "onCancel", "bodyStyle", "afterClose", "contentRender", "width"];
18
18
  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; }
19
19
  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; }
20
- var index = (function (_ref) {
20
+ var ModalTable = (function (_ref) {
21
21
  var configDataProps = _ref.configData,
22
22
  requestProps = _ref.request,
23
23
  _ref$tableProps = _ref.tableProps,
@@ -108,5 +108,5 @@ var index = (function (_ref) {
108
108
  }));
109
109
  });
110
110
 
111
- export { index as default };
111
+ export { ModalTable as default };
112
112
  // powered by hdj
package/es/index.css CHANGED
@@ -106,6 +106,9 @@
106
106
  .ant-hw-table-pointer:hover {
107
107
  color: #1890ff;
108
108
  }
109
+ .ant-hw-table-pointer-not-hover {
110
+ cursor: pointer;
111
+ }
109
112
  .ant-hw-table-header-title-box {
110
113
  -webkit-box-flex: 1;
111
114
  -webkit-flex: 1;
package/es/index.d.ts CHANGED
@@ -8,5 +8,6 @@ export { default as HTableBody } from "./HTableBody";
8
8
  export { default as HTableFooter } from "./HTableFooter";
9
9
  export { default as HTableHeader } from "./HTableHeader";
10
10
  export { default as HTablePagination } from "./HTablePagination";
11
- export { default as HModalTable } from "./ModalTable";
12
- export { useHDialogTable } from "./ModalTable/hooks";
11
+ export { default as HModalTable } from "./DialogTable/ModalTable";
12
+ export { useHDialogTable } from "./DialogTable/hooks";
13
+ export { default as DwTable } from "./DialogTable/DwTable";
package/es/index.js CHANGED
@@ -7,6 +7,7 @@ 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
9
  export { default as HTablePagination } from './HTablePagination/index.js';
10
- export { default as HModalTable } from './ModalTable/index.js';
11
- export { useHDialogTable } from './ModalTable/hooks.js';
10
+ export { default as HModalTable } from './DialogTable/ModalTable.js';
11
+ export { useHDialogTable } from './DialogTable/hooks.js';
12
+ export { default as DwTable } from './DialogTable/DwTable.js';
12
13
  // powered by hdj
package/es/modal.d.ts CHANGED
@@ -7,6 +7,7 @@ import type { ModalProps } from "antd";
7
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
+ import { DrawerProps } from "antd";
10
11
  export interface RowObj {
11
12
  keys?: React.Key[];
12
13
  rowData?: any[];
@@ -113,6 +114,14 @@ export interface HDiaLogTableInstance {
113
114
  hide: () => void;
114
115
  params: any;
115
116
  }
117
+ export interface DwTableProps extends DrawerProps {
118
+ tableProps?: Omit<HTableProps, "configData" | "request">;
119
+ dialogTable?: HDiaLogTableInstance;
120
+ params?: Record<string, any>;
121
+ configData?: HTableProps["configData"];
122
+ request?: HTableProps["request"];
123
+ contentRender?: (node: React.ReactNode) => React.ReactNode;
124
+ }
116
125
  export interface ModalTableProps extends ModalProps {
117
126
  tableProps?: Omit<HTableProps, "configData" | "request">;
118
127
  dialogTable?: HDiaLogTableInstance;
@@ -0,0 +1,3 @@
1
+ import type { DwTableProps } from "../modal";
2
+ declare const _default: ({ configData: configDataProps, request: requestProps, tableProps, dialogTable, visible, bodyStyle, onClose, afterVisibleChange, contentRender, width, ...props }: DwTableProps) => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,124 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _Object$keys = require('@babel/runtime-corejs3/core-js/object/keys');
6
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js/object/get-own-property-symbols');
7
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/filter');
8
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptor');
9
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/for-each');
10
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptors');
11
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js/object/define-properties');
12
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js/object/define-property');
13
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
+ var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
15
+ var jsxRuntime = require('react/jsx-runtime');
16
+ var antd = require('antd');
17
+ var hooks = require('./hooks.js');
18
+ var Content = require('./Content.js');
19
+ var icons = require('@ant-design/icons');
20
+ var index = require('../hooks/index.js');
21
+
22
+ var _excluded = ["configData", "request", "tableProps", "dialogTable", "visible", "bodyStyle", "onClose", "afterVisibleChange", "contentRender", "width"];
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; }
24
+ 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; }
25
+ var DwTable = (function (_ref) {
26
+ var configDataProps = _ref.configData,
27
+ requestProps = _ref.request,
28
+ _ref$tableProps = _ref.tableProps,
29
+ tableProps = _ref$tableProps === void 0 ? {} : _ref$tableProps,
30
+ dialogTable = _ref.dialogTable,
31
+ _ref$visible = _ref.visible,
32
+ visible = _ref$visible === void 0 ? false : _ref$visible,
33
+ _ref$bodyStyle = _ref.bodyStyle,
34
+ bodyStyle = _ref$bodyStyle === void 0 ? {} : _ref$bodyStyle,
35
+ _onClose = _ref.onClose,
36
+ _afterVisibleChange = _ref.afterVisibleChange,
37
+ contentRender = _ref.contentRender,
38
+ _ref$width = _ref.width,
39
+ width = _ref$width === void 0 ? 666 : _ref$width,
40
+ props = _objectWithoutProperties(_ref, _excluded);
41
+ var _useVisible = hooks.useVisible(visible),
42
+ modalVisible = _useVisible.modalVisible,
43
+ setModalVisible = _useVisible.setModalVisible;
44
+ var className = index.useClassName('hw-table-pointer-not-hover');
45
+ var _useTableProps = hooks.useTableProps(_objectSpread(_objectSpread({}, props), {}, {
46
+ configData: configDataProps,
47
+ request: requestProps
48
+ })),
49
+ modalTableParams = _useTableProps.modalTableParams,
50
+ setModalTableParams = _useTableProps.setModalTableParams;
51
+ var currentTable = hooks.useCurrentTable({
52
+ show: function show(showParams) {
53
+ if (showParams) {
54
+ setModalTableParams(function (oldParams) {
55
+ var configData = oldParams.configData,
56
+ request = oldParams.request,
57
+ title = oldParams.title,
58
+ oldP = oldParams.params;
59
+ var _showParams$title = showParams.title,
60
+ showTitle = _showParams$title === void 0 ? title : _showParams$title,
61
+ _showParams$configDat = showParams.configData,
62
+ showConfigData = _showParams$configDat === void 0 ? configData : _showParams$configDat,
63
+ _showParams$request = showParams.request,
64
+ showReq = _showParams$request === void 0 ? request : _showParams$request,
65
+ _showParams$params = showParams.params,
66
+ params = _showParams$params === void 0 ? oldP : _showParams$params;
67
+ currentTable.params = params;
68
+ return {
69
+ title: showTitle,
70
+ request: showReq,
71
+ configData: showConfigData,
72
+ params: params
73
+ };
74
+ });
75
+ }
76
+ setModalVisible(true);
77
+ },
78
+ hide: function hide() {
79
+ setModalVisible(false);
80
+ },
81
+ dialogTable: dialogTable
82
+ });
83
+ var configData = modalTableParams.configData,
84
+ request = modalTableParams.request,
85
+ title = modalTableParams.title,
86
+ params = modalTableParams.params;
87
+ var req = request ? function (reqParams) {
88
+ return request(_objectSpread(_objectSpread({}, params), reqParams));
89
+ } : undefined;
90
+ return jsxRuntime.jsx(antd.Drawer, _objectSpread(_objectSpread({}, props), {}, {
91
+ visible: modalVisible,
92
+ onClose: function onClose(e) {
93
+ setModalVisible(false);
94
+ _onClose === null || _onClose === void 0 || _onClose(e);
95
+ },
96
+ destroyOnClose: true,
97
+ title: title,
98
+ closable: false,
99
+ extra: jsxRuntime.jsx(icons.CloseOutlined, {
100
+ className: className
101
+ }),
102
+ width: width,
103
+ bodyStyle: _objectSpread({
104
+ padding: 0,
105
+ paddingBottom: 12
106
+ }, bodyStyle),
107
+ afterVisibleChange: function afterVisibleChange(visible) {
108
+ if (!visible) {
109
+ currentTable.form.resetFields();
110
+ }
111
+ _afterVisibleChange === null || _afterVisibleChange === void 0 || _afterVisibleChange(visible);
112
+ },
113
+ children: jsxRuntime.jsx(Content.default, {
114
+ contentRender: contentRender,
115
+ tableProps: tableProps,
116
+ configData: configData || [],
117
+ dialogTable: currentTable,
118
+ request: req
119
+ })
120
+ }));
121
+ });
122
+
123
+ exports.default = DwTable;
124
+ // powered by h
@@ -20,7 +20,7 @@ var Content = require('./Content.js');
20
20
  var _excluded = ["configData", "request", "tableProps", "dialogTable", "visible", "onCancel", "bodyStyle", "afterClose", "contentRender", "width"];
21
21
  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; }
22
22
  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; }
23
- var index = (function (_ref) {
23
+ var ModalTable = (function (_ref) {
24
24
  var configDataProps = _ref.configData,
25
25
  requestProps = _ref.request,
26
26
  _ref$tableProps = _ref.tableProps,
@@ -111,5 +111,5 @@ var index = (function (_ref) {
111
111
  }));
112
112
  });
113
113
 
114
- exports.default = index;
114
+ exports.default = ModalTable;
115
115
  // powered by h
package/lib/index.css CHANGED
@@ -106,6 +106,9 @@
106
106
  .ant-hw-table-pointer:hover {
107
107
  color: #1890ff;
108
108
  }
109
+ .ant-hw-table-pointer-not-hover {
110
+ cursor: pointer;
111
+ }
109
112
  .ant-hw-table-header-title-box {
110
113
  -webkit-box-flex: 1;
111
114
  -webkit-flex: 1;
package/lib/index.d.ts CHANGED
@@ -8,5 +8,6 @@ export { default as HTableBody } from "./HTableBody";
8
8
  export { default as HTableFooter } from "./HTableFooter";
9
9
  export { default as HTableHeader } from "./HTableHeader";
10
10
  export { default as HTablePagination } from "./HTablePagination";
11
- export { default as HModalTable } from "./ModalTable";
12
- export { useHDialogTable } from "./ModalTable/hooks";
11
+ export { default as HModalTable } from "./DialogTable/ModalTable";
12
+ export { useHDialogTable } from "./DialogTable/hooks";
13
+ export { default as DwTable } from "./DialogTable/DwTable";
package/lib/index.js CHANGED
@@ -8,8 +8,9 @@ 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
10
  var index$3 = require('./HTablePagination/index.js');
11
- var index$4 = require('./ModalTable/index.js');
12
- var hooks = require('./ModalTable/hooks.js');
11
+ var ModalTable = require('./DialogTable/ModalTable.js');
12
+ var hooks = require('./DialogTable/hooks.js');
13
+ var DwTable = require('./DialogTable/DwTable.js');
13
14
 
14
15
 
15
16
 
@@ -21,6 +22,7 @@ exports.HTableBody = index.default;
21
22
  exports.HTableFooter = index$1.default;
22
23
  exports.HTableHeader = index$2.default;
23
24
  exports.HTablePagination = index$3.default;
24
- exports.HModalTable = index$4.default;
25
+ exports.HModalTable = ModalTable.default;
25
26
  exports.useHDialogTable = hooks.useHDialogTable;
27
+ exports.DwTable = DwTable.default;
26
28
  // powered by h
package/lib/modal.d.ts CHANGED
@@ -7,6 +7,7 @@ import type { ModalProps } from "antd";
7
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
+ import { DrawerProps } from "antd";
10
11
  export interface RowObj {
11
12
  keys?: React.Key[];
12
13
  rowData?: any[];
@@ -113,6 +114,14 @@ export interface HDiaLogTableInstance {
113
114
  hide: () => void;
114
115
  params: any;
115
116
  }
117
+ export interface DwTableProps extends DrawerProps {
118
+ tableProps?: Omit<HTableProps, "configData" | "request">;
119
+ dialogTable?: HDiaLogTableInstance;
120
+ params?: Record<string, any>;
121
+ configData?: HTableProps["configData"];
122
+ request?: HTableProps["request"];
123
+ contentRender?: (node: React.ReactNode) => React.ReactNode;
124
+ }
116
125
  export interface ModalTableProps extends ModalProps {
117
126
  tableProps?: Omit<HTableProps, "configData" | "request">;
118
127
  dialogTable?: HDiaLogTableInstance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/table",
3
- "version": "1.6.8",
3
+ "version": "1.6.9",
4
4
  "description": "基于antd二次开发table组件",
5
5
  "keywords": [
6
6
  "table"
@@ -0,0 +1,90 @@
1
+ import {Drawer} from 'antd';
2
+ import type { DwTableProps } from "../modal";
3
+ import {useCurrentTable, useTableProps, useVisible} from "./hooks";
4
+ import Content from "./Content";
5
+ import {CloseOutlined} from '@ant-design/icons'
6
+ import {useClassName} from "../hooks";
7
+ export default ({
8
+ configData: configDataProps,
9
+ request: requestProps,
10
+ tableProps = {},
11
+ dialogTable,
12
+ visible = false,
13
+ bodyStyle = {},
14
+ onClose,
15
+ afterVisibleChange,
16
+ contentRender,
17
+ width=666,
18
+ ...props
19
+ }:DwTableProps)=>{
20
+ const { modalVisible, setModalVisible } = useVisible(visible);
21
+ const className=useClassName('hw-table-pointer-not-hover');
22
+ const { modalTableParams, setModalTableParams } = useTableProps({
23
+ ...props,
24
+ configData: configDataProps,
25
+ request: requestProps,
26
+ });
27
+ const currentTable = useCurrentTable({
28
+ show: (showParams) => {
29
+ if (showParams) {
30
+ setModalTableParams((oldParams) => {
31
+ const { configData, request, title, params: oldP } = oldParams;
32
+ const {
33
+ title: showTitle = title,
34
+ configData: showConfigData = configData,
35
+ request: showReq = request,
36
+ params = oldP,
37
+ } = showParams;
38
+ currentTable.params = params;
39
+ return {
40
+ title: showTitle,
41
+ request: showReq,
42
+ configData: showConfigData,
43
+ params,
44
+ };
45
+ });
46
+ }
47
+ setModalVisible(true);
48
+ },
49
+ hide: () => {
50
+ setModalVisible(false);
51
+ },
52
+ dialogTable,
53
+ });
54
+ const { configData, request, title, params } = modalTableParams;
55
+ const req = request
56
+ ? (reqParams) => {
57
+ return request({ ...params, ...reqParams });
58
+ }
59
+ : undefined;
60
+ return <Drawer
61
+ {...props}
62
+ visible={modalVisible}
63
+ onClose={(e) => {
64
+ setModalVisible(false);
65
+ onClose?.(e);
66
+ }}
67
+ destroyOnClose
68
+ title={title}
69
+ closable={false}
70
+ extra={
71
+ <CloseOutlined className={className}/>
72
+ }
73
+ width={width}
74
+ bodyStyle={{ padding: 0, paddingBottom: 12, ...bodyStyle }}
75
+ afterVisibleChange={(visible) => {
76
+ if (!visible){
77
+ currentTable.form.resetFields();
78
+ }
79
+ afterVisibleChange?.(visible);
80
+ }}
81
+ >
82
+ <Content
83
+ contentRender={contentRender}
84
+ tableProps={tableProps}
85
+ configData={configData||[]}
86
+ dialogTable={currentTable}
87
+ request={req}
88
+ />
89
+ </Drawer>
90
+ }
@@ -107,6 +107,9 @@
107
107
  color:#1890ff;
108
108
  }
109
109
  }
110
+ .@{ant-prefix}-hw-table-pointer-not-hover{
111
+ cursor: pointer;
112
+ }
110
113
  .@{ant-prefix}-hw-table-header-title-box{
111
114
  flex: 1;
112
115
  display: flex;
@@ -8,5 +8,6 @@ export { default as HTableBody } from "./HTableBody";
8
8
  export { default as HTableFooter } from "./HTableFooter";
9
9
  export { default as HTableHeader } from "./HTableHeader";
10
10
  export { default as HTablePagination } from "./HTablePagination";
11
- export { default as HModalTable } from "./ModalTable";
12
- export { useHDialogTable } from "./ModalTable/hooks";
11
+ export { default as HModalTable } from "./DialogTable/ModalTable";
12
+ export { useHDialogTable } from "./DialogTable/hooks";
13
+ export { default as DwTable } from "./DialogTable/DwTable";
@@ -11,6 +11,7 @@ import type { TableProps } from "antd/lib/table";
11
11
  import type { AffixProps } from "antd/lib/affix";
12
12
  import type { OptionModal } from "./HTableBody";
13
13
  import { GetRowKey } from "rc-table/lib/interface";
14
+ import {DrawerProps} from "antd";
14
15
 
15
16
  export interface RowObj {
16
17
  keys?: React.Key[];
@@ -146,6 +147,15 @@ export interface HDiaLogTableInstance {
146
147
  hide: () => void;
147
148
  params: any;
148
149
  }
150
+ export interface DwTableProps extends DrawerProps{
151
+ tableProps?: Omit<HTableProps, "configData" | "request">;
152
+ dialogTable?: HDiaLogTableInstance;
153
+ params?: Record<string, any>;
154
+ configData?: HTableProps["configData"];
155
+ request?: HTableProps["request"];
156
+ contentRender?:(node:React.ReactNode)=>React.ReactNode;
157
+ }
158
+
149
159
  export interface ModalTableProps extends ModalProps {
150
160
  tableProps?: Omit<HTableProps, "configData" | "request">;
151
161
  dialogTable?: HDiaLogTableInstance;
@@ -0,0 +1,152 @@
1
+ import { Button } from "antd";
2
+ import { DwTable, HTable, useHDialogTable } from "@/components";
3
+ const configData = [
4
+ {
5
+ title: "座位",
6
+ showSearch: true,
7
+ searchType: "select",
8
+ dataIndex: "name",
9
+ itemProps: {
10
+ options: [{ label: "1", value: 1 }],
11
+ },
12
+ },
13
+ {
14
+ title: "操作",
15
+ name: "aaa",
16
+ fixed: "right",
17
+ width: 200,
18
+ showSearch: true,
19
+ render: () => {
20
+ return <div>fff</div>;
21
+ },
22
+ },
23
+ ];
24
+ const req1 = (params) => {
25
+ console.log(params, "req1");
26
+ const { current = 1 } = params;
27
+ return new Promise((resolve, reject) => {
28
+ setTimeout(() => {
29
+ // reject(new Error("错误"));
30
+ resolve({
31
+ size: "10",
32
+ current: current.toString(10),
33
+ total: "100",
34
+ records: [
35
+ {
36
+ id: 1,
37
+ name: "111",
38
+ },
39
+ ],
40
+ });
41
+ }, 2000);
42
+ });
43
+ };
44
+
45
+ const req2 = (params) => {
46
+ const { current = 1 } = params;
47
+ console.log("请求")
48
+ return new Promise((resolve, reject) => {
49
+ setTimeout(() => {
50
+ // reject(new Error("错误"));
51
+ resolve({
52
+ size: "10",
53
+ current: current.toString(10),
54
+ total: "100",
55
+ records: [
56
+ {
57
+ id: 1,
58
+ name: "111",
59
+ },
60
+ {
61
+ id: 2,
62
+ name: "111",
63
+ },
64
+ {
65
+ id: 3,
66
+ name: "111",
67
+ },
68
+ {
69
+ id: 4,
70
+ name: "111",
71
+ },
72
+ {
73
+ id: 5,
74
+ name: "111",
75
+ },
76
+ {
77
+ id: 6,
78
+ name: "111",
79
+ },
80
+ {
81
+ id: 7,
82
+ name: "111",
83
+ },
84
+ {
85
+ id: 8,
86
+ name: "111",
87
+ },
88
+ ],
89
+ });
90
+ }, 2000);
91
+ });
92
+ };
93
+ const Test = () => {
94
+ const dialogTable1 = useHDialogTable();
95
+
96
+ return (
97
+ <>
98
+ <DwTable
99
+ dialogTable={dialogTable1}
100
+ title="111"
101
+ configData={configData}
102
+ request={req2}
103
+ contentRender={(node)=>{
104
+ return <>
105
+ <div>fsafsfsa</div>
106
+ {node}
107
+ </>
108
+ }}
109
+ />
110
+ <Button
111
+ onClick={() => {
112
+ dialogTable1.show();
113
+ }}
114
+ >
115
+ 点我
116
+ </Button>
117
+ </>
118
+ );
119
+ };
120
+ export default () => {
121
+ const dialogTable = useHDialogTable();
122
+ const dialogTable1 = useHDialogTable();
123
+ return (
124
+ <>
125
+ <Button
126
+ onClick={() => {
127
+ dialogTable.show({ title: "3333", params: { id: 1 } });
128
+ }}
129
+ >
130
+ 点我333
131
+ </Button>
132
+ <DwTable
133
+ dialogTable={dialogTable}
134
+ request={req2}
135
+ width={1200}
136
+ configData={configData}
137
+ tableProps={{
138
+ headerTitle: (
139
+ <div
140
+ onClick={() => {
141
+ console.log(dialogTable.params);
142
+ }}
143
+ >
144
+ 点我
145
+ </div>
146
+ ),
147
+ }}
148
+ />
149
+ <HTable configData={configData} headerTitle={<Test />} />
150
+ </>
151
+ );
152
+ };
package/src/routes.tsx CHANGED
@@ -3,6 +3,8 @@ import { Navigate } from "react-router-dom";
3
3
  import Table from "./pages/Table";
4
4
  import ModalTable from "./pages/ModalTable";
5
5
  import TableCustomize from "./pages/TableCustomize";
6
+ import DwTable from "./pages/DwTable";
7
+
6
8
  export interface RouteModal {
7
9
  path?: string;
8
10
  name?: string;
@@ -32,6 +34,11 @@ const routes: RouteModal[] = [
32
34
  name: "ModalTable",
33
35
  element: <ModalTable />,
34
36
  },
37
+ {
38
+ path: "/dwTable",
39
+ name: "dwTable",
40
+ element: <DwTable />,
41
+ },
35
42
  ];
36
43
 
37
44
  export default routes;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes