@nokecy/qc-ui 1.0.63 → 1.0.65

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.
@@ -17,7 +17,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
17
17
  */
18
18
  var defaultHandleExport = exports.defaultHandleExport = /*#__PURE__*/function () {
19
19
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(exportApi, params, fileName) {
20
- var hide, blob, url, link, _error$response, errorMessage;
20
+ var hide, response, url, link, _error$response, errorMessage;
21
21
  return _regeneratorRuntime().wrap(function _callee$(_context) {
22
22
  while (1) switch (_context.prev = _context.next) {
23
23
  case 0:
@@ -26,9 +26,22 @@ var defaultHandleExport = exports.defaultHandleExport = /*#__PURE__*/function ()
26
26
  _context.next = 4;
27
27
  return exportApi(params);
28
28
  case 4:
29
- blob = _context.sent;
29
+ response = _context.sent;
30
+ if (response instanceof Blob) {
31
+ _context.next = 8;
32
+ break;
33
+ }
34
+ console.error('导出API返回的不是Blob对象:', response);
35
+ throw new Error('导出数据格式错误,请检查API配置');
36
+ case 8:
37
+ if (!(response.size === 0)) {
38
+ _context.next = 10;
39
+ break;
40
+ }
41
+ throw new Error('导出的文件为空');
42
+ case 10:
30
43
  // 创建下载链接
31
- url = window.URL.createObjectURL(blob);
44
+ url = window.URL.createObjectURL(response);
32
45
  link = document.createElement('a');
33
46
  link.href = url;
34
47
  link.download = fileName;
@@ -39,24 +52,24 @@ var defaultHandleExport = exports.defaultHandleExport = /*#__PURE__*/function ()
39
52
  document.body.removeChild(link);
40
53
  window.URL.revokeObjectURL(url);
41
54
  _antd.message.success('导出成功');
42
- _context.next = 22;
55
+ _context.next = 27;
43
56
  break;
44
- case 16:
45
- _context.prev = 16;
57
+ case 21:
58
+ _context.prev = 21;
46
59
  _context.t0 = _context["catch"](1);
47
60
  console.error('导出失败:', _context.t0);
48
61
  errorMessage = ((_error$response = _context.t0.response) === null || _error$response === void 0 || (_error$response = _error$response.data) === null || _error$response === void 0 || (_error$response = _error$response.error) === null || _error$response === void 0 ? void 0 : _error$response.message) || _context.t0.message || '导出失败';
49
62
  _antd.message.error("\u5BFC\u51FA\u5931\u8D25\uFF1A".concat(errorMessage));
50
63
  throw _context.t0;
51
- case 22:
52
- _context.prev = 22;
64
+ case 27:
65
+ _context.prev = 27;
53
66
  hide();
54
- return _context.finish(22);
55
- case 25:
67
+ return _context.finish(27);
68
+ case 30:
56
69
  case "end":
57
70
  return _context.stop();
58
71
  }
59
- }, _callee, null, [[1, 16, 22, 25]]);
72
+ }, _callee, null, [[1, 21, 27, 30]]);
60
73
  }));
61
74
  return function defaultHandleExport(_x, _x2, _x3) {
62
75
  return _ref.apply(this, arguments);
@@ -150,7 +150,12 @@ var withStandardForm = exports.withStandardForm = function withStandardForm(conf
150
150
  Select: _antdV.Select,
151
151
  DatePicker: _antdV.DatePicker,
152
152
  NumberPicker: _antdV.NumberPicker,
153
- Switch: _antdV.Switch
153
+ Switch: _antdV.Switch,
154
+ FormItem: _antdV.FormItem,
155
+ // 字段装饰器,用于渲染 label
156
+ FormLayout: _antdV.FormLayout,
157
+ // 表单布局组件
158
+ FormGrid: _antdV.FormGrid
154
159
  }, customComponents);
155
160
  return (0, _react2.createSchemaField)({
156
161
  components: components
@@ -12,7 +12,7 @@ import { message } from 'antd';
12
12
  */
13
13
  export var defaultHandleExport = /*#__PURE__*/function () {
14
14
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(exportApi, params, fileName) {
15
- var hide, blob, url, link, _error$response, errorMessage;
15
+ var hide, response, url, link, _error$response, errorMessage;
16
16
  return _regeneratorRuntime().wrap(function _callee$(_context) {
17
17
  while (1) switch (_context.prev = _context.next) {
18
18
  case 0:
@@ -21,9 +21,22 @@ export var defaultHandleExport = /*#__PURE__*/function () {
21
21
  _context.next = 4;
22
22
  return exportApi(params);
23
23
  case 4:
24
- blob = _context.sent;
24
+ response = _context.sent;
25
+ if (response instanceof Blob) {
26
+ _context.next = 8;
27
+ break;
28
+ }
29
+ console.error('导出API返回的不是Blob对象:', response);
30
+ throw new Error('导出数据格式错误,请检查API配置');
31
+ case 8:
32
+ if (!(response.size === 0)) {
33
+ _context.next = 10;
34
+ break;
35
+ }
36
+ throw new Error('导出的文件为空');
37
+ case 10:
25
38
  // 创建下载链接
26
- url = window.URL.createObjectURL(blob);
39
+ url = window.URL.createObjectURL(response);
27
40
  link = document.createElement('a');
28
41
  link.href = url;
29
42
  link.download = fileName;
@@ -34,24 +47,24 @@ export var defaultHandleExport = /*#__PURE__*/function () {
34
47
  document.body.removeChild(link);
35
48
  window.URL.revokeObjectURL(url);
36
49
  message.success('导出成功');
37
- _context.next = 22;
50
+ _context.next = 27;
38
51
  break;
39
- case 16:
40
- _context.prev = 16;
52
+ case 21:
53
+ _context.prev = 21;
41
54
  _context.t0 = _context["catch"](1);
42
55
  console.error('导出失败:', _context.t0);
43
56
  errorMessage = ((_error$response = _context.t0.response) === null || _error$response === void 0 || (_error$response = _error$response.data) === null || _error$response === void 0 || (_error$response = _error$response.error) === null || _error$response === void 0 ? void 0 : _error$response.message) || _context.t0.message || '导出失败';
44
57
  message.error("\u5BFC\u51FA\u5931\u8D25\uFF1A".concat(errorMessage));
45
58
  throw _context.t0;
46
- case 22:
47
- _context.prev = 22;
59
+ case 27:
60
+ _context.prev = 27;
48
61
  hide();
49
- return _context.finish(22);
50
- case 25:
62
+ return _context.finish(27);
63
+ case 30:
51
64
  case "end":
52
65
  return _context.stop();
53
66
  }
54
- }, _callee, null, [[1, 16, 22, 25]]);
67
+ }, _callee, null, [[1, 21, 27, 30]]);
55
68
  }));
56
69
  return function defaultHandleExport(_x, _x2, _x3) {
57
70
  return _ref.apply(this, arguments);
@@ -10,7 +10,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
10
10
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
11
  import React, { useMemo } from 'react';
12
12
  import { createSchemaField } from '@formily/react';
13
- import { Input, Select, DatePicker, NumberPicker, Switch } from '@formily/antd-v5';
13
+ import { Input, Select, DatePicker, NumberPicker, Switch, FormItem, FormLayout, FormGrid } from '@formily/antd-v5';
14
14
  import StandardFormDialog from "./StandardFormDialog";
15
15
 
16
16
  /**
@@ -142,7 +142,12 @@ export var withStandardForm = function withStandardForm(config) {
142
142
  Select: Select,
143
143
  DatePicker: DatePicker,
144
144
  NumberPicker: NumberPicker,
145
- Switch: Switch
145
+ Switch: Switch,
146
+ FormItem: FormItem,
147
+ // 字段装饰器,用于渲染 label
148
+ FormLayout: FormLayout,
149
+ // 表单布局组件
150
+ FormGrid: FormGrid
146
151
  }, customComponents);
147
152
  return createSchemaField({
148
153
  components: components