@magicbe/antd-crud 0.0.42 → 0.0.44
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/README.md +301 -0
- package/dist/components/Action.d.ts +1 -2
- package/dist/components/Action.js +7 -8
- package/dist/components/Filter.d.ts +1 -3
- package/dist/components/Filter.js +7 -4
- package/dist/components/Table.d.ts +2 -2
- package/dist/components/Table.js +7 -8
- package/dist/components/index.js +4 -3
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# @magicbe/antd-crud
|
|
2
|
+
|
|
3
|
+
一个基于 Ant Design 的 CRUD 表格组件库,简化开发中的增删改查操作。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- 快速构建完整的 CRUD 表格界面
|
|
8
|
+
- 支持多种表单字段类型
|
|
9
|
+
- 内置筛选、新增、编辑、删除功能
|
|
10
|
+
- 可自定义操作按钮
|
|
11
|
+
- 基于 Ant Design,样式统一
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# 使用 npm
|
|
17
|
+
npm install @magicbe/antd-crud
|
|
18
|
+
|
|
19
|
+
# 使用 yarn
|
|
20
|
+
yarn add @magicbe/antd-crud
|
|
21
|
+
|
|
22
|
+
# 使用 pnpm
|
|
23
|
+
pnpm add @magicbe/antd-crud
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 依赖
|
|
27
|
+
|
|
28
|
+
- antd: 5.22.5+
|
|
29
|
+
- react: 18.2.0+
|
|
30
|
+
- react-dom: 18.2.0+
|
|
31
|
+
|
|
32
|
+
## 基本使用
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import React from 'react';
|
|
36
|
+
import { CrudTable, type ContentProps, type ColumnType, type delHandle, type editHandle, type addHandle } from '@magicbe/antd-crud';
|
|
37
|
+
|
|
38
|
+
interface User {
|
|
39
|
+
id: number;
|
|
40
|
+
name: string;
|
|
41
|
+
age: number;
|
|
42
|
+
address: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const columns: ColumnType<User>['columns'] = [
|
|
46
|
+
{
|
|
47
|
+
title: '姓名',
|
|
48
|
+
dataIndex: 'name',
|
|
49
|
+
filter: 'Input',
|
|
50
|
+
field: {
|
|
51
|
+
type: 'Input',
|
|
52
|
+
rules: [{ required: true }],
|
|
53
|
+
...({})
|
|
54
|
+
},
|
|
55
|
+
add: true,
|
|
56
|
+
edit: true,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
title: '年龄',
|
|
60
|
+
dataIndex: 'age',
|
|
61
|
+
field: 'InputNumber',
|
|
62
|
+
add: true,
|
|
63
|
+
edit: true,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
title: '地址',
|
|
67
|
+
dataIndex: 'address',
|
|
68
|
+
field: 'TextArea',
|
|
69
|
+
add: true,
|
|
70
|
+
edit: true,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
title: "所属区域",
|
|
74
|
+
dataIndex: "region",
|
|
75
|
+
field: {
|
|
76
|
+
type: "Select",
|
|
77
|
+
option: {
|
|
78
|
+
options: [
|
|
79
|
+
{
|
|
80
|
+
label: "区域1",
|
|
81
|
+
value: "1",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: "区域2",
|
|
85
|
+
value: "2",
|
|
86
|
+
},
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
rules: [{ required: true }]
|
|
90
|
+
},
|
|
91
|
+
edit: true,
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
const App: React.FC = () => {
|
|
96
|
+
const getSources: ContentProps<User>['getSources'] = async (params: any = {}) => {
|
|
97
|
+
const {
|
|
98
|
+
current: page = 1,
|
|
99
|
+
pageSize: size = 10,
|
|
100
|
+
} = params;
|
|
101
|
+
|
|
102
|
+
// 模拟API请求
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
sources: [
|
|
106
|
+
{ id: 1, name: '张三', age: 28, address: '北京市海淀区' },
|
|
107
|
+
{ id: 2, name: '李四', age: 32, address: '上海市浦东新区' },
|
|
108
|
+
],
|
|
109
|
+
total: 2,
|
|
110
|
+
page,
|
|
111
|
+
size,
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const add: addHandle = async (value) => {
|
|
116
|
+
// 模拟新增操作
|
|
117
|
+
console.log('add:', value);
|
|
118
|
+
return Promise.resolve();
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const edit: editHandle = async (value) => {
|
|
122
|
+
// 模拟编辑操作
|
|
123
|
+
console.log('edit:', value);
|
|
124
|
+
return Promise.resolve();
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const del: delHandle = async (value) => {
|
|
128
|
+
// 模拟删除操作
|
|
129
|
+
console.log('delete:', value);
|
|
130
|
+
return Promise.resolve();
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<CrudTable
|
|
135
|
+
columns={columns}
|
|
136
|
+
getSources={getSources}
|
|
137
|
+
add={add}
|
|
138
|
+
edit={edit}
|
|
139
|
+
del={del}
|
|
140
|
+
rowKey={"uuid"}
|
|
141
|
+
/>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export default App;
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## API 文档
|
|
149
|
+
|
|
150
|
+
### CrudTable
|
|
151
|
+
|
|
152
|
+
主要组件,集成了筛选、操作按钮和表格功能。
|
|
153
|
+
|
|
154
|
+
#### 属性
|
|
155
|
+
|
|
156
|
+
| 属性名 | 类型 | 说明 |
|
|
157
|
+
|--------|------|------|
|
|
158
|
+
| columns | ColumnType[] | 表格列配置 |
|
|
159
|
+
| getSources | (params?: GetSourceFunctionParams) => Promise<Source> | 获取数据的方法 |
|
|
160
|
+
| add | addHandle \| addHandleMap | 新增操作方法 |
|
|
161
|
+
| edit | editHandle \| editHandleMap | 编辑操作方法 |
|
|
162
|
+
| del | delHandle \| Partial<HandleMap<delHandle>> | 删除操作方法 |
|
|
163
|
+
| action | Action | 自定义操作按钮 |
|
|
164
|
+
| rowSelection | RowSelectionType | 行选择类型 |
|
|
165
|
+
| pagination | false | 是否显示分页(暂仅支持false) |
|
|
166
|
+
| drawer | number \| DrawerProps | 抽屉配置 |
|
|
167
|
+
| pageSizeOptions | PaginationProps['pageSizeOptions'] | 每页条数选项 |
|
|
168
|
+
| actionColumn | ColumnType<any> | 操作列配置 |
|
|
169
|
+
|
|
170
|
+
### ColumnType
|
|
171
|
+
|
|
172
|
+
表格列配置,继承自 Ant Design 的 ColumnType,增加了以下属性:
|
|
173
|
+
|
|
174
|
+
| 属性名 | 类型 | 说明 |
|
|
175
|
+
|--------|------|------|
|
|
176
|
+
| field | ColumnFieldKeys \| ColumnField \| React.FC | 表单字段类型 |
|
|
177
|
+
| filter | boolean \| ColumnFieldKeys \| ColumnField \| React.FC | 筛选字段类型 |
|
|
178
|
+
| add | boolean \| ColumnFieldKeys \| ColumnField \| React.FC | 新增表单字段类型 |
|
|
179
|
+
| edit | boolean \| ColumnFieldKeys \| ColumnField \| React.FC | 编辑表单字段类型 |
|
|
180
|
+
|
|
181
|
+
### ColumnField 类型
|
|
182
|
+
|
|
183
|
+
支持的表单字段类型:
|
|
184
|
+
- Input
|
|
185
|
+
- Input.Password
|
|
186
|
+
- TextArea
|
|
187
|
+
- InputNumber
|
|
188
|
+
- Select
|
|
189
|
+
- Cascader
|
|
190
|
+
- TreeSelect
|
|
191
|
+
- Checkbox
|
|
192
|
+
- Checkbox.Group
|
|
193
|
+
- DatePicker
|
|
194
|
+
- DatePicker.YearPicker
|
|
195
|
+
- DatePicker.MonthPicker
|
|
196
|
+
- DatePicker.WeekPicker
|
|
197
|
+
- DatePicker.TimePicker
|
|
198
|
+
- DatePicker.RangePicker
|
|
199
|
+
- DatePicker.QuarterPicker
|
|
200
|
+
- TimePicker
|
|
201
|
+
- TimePicker.RangePicker
|
|
202
|
+
- Radio
|
|
203
|
+
- Radio.Group
|
|
204
|
+
- Switch
|
|
205
|
+
|
|
206
|
+
### TableContextProvider 和 useTableContext
|
|
207
|
+
|
|
208
|
+
提供表格上下文,可用于自定义组件中获取表格状态和方法。
|
|
209
|
+
|
|
210
|
+
### Filter
|
|
211
|
+
|
|
212
|
+
筛选组件,可单独使用。
|
|
213
|
+
|
|
214
|
+
### Action
|
|
215
|
+
|
|
216
|
+
操作按钮组件,提供了新增、编辑、删除等默认操作。
|
|
217
|
+
|
|
218
|
+
### Table
|
|
219
|
+
|
|
220
|
+
表格组件,继承自 Ant Design 的 Table。
|
|
221
|
+
|
|
222
|
+
### CrudConfigProvider
|
|
223
|
+
|
|
224
|
+
配置提供者,继承自 Ant Design 的 ConfigProvider。
|
|
225
|
+
|
|
226
|
+
## 高级用法
|
|
227
|
+
|
|
228
|
+
### 自定义操作按钮
|
|
229
|
+
|
|
230
|
+
```tsx
|
|
231
|
+
<CrudTable
|
|
232
|
+
columns={columns}
|
|
233
|
+
getSources={getSources}
|
|
234
|
+
action={{
|
|
235
|
+
master: {
|
|
236
|
+
add: true,
|
|
237
|
+
del: true,
|
|
238
|
+
// 自定义主操作按钮
|
|
239
|
+
},
|
|
240
|
+
record: {
|
|
241
|
+
edit: true,
|
|
242
|
+
del: true,
|
|
243
|
+
// 自定义行操作按钮
|
|
244
|
+
},
|
|
245
|
+
}}
|
|
246
|
+
/>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### 使用 Context
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
import { TableContextProvider, useTableContext } from '@magicbe/antd-crud';
|
|
253
|
+
|
|
254
|
+
const CustomComponent: React.FC = () => {
|
|
255
|
+
const { table_ref } = useTableContext();
|
|
256
|
+
|
|
257
|
+
const handleRefresh = () => {
|
|
258
|
+
table_ref.current?.loadRecords();
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
return (
|
|
262
|
+
<button onClick={handleRefresh}>刷新数据</button>
|
|
263
|
+
);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const App: React.FC = () => {
|
|
267
|
+
return (
|
|
268
|
+
<TableContextProvider {...props}>
|
|
269
|
+
<CustomComponent />
|
|
270
|
+
</TableContextProvider>
|
|
271
|
+
);
|
|
272
|
+
};
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### 配置主题
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
import { CrudConfigProvider } from '@magicbe/antd-crud';
|
|
279
|
+
|
|
280
|
+
const App: React.FC = () => {
|
|
281
|
+
return (
|
|
282
|
+
<CrudConfigProvider theme={{
|
|
283
|
+
token: {
|
|
284
|
+
colorPrimary: '#1890ff',
|
|
285
|
+
},
|
|
286
|
+
}}>
|
|
287
|
+
<CrudTable {...props} />
|
|
288
|
+
</CrudConfigProvider>
|
|
289
|
+
);
|
|
290
|
+
};
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## 注意事项
|
|
294
|
+
|
|
295
|
+
1. 组件依赖 antd 5.22.5 及以上版本,请确保项目中 antd 版本符合要求。
|
|
296
|
+
2. 目前 pagination 仅支持设置为 false,分页功能内置实现。
|
|
297
|
+
3. 自定义组件时,请使用 TableContextProvider 包裹以确保能正确获取上下文。
|
|
298
|
+
|
|
299
|
+
## License
|
|
300
|
+
|
|
301
|
+
MIT
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
|
-
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<ActionProps & React.RefAttributes<ActionRef>>;
|
|
2
|
+
declare const _default: () => import("react/jsx-runtime").JSX.Element;
|
|
4
3
|
export default _default;
|
|
5
4
|
/**自定义渲染 */
|
|
6
5
|
export declare const CustormRender: React.FC<PropsWithChildren>;
|
|
@@ -50,7 +50,7 @@ import EditForm from "./Edit";
|
|
|
50
50
|
var _a = createEmotion({ key: "action" }), css = _a.css, cx = _a.cx;
|
|
51
51
|
var wrapper_css = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-bottom: 25px;\n"], ["\n margin-bottom: 25px;\n"])));
|
|
52
52
|
/**操作 */
|
|
53
|
-
var Action = function (_a, ref) {
|
|
53
|
+
var Action = React.forwardRef(function (_a, ref) {
|
|
54
54
|
var className = _a.className;
|
|
55
55
|
var action = useTableContext().action;
|
|
56
56
|
useImperativeHandle(ref, function () { return ({}); });
|
|
@@ -124,8 +124,11 @@ var Action = function (_a, ref) {
|
|
|
124
124
|
}
|
|
125
125
|
/**默认渲染 */
|
|
126
126
|
return (_jsxs(Space, { className: cx(wrapper_css, className), children: [_jsx(AppendAction, {}), _jsx(EditAction, {}), _jsx(DeleteAction, {})] }));
|
|
127
|
-
};
|
|
128
|
-
export default
|
|
127
|
+
});
|
|
128
|
+
export default (function () {
|
|
129
|
+
var action_ref = useTableContext().action_ref;
|
|
130
|
+
return _jsx(Action, { ref: action_ref });
|
|
131
|
+
});
|
|
129
132
|
/**自定义渲染 */
|
|
130
133
|
export var CustormRender = function (_a) {
|
|
131
134
|
var children = _a.children;
|
|
@@ -139,7 +142,7 @@ var append_action_default_children = (_jsxs(Button, { type: "primary", children:
|
|
|
139
142
|
export var AppendAction = function (_a) {
|
|
140
143
|
var _b = _a.children, children = _b === void 0 ? append_action_default_children : _b;
|
|
141
144
|
var _c = Modal.useModal(), modalInstance = _c[0], modalContextHolder = _c[1];
|
|
142
|
-
var _d = useTableContext(),
|
|
145
|
+
var _d = useTableContext(), table_ref = _d.table_ref, filter_ref = _d.filter_ref, form_ref = _d.form_ref, add = _d.add, drawer = _d.drawer;
|
|
143
146
|
/**添加表单抽屉 */
|
|
144
147
|
var _e = useState(false), add_drawer_open = _e[0], setAdd_drawer_open = _e[1];
|
|
145
148
|
var _f = useState(), init_data = _f[0], setInit_data = _f[1];
|
|
@@ -295,10 +298,6 @@ export var DeleteAction = function (_a) {
|
|
|
295
298
|
if (error_2 === false)
|
|
296
299
|
return [2 /*return*/];
|
|
297
300
|
console.error(error_2);
|
|
298
|
-
modalInstance.error({
|
|
299
|
-
title: "错误",
|
|
300
|
-
content: String(error_2),
|
|
301
|
-
});
|
|
302
301
|
return [3 /*break*/, 12];
|
|
303
302
|
case 11:
|
|
304
303
|
setLoading(false);
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { FilterProps, FilterRef } from "../interface";
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<FilterProps & React.RefAttributes<FilterRef>>;
|
|
1
|
+
declare const _default: () => import("react/jsx-runtime").JSX.Element;
|
|
4
2
|
export default _default;
|
|
@@ -33,9 +33,9 @@ import { Button, Form, Space } from "antd";
|
|
|
33
33
|
import createEmotion from "@emotion/css/create-instance";
|
|
34
34
|
import { SearchOutlined, UndoOutlined } from "@ant-design/icons";
|
|
35
35
|
import { get, isObject, isString } from "lodash";
|
|
36
|
-
var
|
|
36
|
+
var css = createEmotion({ key: "filter" }).css;
|
|
37
37
|
var wrapper_css = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin-bottom: 25px;\n"], ["\n margin-bottom: 25px;\n"])));
|
|
38
|
-
var Filter = function (_a, ref) {
|
|
38
|
+
var Filter = React.forwardRef(function (_a, ref) {
|
|
39
39
|
var form = Form.useForm()[0];
|
|
40
40
|
var _b = useTableContext(), columns = _b.columns, table_ref = _b.table_ref;
|
|
41
41
|
var filters = columns === null || columns === void 0 ? void 0 : columns.filter(function (_a) {
|
|
@@ -72,6 +72,9 @@ var Filter = function (_a, ref) {
|
|
|
72
72
|
if (!(filters === null || filters === void 0 ? void 0 : filters.length))
|
|
73
73
|
return _jsx(Fragment, {});
|
|
74
74
|
return (_jsxs(Form, { layout: "inline", onFinish: onFinish, className: wrapper_css, form: form, initialValues: initialValues, children: [filters === null || filters === void 0 ? void 0 : filters.map(function (filter) { return _createElement(Field, __assign({}, filter, { key: String(filter.dataIndex) })); }), _jsxs(Space, { size: 14, children: [_jsxs(Button, { htmlType: "submit", type: "primary", children: [_jsx(SearchOutlined, {}), "\u67E5\u8BE2"] }), _jsxs(Button, { htmlType: "reset", children: [_jsx(UndoOutlined, {}), "\u91CD\u7F6E"] })] })] }));
|
|
75
|
-
};
|
|
76
|
-
export default
|
|
75
|
+
});
|
|
76
|
+
export default (function () {
|
|
77
|
+
var filter_ref = useTableContext().filter_ref;
|
|
78
|
+
return _jsx(Filter, { ref: filter_ref });
|
|
79
|
+
});
|
|
77
80
|
var templateObject_1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from "react";
|
|
2
|
-
import {
|
|
3
|
-
declare const _default:
|
|
2
|
+
import { type AnyObject } from "../interface";
|
|
3
|
+
declare const _default: () => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default _default;
|
|
5
5
|
interface ActionProps {
|
|
6
6
|
row: AnyObject;
|
package/dist/components/Table.js
CHANGED
|
@@ -69,7 +69,7 @@ import { useTableContext } from "./Context";
|
|
|
69
69
|
import AddForm from "./Add";
|
|
70
70
|
import EditForm from "./Edit";
|
|
71
71
|
import { css } from "@emotion/css";
|
|
72
|
-
var Table = function (_a, ref) {
|
|
72
|
+
var Table = React.forwardRef(function (_a, ref) {
|
|
73
73
|
var _b = useTableContext(), getSources = _b.getSources, selectionType = _b.rowSelection, action = _b.action, content_ref = _b.content_ref, filter_ref = _b.filter_ref, pageSizeOptions = _b.pageSizeOptions, _c = _b.actionColumn, actionColumn = _c === void 0 ? {} : _c, _pagination_ = _b.pagination, props = __rest(_b, ["getSources", "rowSelection", "action", "content_ref", "filter_ref", "pageSizeOptions", "actionColumn", "pagination"]);
|
|
74
74
|
var _d = useState([]), sources = _d[0], setSources = _d[1];
|
|
75
75
|
var _e = useState(), total = _e[0], setTotal = _e[1];
|
|
@@ -200,13 +200,16 @@ var Table = function (_a, ref) {
|
|
|
200
200
|
}); });
|
|
201
201
|
useEffect(loadRecords, []);
|
|
202
202
|
return (_jsx(AntdTable, __assign({}, props, { rowSelection: rowSelection, columns: columns, loading: loading, onChange: loadRecords, dataSource: sources, pagination: pagination })));
|
|
203
|
-
};
|
|
204
|
-
export default
|
|
203
|
+
});
|
|
204
|
+
export default (function () {
|
|
205
|
+
var table_ref = useTableContext().table_ref;
|
|
206
|
+
return _jsx(Table, { ref: table_ref });
|
|
207
|
+
});
|
|
205
208
|
var action_cls = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-top: 0;\n padding-bottom: 0;\n"], ["\n padding-top: 0;\n padding-bottom: 0;\n"])));
|
|
206
209
|
var append_action_default_children = (_jsxs(Button, { type: "link", size: "small", className: action_cls, children: [_jsx(PlusOutlined, {}), "\u65B0\u589E"] }));
|
|
207
210
|
export var AppendAction = function (_a) {
|
|
208
211
|
var _b = _a.children, children = _b === void 0 ? append_action_default_children : _b, row = _a.row;
|
|
209
|
-
var _c = useTableContext(), rowKey = _c.rowKey,
|
|
212
|
+
var _c = useTableContext(), rowKey = _c.rowKey, table_ref = _c.table_ref, filter_ref = _c.filter_ref, form_ref = _c.form_ref, add = _c.add, drawer = _c.drawer;
|
|
210
213
|
var _d = Modal.useModal(), modalInstance = _d[0], modalContextHolder = _d[1];
|
|
211
214
|
var _e = useState(false), add_drawer_open = _e[0], setAdd_drawer_open = _e[1];
|
|
212
215
|
var _f = useState(false), loading = _f[0], setLoading = _f[1];
|
|
@@ -497,10 +500,6 @@ export var DeleteAction = function (_a) {
|
|
|
497
500
|
case 10:
|
|
498
501
|
error_4 = _d.sent();
|
|
499
502
|
console.error(error_4);
|
|
500
|
-
modalInstance.error({
|
|
501
|
-
title: "错误",
|
|
502
|
-
content: String(error_4),
|
|
503
|
-
});
|
|
504
503
|
return [3 /*break*/, 12];
|
|
505
504
|
case 11:
|
|
506
505
|
setLoading(false);
|
package/dist/components/index.js
CHANGED
|
@@ -16,10 +16,11 @@ import Action from "./Action";
|
|
|
16
16
|
import Table from "./Table";
|
|
17
17
|
import { TableContextProvider, useTableContext } from "./Context";
|
|
18
18
|
var Content = function () {
|
|
19
|
-
var
|
|
20
|
-
return (_jsxs("div", { ref: content_ref, children: [_jsx(Filter, {
|
|
19
|
+
var content_ref = useTableContext().content_ref;
|
|
20
|
+
return (_jsxs("div", { ref: content_ref, children: [_jsx(Filter, {}), _jsx(Action, {}), _jsx(Table, {})] }));
|
|
21
21
|
};
|
|
22
22
|
var ContentPrev = function (props, ref) {
|
|
23
|
-
|
|
23
|
+
var _a = props.children, children = _a === void 0 ? _jsx(Content, {}) : _a;
|
|
24
|
+
return (_jsx(TableContextProvider, __assign({}, props, { ref: ref, children: children })));
|
|
24
25
|
};
|
|
25
26
|
export default React.forwardRef(ContentPrev);
|