@zhubangyun/lowcode-core 5.8.290 → 5.10.81

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.js +1 -0
  2. package/es/utils/api/file-api.d.ts +7 -0
  3. package/es/utils/api/file-api.js +86 -0
  4. package/es/utils/api/form-api.d.ts +1 -0
  5. package/es/utils/api/form-api.js +66 -27
  6. package/es/utils/api/form-api.utils.d.ts +2 -0
  7. package/es/utils/api/form-api.utils.js +82 -113
  8. package/es/utils/api/index.d.ts +5 -5
  9. package/es/utils/api/index.js +7 -67
  10. package/es/utils/api/rest-api.d.ts +6 -2
  11. package/es/utils/api/rest-api.js +64 -34
  12. package/es/utils/api/schema-api.d.ts +2 -0
  13. package/es/utils/api/schema-api.js +33 -0
  14. package/es/utils/api/script-api.d.ts +1 -0
  15. package/es/utils/api/script-api.js +41 -0
  16. package/es/utils/cache/schema.js +15 -9
  17. package/es/utils/common/LoadPlugins.js +9 -16
  18. package/es/utils/common/index.d.ts +1 -0
  19. package/es/utils/common/index.js +12 -0
  20. package/es/utils/page/index.d.ts +1 -0
  21. package/es/utils/page/index.js +1 -0
  22. package/es/utils/page/page-form-data-manager-group.d.ts +17 -0
  23. package/es/utils/page/page-form-data-manager-group.js +104 -0
  24. package/es/utils/page/page-form-data-manager.d.ts +6 -0
  25. package/es/utils/page/page-form-data-manager.js +24 -79
  26. package/es/utils/page/page-form.d.ts +1 -1
  27. package/es/utils/page/page-form.js +24 -47
  28. package/es/utils/page/page-layout.js +1 -1
  29. package/es/utils/page/page-render.d.ts +10 -0
  30. package/es/utils/page/page-render.js +51 -0
  31. package/es/utils/page/page-schema-utils.d.ts +1 -0
  32. package/es/utils/page/page-schema-utils.js +74 -0
  33. package/lib/index.js +2 -0
  34. package/lib/utils/api/file-api.d.ts +7 -0
  35. package/lib/utils/api/file-api.js +92 -0
  36. package/lib/utils/api/form-api.d.ts +1 -0
  37. package/lib/utils/api/form-api.js +67 -27
  38. package/lib/utils/api/form-api.utils.d.ts +2 -0
  39. package/lib/utils/api/form-api.utils.js +84 -113
  40. package/lib/utils/api/index.d.ts +5 -5
  41. package/lib/utils/api/index.js +14 -72
  42. package/lib/utils/api/rest-api.d.ts +6 -2
  43. package/lib/utils/api/rest-api.js +64 -34
  44. package/lib/utils/api/schema-api.d.ts +2 -0
  45. package/lib/utils/api/schema-api.js +38 -0
  46. package/lib/utils/api/script-api.d.ts +1 -0
  47. package/lib/utils/api/script-api.js +46 -0
  48. package/lib/utils/cache/schema.js +15 -9
  49. package/lib/utils/common/LoadPlugins.js +9 -16
  50. package/lib/utils/common/index.d.ts +1 -0
  51. package/lib/utils/common/index.js +13 -0
  52. package/lib/utils/page/index.d.ts +1 -0
  53. package/lib/utils/page/index.js +3 -1
  54. package/lib/utils/page/page-form-data-manager-group.d.ts +17 -0
  55. package/lib/utils/page/page-form-data-manager-group.js +111 -0
  56. package/lib/utils/page/page-form-data-manager.d.ts +6 -0
  57. package/lib/utils/page/page-form-data-manager.js +24 -79
  58. package/lib/utils/page/page-form.d.ts +1 -1
  59. package/lib/utils/page/page-form.js +24 -47
  60. package/lib/utils/page/page-layout.js +1 -1
  61. package/lib/utils/page/page-render.d.ts +10 -0
  62. package/lib/utils/page/page-render.js +56 -0
  63. package/lib/utils/page/page-schema-utils.d.ts +1 -0
  64. package/lib/utils/page/page-schema-utils.js +79 -0
  65. package/package.json +1 -1
  66. package/es/utils/common/FormDataHandler.d.ts +0 -45
  67. package/es/utils/common/FormDataHandler.js +0 -410
  68. package/lib/utils/common/FormDataHandler.d.ts +0 -45
  69. package/lib/utils/common/FormDataHandler.js +0 -416
@@ -1,4 +1,5 @@
1
1
  import { AxiosInstance, AxiosRequestConfig } from "axios";
2
+ export declare type ValueType = "value" | "field" | "express";
2
3
  export interface RestApiOptions {
3
4
  /**
4
5
  * 超时时间
@@ -12,9 +13,10 @@ export interface RestApiOptions {
12
13
  }
13
14
  export interface FilterRule {
14
15
  connector?: "and" | "or";
15
- key: string;
16
+ key?: string;
16
17
  operator?: OperatorType;
17
- value: any;
18
+ valueType?: ValueType;
19
+ value?: any;
18
20
  rules?: FilterRule[];
19
21
  }
20
22
  export declare type OperatorType = "eq" | "ne" | "gt" | "goe" | "lt" | "loe" | "like" | "notLike" | "in" | "notIn" | "isNull" | "isNotNull" | "between" | "notBetween";
@@ -87,6 +89,7 @@ export interface BaseType {
87
89
  id: string;
88
90
  fieldId?: string;
89
91
  label: string;
92
+ labelField: string;
90
93
  };
91
94
  _load?: boolean;
92
95
  }
@@ -95,6 +98,7 @@ export interface BaseType {
95
98
  */
96
99
  export interface BaseResult<DataType> {
97
100
  success: boolean;
101
+ requestId?: string;
98
102
  message?: string;
99
103
  refs?: Refs;
100
104
  }
@@ -8,6 +8,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
8
  import axios from "axios";
9
9
  import { onFulfilled, onRejected } from "./index";
10
10
  import { transformerId } from "../data";
11
+ import { showForm } from "../page";
11
12
  export var BaseRestApi = /*#__PURE__*/function () {
12
13
  function BaseRestApi(uri, options) {
13
14
  this.uri = void 0;
@@ -84,7 +85,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
84
85
  _context2.next = 12;
85
86
  break;
86
87
  }
87
- this.showError("\u83B7\u53D6{" + id + "}\u5931\u8D25!", res.message).then();
88
+ this.showError("\u83B7\u53D6{" + id + "}\u5931\u8D25!", res).then();
88
89
  _context2.next = 10;
89
90
  return options === null || options === void 0 ? void 0 : (_options$onError = options.onError) === null || _options$onError === void 0 ? void 0 : _options$onError.call(options, res);
90
91
  case 10:
@@ -125,7 +126,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
125
126
  _context3.next = 12;
126
127
  break;
127
128
  }
128
- this.showError("\u63D0\u4EA4\u5931\u8D25!", res.message).then();
129
+ this.showError("\u63D0\u4EA4\u5931\u8D25!", res).then();
129
130
  _context3.next = 10;
130
131
  return options === null || options === void 0 ? void 0 : (_options$onError2 = options.onError) === null || _options$onError2 === void 0 ? void 0 : _options$onError2.call(options, res);
131
132
  case 10:
@@ -172,7 +173,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
172
173
  _context4.next = 12;
173
174
  break;
174
175
  }
175
- this.showError("\u65B0\u589E\u5931\u8D25!", res.message).then();
176
+ this.showError("\u65B0\u589E\u5931\u8D25!", res).then();
176
177
  _context4.next = 10;
177
178
  return options === null || options === void 0 ? void 0 : (_options$onError3 = options.onError) === null || _options$onError3 === void 0 ? void 0 : _options$onError3.call(options, res);
178
179
  case 10:
@@ -219,7 +220,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
219
220
  _context5.next = 12;
220
221
  break;
221
222
  }
222
- this.showError("\u66F4\u65B0\u5931\u8D25!", res.message).then();
223
+ this.showError("\u66F4\u65B0\u5931\u8D25!", res).then();
223
224
  _context5.next = 10;
224
225
  return options === null || options === void 0 ? void 0 : (_options$onError4 = options.onError) === null || _options$onError4 === void 0 ? void 0 : _options$onError4.call(options, res);
225
226
  case 10:
@@ -266,7 +267,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
266
267
  _context6.next = 12;
267
268
  break;
268
269
  }
269
- this.showError("\u5220\u9664{" + id + "}\u5931\u8D25!", res.message).then();
270
+ this.showError("\u5220\u9664{" + id + "}\u5931\u8D25!", res).then();
270
271
  _context6.next = 10;
271
272
  return options === null || options === void 0 ? void 0 : (_options$onError5 = options.onError) === null || _options$onError5 === void 0 ? void 0 : _options$onError5.call(options, res);
272
273
  case 10:
@@ -323,7 +324,7 @@ export var BaseRestApi = /*#__PURE__*/function () {
323
324
  _context7.next = 18;
324
325
  break;
325
326
  }
326
- this.showError("\u5220\u9664\u5931\u8D25!", res.message).then();
327
+ this.showError("\u5220\u9664\u5931\u8D25!", res).then();
327
328
  _context7.next = 16;
328
329
  return options === null || options === void 0 ? void 0 : (_options$onError6 = options.onError) === null || _options$onError6 === void 0 ? void 0 : _options$onError6.call(options, res);
329
330
  case 16:
@@ -344,62 +345,72 @@ export var BaseRestApi = /*#__PURE__*/function () {
344
345
  return _delete2.apply(this, arguments);
345
346
  }
346
347
  return _delete;
347
- }();
348
- _proto.showError = /*#__PURE__*/function () {
349
- var _showError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(type, msg) {
350
- var props;
348
+ }() // @ts-ignore
349
+ ;
350
+ _proto.showError =
351
+ /*#__PURE__*/
352
+ function () {
353
+ var _showError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(type, res) {
354
+ var msg, props, content;
351
355
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
352
356
  while (1) switch (_context8.prev = _context8.next) {
353
357
  case 0:
354
- _context8.prev = 0;
358
+ msg = res.message;
359
+ _context8.prev = 1;
355
360
  if (!msg) {
356
- _context8.next = 18;
361
+ _context8.next = 21;
357
362
  break;
358
363
  }
359
364
  props = JSON.parse(msg);
360
- props.content = props.message;
365
+ content = /*#__PURE__*/React.createElement(ErrorContent, {
366
+ requestId: res.requestId,
367
+ message: props.message
368
+ });
369
+ props.content = content;
370
+ props.message = content;
361
371
  if (!props.title) {
362
372
  props.title = "" + this.title + type;
363
373
  }
364
374
  if (!(props.type == "message")) {
365
- _context8.next = 10;
375
+ _context8.next = 13;
366
376
  break;
367
377
  }
368
378
  _message.error(props);
369
379
  return _context8.abrupt("return");
370
- case 10:
380
+ case 13:
371
381
  if (!(props.type == "modal")) {
372
- _context8.next = 15;
382
+ _context8.next = 18;
373
383
  break;
374
384
  }
375
385
  _Modal.error(props);
376
386
  return _context8.abrupt("return");
377
- case 15:
387
+ case 18:
378
388
  if (!(props.type == "notification")) {
379
- _context8.next = 18;
389
+ _context8.next = 21;
380
390
  break;
381
391
  }
382
392
  _notification.error(props);
383
393
  return _context8.abrupt("return");
384
- case 18:
385
- _context8.next = 24;
394
+ case 21:
395
+ _context8.next = 27;
386
396
  break;
387
- case 20:
388
- _context8.prev = 20;
389
- _context8.t0 = _context8["catch"](0);
397
+ case 23:
398
+ _context8.prev = 23;
399
+ _context8.t0 = _context8["catch"](1);
390
400
  console.error("" + this.title + type + (msg || ""));
391
401
  _Modal.error({
392
402
  title: "" + this.title + type,
393
403
  centered: true,
394
- content: /*#__PURE__*/React.createElement(_Typography.Text, {
395
- type: "danger"
396
- }, msg || "")
404
+ content: /*#__PURE__*/React.createElement(ErrorContent, {
405
+ requestId: res.requestId,
406
+ message: res.message
407
+ })
397
408
  });
398
- case 24:
409
+ case 27:
399
410
  case "end":
400
411
  return _context8.stop();
401
412
  }
402
- }, _callee8, this, [[0, 20]]);
413
+ }, _callee8, this, [[1, 23]]);
403
414
  }));
404
415
  function showError(_x15, _x16) {
405
416
  return _showError.apply(this, arguments);
@@ -408,13 +419,32 @@ export var BaseRestApi = /*#__PURE__*/function () {
408
419
  }();
409
420
  return BaseRestApi;
410
421
  }();
411
- function getStringId(item) {
412
- if (typeof (item === null || item === void 0 ? void 0 : item.id) === "string") {
413
- return item.id;
414
- } else if (typeof item === "string") {
415
- return item;
422
+ function ErrorContent(props) {
423
+ var content = /*#__PURE__*/React.createElement(_Typography.Text, {
424
+ type: "danger",
425
+ style: {
426
+ whiteSpace: "pre-wrap"
427
+ }
428
+ }, props.message || "");
429
+ if (props.requestId) {
430
+ return /*#__PURE__*/React.createElement("div", null, content, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
431
+ onClick: function onClick() {
432
+ _Modal.destroyAll();
433
+ _message.destroy();
434
+ _notification.destroy();
435
+ showForm({
436
+ layout: "modal",
437
+ form: {
438
+ id: "form_e3dbb9076a544f86a3bb6ec113e22494"
439
+ },
440
+ mode: "detail",
441
+ dataId: props.requestId
442
+ }).then();
443
+ }
444
+ }, "\u67E5\u770B\u65E5\u5FD7")));
445
+ } else {
446
+ return content;
416
447
  }
417
- return null;
418
448
  }
419
449
  export var RestApi = /*#__PURE__*/function (_BaseRestApi2) {
420
450
  function RestApi(uri, options) {
@@ -0,0 +1,2 @@
1
+ import { OneResult } from "./rest-api";
2
+ export declare function getSchema(pageId: string, mock?: boolean): Promise<OneResult<any>>;
@@ -0,0 +1,33 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { schema } from "../cache";
4
+ export function getSchema(_x, _x2) {
5
+ return _getSchema.apply(this, arguments);
6
+ }
7
+ function _getSchema() {
8
+ _getSchema = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pageId, mock) {
9
+ var key;
10
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
11
+ while (1) switch (_context.prev = _context.next) {
12
+ case 0:
13
+ if (typeof mock != "boolean") {
14
+ if (typeof window.__mock == "boolean") {
15
+ mock = window.__mock;
16
+ }
17
+ }
18
+ key = mock ? pageId + "_mock" : pageId;
19
+ _context.next = 4;
20
+ return schema.getInstance(key, {
21
+ mock: mock,
22
+ pageId: pageId
23
+ });
24
+ case 4:
25
+ return _context.abrupt("return", _context.sent);
26
+ case 5:
27
+ case "end":
28
+ return _context.stop();
29
+ }
30
+ }, _callee);
31
+ }));
32
+ return _getSchema.apply(this, arguments);
33
+ }
@@ -0,0 +1 @@
1
+ export declare function loadDts(): Promise<any[]>;
@@ -0,0 +1,41 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { getFormApi } from "./index";
4
+ export function loadDts() {
5
+ return _loadDts.apply(this, arguments);
6
+ }
7
+ function _loadDts() {
8
+ _loadDts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
9
+ var api, res;
10
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
11
+ while (1) switch (_context.prev = _context.next) {
12
+ case 0:
13
+ _context.prev = 0;
14
+ _context.next = 3;
15
+ return getFormApi("form_bea7fcc6376c4461965237056f970fb7");
16
+ case 3:
17
+ api = _context.sent;
18
+ _context.next = 6;
19
+ return api.search({
20
+ pageSize: 1000,
21
+ searchFields: [{
22
+ key: "type",
23
+ operator: "eq",
24
+ value: "dts"
25
+ }]
26
+ });
27
+ case 6:
28
+ res = _context.sent;
29
+ return _context.abrupt("return", res.data || []);
30
+ case 10:
31
+ _context.prev = 10;
32
+ _context.t0 = _context["catch"](0);
33
+ return _context.abrupt("return", []);
34
+ case 13:
35
+ case "end":
36
+ return _context.stop();
37
+ }
38
+ }, _callee, null, [[0, 10]]);
39
+ }));
40
+ return _loadDts.apply(this, arguments);
41
+ }
@@ -19,14 +19,20 @@ function _handleFormSchema() {
19
19
  return _regeneratorRuntime.wrap(function _callee$(_context) {
20
20
  while (1) switch (_context.prev = _context.next) {
21
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:
22
28
  formFieldSchema = new FormFieldSchema(schema.children[0], null);
23
29
  fdmItems = [];
24
30
  fieldIdMap = new Map();
25
31
  schema.state = schema.state || {};
26
32
  schema.methods = schema.methods || {};
27
- _context.next = 7;
33
+ _context.next = 9;
28
34
  return handleAssociationForm(formFieldSchema, schema);
29
- case 7:
35
+ case 9:
30
36
  //初次处理
31
37
  forEachFormSchema(schema, function (field) {
32
38
  if (field.fdmSchema) {
@@ -47,15 +53,15 @@ function _handleFormSchema() {
47
53
 
48
54
  //处理查询列
49
55
  _i = 0, _fdmItems = fdmItems;
50
- case 9:
56
+ case 11:
51
57
  if (!(_i < _fdmItems.length)) {
52
- _context.next = 17;
58
+ _context.next = 19;
53
59
  break;
54
60
  }
55
61
  fdmField = _fdmItems[_i];
56
- _context.next = 13;
62
+ _context.next = 15;
57
63
  return handleFdmAssociationAttributeFields(formFieldSchema, fdmField.fdmSchema);
58
- case 13:
64
+ case 15:
59
65
  forEachFormSchema(fdmField.fdmSchema, function (field) {
60
66
  var _field$props;
61
67
  var findSchema = fieldIdMap.get((_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.fieldId);
@@ -92,11 +98,11 @@ function _handleFormSchema() {
92
98
  }
93
99
  return true;
94
100
  });
95
- case 14:
101
+ case 16:
96
102
  _i++;
97
- _context.next = 9;
103
+ _context.next = 11;
98
104
  break;
99
- case 17:
105
+ case 19:
100
106
  case "end":
101
107
  return _context.stop();
102
108
  }
@@ -62,15 +62,10 @@ function _loadStyle() {
62
62
  case 2:
63
63
  return _context3.abrupt("return", new Promise( /*#__PURE__*/function () {
64
64
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve) {
65
- var callback, target;
65
+ var target;
66
66
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
67
67
  while (1) switch (_context2.prev = _context2.next) {
68
68
  case 0:
69
- callback = function _callback(status) {
70
- setTimeout(function () {
71
- resolve(status);
72
- }, 10);
73
- };
74
69
  //加载式样
75
70
  target = doc.querySelector("link[href='" + src + "']");
76
71
  if (!target) {
@@ -78,16 +73,16 @@ function _loadStyle() {
78
73
  target.href = src;
79
74
  target.rel = "stylesheet";
80
75
  target.onload = function () {
81
- return callback(true);
76
+ resolve(true);
82
77
  };
83
78
  target.onerror = function () {
84
- return callback(false);
79
+ resolve(false);
85
80
  };
86
81
  doc.head.appendChild(target);
87
82
  } else {
88
- callback(true);
83
+ resolve(true);
89
84
  }
90
- case 3:
85
+ case 2:
91
86
  case "end":
92
87
  return _context2.stop();
93
88
  }
@@ -125,10 +120,8 @@ function _loadScript() {
125
120
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
126
121
  while (1) switch (_context4.prev = _context4.next) {
127
122
  case 0:
128
- callback = function _callback2(status) {
129
- setTimeout(function () {
130
- resolve(status);
131
- }, 10);
123
+ callback = function _callback(status) {
124
+ resolve(status);
132
125
  };
133
126
  //加载脚本
134
127
  target = doc.querySelector("script[src='" + src + "']");
@@ -139,10 +132,10 @@ function _loadScript() {
139
132
  }
140
133
  target.src = src;
141
134
  target.onload = function () {
142
- return callback(true);
135
+ callback(true);
143
136
  };
144
137
  target.onerror = function () {
145
- return callback(false);
138
+ callback(false);
146
139
  };
147
140
  doc.body.appendChild(target);
148
141
  } else {
@@ -1,2 +1,3 @@
1
1
  export { loadPlugins } from "./LoadPlugins";
2
2
  export declare function uuid(prefix?: string, separator?: string): string;
3
+ export declare function toArray(data: any): any[];
@@ -1,7 +1,19 @@
1
1
  import { v4 } from "uuid";
2
2
  export { loadPlugins } from "./LoadPlugins";
3
3
  export function uuid(prefix, separator) {
4
+ if (!prefix && !separator) {
5
+ return v4();
6
+ }
4
7
  return [prefix, separator, v4()].filter(function (v) {
5
8
  return !!v;
6
9
  }).join("");
10
+ }
11
+ export function toArray(data) {
12
+ if (!data) {
13
+ return [];
14
+ } else if (Array.isArray(data)) {
15
+ return data;
16
+ } else {
17
+ return [data];
18
+ }
7
19
  }
@@ -1,5 +1,6 @@
1
1
  export { showForm } from "./page-form";
2
2
  export { showFormDataManager } from "./page-form-data-manager";
3
+ export { showFormDataManagerGroup } from "./page-form-data-manager-group";
3
4
  export declare function showLoading(): Promise<void>;
4
5
  export declare function hideLoading(): Promise<void>;
5
6
  export declare function openPage(url: string, target?: string): Promise<any>;
@@ -2,6 +2,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  export { showForm } from "./page-form";
4
4
  export { showFormDataManager } from "./page-form-data-manager";
5
+ export { showFormDataManagerGroup } from "./page-form-data-manager-group";
5
6
  var timerRef;
6
7
  function debounceHide() {
7
8
  if (timerRef) {
@@ -0,0 +1,17 @@
1
+ import { PageLayoutType } from "./page-layout";
2
+ export declare type PageFormDataManagerModeType = "page" | "selectOne" | "selectMore";
3
+ export interface ShowFormDataManagerGroupProps {
4
+ container?: HTMLDivElement;
5
+ layout?: PageLayoutType;
6
+ mode?: PageFormDataManagerModeType;
7
+ items: any[];
8
+ extraProps?: any;
9
+ defaultSelectedRows?: any[];
10
+ onClose?: () => void | Promise<void>;
11
+ onSearch?: (params: any[]) => void | Promise<void>;
12
+ onLoadData?: (response: {
13
+ data: any[];
14
+ total: number;
15
+ }) => void | Promise<void>;
16
+ }
17
+ export declare function showFormDataManagerGroup(options: ShowFormDataManagerGroupProps): Promise<any | any[]>;
@@ -0,0 +1,104 @@
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", "items", "onSelectOk", "onClose"],
6
+ _excluded2 = ["container", "onClose"];
7
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
+ import { PageLayout } from "./page-layout";
9
+ import React, { Component } from "react";
10
+ import { ReactRender } from "../../components/react-render";
11
+ import { cloneDataView } from "./page-schema-utils";
12
+ import { renderElement } from "./page-render";
13
+ import { v4 } from "uuid";
14
+ export function showFormDataManagerGroup(_x) {
15
+ return _showFormDataManagerGroup.apply(this, arguments);
16
+ }
17
+ function _showFormDataManagerGroup() {
18
+ _showFormDataManagerGroup = _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: FormDataManagerRender,
29
+ props: props
30
+ }
31
+ }));
32
+ case 2:
33
+ case "end":
34
+ return _context.stop();
35
+ }
36
+ }, _callee);
37
+ }));
38
+ return _showFormDataManagerGroup.apply(this, arguments);
39
+ }
40
+ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
41
+ function FormDataManagerRender() {
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(FormDataManagerRender, _Component);
51
+ var _proto = FormDataManagerRender.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
+ items = _this$props.items,
58
+ onSelectOk = _this$props.onSelectOk,
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
+ // @ts-ignore
70
+ restProps.onSelectOk = function (data) {
71
+ var _self$layoutRef2;
72
+ (_self$layoutRef2 = self.layoutRef) === null || _self$layoutRef2 === void 0 ? void 0 : _self$layoutRef2.close();
73
+ onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(data);
74
+ };
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
+ return /*#__PURE__*/React.createElement(PageLayout, {
81
+ layout: layout,
82
+ ref: function ref(layout) {
83
+ return _this2.layoutRef = layout;
84
+ }
85
+ }, /*#__PURE__*/React.createElement(ReactRender, _extends({}, restProps, {
86
+ components: window._components || window.components || window.__components,
87
+ schema: {
88
+ id: v4(),
89
+ componentName: "Page",
90
+ props: {},
91
+ state: {},
92
+ children: [{
93
+ componentName: "PageFdmGroup",
94
+ props: {
95
+ mode: restProps.mode,
96
+ defaultSelectedRows: restProps.defaultSelectedRows,
97
+ items: fdmItems
98
+ }
99
+ }]
100
+ }
101
+ })));
102
+ };
103
+ return FormDataManagerRender;
104
+ }(Component);
@@ -1,4 +1,5 @@
1
1
  import { PageLayoutType } from "./page-layout";
2
+ import { FilterRule } from "../api/rest-api";
2
3
  export declare type PageFormDataManagerModeType = "associationField" | "dataManager" | "selectOne" | "selectMore";
3
4
  export interface ShowPageFormDataManagerProps {
4
5
  container?: HTMLDivElement;
@@ -8,6 +9,11 @@ export interface ShowPageFormDataManagerProps {
8
9
  fieldId?: string;
9
10
  };
10
11
  mode?: PageFormDataManagerModeType;
12
+ dataView?: {
13
+ filterRules?: FilterRule[];
14
+ searchFields?: FilterRule[];
15
+ orderRules?: any[];
16
+ };
11
17
  extraProps?: any;
12
18
  onClose?: () => void | Promise<void>;
13
19
  onSearch?: (params: any[]) => void | Promise<void>;