@hw-component/table 1.9.13 → 1.9.15

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 (37) hide show
  1. package/es/DialogTable/Content.d.ts +2 -1
  2. package/es/DialogTable/Content.js +4 -2
  3. package/es/DialogTable/DwTable.d.ts +1 -0
  4. package/es/DialogTable/DwTable.js +10 -4
  5. package/es/DialogTable/ModalTable.d.ts +1 -0
  6. package/es/DialogTable/ModalTable.js +9 -3
  7. package/es/DialogTable/hooks.d.ts +3 -1
  8. package/es/DialogTable/hooks.js +4 -2
  9. package/es/Table.d.ts +1 -1
  10. package/es/Table.js +8 -9
  11. package/es/hooks/useReq.d.ts +3 -3
  12. package/es/hooks/useReq.js +82 -19
  13. package/es/modal.d.ts +3 -1
  14. package/lib/DialogTable/Content.d.ts +2 -1
  15. package/lib/DialogTable/Content.js +4 -2
  16. package/lib/DialogTable/DwTable.d.ts +1 -0
  17. package/lib/DialogTable/DwTable.js +10 -4
  18. package/lib/DialogTable/ModalTable.d.ts +1 -0
  19. package/lib/DialogTable/ModalTable.js +9 -3
  20. package/lib/DialogTable/hooks.d.ts +3 -1
  21. package/lib/DialogTable/hooks.js +4 -2
  22. package/lib/Table.d.ts +1 -1
  23. package/lib/Table.js +8 -9
  24. package/lib/hooks/useReq.d.ts +3 -3
  25. package/lib/hooks/useReq.js +81 -18
  26. package/lib/modal.d.ts +3 -1
  27. package/package.json +15 -14
  28. package/src/components/DialogTable/Content.tsx +2 -0
  29. package/src/components/DialogTable/DwTable.tsx +10 -2
  30. package/src/components/DialogTable/ModalTable.tsx +11 -2
  31. package/src/components/DialogTable/hooks.ts +2 -0
  32. package/src/components/Table.tsx +7 -5
  33. package/src/components/hooks/useReq.ts +57 -8
  34. package/src/components/modal.ts +3 -1
  35. package/src/pages/DwTable/index.tsx +16 -2
  36. package/src/pages/ModalTable/index.tsx +14 -2
  37. package/src/pages/Table/index.tsx +27 -32
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ModalTableProps } from "@/components/modal";
2
- declare const _default: ({ tableProps, configData, dialogTable, request, contentRender, }: ModalTableProps) => JSX.Element;
3
+ declare const _default: ({ tableProps, configData, dialogTable, request, contentRender, dataSource, }: ModalTableProps) => JSX.Element;
3
4
  export default _default;
@@ -18,12 +18,14 @@ var Content = (function (_ref) {
18
18
  configData = _ref.configData,
19
19
  dialogTable = _ref.dialogTable,
20
20
  request = _ref.request,
21
- contentRender = _ref.contentRender;
21
+ contentRender = _ref.contentRender,
22
+ dataSource = _ref.dataSource;
22
23
  var node = jsx(Table, _objectSpread(_objectSpread({}, tableProps), {}, {
23
24
  configData: configData || [],
24
25
  table: dialogTable,
25
26
  request: request,
26
- affixProps: false
27
+ affixProps: false,
28
+ dataSource: dataSource
27
29
  }));
28
30
  return jsx(Fragment, {
29
31
  children: contentRender ? contentRender(node) : node
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { DwTableProps } from "../modal";
2
3
  declare const _default: ({ configData: configDataProps, request: requestProps, tableProps, dialogTable, visible, bodyStyle, onClose, afterVisibleChange, contentRender, width, footer, ...props }: DwTableProps) => JSX.Element;
3
4
  export default _default;
@@ -54,7 +54,8 @@ var DwTable = (function (_ref) {
54
54
  var configData = oldParams.configData,
55
55
  request = oldParams.request,
56
56
  title = oldParams.title,
57
- oldP = oldParams.params;
57
+ oldP = oldParams.params,
58
+ oldDataSource = oldParams.dataSource;
58
59
  var _showParams$title = showParams.title,
59
60
  showTitle = _showParams$title === void 0 ? title : _showParams$title,
60
61
  _showParams$configDat = showParams.configData,
@@ -62,13 +63,16 @@ var DwTable = (function (_ref) {
62
63
  _showParams$request = showParams.request,
63
64
  showReq = _showParams$request === void 0 ? request : _showParams$request,
64
65
  _showParams$params = showParams.params,
65
- params = _showParams$params === void 0 ? oldP : _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;
66
69
  currentTable.params = params;
67
70
  return {
68
71
  title: showTitle,
69
72
  request: showReq,
70
73
  configData: showConfigData,
71
- params: params
74
+ params: params,
75
+ dataSource: dataSource
72
76
  };
73
77
  });
74
78
  }
@@ -81,6 +85,7 @@ var DwTable = (function (_ref) {
81
85
  });
82
86
  var configData = modalTableParams.configData,
83
87
  request = modalTableParams.request,
88
+ dataSource = modalTableParams.dataSource,
84
89
  title = modalTableParams.title,
85
90
  params = modalTableParams.params;
86
91
  var req = request ? function (reqParams) {
@@ -119,7 +124,8 @@ var DwTable = (function (_ref) {
119
124
  tableProps: tableProps,
120
125
  configData: configData || [],
121
126
  dialogTable: currentTable,
122
- request: req
127
+ request: req,
128
+ dataSource: dataSource
123
129
  })
124
130
  }));
125
131
  });
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ModalTableProps } from "../modal";
2
3
  declare const _default: ({ configData: configDataProps, request: requestProps, tableProps, dialogTable, visible, onCancel, bodyStyle, afterClose, contentRender, width, footer, ...props }: ModalTableProps) => JSX.Element;
3
4
  export default _default;
@@ -51,13 +51,16 @@ var ModalTable = (function (_ref) {
51
51
  var configData = oldParams.configData,
52
52
  request = oldParams.request,
53
53
  title = oldParams.title,
54
- oldP = oldParams.params;
54
+ oldP = oldParams.params,
55
+ oldDataSource = oldParams.dataSource;
55
56
  var _showParams$title = showParams.title,
56
57
  showTitle = _showParams$title === void 0 ? title : _showParams$title,
57
58
  _showParams$configDat = showParams.configData,
58
59
  showConfigData = _showParams$configDat === void 0 ? configData : _showParams$configDat,
59
60
  _showParams$request = showParams.request,
60
61
  showReq = _showParams$request === void 0 ? request : _showParams$request,
62
+ _showParams$dataSourc = showParams.dataSource,
63
+ dataSource = _showParams$dataSourc === void 0 ? oldDataSource : _showParams$dataSourc,
61
64
  _showParams$params = showParams.params,
62
65
  params = _showParams$params === void 0 ? oldP : _showParams$params;
63
66
  currentTable.params = params;
@@ -65,7 +68,8 @@ var ModalTable = (function (_ref) {
65
68
  title: showTitle,
66
69
  request: showReq,
67
70
  configData: showConfigData,
68
- params: params
71
+ params: params,
72
+ dataSource: dataSource
69
73
  };
70
74
  });
71
75
  }
@@ -77,6 +81,7 @@ var ModalTable = (function (_ref) {
77
81
  dialogTable: dialogTable
78
82
  });
79
83
  var configData = modalTableParams.configData,
84
+ dataSource = modalTableParams.dataSource,
80
85
  request = modalTableParams.request,
81
86
  title = modalTableParams.title,
82
87
  params = modalTableParams.params;
@@ -106,7 +111,8 @@ var ModalTable = (function (_ref) {
106
111
  tableProps: tableProps,
107
112
  configData: configData || [],
108
113
  dialogTable: currentTable,
109
- request: req
114
+ request: req,
115
+ dataSource: dataSource
110
116
  })
111
117
  }));
112
118
  });
@@ -4,18 +4,20 @@ export declare const useHDialogTable: () => HDiaLogTableInstance;
4
4
  interface ParamsModal extends HOnDiaLogTableInstance {
5
5
  dialogTable?: HDiaLogTableInstance;
6
6
  }
7
- export declare const useTableProps: ({ configData, params, title, request, }: Omit<ModalTableProps, "tableProps">) => {
7
+ export declare const useTableProps: ({ configData, params, title, request, dataSource, }: Omit<ModalTableProps, "tableProps">) => {
8
8
  modalTableParams: {
9
9
  params: Record<string, any> | undefined;
10
10
  title: import("react").ReactNode;
11
11
  configData: import("../modal").ConfigDataModal | undefined;
12
12
  request: ((params: import("../modal").ParamsModal) => Promise<import("../modal").ResultModal>) | undefined;
13
+ dataSource: any[] | undefined;
13
14
  };
14
15
  setModalTableParams: import("react").Dispatch<import("react").SetStateAction<{
15
16
  params: Record<string, any> | undefined;
16
17
  title: import("react").ReactNode;
17
18
  configData: import("../modal").ConfigDataModal | undefined;
18
19
  request: ((params: import("../modal").ParamsModal) => Promise<import("../modal").ResultModal>) | undefined;
20
+ dataSource: any[] | undefined;
19
21
  }>>;
20
22
  };
21
23
  export declare const useCurrentTable: ({ show, hide, dialogTable }: ParamsModal) => HDiaLogTableInstance;
@@ -28,12 +28,14 @@ var useTableProps = function useTableProps(_ref) {
28
28
  var configData = _ref.configData,
29
29
  params = _ref.params,
30
30
  title = _ref.title,
31
- request = _ref.request;
31
+ request = _ref.request,
32
+ dataSource = _ref.dataSource;
32
33
  var _useState = useState({
33
34
  params: params,
34
35
  title: title,
35
36
  configData: configData,
36
- request: request
37
+ request: request,
38
+ dataSource: dataSource
37
39
  }),
38
40
  _useState2 = _slicedToArray(_useState, 2),
39
41
  modalTableParams = _useState2[0],
package/es/Table.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { HTableProps } from "./modal";
3
- declare const _default: ({ request, configData, searchSpan, table, hideHeader, headerStyle, tableStyle, action, spaceSize, className, paginationStyle, rowKey, onFinish, manual, formInitValues, hideLabel, labelWidth, onReset, style, ...props }: HTableProps) => JSX.Element;
3
+ declare const _default: ({ request, configData, searchSpan, table, hideHeader, headerStyle, tableStyle, action, spaceSize, className, paginationStyle, rowKey, onFinish, manual, formInitValues, hideLabel, labelWidth, onReset, style, dataSource, reload, ...props }: HTableProps) => JSX.Element;
4
4
  export default _default;
package/es/Table.js CHANGED
@@ -17,13 +17,12 @@ import Body from './HTableBody/index.js';
17
17
  import useCurrentTable from './hooks/useCurrentTable.js';
18
18
  import useRowObj from './hooks/useRowObj.js';
19
19
  import { HTableContext } from './context.js';
20
- import { Space } from 'antd';
21
20
  import useReq from './hooks/useReq.js';
22
21
  import useDispatch from './hooks/useDispatch.js';
23
22
  import { useState } from 'react';
24
23
  import { useClassName } from './hooks/index.js';
25
24
 
26
- var _excluded = ["request", "configData", "searchSpan", "table", "hideHeader", "headerStyle", "tableStyle", "action", "spaceSize", "className", "paginationStyle", "rowKey", "onFinish", "manual", "formInitValues", "hideLabel", "labelWidth", "onReset", "style"];
25
+ var _excluded = ["request", "configData", "searchSpan", "table", "hideHeader", "headerStyle", "tableStyle", "action", "spaceSize", "className", "paginationStyle", "rowKey", "onFinish", "manual", "formInitValues", "hideLabel", "labelWidth", "onReset", "style", "dataSource", "reload"];
27
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; }
28
27
  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; }
29
28
  var Table = (function (_ref) {
@@ -49,11 +48,15 @@ var Table = (function (_ref) {
49
48
  labelWidth = _ref.labelWidth,
50
49
  onReset = _ref.onReset,
51
50
  style = _ref.style,
51
+ dataSource = _ref.dataSource,
52
+ reload = _ref.reload,
52
53
  props = _objectWithoutProperties(_ref, _excluded);
53
54
  var _useReq = useReq({
54
55
  request: request,
55
56
  manual: manual,
56
- formInitValues: formInitValues
57
+ formInitValues: formInitValues,
58
+ dataSource: dataSource,
59
+ reload: reload
57
60
  }),
58
61
  run = _useReq.run,
59
62
  loading = _useReq.loading,
@@ -115,12 +118,8 @@ var Table = (function (_ref) {
115
118
  hideLabel: hideLabel,
116
119
  labelWidth: labelWidth
117
120
  },
118
- children: jsxs(Space, {
119
- direction: "vertical",
120
- size: 0,
121
- style: _objectSpread({
122
- width: "100%"
123
- }, style),
121
+ children: jsxs("div", {
122
+ style: _objectSpread({}, style),
124
123
  className: _concatInstanceProperty(_context = "".concat(contentClassName, " ")).call(_context, className),
125
124
  children: [!hideHeader && jsx(Header, {
126
125
  searchSpan: searchSpan,
@@ -4,7 +4,7 @@ export interface IParamsModal {
4
4
  loading?: boolean;
5
5
  error?: Error;
6
6
  reload?: (params: any) => Promise<any>;
7
- dataSource?: any;
7
+ dataSource?: ResultModal | any[];
8
8
  manual?: boolean;
9
9
  formInitValues?: Record<string, any>;
10
10
  }
@@ -28,8 +28,8 @@ declare const _default: ({ request, loading, error, reload, dataSource, manual,
28
28
  } | {
29
29
  loading: boolean | undefined;
30
30
  error: Error | undefined;
31
- data: any;
32
- run: (params?: Record<string, any>) => Promise<any>;
31
+ data: ResultModal;
32
+ run: (params?: Record<string, any>) => Promise<void>;
33
33
  saveParams: {
34
34
  old: {};
35
35
  };
@@ -7,53 +7,116 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js/instance/fo
7
7
  import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js/object/get-own-property-descriptors';
8
8
  import _Object$defineProperties from '@babel/runtime-corejs3/core-js/object/define-properties';
9
9
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js/object/define-property';
10
- import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
11
10
  import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
12
11
  import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
12
+ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
13
+ import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
13
14
  import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
14
- import { useMemo, useEffect } from 'react';
15
+ import 'core-js/modules/es.object.to-string.js';
16
+ import 'core-js/modules/es.regexp.to-string.js';
17
+ import _Number$parseInt from '@babel/runtime-corejs3/core-js/number/parse-int';
18
+ import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js/instance/slice';
19
+ import _Array$isArray from '@babel/runtime-corejs3/core-js/array/is-array';
20
+ import { useMemo, useEffect, useState } from 'react';
15
21
  import { useRequest } from 'ahooks';
16
22
 
17
23
  var _excluded = ["size", "current"],
18
24
  _excluded2 = ["size", "current"];
19
25
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
26
  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; }
21
- var useReq = (function (_ref) {
22
- var request = _ref.request,
23
- loading = _ref.loading,
24
- error = _ref.error,
25
- reload = _ref.reload,
26
- dataSource = _ref.dataSource,
27
- _ref$manual = _ref.manual,
28
- manual = _ref$manual === void 0 ? false : _ref$manual,
29
- _ref$formInitValues = _ref.formInitValues,
30
- formInitValues = _ref$formInitValues === void 0 ? {} : _ref$formInitValues;
27
+ var defaultDataSource = {
28
+ records: [],
29
+ total: "0",
30
+ size: "0",
31
+ current: "1"
32
+ };
33
+ var useDataSource = function useDataSource(_ref) {
34
+ var reload = _ref.reload,
35
+ dataSource = _ref.dataSource;
36
+ var _useState = useState(_objectSpread({}, defaultDataSource)),
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ cpDataSource = _useState2[0],
39
+ setCpDataSource = _useState2[1];
40
+ var localMaker = function localMaker(params) {
41
+ var size = params.size,
42
+ current = params.current;
43
+ var ps = _Number$parseInt(size);
44
+ var pn = _Number$parseInt(current);
45
+ var prvPn = pn - 1;
46
+ var arrDataSource = dataSource;
47
+ var records = _sliceInstanceProperty(arrDataSource).call(arrDataSource, prvPn * ps, pn * ps);
48
+ var total = arrDataSource.length;
49
+ return {
50
+ records: records,
51
+ size: size,
52
+ current: current,
53
+ total: total.toString()
54
+ };
55
+ };
56
+ var defaultReload = function defaultReload(params) {
57
+ if (_Array$isArray(dataSource)) {
58
+ console.warn("@hw-component/table:非受控模式reload将不起作用");
59
+ setCpDataSource(localMaker(params));
60
+ return;
61
+ }
62
+ reload === null || reload === void 0 || reload(params);
63
+ };
64
+ useEffect(function () {
65
+ if (_Array$isArray(dataSource)) {
66
+ setCpDataSource(function (old) {
67
+ return localMaker(old);
68
+ });
69
+ return;
70
+ }
71
+ setCpDataSource(dataSource || _objectSpread({}, defaultDataSource));
72
+ }, [dataSource]);
73
+ return {
74
+ reload: defaultReload,
75
+ dataSource: cpDataSource
76
+ };
77
+ };
78
+ var useReq = (function (_ref2) {
79
+ var request = _ref2.request,
80
+ loading = _ref2.loading,
81
+ error = _ref2.error,
82
+ reload = _ref2.reload,
83
+ dataSource = _ref2.dataSource,
84
+ _ref2$manual = _ref2.manual,
85
+ manual = _ref2$manual === void 0 ? false : _ref2$manual,
86
+ _ref2$formInitValues = _ref2.formInitValues,
87
+ formInitValues = _ref2$formInitValues === void 0 ? {} : _ref2$formInitValues;
31
88
  var saveParams = useMemo(function () {
32
89
  return {
33
90
  old: {}
34
91
  };
35
92
  }, []);
93
+ var _useDataSource = useDataSource({
94
+ reload: reload,
95
+ dataSource: dataSource
96
+ }),
97
+ localReload = _useDataSource.reload,
98
+ localDataSource = _useDataSource.dataSource;
36
99
  var reloadFn = /*#__PURE__*/function () {
37
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
100
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
38
101
  var params,
39
102
  _params$size,
40
103
  size,
41
104
  _params$current,
42
105
  current,
43
106
  oParams,
44
- reqParams,
107
+ requestParams,
45
108
  _args = arguments;
46
109
  return _regeneratorRuntime.wrap(function _callee$(_context) {
47
110
  while (1) switch (_context.prev = _context.next) {
48
111
  case 0:
49
112
  params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
50
113
  _params$size = params.size, size = _params$size === void 0 ? "10" : _params$size, _params$current = params.current, current = _params$current === void 0 ? "1" : _params$current, oParams = _objectWithoutProperties(params, _excluded);
51
- reqParams = _objectSpread({
114
+ requestParams = _objectSpread({
52
115
  size: size,
53
116
  current: current
54
117
  }, oParams);
55
- saveParams.old = reqParams;
56
- return _context.abrupt("return", reload === null || reload === void 0 ? void 0 : reload(reqParams));
118
+ saveParams.old = requestParams;
119
+ return _context.abrupt("return", localReload(requestParams));
57
120
  case 5:
58
121
  case "end":
59
122
  return _context.stop();
@@ -61,7 +124,7 @@ var useReq = (function (_ref) {
61
124
  }, _callee);
62
125
  }));
63
126
  return function reloadFn() {
64
- return _ref2.apply(this, arguments);
127
+ return _ref3.apply(this, arguments);
65
128
  };
66
129
  }();
67
130
  var resultAction = useRequest(function () {
@@ -98,7 +161,7 @@ var useReq = (function (_ref) {
98
161
  return {
99
162
  loading: loading,
100
163
  error: error,
101
- data: dataSource,
164
+ data: localDataSource,
102
165
  run: reloadFn,
103
166
  saveParams: saveParams
104
167
  };
package/es/modal.d.ts CHANGED
@@ -65,7 +65,7 @@ export interface HTableProps extends Omit<ProTableProps<any, any>, "request" | "
65
65
  error?: Error;
66
66
  reload?: (params: any) => Promise<any>;
67
67
  manual?: boolean;
68
- dataSource?: ResultModal;
68
+ dataSource?: ResultModal | any[];
69
69
  paginationStyle?: React.CSSProperties;
70
70
  allPageCheck?: boolean;
71
71
  rowSelection?: HRowSelection | false;
@@ -103,6 +103,7 @@ export interface DialogParamsModal {
103
103
  request?: HTableProps["request"];
104
104
  params?: Record<string, any>;
105
105
  title?: string | React.ReactNode;
106
+ dataSource?: any[];
106
107
  }
107
108
  export interface HOnDiaLogTableInstance {
108
109
  show: (params?: DialogParamsModal) => void;
@@ -130,6 +131,7 @@ export interface ModalTableProps extends ModalProps {
130
131
  configData?: HTableProps["configData"];
131
132
  request?: HTableProps["request"];
132
133
  contentRender?: (node: React.ReactNode) => React.ReactNode;
134
+ dataSource?: any[];
133
135
  }
134
136
  export type ValueTypeConfigRenderFn = (config: ConfigItemModal, itemData: any, index: number, tableInstance: HTableInstance) => React.ReactNode;
135
137
  export type ValueTypeConfigModal = Record<string, ValueTypeConfigRenderFn>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ModalTableProps } from "@/components/modal";
2
- declare const _default: ({ tableProps, configData, dialogTable, request, contentRender, }: ModalTableProps) => JSX.Element;
3
+ declare const _default: ({ tableProps, configData, dialogTable, request, contentRender, dataSource, }: ModalTableProps) => JSX.Element;
3
4
  export default _default;
@@ -21,12 +21,14 @@ var Content = (function (_ref) {
21
21
  configData = _ref.configData,
22
22
  dialogTable = _ref.dialogTable,
23
23
  request = _ref.request,
24
- contentRender = _ref.contentRender;
24
+ contentRender = _ref.contentRender,
25
+ dataSource = _ref.dataSource;
25
26
  var node = jsxRuntime.jsx(Table.default, _objectSpread(_objectSpread({}, tableProps), {}, {
26
27
  configData: configData || [],
27
28
  table: dialogTable,
28
29
  request: request,
29
- affixProps: false
30
+ affixProps: false,
31
+ dataSource: dataSource
30
32
  }));
31
33
  return jsxRuntime.jsx(jsxRuntime.Fragment, {
32
34
  children: contentRender ? contentRender(node) : node
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { DwTableProps } from "../modal";
2
3
  declare const _default: ({ configData: configDataProps, request: requestProps, tableProps, dialogTable, visible, bodyStyle, onClose, afterVisibleChange, contentRender, width, footer, ...props }: DwTableProps) => JSX.Element;
3
4
  export default _default;
@@ -57,7 +57,8 @@ var DwTable = (function (_ref) {
57
57
  var configData = oldParams.configData,
58
58
  request = oldParams.request,
59
59
  title = oldParams.title,
60
- oldP = oldParams.params;
60
+ oldP = oldParams.params,
61
+ oldDataSource = oldParams.dataSource;
61
62
  var _showParams$title = showParams.title,
62
63
  showTitle = _showParams$title === void 0 ? title : _showParams$title,
63
64
  _showParams$configDat = showParams.configData,
@@ -65,13 +66,16 @@ var DwTable = (function (_ref) {
65
66
  _showParams$request = showParams.request,
66
67
  showReq = _showParams$request === void 0 ? request : _showParams$request,
67
68
  _showParams$params = showParams.params,
68
- params = _showParams$params === void 0 ? oldP : _showParams$params;
69
+ params = _showParams$params === void 0 ? oldP : _showParams$params,
70
+ _showParams$dataSourc = showParams.dataSource,
71
+ dataSource = _showParams$dataSourc === void 0 ? oldDataSource : _showParams$dataSourc;
69
72
  currentTable.params = params;
70
73
  return {
71
74
  title: showTitle,
72
75
  request: showReq,
73
76
  configData: showConfigData,
74
- params: params
77
+ params: params,
78
+ dataSource: dataSource
75
79
  };
76
80
  });
77
81
  }
@@ -84,6 +88,7 @@ var DwTable = (function (_ref) {
84
88
  });
85
89
  var configData = modalTableParams.configData,
86
90
  request = modalTableParams.request,
91
+ dataSource = modalTableParams.dataSource,
87
92
  title = modalTableParams.title,
88
93
  params = modalTableParams.params;
89
94
  var req = request ? function (reqParams) {
@@ -122,7 +127,8 @@ var DwTable = (function (_ref) {
122
127
  tableProps: tableProps,
123
128
  configData: configData || [],
124
129
  dialogTable: currentTable,
125
- request: req
130
+ request: req,
131
+ dataSource: dataSource
126
132
  })
127
133
  }));
128
134
  });
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ModalTableProps } from "../modal";
2
3
  declare const _default: ({ configData: configDataProps, request: requestProps, tableProps, dialogTable, visible, onCancel, bodyStyle, afterClose, contentRender, width, footer, ...props }: ModalTableProps) => JSX.Element;
3
4
  export default _default;
@@ -54,13 +54,16 @@ var ModalTable = (function (_ref) {
54
54
  var configData = oldParams.configData,
55
55
  request = oldParams.request,
56
56
  title = oldParams.title,
57
- oldP = oldParams.params;
57
+ oldP = oldParams.params,
58
+ oldDataSource = oldParams.dataSource;
58
59
  var _showParams$title = showParams.title,
59
60
  showTitle = _showParams$title === void 0 ? title : _showParams$title,
60
61
  _showParams$configDat = showParams.configData,
61
62
  showConfigData = _showParams$configDat === void 0 ? configData : _showParams$configDat,
62
63
  _showParams$request = showParams.request,
63
64
  showReq = _showParams$request === void 0 ? request : _showParams$request,
65
+ _showParams$dataSourc = showParams.dataSource,
66
+ dataSource = _showParams$dataSourc === void 0 ? oldDataSource : _showParams$dataSourc,
64
67
  _showParams$params = showParams.params,
65
68
  params = _showParams$params === void 0 ? oldP : _showParams$params;
66
69
  currentTable.params = params;
@@ -68,7 +71,8 @@ var ModalTable = (function (_ref) {
68
71
  title: showTitle,
69
72
  request: showReq,
70
73
  configData: showConfigData,
71
- params: params
74
+ params: params,
75
+ dataSource: dataSource
72
76
  };
73
77
  });
74
78
  }
@@ -80,6 +84,7 @@ var ModalTable = (function (_ref) {
80
84
  dialogTable: dialogTable
81
85
  });
82
86
  var configData = modalTableParams.configData,
87
+ dataSource = modalTableParams.dataSource,
83
88
  request = modalTableParams.request,
84
89
  title = modalTableParams.title,
85
90
  params = modalTableParams.params;
@@ -109,7 +114,8 @@ var ModalTable = (function (_ref) {
109
114
  tableProps: tableProps,
110
115
  configData: configData || [],
111
116
  dialogTable: currentTable,
112
- request: req
117
+ request: req,
118
+ dataSource: dataSource
113
119
  })
114
120
  }));
115
121
  });
@@ -4,18 +4,20 @@ export declare const useHDialogTable: () => HDiaLogTableInstance;
4
4
  interface ParamsModal extends HOnDiaLogTableInstance {
5
5
  dialogTable?: HDiaLogTableInstance;
6
6
  }
7
- export declare const useTableProps: ({ configData, params, title, request, }: Omit<ModalTableProps, "tableProps">) => {
7
+ export declare const useTableProps: ({ configData, params, title, request, dataSource, }: Omit<ModalTableProps, "tableProps">) => {
8
8
  modalTableParams: {
9
9
  params: Record<string, any> | undefined;
10
10
  title: import("react").ReactNode;
11
11
  configData: import("../modal").ConfigDataModal | undefined;
12
12
  request: ((params: import("../modal").ParamsModal) => Promise<import("../modal").ResultModal>) | undefined;
13
+ dataSource: any[] | undefined;
13
14
  };
14
15
  setModalTableParams: import("react").Dispatch<import("react").SetStateAction<{
15
16
  params: Record<string, any> | undefined;
16
17
  title: import("react").ReactNode;
17
18
  configData: import("../modal").ConfigDataModal | undefined;
18
19
  request: ((params: import("../modal").ParamsModal) => Promise<import("../modal").ResultModal>) | undefined;
20
+ dataSource: any[] | undefined;
19
21
  }>>;
20
22
  };
21
23
  export declare const useCurrentTable: ({ show, hide, dialogTable }: ParamsModal) => HDiaLogTableInstance;
@@ -29,12 +29,14 @@ var useTableProps = function useTableProps(_ref) {
29
29
  var configData = _ref.configData,
30
30
  params = _ref.params,
31
31
  title = _ref.title,
32
- request = _ref.request;
32
+ request = _ref.request,
33
+ dataSource = _ref.dataSource;
33
34
  var _useState = React.useState({
34
35
  params: params,
35
36
  title: title,
36
37
  configData: configData,
37
- request: request
38
+ request: request,
39
+ dataSource: dataSource
38
40
  }),
39
41
  _useState2 = _slicedToArray(_useState, 2),
40
42
  modalTableParams = _useState2[0],
package/lib/Table.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { HTableProps } from "./modal";
3
- declare const _default: ({ request, configData, searchSpan, table, hideHeader, headerStyle, tableStyle, action, spaceSize, className, paginationStyle, rowKey, onFinish, manual, formInitValues, hideLabel, labelWidth, onReset, style, ...props }: HTableProps) => JSX.Element;
3
+ declare const _default: ({ request, configData, searchSpan, table, hideHeader, headerStyle, tableStyle, action, spaceSize, className, paginationStyle, rowKey, onFinish, manual, formInitValues, hideLabel, labelWidth, onReset, style, dataSource, reload, ...props }: HTableProps) => JSX.Element;
4
4
  export default _default;
package/lib/Table.js CHANGED
@@ -20,13 +20,12 @@ var index$2 = require('./HTableBody/index.js');
20
20
  var useCurrentTable = require('./hooks/useCurrentTable.js');
21
21
  var useRowObj = require('./hooks/useRowObj.js');
22
22
  var context = require('./context.js');
23
- var antd = require('antd');
24
23
  var useReq = require('./hooks/useReq.js');
25
24
  var useDispatch = require('./hooks/useDispatch.js');
26
25
  var React = require('react');
27
26
  var index = require('./hooks/index.js');
28
27
 
29
- var _excluded = ["request", "configData", "searchSpan", "table", "hideHeader", "headerStyle", "tableStyle", "action", "spaceSize", "className", "paginationStyle", "rowKey", "onFinish", "manual", "formInitValues", "hideLabel", "labelWidth", "onReset", "style"];
28
+ var _excluded = ["request", "configData", "searchSpan", "table", "hideHeader", "headerStyle", "tableStyle", "action", "spaceSize", "className", "paginationStyle", "rowKey", "onFinish", "manual", "formInitValues", "hideLabel", "labelWidth", "onReset", "style", "dataSource", "reload"];
30
29
  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; }
31
30
  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; }
32
31
  var Table = (function (_ref) {
@@ -52,11 +51,15 @@ var Table = (function (_ref) {
52
51
  labelWidth = _ref.labelWidth,
53
52
  onReset = _ref.onReset,
54
53
  style = _ref.style,
54
+ dataSource = _ref.dataSource,
55
+ reload = _ref.reload,
55
56
  props = _objectWithoutProperties(_ref, _excluded);
56
57
  var _useReq = useReq.default({
57
58
  request: request,
58
59
  manual: manual,
59
- formInitValues: formInitValues
60
+ formInitValues: formInitValues,
61
+ dataSource: dataSource,
62
+ reload: reload
60
63
  }),
61
64
  run = _useReq.run,
62
65
  loading = _useReq.loading,
@@ -118,12 +121,8 @@ var Table = (function (_ref) {
118
121
  hideLabel: hideLabel,
119
122
  labelWidth: labelWidth
120
123
  },
121
- children: jsxRuntime.jsxs(antd.Space, {
122
- direction: "vertical",
123
- size: 0,
124
- style: _objectSpread({
125
- width: "100%"
126
- }, style),
124
+ children: jsxRuntime.jsxs("div", {
125
+ style: _objectSpread({}, style),
127
126
  className: _concatInstanceProperty(_context = "".concat(contentClassName, " ")).call(_context, className),
128
127
  children: [!hideHeader && jsxRuntime.jsx(index$1.default, {
129
128
  searchSpan: searchSpan,