@magicbe/antd-crud 0.0.32 → 0.0.33

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.
@@ -2,17 +2,6 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
2
2
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
3
  return cooked;
4
4
  };
5
- var __assign = (this && this.__assign) || function () {
6
- __assign = Object.assign || function(t) {
7
- for (var s, i = 1, n = arguments.length; i < n; i++) {
8
- s = arguments[i];
9
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
- t[p] = s[p];
11
- }
12
- return t;
13
- };
14
- return __assign.apply(this, arguments);
15
- };
16
5
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
6
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
7
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -23,8 +12,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
23
12
  });
24
13
  };
25
14
  var __generator = (this && this.__generator) || function (thisArg, body) {
26
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
27
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
16
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
17
  function verb(n) { return function (v) { return step([n, v]); }; }
29
18
  function step(op) {
30
19
  if (f) throw new TypeError("Generator is already executing.");
@@ -76,7 +65,7 @@ var Action = function (_a, ref) {
76
65
  /**自定义渲染数组 */
77
66
  if (isArray(action)) {
78
67
  var children = action.map(function (Component, key) { return (_jsx(CustormRender, { children: _jsx(Component, {}) }, key)); });
79
- return (_jsx(Space, __assign({ className: cx(wrapper_css, className) }, { children: children })));
68
+ return (_jsx(Space, { className: cx(wrapper_css, className), children: children }));
80
69
  }
81
70
  /**自定义渲染对象 */
82
71
  if (isObject(action)) {
@@ -95,7 +84,7 @@ var Action = function (_a, ref) {
95
84
  /**自定义渲染数组 */
96
85
  if (isArray(master)) {
97
86
  var children = master.map(function (Component, key) { return (_jsx(CustormRender, { children: _jsx(Component, {}) }, key)); });
98
- return (_jsx(Space, __assign({ className: cx(wrapper_css, className) }, { children: children })));
87
+ return (_jsx(Space, { className: cx(wrapper_css, className), children: children }));
99
88
  }
100
89
  /**自定义渲染对象 */
101
90
  if (isObject(master)) {
@@ -130,11 +119,11 @@ var Action = function (_a, ref) {
130
119
  if (edit === true)
131
120
  edit_element = _jsx(EditAction, {});
132
121
  }
133
- return (_jsxs(Space, __assign({ className: cx(wrapper_css, className) }, { children: [add_element, edit_element, del_element] })));
122
+ return (_jsxs(Space, { className: cx(wrapper_css, className), children: [add_element, edit_element, del_element] }));
134
123
  }
135
124
  }
136
125
  /**默认渲染 */
137
- return (_jsxs(Space, __assign({ className: cx(wrapper_css, className) }, { children: [_jsx(AppendAction, {}), _jsx(EditAction, {}), _jsx(DeleteAction, {})] })));
126
+ return (_jsxs(Space, { className: cx(wrapper_css, className), children: [_jsx(AppendAction, {}), _jsx(EditAction, {}), _jsx(DeleteAction, {})] }));
138
127
  };
139
128
  export default React.forwardRef(Action);
140
129
  /**自定义渲染 */
@@ -240,7 +229,7 @@ export var AppendAction = function (_a) {
240
229
  }); });
241
230
  };
242
231
  /**新增操作 */
243
- var add_extra = (_jsxs(Space, { children: [_jsx(Button, __assign({ onClick: switchAddDrawer }, { children: "\u53D6\u6D88" })), _jsx(Button, __assign({ type: "primary", onClick: onConfirm, loading: loading }, { children: "\u786E\u5B9A" }))] }));
232
+ var add_extra = (_jsxs(Space, { children: [_jsx(Button, { onClick: switchAddDrawer, children: "\u53D6\u6D88" }), _jsx(Button, { type: "primary", onClick: onConfirm, loading: loading, children: "\u786E\u5B9A" })] }));
244
233
  var drawer_width = useMemo(function () {
245
234
  if (isNumber(drawer))
246
235
  return drawer;
@@ -248,7 +237,7 @@ export var AppendAction = function (_a) {
248
237
  return drawer.add;
249
238
  return 600;
250
239
  }, [drawer]);
251
- return (_jsxs(Fragment, { children: [_jsx(Button, __assign({ type: "primary", onClick: switchAddDrawer }, { children: children })), _jsx(Drawer, __assign({ title: "\u65B0\u589E", width: drawer_width, onClose: switchAddDrawer, open: add_drawer_open, closable: false, extra: add_extra, getContainer: function () { return content_ref.current; }, destroyOnClose: true }, { children: _jsx(AddForm, { ref: form_ref, default_data: init_data }) })), modalContextHolder] }));
240
+ return (_jsxs(Fragment, { children: [_jsx(Button, { type: "primary", onClick: switchAddDrawer, children: children }), _jsx(Drawer, { title: "\u65B0\u589E", width: drawer_width, onClose: switchAddDrawer, open: add_drawer_open, closable: false, extra: add_extra, getContainer: function () { return content_ref.current; }, destroyOnClose: true, children: _jsx(AddForm, { ref: form_ref, default_data: init_data }) }), modalContextHolder] }));
252
241
  };
253
242
  var delete_action_default_children = (_jsxs(Space, { children: [_jsx(DeleteOutlined, {}), "\u5220\u9664"] }));
254
243
  /**删除方法 */
@@ -355,7 +344,7 @@ export var DeleteAction = function (_a) {
355
344
  });
356
345
  });
357
346
  };
358
- return (_jsxs(Fragment, { children: [_jsx(Button, __assign({ type: "primary", danger: true, onClick: onClick, loading: loading }, { children: children })), modalContextHolder] }));
347
+ return (_jsxs(Fragment, { children: [_jsx(Button, { type: "primary", danger: true, onClick: onClick, loading: loading, children: children }), modalContextHolder] }));
359
348
  };
360
349
  var edit_action_default_children = (_jsxs(Space, { children: [_jsx(EditFilled, {}), "\u7F16\u8F91"] }));
361
350
  /**编辑方法 */
@@ -454,7 +443,7 @@ export var EditAction = function (_a) {
454
443
  }); });
455
444
  };
456
445
  /**编辑操作 */
457
- var edit_extra = (_jsxs(Space, { children: [_jsx(Button, __assign({ onClick: switchEditDrawer }, { children: "\u53D6\u6D88" })), _jsx(Button, __assign({ type: "primary", onClick: onConfirm, loading: loading }, { children: "\u786E\u5B9A" }))] }));
446
+ var edit_extra = (_jsxs(Space, { children: [_jsx(Button, { onClick: switchEditDrawer, children: "\u53D6\u6D88" }), _jsx(Button, { type: "primary", onClick: onConfirm, loading: loading, children: "\u786E\u5B9A" })] }));
458
447
  var drawer_width = useMemo(function () {
459
448
  if (isNumber(drawer))
460
449
  return drawer;
@@ -462,6 +451,6 @@ export var EditAction = function (_a) {
462
451
  return drawer.add;
463
452
  return 600;
464
453
  }, [drawer]);
465
- return (_jsxs(Fragment, { children: [_jsx(Button, __assign({ onClick: onClick }, { children: children })), _jsx(Drawer, __assign({ title: "\u7F16\u8F91", width: drawer_width, onClose: switchEditDrawer, open: edit_drawer_open, closable: false, extra: edit_extra, getContainer: function () { return content_ref.current; }, destroyOnClose: true }, { children: _jsx(EditForm, { ref: form_ref, default_data: init_data }) })), modalContextHolder] }));
454
+ return (_jsxs(Fragment, { children: [_jsx(Button, { onClick: onClick, children: children }), _jsx(Drawer, { title: "\u7F16\u8F91", width: drawer_width, onClose: switchEditDrawer, open: edit_drawer_open, closable: false, extra: edit_extra, getContainer: function () { return content_ref.current; }, destroyOnClose: true, children: _jsx(EditForm, { ref: form_ref, default_data: init_data }) }), modalContextHolder] }));
466
455
  };
467
456
  var templateObject_1;
@@ -53,6 +53,6 @@ var AddForm = React.forwardRef(function (_a, ref) {
53
53
  useImperativeHandle(ref, function () { return ({
54
54
  form: form,
55
55
  }); });
56
- return (_jsx(AntdForm, __assign({ form: form, layout: "vertical", initialValues: default_data }, { children: fields.map(function (field) { return _createElement(Field, __assign({}, field, { key: String(field.dataIndex) })); }) })));
56
+ return (_jsx(AntdForm, { form: form, layout: "vertical", initialValues: default_data, children: fields.map(function (field) { return _createElement(Field, __assign({}, field, { key: String(field.dataIndex) })); }) }));
57
57
  });
58
58
  export default AddForm;
@@ -37,7 +37,7 @@ var TableContextProviderPrev = function (_a, ref) {
37
37
  content_ref: content_ref,
38
38
  form_ref: form_ref,
39
39
  }); });
40
- return (_jsx(TableContext.Provider, __assign({ value: __assign(__assign({}, props), { drawer: drawer, filter_ref: filter_ref, action_ref: action_ref, table_ref: table_ref, content_ref: content_ref, form_ref: form_ref }) }, { children: children })));
40
+ return (_jsx(TableContext.Provider, { value: __assign(__assign({}, props), { drawer: drawer, filter_ref: filter_ref, action_ref: action_ref, table_ref: table_ref, content_ref: content_ref, form_ref: form_ref }), children: children }));
41
41
  };
42
42
  export var TableContextProvider = React.forwardRef(TableContextProviderPrev);
43
43
  export var useTableContext = function () { return useContext(TableContext); };
@@ -53,6 +53,6 @@ var EditForm = React.forwardRef(function (_a, ref) {
53
53
  useImperativeHandle(ref, function () { return ({
54
54
  form: form,
55
55
  }); });
56
- return (_jsx(AntdForm, __assign({ form: form, layout: "vertical", initialValues: default_data }, { children: fields.map(function (field) { return _createElement(Field, __assign({}, field, { key: String(field.dataIndex) })); }) })));
56
+ return (_jsx(AntdForm, { form: form, layout: "vertical", initialValues: default_data, children: fields.map(function (field) { return _createElement(Field, __assign({}, field, { key: String(field.dataIndex) })); }) }));
57
57
  });
58
58
  export default EditForm;
@@ -65,6 +65,6 @@ var Field = function (props) {
65
65
  };
66
66
  return getNext(field);
67
67
  }, [field, dataIndex, title]), Component = _a.Component, name = _a.name, label = _a.label, _b = _a.option, option = _b === void 0 ? {} : _b, rules = _a.rules;
68
- return (_jsx(Form.Item, __assign({ name: name, label: label, rules: rules, hidden: field === "Hidden" }, { children: _jsx(Component, __assign({}, option)) })));
68
+ return (_jsx(Form.Item, { name: name, label: label, rules: rules, hidden: field === "Hidden", children: _jsx(Component, __assign({}, option)) }));
69
69
  };
70
70
  export default Field;
@@ -67,7 +67,7 @@ var Filter = function (_a, ref) {
67
67
  var initialValues;
68
68
  if (!(filters === null || filters === void 0 ? void 0 : filters.length))
69
69
  return _jsx(Fragment, {});
70
- return (_jsxs(Form, __assign({ 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, { children: [_jsxs(Button, __assign({ htmlType: "submit", type: "primary" }, { children: [_jsx(SearchOutlined, {}), "\u67E5\u8BE2"] })), _jsxs(Button, __assign({ htmlType: "reset" }, { children: [_jsx(UndoOutlined, {}), "\u91CD\u7F6E"] }))] })] })));
70
+ 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, { children: [_jsxs(Button, { htmlType: "submit", type: "primary", children: [_jsx(SearchOutlined, {}), "\u67E5\u8BE2"] }), _jsxs(Button, { htmlType: "reset", children: [_jsx(UndoOutlined, {}), "\u91CD\u7F6E"] })] })] }));
71
71
  };
72
72
  export default React.forwardRef(Filter);
73
73
  var templateObject_1;
@@ -19,8 +19,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
19
19
  });
20
20
  };
21
21
  var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
24
  function verb(n) { return function (v) { return step([n, v]); }; }
25
25
  function step(op) {
26
26
  if (f) throw new TypeError("Generator is already executing.");
@@ -313,7 +313,7 @@ export var AppendAction = function (_a) {
313
313
  });
314
314
  }); };
315
315
  /**新增操作 */
316
- var add_extra = (_jsxs(Space, { children: [_jsx(Button, __assign({ onClick: switchAddDrawer }, { children: "\u53D6\u6D88" })), _jsx(Button, __assign({ type: "primary", onClick: onConfirm, loading: loading }, { children: "\u786E\u5B9A" }))] }));
316
+ var add_extra = (_jsxs(Space, { children: [_jsx(Button, { onClick: switchAddDrawer, children: "\u53D6\u6D88" }), _jsx(Button, { type: "primary", onClick: onConfirm, loading: loading, children: "\u786E\u5B9A" })] }));
317
317
  var drawer_width = useMemo(function () {
318
318
  if (isNumber(drawer))
319
319
  return drawer;
@@ -321,7 +321,7 @@ export var AppendAction = function (_a) {
321
321
  return drawer.add;
322
322
  return 600;
323
323
  }, [drawer]);
324
- return (_jsxs(Fragment, { children: [_jsx(Button, __assign({ type: "link", size: "small", onClick: onClick }, { children: children })), _jsx(Drawer, __assign({ title: "\u65B0\u589E", width: drawer_width, onClose: switchAddDrawer, open: add_drawer_open, closable: false, extra: add_extra, getContainer: function () { return content_ref.current; }, destroyOnClose: true }, { children: _jsx(AddForm, { default_data: init_data, ref: form_ref }) })), modalContextHolder] }));
324
+ return (_jsxs(Fragment, { children: [_jsx(Button, { type: "link", size: "small", onClick: onClick, children: children }), _jsx(Drawer, { title: "\u65B0\u589E", width: drawer_width, onClose: switchAddDrawer, open: add_drawer_open, closable: false, extra: add_extra, getContainer: function () { return content_ref.current; }, destroyOnClose: true, children: _jsx(AddForm, { default_data: init_data, ref: form_ref }) }), modalContextHolder] }));
325
325
  };
326
326
  var edit_action_default_children = (_jsxs(Space, { children: [_jsx(EditFilled, {}), "\u7F16\u8F91"] }));
327
327
  export var EditAction = function (_a) {
@@ -429,7 +429,7 @@ export var EditAction = function (_a) {
429
429
  }); });
430
430
  };
431
431
  /**新增操作 */
432
- var edit_extra = (_jsxs(Space, { children: [_jsx(Button, __assign({ onClick: switchEditDrawer }, { children: "\u53D6\u6D88" })), _jsx(Button, __assign({ type: "primary", onClick: onConfirm, loading: loading }, { children: "\u786E\u5B9A" }))] }));
432
+ var edit_extra = (_jsxs(Space, { children: [_jsx(Button, { onClick: switchEditDrawer, children: "\u53D6\u6D88" }), _jsx(Button, { type: "primary", onClick: onConfirm, loading: loading, children: "\u786E\u5B9A" })] }));
433
433
  var drawer_width = useMemo(function () {
434
434
  if (isNumber(drawer))
435
435
  return drawer;
@@ -437,7 +437,7 @@ export var EditAction = function (_a) {
437
437
  return drawer.add;
438
438
  return 600;
439
439
  }, [drawer]);
440
- return (_jsxs(Fragment, { children: [_jsx(Button, __assign({ type: "link", size: "small", onClick: onClick, loading: clickLoading }, { children: children })), _jsx(Drawer, __assign({ title: "\u7F16\u8F91", width: drawer_width, onClose: switchEditDrawer, open: edit_drawer_open, closable: false, extra: edit_extra, getContainer: function () { return content_ref.current; }, destroyOnClose: true }, { children: _jsx(EditForm, { ref: form_ref, default_data: init_data }) })), modalContextHolder] }));
440
+ return (_jsxs(Fragment, { children: [_jsx(Button, { type: "link", size: "small", onClick: onClick, loading: clickLoading, children: children }), _jsx(Drawer, { title: "\u7F16\u8F91", width: drawer_width, onClose: switchEditDrawer, open: edit_drawer_open, closable: false, extra: edit_extra, getContainer: function () { return content_ref.current; }, destroyOnClose: true, children: _jsx(EditForm, { ref: form_ref, default_data: init_data }) }), modalContextHolder] }));
441
441
  };
442
442
  var delete_action_default_children = (_jsxs(Space, { children: [_jsx(DeleteOutlined, {}), "\u5220\u9664"] }));
443
443
  export var DeleteAction = function (_a) {
@@ -540,5 +540,5 @@ export var DeleteAction = function (_a) {
540
540
  });
541
541
  });
542
542
  };
543
- return (_jsxs(Fragment, { children: [_jsx(Button, __assign({ type: "link", danger: true, size: "small", onClick: onClick, loading: loading }, { children: children })), modalContextHolder] }));
543
+ return (_jsxs(Fragment, { children: [_jsx(Button, { type: "link", danger: true, size: "small", onClick: onClick, loading: loading, children: children }), modalContextHolder] }));
544
544
  };
@@ -17,9 +17,9 @@ import Table from "./Table";
17
17
  import { TableContextProvider, useTableContext } from "./Context";
18
18
  var Content = function () {
19
19
  var _a = useTableContext(), filter_ref = _a.filter_ref, action_ref = _a.action_ref, table_ref = _a.table_ref, content_ref = _a.content_ref;
20
- return (_jsxs("div", __assign({ ref: content_ref }, { children: [_jsx(Filter, { ref: filter_ref }), _jsx(Action, { ref: action_ref }), _jsx(Table, { ref: table_ref })] })));
20
+ return (_jsxs("div", { ref: content_ref, children: [_jsx(Filter, { ref: filter_ref }), _jsx(Action, { ref: action_ref }), _jsx(Table, { ref: table_ref })] }));
21
21
  };
22
22
  var ContentPrev = function (props, ref) {
23
- return (_jsx(TableContextProvider, __assign({}, props, { ref: ref }, { children: _jsx(Content, {}) })));
23
+ return (_jsx(TableContextProvider, __assign({}, props, { ref: ref, children: _jsx(Content, {}) })));
24
24
  };
25
25
  export default React.forwardRef(ContentPrev);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magicbe/antd-crud",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "description": "antd crud table",
5
5
  "author": "wang quan",
6
6
  "private": false,
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@ant-design/icons": "^5.4.0",
22
22
  "@emotion/css": "^11.13.0",
23
- "antd": "5.18.3",
23
+ "antd": "5.22.5",
24
24
  "deepmerge": "^4.3.1",
25
25
  "lodash": "^4.17.21",
26
26
  "react": "^18.2.0",
@@ -41,7 +41,7 @@
41
41
  "@types/react-dom": "^18.0.9",
42
42
  "http-proxy-middleware": "^3.0.0",
43
43
  "react-scripts": "^5.0.1",
44
- "typescript": "^4.9.4"
44
+ "typescript": "5.7.3"
45
45
  },
46
46
  "scripts": {
47
47
  "lint": "eslint --ext js,ts,tsx src --max-warnings 5",