@zhubangyun/lowcode-core 5.8.110 → 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.
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
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."); }
@@ -9,32 +8,25 @@ export function handleFormSchema(_x) {
9
8
  return _handleFormSchema.apply(this, arguments);
10
9
  }
11
10
 
12
- //处理关联表单
11
+ /**
12
+ * 处理数据管理关联属性
13
+ * @param rootSchema
14
+ * @param fdmSchema
15
+ */
13
16
  function _handleFormSchema() {
14
17
  _handleFormSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(schema) {
15
- var fdmItems, fieldIdMap;
18
+ var formFieldSchema, fdmItems, fieldIdMap, _i, _fdmItems, fdmField;
16
19
  return _regeneratorRuntime.wrap(function _callee$(_context) {
17
20
  while (1) switch (_context.prev = _context.next) {
18
21
  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:
22
+ formFieldSchema = new FormFieldSchema(schema.children[0], null);
31
23
  fdmItems = [];
32
24
  fieldIdMap = new Map();
33
25
  schema.state = schema.state || {};
34
26
  schema.methods = schema.methods || {};
35
- _context.next = 10;
36
- return handleAssociationForm(schema);
37
- case 10:
27
+ _context.next = 7;
28
+ return handleAssociationForm(formFieldSchema, schema);
29
+ case 7:
38
30
  //初次处理
39
31
  forEachFormSchema(schema, function (field) {
40
32
  if (field.fdmSchema) {
@@ -43,7 +35,6 @@ function _handleFormSchema() {
43
35
  field.fdmSchema.props = ((_field$fdmSchema = field.fdmSchema) === null || _field$fdmSchema === void 0 ? void 0 : _field$fdmSchema.props) || {};
44
36
  field.fdmSchema.props.style = ((_field$fdmSchema2 = field.fdmSchema) === null || _field$fdmSchema2 === void 0 ? void 0 : _field$fdmSchema2.props.style) || {};
45
37
  field.fdmSchema.props.style.height = "100%";
46
- field.fdmSchema.props.label = field.props.label;
47
38
  }
48
39
  if (field.props.fieldId) {
49
40
  //删除children防止循环
@@ -55,33 +46,57 @@ function _handleFormSchema() {
55
46
  });
56
47
 
57
48
  //处理查询列
58
- fdmItems.forEach(function (fdmField) {
59
- forEachFormSchema(fdmField.fdmSchema, function (field) {
60
- var _field$props;
61
- var findSchema = fieldIdMap.get((_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.fieldId);
62
- if (findSchema) {
63
- field.componentName = findSchema.componentName;
64
- field.props = Object.assign({}, JSON.parse(JSON.stringify(findSchema.props)), field.props);
65
- //处理子表查询
66
- if (findSchema.componentName == "SubFormField") {
67
- if (findSchema.fdmSchema) {
68
- var subFormFdmSchema = JSON.parse(JSON.stringify(findSchema.fdmSchema));
69
- forEachFormSchema(subFormFdmSchema, function (field) {
70
- if (field.componentName === "PageFdm") {
71
- field.props.layout = "inline";
72
- }
73
- return true;
74
- });
75
- // @ts-ignore
76
- field.props.fdmSchema = subFormFdmSchema;
77
- field.children = subFormFdmSchema.children[0].children;
78
- }
49
+ _i = 0, _fdmItems = fdmItems;
50
+ case 9:
51
+ if (!(_i < _fdmItems.length)) {
52
+ _context.next = 17;
53
+ break;
54
+ }
55
+ fdmField = _fdmItems[_i];
56
+ _context.next = 13;
57
+ return handleFdmAssociationAttributeFields(formFieldSchema, fdmField.fdmSchema);
58
+ case 13:
59
+ forEachFormSchema(fdmField.fdmSchema, function (field) {
60
+ var _field$props;
61
+ var findSchema = fieldIdMap.get((_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.fieldId);
62
+ if (findSchema) {
63
+ field.componentName = findSchema.componentName;
64
+ field.props = Object.assign({}, JSON.parse(JSON.stringify(findSchema.props)), field.props);
65
+ //处理子表查询
66
+ if (findSchema.componentName == "SubFormField") {
67
+ if (findSchema.fdmSchema) {
68
+ var subFormFdmSchema = JSON.parse(JSON.stringify(findSchema.fdmSchema));
69
+ forEachFormSchema(subFormFdmSchema, function (field) {
70
+ if (field.componentName === "PageFdm") {
71
+ field.props.layout = "inline";
72
+ }
73
+ return true;
74
+ });
75
+ // @ts-ignore
76
+ field.props.fdmSchema = subFormFdmSchema;
77
+ field.children = subFormFdmSchema.children[0].children;
78
+ field.children = field.children.filter(function (item) {
79
+ return !item.props.hideInSubTable;
80
+ });
81
+ //处理子列隐藏
82
+ forEachFormSchema(field, function (subField) {
83
+ if (Array.isArray(subField.children)) {
84
+ subField.children = subField.children.filter(function (item) {
85
+ return !item.props.hideInSubTable;
86
+ });
87
+ }
88
+ return true;
89
+ });
79
90
  }
80
91
  }
81
- return true;
82
- });
92
+ }
93
+ return true;
83
94
  });
84
- case 12:
95
+ case 14:
96
+ _i++;
97
+ _context.next = 9;
98
+ break;
99
+ case 17:
85
100
  case "end":
86
101
  return _context.stop();
87
102
  }
@@ -89,159 +104,204 @@ function _handleFormSchema() {
89
104
  }));
90
105
  return _handleFormSchema.apply(this, arguments);
91
106
  }
92
- function handleAssociationForm(_x2) {
107
+ function handleFdmAssociationAttributeFields(_x2, _x3) {
108
+ return _handleFdmAssociationAttributeFields.apply(this, arguments);
109
+ } //处理关联表单
110
+ function _handleFdmAssociationAttributeFields() {
111
+ _handleFdmAssociationAttributeFields = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(rootSchema, fdmSchema) {
112
+ var associationAttributeFields, _i2, _associationAttribute, _attrField$props, attrField, associationAttribute, cloneSchema;
113
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
114
+ while (1) switch (_context2.prev = _context2.next) {
115
+ case 0:
116
+ //关联属性
117
+ associationAttributeFields = [];
118
+ forEachFormSchema(fdmSchema, function (field) {
119
+ if (field.componentName == "FdmAssociationFieldColumn") {
120
+ associationAttributeFields.push(field);
121
+ }
122
+ return true;
123
+ });
124
+ _i2 = 0, _associationAttribute = associationAttributeFields;
125
+ case 3:
126
+ if (!(_i2 < _associationAttribute.length)) {
127
+ _context2.next = 13;
128
+ break;
129
+ }
130
+ attrField = _associationAttribute[_i2];
131
+ associationAttribute = (_attrField$props = attrField.props) === null || _attrField$props === void 0 ? void 0 : _attrField$props.associationAttribute;
132
+ _context2.next = 8;
133
+ return cloneAssociationAttributeFieldSchema(rootSchema, associationAttribute);
134
+ case 8:
135
+ cloneSchema = _context2.sent;
136
+ if (cloneSchema) {
137
+ //向关联属性中注册 fieldSchema 架构会将 associationAttributeField schema 转换成 jsx
138
+ attrField.componentName = cloneSchema.componentName;
139
+ attrField.props = Object.assign({}, JSON.parse(JSON.stringify(cloneSchema.props)), attrField.props);
140
+ attrField.props.fieldId = associationAttribute.join(".");
141
+ }
142
+ case 10:
143
+ _i2++;
144
+ _context2.next = 3;
145
+ break;
146
+ case 13:
147
+ case "end":
148
+ return _context2.stop();
149
+ }
150
+ }, _callee2);
151
+ }));
152
+ return _handleFdmAssociationAttributeFields.apply(this, arguments);
153
+ }
154
+ function handleAssociationForm(_x4, _x5) {
93
155
  return _handleAssociationForm.apply(this, arguments);
94
156
  }
95
- /**
96
- * 遍历schema
97
- * @param schema
98
- * @param callback 返回true 继续往下遍历
99
- */
100
157
  function _handleAssociationForm() {
101
- _handleAssociationForm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(schema) {
102
- var rootSchema, associationFields, associationAttributeFields, schemaMap, getSchema, _getSchema, _loop, _ret, _i, _associationAttribute;
103
- return _regeneratorRuntime.wrap(function _callee3$(_context4) {
104
- while (1) switch (_context4.prev = _context4.next) {
158
+ _handleAssociationForm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(rootSchema, schema) {
159
+ var associationAttributeFields, _i3, _associationAttribute2, _attrField$props2, _attrField$props2$fie, attrField, associationAttribute, cloneSchema;
160
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
161
+ while (1) switch (_context3.prev = _context3.next) {
105
162
  case 0:
106
- _getSchema = function _getSchema3() {
107
- _getSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id) {
108
- var res;
109
- return _regeneratorRuntime.wrap(function _callee2$(_context3) {
110
- while (1) switch (_context3.prev = _context3.next) {
111
- case 0:
112
- if (!schemaMap[id]) {
113
- _context3.next = 2;
114
- break;
115
- }
116
- return _context3.abrupt("return", schemaMap[id]);
117
- case 2:
118
- _context3.next = 4;
119
- return utils.api.getSchema(id);
120
- case 4:
121
- res = _context3.sent;
122
- schemaMap[id] = res.data;
123
- return _context3.abrupt("return", schemaMap[id]);
124
- case 7:
125
- case "end":
126
- return _context3.stop();
127
- }
128
- }, _callee2);
129
- }));
130
- return _getSchema.apply(this, arguments);
131
- };
132
- getSchema = function _getSchema2(_x3) {
133
- return _getSchema.apply(this, arguments);
134
- };
135
- //跟schema
136
- rootSchema = new FormFieldSchema(schema.children[0], null); //关联表单单选
137
- associationFields = []; //关联属性
138
- associationAttributeFields = [];
163
+ //关联属性
164
+ associationAttributeFields = []; //关联查询
139
165
  forEachFormSchema(schema, function (field) {
140
- if (field.componentName == "AssociationField") {
141
- associationFields.push(field);
142
- }
143
166
  if (field.componentName == "AssociationAttributeField") {
144
167
  associationAttributeFields.push(field);
145
168
  }
146
169
  return true;
147
170
  });
148
- //处理关联属性schema
149
- schemaMap = {};
150
- schemaMap[schema.id] = schema;
151
-
152
- //从缓存中获取schema
153
171
 
154
172
  //处理关联属性 赋值schema
155
- _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
156
- var _attrField$props, _attrField$props$fiel, _findField$props, _findField$props$fiel;
157
- var attrField, associationAttribute, findField, associationForm, associationFormSchema, associationAttributeField, field, associationField, depth1, depth2;
158
- return _regeneratorRuntime.wrap(function _loop$(_context2) {
159
- while (1) switch (_context2.prev = _context2.next) {
160
- case 0:
161
- attrField = _associationAttribute[_i];
162
- associationAttribute = (_attrField$props = attrField.props) === null || _attrField$props === void 0 ? void 0 : (_attrField$props$fiel = _attrField$props.fieldProps) === null || _attrField$props$fiel === void 0 ? void 0 : _attrField$props$fiel.associationAttribute;
163
- if (associationAttribute) {
164
- _context2.next = 4;
165
- break;
166
- }
167
- return _context2.abrupt("return", {
168
- v: void 0
169
- });
170
- case 4:
171
- findField = associationFields.find(function (assi) {
172
- return assi.props.fieldId == (associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[0]);
173
- });
174
- associationForm = findField === null || findField === void 0 ? void 0 : (_findField$props = findField.props) === null || _findField$props === void 0 ? void 0 : (_findField$props$fiel = _findField$props.fieldProps) === null || _findField$props$fiel === void 0 ? void 0 : _findField$props$fiel.associationForm;
175
- if (associationForm) {
176
- _context2.next = 8;
177
- break;
178
- }
179
- return _context2.abrupt("return", {
180
- v: void 0
181
- });
182
- case 8:
183
- _context2.next = 10;
184
- return getSchema(associationForm.id);
185
- case 10:
186
- associationFormSchema = _context2.sent;
187
- //向关联属性中注册 schema 开始
188
- associationAttributeField = null;
189
- forEachFormSchema(associationFormSchema, function (field) {
190
- if (field.props.fieldId == (associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[1])) {
191
- associationAttributeField = _extends({}, field);
192
- return false;
193
- }
194
- return true;
195
- });
196
- attrField.props.fieldProps.associationAttributeField = associationAttributeField;
197
- //向关联属性中注册 schema 结束
198
- //向关联表单中注册关联属性填充 开始
199
- findField.props.fieldProps.associationAttributes = findField.props.fieldProps.associationAttributes || [];
200
- field = rootSchema.findFieldById(attrField.props.fieldId);
201
- associationField = rootSchema.findFieldById(associationAttribute[0]);
202
- if (field && associationField) {
203
- depth1 = field.getFieldPaths().split(".").length;
204
- depth2 = associationField.getFieldPaths().split(".").length;
205
- attrField.props.fieldProps.associationDepth = depth1 - depth2;
206
- findField.props.fieldProps.associationAttributes.push({
207
- key: field.getFieldPaths(),
208
- value: associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[1]
209
- });
210
- //向关联表单中注册关联属性填充 结束
211
- }
212
- //设置关联属性默认值 结束
213
- case 18:
214
- case "end":
215
- return _context2.stop();
216
- }
217
- }, _loop);
218
- });
219
- _i = 0, _associationAttribute = associationAttributeFields;
220
- case 10:
221
- if (!(_i < _associationAttribute.length)) {
222
- _context4.next = 18;
173
+ _i3 = 0, _associationAttribute2 = associationAttributeFields;
174
+ case 3:
175
+ if (!(_i3 < _associationAttribute2.length)) {
176
+ _context3.next = 13;
223
177
  break;
224
178
  }
225
- return _context4.delegateYield(_loop(), "t0", 12);
226
- case 12:
227
- _ret = _context4.t0;
228
- if (!_ret) {
229
- _context4.next = 15;
230
- break;
179
+ attrField = _associationAttribute2[_i3];
180
+ associationAttribute = (_attrField$props2 = attrField.props) === null || _attrField$props2 === void 0 ? void 0 : (_attrField$props2$fie = _attrField$props2.fieldProps) === null || _attrField$props2$fie === void 0 ? void 0 : _attrField$props2$fie.associationAttribute;
181
+ _context3.next = 8;
182
+ return cloneAssociationAttributeFieldSchema(rootSchema, associationAttribute);
183
+ case 8:
184
+ cloneSchema = _context3.sent;
185
+ if (cloneSchema) {
186
+ //向关联属性中注册 fieldSchema 架构会将 associationAttributeField schema 转换成 jsx
187
+ attrField.props.fieldProps.associationAttributeField = cloneSchema;
231
188
  }
232
- return _context4.abrupt("return", _ret.v);
233
- case 15:
234
- _i++;
235
- _context4.next = 10;
189
+ case 10:
190
+ _i3++;
191
+ _context3.next = 3;
236
192
  break;
237
- case 18:
193
+ case 13:
238
194
  case "end":
239
- return _context4.stop();
195
+ return _context3.stop();
240
196
  }
241
197
  }, _callee3);
242
198
  }));
243
199
  return _handleAssociationForm.apply(this, arguments);
244
200
  }
201
+ function cloneAssociationAttributeFieldSchema(_x6, _x7) {
202
+ return _cloneAssociationAttributeFieldSchema.apply(this, arguments);
203
+ }
204
+ function _cloneAssociationAttributeFieldSchema() {
205
+ _cloneAssociationAttributeFieldSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(rootSchema, associationAttribute) {
206
+ var associationFormSchema;
207
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
208
+ while (1) switch (_context4.prev = _context4.next) {
209
+ case 0:
210
+ if (Array.isArray(associationAttribute)) {
211
+ _context4.next = 2;
212
+ break;
213
+ }
214
+ return _context4.abrupt("return", null);
215
+ case 2:
216
+ _context4.next = 4;
217
+ return getSchemaByAssociationFieldId(rootSchema, associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[0]);
218
+ case 4:
219
+ associationFormSchema = _context4.sent;
220
+ if (!associationFormSchema) {
221
+ _context4.next = 7;
222
+ break;
223
+ }
224
+ return _context4.abrupt("return", findFieldSchema(associationFormSchema, associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[1]));
225
+ case 7:
226
+ return _context4.abrupt("return", null);
227
+ case 8:
228
+ case "end":
229
+ return _context4.stop();
230
+ }
231
+ }, _callee4);
232
+ }));
233
+ return _cloneAssociationAttributeFieldSchema.apply(this, arguments);
234
+ }
235
+ function getSchemaByAssociationFieldId(_x8, _x9) {
236
+ return _getSchemaByAssociationFieldId.apply(this, arguments);
237
+ }
238
+ /**
239
+ * 从schema中查找field
240
+ * @param schema
241
+ * @param fieldId
242
+ */
243
+ function _getSchemaByAssociationFieldId() {
244
+ _getSchemaByAssociationFieldId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(rootSchema, associationFieldId) {
245
+ var lastFieldId, associationFormSchema, _findAssociationField, _findAssociationField2, _findAssociationField3, findAssociationField, formId;
246
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
247
+ while (1) switch (_context5.prev = _context5.next) {
248
+ case 0:
249
+ if (associationFieldId) {
250
+ _context5.next = 2;
251
+ break;
252
+ }
253
+ return _context5.abrupt("return", null);
254
+ case 2:
255
+ lastFieldId = associationFieldId.split(".").pop();
256
+ associationFormSchema = null;
257
+ if (!(lastFieldId == "parent")) {
258
+ _context5.next = 8;
259
+ break;
260
+ }
261
+ associationFormSchema = rootSchema.schema;
262
+ _context5.next = 15;
263
+ break;
264
+ case 8:
265
+ findAssociationField = findFieldSchema(rootSchema.schema, lastFieldId);
266
+ formId = findAssociationField === null || findAssociationField === void 0 ? void 0 : (_findAssociationField = findAssociationField.props) === null || _findAssociationField === void 0 ? void 0 : (_findAssociationField2 = _findAssociationField.fieldProps) === null || _findAssociationField2 === void 0 ? void 0 : (_findAssociationField3 = _findAssociationField2.associationForm) === null || _findAssociationField3 === void 0 ? void 0 : _findAssociationField3.id;
267
+ if (formId) {
268
+ _context5.next = 12;
269
+ break;
270
+ }
271
+ return _context5.abrupt("return", null);
272
+ case 12:
273
+ _context5.next = 14;
274
+ return utils.api.getSchema(formId);
275
+ case 14:
276
+ associationFormSchema = _context5.sent.data;
277
+ case 15:
278
+ return _context5.abrupt("return", associationFormSchema);
279
+ case 16:
280
+ case "end":
281
+ return _context5.stop();
282
+ }
283
+ }, _callee5);
284
+ }));
285
+ return _getSchemaByAssociationFieldId.apply(this, arguments);
286
+ }
287
+ function findFieldSchema(schema, fieldId) {
288
+ var associationAttributeField = null;
289
+ forEachFormSchema(schema, function (field) {
290
+ if (field.props.fieldId == fieldId) {
291
+ //深拷贝
292
+ associationAttributeField = JSON.parse(JSON.stringify(field));
293
+ return false;
294
+ }
295
+ return true;
296
+ });
297
+ return associationAttributeField;
298
+ }
299
+
300
+ /**
301
+ * 遍历schema
302
+ * @param schema
303
+ * @param callback 返回true 继续往下遍历
304
+ */
245
305
  export function forEachFormSchema(schema, callback) {
246
306
  var _schema$children;
247
307
  schema === null || schema === void 0 ? void 0 : (_schema$children = schema.children) === null || _schema$children === void 0 ? void 0 : _schema$children.forEach(function (child, index, children) {
@@ -301,4 +361,36 @@ var FormFieldSchema = /*#__PURE__*/function () {
301
361
  }).join(".");
302
362
  };
303
363
  return FormFieldSchema;
304
- }();
364
+ }();
365
+ export function getAdminFormSchema(_x10) {
366
+ return _getAdminFormSchema.apply(this, arguments);
367
+ }
368
+ function _getAdminFormSchema() {
369
+ _getAdminFormSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
370
+ var res, schema;
371
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
372
+ while (1) switch (_context6.prev = _context6.next) {
373
+ case 0:
374
+ _context6.next = 2;
375
+ return utils.api.getSchema(id, true);
376
+ case 2:
377
+ res = _context6.sent;
378
+ if (!res.success) {
379
+ _context6.next = 8;
380
+ break;
381
+ }
382
+ schema = JSON.parse(JSON.stringify(res.data));
383
+ _context6.next = 7;
384
+ return handleFormSchema(schema);
385
+ case 7:
386
+ return _context6.abrupt("return", schema);
387
+ case 8:
388
+ return _context6.abrupt("return", null);
389
+ case 9:
390
+ case "end":
391
+ return _context6.stop();
392
+ }
393
+ }, _callee6);
394
+ }));
395
+ return _getAdminFormSchema.apply(this, arguments);
396
+ }
@@ -61,7 +61,7 @@ function _loadMaterials() {
61
61
  }
62
62
  return _context2.abrupt("return");
63
63
  case 3:
64
- 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"];
64
+ 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"];
65
65
  _context2.next = 6;
66
66
  return (0, _common.loadPlugins)(urls.map(function (url) {
67
67
  return "https://cdn.zhiyunhe.com/plugin/" + url;
package/lib/style.js CHANGED
@@ -1,3 +1,4 @@
1
+ require('antd/lib/typography/style');
1
2
  require('antd/lib/notification/style');
2
3
  require('antd/lib/modal/style');
3
4
  require('antd/lib/message/style');
@@ -9,7 +9,7 @@ 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>>;
@@ -28,7 +28,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
28
28
  _proto.initialize = /*#__PURE__*/function () {
29
29
  var _initialize = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
30
30
  var _this2 = this;
31
- var _this$schema$props, res;
31
+ var _this$schema$children, _this$schema$children2, res;
32
32
  return _regenerator["default"].wrap(function _callee$(_context) {
33
33
  while (1) switch (_context.prev = _context.next) {
34
34
  case 0:
@@ -45,7 +45,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
45
45
  res = _context.sent;
46
46
  this.schema = res.data;
47
47
  this.initialized = !!this.schema;
48
- this.title = (_this$schema$props = this.schema.props) === null || _this$schema$props === void 0 ? void 0 : _this$schema$props.label;
48
+ 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;
49
49
  if (this.fieldId) {
50
50
  JSON.stringify(this.schema, function (key, value) {
51
51
  var _value$props;
@@ -113,13 +113,13 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
113
113
  return handleRequestConfig;
114
114
  }();
115
115
  _proto.search = /*#__PURE__*/function () {
116
- var _search = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(params) {
117
- var _params, _params2;
118
- var config, res;
116
+ var _search = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(searchParams) {
117
+ var _searchParams, _searchParams2;
118
+ var config, res, start;
119
119
  return _regenerator["default"].wrap(function _callee3$(_context3) {
120
120
  while (1) switch (_context3.prev = _context3.next) {
121
121
  case 0:
122
- params = params || {};
122
+ searchParams = searchParams || {};
123
123
  config = {
124
124
  params: {
125
125
  description: this.title + "\u67E5\u8BE2",
@@ -130,19 +130,21 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
130
130
  _context3.next = 4;
131
131
  return this.handleRequestConfig(config);
132
132
  case 4:
133
- params.filterRules = (0, _formApi.handleFilterRules)(((_params = params) === null || _params === void 0 ? void 0 : _params.filterRules) || [], {
133
+ searchParams.filterRules = (0, _formApi.handleFilterRules)(((_searchParams = searchParams) === null || _searchParams === void 0 ? void 0 : _searchParams.filterRules) || [], {
134
134
  filterNullValue: false
135
135
  });
136
- params.searchFields = (0, _formApi.handleFilterRules)(((_params2 = params) === null || _params2 === void 0 ? void 0 : _params2.searchFields) || [], {
136
+ searchParams.searchFields = (0, _formApi.handleFilterRules)(((_searchParams2 = searchParams) === null || _searchParams2 === void 0 ? void 0 : _searchParams2.searchFields) || [], {
137
137
  filterNullValue: true
138
138
  });
139
139
  _context3.next = 8;
140
- return this.request.post("search", params, config);
140
+ return this.request.post("search", searchParams, config);
141
141
  case 8:
142
142
  res = _context3.sent;
143
+ start = Date.now();
143
144
  (0, _formApi.assembleAssociationField)(res.data, res.refs);
145
+ console.debug("form.search:" + (Date.now() - start), res);
144
146
  return _context3.abrupt("return", res);
145
- case 11:
147
+ case 13:
146
148
  case "end":
147
149
  return _context3.stop();
148
150
  }
@@ -155,7 +157,7 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
155
157
  }();
156
158
  _proto.getById = /*#__PURE__*/function () {
157
159
  var _getById = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(id, options) {
158
- var res;
160
+ var res, start;
159
161
  return _regenerator["default"].wrap(function _callee4$(_context4) {
160
162
  while (1) switch (_context4.prev = _context4.next) {
161
163
  case 0:
@@ -163,10 +165,11 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
163
165
  return _RestApi.prototype.getById.call(this, id, options);
164
166
  case 2:
165
167
  res = _context4.sent;
168
+ start = Date.now();
166
169
  (0, _formApi.assembleAssociationField)(res.data, res.refs);
167
- console.debug("formApi.getById", res);
170
+ console.debug("formApi.getById" + (Date.now() - start), res);
168
171
  return _context4.abrupt("return", res);
169
- case 6:
172
+ case 7:
170
173
  case "end":
171
174
  return _context4.stop();
172
175
  }
@@ -1,7 +1,8 @@
1
1
  import { BaseType, FilterRule, Refs } from "./rest-api";
2
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;
3
5
  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
6
  export declare function handleFilterRules(filters: FilterRule[], options: {
6
7
  filterNullValue: boolean;
7
- }): any;
8
+ }): FilterRule[];