@zhubangyun/lowcode-core 5.12.92 → 6.1.90

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.
Files changed (98) hide show
  1. package/es/components/load-materials/index.js +44 -28
  2. package/es/components/page-loading/index.js +4 -1
  3. package/es/demo/index.js +8 -8
  4. package/es/index.d.ts +1 -1
  5. package/es/index.js +41 -2
  6. package/es/index.less +10 -0
  7. package/es/style.js +2 -2
  8. package/es/utils/api/file-api.js +21 -21
  9. package/es/utils/api/form-api.d.ts +2 -1
  10. package/es/utils/api/form-api.js +90 -51
  11. package/es/utils/api/form-api.utils.js +5 -4
  12. package/es/utils/api/index.d.ts +2 -2
  13. package/es/utils/api/index.js +1 -0
  14. package/es/utils/api/rest-api.d.ts +3 -1
  15. package/es/utils/api/rest-api.js +207 -125
  16. package/es/utils/api/schema-api.js +5 -5
  17. package/es/utils/api/schema.util.d.ts +3 -3
  18. package/es/utils/api/schema.util.js +17 -12
  19. package/es/utils/api/script-api.js +12 -12
  20. package/es/utils/api/user-info.js +7 -7
  21. package/es/utils/cache/index.js +66 -26
  22. package/es/utils/common/LoadPlugins.js +33 -33
  23. package/es/utils/common/SingletonInstanceMap.js +21 -21
  24. package/es/utils/common/index.d.ts +3 -0
  25. package/es/utils/common/index.js +13 -3
  26. package/es/utils/designer/assets/assets.parse.js +15 -15
  27. package/es/utils/designer/assets/assets.typing.js +6 -0
  28. package/es/utils/designer/engine/index.js +23 -23
  29. package/es/utils/designer/index.js +7 -7
  30. package/es/utils/page/index.js +18 -18
  31. package/es/utils/page/page-form-data-manager-group.js +9 -6
  32. package/es/utils/page/page-form-data-manager.d.ts +1 -0
  33. package/es/utils/page/page-form-data-manager.js +9 -6
  34. package/es/utils/page/page-form-group.d.ts +1 -0
  35. package/es/utils/page/page-form-group.js +8 -7
  36. package/es/utils/page/page-form.d.ts +1 -0
  37. package/es/utils/page/page-form.js +23 -12
  38. package/es/utils/page/page-layout.d.ts +3 -0
  39. package/es/utils/page/page-layout.js +33 -9
  40. package/es/utils/page/page-load-schema.js +20 -28
  41. package/es/utils/page/page-render.js +4 -4
  42. package/es/utils/page/page-show.d.ts +2 -0
  43. package/es/utils/page/page-show.js +8 -3
  44. package/es/utils/page/print-form.js +60 -51
  45. package/es/utils/uni-bridge.d.ts +18 -0
  46. package/es/utils/uni-bridge.js +130 -0
  47. package/es/utils/util.common.d.ts +1 -0
  48. package/es/utils/util.common.js +4 -0
  49. package/lib/components/load-materials/index.js +45 -30
  50. package/lib/components/page-loading/index.js +4 -1
  51. package/lib/demo/index.js +9 -10
  52. package/lib/index.d.ts +1 -1
  53. package/lib/index.js +45 -6
  54. package/lib/index.less +10 -0
  55. package/lib/style.js +2 -2
  56. package/lib/utils/api/file-api.js +21 -21
  57. package/lib/utils/api/form-api.d.ts +2 -1
  58. package/lib/utils/api/form-api.js +90 -51
  59. package/lib/utils/api/form-api.utils.js +5 -4
  60. package/lib/utils/api/index.d.ts +2 -2
  61. package/lib/utils/api/index.js +2 -2
  62. package/lib/utils/api/rest-api.d.ts +3 -1
  63. package/lib/utils/api/rest-api.js +207 -125
  64. package/lib/utils/api/schema-api.js +5 -5
  65. package/lib/utils/api/schema.util.d.ts +3 -3
  66. package/lib/utils/api/schema.util.js +19 -13
  67. package/lib/utils/api/script-api.js +12 -12
  68. package/lib/utils/api/user-info.js +7 -7
  69. package/lib/utils/cache/index.js +65 -25
  70. package/lib/utils/common/LoadPlugins.js +33 -33
  71. package/lib/utils/common/SingletonInstanceMap.js +21 -21
  72. package/lib/utils/common/index.d.ts +3 -0
  73. package/lib/utils/common/index.js +15 -2
  74. package/lib/utils/designer/assets/assets.parse.js +16 -17
  75. package/lib/utils/designer/assets/assets.typing.js +6 -0
  76. package/lib/utils/designer/engine/index.js +23 -23
  77. package/lib/utils/designer/index.js +7 -7
  78. package/lib/utils/index.js +1 -2
  79. package/lib/utils/page/index.js +18 -18
  80. package/lib/utils/page/page-form-data-manager-group.js +10 -8
  81. package/lib/utils/page/page-form-data-manager.d.ts +1 -0
  82. package/lib/utils/page/page-form-data-manager.js +10 -8
  83. package/lib/utils/page/page-form-group.d.ts +1 -0
  84. package/lib/utils/page/page-form-group.js +9 -9
  85. package/lib/utils/page/page-form.d.ts +1 -0
  86. package/lib/utils/page/page-form.js +24 -14
  87. package/lib/utils/page/page-layout.d.ts +3 -0
  88. package/lib/utils/page/page-layout.js +34 -11
  89. package/lib/utils/page/page-load-schema.js +19 -27
  90. package/lib/utils/page/page-render.js +4 -4
  91. package/lib/utils/page/page-show.d.ts +2 -0
  92. package/lib/utils/page/page-show.js +9 -5
  93. package/lib/utils/page/print-form.js +60 -51
  94. package/lib/utils/uni-bridge.d.ts +18 -0
  95. package/lib/utils/uni-bridge.js +135 -0
  96. package/lib/utils/util.common.d.ts +1 -0
  97. package/lib/utils/util.common.js +8 -0
  98. package/package.json +2 -2
@@ -1,12 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
2
+ function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
5
  import { transformerId } from "../data";
6
+ var SimpleSerialFieldNames = ["parent", "instance"];
6
7
  export function convertSaveData(data) {
7
8
  if (!data) return data;
8
9
  return JSON.parse(JSON.stringify(data, function (key, value) {
9
- if (key == "parent") {
10
+ if (SimpleSerialFieldNames.includes(key)) {
10
11
  var id = value === null || value === void 0 ? void 0 : value.id;
11
12
  return id ? {
12
13
  id: id
@@ -1,11 +1,11 @@
1
+ import { AxiosResponse } from "axios";
1
2
  export { RestApi } from "./rest-api";
2
3
  export { getFormApi, RestFormApi } from "./form-api";
3
- import { AxiosResponse } from "axios/index";
4
4
  export { getSchema } from "./schema-api";
5
5
  export { getUserinfo } from "./user-info";
6
6
  export * as files from "./file-api";
7
7
  export * as scrips from "./script-api";
8
8
  export declare const apiRequest: import("axios").AxiosInstance;
9
- export declare const request: <T = any, R = AxiosResponse<T, any>, D = any>(config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
9
+ export declare const request: <T = any, R = AxiosResponse<T, any, {}>, D = any>(config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
10
10
  export declare function onFulfilled(res: AxiosResponse): any;
11
11
  export declare function onRejected(error: any): any;
@@ -32,6 +32,7 @@ export function onRejected(error) {
32
32
  var _error$response = error.response,
33
33
  status = _error$response.status,
34
34
  statusText = _error$response.statusText;
35
+ console.error("请求失败!", error);
35
36
  if (status == 400) {
36
37
  return error.response.data || {};
37
38
  }
@@ -36,7 +36,7 @@ export declare abstract class BaseRestApi<DataType> {
36
36
  title: string;
37
37
  request: AxiosInstance;
38
38
  protected constructor(uri: string, options?: RestApiOptions);
39
- abstract handleRequestConfig(config: AxiosRequestConfig): void;
39
+ abstract handleRequestConfig(config: AxiosRequestConfig): Promise<void>;
40
40
  search(params?: RestSearchParams): Promise<ManyResult<DataType>>;
41
41
  /**
42
42
  * 通过id获取
@@ -58,6 +58,8 @@ export declare abstract class BaseRestApi<DataType> {
58
58
  */
59
59
  deleteById(id: string, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
60
60
  delete(data: any | any[], options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
61
+ export(data: any, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
62
+ import(data: any, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
61
63
  showError(type: string, res: BaseResult<any>): Promise<void>;
62
64
  }
63
65
  export declare class RestApi<DataType> extends BaseRestApi<DataType> {
@@ -28,25 +28,25 @@ export var BaseRestApi = /*#__PURE__*/function () {
28
28
  }
29
29
  var _proto = BaseRestApi.prototype;
30
30
  _proto.search = /*#__PURE__*/function () {
31
- var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
31
+ var _search = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
32
32
  var _this$handleRequestCo;
33
33
  var config;
34
- return _regeneratorRuntime.wrap(function _callee$(_context) {
34
+ return _regeneratorRuntime.wrap(function (_context) {
35
35
  while (1) switch (_context.prev = _context.next) {
36
36
  case 0:
37
37
  config = {
38
38
  params: params
39
39
  };
40
- _context.next = 3;
40
+ _context.next = 1;
41
41
  return (_this$handleRequestCo = this.handleRequestConfig) === null || _this$handleRequestCo === void 0 ? void 0 : _this$handleRequestCo.call(this, config);
42
- case 3:
43
- _context.next = 5;
42
+ case 1:
43
+ _context.next = 2;
44
44
  return this.request.get("", {
45
45
  params: params
46
46
  });
47
- case 5:
47
+ case 2:
48
48
  return _context.abrupt("return", _context.sent);
49
- case 6:
49
+ case 3:
50
50
  case "end":
51
51
  return _context.stop();
52
52
  }
@@ -66,36 +66,36 @@ export var BaseRestApi = /*#__PURE__*/function () {
66
66
  _proto.getById =
67
67
  /*#__PURE__*/
68
68
  function () {
69
- var _getById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id, options) {
69
+ var _getById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id, options) {
70
70
  var _this$handleRequestCo2;
71
71
  var config, res, _options$onError, _options$onSuccess;
72
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
72
+ return _regeneratorRuntime.wrap(function (_context2) {
73
73
  while (1) switch (_context2.prev = _context2.next) {
74
74
  case 0:
75
75
  config = {};
76
- _context2.next = 3;
76
+ _context2.next = 1;
77
77
  return (_this$handleRequestCo2 = this.handleRequestConfig) === null || _this$handleRequestCo2 === void 0 ? void 0 : _this$handleRequestCo2.call(this, config);
78
- case 3:
79
- _context2.next = 5;
78
+ case 1:
79
+ _context2.next = 2;
80
80
  return this.request.get(String(id), config);
81
- case 5:
81
+ case 2:
82
82
  res = _context2.sent;
83
83
  if (res.success) {
84
- _context2.next = 12;
84
+ _context2.next = 4;
85
85
  break;
86
86
  }
87
87
  this.showError("\u83B7\u53D6{" + id + "}\u5931\u8D25!", res).then();
88
- _context2.next = 10;
88
+ _context2.next = 3;
89
89
  return options === null || options === void 0 ? void 0 : (_options$onError = options.onError) === null || _options$onError === void 0 ? void 0 : _options$onError.call(options, res);
90
- case 10:
91
- _context2.next = 14;
90
+ case 3:
91
+ _context2.next = 5;
92
92
  break;
93
- case 12:
94
- _context2.next = 14;
93
+ case 4:
94
+ _context2.next = 5;
95
95
  return options === null || options === void 0 ? void 0 : (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 ? void 0 : _options$onSuccess.call(options, res);
96
- case 14:
96
+ case 5:
97
97
  return _context2.abrupt("return", res);
98
- case 15:
98
+ case 6:
99
99
  case "end":
100
100
  return _context2.stop();
101
101
  }
@@ -107,36 +107,36 @@ export var BaseRestApi = /*#__PURE__*/function () {
107
107
  return getById;
108
108
  }();
109
109
  _proto.save = /*#__PURE__*/function () {
110
- var _save = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data, options) {
110
+ var _save = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data, options) {
111
111
  var _this$handleRequestCo3;
112
112
  var config, res, _options$onError2, _options$onSuccess2;
113
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
113
+ return _regeneratorRuntime.wrap(function (_context3) {
114
114
  while (1) switch (_context3.prev = _context3.next) {
115
115
  case 0:
116
116
  config = {};
117
- _context3.next = 3;
117
+ _context3.next = 1;
118
118
  return (_this$handleRequestCo3 = this.handleRequestConfig) === null || _this$handleRequestCo3 === void 0 ? void 0 : _this$handleRequestCo3.call(this, config);
119
- case 3:
120
- _context3.next = 5;
119
+ case 1:
120
+ _context3.next = 2;
121
121
  return this.request.post("save", data, config);
122
- case 5:
122
+ case 2:
123
123
  res = _context3.sent;
124
124
  if (res.success) {
125
- _context3.next = 12;
125
+ _context3.next = 4;
126
126
  break;
127
127
  }
128
128
  this.showError("\u63D0\u4EA4\u5931\u8D25!", res).then();
129
- _context3.next = 10;
129
+ _context3.next = 3;
130
130
  return options === null || options === void 0 ? void 0 : (_options$onError2 = options.onError) === null || _options$onError2 === void 0 ? void 0 : _options$onError2.call(options, res);
131
- case 10:
132
- _context3.next = 14;
131
+ case 3:
132
+ _context3.next = 5;
133
133
  break;
134
- case 12:
135
- _context3.next = 14;
134
+ case 4:
135
+ _context3.next = 5;
136
136
  return options === null || options === void 0 ? void 0 : (_options$onSuccess2 = options.onSuccess) === null || _options$onSuccess2 === void 0 ? void 0 : _options$onSuccess2.call(options, res);
137
- case 14:
137
+ case 5:
138
138
  return _context3.abrupt("return", res);
139
- case 15:
139
+ case 6:
140
140
  case "end":
141
141
  return _context3.stop();
142
142
  }
@@ -154,36 +154,36 @@ export var BaseRestApi = /*#__PURE__*/function () {
154
154
  _proto.create =
155
155
  /*#__PURE__*/
156
156
  function () {
157
- var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data, options) {
157
+ var _create = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data, options) {
158
158
  var _this$handleRequestCo4;
159
159
  var config, res, _options$onError3, _options$onSuccess3;
160
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
160
+ return _regeneratorRuntime.wrap(function (_context4) {
161
161
  while (1) switch (_context4.prev = _context4.next) {
162
162
  case 0:
163
163
  config = {};
164
- _context4.next = 3;
164
+ _context4.next = 1;
165
165
  return (_this$handleRequestCo4 = this.handleRequestConfig) === null || _this$handleRequestCo4 === void 0 ? void 0 : _this$handleRequestCo4.call(this, config);
166
- case 3:
167
- _context4.next = 5;
166
+ case 1:
167
+ _context4.next = 2;
168
168
  return this.request.post("", data, config);
169
- case 5:
169
+ case 2:
170
170
  res = _context4.sent;
171
171
  if (res.success) {
172
- _context4.next = 12;
172
+ _context4.next = 4;
173
173
  break;
174
174
  }
175
175
  this.showError("\u65B0\u589E\u5931\u8D25!", res).then();
176
- _context4.next = 10;
176
+ _context4.next = 3;
177
177
  return options === null || options === void 0 ? void 0 : (_options$onError3 = options.onError) === null || _options$onError3 === void 0 ? void 0 : _options$onError3.call(options, res);
178
- case 10:
179
- _context4.next = 14;
178
+ case 3:
179
+ _context4.next = 5;
180
180
  break;
181
- case 12:
182
- _context4.next = 14;
181
+ case 4:
182
+ _context4.next = 5;
183
183
  return options === null || options === void 0 ? void 0 : (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 ? void 0 : _options$onSuccess3.call(options, res);
184
- case 14:
184
+ case 5:
185
185
  return _context4.abrupt("return", res);
186
- case 15:
186
+ case 6:
187
187
  case "end":
188
188
  return _context4.stop();
189
189
  }
@@ -201,42 +201,42 @@ export var BaseRestApi = /*#__PURE__*/function () {
201
201
  _proto.update =
202
202
  /*#__PURE__*/
203
203
  function () {
204
- var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, data, options) {
204
+ var _update = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, data, options) {
205
205
  var _this$handleRequestCo5;
206
206
  var config, res, _options$onError4, _options$onSuccess4;
207
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
207
+ return _regeneratorRuntime.wrap(function (_context5) {
208
208
  while (1) switch (_context5.prev = _context5.next) {
209
209
  case 0:
210
210
  config = {};
211
- _context5.next = 3;
211
+ _context5.next = 1;
212
212
  return (_this$handleRequestCo5 = this.handleRequestConfig) === null || _this$handleRequestCo5 === void 0 ? void 0 : _this$handleRequestCo5.call(this, config);
213
- case 3:
214
- _context5.next = 5;
213
+ case 1:
214
+ _context5.next = 2;
215
215
  return this.request.put(String(id), data, config);
216
- case 5:
216
+ case 2:
217
217
  res = _context5.sent;
218
218
  if (res.success) {
219
- _context5.next = 12;
219
+ _context5.next = 4;
220
220
  break;
221
221
  }
222
222
  this.showError("\u66F4\u65B0\u5931\u8D25!", res).then();
223
- _context5.next = 10;
223
+ _context5.next = 3;
224
224
  return options === null || options === void 0 ? void 0 : (_options$onError4 = options.onError) === null || _options$onError4 === void 0 ? void 0 : _options$onError4.call(options, res);
225
- case 10:
226
- _context5.next = 14;
225
+ case 3:
226
+ _context5.next = 5;
227
227
  break;
228
- case 12:
229
- _context5.next = 14;
228
+ case 4:
229
+ _context5.next = 5;
230
230
  return options === null || options === void 0 ? void 0 : (_options$onSuccess4 = options.onSuccess) === null || _options$onSuccess4 === void 0 ? void 0 : _options$onSuccess4.call(options, res);
231
- case 14:
231
+ case 5:
232
232
  return _context5.abrupt("return", res);
233
- case 15:
233
+ case 6:
234
234
  case "end":
235
235
  return _context5.stop();
236
236
  }
237
237
  }, _callee5, this);
238
238
  }));
239
- function update(_x8, _x9, _x10) {
239
+ function update(_x8, _x9, _x0) {
240
240
  return _update.apply(this, arguments);
241
241
  }
242
242
  return update;
@@ -248,57 +248,57 @@ export var BaseRestApi = /*#__PURE__*/function () {
248
248
  _proto.deleteById =
249
249
  /*#__PURE__*/
250
250
  function () {
251
- var _deleteById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id, options) {
251
+ var _deleteById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id, options) {
252
252
  var _this$handleRequestCo6;
253
253
  var config, res, _options$onError5, _options$onSuccess5;
254
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
254
+ return _regeneratorRuntime.wrap(function (_context6) {
255
255
  while (1) switch (_context6.prev = _context6.next) {
256
256
  case 0:
257
257
  config = {};
258
- _context6.next = 3;
258
+ _context6.next = 1;
259
259
  return (_this$handleRequestCo6 = this.handleRequestConfig) === null || _this$handleRequestCo6 === void 0 ? void 0 : _this$handleRequestCo6.call(this, config);
260
- case 3:
261
- _context6.next = 5;
260
+ case 1:
261
+ _context6.next = 2;
262
262
  return this.request["delete"](String(id), config);
263
- case 5:
263
+ case 2:
264
264
  res = _context6.sent;
265
265
  if (res.success) {
266
- _context6.next = 12;
266
+ _context6.next = 4;
267
267
  break;
268
268
  }
269
269
  this.showError("\u5220\u9664{" + id + "}\u5931\u8D25!", res).then();
270
- _context6.next = 10;
270
+ _context6.next = 3;
271
271
  return options === null || options === void 0 ? void 0 : (_options$onError5 = options.onError) === null || _options$onError5 === void 0 ? void 0 : _options$onError5.call(options, res);
272
- case 10:
273
- _context6.next = 14;
272
+ case 3:
273
+ _context6.next = 5;
274
274
  break;
275
- case 12:
276
- _context6.next = 14;
275
+ case 4:
276
+ _context6.next = 5;
277
277
  return options === null || options === void 0 ? void 0 : (_options$onSuccess5 = options.onSuccess) === null || _options$onSuccess5 === void 0 ? void 0 : _options$onSuccess5.call(options, res);
278
- case 14:
278
+ case 5:
279
279
  return _context6.abrupt("return", res);
280
- case 15:
280
+ case 6:
281
281
  case "end":
282
282
  return _context6.stop();
283
283
  }
284
284
  }, _callee6, this);
285
285
  }));
286
- function deleteById(_x11, _x12) {
286
+ function deleteById(_x1, _x10) {
287
287
  return _deleteById.apply(this, arguments);
288
288
  }
289
289
  return deleteById;
290
290
  }();
291
291
  _proto["delete"] = /*#__PURE__*/function () {
292
- var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data, options) {
292
+ var _delete2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data, options) {
293
293
  var _this$handleRequestCo7;
294
294
  var config, arrayData, idValue, res, _options$onError6, _options$onSuccess6;
295
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
295
+ return _regeneratorRuntime.wrap(function (_context7) {
296
296
  while (1) switch (_context7.prev = _context7.next) {
297
297
  case 0:
298
298
  config = {};
299
- _context7.next = 3;
299
+ _context7.next = 1;
300
300
  return (_this$handleRequestCo7 = this.handleRequestConfig) === null || _this$handleRequestCo7 === void 0 ? void 0 : _this$handleRequestCo7.call(this, config);
301
- case 3:
301
+ case 1:
302
302
  arrayData = [];
303
303
  idValue = transformerId(data);
304
304
  if (!Array.isArray(idValue)) {
@@ -310,51 +310,133 @@ export var BaseRestApi = /*#__PURE__*/function () {
310
310
  return !!item;
311
311
  });
312
312
  if (!(arrayData.length == 0)) {
313
- _context7.next = 9;
313
+ _context7.next = 2;
314
314
  break;
315
315
  }
316
316
  throw new Error("删除对象不可为空!");
317
- case 9:
318
- _context7.next = 11;
317
+ case 2:
318
+ _context7.next = 3;
319
319
  return this.request.post("remove", arrayData, config);
320
- case 11:
320
+ case 3:
321
321
  res = _context7.sent;
322
322
  if (res.success) {
323
- _context7.next = 18;
323
+ _context7.next = 5;
324
324
  break;
325
325
  }
326
326
  this.showError("\u5220\u9664\u5931\u8D25!", res).then();
327
- _context7.next = 16;
327
+ _context7.next = 4;
328
328
  return options === null || options === void 0 ? void 0 : (_options$onError6 = options.onError) === null || _options$onError6 === void 0 ? void 0 : _options$onError6.call(options, res);
329
- case 16:
330
- _context7.next = 20;
329
+ case 4:
330
+ _context7.next = 6;
331
331
  break;
332
- case 18:
333
- _context7.next = 20;
332
+ case 5:
333
+ _context7.next = 6;
334
334
  return options === null || options === void 0 ? void 0 : (_options$onSuccess6 = options.onSuccess) === null || _options$onSuccess6 === void 0 ? void 0 : _options$onSuccess6.call(options, res);
335
- case 20:
335
+ case 6:
336
336
  return _context7.abrupt("return", res);
337
- case 21:
337
+ case 7:
338
338
  case "end":
339
339
  return _context7.stop();
340
340
  }
341
341
  }, _callee7, this);
342
342
  }));
343
- function _delete(_x13, _x14) {
343
+ function _delete(_x11, _x12) {
344
344
  return _delete2.apply(this, arguments);
345
345
  }
346
346
  return _delete;
347
347
  }();
348
- _proto.showError = /*#__PURE__*/function () {
349
- var _showError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(type, res) {
350
- var msg, props;
351
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
348
+ _proto["export"] = /*#__PURE__*/function () {
349
+ var _export2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data, options) {
350
+ var _this$handleRequestCo8;
351
+ var config, res, _options$onError7, _options$onSuccess7;
352
+ return _regeneratorRuntime.wrap(function (_context8) {
352
353
  while (1) switch (_context8.prev = _context8.next) {
354
+ case 0:
355
+ config = {};
356
+ _context8.next = 1;
357
+ return (_this$handleRequestCo8 = this.handleRequestConfig) === null || _this$handleRequestCo8 === void 0 ? void 0 : _this$handleRequestCo8.call(this, config);
358
+ case 1:
359
+ _context8.next = 2;
360
+ return this.request.post("/export", data, config);
361
+ case 2:
362
+ res = _context8.sent;
363
+ if (res.success) {
364
+ _context8.next = 4;
365
+ break;
366
+ }
367
+ this.showError("\u5BFC\u51FA\u5931\u8D25!", res).then();
368
+ _context8.next = 3;
369
+ return options === null || options === void 0 ? void 0 : (_options$onError7 = options.onError) === null || _options$onError7 === void 0 ? void 0 : _options$onError7.call(options, res);
370
+ case 3:
371
+ _context8.next = 5;
372
+ break;
373
+ case 4:
374
+ _context8.next = 5;
375
+ return options === null || options === void 0 ? void 0 : (_options$onSuccess7 = options.onSuccess) === null || _options$onSuccess7 === void 0 ? void 0 : _options$onSuccess7.call(options, res);
376
+ case 5:
377
+ return _context8.abrupt("return", res);
378
+ case 6:
379
+ case "end":
380
+ return _context8.stop();
381
+ }
382
+ }, _callee8, this);
383
+ }));
384
+ function _export(_x13, _x14) {
385
+ return _export2.apply(this, arguments);
386
+ }
387
+ return _export;
388
+ }();
389
+ _proto["import"] = /*#__PURE__*/function () {
390
+ var _import2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(data, options) {
391
+ var _this$handleRequestCo9;
392
+ var config, res, _options$onError8, _options$onSuccess8;
393
+ return _regeneratorRuntime.wrap(function (_context9) {
394
+ while (1) switch (_context9.prev = _context9.next) {
395
+ case 0:
396
+ config = {};
397
+ _context9.next = 1;
398
+ return (_this$handleRequestCo9 = this.handleRequestConfig) === null || _this$handleRequestCo9 === void 0 ? void 0 : _this$handleRequestCo9.call(this, config);
399
+ case 1:
400
+ _context9.next = 2;
401
+ return this.request.post("import", data, config);
402
+ case 2:
403
+ res = _context9.sent;
404
+ if (res.success) {
405
+ _context9.next = 4;
406
+ break;
407
+ }
408
+ this.showError("\u5BFC\u5165\u5931\u8D25!", res).then();
409
+ _context9.next = 3;
410
+ return options === null || options === void 0 ? void 0 : (_options$onError8 = options.onError) === null || _options$onError8 === void 0 ? void 0 : _options$onError8.call(options, res);
411
+ case 3:
412
+ _context9.next = 5;
413
+ break;
414
+ case 4:
415
+ _context9.next = 5;
416
+ return options === null || options === void 0 ? void 0 : (_options$onSuccess8 = options.onSuccess) === null || _options$onSuccess8 === void 0 ? void 0 : _options$onSuccess8.call(options, res);
417
+ case 5:
418
+ return _context9.abrupt("return", res);
419
+ case 6:
420
+ case "end":
421
+ return _context9.stop();
422
+ }
423
+ }, _callee9, this);
424
+ }));
425
+ function _import(_x15, _x16) {
426
+ return _import2.apply(this, arguments);
427
+ }
428
+ return _import;
429
+ }();
430
+ _proto.showError = /*#__PURE__*/function () {
431
+ var _showError = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(type, res) {
432
+ var msg, props, _t;
433
+ return _regeneratorRuntime.wrap(function (_context0) {
434
+ while (1) switch (_context0.prev = _context0.next) {
353
435
  case 0:
354
436
  msg = res.message;
355
- _context8.prev = 1;
437
+ _context0.prev = 1;
356
438
  if (!msg) {
357
- _context8.next = 19;
439
+ _context0.next = 4;
358
440
  break;
359
441
  }
360
442
  props = JSON.parse(msg);
@@ -363,31 +445,31 @@ export var BaseRestApi = /*#__PURE__*/function () {
363
445
  props.title = "" + this.title + type;
364
446
  }
365
447
  if (!(props.type == "message")) {
366
- _context8.next = 11;
448
+ _context0.next = 2;
367
449
  break;
368
450
  }
369
451
  _message.error(props);
370
- return _context8.abrupt("return");
371
- case 11:
452
+ return _context0.abrupt("return");
453
+ case 2:
372
454
  if (!(props.type == "modal")) {
373
- _context8.next = 16;
455
+ _context0.next = 3;
374
456
  break;
375
457
  }
376
458
  _Modal.error(props);
377
- return _context8.abrupt("return");
378
- case 16:
459
+ return _context0.abrupt("return");
460
+ case 3:
379
461
  if (!(props.type == "notification")) {
380
- _context8.next = 19;
462
+ _context0.next = 4;
381
463
  break;
382
464
  }
383
465
  _notification.error(props);
384
- return _context8.abrupt("return");
385
- case 19:
386
- _context8.next = 25;
466
+ return _context0.abrupt("return");
467
+ case 4:
468
+ _context0.next = 6;
387
469
  break;
388
- case 21:
389
- _context8.prev = 21;
390
- _context8.t0 = _context8["catch"](1);
470
+ case 5:
471
+ _context0.prev = 5;
472
+ _t = _context0["catch"](1);
391
473
  console.error("" + this.title + type + (msg || ""));
392
474
  _Modal.error({
393
475
  title: "" + this.title + type,
@@ -397,13 +479,13 @@ export var BaseRestApi = /*#__PURE__*/function () {
397
479
  message: res.message
398
480
  })
399
481
  });
400
- case 25:
482
+ case 6:
401
483
  case "end":
402
- return _context8.stop();
484
+ return _context0.stop();
403
485
  }
404
- }, _callee8, this, [[1, 21]]);
486
+ }, _callee0, this, [[1, 5]]);
405
487
  }));
406
- function showError(_x15, _x16) {
488
+ function showError(_x17, _x18) {
407
489
  return _showError.apply(this, arguments);
408
490
  }
409
491
  return showError;
@@ -425,16 +507,16 @@ export var RestApi = /*#__PURE__*/function (_BaseRestApi2) {
425
507
  _inheritsLoose(RestApi, _BaseRestApi2);
426
508
  var _proto2 = RestApi.prototype;
427
509
  _proto2.handleRequestConfig = /*#__PURE__*/function () {
428
- var _handleRequestConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(config) {
429
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
430
- while (1) switch (_context9.prev = _context9.next) {
510
+ var _handleRequestConfig = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(config) {
511
+ return _regeneratorRuntime.wrap(function (_context1) {
512
+ while (1) switch (_context1.prev = _context1.next) {
431
513
  case 0:
432
514
  case "end":
433
- return _context9.stop();
515
+ return _context1.stop();
434
516
  }
435
- }, _callee9);
517
+ }, _callee1);
436
518
  }));
437
- function handleRequestConfig(_x17) {
519
+ function handleRequestConfig(_x19) {
438
520
  return _handleRequestConfig.apply(this, arguments);
439
521
  }
440
522
  return handleRequestConfig;
@@ -5,21 +5,21 @@ export function getSchema(_x, _x2) {
5
5
  return _getSchema.apply(this, arguments);
6
6
  }
7
7
  function _getSchema() {
8
- _getSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pageId, mock) {
8
+ _getSchema = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(pageId, mock) {
9
9
  var key;
10
- return _regeneratorRuntime.wrap(function _callee$(_context) {
10
+ return _regeneratorRuntime.wrap(function (_context) {
11
11
  while (1) switch (_context.prev = _context.next) {
12
12
  case 0:
13
13
  mock = getMock(mock);
14
14
  key = mock ? pageId + ":mock" : pageId;
15
- _context.next = 4;
15
+ _context.next = 1;
16
16
  return schema.getInstance(key, {
17
17
  mock: mock,
18
18
  pageId: pageId
19
19
  });
20
- case 4:
20
+ case 1:
21
21
  return _context.abrupt("return", _context.sent);
22
- case 5:
22
+ case 2:
23
23
  case "end":
24
24
  return _context.stop();
25
25
  }