@zhubangyun/lowcode-core 5.6.214 → 5.8.110

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.
@@ -1,28 +1,30 @@
1
- #fullscreen-loading {
2
- position: fixed;
3
- width: 100vw;
4
- height: 100vh;
5
- top: 0;
6
- left: 0;
1
+ .page-loading {
2
+ width: 100%;
3
+ height: 100%;
7
4
  z-index: 10;
8
- background: white;
5
+ background: rgba(255, 255, 255, 0.5);
9
6
  display: flex;
10
7
  justify-content: center;
11
8
  align-items: center;
12
9
  overflow: hidden;
13
10
  }
14
11
 
15
- .page-loading {
16
- width: 100%;
17
- height: 100%;
18
- z-index: 10;
19
- background: white;
12
+
13
+ #fullscreen-loading {
14
+ position: fixed;
15
+ width: 100vw;
16
+ height: 100vh;
17
+ top: 0;
18
+ left: 0;
19
+ z-index: 100000;
20
+ background: rgba(255, 255, 255, 0.5);
20
21
  display: flex;
21
22
  justify-content: center;
22
23
  align-items: center;
23
24
  overflow: hidden;
24
25
  }
25
26
 
27
+
26
28
  .atom-spinner, .atom-spinner * {
27
29
  box-sizing: border-box;
28
30
  }
package/es/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import "./index.less";
2
2
  import utils from "./utils";
3
+ import * as lodash from "lodash";
3
4
  export { LoadMaterials } from "./components/load-materials";
4
5
  export { PageLoading } from "./components/page-loading";
5
6
  export { RestApi, RestFormApi, apiRequest } from "./utils/api";
6
7
  export { Layout } from "./components/layout";
7
8
  export { ReactRender } from "./components/react-render";
8
- export { utils };
9
+ export { utils, lodash };
package/es/index.js CHANGED
@@ -1,13 +1,23 @@
1
1
  import "./index.less";
2
2
  import utils from "./utils";
3
3
  import { ReactRender } from "./components/react-render";
4
+ import * as lodash from "lodash";
4
5
  export { LoadMaterials } from "./components/load-materials";
5
6
  export { PageLoading } from "./components/page-loading";
6
7
  export { RestApi, RestFormApi, apiRequest } from "./utils/api";
7
8
  export { Layout } from "./components/layout";
8
9
  export { ReactRender } from "./components/react-render";
9
- // @ts-ignore
10
- window.utils = utils;
10
+
11
11
  // @ts-ignore
12
12
  window.__ReactRender = ReactRender;
13
- export { utils };
13
+ // @ts-ignore
14
+ if (window._) {
15
+ // @ts-ignore
16
+ window.lodash = window._;
17
+ }
18
+ // @ts-ignore
19
+ if (!window.utils) {
20
+ // @ts-ignore
21
+ window.utils = utils;
22
+ }
23
+ export { utils, lodash };
package/es/style.js CHANGED
@@ -1,6 +1,7 @@
1
+ import 'antd/es/notification/style';
2
+ import 'antd/es/modal/style';
1
3
  import 'antd/es/message/style';
2
4
  import 'antd/es/drawer/style';
3
- import 'antd/es/modal/style';
4
5
  import 'antd/es/result/style';
5
6
  import 'antd/es/config-provider/style';
6
7
 
@@ -14,4 +14,5 @@ export declare class RestFormApi<DataType> extends RestApi<DataType> {
14
14
  save(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
15
15
  create(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
16
16
  update(id: string, data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
17
+ serviceUpdate(data: DataType, options?: BaseRequestOptions<DataType>): Promise<import("axios").AxiosResponse<any, any>>;
17
18
  }
@@ -1,11 +1,9 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
3
- 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."); }
4
- 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); }
5
- 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; }
6
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
4
  import { RestApi } from "./rest-api";
8
5
  import { getSchema } from "./index";
6
+ import { assembleAssociationField, convertSaveData, handleFilterRules } from "./form-api.utils";
9
7
  export var RestFormApi = /*#__PURE__*/function (_RestApi) {
10
8
  function RestFormApi(formId, fieldId, mock) {
11
9
  var _this;
@@ -25,7 +23,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
25
23
  _proto.initialize = /*#__PURE__*/function () {
26
24
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
27
25
  var _this2 = this;
28
- var res;
26
+ var _this$schema$props, res;
29
27
  return _regeneratorRuntime.wrap(function _callee$(_context) {
30
28
  while (1) switch (_context.prev = _context.next) {
31
29
  case 0:
@@ -42,7 +40,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
42
40
  res = _context.sent;
43
41
  this.schema = res.data;
44
42
  this.initialized = !!this.schema;
45
- this.title = this.schema.label;
43
+ this.title = (_this$schema$props = this.schema.props) === null || _this$schema$props === void 0 ? void 0 : _this$schema$props.label;
46
44
  if (this.fieldId) {
47
45
  JSON.stringify(this.schema, function (key, value) {
48
46
  var _value$props;
@@ -90,6 +88,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
90
88
  return this.initialize();
91
89
  case 2:
92
90
  config.params = config.params || {};
91
+ config.params.description = "" + this.title;
93
92
  config.params.formId = this.formId;
94
93
  if (this.fieldId) {
95
94
  config.params.fieldId = this.fieldId;
@@ -97,7 +96,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
97
96
  if (this.mock) {
98
97
  config.params.mock = this.mock;
99
98
  }
100
- case 6:
99
+ case 7:
101
100
  case "end":
102
101
  return _context2.stop();
103
102
  }
@@ -110,17 +109,35 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
110
109
  }();
111
110
  _proto.search = /*#__PURE__*/function () {
112
111
  var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(params) {
113
- var res;
112
+ var _params, _params2;
113
+ var config, res;
114
114
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
115
115
  while (1) switch (_context3.prev = _context3.next) {
116
116
  case 0:
117
- _context3.next = 2;
118
- return _RestApi.prototype.search.call(this, params);
119
- case 2:
117
+ params = params || {};
118
+ config = {
119
+ params: {
120
+ description: this.title + "\u67E5\u8BE2",
121
+ formId: this.formId,
122
+ fieldId: this.fieldId
123
+ }
124
+ };
125
+ _context3.next = 4;
126
+ return this.handleRequestConfig(config);
127
+ case 4:
128
+ params.filterRules = handleFilterRules(((_params = params) === null || _params === void 0 ? void 0 : _params.filterRules) || [], {
129
+ filterNullValue: false
130
+ });
131
+ params.searchFields = handleFilterRules(((_params2 = params) === null || _params2 === void 0 ? void 0 : _params2.searchFields) || [], {
132
+ filterNullValue: true
133
+ });
134
+ _context3.next = 8;
135
+ return this.request.post("search", params, config);
136
+ case 8:
120
137
  res = _context3.sent;
121
- res.data = assembleAssociationField(res.data, res.refs);
138
+ assembleAssociationField(res.data, res.refs);
122
139
  return _context3.abrupt("return", res);
123
- case 5:
140
+ case 11:
124
141
  case "end":
125
142
  return _context3.stop();
126
143
  }
@@ -141,9 +158,10 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
141
158
  return _RestApi.prototype.getById.call(this, id, options);
142
159
  case 2:
143
160
  res = _context4.sent;
144
- res.data = assembleAssociationField(res.data, res.refs);
161
+ assembleAssociationField(res.data, res.refs);
162
+ console.debug("formApi.getById", res);
145
163
  return _context4.abrupt("return", res);
146
- case 5:
164
+ case 6:
147
165
  case "end":
148
166
  return _context4.stop();
149
167
  }
@@ -205,57 +223,22 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
205
223
  }
206
224
  return update;
207
225
  }();
208
- return RestFormApi;
209
- }(RestApi);
210
- function convertSaveData(data) {
211
- if (!data) return data;
212
- return JSON.parse(JSON.stringify(data, function (key, value) {
213
- if (key == "parent") {
214
- return value === null || value === void 0 ? void 0 : value.id;
215
- }
216
- return value;
217
- }));
218
- }
219
- function assembleAssociationField(data, refs) {
220
- if (!data || !refs) return;
221
- var fieldIdDataMap = new Map();
222
- for (var _iterator = _createForOfIteratorHelperLoose(refs), _step; !(_step = _iterator()).done;) {
223
- var ref = _step.value;
224
- var dataMap = new Map();
225
- for (var _iterator2 = _createForOfIteratorHelperLoose(ref.data), _step2; !(_step2 = _iterator2()).done;) {
226
- var datum = _step2.value;
227
- dataMap.set(datum.id, datum);
228
- }
229
- for (var _iterator3 = _createForOfIteratorHelperLoose(ref.fieldIds), _step3; !(_step3 = _iterator3()).done;) {
230
- var fieldId = _step3.value;
231
- fieldIdDataMap.set(fieldId + "Id", dataMap);
232
- }
233
- }
234
- var jsonText = JSON.stringify(data, function (key, value) {
235
- if (value !== null && value !== void 0 && value.id) {
236
- var _loop = function _loop() {
237
- var fieldIdName = _Object$keys[_i];
238
- var dataMap = fieldIdDataMap.get(fieldIdName);
239
- if (dataMap) {
240
- var fieldIdValue = value[fieldIdName];
241
- var fieldValue = null;
242
- if (Array.isArray(fieldIdValue)) {
243
- fieldValue = fieldIdValue.map(function (id) {
244
- return dataMap.get(id);
245
- }).filter(function (v) {
246
- return !!v;
247
- });
248
- } else if (typeof fieldIdValue == "string") {
249
- fieldValue = dataMap.get(fieldIdValue);
250
- }
251
- value[fieldIdName.slice(0, -2)] = fieldValue;
226
+ _proto.serviceUpdate = /*#__PURE__*/function () {
227
+ var _serviceUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data, options) {
228
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
229
+ while (1) switch (_context8.prev = _context8.next) {
230
+ case 0:
231
+ return _context8.abrupt("return", this.request.post("serviceUpdate", data));
232
+ case 1:
233
+ case "end":
234
+ return _context8.stop();
252
235
  }
253
- };
254
- for (var _i = 0, _Object$keys = Object.keys(value); _i < _Object$keys.length; _i++) {
255
- _loop();
256
- }
236
+ }, _callee8, this);
237
+ }));
238
+ function serviceUpdate(_x12, _x13) {
239
+ return _serviceUpdate.apply(this, arguments);
257
240
  }
258
- return value;
259
- });
260
- return JSON.parse(jsonText);
261
- }
241
+ return serviceUpdate;
242
+ }();
243
+ return RestFormApi;
244
+ }(RestApi);
@@ -0,0 +1,7 @@
1
+ import { BaseType, FilterRule, Refs } from "./rest-api";
2
+ export declare function convertSaveData(data: any): any;
3
+ export declare function assembleAssociationField(data: BaseType | BaseType[], refs?: Refs): void;
4
+ export declare function assembleAssociationFieldValue(data: BaseType | BaseType[], fieldIdDataMap: Map<string, Map<string, BaseType>>, prefixKey?: string): void;
5
+ export declare function handleFilterRules(filters: FilterRule[], options: {
6
+ filterNullValue: boolean;
7
+ }): any;
@@ -0,0 +1,128 @@
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; }
5
+ import { transformerId } from "../data";
6
+ export function convertSaveData(data) {
7
+ if (!data) return data;
8
+ return JSON.parse(JSON.stringify(data, function (key, value) {
9
+ if (key == "parent") {
10
+ return value === null || value === void 0 ? void 0 : value.id;
11
+ }
12
+ return value;
13
+ }));
14
+ }
15
+ export function assembleAssociationField(data, refs) {
16
+ if (!data || !refs) return;
17
+ var fieldIdDataMap = new Map();
18
+ for (var _iterator = _createForOfIteratorHelperLoose(refs), _step; !(_step = _iterator()).done;) {
19
+ var ref = _step.value;
20
+ var dataMap = new Map();
21
+ for (var _iterator4 = _createForOfIteratorHelperLoose(ref.data), _step4; !(_step4 = _iterator4()).done;) {
22
+ var datum = _step4.value;
23
+ dataMap.set(datum.id, datum);
24
+ }
25
+ for (var _iterator5 = _createForOfIteratorHelperLoose(ref.fieldIds), _step5; !(_step5 = _iterator5()).done;) {
26
+ var fieldId = _step5.value;
27
+ fieldIdDataMap.set(fieldId + "Id", dataMap);
28
+ }
29
+ }
30
+ //组装refs的关联属性
31
+ for (var _iterator2 = _createForOfIteratorHelperLoose(refs), _step2; !(_step2 = _iterator2()).done;) {
32
+ var _ref = _step2.value;
33
+ var key = _ref.form.id;
34
+ if (_ref.form.fieldId) {
35
+ key += "." + _ref.form.fieldId;
36
+ }
37
+ assembleAssociationFieldValue(_ref.data, fieldIdDataMap, key);
38
+ }
39
+ function loopAssembleAssociation(values) {
40
+ if (!Array.isArray(values)) {
41
+ if (values !== null && values !== void 0 && values.id) {
42
+ loopAssembleAssociation([values]);
43
+ }
44
+ }
45
+ if (Array.isArray(values)) {
46
+ var _values$;
47
+ if ((_values$ = values[0]) !== null && _values$ !== void 0 && _values$.id) {
48
+ assembleAssociationFieldValue(values, fieldIdDataMap);
49
+ //处理子表
50
+ for (var _iterator3 = _createForOfIteratorHelperLoose(values), _step3; !(_step3 = _iterator3()).done;) {
51
+ var value = _step3.value;
52
+ for (var _i = 0, _Object$values = Object.values(value); _i < _Object$values.length; _i++) {
53
+ var subValues = _Object$values[_i];
54
+ if (Array.isArray(subValues)) {
55
+ loopAssembleAssociation(subValues);
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ loopAssembleAssociation(data);
63
+ }
64
+ export function assembleAssociationFieldValue(data, fieldIdDataMap, prefixKey) {
65
+ var arrayData = [];
66
+ if (Array.isArray(data)) {
67
+ arrayData = data;
68
+ } else if (typeof data == "object") {
69
+ arrayData = [data];
70
+ }
71
+ for (var _iterator6 = _createForOfIteratorHelperLoose(arrayData), _step6; !(_step6 = _iterator6()).done;) {
72
+ var item = _step6.value;
73
+ var _loop = function _loop() {
74
+ var fieldIdName = _Object$keys[_i2];
75
+ var fieldIdKey = fieldIdName;
76
+ if (prefixKey) {
77
+ fieldIdKey = prefixKey + "." + fieldIdName;
78
+ }
79
+ var dataMap = fieldIdDataMap.get(fieldIdKey);
80
+ if (dataMap) {
81
+ var fieldIdValue = item[fieldIdName];
82
+ var fieldValue = null;
83
+ if (Array.isArray(fieldIdValue)) {
84
+ // @ts-ignore
85
+ fieldValue = fieldIdValue.map(function (id) {
86
+ return dataMap.get(id);
87
+ }).filter(function (v) {
88
+ return !!v;
89
+ });
90
+ } else if (typeof fieldIdValue == "string") {
91
+ fieldValue = dataMap.get(fieldIdValue);
92
+ }
93
+ item[fieldIdName.slice(0, -2)] = fieldValue;
94
+ }
95
+ };
96
+ for (var _i2 = 0, _Object$keys = Object.keys(item); _i2 < _Object$keys.length; _i2++) {
97
+ _loop();
98
+ }
99
+ }
100
+ }
101
+ export function handleFilterRules(filters, options) {
102
+ var filterNullValue = options.filterNullValue;
103
+ if (Array.isArray(filters)) {
104
+ var cloneRules = filters.filter(function (rule) {
105
+ return !!rule;
106
+ }).map(function (rule) {
107
+ return _extends({}, rule, {
108
+ value: transformerId(rule.value),
109
+ rules: handleFilterRules(rule.rules || [], options)
110
+ });
111
+ });
112
+ if (filterNullValue) {
113
+ cloneRules = cloneRules.filter(function (rule) {
114
+ if (rule.value == null) {
115
+ if (rule.operator != "isNull" && rule.operator != "isNotNull") {
116
+ return false;
117
+ }
118
+ }
119
+ return true;
120
+ });
121
+ }
122
+ if (cloneRules.length == 0) {
123
+ return undefined;
124
+ }
125
+ } else {
126
+ return undefined;
127
+ }
128
+ }
@@ -22,6 +22,8 @@ export interface RestSearchParams {
22
22
  page?: number;
23
23
  pageSize?: number;
24
24
  filterRules?: FilterRule[];
25
+ searchFields?: FilterRule[];
26
+ orderRules?: any[];
25
27
  }
26
28
  export declare abstract class BaseRestApi<DataType> {
27
29
  uri: string;
@@ -49,6 +51,7 @@ export declare abstract class BaseRestApi<DataType> {
49
51
  * 通过id删除
50
52
  */
51
53
  deleteById(id: string, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
54
+ delete(data: any | any[], options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
52
55
  private showError;
53
56
  }
54
57
  export declare class RestApi<DataType> extends BaseRestApi<DataType> {
@@ -1,9 +1,12 @@
1
1
  import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
2
+ import _notification from "antd/es/notification";
3
+ import _Modal from "antd/es/modal";
2
4
  import _message from "antd/es/message";
3
5
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
5
7
  import axios from "axios";
6
8
  import { onFulfilled, onRejected } from "./index";
9
+ import { transformerId } from "../data";
7
10
  export var BaseRestApi = /*#__PURE__*/function () {
8
11
  function BaseRestApi(uri, options) {
9
12
  this.uri = void 0;
@@ -114,7 +117,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
114
117
  return (_this$handleRequestCo3 = this.handleRequestConfig) === null || _this$handleRequestCo3 === void 0 ? void 0 : _this$handleRequestCo3.call(this, config);
115
118
  case 3:
116
119
  _context3.next = 5;
117
- return this.request.post("", data, config);
120
+ return this.request.post("save", data, config);
118
121
  case 5:
119
122
  res = _context3.sent;
120
123
  if (res.success) {
@@ -284,26 +287,130 @@ export var BaseRestApi = /*#__PURE__*/function () {
284
287
  }
285
288
  return deleteById;
286
289
  }();
287
- _proto.showError = /*#__PURE__*/function () {
288
- var _showError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(type, msg) {
290
+ _proto["delete"] = /*#__PURE__*/function () {
291
+ var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(data, options) {
292
+ var _this$handleRequestCo7;
293
+ var config, arrayData, idValue, res, _options$onError6, _options$onSuccess6;
289
294
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
290
295
  while (1) switch (_context7.prev = _context7.next) {
291
296
  case 0:
292
- console.error("{" + this.title + "}" + type + (msg || ""));
293
- _message === null || _message === void 0 ? void 0 : _message.error("{" + this.title + "}" + type + (msg || "")).then();
294
- case 2:
297
+ config = {};
298
+ _context7.next = 3;
299
+ return (_this$handleRequestCo7 = this.handleRequestConfig) === null || _this$handleRequestCo7 === void 0 ? void 0 : _this$handleRequestCo7.call(this, config);
300
+ case 3:
301
+ arrayData = [];
302
+ idValue = transformerId(data);
303
+ if (!Array.isArray(idValue)) {
304
+ arrayData.push(idValue);
305
+ } else {
306
+ arrayData = idValue;
307
+ }
308
+ arrayData = arrayData.filter(function (item) {
309
+ return !!item;
310
+ });
311
+ if (!(arrayData.length == 0)) {
312
+ _context7.next = 9;
313
+ break;
314
+ }
315
+ throw new Error("删除对象不可为空!");
316
+ case 9:
317
+ _context7.next = 11;
318
+ return this.request.post("remove", arrayData, config);
319
+ case 11:
320
+ res = _context7.sent;
321
+ if (res.success) {
322
+ _context7.next = 18;
323
+ break;
324
+ }
325
+ this.showError("\u5220\u9664\u5931\u8D25!", res.message).then();
326
+ _context7.next = 16;
327
+ return options === null || options === void 0 ? void 0 : (_options$onError6 = options.onError) === null || _options$onError6 === void 0 ? void 0 : _options$onError6.call(options, res);
328
+ case 16:
329
+ _context7.next = 20;
330
+ break;
331
+ case 18:
332
+ _context7.next = 20;
333
+ return options === null || options === void 0 ? void 0 : (_options$onSuccess6 = options.onSuccess) === null || _options$onSuccess6 === void 0 ? void 0 : _options$onSuccess6.call(options, res);
334
+ case 20:
335
+ return _context7.abrupt("return", res);
336
+ case 21:
295
337
  case "end":
296
338
  return _context7.stop();
297
339
  }
298
340
  }, _callee7, this);
299
341
  }));
300
- function showError(_x13, _x14) {
342
+ function _delete(_x13, _x14) {
343
+ return _delete2.apply(this, arguments);
344
+ }
345
+ return _delete;
346
+ }();
347
+ _proto.showError = /*#__PURE__*/function () {
348
+ var _showError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(type, msg) {
349
+ var props;
350
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
351
+ while (1) switch (_context8.prev = _context8.next) {
352
+ case 0:
353
+ _context8.prev = 0;
354
+ if (!msg) {
355
+ _context8.next = 18;
356
+ break;
357
+ }
358
+ props = JSON.parse(msg);
359
+ props.content = props.message;
360
+ if (props.title) {
361
+ props.title = "" + this.title + type;
362
+ }
363
+ if (!(props.type == "message")) {
364
+ _context8.next = 10;
365
+ break;
366
+ }
367
+ _message.error(props);
368
+ return _context8.abrupt("return");
369
+ case 10:
370
+ if (!(props.type == "modal")) {
371
+ _context8.next = 15;
372
+ break;
373
+ }
374
+ _Modal.error(props);
375
+ return _context8.abrupt("return");
376
+ case 15:
377
+ if (!(props.type == "notification")) {
378
+ _context8.next = 18;
379
+ break;
380
+ }
381
+ _notification.error(props);
382
+ return _context8.abrupt("return");
383
+ case 18:
384
+ _context8.next = 23;
385
+ break;
386
+ case 20:
387
+ _context8.prev = 20;
388
+ _context8.t0 = _context8["catch"](0);
389
+ console.log("`showError`解析异常:", _context8.t0);
390
+ case 23:
391
+ console.error("{" + this.title + "}" + type + (msg || ""));
392
+ _message === null || _message === void 0 ? void 0 : _message.error("{" + this.title + "}" + type + (msg || "")).then();
393
+ case 25:
394
+ case "end":
395
+ return _context8.stop();
396
+ }
397
+ }, _callee8, this, [[0, 20]]);
398
+ }));
399
+ function showError(_x15, _x16) {
301
400
  return _showError.apply(this, arguments);
302
401
  }
303
402
  return showError;
304
403
  }();
305
404
  return BaseRestApi;
306
405
  }();
406
+ function getStringId(item) {
407
+ if (typeof (item === null || item === void 0 ? void 0 : item.id) === "string") {
408
+ return item.id;
409
+ } else if (typeof item === "string") {
410
+ return item;
411
+ }
412
+ return null;
413
+ }
307
414
  export var RestApi = /*#__PURE__*/function (_BaseRestApi2) {
308
415
  function RestApi(uri, options) {
309
416
  return _BaseRestApi2.call(this, uri, options) || this;
@@ -311,16 +418,16 @@ export var RestApi = /*#__PURE__*/function (_BaseRestApi2) {
311
418
  _inheritsLoose(RestApi, _BaseRestApi2);
312
419
  var _proto2 = RestApi.prototype;
313
420
  _proto2.handleRequestConfig = /*#__PURE__*/function () {
314
- var _handleRequestConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(config) {
315
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
316
- while (1) switch (_context8.prev = _context8.next) {
421
+ var _handleRequestConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(config) {
422
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
423
+ while (1) switch (_context9.prev = _context9.next) {
317
424
  case 0:
318
425
  case "end":
319
- return _context8.stop();
426
+ return _context9.stop();
320
427
  }
321
- }, _callee8);
428
+ }, _callee9);
322
429
  }));
323
- function handleRequestConfig(_x15) {
430
+ function handleRequestConfig(_x17) {
324
431
  return _handleRequestConfig.apply(this, arguments);
325
432
  }
326
433
  return handleRequestConfig;
@@ -16,13 +16,25 @@ function _handleFormSchema() {
16
16
  return _regeneratorRuntime.wrap(function _callee$(_context) {
17
17
  while (1) switch (_context.prev = _context.next) {
18
18
  case 0:
19
+ if (!(schema.type !== "form")) {
20
+ _context.next = 2;
21
+ break;
22
+ }
23
+ return _context.abrupt("return");
24
+ case 2:
25
+ if (schema !== null && schema !== void 0 && schema.componentName) {
26
+ _context.next = 4;
27
+ break;
28
+ }
29
+ return _context.abrupt("return");
30
+ case 4:
19
31
  fdmItems = [];
20
32
  fieldIdMap = new Map();
21
33
  schema.state = schema.state || {};
22
34
  schema.methods = schema.methods || {};
23
- _context.next = 6;
35
+ _context.next = 10;
24
36
  return handleAssociationForm(schema);
25
- case 6:
37
+ case 10:
26
38
  //初次处理
27
39
  forEachFormSchema(schema, function (field) {
28
40
  if (field.fdmSchema) {
@@ -69,7 +81,7 @@ function _handleFormSchema() {
69
81
  return true;
70
82
  });
71
83
  });
72
- case 8:
84
+ case 12:
73
85
  case "end":
74
86
  return _context.stop();
75
87
  }
@@ -0,0 +1 @@
1
+ export declare function transformerId(value: any): any;