@zhubangyun/lowcode-core 5.10.221 → 5.12.10

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 (69) hide show
  1. package/es/index.less +10 -0
  2. package/es/utils/api/file-api.d.ts +17 -5
  3. package/es/utils/api/file-api.js +10 -7
  4. package/es/utils/api/form-api.js +33 -44
  5. package/es/utils/api/form-api.utils.d.ts +5 -5
  6. package/es/utils/api/form-api.utils.js +55 -36
  7. package/es/utils/api/index.d.ts +4 -3
  8. package/es/utils/api/index.js +9 -2
  9. package/es/utils/api/rest-api.d.ts +6 -5
  10. package/es/utils/api/rest-api.js +1 -1
  11. package/es/utils/api/schema.util.d.ts +14 -0
  12. package/es/utils/api/schema.util.js +32 -0
  13. package/es/utils/api/script-api.js +1 -1
  14. package/es/utils/api/user-info.d.ts +16 -6
  15. package/es/utils/api/user-info.js +31 -20
  16. package/es/utils/cache/index.js +21 -11
  17. package/es/utils/cache/schema.d.ts +0 -2
  18. package/es/utils/cache/schema.js +0 -388
  19. package/es/utils/formIds.d.ts +3 -0
  20. package/es/utils/formIds.js +3 -0
  21. package/es/utils/page/index.d.ts +2 -0
  22. package/es/utils/page/index.js +2 -0
  23. package/es/utils/page/page-form-data-manager-group.d.ts +2 -0
  24. package/es/utils/page/page-form-data-manager-group.js +3 -7
  25. package/es/utils/page/page-form-data-manager.d.ts +2 -1
  26. package/es/utils/page/page-form-data-manager.js +1 -0
  27. package/es/utils/page/page-form-group.d.ts +17 -0
  28. package/es/utils/page/page-form-group.js +97 -0
  29. package/es/utils/page/page-form.d.ts +2 -1
  30. package/es/utils/page/page-form.js +3 -3
  31. package/es/utils/page/page-render.js +1 -2
  32. package/es/utils/page/page-show.d.ts +1 -0
  33. package/es/utils/page/print-form.d.ts +8 -0
  34. package/es/utils/page/print-form.js +147 -0
  35. package/lib/index.less +10 -0
  36. package/lib/utils/api/file-api.d.ts +17 -5
  37. package/lib/utils/api/file-api.js +10 -7
  38. package/lib/utils/api/form-api.js +33 -44
  39. package/lib/utils/api/form-api.utils.d.ts +5 -5
  40. package/lib/utils/api/form-api.utils.js +55 -36
  41. package/lib/utils/api/index.d.ts +4 -3
  42. package/lib/utils/api/index.js +10 -3
  43. package/lib/utils/api/rest-api.d.ts +6 -5
  44. package/lib/utils/api/rest-api.js +1 -1
  45. package/lib/utils/api/schema.util.d.ts +14 -0
  46. package/lib/utils/api/schema.util.js +37 -0
  47. package/lib/utils/api/script-api.js +1 -1
  48. package/lib/utils/api/user-info.d.ts +16 -6
  49. package/lib/utils/api/user-info.js +32 -21
  50. package/lib/utils/cache/index.js +20 -9
  51. package/lib/utils/cache/schema.d.ts +0 -2
  52. package/lib/utils/cache/schema.js +0 -390
  53. package/lib/utils/formIds.d.ts +3 -0
  54. package/lib/utils/formIds.js +7 -0
  55. package/lib/utils/page/index.d.ts +2 -0
  56. package/lib/utils/page/index.js +7 -1
  57. package/lib/utils/page/page-form-data-manager-group.d.ts +2 -0
  58. package/lib/utils/page/page-form-data-manager-group.js +3 -7
  59. package/lib/utils/page/page-form-data-manager.d.ts +2 -1
  60. package/lib/utils/page/page-form-data-manager.js +1 -0
  61. package/lib/utils/page/page-form-group.d.ts +17 -0
  62. package/lib/utils/page/page-form-group.js +104 -0
  63. package/lib/utils/page/page-form.d.ts +2 -1
  64. package/lib/utils/page/page-form.js +3 -3
  65. package/lib/utils/page/page-render.js +1 -2
  66. package/lib/utils/page/page-show.d.ts +1 -0
  67. package/lib/utils/page/print-form.d.ts +8 -0
  68. package/lib/utils/page/print-form.js +153 -0
  69. package/package.json +1 -1
@@ -2,9 +2,8 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import { SingletonInstanceMap } from "../common/SingletonInstanceMap";
5
- import { RestFormApi } from "../api";
6
- import { handleFormSchema } from "./schema";
7
- import { apiRequest } from "../api";
5
+ import { apiRequest, RestFormApi } from "../api";
6
+ import { forEachFormSchema } from "../api/schema.util";
8
7
  export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
9
8
  function SchemaCache() {
10
9
  return _SingletonInstanceMap.apply(this, arguments) || this;
@@ -13,7 +12,7 @@ export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
13
12
  var _proto = SchemaCache.prototype;
14
13
  _proto.createInstance = /*#__PURE__*/function () {
15
14
  var _createInstance = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(key, options) {
16
- var mock, pageId, res;
15
+ var mock, pageId, schemaRes, schema, permissionRes, permission;
17
16
  return _regeneratorRuntime.wrap(function _callee$(_context) {
18
17
  while (1) switch (_context.prev = _context.next) {
19
18
  case 0:
@@ -25,16 +24,27 @@ export var SchemaCache = /*#__PURE__*/function (_SingletonInstanceMap) {
25
24
  }
26
25
  });
27
26
  case 3:
28
- res = _context.sent;
29
- if (!res.success) {
30
- _context.next = 7;
27
+ schemaRes = _context.sent;
28
+ schema = schemaRes.data;
29
+ if (!(typeof schema == "object")) {
30
+ _context.next = 11;
31
31
  break;
32
32
  }
33
- _context.next = 7;
34
- return handleFormSchema(res.data);
35
- case 7:
36
- return _context.abrupt("return", res);
33
+ _context.next = 8;
34
+ return apiRequest.get("pages/" + pageId + "/permission");
37
35
  case 8:
36
+ permissionRes = _context.sent;
37
+ permission = permissionRes.data;
38
+ if (typeof permission == "object") {
39
+ forEachFormSchema(schema, true, function (child) {
40
+ child.props = child.props || {};
41
+ child.props.permission = permission;
42
+ });
43
+ }
44
+ case 11:
45
+ console.log("schemaRes", schemaRes);
46
+ return _context.abrupt("return", schemaRes);
47
+ case 13:
38
48
  case "end":
39
49
  return _context.stop();
40
50
  }
@@ -1,8 +1,6 @@
1
- export declare function handleFormSchema(schema: any): Promise<void>;
2
1
  /**
3
2
  * 遍历schema
4
3
  * @param schema
5
4
  * @param callback 返回true 继续往下遍历
6
5
  */
7
6
  export declare function forEachFormSchema(schema: any, callback: (child: any, index: number, children: any[]) => boolean): void;
8
- export declare function getAdminFormSchema(id: string): Promise<any>;
@@ -1,308 +1,3 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
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
- import utils from "../index";
7
- export function handleFormSchema(_x) {
8
- return _handleFormSchema.apply(this, arguments);
9
- }
10
-
11
- /**
12
- * 处理数据管理关联属性
13
- * @param rootSchema
14
- * @param fdmSchema
15
- */
16
- function _handleFormSchema() {
17
- _handleFormSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(schema) {
18
- var formFieldSchema, fdmItems, fieldIdMap, _i, _fdmItems, fdmField;
19
- return _regeneratorRuntime.wrap(function _callee$(_context) {
20
- while (1) switch (_context.prev = _context.next) {
21
- case 0:
22
- if (!((schema === null || schema === void 0 ? void 0 : schema.componentName) != "Page")) {
23
- _context.next = 2;
24
- break;
25
- }
26
- return _context.abrupt("return");
27
- case 2:
28
- formFieldSchema = new FormFieldSchema(schema.children[0], null);
29
- fdmItems = [];
30
- fieldIdMap = new Map();
31
- schema.state = schema.state || {};
32
- schema.methods = schema.methods || {};
33
- _context.next = 9;
34
- return handleAssociationForm(formFieldSchema, schema);
35
- case 9:
36
- //初次处理
37
- forEachFormSchema(schema, function (field) {
38
- if (field.fdmSchema) {
39
- var _field$fdmSchema, _field$fdmSchema2;
40
- fdmItems.push(field);
41
- field.fdmSchema.props = ((_field$fdmSchema = field.fdmSchema) === null || _field$fdmSchema === void 0 ? void 0 : _field$fdmSchema.props) || {};
42
- field.fdmSchema.props.style = ((_field$fdmSchema2 = field.fdmSchema) === null || _field$fdmSchema2 === void 0 ? void 0 : _field$fdmSchema2.props.style) || {};
43
- field.fdmSchema.props.style.height = "100%";
44
- }
45
- if (field.props.fieldId) {
46
- //删除children防止循环
47
- var copyField = JSON.parse(JSON.stringify(field));
48
- delete copyField.children;
49
- fieldIdMap.set(field.props.fieldId, copyField);
50
- }
51
- return true;
52
- });
53
-
54
- //处理查询列
55
- _i = 0, _fdmItems = fdmItems;
56
- case 11:
57
- if (!(_i < _fdmItems.length)) {
58
- _context.next = 19;
59
- break;
60
- }
61
- fdmField = _fdmItems[_i];
62
- _context.next = 15;
63
- return handleFdmAssociationAttributeFields(formFieldSchema, fdmField.fdmSchema);
64
- case 15:
65
- forEachFormSchema(fdmField.fdmSchema, function (field) {
66
- var _field$props;
67
- var findSchema = fieldIdMap.get((_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.fieldId);
68
- if (findSchema) {
69
- field.componentName = findSchema.componentName;
70
- field.props = Object.assign({}, JSON.parse(JSON.stringify(findSchema.props)), field.props);
71
- //处理子表查询
72
- if (findSchema.componentName == "SubFormField") {
73
- if (findSchema.fdmSchema) {
74
- var subFormFdmSchema = JSON.parse(JSON.stringify(findSchema.fdmSchema));
75
- forEachFormSchema(subFormFdmSchema, function (field) {
76
- if (field.componentName === "PageFdm") {
77
- field.props.layout = "inline";
78
- }
79
- return true;
80
- });
81
- // @ts-ignore
82
- field.props.fdmSchema = subFormFdmSchema;
83
- field.children = subFormFdmSchema.children[0].children;
84
- field.children = field.children.filter(function (item) {
85
- return !item.props.hideInSubTable;
86
- });
87
- //处理子列隐藏
88
- forEachFormSchema(field, function (subField) {
89
- if (Array.isArray(subField.children)) {
90
- subField.children = subField.children.filter(function (item) {
91
- return !item.props.hideInSubTable;
92
- });
93
- }
94
- return true;
95
- });
96
- }
97
- }
98
- }
99
- return true;
100
- });
101
- case 16:
102
- _i++;
103
- _context.next = 11;
104
- break;
105
- case 19:
106
- case "end":
107
- return _context.stop();
108
- }
109
- }, _callee);
110
- }));
111
- return _handleFormSchema.apply(this, arguments);
112
- }
113
- function handleFdmAssociationAttributeFields(_x2, _x3) {
114
- return _handleFdmAssociationAttributeFields.apply(this, arguments);
115
- } //处理关联表单
116
- function _handleFdmAssociationAttributeFields() {
117
- _handleFdmAssociationAttributeFields = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(rootSchema, fdmSchema) {
118
- var associationAttributeFields, _i2, _associationAttribute, _attrField$props, attrField, associationAttribute, cloneSchema;
119
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
120
- while (1) switch (_context2.prev = _context2.next) {
121
- case 0:
122
- //关联属性
123
- associationAttributeFields = [];
124
- forEachFormSchema(fdmSchema, function (field) {
125
- if (field.componentName == "FdmAssociationFieldColumn") {
126
- associationAttributeFields.push(field);
127
- }
128
- return true;
129
- });
130
- _i2 = 0, _associationAttribute = associationAttributeFields;
131
- case 3:
132
- if (!(_i2 < _associationAttribute.length)) {
133
- _context2.next = 13;
134
- break;
135
- }
136
- attrField = _associationAttribute[_i2];
137
- associationAttribute = (_attrField$props = attrField.props) === null || _attrField$props === void 0 ? void 0 : _attrField$props.associationAttribute;
138
- _context2.next = 8;
139
- return cloneAssociationAttributeFieldSchema(rootSchema, associationAttribute);
140
- case 8:
141
- cloneSchema = _context2.sent;
142
- if (cloneSchema) {
143
- //向关联属性中注册 fieldSchema 架构会将 associationAttributeField schema 转换成 jsx
144
- attrField.componentName = cloneSchema.componentName;
145
- attrField.props = Object.assign({}, JSON.parse(JSON.stringify(cloneSchema.props)), attrField.props);
146
- attrField.props.fieldId = associationAttribute.join(".");
147
- }
148
- case 10:
149
- _i2++;
150
- _context2.next = 3;
151
- break;
152
- case 13:
153
- case "end":
154
- return _context2.stop();
155
- }
156
- }, _callee2);
157
- }));
158
- return _handleFdmAssociationAttributeFields.apply(this, arguments);
159
- }
160
- function handleAssociationForm(_x4, _x5) {
161
- return _handleAssociationForm.apply(this, arguments);
162
- }
163
- function _handleAssociationForm() {
164
- _handleAssociationForm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(rootSchema, schema) {
165
- var associationAttributeFields, _i3, _associationAttribute2, _attrField$props2, _attrField$props2$fie, attrField, associationAttribute, cloneSchema;
166
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
167
- while (1) switch (_context3.prev = _context3.next) {
168
- case 0:
169
- //关联属性
170
- associationAttributeFields = []; //关联查询
171
- forEachFormSchema(schema, function (field) {
172
- if (field.componentName == "AssociationAttributeField") {
173
- associationAttributeFields.push(field);
174
- }
175
- return true;
176
- });
177
-
178
- //处理关联属性 赋值schema
179
- _i3 = 0, _associationAttribute2 = associationAttributeFields;
180
- case 3:
181
- if (!(_i3 < _associationAttribute2.length)) {
182
- _context3.next = 13;
183
- break;
184
- }
185
- attrField = _associationAttribute2[_i3];
186
- 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;
187
- _context3.next = 8;
188
- return cloneAssociationAttributeFieldSchema(rootSchema, associationAttribute);
189
- case 8:
190
- cloneSchema = _context3.sent;
191
- if (cloneSchema) {
192
- //向关联属性中注册 fieldSchema 架构会将 associationAttributeField schema 转换成 jsx
193
- attrField.props.fieldProps.associationAttributeField = cloneSchema;
194
- }
195
- case 10:
196
- _i3++;
197
- _context3.next = 3;
198
- break;
199
- case 13:
200
- case "end":
201
- return _context3.stop();
202
- }
203
- }, _callee3);
204
- }));
205
- return _handleAssociationForm.apply(this, arguments);
206
- }
207
- function cloneAssociationAttributeFieldSchema(_x6, _x7) {
208
- return _cloneAssociationAttributeFieldSchema.apply(this, arguments);
209
- }
210
- function _cloneAssociationAttributeFieldSchema() {
211
- _cloneAssociationAttributeFieldSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(rootSchema, associationAttribute) {
212
- var associationFormSchema;
213
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
214
- while (1) switch (_context4.prev = _context4.next) {
215
- case 0:
216
- if (Array.isArray(associationAttribute)) {
217
- _context4.next = 2;
218
- break;
219
- }
220
- return _context4.abrupt("return", null);
221
- case 2:
222
- _context4.next = 4;
223
- return getSchemaByAssociationFieldId(rootSchema, associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[0]);
224
- case 4:
225
- associationFormSchema = _context4.sent;
226
- if (!associationFormSchema) {
227
- _context4.next = 7;
228
- break;
229
- }
230
- return _context4.abrupt("return", findFieldSchema(associationFormSchema, associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[1]));
231
- case 7:
232
- return _context4.abrupt("return", null);
233
- case 8:
234
- case "end":
235
- return _context4.stop();
236
- }
237
- }, _callee4);
238
- }));
239
- return _cloneAssociationAttributeFieldSchema.apply(this, arguments);
240
- }
241
- function getSchemaByAssociationFieldId(_x8, _x9) {
242
- return _getSchemaByAssociationFieldId.apply(this, arguments);
243
- }
244
- /**
245
- * 从schema中查找field
246
- * @param schema
247
- * @param fieldId
248
- */
249
- function _getSchemaByAssociationFieldId() {
250
- _getSchemaByAssociationFieldId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(rootSchema, associationFieldId) {
251
- var lastFieldId, associationFormSchema, _findAssociationField, _findAssociationField2, _findAssociationField3, findAssociationField, formId;
252
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
253
- while (1) switch (_context5.prev = _context5.next) {
254
- case 0:
255
- if (associationFieldId) {
256
- _context5.next = 2;
257
- break;
258
- }
259
- return _context5.abrupt("return", null);
260
- case 2:
261
- lastFieldId = associationFieldId.split(".").pop();
262
- associationFormSchema = null;
263
- if (!(lastFieldId == "parent")) {
264
- _context5.next = 8;
265
- break;
266
- }
267
- associationFormSchema = rootSchema.schema;
268
- _context5.next = 15;
269
- break;
270
- case 8:
271
- findAssociationField = findFieldSchema(rootSchema.schema, lastFieldId);
272
- 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;
273
- if (formId) {
274
- _context5.next = 12;
275
- break;
276
- }
277
- return _context5.abrupt("return", null);
278
- case 12:
279
- _context5.next = 14;
280
- return utils.api.getSchema(formId);
281
- case 14:
282
- associationFormSchema = _context5.sent.data;
283
- case 15:
284
- return _context5.abrupt("return", associationFormSchema);
285
- case 16:
286
- case "end":
287
- return _context5.stop();
288
- }
289
- }, _callee5);
290
- }));
291
- return _getSchemaByAssociationFieldId.apply(this, arguments);
292
- }
293
- function findFieldSchema(schema, fieldId) {
294
- var associationAttributeField = null;
295
- forEachFormSchema(schema, function (field) {
296
- if (field.props.fieldId == fieldId) {
297
- //深拷贝
298
- associationAttributeField = JSON.parse(JSON.stringify(field));
299
- return false;
300
- }
301
- return true;
302
- });
303
- return associationAttributeField;
304
- }
305
-
306
1
  /**
307
2
  * 遍历schema
308
3
  * @param schema
@@ -316,87 +11,4 @@ export function forEachFormSchema(schema, callback) {
316
11
  forEachFormSchema(child, callback);
317
12
  }
318
13
  });
319
- }
320
- var FormFieldSchema = /*#__PURE__*/function () {
321
- function FormFieldSchema(schema, parent) {
322
- var _schema$children2,
323
- _this = this;
324
- this.fieldId = void 0;
325
- this.componentName = void 0;
326
- this.parent = void 0;
327
- this.schema = void 0;
328
- this.children = void 0;
329
- this.schema = schema;
330
- this.parent = parent;
331
- this.children = [];
332
- this.fieldId = schema.props.fieldId;
333
- this.componentName = schema.componentName;
334
- (_schema$children2 = schema.children) === null || _schema$children2 === void 0 ? void 0 : _schema$children2.forEach(function (item) {
335
- _this.children.push(new FormFieldSchema(item, _this));
336
- });
337
- }
338
- var _proto = FormFieldSchema.prototype;
339
- _proto.findFieldById = function findFieldById(fieldId) {
340
- if (this.fieldId == fieldId) {
341
- return this;
342
- }
343
- for (var _iterator = _createForOfIteratorHelperLoose(this.children), _step; !(_step = _iterator()).done;) {
344
- var _child = _step.value;
345
- if (_child.findFieldById(fieldId)) {
346
- return _child.findFieldById(fieldId);
347
- }
348
- }
349
- return null;
350
- };
351
- _proto.getFieldPaths = function getFieldPaths() {
352
- var paths = [];
353
- function loopParent(field) {
354
- if (field !== null && field !== void 0 && field.parent) {
355
- paths.push(field.parent);
356
- loopParent(field.parent);
357
- }
358
- }
359
- loopParent(this);
360
- paths.reverse();
361
- paths = paths.filter(function (item) {
362
- return ["SubFormField"].includes(item.componentName);
363
- });
364
- paths.push(this);
365
- return paths.map(function (item) {
366
- return item.fieldId;
367
- }).join(".");
368
- };
369
- return FormFieldSchema;
370
- }();
371
- export function getAdminFormSchema(_x10) {
372
- return _getAdminFormSchema.apply(this, arguments);
373
- }
374
- function _getAdminFormSchema() {
375
- _getAdminFormSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
376
- var res, schema;
377
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
378
- while (1) switch (_context6.prev = _context6.next) {
379
- case 0:
380
- _context6.next = 2;
381
- return utils.api.getSchema(id, true);
382
- case 2:
383
- res = _context6.sent;
384
- if (!res.success) {
385
- _context6.next = 8;
386
- break;
387
- }
388
- schema = JSON.parse(JSON.stringify(res.data));
389
- _context6.next = 7;
390
- return handleFormSchema(schema);
391
- case 7:
392
- return _context6.abrupt("return", schema);
393
- case 8:
394
- return _context6.abrupt("return", null);
395
- case 9:
396
- case "end":
397
- return _context6.stop();
398
- }
399
- }, _callee6);
400
- }));
401
- return _getAdminFormSchema.apply(this, arguments);
402
14
  }
@@ -0,0 +1,3 @@
1
+ export declare const FormIds: {
2
+ printTemplate: string;
3
+ };
@@ -0,0 +1,3 @@
1
+ export var FormIds = {
2
+ printTemplate: "98cae197-549c-44c1-a3f5-0907f7d2f11b"
3
+ };
@@ -1,4 +1,6 @@
1
+ export { print, getFormPrintTemplates } from "./print-form";
1
2
  export { showForm } from "./page-form";
3
+ export { showFormGroup } from "./page-form-group";
2
4
  export { showFormDataManager } from "./page-form-data-manager";
3
5
  export { showFormDataManagerGroup } from "./page-form-data-manager-group";
4
6
  export { show } from "./page-show";
@@ -1,6 +1,8 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ export { print, getFormPrintTemplates } from "./print-form";
3
4
  export { showForm } from "./page-form";
5
+ export { showFormGroup } from "./page-form-group";
4
6
  export { showFormDataManager } from "./page-form-data-manager";
5
7
  export { showFormDataManagerGroup } from "./page-form-data-manager-group";
6
8
  export { show } from "./page-show";
@@ -4,6 +4,7 @@ export interface ShowFormDataManagerGroupProps {
4
4
  container?: HTMLDivElement;
5
5
  layout?: PageLayoutType;
6
6
  mode?: PageFormDataManagerModeType;
7
+ title?: string;
7
8
  items: any[];
8
9
  extraProps?: any;
9
10
  defaultSelectedRows?: any[];
@@ -13,5 +14,6 @@ export interface ShowFormDataManagerGroupProps {
13
14
  data: any[];
14
15
  total: number;
15
16
  }) => void | Promise<void>;
17
+ pageRef?: (page: any) => void;
16
18
  }
17
19
  export declare function showFormDataManagerGroup(options: ShowFormDataManagerGroupProps): Promise<any | any[]>;
@@ -8,7 +8,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  import { PageLayout } from "./page-layout";
9
9
  import React, { Component } from "react";
10
10
  import { ReactRender } from "../../components/react-render";
11
- import { cloneDataView } from "./page-schema-utils";
12
11
  import { renderElement } from "./page-render";
13
12
  import { v4 } from "uuid";
14
13
  export function showFormDataManagerGroup(_x) {
@@ -72,11 +71,6 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
72
71
  (_self$layoutRef2 = self.layoutRef) === null || _self$layoutRef2 === void 0 ? void 0 : _self$layoutRef2.close();
73
72
  onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(data);
74
73
  };
75
- var fdmItems = (items === null || items === void 0 ? void 0 : items.map(function (item) {
76
- return _extends({}, item, {
77
- dataView: cloneDataView(_this2.props.extraProps, item.dataView)
78
- });
79
- })) || [];
80
74
  return /*#__PURE__*/React.createElement(PageLayout, {
81
75
  layout: layout,
82
76
  ref: function ref(layout) {
@@ -92,9 +86,11 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
92
86
  children: [{
93
87
  componentName: "PageFdmGroup",
94
88
  props: {
89
+ layout: layout,
90
+ title: restProps.title,
95
91
  mode: restProps.mode,
96
92
  defaultSelectedRows: restProps.defaultSelectedRows,
97
- items: fdmItems
93
+ items: items
98
94
  }
99
95
  }]
100
96
  }
@@ -1,6 +1,6 @@
1
1
  import { PageLayoutType } from "./page-layout";
2
2
  import { FilterRule } from "../api/rest-api";
3
- export type PageFormDataManagerModeType = "associationField" | "dataManager" | "selectOne" | "selectMore";
3
+ export type PageFormDataManagerModeType = "associationField" | "dataManager" | "selectOne" | "selectMany";
4
4
  export interface ShowPageFormDataManagerProps {
5
5
  container?: HTMLDivElement;
6
6
  layout?: PageLayoutType;
@@ -21,5 +21,6 @@ export interface ShowPageFormDataManagerProps {
21
21
  data: any[];
22
22
  total: number;
23
23
  }) => void | Promise<void>;
24
+ pageRef?: (page: any) => void;
24
25
  }
25
26
  export declare function showFormDataManager(options: ShowPageFormDataManagerProps): Promise<any | any[]>;
@@ -92,6 +92,7 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
92
92
  return true;
93
93
  });
94
94
  }
95
+ fdmSchema.app = schema.app;
95
96
  return /*#__PURE__*/React.createElement(ReactRender, _extends({}, restProps, {
96
97
  schema: fdmSchema,
97
98
  components: window._components || window.components || window.__components
@@ -0,0 +1,17 @@
1
+ import { PageLayoutType } from "./page-layout";
2
+ import { PageFormModeType } from "./page-form";
3
+ export interface ShowFormGroupProps {
4
+ container?: HTMLDivElement;
5
+ layout?: PageLayoutType;
6
+ form?: {
7
+ id: string;
8
+ fieldId?: string;
9
+ };
10
+ items?: any[];
11
+ mode?: PageFormModeType;
12
+ onSubmitOk?: (data: any) => void;
13
+ onRemoveOk?: () => void;
14
+ onClose?: () => void | Promise<void>;
15
+ pageRef?: (page: any) => void;
16
+ }
17
+ export declare function showFormGroup(options: ShowFormGroupProps): Promise<any>;
@@ -0,0 +1,97 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
+ var _excluded = ["layout", "form", "items", "onClose"],
6
+ _excluded2 = ["container", "onClose"];
7
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
+ import { PageLayout } from "./page-layout";
9
+ import { renderElement } from "./page-render";
10
+ import React, { Component } from "react";
11
+ import { ReactRender } from "../../components/react-render";
12
+ import { v4 } from "uuid";
13
+ import { PageLoadSchema } from "./page-load-schema";
14
+ export function showFormGroup(_x) {
15
+ return _showFormGroup.apply(this, arguments);
16
+ }
17
+ function _showFormGroup() {
18
+ _showFormGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
19
+ var container, onClose, props;
20
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ container = options.container, onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2);
24
+ return _context.abrupt("return", renderElement({
25
+ container: container,
26
+ onClose: onClose,
27
+ element: {
28
+ component: FormGroupRender,
29
+ props: props
30
+ }
31
+ }));
32
+ case 2:
33
+ case "end":
34
+ return _context.stop();
35
+ }
36
+ }, _callee);
37
+ }));
38
+ return _showFormGroup.apply(this, arguments);
39
+ }
40
+ var FormGroupRender = /*#__PURE__*/function (_Component) {
41
+ function FormGroupRender() {
42
+ var _this;
43
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
44
+ args[_key] = arguments[_key];
45
+ }
46
+ _this = _Component.call.apply(_Component, [this].concat(args)) || this;
47
+ _this.layoutRef = void 0;
48
+ return _this;
49
+ }
50
+ _inheritsLoose(FormGroupRender, _Component);
51
+ var _proto = FormGroupRender.prototype;
52
+ _proto.render = function render() {
53
+ var _this2 = this;
54
+ var self = this;
55
+ var _this$props = this.props,
56
+ layout = _this$props.layout,
57
+ form = _this$props.form,
58
+ items = _this$props.items,
59
+ onClose = _this$props.onClose,
60
+ restProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
61
+ // @ts-ignore
62
+ restProps.layout = layout || "modal";
63
+ // @ts-ignore
64
+ restProps.onClose = function () {
65
+ var _self$layoutRef;
66
+ (_self$layoutRef = self.layoutRef) === null || _self$layoutRef === void 0 ? void 0 : _self$layoutRef.close();
67
+ onClose === null || onClose === void 0 ? void 0 : onClose();
68
+ };
69
+ return /*#__PURE__*/React.createElement(PageLayout, {
70
+ layout: layout,
71
+ ref: function ref(layout) {
72
+ return _this2.layoutRef = layout;
73
+ }
74
+ }, /*#__PURE__*/React.createElement(PageLoadSchema, {
75
+ pageId: form === null || form === void 0 ? void 0 : form.id
76
+ }, function (schema) {
77
+ return /*#__PURE__*/React.createElement(ReactRender, _extends({}, restProps, {
78
+ components: window._components || window.components || window.__components,
79
+ schema: {
80
+ id: v4(),
81
+ componentName: "Page",
82
+ props: {},
83
+ state: {},
84
+ children: [{
85
+ componentName: "PageFormGroup",
86
+ props: {
87
+ title: schema.label,
88
+ form: form,
89
+ items: items
90
+ }
91
+ }]
92
+ }
93
+ }));
94
+ }));
95
+ };
96
+ return FormGroupRender;
97
+ }(Component);