@magicbe/antd-crud 0.0.37 → 0.0.39
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/dist/components/Action.js +2 -2
- package/dist/components/Table.js +22 -18
- package/dist/interface.d.ts +1 -0
- package/package.json +1 -1
|
@@ -237,7 +237,7 @@ export var AppendAction = function (_a) {
|
|
|
237
237
|
return drawer.add;
|
|
238
238
|
return 600;
|
|
239
239
|
}, [drawer]);
|
|
240
|
-
return (_jsxs(Fragment, { children: [React.cloneElement(children, { onClick: switchAddDrawer }), _jsx(Drawer, { title: "\u65B0\u589E", width: drawer_width, onClose: switchAddDrawer, open: add_drawer_open,
|
|
240
|
+
return (_jsxs(Fragment, { children: [React.cloneElement(children, { onClick: switchAddDrawer }), _jsx(Drawer, { title: "\u65B0\u589E", width: drawer_width, onClose: switchAddDrawer, open: add_drawer_open, extra: add_extra, destroyOnClose: true, keyboard: false, children: _jsx(AddForm, { ref: form_ref, default_data: init_data }) }), modalContextHolder] }));
|
|
241
241
|
};
|
|
242
242
|
var delete_action_default_children = (_jsxs(Button, { type: "primary", danger: true, children: [_jsx(DeleteOutlined, {}), "\u5220\u9664"] }));
|
|
243
243
|
/**删除方法 */
|
|
@@ -451,6 +451,6 @@ export var EditAction = function (_a) {
|
|
|
451
451
|
return drawer.add;
|
|
452
452
|
return 600;
|
|
453
453
|
}, [drawer]);
|
|
454
|
-
return (_jsxs(Fragment, { children: [React.cloneElement(children, { onClick: onClick }), _jsx(Drawer, { title: "\u7F16\u8F91", width: drawer_width, onClose: switchEditDrawer, open: edit_drawer_open,
|
|
454
|
+
return (_jsxs(Fragment, { children: [React.cloneElement(children, { onClick: onClick }), _jsx(Drawer, { title: "\u7F16\u8F91", width: drawer_width, onClose: switchEditDrawer, open: edit_drawer_open, extra: edit_extra, destroyOnClose: true, keyboard: false, children: _jsx(EditForm, { ref: form_ref, default_data: init_data }) }), modalContextHolder] }));
|
|
455
455
|
};
|
|
456
456
|
var templateObject_1;
|
package/dist/components/Table.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
1
5
|
var __assign = (this && this.__assign) || function () {
|
|
2
6
|
__assign = Object.assign || function(t) {
|
|
3
7
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -64,23 +68,21 @@ import { get, isArray, isEmpty, isFunction, isNumber, isObject } from "lodash";
|
|
|
64
68
|
import { useTableContext } from "./Context";
|
|
65
69
|
import AddForm from "./Add";
|
|
66
70
|
import EditForm from "./Edit";
|
|
71
|
+
import { css } from "@emotion/css";
|
|
67
72
|
var Table = function (_a, ref) {
|
|
68
|
-
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, _pagination_ = _b.pagination, props = __rest(_b, ["getSources", "rowSelection", "action", "content_ref", "filter_ref", "pageSizeOptions", "pagination"]);
|
|
69
|
-
var
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
var
|
|
75
|
-
var
|
|
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
|
+
var _d = useState([]), sources = _d[0], setSources = _d[1];
|
|
75
|
+
var _e = useState(), total = _e[0], setTotal = _e[1];
|
|
76
|
+
var _f = useState(), page = _f[0], setPage = _f[1];
|
|
77
|
+
var _g = useState(), size = _g[0], setSize = _g[1];
|
|
78
|
+
var _h = useState(false), loading = _h[0], setLoading = _h[1];
|
|
79
|
+
var _j = useState([]), selected_keys = _j[0], setSelected_keys = _j[1];
|
|
80
|
+
var _k = useState([]), selected_rows = _k[0], setSelected_rows = _k[1];
|
|
76
81
|
var columns = useMemo(function () {
|
|
77
82
|
var _a;
|
|
78
|
-
var default_action = {
|
|
79
|
-
title: "操作",
|
|
80
|
-
render: function (value, row, index) {
|
|
83
|
+
var default_action = __assign({ title: "操作", render: function (value, row, index) {
|
|
81
84
|
return (_jsxs(Space, { children: [React.cloneElement(_jsx(AppendAction, {}), value, row, index), React.cloneElement(_jsx(EditAction, {}), value, row, index), React.cloneElement(_jsx(DeleteAction, {}), value, row, index)] }));
|
|
82
|
-
}
|
|
83
|
-
};
|
|
85
|
+
} }, actionColumn);
|
|
84
86
|
var nexts = (_a = props.columns) === null || _a === void 0 ? void 0 : _a.filter(function (_a) {
|
|
85
87
|
var hidden = _a.hidden;
|
|
86
88
|
return !hidden;
|
|
@@ -200,7 +202,8 @@ var Table = function (_a, ref) {
|
|
|
200
202
|
return (_jsx(AntdTable, __assign({}, props, { rowSelection: rowSelection, columns: columns, loading: loading, onChange: loadRecords, dataSource: sources, pagination: pagination })));
|
|
201
203
|
};
|
|
202
204
|
export default React.forwardRef(Table);
|
|
203
|
-
var
|
|
205
|
+
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
|
+
var append_action_default_children = (_jsxs(Button, { type: "link", size: "small", className: action_cls, children: [_jsx(PlusOutlined, {}), "\u65B0\u589E"] }));
|
|
204
207
|
export var AppendAction = function (_a) {
|
|
205
208
|
var _b = _a.children, children = _b === void 0 ? append_action_default_children : _b, row = _a.row;
|
|
206
209
|
var _c = useTableContext(), rowKey = _c.rowKey, content_ref = _c.content_ref, table_ref = _c.table_ref, filter_ref = _c.filter_ref, form_ref = _c.form_ref, add = _c.add, drawer = _c.drawer;
|
|
@@ -321,9 +324,9 @@ export var AppendAction = function (_a) {
|
|
|
321
324
|
return drawer.add;
|
|
322
325
|
return 600;
|
|
323
326
|
}, [drawer]);
|
|
324
|
-
return (_jsxs(Fragment, { children: [React.cloneElement(children, { onClick: onClick }), _jsx(Drawer, { title: "\u65B0\u589E", width: drawer_width, onClose: switchAddDrawer, open: add_drawer_open,
|
|
327
|
+
return (_jsxs(Fragment, { children: [React.cloneElement(children, { onClick: onClick }), _jsx(Drawer, { title: "\u65B0\u589E", width: drawer_width, onClose: switchAddDrawer, open: add_drawer_open, extra: add_extra, destroyOnClose: true, keyboard: false, children: _jsx(AddForm, { default_data: init_data, ref: form_ref }) }), modalContextHolder] }));
|
|
325
328
|
};
|
|
326
|
-
var edit_action_default_children = (_jsxs(Button, { type: "link", size: "small", children: [_jsx(EditFilled, {}), "\u7F16\u8F91"] }));
|
|
329
|
+
var edit_action_default_children = (_jsxs(Button, { type: "link", size: "small", className: action_cls, children: [_jsx(EditFilled, {}), "\u7F16\u8F91"] }));
|
|
327
330
|
export var EditAction = function (_a) {
|
|
328
331
|
var _b = _a.children, children = _b === void 0 ? edit_action_default_children : _b, row = _a.row;
|
|
329
332
|
var _c = useTableContext(), edit = _c.edit, rowKey = _c.rowKey, content_ref = _c.content_ref, table_ref = _c.table_ref, filter_ref = _c.filter_ref, form_ref = _c.form_ref, drawer = _c.drawer;
|
|
@@ -437,9 +440,9 @@ export var EditAction = function (_a) {
|
|
|
437
440
|
return drawer.add;
|
|
438
441
|
return 600;
|
|
439
442
|
}, [drawer]);
|
|
440
|
-
return (_jsxs(Fragment, { children: [React.cloneElement(children, { onClick: onClick, loading: clickLoading }), _jsx(Drawer, { title: "\u7F16\u8F91", width: drawer_width, onClose: switchEditDrawer, open: edit_drawer_open,
|
|
443
|
+
return (_jsxs(Fragment, { children: [React.cloneElement(children, { onClick: onClick, loading: clickLoading }), _jsx(Drawer, { title: "\u7F16\u8F91", width: drawer_width, onClose: switchEditDrawer, open: edit_drawer_open, extra: edit_extra, destroyOnClose: true, keyboard: false, children: _jsx(EditForm, { ref: form_ref, default_data: init_data }) }), modalContextHolder] }));
|
|
441
444
|
};
|
|
442
|
-
var delete_action_default_children = (_jsxs(Button, { size: "small", type: "link", danger: true, children: [_jsx(DeleteOutlined, {}), "\u5220\u9664"] }));
|
|
445
|
+
var delete_action_default_children = (_jsxs(Button, { size: "small", type: "link", danger: true, className: action_cls, children: [_jsx(DeleteOutlined, {}), "\u5220\u9664"] }));
|
|
443
446
|
export var DeleteAction = function (_a) {
|
|
444
447
|
var _b = _a.children, children = _b === void 0 ? delete_action_default_children : _b, row = _a.row;
|
|
445
448
|
var _c = useTableContext(), table_ref = _c.table_ref, filter_ref = _c.filter_ref, del = _c.del, rowKey = _c.rowKey;
|
|
@@ -542,3 +545,4 @@ export var DeleteAction = function (_a) {
|
|
|
542
545
|
};
|
|
543
546
|
return (_jsxs(Fragment, { children: [React.cloneElement(children, { onClick: onClick, loading: loading }), modalContextHolder] }));
|
|
544
547
|
};
|
|
548
|
+
var templateObject_1;
|
package/dist/interface.d.ts
CHANGED
|
@@ -172,6 +172,7 @@ export interface ContentProps<RecordType = AnyObject> extends Omit<AntdTableProp
|
|
|
172
172
|
pagination?: false;
|
|
173
173
|
drawer?: number | DrawerProps;
|
|
174
174
|
pageSizeOptions?: PaginationProps["pageSizeOptions"];
|
|
175
|
+
actionColumn?: ColumnType<any>;
|
|
175
176
|
}
|
|
176
177
|
/**主体暴露 */
|
|
177
178
|
export interface ContentRef {
|