@hw-component/table 1.9.93 → 1.9.95
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/DialogTable/Content.d.ts +4 -3
- package/es/DialogTable/Content.js +52 -3
- package/es/DialogTable/DwEditTable.d.ts +5 -0
- package/es/DialogTable/DwEditTable.js +134 -0
- package/es/DialogTable/DwTable.js +2 -2
- package/es/DialogTable/ModalEditTable.d.ts +5 -0
- package/es/DialogTable/ModalEditTable.js +120 -0
- package/es/DialogTable/ModalTable.js +2 -2
- package/es/DialogTable/hooks.d.ts +4 -15
- package/es/DialogTable/hooks.js +9 -2
- package/es/EditTable/hooks.d.ts +9 -0
- package/es/EditTable/hooks.js +76 -0
- package/es/EditTable/index.d.ts +4 -0
- package/es/EditTable/index.js +181 -0
- package/es/EditTable/modal.d.ts +19 -0
- package/es/HTableBody/defaultRender.d.ts +7 -1
- package/es/HTableBody/defaultRender.js +11 -4
- package/es/HTableBody/index.js +4 -1
- package/es/HTableBody/modal.d.ts +3 -3
- package/es/HTablePagination/index.d.ts +2 -1
- package/es/HTablePagination/index.js +6 -4
- package/es/TableConfig.d.ts +5 -5
- package/es/index.d.ts +3 -0
- package/es/index.js +3 -0
- package/es/modal.d.ts +18 -7
- package/es/render/Text.d.ts +0 -1
- package/lib/DialogTable/Content.d.ts +4 -3
- package/lib/DialogTable/Content.js +53 -5
- package/lib/DialogTable/DwEditTable.d.ts +5 -0
- package/lib/DialogTable/DwEditTable.js +137 -0
- package/lib/DialogTable/DwTable.js +1 -1
- package/lib/DialogTable/ModalEditTable.d.ts +5 -0
- package/lib/DialogTable/ModalEditTable.js +123 -0
- package/lib/DialogTable/ModalTable.js +1 -1
- package/lib/DialogTable/hooks.d.ts +4 -15
- package/lib/DialogTable/hooks.js +9 -2
- package/lib/EditTable/hooks.d.ts +9 -0
- package/lib/EditTable/hooks.js +78 -0
- package/lib/EditTable/index.d.ts +4 -0
- package/lib/EditTable/index.js +184 -0
- package/lib/EditTable/modal.d.ts +19 -0
- package/lib/HTableBody/defaultRender.d.ts +7 -1
- package/lib/HTableBody/defaultRender.js +11 -4
- package/lib/HTableBody/index.js +4 -1
- package/lib/HTableBody/modal.d.ts +3 -3
- package/lib/HTablePagination/index.d.ts +2 -1
- package/lib/HTablePagination/index.js +6 -4
- package/lib/TableConfig.d.ts +5 -5
- package/lib/index.d.ts +3 -0
- package/lib/index.js +6 -0
- package/lib/modal.d.ts +18 -7
- package/lib/render/Text.d.ts +0 -1
- package/package.json +4 -3
- package/src/components/DialogTable/Content.tsx +25 -2
- package/src/components/DialogTable/DwEditTable.tsx +111 -0
- package/src/components/DialogTable/DwTable.tsx +3 -2
- package/src/components/DialogTable/ModalEditTable.tsx +99 -0
- package/src/components/DialogTable/ModalTable.tsx +3 -2
- package/src/components/DialogTable/hooks.ts +15 -4
- package/src/components/EditTable/hooks.ts +43 -0
- package/src/components/EditTable/index.tsx +118 -0
- package/src/components/EditTable/modal.ts +26 -0
- package/src/components/HTableBody/defaultRender.tsx +17 -7
- package/src/components/HTableBody/index.tsx +1 -1
- package/src/components/HTableBody/modal.ts +6 -7
- package/src/components/HTablePagination/index.tsx +7 -3
- package/src/components/Table.tsx +1 -0
- package/src/components/TableConfig.tsx +7 -3
- package/src/components/index.tsx +3 -0
- package/src/components/modal.ts +24 -10
- package/src/components/render/index.tsx +1 -0
- package/src/pages/DwTable/index.tsx +1 -0
- package/src/pages/EditTable/index.tsx +70 -0
- package/src/pages/ModalEditTable/index.tsx +84 -0
- package/src/pages/Table/index.tsx +14 -15
- package/src/routes.tsx +12 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
3
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
4
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
5
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
6
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
7
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
8
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
9
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/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 { EditTableContent } from './Content.js';
|
|
16
|
+
import { CloseOutlined } from '@ant-design/icons';
|
|
17
|
+
import { useClassName } from '../hooks/index.js';
|
|
18
|
+
|
|
19
|
+
var _excluded = ["configData", "request", "editTableProps", "dialogTable", "visible", "bodyStyle", "onClose", "afterVisibleChange", "contentRender", "width", "footer"];
|
|
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 DwEditTable = (function (_ref) {
|
|
23
|
+
var configDataProps = _ref.configData,
|
|
24
|
+
requestProps = _ref.request,
|
|
25
|
+
_ref$editTableProps = _ref.editTableProps,
|
|
26
|
+
editTableProps = _ref$editTableProps === void 0 ? {} : _ref$editTableProps,
|
|
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 ? 888 : _ref$width,
|
|
37
|
+
_ref$footer = _ref.footer,
|
|
38
|
+
footer = _ref$footer === void 0 ? null : _ref$footer,
|
|
39
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
+
var _useVisible = useVisible(visible),
|
|
41
|
+
modalVisible = _useVisible.modalVisible,
|
|
42
|
+
setModalVisible = _useVisible.setModalVisible;
|
|
43
|
+
var className = useClassName("hw-table-pointer-not-hover");
|
|
44
|
+
var _useTableProps = useTableProps(_objectSpread(_objectSpread({}, props), {}, {
|
|
45
|
+
configData: configDataProps,
|
|
46
|
+
request: requestProps
|
|
47
|
+
})),
|
|
48
|
+
modalTableParams = _useTableProps.modalTableParams,
|
|
49
|
+
setModalTableParams = _useTableProps.setModalTableParams;
|
|
50
|
+
var currentTable = useCurrentTable({
|
|
51
|
+
show: function show(showParams) {
|
|
52
|
+
if (showParams) {
|
|
53
|
+
setModalTableParams(function (oldParams) {
|
|
54
|
+
var configData = oldParams.configData,
|
|
55
|
+
request = oldParams.request,
|
|
56
|
+
title = oldParams.title,
|
|
57
|
+
oldP = oldParams.params,
|
|
58
|
+
oldDataSource = oldParams.dataSource;
|
|
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
|
+
_showParams$dataSourc = showParams.dataSource,
|
|
68
|
+
dataSource = _showParams$dataSourc === void 0 ? oldDataSource : _showParams$dataSourc;
|
|
69
|
+
currentTable.params = params;
|
|
70
|
+
return {
|
|
71
|
+
title: showTitle,
|
|
72
|
+
request: showReq,
|
|
73
|
+
configData: showConfigData,
|
|
74
|
+
params: params,
|
|
75
|
+
dataSource: dataSource
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
setModalVisible(true);
|
|
80
|
+
},
|
|
81
|
+
hide: function hide() {
|
|
82
|
+
setModalVisible(false);
|
|
83
|
+
},
|
|
84
|
+
dialogTable: dialogTable
|
|
85
|
+
});
|
|
86
|
+
var configData = modalTableParams.configData,
|
|
87
|
+
request = modalTableParams.request,
|
|
88
|
+
dataSource = modalTableParams.dataSource,
|
|
89
|
+
title = modalTableParams.title,
|
|
90
|
+
params = modalTableParams.params;
|
|
91
|
+
var req = request ? function (reqParams) {
|
|
92
|
+
return request(_objectSpread(_objectSpread({}, params), reqParams));
|
|
93
|
+
} : undefined;
|
|
94
|
+
return jsx(Drawer, _objectSpread(_objectSpread({}, props), {}, {
|
|
95
|
+
footer: footer,
|
|
96
|
+
visible: modalVisible,
|
|
97
|
+
onClose: function onClose(e) {
|
|
98
|
+
setModalVisible(false);
|
|
99
|
+
_onClose === null || _onClose === void 0 || _onClose(e);
|
|
100
|
+
},
|
|
101
|
+
destroyOnClose: true,
|
|
102
|
+
title: title,
|
|
103
|
+
closable: false,
|
|
104
|
+
extra: jsx(CloseOutlined, {
|
|
105
|
+
className: className,
|
|
106
|
+
onClick: function onClick(e) {
|
|
107
|
+
setModalVisible(false);
|
|
108
|
+
_onClose === null || _onClose === void 0 || _onClose(e);
|
|
109
|
+
}
|
|
110
|
+
}),
|
|
111
|
+
width: width,
|
|
112
|
+
bodyStyle: _objectSpread({
|
|
113
|
+
padding: 0,
|
|
114
|
+
paddingBottom: 12
|
|
115
|
+
}, bodyStyle),
|
|
116
|
+
afterVisibleChange: function afterVisibleChange(changeVisible) {
|
|
117
|
+
if (!changeVisible) {
|
|
118
|
+
currentTable.form.resetFields();
|
|
119
|
+
}
|
|
120
|
+
_afterVisibleChange === null || _afterVisibleChange === void 0 || _afterVisibleChange(changeVisible);
|
|
121
|
+
},
|
|
122
|
+
children: jsx(EditTableContent, {
|
|
123
|
+
contentRender: contentRender,
|
|
124
|
+
editTableProps: editTableProps,
|
|
125
|
+
configData: configData || [],
|
|
126
|
+
dialogTable: currentTable,
|
|
127
|
+
request: req,
|
|
128
|
+
dataSource: dataSource
|
|
129
|
+
})
|
|
130
|
+
}));
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
export { DwEditTable as default };
|
|
134
|
+
// powered by hdj
|
|
@@ -12,7 +12,7 @@ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWitho
|
|
|
12
12
|
import { jsx } from 'react/jsx-runtime';
|
|
13
13
|
import { Drawer } from 'antd';
|
|
14
14
|
import { useVisible, useTableProps, useCurrentTable } from './hooks.js';
|
|
15
|
-
import
|
|
15
|
+
import { TableContent } from './Content.js';
|
|
16
16
|
import { CloseOutlined } from '@ant-design/icons';
|
|
17
17
|
import { useClassName } from '../hooks/index.js';
|
|
18
18
|
|
|
@@ -119,7 +119,7 @@ var DwTable = (function (_ref) {
|
|
|
119
119
|
}
|
|
120
120
|
_afterVisibleChange === null || _afterVisibleChange === void 0 || _afterVisibleChange(changeVisible);
|
|
121
121
|
},
|
|
122
|
-
children: jsx(
|
|
122
|
+
children: jsx(TableContent, {
|
|
123
123
|
contentRender: contentRender,
|
|
124
124
|
tableProps: tableProps,
|
|
125
125
|
configData: configData || [],
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ModalTableProps } from "../modal";
|
|
3
|
+
import { ProColumns } from "@ant-design/pro-table/lib/typing";
|
|
4
|
+
declare const _default: ({ configData: configDataProps, request: requestProps, editTableProps, dialogTable, visible, onCancel, bodyStyle, afterClose, contentRender, width, footer, ...props }: ModalTableProps<ProColumns[]>) => JSX.Element;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
3
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
4
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
5
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
6
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
7
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
8
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
9
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/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 { Modal } from 'antd';
|
|
14
|
+
import { useVisible, useTableProps, useCurrentTable } from './hooks.js';
|
|
15
|
+
import { EditTableContent } from './Content.js';
|
|
16
|
+
|
|
17
|
+
var _excluded = ["configData", "request", "editTableProps", "dialogTable", "visible", "onCancel", "bodyStyle", "afterClose", "contentRender", "width", "footer"];
|
|
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
|
+
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 ModalEditTable = (function (_ref) {
|
|
21
|
+
var configDataProps = _ref.configData,
|
|
22
|
+
requestProps = _ref.request,
|
|
23
|
+
_ref$editTableProps = _ref.editTableProps,
|
|
24
|
+
editTableProps = _ref$editTableProps === void 0 ? {} : _ref$editTableProps,
|
|
25
|
+
dialogTable = _ref.dialogTable,
|
|
26
|
+
_ref$visible = _ref.visible,
|
|
27
|
+
visible = _ref$visible === void 0 ? false : _ref$visible,
|
|
28
|
+
_onCancel = _ref.onCancel,
|
|
29
|
+
_ref$bodyStyle = _ref.bodyStyle,
|
|
30
|
+
bodyStyle = _ref$bodyStyle === void 0 ? {} : _ref$bodyStyle,
|
|
31
|
+
_afterClose = _ref.afterClose,
|
|
32
|
+
contentRender = _ref.contentRender,
|
|
33
|
+
_ref$width = _ref.width,
|
|
34
|
+
width = _ref$width === void 0 ? 666 : _ref$width,
|
|
35
|
+
_ref$footer = _ref.footer,
|
|
36
|
+
footer = _ref$footer === void 0 ? null : _ref$footer,
|
|
37
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
38
|
+
var _useVisible = useVisible(visible),
|
|
39
|
+
modalVisible = _useVisible.modalVisible,
|
|
40
|
+
setModalVisible = _useVisible.setModalVisible;
|
|
41
|
+
var _useTableProps = useTableProps(_objectSpread(_objectSpread({}, props), {}, {
|
|
42
|
+
configData: configDataProps,
|
|
43
|
+
request: requestProps
|
|
44
|
+
})),
|
|
45
|
+
modalTableParams = _useTableProps.modalTableParams,
|
|
46
|
+
setModalTableParams = _useTableProps.setModalTableParams;
|
|
47
|
+
var currentTable = useCurrentTable({
|
|
48
|
+
show: function show(showParams) {
|
|
49
|
+
if (showParams) {
|
|
50
|
+
setModalTableParams(function (oldParams) {
|
|
51
|
+
var configData = oldParams.configData,
|
|
52
|
+
request = oldParams.request,
|
|
53
|
+
title = oldParams.title,
|
|
54
|
+
oldP = oldParams.params,
|
|
55
|
+
oldDataSource = oldParams.dataSource;
|
|
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$dataSourc = showParams.dataSource,
|
|
63
|
+
dataSource = _showParams$dataSourc === void 0 ? oldDataSource : _showParams$dataSourc,
|
|
64
|
+
_showParams$params = showParams.params,
|
|
65
|
+
params = _showParams$params === void 0 ? oldP : _showParams$params;
|
|
66
|
+
currentTable.params = params;
|
|
67
|
+
return {
|
|
68
|
+
title: showTitle,
|
|
69
|
+
request: showReq,
|
|
70
|
+
configData: showConfigData,
|
|
71
|
+
params: params,
|
|
72
|
+
dataSource: dataSource
|
|
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
|
+
dataSource = modalTableParams.dataSource,
|
|
85
|
+
request = modalTableParams.request,
|
|
86
|
+
title = modalTableParams.title,
|
|
87
|
+
params = modalTableParams.params;
|
|
88
|
+
var req = request ? function (reqParams) {
|
|
89
|
+
return request(_objectSpread(_objectSpread({}, params), reqParams));
|
|
90
|
+
} : undefined;
|
|
91
|
+
return jsx(Modal, _objectSpread(_objectSpread({}, props), {}, {
|
|
92
|
+
footer: footer,
|
|
93
|
+
visible: modalVisible,
|
|
94
|
+
onCancel: function onCancel(e) {
|
|
95
|
+
setModalVisible(false);
|
|
96
|
+
_onCancel === null || _onCancel === void 0 || _onCancel(e);
|
|
97
|
+
},
|
|
98
|
+
destroyOnClose: true,
|
|
99
|
+
title: title,
|
|
100
|
+
width: width,
|
|
101
|
+
bodyStyle: _objectSpread({
|
|
102
|
+
padding: "0px 0px 12px"
|
|
103
|
+
}, bodyStyle),
|
|
104
|
+
afterClose: function afterClose() {
|
|
105
|
+
currentTable.form.resetFields();
|
|
106
|
+
_afterClose === null || _afterClose === void 0 || _afterClose();
|
|
107
|
+
},
|
|
108
|
+
children: jsx(EditTableContent, {
|
|
109
|
+
contentRender: contentRender,
|
|
110
|
+
editTableProps: editTableProps,
|
|
111
|
+
configData: configData || [],
|
|
112
|
+
dialogTable: currentTable,
|
|
113
|
+
request: req,
|
|
114
|
+
dataSource: dataSource
|
|
115
|
+
})
|
|
116
|
+
}));
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
export { ModalEditTable as default };
|
|
120
|
+
// powered by hdj
|
|
@@ -12,7 +12,7 @@ import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWitho
|
|
|
12
12
|
import { jsx } from 'react/jsx-runtime';
|
|
13
13
|
import { Modal } from 'antd';
|
|
14
14
|
import { useVisible, useTableProps, useCurrentTable } from './hooks.js';
|
|
15
|
-
import
|
|
15
|
+
import { TableContent } from './Content.js';
|
|
16
16
|
|
|
17
17
|
var _excluded = ["configData", "request", "tableProps", "dialogTable", "visible", "onCancel", "bodyStyle", "afterClose", "contentRender", "width", "footer"];
|
|
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; }
|
|
@@ -105,7 +105,7 @@ var ModalTable = (function (_ref) {
|
|
|
105
105
|
currentTable.form.resetFields();
|
|
106
106
|
_afterClose === null || _afterClose === void 0 || _afterClose();
|
|
107
107
|
},
|
|
108
|
-
children: jsx(
|
|
108
|
+
children: jsx(TableContent, {
|
|
109
109
|
contentRender: contentRender,
|
|
110
110
|
tableProps: tableProps,
|
|
111
111
|
configData: configData || [],
|
|
@@ -4,21 +4,10 @@ export declare const useHDialogTable: () => HDiaLogTableInstance;
|
|
|
4
4
|
interface ParamsModal extends HOnDiaLogTableInstance {
|
|
5
5
|
dialogTable?: HDiaLogTableInstance;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
configData: import("../modal").ConfigDataModal | undefined;
|
|
12
|
-
request: ((params: import("../modal").ParamsModal) => Promise<import("../modal").ResultModal>) | undefined;
|
|
13
|
-
dataSource: any[] | undefined;
|
|
14
|
-
};
|
|
15
|
-
setModalTableParams: import("react").Dispatch<import("react").SetStateAction<{
|
|
16
|
-
params: Record<string, any> | undefined;
|
|
17
|
-
title: import("react").ReactNode;
|
|
18
|
-
configData: import("../modal").ConfigDataModal | undefined;
|
|
19
|
-
request: ((params: import("../modal").ParamsModal) => Promise<import("../modal").ResultModal>) | undefined;
|
|
20
|
-
dataSource: any[] | undefined;
|
|
21
|
-
}>>;
|
|
7
|
+
type TablePropsModal<T> = Omit<ModalTableProps<T>, "tableProps">;
|
|
8
|
+
export declare function useTableProps<T>({ configData, params, title, request, dataSource, }: TablePropsModal<T>): {
|
|
9
|
+
modalTableParams: TablePropsModal<T>;
|
|
10
|
+
setModalTableParams: import("react").Dispatch<import("react").SetStateAction<TablePropsModal<T>>>;
|
|
22
11
|
};
|
|
23
12
|
export declare const useCurrentTable: ({ show, hide, dialogTable }: ParamsModal) => HDiaLogTableInstance;
|
|
24
13
|
export declare const useVisible: (visible: boolean) => {
|
package/es/DialogTable/hooks.js
CHANGED
|
@@ -24,7 +24,7 @@ var useHDialogTable = function useHDialogTable() {
|
|
|
24
24
|
});
|
|
25
25
|
}, []);
|
|
26
26
|
};
|
|
27
|
-
|
|
27
|
+
function useTableProps(_ref) {
|
|
28
28
|
var configData = _ref.configData,
|
|
29
29
|
params = _ref.params,
|
|
30
30
|
title = _ref.title,
|
|
@@ -49,11 +49,18 @@ var useTableProps = function useTableProps(_ref) {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}, [configData]);
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
setModalTableParams(function (oldVal) {
|
|
54
|
+
return _objectSpread(_objectSpread({}, oldVal), {}, {
|
|
55
|
+
dataSource: dataSource
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}, [dataSource]);
|
|
52
59
|
return {
|
|
53
60
|
modalTableParams: modalTableParams,
|
|
54
61
|
setModalTableParams: setModalTableParams
|
|
55
62
|
};
|
|
56
|
-
}
|
|
63
|
+
}
|
|
57
64
|
var useCurrentTable = function useCurrentTable(_ref2) {
|
|
58
65
|
var show = _ref2.show,
|
|
59
66
|
hide = _ref2.hide,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EditTableProps } from "./modal";
|
|
2
|
+
import { MutableRefObject } from "react";
|
|
3
|
+
import type { ActionType } from "@ant-design/pro-table";
|
|
4
|
+
import { EditableFormInstance } from "@ant-design/pro-table/lib/components/EditableTable";
|
|
5
|
+
export declare const useListRequest: ({ request, dataSource }: EditTableProps) => import("@ahooksjs/use-request/lib/types").BaseResult<any, [params: any]>;
|
|
6
|
+
export declare const useCuRef: ({ actionRef, editableFormRef }: EditTableProps) => {
|
|
7
|
+
cuActionRef: MutableRefObject<ActionType>;
|
|
8
|
+
cuEditableFormRef: MutableRefObject<EditableFormInstance>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
3
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
4
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
5
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
6
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
7
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
8
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
9
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
10
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
11
|
+
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
|
12
|
+
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
13
|
+
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
14
|
+
import { useRequest } from 'ahooks';
|
|
15
|
+
import { useMemo, useRef } from 'react';
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
+
var useListRequest = function useListRequest(_ref) {
|
|
20
|
+
var request = _ref.request,
|
|
21
|
+
dataSource = _ref.dataSource;
|
|
22
|
+
var saveParams = useMemo(function () {
|
|
23
|
+
return {
|
|
24
|
+
params: {}
|
|
25
|
+
};
|
|
26
|
+
}, []);
|
|
27
|
+
return useRequest( /*#__PURE__*/function () {
|
|
28
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
|
|
29
|
+
var newParams;
|
|
30
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
31
|
+
while (1) switch (_context.prev = _context.next) {
|
|
32
|
+
case 0:
|
|
33
|
+
newParams = _objectSpread(_objectSpread({}, saveParams.params), params);
|
|
34
|
+
saveParams.params = newParams;
|
|
35
|
+
if (!request) {
|
|
36
|
+
_context.next = 4;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
return _context.abrupt("return", request(newParams));
|
|
40
|
+
case 4:
|
|
41
|
+
if (!_Array$isArray(dataSource)) {
|
|
42
|
+
_context.next = 6;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
return _context.abrupt("return", dataSource);
|
|
46
|
+
case 6:
|
|
47
|
+
return _context.abrupt("return", dataSource);
|
|
48
|
+
case 7:
|
|
49
|
+
case "end":
|
|
50
|
+
return _context.stop();
|
|
51
|
+
}
|
|
52
|
+
}, _callee);
|
|
53
|
+
}));
|
|
54
|
+
return function (_x) {
|
|
55
|
+
return _ref2.apply(this, arguments);
|
|
56
|
+
};
|
|
57
|
+
}(), {
|
|
58
|
+
manual: true,
|
|
59
|
+
refreshDeps: [dataSource]
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
var useCuRef = function useCuRef(_ref3) {
|
|
63
|
+
var actionRef = _ref3.actionRef,
|
|
64
|
+
editableFormRef = _ref3.editableFormRef;
|
|
65
|
+
var defaultActionRef = useRef();
|
|
66
|
+
var defaultTableRef = useRef();
|
|
67
|
+
var cuActionRef = actionRef || defaultActionRef;
|
|
68
|
+
var cuEditableFormRef = editableFormRef || defaultTableRef;
|
|
69
|
+
return {
|
|
70
|
+
cuActionRef: cuActionRef,
|
|
71
|
+
cuEditableFormRef: cuEditableFormRef
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export { useCuRef, useListRequest };
|
|
76
|
+
// powered by hdj
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { EditTableProps } from "./modal";
|
|
3
|
+
declare const _default: ({ configData, rowKey, creatorButtonText, recordCreatorProps, defaultRecordValue, pagination, editable, dataSource, request, manual, emptyRender, errorRender, onAdd, onEdit, actionRef, editableFormRef, ...props }: EditTableProps) => JSX.Element;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
|
3
|
+
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
4
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
5
|
+
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
6
|
+
import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
|
|
7
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
8
|
+
import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
|
|
9
|
+
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
10
|
+
import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
|
|
11
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
12
|
+
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
13
|
+
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
14
|
+
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
15
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
16
|
+
import { EditableProTable } from '@ant-design/pro-table';
|
|
17
|
+
import { useClassName } from '../hooks/index.js';
|
|
18
|
+
import HTablePagination from '../HTablePagination/index.js';
|
|
19
|
+
import { ConfigProvider } from 'antd';
|
|
20
|
+
import { emptyDefaultRender, errorDefaultRender } from '../HTableBody/defaultRender.js';
|
|
21
|
+
import { useHTableConfigContext } from '../TableConfig.js';
|
|
22
|
+
import { useListRequest, useCuRef } from './hooks.js';
|
|
23
|
+
|
|
24
|
+
var _excluded = ["configData", "rowKey", "creatorButtonText", "recordCreatorProps", "defaultRecordValue", "pagination", "editable", "dataSource", "request", "manual", "emptyRender", "errorRender", "onAdd", "onEdit", "actionRef", "editableFormRef"],
|
|
25
|
+
_excluded2 = ["index", "id"];
|
|
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; }
|
|
27
|
+
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; }
|
|
28
|
+
var EditTable = (function (_ref) {
|
|
29
|
+
var configData = _ref.configData,
|
|
30
|
+
_ref$rowKey = _ref.rowKey,
|
|
31
|
+
rowKey = _ref$rowKey === void 0 ? "id" : _ref$rowKey,
|
|
32
|
+
_ref$creatorButtonTex = _ref.creatorButtonText,
|
|
33
|
+
creatorButtonText = _ref$creatorButtonTex === void 0 ? "新增一列" : _ref$creatorButtonTex,
|
|
34
|
+
_ref$recordCreatorPro = _ref.recordCreatorProps,
|
|
35
|
+
recordCreatorProps = _ref$recordCreatorPro === void 0 ? {} : _ref$recordCreatorPro;
|
|
36
|
+
_ref.defaultRecordValue;
|
|
37
|
+
var pagination = _ref.pagination,
|
|
38
|
+
_ref$editable = _ref.editable,
|
|
39
|
+
editable = _ref$editable === void 0 ? {} : _ref$editable,
|
|
40
|
+
dataSource = _ref.dataSource,
|
|
41
|
+
request = _ref.request,
|
|
42
|
+
manual = _ref.manual,
|
|
43
|
+
emptyRender = _ref.emptyRender,
|
|
44
|
+
errorRender = _ref.errorRender,
|
|
45
|
+
onAdd = _ref.onAdd,
|
|
46
|
+
onEdit = _ref.onEdit,
|
|
47
|
+
actionRef = _ref.actionRef,
|
|
48
|
+
editableFormRef = _ref.editableFormRef,
|
|
49
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
+
var tableBody = useClassName("hw-table-body");
|
|
51
|
+
var _useListRequest = useListRequest({
|
|
52
|
+
request: request,
|
|
53
|
+
dataSource: dataSource
|
|
54
|
+
}),
|
|
55
|
+
loading = _useListRequest.loading,
|
|
56
|
+
data = _useListRequest.data,
|
|
57
|
+
error = _useListRequest.error,
|
|
58
|
+
run = _useListRequest.run;
|
|
59
|
+
var _useHTableConfigConte = useHTableConfigContext({
|
|
60
|
+
emptyRender: emptyRender,
|
|
61
|
+
errorRender: errorRender
|
|
62
|
+
}),
|
|
63
|
+
_useHTableConfigConte2 = _useHTableConfigConte.emptyRender,
|
|
64
|
+
tableEmptyRender = _useHTableConfigConte2 === void 0 ? emptyDefaultRender : _useHTableConfigConte2,
|
|
65
|
+
_useHTableConfigConte3 = _useHTableConfigConte.errorRender,
|
|
66
|
+
tableErrorRender = _useHTableConfigConte3 === void 0 ? errorDefaultRender : _useHTableConfigConte3;
|
|
67
|
+
var isLocalData = _Array$isArray(data);
|
|
68
|
+
var values = isLocalData ? data : data === null || data === void 0 ? void 0 : data.record;
|
|
69
|
+
var _useCuRef = useCuRef({
|
|
70
|
+
actionRef: actionRef,
|
|
71
|
+
editableFormRef: editableFormRef
|
|
72
|
+
}),
|
|
73
|
+
cuActionRef = _useCuRef.cuActionRef,
|
|
74
|
+
cuEditableFormRef = _useCuRef.cuEditableFormRef;
|
|
75
|
+
return jsxs("div", {
|
|
76
|
+
className: tableBody,
|
|
77
|
+
children: [jsx(ConfigProvider, {
|
|
78
|
+
renderEmpty: function renderEmpty() {
|
|
79
|
+
if (error) {
|
|
80
|
+
return tableErrorRender === null || tableErrorRender === void 0 ? void 0 : tableErrorRender({
|
|
81
|
+
reload: cuActionRef.current.reload,
|
|
82
|
+
error: error
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return tableEmptyRender === null || tableEmptyRender === void 0 ? void 0 : tableEmptyRender();
|
|
86
|
+
},
|
|
87
|
+
children: jsx(EditableProTable, _objectSpread({
|
|
88
|
+
columns: configData,
|
|
89
|
+
loading: loading,
|
|
90
|
+
rowKey: rowKey,
|
|
91
|
+
editableFormRef: cuEditableFormRef,
|
|
92
|
+
manualRequest: manual,
|
|
93
|
+
request: run,
|
|
94
|
+
actionRef: cuActionRef,
|
|
95
|
+
value: values,
|
|
96
|
+
recordCreatorProps: _objectSpread({
|
|
97
|
+
position: "bottom",
|
|
98
|
+
record: function record() {
|
|
99
|
+
return {
|
|
100
|
+
id: "add"
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
creatorButtonText: creatorButtonText
|
|
104
|
+
}, recordCreatorProps),
|
|
105
|
+
editable: _objectSpread({
|
|
106
|
+
type: "single",
|
|
107
|
+
onCancel: function () {
|
|
108
|
+
var _onCancel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(keys) {
|
|
109
|
+
var _cuEditableFormRef$cu;
|
|
110
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
111
|
+
while (1) switch (_context.prev = _context.next) {
|
|
112
|
+
case 0:
|
|
113
|
+
(_cuEditableFormRef$cu = cuEditableFormRef.current) === null || _cuEditableFormRef$cu === void 0 || _cuEditableFormRef$cu.resetFields([keys]);
|
|
114
|
+
case 1:
|
|
115
|
+
case "end":
|
|
116
|
+
return _context.stop();
|
|
117
|
+
}
|
|
118
|
+
}, _callee);
|
|
119
|
+
}));
|
|
120
|
+
function onCancel(_x) {
|
|
121
|
+
return _onCancel.apply(this, arguments);
|
|
122
|
+
}
|
|
123
|
+
return onCancel;
|
|
124
|
+
}(),
|
|
125
|
+
actionRender: function actionRender(trow, tconfig, defaultDoms) {
|
|
126
|
+
return [defaultDoms.save, defaultDoms.cancel];
|
|
127
|
+
},
|
|
128
|
+
onSave: function () {
|
|
129
|
+
var _onSave = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(key, row) {
|
|
130
|
+
var _cuEditableFormRef$cu3, _cuActionRef$current2;
|
|
131
|
+
var id, oRow, _cuEditableFormRef$cu2, _cuActionRef$current;
|
|
132
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
133
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
134
|
+
case 0:
|
|
135
|
+
row.index, id = row.id, oRow = _objectWithoutProperties(row, _excluded2);
|
|
136
|
+
if (!(key === "add")) {
|
|
137
|
+
_context2.next = 7;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
_context2.next = 4;
|
|
141
|
+
return onAdd === null || onAdd === void 0 ? void 0 : onAdd(oRow);
|
|
142
|
+
case 4:
|
|
143
|
+
(_cuEditableFormRef$cu2 = cuEditableFormRef.current) === null || _cuEditableFormRef$cu2 === void 0 || _cuEditableFormRef$cu2.resetFields(["add"]);
|
|
144
|
+
(_cuActionRef$current = cuActionRef.current) === null || _cuActionRef$current === void 0 || _cuActionRef$current.reload();
|
|
145
|
+
return _context2.abrupt("return");
|
|
146
|
+
case 7:
|
|
147
|
+
_context2.next = 9;
|
|
148
|
+
return onEdit === null || onEdit === void 0 ? void 0 : onEdit(_objectSpread({
|
|
149
|
+
id: id
|
|
150
|
+
}, oRow));
|
|
151
|
+
case 9:
|
|
152
|
+
(_cuEditableFormRef$cu3 = cuEditableFormRef.current) === null || _cuEditableFormRef$cu3 === void 0 || _cuEditableFormRef$cu3.resetFields(["key"]);
|
|
153
|
+
(_cuActionRef$current2 = cuActionRef.current) === null || _cuActionRef$current2 === void 0 || _cuActionRef$current2.reload();
|
|
154
|
+
case 11:
|
|
155
|
+
case "end":
|
|
156
|
+
return _context2.stop();
|
|
157
|
+
}
|
|
158
|
+
}, _callee2);
|
|
159
|
+
}));
|
|
160
|
+
function onSave(_x2, _x3) {
|
|
161
|
+
return _onSave.apply(this, arguments);
|
|
162
|
+
}
|
|
163
|
+
return onSave;
|
|
164
|
+
}()
|
|
165
|
+
}, editable)
|
|
166
|
+
}, props))
|
|
167
|
+
}), jsx(HTablePagination, _objectSpread(_objectSpread({
|
|
168
|
+
data: isLocalData ? null : data
|
|
169
|
+
}, pagination), {}, {
|
|
170
|
+
onChange: function onChange(page, pageSize) {
|
|
171
|
+
run({
|
|
172
|
+
size: pageSize,
|
|
173
|
+
current: page
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}))]
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
export { EditTable as default };
|
|
181
|
+
// powered by hdj
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EditableProTableProps } from "@ant-design/pro-table/lib/components/EditableTable";
|
|
2
|
+
import { ParamsType } from "@ant-design/pro-provider";
|
|
3
|
+
import { IPaginationProps } from "../HTablePagination";
|
|
4
|
+
import { EmptyPageRender, ErrorPageRender } from "../modal";
|
|
5
|
+
import { ProColumns } from "@ant-design/pro-table/lib/typing";
|
|
6
|
+
export interface EditTableProps<T = any> extends Omit<EditableProTableProps<T, ParamsType>, "recordCreatorProps" | "request" | "pagination"> {
|
|
7
|
+
creatorButtonText?: string;
|
|
8
|
+
defaultRecordValue?: T;
|
|
9
|
+
recordCreatorProps?: Partial<EditableProTableProps<T, ParamsType>["recordCreatorProps"]>;
|
|
10
|
+
dataSource?: any[];
|
|
11
|
+
request?: (params: Record<string, any>) => Promise<T>;
|
|
12
|
+
pagination?: IPaginationProps;
|
|
13
|
+
manual?: boolean;
|
|
14
|
+
emptyRender?: EmptyPageRender;
|
|
15
|
+
errorRender?: ErrorPageRender;
|
|
16
|
+
onAdd?: (data: T) => Promise<void>;
|
|
17
|
+
onEdit?: (data: T) => Promise<void>;
|
|
18
|
+
configData?: ProColumns<T>[];
|
|
19
|
+
}
|