@pointcloud/pcloud-components 0.1.33 → 0.1.34

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.
@@ -0,0 +1,140 @@
1
+ @import '../commonStyle/index.less';
2
+
3
+ .@{prefix}-crud {
4
+ height: 100%;
5
+ display: flex;
6
+ flex-direction: column;
7
+
8
+ &.fullscreen {
9
+ position: fixed;
10
+ inset: 0;
11
+ z-index: 10000;
12
+ padding: 10px;
13
+ background-color: #fff;
14
+ }
15
+
16
+ &-action-tool-bar {
17
+ display: flex;
18
+ justify-content: space-between;
19
+ align-items: center;
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ &-action-bar,
24
+ &-tool-bar {
25
+ display: flex;
26
+ justify-content: flex-start;
27
+ align-items: center;
28
+ gap: 8px;
29
+ }
30
+
31
+ .tool-icon {
32
+ cursor: pointer;
33
+ padding: 5px;
34
+ border: 1px solid #e3e3e3;
35
+ border-radius: 50%;
36
+ font-size: 15px;
37
+
38
+ &:hover {
39
+ border-color: #2e4dd9;
40
+ color: #2e4dd9;
41
+ }
42
+
43
+ &.rotating {
44
+ animation: rotating 0.5s linear;
45
+ }
46
+ }
47
+
48
+ // column setting popup
49
+ .column-setting-popup {
50
+ .ant-popover-title {
51
+ padding-right: 10px;
52
+ padding-left: 10px;
53
+ }
54
+
55
+ .ant-popover-inner-content {
56
+ width: 100%;
57
+ padding: 8px 0 4px;
58
+ }
59
+
60
+ .column-setting-title {
61
+ display: flex;
62
+ justify-content: space-between;
63
+ align-items: center;
64
+ }
65
+
66
+ .column-setting-list {
67
+ display: flex;
68
+ flex-direction: column;
69
+ max-height: 300px;
70
+ overflow-y: auto;
71
+ margin-bottom: 0;
72
+ padding-inline-start: 0;
73
+ list-style: none;
74
+ padding: 5px 0;
75
+ }
76
+
77
+ .column-setting-list::-webkit-scrollbar {
78
+ width: 5px;
79
+ }
80
+
81
+ .column-setting-list::-webkit-scrollbar-track {
82
+ border-radius: 3px;
83
+ }
84
+
85
+ .column-setting-list::-webkit-scrollbar-thumb {
86
+ width: 5px;
87
+ border-radius: 3px;
88
+ background: #8b8b8b;
89
+ }
90
+
91
+ .column-setting-item {
92
+ display: flex;
93
+ align-items: center;
94
+ padding: 8px 10px;
95
+ user-select: none;
96
+ border-radius: 4px;
97
+ margin-bottom: 2px;
98
+ min-height: 32px;
99
+
100
+ &:hover {
101
+ background-color: #f5f5f5;
102
+ }
103
+ }
104
+
105
+ .column-drag-handle {
106
+ cursor: move;
107
+ margin-right: 8px;
108
+ display: flex;
109
+ align-items: center;
110
+ color: #666;
111
+ }
112
+
113
+ .column-setting-footer {
114
+ display: flex;
115
+ justify-content: flex-end;
116
+ padding-top: 4px;
117
+ border-top: 1px solid #f0f0f0;
118
+ }
119
+ }
120
+
121
+ &-table {
122
+ flex: 1;
123
+ }
124
+
125
+ &-modalform-view {
126
+ .ant-form-item-label > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before {
127
+ display: none;
128
+ }
129
+ }
130
+
131
+ @keyframes rotating {
132
+ from {
133
+ transform: rotate(0deg);
134
+ }
135
+
136
+ to {
137
+ transform: rotate(360deg);
138
+ }
139
+ }
140
+ }
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import type { CheckboxValueType } from 'antd/es/checkbox/Group';
3
+ import type { DColumnType } from '../DTable';
4
+ export interface ToolbarProps {
5
+ className?: string;
6
+ fullScreen?: boolean;
7
+ columns?: DColumnType[];
8
+ onActions?: {
9
+ setFullScreen?: (fullScreen: boolean) => void;
10
+ handleRefresh?: () => void;
11
+ onColumnSettingChanged?: (checkedList: CheckboxValueType[], sortedColumns?: DColumnType[]) => void;
12
+ };
13
+ }
14
+ declare function Toolbar({ className, fullScreen, columns, onActions }: ToolbarProps): import("react/jsx-runtime").JSX.Element;
15
+ declare const _default: import("react").MemoExoticComponent<typeof Toolbar>;
16
+ export default _default;
@@ -0,0 +1,249 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import { memo, useState, useRef, useEffect, useMemo } from 'react';
5
+ import classNames from 'classnames';
6
+ import { Popover, Checkbox, Button } from 'antd';
7
+ import { ReloadOutlined, FullscreenOutlined, FullscreenExitOutlined, BarsOutlined, HolderOutlined } from '@ant-design/icons';
8
+ import Sortable from 'sortablejs';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ import { Fragment as _Fragment } from "react/jsx-runtime";
12
+ function Toolbar(_ref) {
13
+ var className = _ref.className,
14
+ fullScreen = _ref.fullScreen,
15
+ _ref$columns = _ref.columns,
16
+ columns = _ref$columns === void 0 ? [] : _ref$columns,
17
+ onActions = _ref.onActions;
18
+ var timer = useRef(null);
19
+ var sortableInstance = useRef(null);
20
+ var sortableContainer = useRef(null);
21
+ var containerNode = useRef(null);
22
+ var _useState = useState(false),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ columnSettingVisible = _useState2[0],
25
+ setColumnSettingVisible = _useState2[1];
26
+ var _useState3 = useState(false),
27
+ _useState4 = _slicedToArray(_useState3, 2),
28
+ rotating = _useState4[0],
29
+ setRotating = _useState4[1];
30
+ var reloadIconClass = useMemo(function () {
31
+ return classNames('tool-icon', {
32
+ rotating: rotating
33
+ });
34
+ }, [rotating]);
35
+ var checkedValues = useMemo(function () {
36
+ return columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
37
+ return item.title;
38
+ }).filter(function (title) {
39
+ return title !== undefined;
40
+ });
41
+ }, [columns]);
42
+ var _useState5 = useState({
43
+ sortedColumns: columns,
44
+ checkedList: checkedValues
45
+ }),
46
+ _useState6 = _slicedToArray(_useState5, 2),
47
+ columnSetting = _useState6[0],
48
+ setColumnSetting = _useState6[1];
49
+ var _ref2 = onActions || {},
50
+ setFullScreen = _ref2.setFullScreen,
51
+ handleRefresh = _ref2.handleRefresh;
52
+ var handleFullScreen = function handleFullScreen() {
53
+ var newFullscreen = !fullScreen;
54
+ setFullScreen === null || setFullScreen === void 0 || setFullScreen(newFullscreen);
55
+ };
56
+ var handleReload = function handleReload() {
57
+ setRotating(true);
58
+ handleRefresh === null || handleRefresh === void 0 || handleRefresh();
59
+ if (timer.current) clearTimeout(timer.current);
60
+ timer.current = window.setTimeout(function () {
61
+ setRotating(false);
62
+ }, 500);
63
+ };
64
+ var handleConfirm = function handleConfirm() {
65
+ var _onActions$onColumnSe;
66
+ setColumnSettingVisible(false);
67
+ onActions === null || onActions === void 0 || (_onActions$onColumnSe = onActions.onColumnSettingChanged) === null || _onActions$onColumnSe === void 0 || _onActions$onColumnSe.call(onActions, columnSetting.checkedList, columnSetting.sortedColumns);
68
+ };
69
+ var handleReset = function handleReset() {
70
+ setColumnSetting({
71
+ sortedColumns: columns,
72
+ checkedList: checkedValues
73
+ });
74
+ };
75
+ var onCheckAllChange = function onCheckAllChange(e) {
76
+ var checked = e.target.checked;
77
+ if (checked) {
78
+ // 全选所有列标题
79
+ var allValues = columns.map(function (item) {
80
+ return item.title;
81
+ }).filter(function (title) {
82
+ return title !== undefined;
83
+ });
84
+ setColumnSetting(function (prev) {
85
+ return _objectSpread(_objectSpread({}, prev), {}, {
86
+ checkedList: allValues
87
+ });
88
+ });
89
+ } else {
90
+ // 取消全选
91
+ setColumnSetting(function (prev) {
92
+ return _objectSpread(_objectSpread({}, prev), {}, {
93
+ checkedList: []
94
+ });
95
+ });
96
+ }
97
+ };
98
+ useEffect(function () {
99
+ return function () {
100
+ if (timer.current) clearTimeout(timer.current);
101
+ };
102
+ }, []);
103
+ useEffect(function () {
104
+ if (columnSettingVisible && !sortableInstance.current && sortableContainer.current) {
105
+ sortableInstance.current = Sortable.create(sortableContainer.current, {
106
+ animation: 150,
107
+ handle: '.column-drag-handle',
108
+ draggable: '.column-setting-item',
109
+ direction: 'vertical',
110
+ onEnd: function onEnd(_ref3) {
111
+ var oldIndex = _ref3.oldIndex,
112
+ newIndex = _ref3.newIndex;
113
+ if (oldIndex !== undefined && newIndex !== undefined && oldIndex !== newIndex) {
114
+ // 更新临时列顺序
115
+ var newColumns = _toConsumableArray(columnSetting.sortedColumns);
116
+ newColumns.splice(newIndex, 0, newColumns.splice(oldIndex, 1)[0]);
117
+ setColumnSetting(function (prev) {
118
+ return _objectSpread(_objectSpread({}, prev), {}, {
119
+ sortedColumns: newColumns
120
+ });
121
+ });
122
+ }
123
+ }
124
+ });
125
+ } else if (!columnSettingVisible && sortableInstance.current) {
126
+ sortableInstance.current.destroy();
127
+ sortableInstance.current = null;
128
+ }
129
+ return function () {
130
+ if (sortableInstance.current) {
131
+ sortableInstance.current.destroy();
132
+ sortableInstance.current = null;
133
+ }
134
+ };
135
+ }, [columns, columnSettingVisible, columnSetting.sortedColumns]);
136
+ var indeterminate = useMemo(function () {
137
+ return !!columnSetting.checkedList.length && columnSetting.checkedList.length < columns.length;
138
+ }, [columnSetting.checkedList, columns.length]);
139
+ var checkAll = useMemo(function () {
140
+ return columnSetting.checkedList.length === columns.length;
141
+ }, [columnSetting.checkedList, columns.length]);
142
+ var popoverContent = useMemo(function () {
143
+ var _columnSetting$sorted;
144
+ return /*#__PURE__*/_jsxs(_Fragment, {
145
+ children: [/*#__PURE__*/_jsx("ul", {
146
+ ref: sortableContainer,
147
+ className: "column-setting-list",
148
+ children: (_columnSetting$sorted = columnSetting.sortedColumns) === null || _columnSetting$sorted === void 0 ? void 0 : _columnSetting$sorted.map(function (item) {
149
+ var isChecked = columnSetting.checkedList.includes(item === null || item === void 0 ? void 0 : item.title);
150
+ return /*#__PURE__*/_jsxs("li", {
151
+ className: "column-setting-item",
152
+ children: [/*#__PURE__*/_jsx("div", {
153
+ className: "column-drag-handle",
154
+ children: /*#__PURE__*/_jsx(HolderOutlined, {})
155
+ }), /*#__PURE__*/_jsx(Checkbox, {
156
+ checked: isChecked,
157
+ onChange: function onChange(e) {
158
+ var newCheckedList = e.target.checked ? [].concat(_toConsumableArray(columnSetting.checkedList), [item === null || item === void 0 ? void 0 : item.title]).filter(function (title) {
159
+ return title !== undefined;
160
+ }) : columnSetting.checkedList.filter(function (title) {
161
+ return title !== (item === null || item === void 0 ? void 0 : item.title);
162
+ });
163
+ setColumnSetting(function (prev) {
164
+ return _objectSpread(_objectSpread({}, prev), {}, {
165
+ checkedList: newCheckedList
166
+ });
167
+ });
168
+ },
169
+ value: item === null || item === void 0 ? void 0 : item.title,
170
+ children: item === null || item === void 0 ? void 0 : item.title
171
+ })]
172
+ }, (item === null || item === void 0 ? void 0 : item.key) || (item === null || item === void 0 ? void 0 : item.dataIndex));
173
+ })
174
+ }), /*#__PURE__*/_jsxs("div", {
175
+ className: "column-setting-footer",
176
+ children: [/*#__PURE__*/_jsx(Button, {
177
+ type: "link",
178
+ style: {
179
+ color: 'inherit'
180
+ },
181
+ onClick: function onClick() {
182
+ return setColumnSettingVisible(false);
183
+ },
184
+ children: "\u53D6\u6D88"
185
+ }), /*#__PURE__*/_jsx(Button, {
186
+ type: "link",
187
+ onClick: handleConfirm,
188
+ children: "\u786E\u5B9A"
189
+ })]
190
+ })]
191
+ });
192
+ }, [columnSetting.sortedColumns, columnSetting.checkedList, handleConfirm]);
193
+
194
+ // 使用useMemo优化Popover标题,避免不必要的重渲染
195
+ var popoverTitle = useMemo(function () {
196
+ return /*#__PURE__*/_jsxs("div", {
197
+ className: "column-setting-title",
198
+ children: [/*#__PURE__*/_jsx(Checkbox, {
199
+ indeterminate: indeterminate,
200
+ onChange: onCheckAllChange,
201
+ checked: checkAll,
202
+ children: "\u5168\u9009"
203
+ }), /*#__PURE__*/_jsx(Button, {
204
+ type: "link",
205
+ size: "small",
206
+ onClick: handleReset,
207
+ children: "\u91CD\u7F6E"
208
+ })]
209
+ });
210
+ }, [indeterminate, onCheckAllChange, checkAll, handleReset]);
211
+ return /*#__PURE__*/_jsxs("div", {
212
+ className: className,
213
+ ref: containerNode,
214
+ children: [/*#__PURE__*/_jsx(ReloadOutlined, {
215
+ className: reloadIconClass,
216
+ title: "\u5237\u65B0",
217
+ onClick: handleReload
218
+ }), fullScreen ? /*#__PURE__*/_jsx(FullscreenExitOutlined, {
219
+ className: "tool-icon",
220
+ title: "\u53D6\u6D88\u5168\u5C4F",
221
+ onClick: handleFullScreen
222
+ }) : /*#__PURE__*/_jsx(FullscreenOutlined, {
223
+ className: "tool-icon",
224
+ title: "\u5168\u5C4F",
225
+ onClick: handleFullScreen
226
+ }), /*#__PURE__*/_jsx(Popover, {
227
+ open: columnSettingVisible,
228
+ title: popoverTitle,
229
+ trigger: "click",
230
+ placement: "bottomRight",
231
+ onOpenChange: function onOpenChange(open) {
232
+ return setColumnSettingVisible(open);
233
+ },
234
+ getPopupContainer: function getPopupContainer(triggerNode) {
235
+ return triggerNode.parentElement;
236
+ },
237
+ overlayClassName: "column-setting-popup",
238
+ content: popoverContent,
239
+ children: /*#__PURE__*/_jsx(BarsOutlined, {
240
+ className: "tool-icon",
241
+ title: "\u5217\u8BBE\u7F6E",
242
+ onClick: function onClick() {
243
+ return setColumnSettingVisible(true);
244
+ }
245
+ })
246
+ })]
247
+ });
248
+ }
249
+ export default /*#__PURE__*/memo(Toolbar);
@@ -1,4 +1,5 @@
1
- import { DModalProps, DeleteModalProps } from './interface';
1
+ import { ModalFuncProps } from 'antd';
2
+ import { DModalProps } from './interface';
2
3
  import './styles/index.less';
3
4
  declare function DModal(props: DModalProps): import("react/jsx-runtime").JSX.Element;
4
5
  declare namespace DModal {
@@ -9,9 +10,9 @@ declare namespace DModal {
9
10
  export var warning: import("antd/lib/modal/confirm").ModalFunc;
10
11
  export var confirm: import("antd/lib/modal/confirm").ModalFunc;
11
12
  export var destroyAll: () => void;
12
- var _a: ({ content, onOk, onCancel, zIndex }: DeleteModalProps) => {
13
+ var _a: (props: ModalFuncProps) => {
13
14
  destroy: () => void;
14
- update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
15
+ update: (configUpdate: ModalFuncProps | ((prevConfig: ModalFuncProps) => ModalFuncProps)) => void;
15
16
  };
16
17
  export { _a as delete };
17
18
  }
@@ -1,6 +1,7 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["children", "mode"];
3
+ var _excluded = ["children", "mode"],
4
+ _excluded2 = ["content", "onOk", "onCancel", "zIndex"];
4
5
  import { ConfigContext } from "../ConfigProvider";
5
6
  import { Modal } from 'antd';
6
7
  import { useContext, useEffect, useMemo, useRef } from 'react';
@@ -57,22 +58,23 @@ DModal.error = Modal.error;
57
58
  DModal.warning = Modal.warning;
58
59
  DModal.confirm = Modal.confirm;
59
60
  DModal.destroyAll = Modal.destroyAll;
60
- DModal.delete = function (_ref) {
61
- var content = _ref.content,
62
- onOk = _ref.onOk,
63
- onCancel = _ref.onCancel,
64
- zIndex = _ref.zIndex;
65
- return DModal.confirm({
61
+ DModal.delete = function (props) {
62
+ var content = props.content,
63
+ onOk = props.onOk,
64
+ onCancel = props.onCancel,
65
+ zIndex = props.zIndex,
66
+ otherProps = _objectWithoutProperties(props, _excluded2);
67
+ return DModal.confirm(_objectSpread({
66
68
  title: '删除提示',
67
69
  content: content,
68
70
  centered: true,
69
71
  closable: true,
70
72
  okText: '确定',
71
73
  cancelText: '取消',
72
- className: 'pui-modal-container',
74
+ className: 'pui-modal-container pui-delete-modal',
73
75
  onOk: onOk,
74
76
  onCancel: onCancel,
75
77
  zIndex: zIndex
76
- });
78
+ }, otherProps));
77
79
  };
78
80
  export default DModal;
@@ -1,14 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
- import { ModalProps } from 'antd';
3
- type IModalProps = Omit<ModalProps, 'width' | 'className'>;
2
+ import type { ModalProps } from 'antd';
3
+ type IModalProps = Omit<ModalProps, 'className'>;
4
4
  export interface DModalProps extends IModalProps {
5
5
  children?: ReactNode | undefined;
6
6
  mode?: 'absolute' | 'relative' | 'panel';
7
7
  }
8
- export interface DeleteModalProps {
9
- content?: React.ReactNode;
10
- onOk?: <T>(..._args: T[]) => T;
11
- onCancel?: <T>(..._args: T[]) => T;
12
- zIndex?: number;
13
- }
14
8
  export {};
@@ -29,6 +29,22 @@ export type DTableProps = Omit<TableProps<any>, 'columns'> & {
29
29
  /** 表格列配置 */
30
30
  columns?: DColumnType[];
31
31
  };
32
+ export type DTableRef = {
33
+ /** 手动刷新列表方法
34
+ * @param params 可选的新参数,如果不传则使用现有参数
35
+ */
36
+ refresh: (params?: TableParamsProps) => void;
37
+ /** 手动刷新列表到指定页数方法
38
+ * @param page 指定页数
39
+ */
40
+ refreshToPage: (page: number) => void;
41
+ /** 获取当前分页信息 */
42
+ getPaginationState: () => {
43
+ current: number;
44
+ size: number;
45
+ total: number;
46
+ };
47
+ };
32
48
  declare const DTable: React.ForwardRefExoticComponent<Omit<TableProps<any>, "columns"> & {
33
49
  /** 表格列的基础默认配置,默认所有列居中,表头文字超出显示省略号,详见 antd columns */
34
50
  defaultColumnProps?: DColumnType | undefined;
@@ -42,5 +58,5 @@ declare const DTable: React.ForwardRefExoticComponent<Omit<TableProps<any>, "col
42
58
  extraParams?: TableParamsProps | undefined;
43
59
  /** 表格列配置 */
44
60
  columns?: DColumnType[] | undefined;
45
- } & React.RefAttributes<HTMLDivElement>>;
61
+ } & React.RefAttributes<HTMLDivElement & DTableRef>>;
46
62
  export default DTable;
@@ -2,17 +2,19 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  var _excluded = ["loadMore", "defaultColumnProps", "actionColumn", "showErrorMsg", "extraParams", "dataSource", "rowKey", "scroll", "className", "pagination", "columns", "loading"];
5
- /*
6
- * @Author : wangfeihu
7
- * @Date : 2023-05-09 15:04:48
8
- * @LastEditors : wangfeihu
9
- * @LastEditTime : 2023-08-16 16:45:15
10
- * @Description : 基于antd的Table组件
5
+ /*
6
+ * @Author : wangfeihu
7
+ * @Date : 2023-05-09 15:04:48
8
+ * @LastEditors : wangfeihu
9
+ * @LastEditTime : 2023-08-16 16:45:15
10
+ * @Description : 基于antd的Table组件
11
11
  */
12
- import React, { forwardRef, useEffect, useRef, useState, useContext, useMemo } from 'react';
12
+ import React, { forwardRef, useEffect, useRef, useState, useContext, useMemo, useImperativeHandle } from 'react';
13
13
  import { message, Table } from 'antd';
14
14
  import { ConfigContext } from "../ConfigProvider";
15
15
  import "./index.less";
16
+
17
+ // DTable组件的Ref接口定义
16
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
19
  import { jsx as _jsx } from "react/jsx-runtime";
18
20
  // 分页器配置项
@@ -53,7 +55,8 @@ function getActionColumnProps(props, defaultColumnProps) {
53
55
  var defaultProps = {
54
56
  width: 140,
55
57
  title: '操作',
56
- dataIndex: 'action'
58
+ dataIndex: 'action',
59
+ align: 'center'
57
60
  };
58
61
  return typeof props === 'function' ? _objectSpread(_objectSpread(_objectSpread({}, defaultColumnProps), defaultProps), {}, {
59
62
  render: props
@@ -106,17 +109,21 @@ function InternalTable(props, ref) {
106
109
  tableParams = _useState4[0],
107
110
  setTableParams = _useState4[1];
108
111
 
112
+ // 隐藏单个分页时, 高度充满
113
+ var extraHeight = useMemo(function () {
114
+ return _pagination['hideOnSinglePage'] ? 0 : 56;
115
+ }, [_pagination]);
116
+
109
117
  // 默认垂直滚动高度为 calc(100% - 56px),其中56px为表格header高度,如需修改,需要自行覆盖styles中的相关样式
110
118
  var _scroll = scroll ? _objectSpread({
111
- y: 'calc(100% - 56px)'
119
+ y: "calc(100% - ".concat(extraHeight, "px)")
112
120
  }, scroll) : {
113
- y: 'calc(100% - 56px)'
121
+ y: "calc(100% - ".concat(extraHeight, "px)")
114
122
  };
115
123
 
116
124
  // 合并列属性
117
125
  var _columns = getColumns(columns, defaultColumnProps);
118
126
 
119
- // 加入操作列
120
127
  // 加入操作列
121
128
  var _actionColumn = actionColumn ? getActionColumnProps(actionColumn, defaultColumnProps) : undefined;
122
129
  if (_actionColumn && _columns instanceof Array) _columns.push(_actionColumn);
@@ -180,6 +187,12 @@ function InternalTable(props, ref) {
180
187
  }
181
188
  };
182
189
 
190
+ // 手动刷新方法
191
+ var refresh = function refresh(params) {
192
+ var refreshParams = _objectSpread(_objectSpread({}, tableParams), params);
193
+ loadData(refreshParams);
194
+ };
195
+
183
196
  // 监听分页大小变化,如果外部也监听了onChange,则不会触发loadMore,但如果外部onChange返回值为undefined则正常触loadMore
184
197
  var onChange = function onChange(page, pageSize) {
185
198
  if (_pagination && typeof (_pagination === null || _pagination === void 0 ? void 0 : _pagination.onChange) === 'function') {
@@ -201,13 +214,30 @@ function InternalTable(props, ref) {
201
214
  pageSize: tableParams.size,
202
215
  onChange: onChange
203
216
  }) : _pagination;
204
-
217
+ useImperativeHandle(ref, function () {
218
+ return {
219
+ refresh: refresh,
220
+ // 提供获取当前分页状态的方法
221
+ getPaginationState: function getPaginationState() {
222
+ return {
223
+ current: tableParams.current,
224
+ size: tableParams.size,
225
+ total: tableSource.total
226
+ };
227
+ },
228
+ // 提供刷新到指定页面的方法
229
+ refreshToPage: function refreshToPage(page) {
230
+ refresh({
231
+ current: page
232
+ });
233
+ }
234
+ };
235
+ });
205
236
  // 数据初始加载
206
237
  useEffect(function () {
207
238
  return loadData(extraParams);
208
239
  }, [dataSource, extraParams]);
209
240
  return /*#__PURE__*/_jsx(Table, _objectSpread(_objectSpread({}, otherProps), {}, {
210
- ref: ref,
211
241
  rowKey: rowKey,
212
242
  className: _className,
213
243
  columns: _columns,
@@ -1,6 +1,8 @@
1
1
  import { ILoadingInstance, LoadingInstanceProps } from './interface';
2
2
  import './styles/index.less';
3
- declare function Loading(props: LoadingInstanceProps): import("react/jsx-runtime").JSX.Element;
3
+ declare function Loading(props: LoadingInstanceProps & {
4
+ isBodyContainer?: boolean;
5
+ }): import("react/jsx-runtime").JSX.Element | null;
4
6
  declare namespace Loading {
5
7
  var newInstance: (args?: LoadingInstanceProps | undefined) => ILoadingInstance;
6
8
  }