@zhubangyun/lowcode-core 5.7.301 → 5.8.290

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.
@@ -54,7 +54,7 @@ function _loadMaterials() {
54
54
  }
55
55
  return _context2.abrupt("return");
56
56
  case 3:
57
- urls = ["prop-types/15.8.1/prop-types.min.js", "lodash/4.6.1/lodash.min.js", "dayjs/dayjs.min.js", "antd/latest/reset.css", "antd/latest/antd.min.js", "antdIcon/1.0.0/antdIcon.min.js", "lowcode/core/index.js", "lowcode/core/index.css", "lowcode/materials/root/view.js", "lowcode/materials/root/view.css", "lowcode/materials/antd/view.js", "lowcode/materials/antd/view.css", "lowcode/materials/antd-pro/view.js", "lowcode/materials/antd-pro/view.css", "lowcode/icon-font/app/iconfont.js"];
57
+ urls = ["prop-types/15.8.1/prop-types.min.js", "lodash/4.17.15/lodash.min.js", "dayjs/dayjs.min.js", "antd/latest/reset.css", "antd/latest/antd.min.js", "antdIcon/1.0.0/antdIcon.min.js", "lowcode/core/index.js", "lowcode/core/index.css", "lowcode/materials/root/view.js", "lowcode/materials/root/view.css", "lowcode/materials/antd/view.js", "lowcode/materials/antd/view.css", "lowcode/materials/antd-pro/view.js", "lowcode/materials/antd-pro/view.css", "lowcode/icon-font/app/iconfont.js"];
58
58
  _context2.next = 6;
59
59
  return loadPlugins(urls.map(function (url) {
60
60
  return "https://cdn.zhiyunhe.com/plugin/" + url;
@@ -1,9 +1,6 @@
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
5
  background: rgba(255, 255, 255, 0.5);
9
6
  display: flex;
@@ -12,10 +9,14 @@
12
9
  overflow: hidden;
13
10
  }
14
11
 
15
- .page-loading {
16
- width: 100%;
17
- height: 100%;
18
- z-index: 10;
12
+
13
+ #fullscreen-loading {
14
+ position: fixed;
15
+ width: 100vw;
16
+ height: 100vh;
17
+ top: 0;
18
+ left: 0;
19
+ z-index: 100000;
19
20
  background: rgba(255, 255, 255, 0.5);
20
21
  display: flex;
21
22
  justify-content: center;
@@ -23,6 +24,7 @@
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.js CHANGED
@@ -7,8 +7,7 @@ export { PageLoading } from "./components/page-loading";
7
7
  export { RestApi, RestFormApi, apiRequest } from "./utils/api";
8
8
  export { Layout } from "./components/layout";
9
9
  export { ReactRender } from "./components/react-render";
10
- // @ts-ignore
11
- window.utils = utils;
10
+
12
11
  // @ts-ignore
13
12
  window.__ReactRender = ReactRender;
14
13
  // @ts-ignore
@@ -16,4 +15,9 @@ if (window._) {
16
15
  // @ts-ignore
17
16
  window.lodash = window._;
18
17
  }
18
+ // @ts-ignore
19
+ if (!window.utils) {
20
+ // @ts-ignore
21
+ window.utils = utils;
22
+ }
19
23
  export { utils, lodash };
package/es/style.js CHANGED
@@ -1,3 +1,4 @@
1
+ import 'antd/es/typography/style';
1
2
  import 'antd/es/notification/style';
2
3
  import 'antd/es/modal/style';
3
4
  import 'antd/es/message/style';
@@ -9,9 +9,10 @@ export declare class RestFormApi<DataType> extends RestApi<DataType> {
9
9
  constructor(formId: string, fieldId?: string, mock?: boolean);
10
10
  initialize(): Promise<boolean>;
11
11
  handleRequestConfig(config: AxiosRequestConfig): Promise<void>;
12
- search(params?: RestSearchParams): Promise<ManyResult<DataType>>;
12
+ search(searchParams?: RestSearchParams): Promise<ManyResult<DataType>>;
13
13
  getById(id: string, options?: BaseRequestOptions<DataType>): Promise<OneResult<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$children, _this$schema$children2, 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$children = this.schema.children[0]) === null || _this$schema$children === void 0 ? void 0 : (_this$schema$children2 = _this$schema$children.props) === null || _this$schema$children2 === void 0 ? void 0 : _this$schema$children2.label;
46
44
  if (this.fieldId) {
47
45
  JSON.stringify(this.schema, function (key, value) {
48
46
  var _value$props;
@@ -110,27 +108,38 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
110
108
  return handleRequestConfig;
111
109
  }();
112
110
  _proto.search = /*#__PURE__*/function () {
113
- var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(params) {
114
- var res;
111
+ var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(searchParams) {
112
+ var _searchParams, _searchParams2;
113
+ var config, res, start;
115
114
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
116
115
  while (1) switch (_context3.prev = _context3.next) {
117
116
  case 0:
118
- _context3.next = 2;
119
- return this.initialize();
120
- case 2:
121
- _context3.next = 4;
122
- return this.request.post("search", params, {
117
+ searchParams = searchParams || {};
118
+ config = {
123
119
  params: {
124
120
  description: this.title + "\u67E5\u8BE2",
125
121
  formId: this.formId,
126
122
  fieldId: this.fieldId
127
123
  }
128
- });
124
+ };
125
+ _context3.next = 4;
126
+ return this.handleRequestConfig(config);
129
127
  case 4:
128
+ searchParams.filterRules = handleFilterRules(((_searchParams = searchParams) === null || _searchParams === void 0 ? void 0 : _searchParams.filterRules) || [], {
129
+ filterNullValue: false
130
+ });
131
+ searchParams.searchFields = handleFilterRules(((_searchParams2 = searchParams) === null || _searchParams2 === void 0 ? void 0 : _searchParams2.searchFields) || [], {
132
+ filterNullValue: true
133
+ });
134
+ _context3.next = 8;
135
+ return this.request.post("search", searchParams, config);
136
+ case 8:
130
137
  res = _context3.sent;
138
+ start = Date.now();
131
139
  assembleAssociationField(res.data, res.refs);
140
+ console.debug("form.search:" + (Date.now() - start), res);
132
141
  return _context3.abrupt("return", res);
133
- case 7:
142
+ case 13:
134
143
  case "end":
135
144
  return _context3.stop();
136
145
  }
@@ -143,7 +152,7 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
143
152
  }();
144
153
  _proto.getById = /*#__PURE__*/function () {
145
154
  var _getById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id, options) {
146
- var res;
155
+ var res, start;
147
156
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
148
157
  while (1) switch (_context4.prev = _context4.next) {
149
158
  case 0:
@@ -151,10 +160,11 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
151
160
  return _RestApi.prototype.getById.call(this, id, options);
152
161
  case 2:
153
162
  res = _context4.sent;
163
+ start = Date.now();
154
164
  assembleAssociationField(res.data, res.refs);
155
- console.debug("formApi.getById", res);
165
+ console.debug("formApi.getById" + (Date.now() - start), res);
156
166
  return _context4.abrupt("return", res);
157
- case 6:
167
+ case 7:
158
168
  case "end":
159
169
  return _context4.stop();
160
170
  }
@@ -216,100 +226,22 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
216
226
  }
217
227
  return update;
218
228
  }();
219
- return RestFormApi;
220
- }(RestApi);
221
- function convertSaveData(data) {
222
- if (!data) return data;
223
- return JSON.parse(JSON.stringify(data, function (key, value) {
224
- if (key == "parent") {
225
- return value === null || value === void 0 ? void 0 : value.id;
226
- }
227
- return value;
228
- }));
229
- }
230
- function assembleAssociationField(data, refs) {
231
- if (!data || !refs) return;
232
- var fieldIdDataMap = new Map();
233
- for (var _iterator = _createForOfIteratorHelperLoose(refs), _step; !(_step = _iterator()).done;) {
234
- var ref = _step.value;
235
- var dataMap = new Map();
236
- for (var _iterator4 = _createForOfIteratorHelperLoose(ref.data), _step4; !(_step4 = _iterator4()).done;) {
237
- var datum = _step4.value;
238
- dataMap.set(datum.id, datum);
239
- }
240
- for (var _iterator5 = _createForOfIteratorHelperLoose(ref.fieldIds), _step5; !(_step5 = _iterator5()).done;) {
241
- var fieldId = _step5.value;
242
- fieldIdDataMap.set(fieldId + "Id", dataMap);
243
- }
244
- }
245
- //组装refs的关联属性
246
- for (var _iterator2 = _createForOfIteratorHelperLoose(refs), _step2; !(_step2 = _iterator2()).done;) {
247
- var _ref = _step2.value;
248
- var key = _ref.form.id;
249
- if (_ref.form.fieldId) {
250
- key += "." + _ref.form.fieldId;
251
- }
252
- assembleAssociationFieldValue(_ref.data, fieldIdDataMap, key);
253
- }
254
- function loopAssembleAssociation(values) {
255
- if (!Array.isArray(values)) {
256
- if (values !== null && values !== void 0 && values.id) {
257
- loopAssembleAssociation([values]);
258
- }
259
- }
260
- if (Array.isArray(values)) {
261
- var _values$;
262
- if ((_values$ = values[0]) !== null && _values$ !== void 0 && _values$.id) {
263
- assembleAssociationFieldValue(values, fieldIdDataMap);
264
- //处理子表
265
- for (var _iterator3 = _createForOfIteratorHelperLoose(values), _step3; !(_step3 = _iterator3()).done;) {
266
- var value = _step3.value;
267
- for (var _i = 0, _Object$values = Object.values(value); _i < _Object$values.length; _i++) {
268
- var subValues = _Object$values[_i];
269
- if (Array.isArray(subValues)) {
270
- loopAssembleAssociation(subValues);
271
- }
272
- }
273
- }
274
- }
275
- }
276
- }
277
- loopAssembleAssociation(data);
278
- }
279
- function assembleAssociationFieldValue(data, fieldIdDataMap, prefixKey) {
280
- var arrayData = [];
281
- if (Array.isArray(data)) {
282
- arrayData = data;
283
- } else if (typeof data == "object") {
284
- arrayData = [data];
285
- }
286
- for (var _iterator6 = _createForOfIteratorHelperLoose(arrayData), _step6; !(_step6 = _iterator6()).done;) {
287
- var item = _step6.value;
288
- var _loop = function _loop() {
289
- var fieldIdName = _Object$keys[_i2];
290
- var fieldIdKey = fieldIdName;
291
- if (prefixKey) {
292
- fieldIdKey = prefixKey + "." + fieldIdName;
293
- }
294
- var dataMap = fieldIdDataMap.get(fieldIdKey);
295
- if (dataMap) {
296
- var fieldIdValue = item[fieldIdName];
297
- var fieldValue = null;
298
- if (Array.isArray(fieldIdValue)) {
299
- // @ts-ignore
300
- fieldValue = fieldIdValue.map(function (id) {
301
- return dataMap.get(id);
302
- }).filter(function (v) {
303
- return !!v;
304
- });
305
- } else if (typeof fieldIdValue == "string") {
306
- fieldValue = dataMap.get(fieldIdValue);
229
+ _proto.serviceUpdate = /*#__PURE__*/function () {
230
+ var _serviceUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(data, options) {
231
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
232
+ while (1) switch (_context8.prev = _context8.next) {
233
+ case 0:
234
+ return _context8.abrupt("return", this.request.post("serviceUpdate", data));
235
+ case 1:
236
+ case "end":
237
+ return _context8.stop();
307
238
  }
308
- item[fieldIdName.slice(0, -2)] = fieldValue;
309
- }
310
- };
311
- for (var _i2 = 0, _Object$keys = Object.keys(item); _i2 < _Object$keys.length; _i2++) {
312
- _loop();
239
+ }, _callee8, this);
240
+ }));
241
+ function serviceUpdate(_x12, _x13) {
242
+ return _serviceUpdate.apply(this, arguments);
313
243
  }
314
- }
315
- }
244
+ return serviceUpdate;
245
+ }();
246
+ return RestFormApi;
247
+ }(RestApi);
@@ -0,0 +1,8 @@
1
+ import { BaseType, FilterRule, Refs } from "./rest-api";
2
+ export declare function convertSaveData(data: any): any;
3
+ export declare function assembleAssociationFieldV2(data: BaseType | BaseType[], refs?: Refs): void;
4
+ export declare function assembleAssociationFieldDataV2(data: BaseType | BaseType[], dataMap: Map<string, BaseType>): void;
5
+ export declare function assembleAssociationField(data: BaseType | BaseType[], refs?: Refs): void;
6
+ export declare function handleFilterRules(filters: FilterRule[], options: {
7
+ filterNullValue: boolean;
8
+ }): FilterRule[];
@@ -0,0 +1,199 @@
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
+ function getDataKey(data) {
16
+ var key = data.form.id;
17
+ if (data.form.fieldId) {
18
+ key += "." + data.form.fieldId;
19
+ }
20
+ return key + "." + data.id;
21
+ }
22
+ export function assembleAssociationFieldV2(data, refs) {
23
+ if (!data || !refs) return;
24
+ var dataMap = new Map();
25
+ for (var _iterator = _createForOfIteratorHelperLoose(refs), _step; !(_step = _iterator()).done;) {
26
+ var ref = _step.value;
27
+ for (var _iterator3 = _createForOfIteratorHelperLoose(ref.data), _step3; !(_step3 = _iterator3()).done;) {
28
+ var datum = _step3.value;
29
+ var key = getDataKey(datum);
30
+ dataMap.set(key, datum);
31
+ }
32
+ }
33
+
34
+ //组装refs的关联属性
35
+ for (var _iterator2 = _createForOfIteratorHelperLoose(dataMap.values()), _step2; !(_step2 = _iterator2()).done;) {
36
+ var item = _step2.value;
37
+ for (var _i2 = 0, _Object$keys = Object.keys(item); _i2 < _Object$keys.length; _i2++) {
38
+ var _key = _Object$keys[_i2];
39
+ // @ts-ignore
40
+ var value = item[_key];
41
+ assembleAssociationFieldDataV2(value, dataMap);
42
+ }
43
+ }
44
+ function loopAssembleAssociation(value) {
45
+ if (Array.isArray(value)) {
46
+ value.forEach(function (item) {
47
+ return loopAssembleAssociation(item);
48
+ });
49
+ } else if (value !== null && value !== void 0 && value.id) {
50
+ assembleAssociationFieldDataV2(value, dataMap);
51
+ //处理子表
52
+ for (var _i = 0, _Object$values = Object.values(value); _i < _Object$values.length; _i++) {
53
+ var subValues = _Object$values[_i];
54
+ if (typeof subValues == "object") {
55
+ loopAssembleAssociation(subValues);
56
+ }
57
+ }
58
+ }
59
+ }
60
+ loopAssembleAssociation(data);
61
+ }
62
+ export function assembleAssociationFieldDataV2(data, dataMap) {
63
+ if (data == null) {
64
+ return;
65
+ }
66
+ if (Array.isArray(data)) {
67
+ data.forEach(function (item) {
68
+ return assembleAssociationFieldDataV2(item, dataMap);
69
+ });
70
+ } else {
71
+ var _data$form;
72
+ if (data !== null && data !== void 0 && (_data$form = data.form) !== null && _data$form !== void 0 && _data$form.id && data !== null && data !== void 0 && data.id) {
73
+ delete data._load;
74
+ var key = getDataKey(data);
75
+ var value = dataMap.get(key);
76
+ if (value) {
77
+ Object.assign(data, value);
78
+ delete data._load;
79
+ }
80
+ }
81
+ }
82
+ }
83
+ export function assembleAssociationField(data, refs) {
84
+ assembleAssociationFieldV2(data, refs);
85
+ return;
86
+ if (!data || !refs) return;
87
+ var fieldIdDataMap = new Map();
88
+ for (var _iterator4 = _createForOfIteratorHelperLoose(refs), _step4; !(_step4 = _iterator4()).done;) {
89
+ var ref = _step4.value;
90
+ var dataMap = new Map();
91
+ for (var _iterator7 = _createForOfIteratorHelperLoose(ref.data), _step7; !(_step7 = _iterator7()).done;) {
92
+ var datum = _step7.value;
93
+ dataMap.set(datum.id, datum);
94
+ }
95
+ for (var _iterator8 = _createForOfIteratorHelperLoose(ref.fieldIds), _step8; !(_step8 = _iterator8()).done;) {
96
+ var fieldId = _step8.value;
97
+ fieldIdDataMap.set(fieldId + "Id", dataMap);
98
+ }
99
+ }
100
+ //组装refs的关联属性
101
+ for (var _iterator5 = _createForOfIteratorHelperLoose(refs), _step5; !(_step5 = _iterator5()).done;) {
102
+ var _ref = _step5.value;
103
+ var key = _ref.form.id;
104
+ if (_ref.form.fieldId) {
105
+ key += "." + _ref.form.fieldId;
106
+ }
107
+ assembleAssociationFieldValue(_ref.data, fieldIdDataMap, key);
108
+ }
109
+ function loopAssembleAssociation(values) {
110
+ if (!Array.isArray(values)) {
111
+ if (values !== null && values !== void 0 && values.id) {
112
+ loopAssembleAssociation([values]);
113
+ }
114
+ }
115
+ if (Array.isArray(values)) {
116
+ var _values$;
117
+ if ((_values$ = values[0]) !== null && _values$ !== void 0 && _values$.id) {
118
+ assembleAssociationFieldValue(values, fieldIdDataMap);
119
+ //处理子表
120
+ for (var _iterator6 = _createForOfIteratorHelperLoose(values), _step6; !(_step6 = _iterator6()).done;) {
121
+ var value = _step6.value;
122
+ for (var _i3 = 0, _Object$values2 = Object.values(value); _i3 < _Object$values2.length; _i3++) {
123
+ var subValues = _Object$values2[_i3];
124
+ if (Array.isArray(subValues)) {
125
+ loopAssembleAssociation(subValues);
126
+ }
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }
132
+ loopAssembleAssociation(data);
133
+ }
134
+ function assembleAssociationFieldValue(data, fieldIdDataMap, prefixKey) {
135
+ var arrayData = [];
136
+ if (Array.isArray(data)) {
137
+ arrayData = data;
138
+ } else if (typeof data == "object") {
139
+ arrayData = [data];
140
+ }
141
+ for (var _iterator9 = _createForOfIteratorHelperLoose(arrayData), _step9; !(_step9 = _iterator9()).done;) {
142
+ var item = _step9.value;
143
+ var _loop = function _loop() {
144
+ var fieldIdName = _Object$keys2[_i4];
145
+ var fieldIdKey = fieldIdName;
146
+ if (prefixKey) {
147
+ fieldIdKey = prefixKey + "." + fieldIdName;
148
+ }
149
+ var dataMap = fieldIdDataMap.get(fieldIdKey);
150
+ if (dataMap) {
151
+ var fieldIdValue = item[fieldIdName];
152
+ var fieldValue = null;
153
+ if (Array.isArray(fieldIdValue)) {
154
+ // @ts-ignore
155
+ fieldValue = fieldIdValue.map(function (id) {
156
+ return dataMap.get(id);
157
+ }).filter(function (v) {
158
+ return !!v;
159
+ });
160
+ } else if (typeof fieldIdValue == "string") {
161
+ fieldValue = dataMap.get(fieldIdValue);
162
+ }
163
+ item[fieldIdName.slice(0, -2)] = fieldValue;
164
+ }
165
+ };
166
+ for (var _i4 = 0, _Object$keys2 = Object.keys(item); _i4 < _Object$keys2.length; _i4++) {
167
+ _loop();
168
+ }
169
+ }
170
+ }
171
+ export function handleFilterRules(filters, options) {
172
+ var filterNullValue = options.filterNullValue;
173
+ if (Array.isArray(filters)) {
174
+ var cloneRules = filters.filter(function (rule) {
175
+ return !!rule;
176
+ }).map(function (rule) {
177
+ return _extends({}, rule, {
178
+ value: transformerId(rule.value),
179
+ rules: handleFilterRules(rule.rules || [], options)
180
+ });
181
+ });
182
+ if (filterNullValue) {
183
+ cloneRules = cloneRules.filter(function (rule) {
184
+ if (rule.value == null) {
185
+ if (rule.operator != "isNull" && rule.operator != "isNotNull") {
186
+ return false;
187
+ }
188
+ }
189
+ return true;
190
+ });
191
+ }
192
+ if (cloneRules.length == 0) {
193
+ return undefined;
194
+ }
195
+ return cloneRules;
196
+ } else {
197
+ return undefined;
198
+ }
199
+ }
@@ -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> {
@@ -80,6 +83,12 @@ export interface BaseType {
80
83
  * 修改日期
81
84
  */
82
85
  updated_at: string;
86
+ form: {
87
+ id: string;
88
+ fieldId?: string;
89
+ label: string;
90
+ };
91
+ _load?: boolean;
83
92
  }
84
93
  /**
85
94
  * 基础返回结果